!function(e, t) { "object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : t((e = e || self).Potree = {}) }(this, function(le) { "use strict"; function i(t, e) { var n, i = Object.keys(t); return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function(e) { return Object.getOwnPropertyDescriptor(t, e).enumerable })), i.push.apply(i, n)), i } function X(e) { return (X = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function l(e, t, n, i, r, a, o) { try { var s = e[a](o) , l = s.value } catch (e) { return void n(e) } s.done ? t(l) : Promise.resolve(l).then(i, r) } function r(s) { return function() { var e = this , o = arguments; return new Promise(function(t, n) { var i = s.apply(e, o); function r(e) { l(i, t, n, r, a, "next", e) } function a(e) { l(i, t, n, r, a, "throw", e) } r(void 0) } ) } } function O(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") } function o(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value"in i && (i.writable = !0), Object.defineProperty(e, i.key, i) } } function h(e, t, n) { return t && o(e.prototype, t), n && o(e, n), Object.defineProperty(e, "prototype", { writable: !1 }), e } function H(e, t, n) { return t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e } function y(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 && s(e, t) } function v(e) { return (v = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) { return e.__proto__ || Object.getPrototypeOf(e) } )(e) } function s(e, t) { return (s = Object.setPrototypeOf || function(e, t) { return e.__proto__ = t, e } )(e, t) } function u() { if ("undefined" == typeof Reflect || !Reflect.construct) return !1; if (Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } } function B(e, t, n) { return (B = u() ? Reflect.construct : function(e, t, n) { var i = [null]; i.push.apply(i, t); i = new (Function.bind.apply(e, i)); return n && s(i, n.prototype), i } ).apply(null, arguments) } function g(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e } function c(e, t) { if (t && ("object" == typeof t || "function" == typeof t)) return t; if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined"); return g(e) } function w(n) { var i = u(); return function() { var e, t = v(n); return c(this, i ? (e = v(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments)) } } function d(e, t) { for (; !Object.prototype.hasOwnProperty.call(e, t) && null !== (e = v(e)); ) ; return e } function b() { return (b = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(e, t, n) { var i = d(e, t); if (i) { t = Object.getOwnPropertyDescriptor(i, t); return t.get ? t.get.call(arguments.length < 3 ? e : n) : t.value } } ).apply(this, arguments) } function N(e, t) { return p(e) || function(e, t) { var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"]; if (null != n) { var i, r, a = [], o = !0, s = !1; try { for (n = n.call(e); !(o = (i = n.next()).done) && (a.push(i.value), !t || a.length !== t); o = !0) ; } catch (e) { s = !0, r = e } finally { try { o || null == n.return || n.return() } finally { if (s) throw r } } return a } }(e, t) || f(e, t) || E() } function Q(e) { return function(e) { if (Array.isArray(e)) return m(e) }(e) || t(e) || f(e) || function() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") }() } function p(e) { if (Array.isArray(e)) return e } function t(e) { if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e) } function f(e, t) { if (e) { if ("string" == typeof e) return m(e, t); var n = Object.prototype.toString.call(e).slice(8, -1); return "Map" === (n = "Object" === n && e.constructor ? e.constructor.name : n) || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? m(e, t) : void 0 } } function m(e, t) { (null == t || t > e.length) && (t = e.length); for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n]; return i } 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 ue(e, t) { var n = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"]; if (!n) { if (Array.isArray(e) || (n = f(e)) || t && e && "number" == typeof e.length) { n && (e = n); var i = 0 , t = function() {}; return { s: t, n: function() { return i >= e.length ? { done: !0 } : { done: !1, value: e[i++] } }, e: function(e) { throw e }, f: t } } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") } var r, a = !0, o = !1; return { s: function() { n = n.call(e) }, n: function() { var e = n.next(); return a = e.done, e }, e: function(e) { o = !0, r = e }, f: function() { try { a || null == n.return || n.return() } finally { if (o) throw r } } } } function _(e, t) { e = (e = window.navigator.userAgent.match(e)) ? e[1].split(t) : []; return { major: parseInt(e[0]) || 0, minor: parseInt(e[1]) || 0, patch: parseInt(e[2]) || 0 } } var A = { isFullscreen: function() { return document.fullscreenElement || document.mozFullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement }, supportsFullscreen: function() { return document.fullscreenEnabled || document.mozFullscreenEnabled || document.mozFullScreenEnabled || document.webkitFullscreenEnabled || document.msFullscreenEnabled }, isPointerLocked: function() { return document.pointerLockElement || document.mozPointerLockElement || document.webkitPointerLockElement }, requestFullscreen: function(e, t) { e.requestFullscreen ? e.requestFullscreen() : e.mozRequestFullScreen ? e.mozRequestFullScreen() : e.webkitRequestFullscreen ? e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT) : e.msRequestFullscreen && e.msRequestFullscreen(), t && $(document).on("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange", A.requestPointerLock) }, requestPointerLock: function() { var e; if (document.fullscreenElement) e = document.fullscreenElement(); else if (document.mozFullscreenElement) e = document.mozFullscreenElement(); else if (document.mozFullScreenElement) e = document.mozFullScreenElement(); else { if (!document.webkitFullscreenElement) return; e = document.webkitFullscreenElement() } e.requestPointerLock = e.requestPointerLock || e.mozRequestPointerLock || e.webkitRequestPointerLock, e.requestPointerLock(), $(document).off("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange", this) }, exitPointerLock: function() { document.exitPointerLock = document.exitPointerLock || document.mozExitPointerLock || document.webkitExitPointerLock, document.exitPointerLock() }, exitFullscreen: function() { document.exitFullscreen ? document.exitFullscreen() : document.msExitFullscreen ? document.msExitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen() }, details: function() { var e = navigator.userAgent.match("(Firefox|Chrome|Safari)/([\\d]+)"); return e ? { name: e[1], version: parseInt(e[2]), platform: navigator.platform } : {} }, is: function(e) { return this.details() && this.details().name === e }, inIframe: function() { return window.parent !== window }, aspectRatio: function(e) { e = (e = e || $("#player")).width() / e.height(); return isFinite(e) ? e : 0 }, userAgent: function() { return window.navigator.userAgent }, isMobile: function() { var e = navigator.userAgent || navigator.vendor || window.opera; return /(android|bb\d+|meego).+mobile|android|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0, 4)) }, isLandscape: function() { return this.isMobile && 1 < this.aspectRatio() }, isSmallScreen: function() { return screen.width / window.devicePixelRatio < 240 }, detectIE: function() { return -1 !== window.navigator.userAgent.indexOf("MSIE ") || !!navigator.userAgent.match(/Trident.*rv\:11\./) }, detectSafari: function() { return -1 !== window.navigator.userAgent.indexOf("Safari") && !this.detectOpera() && !this.detectChrome() }, detectFirefox: function() { return -1 !== window.navigator.userAgent.indexOf("Firefox") }, detectChrome: function() { return -1 !== window.navigator.userAgent.indexOf("Chrome") && !this.detectOpera() }, detectOpera: function() { return -1 !== window.navigator.userAgent.indexOf("OPR") }, detectIOS: function() { return this.detectIPhone() || this.detectIPad() || this.detectIPod() }, detectIPad: function() { var e = window.navigator.userAgent; return /iPad/.test(e) }, detectIPod: function() { var e = window.navigator.userAgent; return /iPod/.test(e) }, detectIPhone: function() { var e = window.navigator.userAgent; return /iPhone/.test(e) }, detectAndroid: function() { return -1 !== window.navigator.userAgent.indexOf("Android") }, detectAndroidMobile: function() { var e = window.navigator.userAgent; return this.detectAndroid() && -1 !== e.indexOf("Mobile") }, detectSamsungNative: function() { var e = window.navigator.userAgent; return -1 !== e.indexOf("SM-G900H") || -1 !== e.indexOf("GT-I9500") || -1 !== e.indexOf("SM-N900") }, detectSamsungS6: function() { return -1 !== window.navigator.userAgent.indexOf("SM-G92") }, detectHUAWEI5X: function() { return -1 !== window.navigator.userAgent.indexOf("KIW-TL00H") }, detectWebVR: function() { return !(!window.navigator.getVRDisplays || !window.VRDisplay) }, getVRDisplay: function() { var t = $.Deferred(); return this.detectWebVR() ? (navigator.getVRDisplays().then(function(e) { 1 <= e.length && t.resolve(e[0]), t.reject(null) }), t) : t.reject(null) }, iosVersion: function() { if (!this.detectIOS()) throw new DeviceMismatchException("Did not detect an iDevice"); return _(/((?:\d+\_?){1,3}) like Mac OS/, "_") }, androidVersion: function() { if (!this.detectAndroid()) throw new DeviceMismatchException("Did not detect an Android based device"); return _(/Android ((?:\d+\.?){1,3})/, ".") }, valueFromCookie: function(e, t) { e = new RegExp(e + "=([0-9a-f]+)(; ?|$)").exec(document.cookie); if (!e) return t; e = e[1]; return "boolean" == typeof t ? "true" === e || "1" === e : "number" == typeof t ? parseFloat(e) : e }, valueFromHash: function(e, t) { e = new RegExp("[#&?]" + e + "=([^#&?]*)").exec(window.location.href); if (!e) return t; e = e[1]; return "boolean" == typeof t ? "true" === e || "1" === e : "number" == typeof t ? parseFloat(e) : window.decodeURIComponent(e) }, getProjectNum: function() { if (window.__ProjectNum && "__ProjectNum__" != window.__ProjectNum) return window.__ProjectNum; var e = window.location.href.substring(window.location.href.indexOf("=") + 1); return e = -1 != (e = -1 != e.indexOf("&") ? e.substring(0, e.indexOf("&")) : e).indexOf("#") ? e.substring(0, e.indexOf("#")) : e }, urlHasValue: function(e, t) { if ("m" === e && window.__ProjectNum && "__ProjectNum__" != window.__ProjectNum) return window.__ProjectNum; var n = window.location.search.substr(1).split("&"); if (t) { for (var i = 0; i < n.length; i++) { var r = n[i].split("="); if (2 === r.length && r[0] === e) return r[1] } return "" } for (var a = 0; a < n.length; a++) if (n[a].split("=")[0] == e) return !0; return !1 }, urlQueryValue: function(e) { return this.urlHasValue(e, !0) || "" }, urlHashValue: function(e) { for (var t = window.location.hash.substr(1).replace("/?", "").split("&"), n = 0; n < t.length; n++) { var i = t[n].split("="); if (2 === i.length && i[0] === e) return i[1] } return "" }, urlIsHasHash: function(e) { return window.location.hash.substr(1).replace("/?", "").split("&").includes(e) }, islongPhone: function() { var e = screen.height / screen.width; return this.isMobile() && (1.99 < e || e < .502512) }, detectWeixin: function() { return "micromessenger" == window.navigator.userAgent.toLowerCase().match(/MicroMessenger/i) }, detectWeixinMiniProgram: function() { return window.navigator.userAgent.match("miniProgram") }, detectEdge: function() { return -1 < window.navigator.userAgent.indexOf("Edge") }, detectApp: function() { return this.urlHasValue("app") }, isTabHidden: function() { var e = ["webkit", "moz", "ms", "o"]; if ("hidden"in document) return document.hidden; for (var t = 0; t < e.length; t++) if (e[t] + "Hidden"in document) return document[e[t] + "Hidden"]; return !1 } } , T = { displayMode: { showPointCloud: { atPano: { showPoint: !0, showSkybox: !function(e) { return this._invoke("return", e) } , pointUsePanoTex: !1 }, transition: { showPoint: !0, showSkybox: !1, pointUsePanoTex: !1 }, canLeavePano: !0 }, showPanos: { atPano: { showPoint: !1, showSkybox: !0, pointUsePanoTex: !1 }, transition: { showSkybox: !0 }, canLeavePano: !1 }, showBoth: { atPano: { showPoint: !0, showSkybox: !0, pointUsePanoTex: !1 }, transition: { showPoint: !0, showSkybox: !0, pointUsePanoTex: !0 }, canLeavePano: !0 }, pointUsePanoTex: { atPano: { showPoint: !0, showSkybox: !1, pointUsePanoTex: !0 }, transition: { showPoint: !0, showSkybox: !0, pointUsePanoTex: !0 }, canLeavePano: !1 } }, urls: { prefix: "https://laser-oss.4dkankan.com", prefix2: "https://testlaser.4dkankan.com", prefix3: "https://4dkk.4dage.com", prefix4: "https://uat-laser.4dkankan.com/" }, transitionsTime: { flyMinTime: 500, flytimeDistanceMultiplier: 150, panoToPanoMax: 2e3, flyIn: 1e3, flyOut: 1e3 }, moveSpeedAdujust: .5, view: { fov: 70, near: .1, far: 1e4 }, map: { mapHeight: -1e3, cameraHeight: 1e3 }, pointDensity: { magnifier: { maxLevelPercent: 1, pointBudget: 8e6 }, panorama: { maxLevelPercent: .6, pointBudget: A.isMobile() ? 1e5 : 4e5 }, fourViewports: { maxLevelPercent: .4, pointBudget: 1e6 }, fourViewportsMain: { maxLevelPercent: .8, pointBudget: 1e6 }, panoEdit: { maxLevelPercent: 1, pointBudget: 1e6 }, low: { maxLevelPercent: .4, percentByUser: !0, pointBudget: 1e6 }, middle: { maxLevelPercent: .7, percentByUser: !0, pointBudget: A.isMobile() ? 4e6 : 2e6 }, high: { maxLevelPercent: 1, percentByUser: !0, pointBudget: A.isMobile() ? 8e6 : 4e6 } }, clip: { color: "#FFC266" }, panoFieldRadius: 10, measure: { color: "#00C8AF", default: { color: "#64C8BB", opacity: .7 }, highlight: { color: "#00C8AF", opacity: 1 }, guide: { color: "#FFFFFF", opacity: 1 }, backColor: "#333333", lineWidth: 4, textColor: "#FFFFFF" }, material: { pointSize: .1, realPointSize: .1, minSize: .1, maxSize: 1e4, pointSizeType: "ATTENUATED", absolutePanoramaSize: 1.3, pointColor: "#ffffff" }, renderLayers: { bg: 20, bg2: 21, skybox: 1, pointcloud: 11, sceneObjects: 0, model: 2, measure: 4, magnifier: 5, magnifierContent: 16, volume: 6, transformationTool: 7, map: 8, mapObjects: 9, bothMapAndScene: 3, siteModeOnlyMapVisi: 12, siteModelMapUnvisi: 13, siteModeSideVisi: 14 }, siteModel: { names: { building: "建筑", floor: "楼层", room: "房间" }, floorHeightDefault: 5 }, panosEdit: {}, tiling: { panoPreRenderRepeatDelay: 2500, panoPreRenderDelay: 500, preRenderTourPanos: A.valueFromHash("tileprerender", 0), tilingFlagNames: ["usetiles", "tiles"], maxNavPanoQuality: A.valueFromHash("maxtileq", null), maxZoomPanoQuality: A.valueFromHash("maxztileq", null), overlayStyle: A.valueFromHash("tileoverlay", 0), uploadIntervalDelay: A.valueFromHash("tileupdelay", 10), initialIntervalDelay: A.valueFromHash("itiledelay", 0), maxNonBaseUploadsPerFrame: A.valueFromHash("maxnbtpf", 2), maxBaseUploadsPerFrame: A.valueFromHash("maxbtpf", 6), customCompression: A.valueFromHash("tilecustcomp", 0), mobileHighQualityOverride: !1, allowUltraHighResolution: !0 }, navigation: { panoScores: !1, mouseDirection: !0, filterStrictness: .75, angleFactor: -30, directionFactor: 10, distanceFactor: -1, optionalityFactor: 3 }, axis: { x: { color: "#d0021b" }, y: { color: "#86c542" }, z: { color: "#3399c8" } }, highQualityMaxZoom: 2, ultraHighQualityMaxZoom: 3, clickMaxDragDis: 5, clickMaxPressTime: 500, doubleClickTime: 200, background: "#232323", mapBG: "#F5F5F5", colors: { red: [213, 0, 0], pink: [197, 17, 98], purple: [170, 0, 255], "deep purple": [98, 0, 234], blue: [41, 98, 255], "light blue": [0, 145, 234], cyan: [0, 184, 212], teal: [0, 191, 165], green: [0, 200, 83], "light green": [100, 221, 23], lime: [174, 234, 0], yellow: [255, 214, 0], amber: [255, 171, 0], orange: [255, 109, 0], "deep orange": [255, 61, 0] } }; T.OrthoCameraLimit = { standard: { zoom: { min: .001, max: 500 }, posBound: { min: { x: -1e5, y: -1e5, z: T.map.cameraHeight }, max: { x: 1e5, y: 1e5, z: 1 / 0 } } }, expand: { zoom: { min: 4e-4, max: 100 }, posBound: { min: { x: -5e6, y: -1e6, z: T.map.cameraHeight }, max: { x: 5e6, y: 1e6, z: 1 / 0 } } } }; var S = { editType: "", number: "", originDatasetId: "", isOfficial: !(window.testLevelSteps = function(e) { var t; e || (e = [(t = Potree.config.pointDensity).low.maxLevelPercent, t.middle.maxLevelPercent, t.high.maxLevelPercent]); for (var n = 1; ++n <= 12; ) { var i = e.map(function(e) { return e * n }) , r = e.map(function(e) { return Math.round(e * n) }); console.log("当nodeMaxLevel为".concat(n, "时,每一级的level分别为").concat(r, ", (小数:").concat(i, ")")) } console.log("请检查每一层的三个level是否有重复") } ), webSite: "testdata", isLocal: !1, libsUrl: "../libs/", displayMode: "", isTest: A.urlHasValue("test"), prefix: window.location.href.split("//")[1].split("/")[0], pointDensity: "", UserPointDensity: "", UserDensityPercent: null, ifShowMarker: !0, floorplanType: {}, floorplanEnable: !1, floorplanEnables: {}, floorplanRequests: {}, mapEnable: !0, cameraFar: T.view.far, showPanoMesh: !1, dblToFocusPoint: !1, unableNavigate: !1, sizeFitToLevel: !1, zoom: { enabled: !0, min: 1, max: T.highQualityMaxZoom, activationThreshold: 1.1 }, navConstantly: !0, navTileClass: A.isMobile() ? "1k" : "2k", tileClass: "4k", drawEntityData: !1, zoomFromPointert: { whenPanos: !0, whenPointCloud: !0, map: !0 }, rotAroundPoint: !0, tourTestCameraMove: !1, cameraAniSmoothRatio: 20, urls: $.extend({}, T.urls), useDepthTex: !0, datasetsPanos: {}, boundAddObjs: !1, intersectOnObjs: !1, intersectWhenHover: !0 }; S.isLocalhost = S.prefix.includes("localhost"); var C = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 } , V = 0 , j = 1 , W = 2 , P = 1 , D = 3 , q = 0 , J = 1 , Y = 2 , Z = 0 , K = 1 , ee = 2 , te = 3 , ne = 4 , ie = 5 , re = 100 , ae = 101 , oe = 102 , se = 103 , ce = 104 , de = 200 , he = 201 , pe = 202 , fe = 203 , me = 204 , ve = 205 , ge = 206 , ye = 207 , we = 208 , be = 209 , xe = 210 , Ee = 0 , _e = 1 , Me = 2 , Ae = 3 , Te = 4 , Se = 5 , Ce = 6 , Pe = 7 , k = 0 , De = 0 , L = 301 , R = 302 , F = 303 , I = 304 , z = 306 , U = 307 , ke = 1e3 , Be = 1001 , Le = 1002 , Re = 1003 , Fe = 1004 , Ie = 1005 , Oe = 1006 , ze = 1007 , Ne = 1008 , G = 1008 , Ue = 1009 , Ge = 1010 , He = 1011 , Ve = 1012 , je = 1013 , We = 1014 , Xe = 1015 , qe = 1016 , Je = 1017 , Ye = 1018 , Ze = 1019 , Qe = 1020 , Ke = 1021 , $e = 1022 , et = 1023 , tt = 1024 , nt = 1025 , it = et , rt = 1026 , at = 1027 , ot = 1028 , st = 1029 , lt = 1030 , ut = 1031 , ct = 1032 , dt = 1033 , ht = 33776 , pt = 33777 , ft = 33778 , mt = 33779 , vt = 35840 , gt = 35841 , yt = 35842 , wt = 35843 , bt = 36196 , xt = 37492 , Et = 37496 , _t = 37808 , Mt = 37809 , At = 37810 , Tt = 37811 , St = 37812 , Ct = 37813 , Pt = 37814 , Dt = 37815 , kt = 37816 , Bt = 37817 , Lt = 37818 , Rt = 37819 , Ft = 37820 , It = 37821 , Ot = 36492 , zt = 37840 , Nt = 37841 , Ut = 37842 , Gt = 37843 , Ht = 37844 , Vt = 37845 , jt = 37846 , Wt = 37847 , Xt = 37848 , qt = 37849 , Jt = 37850 , Yt = 37851 , Zt = 37852 , Qt = 37853 , Kt = 2300 , $t = 2301 , en = 2400 , tn = 2401 , nn = 2402 , rn = 3e3 , an = 3001 , on = 3201 , sn = 0 , ln = 1 , un = 35044 , cn = 35048 , dn = "300 es"; function hn() {} Object.assign(hn.prototype, { addEventListener: function(e, t) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0; void 0 === this._listeners && (this._listeners = {}); var i = this._listeners; void 0 === i[e] && (i[e] = []), i[e].some(function(e) { return e.listener == t }) || (i[e].push({ listener: t, importance: n }), i[e] = i[e].sort(function(e, t) { return t.importance - e.importance })) }, hasEventListener: function(e, t) { if (void 0 === this._listeners) return !1; var n = this._listeners; return void 0 !== n[e] && n[e].some(function(e) { return e.listener == t }) }, removeEventListener: function(e, t) { var n; void 0 !== this._listeners && (void 0 === (n = this._listeners[e]) || (e = n.find(function(e) { return e.listener == t })) && n.splice(n.indexOf(e), 1)) }, removeEventListeners: function(e) { this._listeners && void 0 !== this._listeners[e] && delete this._listeners[e] }, removeAllListeners: function() { this._listeners = {} }, dispatchEvent: function(e) { if ("string" == typeof e && (e = { type: e }), void 0 !== this._listeners) { var t = this._listeners[e.type]; if (void 0 !== t) { e.target = this; var n, i = ue(t.slice(0)); try { for (i.s(); !(n = i.n()).done; ) { var r = n.value.listener.call(this, e); if (r && r.stopContinue) break } } catch (e) { i.e(e) } finally { i.f() } } } } }); for (var pn = [], fn = 0; fn < 256; fn++) pn[fn] = (fn < 16 ? "0" : "") + fn.toString(16); var mn, vn = 1234567, gn = { DEG2RAD: Math.PI / 180, RAD2DEG: 180 / Math.PI, generateUUID: function() { var e = 4294967295 * Math.random() | 0 , t = 4294967295 * Math.random() | 0 , n = 4294967295 * Math.random() | 0 , i = 4294967295 * Math.random() | 0; return (pn[255 & e] + pn[e >> 8 & 255] + pn[e >> 16 & 255] + pn[e >> 24 & 255] + "-" + pn[255 & t] + pn[t >> 8 & 255] + "-" + pn[t >> 16 & 15 | 64] + pn[t >> 24 & 255] + "-" + pn[63 & n | 128] + pn[n >> 8 & 255] + "-" + pn[n >> 16 & 255] + pn[n >> 24 & 255] + pn[255 & i] + pn[i >> 8 & 255] + pn[i >> 16 & 255] + pn[i >> 24 & 255]).toUpperCase() }, clamp: function(e, t, n) { return Math.max(t, Math.min(n, e)) }, euclideanModulo: function(e, t) { return (e % t + t) % t }, mapLinear: function(e, t, n, i, r) { return i + (e - t) * (r - i) / (n - t) }, lerp: function(e, t, n) { return (1 - n) * e + n * t }, smoothstep: function(e, t, n) { return e <= t ? 0 : n <= e ? 1 : (e = (e - t) / (n - t)) * e * (3 - 2 * e) }, smootherstep: function(e, t, n) { return e <= t ? 0 : n <= e ? 1 : (e = (e - t) / (n - t)) * e * e * (e * (6 * e - 15) + 10) }, randInt: function(e, t) { return e + Math.floor(Math.random() * (t - e + 1)) }, randFloat: function(e, t) { return e + Math.random() * (t - e) }, randFloatSpread: function(e) { return e * (.5 - Math.random()) }, seededRandom: function(e) { return ((vn = 16807 * (vn = void 0 !== e ? e % 2147483647 : vn) % 2147483647) - 1) / 2147483646 }, degToRad: function(e) { return e * gn.DEG2RAD }, radToDeg: function(e) { return e * gn.RAD2DEG }, isPowerOfTwo: function(e) { return 0 == (e & e - 1) && 0 !== e }, ceilPowerOfTwo: function(e) { return Math.pow(2, Math.ceil(Math.log(e) / Math.LN2)) }, floorPowerOfTwo: function(e) { return Math.pow(2, Math.floor(Math.log(e) / Math.LN2)) }, setQuaternionFromProperEuler: function(e, t, n, i, r) { var a = Math.cos , o = Math.sin , s = a(n / 2) , l = o(n / 2) , u = a((t + i) / 2) , c = o((t + i) / 2) , d = a((t - i) / 2) , h = o((t - i) / 2) , p = a((i - t) / 2) , f = o((i - t) / 2); switch (r) { case "XYX": e.set(s * c, l * d, l * h, s * u); break; case "YZY": e.set(l * h, s * c, l * d, s * u); break; case "ZXZ": e.set(l * d, l * h, s * c, s * u); break; case "XZX": e.set(s * c, l * f, l * p, s * u); break; case "YXY": e.set(l * p, s * c, l * f, s * u); break; case "ZYZ": e.set(l * f, l * p, s * c, s * u); break; default: console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + r) } } }, yn = function() { function n() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0 , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; O(this, n), Object.defineProperty(this, "isVector2", { value: !0 }), this.x = e, this.y = t } return h(n, [{ key: "width", get: function() { return this.x }, set: function(e) { this.x = e } }, { key: "height", get: function() { return this.y }, set: function(e) { this.y = e } }, { key: "set", value: function(e, t) { return this.x = e, this.y = t, this } }, { key: "setScalar", value: function(e) { return this.x = e, this.y = e, this } }, { key: "setX", value: function(e) { return this.x = e, this } }, { key: "setY", value: function(e) { return this.y = e, this } }, { key: "setComponent", value: function(e, t) { switch (e) { case 0: this.x = t; break; case 1: this.y = t; break; default: throw new Error("index is out of range: " + e) } return this } }, { key: "getComponent", value: function(e) { switch (e) { case 0: return this.x; case 1: return this.y; default: throw new Error("index is out of range: " + e) } } }, { key: "clone", value: function() { return new this.constructor(this.x,this.y) } }, { key: "copy", value: function(e) { return this.x = e.x, this.y = e.y, this } }, { key: "add", value: function(e, t) { return void 0 !== t ? (console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this) } }, { key: "addScalar", value: function(e) { return this.x += e, this.y += e, this } }, { key: "addVectors", value: function(e, t) { return this.x = e.x + t.x, this.y = e.y + t.y, this } }, { key: "addScaledVector", value: function(e, t) { return this.x += e.x * t, this.y += e.y * t, this } }, { key: "sub", value: function(e, t) { return void 0 !== t ? (console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this) } }, { key: "subScalar", value: function(e) { return this.x -= e, this.y -= e, this } }, { key: "subVectors", value: function(e, t) { return this.x = e.x - t.x, this.y = e.y - t.y, this } }, { key: "multiply", value: function(e) { return this.x *= e.x, this.y *= e.y, this } }, { key: "multiplyScalar", value: function(e) { return this.x *= e, this.y *= e, this } }, { key: "divide", value: function(e) { return this.x /= e.x, this.y /= e.y, this } }, { key: "divideScalar", value: function(e) { return this.multiplyScalar(1 / e) } }, { key: "applyMatrix3", value: function(e) { var t = this.x , n = this.y , e = e.elements; return this.x = e[0] * t + e[3] * n + e[6], this.y = e[1] * t + e[4] * n + e[7], this } }, { key: "min", value: function(e) { return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this } }, { key: "max", value: function(e) { return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this } }, { key: "clamp", value: function(e, t) { return this.x = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this } }, { key: "clampScalar", value: function(e, t) { return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this } }, { key: "clampLength", value: function(e, t) { var n = this.length(); return this.divideScalar(n || 1).multiplyScalar(Math.max(e, Math.min(t, n))) } }, { key: "floor", value: function() { return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this } }, { key: "ceil", value: function() { return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this } }, { key: "round", value: function() { return this.x = Math.round(this.x), this.y = Math.round(this.y), this } }, { key: "roundToZero", value: function() { return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this } }, { key: "negate", value: function() { return this.x = -this.x, this.y = -this.y, this } }, { key: "dot", value: function(e) { return this.x * e.x + this.y * e.y } }, { key: "cross", value: function(e) { return this.x * e.y - this.y * e.x } }, { key: "lengthSq", value: function() { return this.x * this.x + this.y * this.y } }, { key: "length", value: function() { return Math.sqrt(this.x * this.x + this.y * this.y) } }, { key: "manhattanLength", value: function() { return Math.abs(this.x) + Math.abs(this.y) } }, { key: "normalize", value: function() { return this.divideScalar(this.length() || 1) } }, { key: "angle", value: function() { return Math.atan2(-this.y, -this.x) + Math.PI } }, { key: "distanceTo", value: function(e) { return Math.sqrt(this.distanceToSquared(e)) } }, { key: "distanceToSquared", value: function(e) { var t = this.x - e.x , e = this.y - e.y; return t * t + e * e } }, { key: "manhattanDistanceTo", value: function(e) { return Math.abs(this.x - e.x) + Math.abs(this.y - e.y) } }, { key: "setLength", value: function(e) { return this.normalize().multiplyScalar(e) } }, { key: "lerp", value: function(e, t) { return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this } }, { key: "lerpVectors", value: function(e, t, n) { return this.x = e.x + (t.x - e.x) * n, this.y = e.y + (t.y - e.y) * n, this } }, { key: "equals", value: function(e) { return e.x === this.x && e.y === this.y } }, { key: "fromArray", value: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; return this.x = e[t], this.y = e[t + 1], this } }, { key: "toArray", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [] , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; return e[t] = this.x, e[t + 1] = this.y, e } }, { key: "fromBufferAttribute", value: function(e, t, n) { return void 0 !== n && console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."), this.x = e.getX(t), this.y = e.getY(t), this } }, { key: "rotateAround", value: function(e, t) { var n = Math.cos(t) , i = Math.sin(t) , r = this.x - e.x , t = this.y - e.y; return this.x = r * n - t * i + e.x, this.y = r * i + t * n + e.y, this } }, { key: "random", value: function() { return this.x = Math.random(), this.y = Math.random(), this } }]), n }(), wn = function() { function e() { O(this, e), Object.defineProperty(this, "isMatrix3", { value: !0 }), this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1], 0 < arguments.length && console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.") } return h(e, [{ key: "set", value: function(e, t, n, i, r, a, o, s, l) { var u = this.elements; return u[0] = e, u[1] = i, u[2] = o, u[3] = t, u[4] = r, u[5] = s, u[6] = n, u[7] = a, u[8] = l, this } }, { key: "identity", value: function() { return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this } }, { key: "clone", value: function() { return (new this.constructor).fromArray(this.elements) } }, { key: "copy", value: function(e) { var t = this.elements , e = e.elements; return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], this } }, { key: "extractBasis", value: function(e, t, n) { return e.setFromMatrix3Column(this, 0), t.setFromMatrix3Column(this, 1), n.setFromMatrix3Column(this, 2), this } }, { key: "setFromMatrix4", value: function(e) { e = e.elements; return this.set(e[0], e[4], e[8], e[1], e[5], e[9], e[2], e[6], e[10]), this } }, { key: "multiply", value: function(e) { return this.multiplyMatrices(this, e) } }, { key: "premultiply", value: function(e) { return this.multiplyMatrices(e, this) } }, { key: "multiplyMatrices", value: function(e, t) { var n = e.elements , i = t.elements , r = this.elements , a = n[0] , o = n[3] , s = n[6] , l = n[1] , u = n[4] , c = n[7] , d = n[2] , h = n[5] , p = n[8] , f = i[0] , m = i[3] , v = i[6] , g = i[1] , y = i[4] , e = i[7] , t = i[2] , n = i[5] , i = i[8]; return r[0] = a * f + o * g + s * t, r[3] = a * m + o * y + s * n, r[6] = a * v + o * e + s * i, r[1] = l * f + u * g + c * t, r[4] = l * m + u * y + c * n, r[7] = l * v + u * e + c * i, r[2] = d * f + h * g + p * t, r[5] = d * m + h * y + p * n, r[8] = d * v + h * e + p * i, this } }, { key: "multiplyScalar", value: function(e) { var t = this.elements; return t[0] *= e, t[3] *= e, t[6] *= e, t[1] *= e, t[4] *= e, t[7] *= e, t[2] *= e, t[5] *= e, t[8] *= e, this } }, { key: "determinant", value: function() { var e = this.elements , t = e[0] , n = e[1] , i = e[2] , r = e[3] , a = e[4] , o = e[5] , s = e[6] , l = e[7] , e = e[8]; return t * a * e - t * o * l - n * r * e + n * o * s + i * r * l - i * a * s } }, { key: "invert", value: function() { var e = this.elements , t = e[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 = u * a - o * l , d = o * s - u * r , h = l * r - a * s , p = t * c + n * d + i * h; if (0 == p) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0); p = 1 / p; return e[0] = c * p, e[1] = (i * l - u * n) * p, e[2] = (o * n - i * a) * p, e[3] = d * p, e[4] = (u * t - i * s) * p, e[5] = (i * r - o * t) * p, e[6] = h * p, e[7] = (n * s - l * t) * p, e[8] = (a * t - n * r) * p, this } }, { key: "transpose", value: function() { var e = this.elements , t = e[1]; return e[1] = e[3], e[3] = t, t = e[2], e[2] = e[6], e[6] = t, t = e[5], e[5] = e[7], e[7] = t, this } }, { key: "getNormalMatrix", value: function(e) { return this.setFromMatrix4(e).copy(this).invert().transpose() } }, { key: "transposeIntoArray", value: function(e) { var t = this.elements; return e[0] = t[0], e[1] = t[3], e[2] = t[6], e[3] = t[1], e[4] = t[4], e[5] = t[7], e[6] = t[2], e[7] = t[5], e[8] = t[8], this } }, { key: "setUvTransform", value: function(e, t, n, i, r, a, o) { var s = Math.cos(r) , r = Math.sin(r); return this.set(n * s, n * r, -n * (s * a + r * o) + a + e, -i * r, i * s, -i * (-r * a + s * o) + o + t, 0, 0, 1), this } }, { key: "scale", value: function(e, t) { var n = this.elements; return n[0] *= e, n[3] *= e, n[6] *= e, n[1] *= t, n[4] *= t, n[7] *= t, this } }, { key: "rotate", value: function(e) { var t = Math.cos(e) , n = Math.sin(e) , i = this.elements , r = i[0] , a = i[3] , o = i[6] , s = i[1] , l = i[4] , e = i[7]; return i[0] = t * r + n * s, i[3] = t * a + n * l, i[6] = t * o + n * e, i[1] = -n * r + t * s, i[4] = -n * a + t * l, i[7] = -n * o + t * e, this } }, { key: "translate", value: function(e, t) { var n = this.elements; return n[0] += e * n[2], n[3] += e * n[5], n[6] += e * n[8], n[1] += t * n[2], n[4] += t * n[5], n[7] += t * n[8], this } }, { key: "equals", value: function(e) { for (var t = this.elements, n = e.elements, i = 0; i < 9; i++) if (t[i] !== n[i]) return !1; return !0 } }, { key: "fromArray", value: function(e) { for (var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, n = 0; n < 9; n++) this.elements[n] = e[n + t]; return this } }, { key: "toArray", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [] , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0 , n = this.elements; return e[t] = n[0], e[t + 1] = n[1], e[t + 2] = n[2], e[t + 3] = n[3], e[t + 4] = n[4], e[t + 5] = n[5], e[t + 6] = n[6], e[t + 7] = n[7], e[t + 8] = n[8], e } }]), e }(), bn = { getDataURL: function(e) { if (/^data:/i.test(e.src)) return e.src; if ("undefined" == typeof HTMLCanvasElement) return e.src; var t, e = e instanceof HTMLCanvasElement ? e : ((mn = void 0 === mn ? document.createElementNS("http://www.w3.org/1999/xhtml", "canvas") : mn).width = e.width, mn.height = e.height, t = mn.getContext("2d"), e instanceof ImageData ? t.putImageData(e, 0, 0) : t.drawImage(e, 0, 0, e.width, e.height), mn); return 2048 < e.width || 2048 < e.height ? e.toDataURL("image/jpeg", .6) : e.toDataURL("image/png") } }, xn = 0; function En() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : En.DEFAULT_IMAGE , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : En.DEFAULT_MAPPING , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : Be , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : Be , r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : Oe , a = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : Ne , o = 6 < arguments.length && void 0 !== arguments[6] ? arguments[6] : et , s = 7 < arguments.length && void 0 !== arguments[7] ? arguments[7] : Ue , l = 8 < arguments.length && void 0 !== arguments[8] ? arguments[8] : 1 , u = 9 < arguments.length && void 0 !== arguments[9] ? arguments[9] : rn; Object.defineProperty(this, "id", { value: xn++ }), this.uuid = gn.generateUUID(), this.name = "", this.image = e, this.mipmaps = [], this.mapping = t, this.wrapS = n, this.wrapT = i, this.magFilter = r, this.minFilter = a, this.anisotropy = l, this.format = o, this.internalFormat = null, this.type = s, this.offset = new yn(0,0), this.repeat = new yn(1,1), this.center = new yn(0,0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new wn, this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.encoding = u, this.version = 0, this.onUpdate = null } function _n(e) { return "undefined" != typeof HTMLImageElement && e instanceof HTMLImageElement || "undefined" != typeof HTMLCanvasElement && e instanceof HTMLCanvasElement || "undefined" != typeof ImageBitmap && e instanceof ImageBitmap ? bn.getDataURL(e) : e.data ? { data: Array.prototype.slice.call(e.data), width: e.width, height: e.height, type: e.data.constructor.name } : (console.warn("THREE.Texture: Unable to serialize Texture."), {}) } En.DEFAULT_IMAGE = void 0, En.DEFAULT_MAPPING = 300, En.prototype = Object.assign(Object.create(hn.prototype), { constructor: En, isTexture: !0, updateMatrix: function() { this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y) }, clone: function() { return (new this.constructor).copy(this) }, copy: function(e) { return this.name = e.name, this.image = e.image, this.mipmaps = e.mipmaps.slice(0), this.mapping = e.mapping, this.wrapS = e.wrapS, this.wrapT = e.wrapT, this.magFilter = e.magFilter, this.minFilter = e.minFilter, this.anisotropy = e.anisotropy, this.format = e.format, this.internalFormat = e.internalFormat, this.type = e.type, this.offset.copy(e.offset), this.repeat.copy(e.repeat), this.center.copy(e.center), this.rotation = e.rotation, this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrix.copy(e.matrix), this.generateMipmaps = e.generateMipmaps, this.premultiplyAlpha = e.premultiplyAlpha, this.flipY = e.flipY, this.unpackAlignment = e.unpackAlignment, this.encoding = e.encoding, this }, toJSON: function(e) { var t = void 0 === e || "string" == typeof e; if (!t && void 0 !== e.textures[this.uuid]) return e.textures[this.uuid]; var n = { metadata: { version: 4.5, type: "Texture", generator: "Texture.toJSON" }, uuid: this.uuid, name: this.name, mapping: this.mapping, repeat: [this.repeat.x, this.repeat.y], offset: [this.offset.x, this.offset.y], center: [this.center.x, this.center.y], rotation: this.rotation, wrap: [this.wrapS, this.wrapT], format: this.format, type: this.type, encoding: this.encoding, minFilter: this.minFilter, magFilter: this.magFilter, anisotropy: this.anisotropy, flipY: this.flipY, premultiplyAlpha: this.premultiplyAlpha, unpackAlignment: this.unpackAlignment }; if (void 0 !== this.image) { var i = this.image; if (void 0 === i.uuid && (i.uuid = gn.generateUUID()), !t && void 0 === e.images[i.uuid]) { if (Array.isArray(i)) for (var r = [], a = 0, o = i.length; a < o; a++) i[a].isDataTexture ? r.push(_n(i[a].image)) : r.push(_n(i[a])); else r = _n(i); e.images[i.uuid] = { uuid: i.uuid, url: r } } n.image = i.uuid } return t || (e.textures[this.uuid] = n), n }, dispose: function() { this.dispatchEvent({ type: "dispose" }) }, transformUv: function(e) { if (300 !== this.mapping) return e; if (e.applyMatrix3(this.matrix), e.x < 0 || 1 < e.x) switch (this.wrapS) { case ke: e.x = e.x - Math.floor(e.x); break; case Be: e.x = e.x < 0 ? 0 : 1; break; case Le: 1 === Math.abs(Math.floor(e.x) % 2) ? e.x = Math.ceil(e.x) - e.x : e.x = e.x - Math.floor(e.x) } if (e.y < 0 || 1 < e.y) switch (this.wrapT) { case ke: e.y = e.y - Math.floor(e.y); break; case Be: e.y = e.y < 0 ? 0 : 1; break; case Le: 1 === Math.abs(Math.floor(e.y) % 2) ? e.y = Math.ceil(e.y) - e.y : e.y = e.y - Math.floor(e.y) } return this.flipY && (e.y = 1 - e.y), e } }), Object.defineProperty(En.prototype, "needsUpdate", { set: function(e) { !0 === e && this.version++ } }); var Mn = function() { function r() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0 , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0 , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0 , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1; O(this, r), Object.defineProperty(this, "isVector4", { value: !0 }), this.x = e, this.y = t, this.z = n, this.w = i } return h(r, [{ key: "width", get: function() { return this.z }, set: function(e) { this.z = e } }, { key: "height", get: function() { return this.w }, set: function(e) { this.w = e } }, { key: "set", value: function(e, t, n, i) { return this.x = e, this.y = t, this.z = n, this.w = i, this } }, { key: "setScalar", value: function(e) { return this.x = e, this.y = e, this.z = e, this.w = e, this } }, { key: "setX", value: function(e) { return this.x = e, this } }, { key: "setY", value: function(e) { return this.y = e, this } }, { key: "setZ", value: function(e) { return this.z = e, this } }, { key: "setW", value: function(e) { return this.w = e, this } }, { key: "setComponent", value: function(e, t) { switch (e) { case 0: this.x = t; break; case 1: this.y = t; break; case 2: this.z = t; break; case 3: this.w = t; break; default: throw new Error("index is out of range: " + e) } return this } }, { key: "getComponent", value: function(e) { switch (e) { case 0: return this.x; case 1: return this.y; case 2: return this.z; case 3: return this.w; default: throw new Error("index is out of range: " + e) } } }, { key: "clone", value: function() { return new this.constructor(this.x,this.y,this.z,this.w) } }, { key: "copy", value: function(e) { return this.x = e.x, this.y = e.y, this.z = e.z, this.w = void 0 !== e.w ? e.w : 1, this } }, { key: "add", value: function(e, t) { return void 0 !== t ? (console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this.z += e.z, this.w += e.w, this) } }, { key: "addScalar", value: function(e) { return this.x += e, this.y += e, this.z += e, this.w += e, this } }, { key: "addVectors", value: function(e, t) { return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this.w = e.w + t.w, this } }, { key: "addScaledVector", value: function(e, t) { return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this.w += e.w * t, this } }, { key: "sub", value: function(e, t) { return void 0 !== t ? (console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this.z -= e.z, this.w -= e.w, this) } }, { key: "subScalar", value: function(e) { return this.x -= e, this.y -= e, this.z -= e, this.w -= e, this } }, { key: "subVectors", value: function(e, t) { return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this.w = e.w - t.w, this } }, { key: "multiplyScalar", value: function(e) { return this.x *= e, this.y *= e, this.z *= e, this.w *= e, this } }, { key: "applyMatrix4", value: function(e) { var t = this.x , n = this.y , i = this.z , r = this.w , e = e.elements; return this.x = e[0] * t + e[4] * n + e[8] * i + e[12] * r, this.y = e[1] * t + e[5] * n + e[9] * i + e[13] * r, this.z = e[2] * t + e[6] * n + e[10] * i + e[14] * r, this.w = e[3] * t + e[7] * n + e[11] * i + e[15] * r, this } }, { key: "divideScalar", value: function(e) { return this.multiplyScalar(1 / e) } }, { key: "setAxisAngleFromQuaternion", value: function(e) { this.w = 2 * Math.acos(e.w); var t = Math.sqrt(1 - e.w * e.w); return t < 1e-4 ? (this.x = 1, this.y = 0, this.z = 0) : (this.x = e.x / t, this.y = e.y / t, this.z = e.z / t), this } }, { key: "setAxisAngleFromRotationMatrix", value: function(e) { var t, n, i, r = e.elements, a = r[0], o = r[4], s = r[8], l = r[1], u = r[5], c = r[9], d = r[2], h = r[6], p = r[10]; if (Math.abs(o - l) < .01 && Math.abs(s - d) < .01 && Math.abs(c - h) < .01) { if (Math.abs(o + l) < .1 && Math.abs(s + d) < .1 && Math.abs(c + h) < .1 && Math.abs(a + u + p - 3) < .1) return this.set(1, 0, 0, 0), this; var f = Math.PI , m = (a + 1) / 2 , v = (u + 1) / 2 , g = (p + 1) / 2 , y = (o + l) / 4 , e = (s + d) / 4 , r = (c + h) / 4; return v < m && g < m ? i = m < .01 ? (t = 0, n = .707106781) : (n = y / (t = Math.sqrt(m)), e / t) : g < v ? i = v < .01 ? (n = 0, t = .707106781) : (t = y / (n = Math.sqrt(v)), r / n) : g < .01 ? (n = t = .707106781, i = 0) : (t = e / (i = Math.sqrt(g)), n = r / i), this.set(t, n, i, f), this } f = Math.sqrt((h - c) * (h - c) + (s - d) * (s - d) + (l - o) * (l - o)); return Math.abs(f) < .001 && (f = 1), this.x = (h - c) / f, this.y = (s - d) / f, this.z = (l - o) / f, this.w = Math.acos((a + u + p - 1) / 2), this } }, { key: "min", value: function(e) { return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this.w = Math.min(this.w, e.w), this } }, { key: "max", value: function(e) { return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this.w = Math.max(this.w, e.w), this } }, { key: "clamp", value: function(e, t) { return this.x = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this.z = Math.max(e.z, Math.min(t.z, this.z)), this.w = Math.max(e.w, Math.min(t.w, this.w)), this } }, { key: "clampScalar", value: function(e, t) { return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this.z = Math.max(e, Math.min(t, this.z)), this.w = Math.max(e, Math.min(t, this.w)), this } }, { key: "clampLength", value: function(e, t) { var n = this.length(); return this.divideScalar(n || 1).multiplyScalar(Math.max(e, Math.min(t, n))) } }, { key: "floor", value: function() { return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this.w = Math.floor(this.w), this } }, { key: "ceil", value: function() { return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this.w = Math.ceil(this.w), this } }, { key: "round", value: function() { return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this.w = Math.round(this.w), this } }, { key: "roundToZero", value: function() { return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this.w = this.w < 0 ? Math.ceil(this.w) : Math.floor(this.w), this } }, { key: "negate", value: function() { return this.x = -this.x, this.y = -this.y, this.z = -this.z, this.w = -this.w, 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: "manhattanLength", value: function() { return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w) } }, { key: "normalize", value: function() { return this.divideScalar(this.length() || 1) } }, { key: "setLength", value: function(e) { return this.normalize().multiplyScalar(e) } }, { key: "lerp", value: function(e, t) { return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this.z += (e.z - this.z) * t, this.w += (e.w - this.w) * t, this } }, { key: "lerpVectors", value: function(e, t, n) { return this.x = e.x + (t.x - e.x) * n, this.y = e.y + (t.y - e.y) * n, this.z = e.z + (t.z - e.z) * n, this.w = e.w + (t.w - e.w) * n, 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 = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; return this.x = e[t], this.y = e[t + 1], this.z = e[t + 2], this.w = e[t + 3], this } }, { key: "toArray", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [] , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; return e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e[t + 3] = this.w, e } }, { key: "fromBufferAttribute", value: function(e, t, n) { return void 0 !== n && console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."), this.x = e.getX(t), this.y = e.getY(t), this.z = e.getZ(t), this.w = e.getW(t), this } }, { key: "random", value: function() { return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this.w = Math.random(), this } }]), r }(); function An(e, t, n) { this.width = e, this.height = t, this.scissor = new Mn(0,0,e,t), this.scissorTest = !1, this.viewport = new Mn(0,0,e,t), this.texture = new En(void 0,(n = n || {}).mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding), this.texture.image = {}, this.texture.image.width = e, this.texture.image.height = t, this.texture.generateMipmaps = void 0 !== n.generateMipmaps && n.generateMipmaps, this.texture.minFilter = void 0 !== n.minFilter ? n.minFilter : Oe, this.depthBuffer = void 0 === n.depthBuffer || n.depthBuffer, this.stencilBuffer = void 0 !== n.stencilBuffer && n.stencilBuffer, this.depthTexture = void 0 !== n.depthTexture ? n.depthTexture : null } function Tn(e, t, n) { An.call(this, e, t, n), this.samples = 4 } An.prototype = Object.assign(Object.create(hn.prototype), { constructor: An, isWebGLRenderTarget: !0, setSize: function(e, t) { this.width === e && this.height === t || (this.width = e, this.height = t, this.texture.image.width = e, this.texture.image.height = t, this.dispose()), this.viewport.set(0, 0, e, t), this.scissor.set(0, 0, e, t) }, clone: function() { return (new this.constructor).copy(this) }, copy: function(e) { return this.width = e.width, this.height = e.height, this.viewport.copy(e.viewport), this.texture = e.texture.clone(), this.depthBuffer = e.depthBuffer, this.stencilBuffer = e.stencilBuffer, this.depthTexture = e.depthTexture, this }, dispose: function() { this.dispatchEvent({ type: "dispose" }) } }), Tn.prototype = Object.assign(Object.create(An.prototype), { constructor: Tn, isWebGLMultisampleRenderTarget: !0, copy: function(e) { return An.prototype.copy.call(this, e), this.samples = e.samples, this } }); var Sn = function() { function r() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0 , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0 , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0 , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1; O(this, r), Object.defineProperty(this, "isQuaternion", { value: !0 }), this._x = e, this._y = t, this._z = n, this._w = i } return h(r, [{ key: "x", get: function() { return this._x }, set: function(e) { this._x = e, this._onChangeCallback() } }, { key: "y", get: function() { return this._y }, set: function(e) { this._y = e, this._onChangeCallback() } }, { key: "z", get: function() { return this._z }, set: function(e) { this._z = e, this._onChangeCallback() } }, { key: "w", get: function() { return this._w }, set: function(e) { this._w = e, this._onChangeCallback() } }, { key: "set", value: function(e, t, n, i) { return this._x = e, this._y = t, this._z = n, this._w = i, this._onChangeCallback(), this } }, { key: "clone", value: function() { return new this.constructor(this._x,this._y,this._z,this._w) } }, { key: "copy", value: function(e) { return this._x = e.x, this._y = e.y, this._z = e.z, this._w = e.w, this._onChangeCallback(), this } }, { key: "setFromEuler", value: function(e, t) { if (!e || !e.isEuler) throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order."); var n = e._x , i = e._y , r = e._z , a = e._order , o = Math.cos , e = Math.sin , s = o(n / 2) , l = o(i / 2) , u = o(r / 2) , c = e(n / 2) , d = e(i / 2) , h = e(r / 2); switch (a) { case "XYZ": this._x = c * l * u + s * d * h, this._y = s * d * u - c * l * h, this._z = s * l * h + c * d * u, this._w = s * l * u - c * d * h; break; case "YXZ": this._x = c * l * u + s * d * h, this._y = s * d * u - c * l * h, this._z = s * l * h - c * d * u, this._w = s * l * u + c * d * h; break; case "ZXY": this._x = c * l * u - s * d * h, this._y = s * d * u + c * l * h, this._z = s * l * h + c * d * u, this._w = s * l * u - c * d * h; break; case "ZYX": this._x = c * l * u - s * d * h, this._y = s * d * u + c * l * h, this._z = s * l * h - c * d * u, this._w = s * l * u + c * d * h; break; case "YZX": this._x = c * l * u + s * d * h, this._y = s * d * u + c * l * h, this._z = s * l * h - c * d * u, this._w = s * l * u - c * d * h; break; case "XZY": this._x = c * l * u - s * d * h, this._y = s * d * u - c * l * h, this._z = s * l * h + c * d * u, this._w = s * l * u + c * d * h; break; default: console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + a) } return !1 !== t && this._onChangeCallback(), this } }, { key: "setFromAxisAngle", value: function(e, t) { var n = t / 2 , t = Math.sin(n); return this._x = e.x * t, this._y = e.y * t, this._z = e.z * t, this._w = Math.cos(n), this._onChangeCallback(), this } }, { key: "setFromRotationMatrix", value: function(e) { var t, n = e.elements, i = n[0], r = n[4], a = n[8], o = n[1], s = n[5], l = n[9], u = n[2], c = n[6], e = n[10], n = i + s + e; return 0 < n ? (n = .5 / Math.sqrt(n + 1), this._w = .25 / n, this._x = (c - l) * n, this._y = (a - u) * n, this._z = (o - r) * n) : s < i && e < i ? (t = 2 * Math.sqrt(1 + i - s - e), this._w = (c - l) / t, this._x = .25 * t, this._y = (r + o) / t, this._z = (a + u) / t) : e < s ? (t = 2 * Math.sqrt(1 + s - i - e), this._w = (a - u) / t, this._x = (r + o) / t, this._y = .25 * t, this._z = (l + c) / t) : (s = 2 * Math.sqrt(1 + e - i - s), this._w = (o - r) / s, this._x = (a + u) / s, this._y = (l + c) / s, this._z = .25 * s), this._onChangeCallback(), this } }, { key: "setFromUnitVectors", value: function(e, t) { var n = e.dot(t) + 1; return n < 1e-6 ? (n = 0, Math.abs(e.x) > Math.abs(e.z) ? (this._x = -e.y, this._y = e.x, this._z = 0) : (this._x = 0, this._y = -e.z, this._z = e.y)) : (this._x = e.y * t.z - e.z * t.y, this._y = e.z * t.x - e.x * t.z, this._z = e.x * t.y - e.y * t.x), this._w = n, this.normalize() } }, { key: "angleTo", value: function(e) { return 2 * Math.acos(Math.abs(gn.clamp(this.dot(e), -1, 1))) } }, { key: "rotateTowards", value: function(e, t) { var n = this.angleTo(e); if (0 === n) return this; n = Math.min(1, t / n); return this.slerp(e, n), this } }, { key: "identity", value: function() { return this.set(0, 0, 0, 1) } }, { key: "invert", value: function() { return this.conjugate() } }, { key: "conjugate", value: function() { return this._x *= -1, this._y *= -1, this._z *= -1, this._onChangeCallback(), this } }, { key: "dot", value: function(e) { return this._x * e._x + this._y * e._y + this._z * e._z + this._w * e._w } }, { key: "lengthSq", value: function() { return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w } }, { key: "length", value: function() { return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w) } }, { key: "normalize", value: function() { var e = this.length(); return 0 === e ? (this._x = 0, this._y = 0, this._z = 0, this._w = 1) : (this._x = this._x * (e = 1 / e), this._y = this._y * e, this._z = this._z * e, this._w = this._w * e), this._onChangeCallback(), this } }, { key: "multiply", value: function(e, t) { return void 0 !== t ? (console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."), this.multiplyQuaternions(e, t)) : this.multiplyQuaternions(this, e) } }, { key: "premultiply", value: function(e) { return this.multiplyQuaternions(e, this) } }, { key: "multiplyQuaternions", value: function(e, t) { var n = e._x , i = e._y , r = e._z , a = e._w , o = t._x , s = t._y , e = t._z , t = t._w; return this._x = n * t + a * o + i * e - r * s, this._y = i * t + a * s + r * o - n * e, this._z = r * t + a * e + n * s - i * o, this._w = a * t - n * o - i * s - r * e, this._onChangeCallback(), this } }, { key: "slerp", value: function(e, t) { if (0 === t) return this; if (1 === t) return this.copy(e); var n = this._x , i = this._y , r = this._z , a = this._w , o = a * e._w + n * e._x + i * e._y + r * e._z; if (o < 0 ? (this._w = -e._w, this._x = -e._x, this._y = -e._y, this._z = -e._z, o = -o) : this.copy(e), 1 <= o) return this._w = a, this._x = n, this._y = i, this._z = r, this; e = 1 - o * o; if (e <= Number.EPSILON) { var s = 1 - t; return this._w = s * a + t * this._w, this._x = s * n + t * this._x, this._y = s * i + t * this._y, this._z = s * r + t * this._z, this.normalize(), this._onChangeCallback(), this } s = Math.sqrt(e), e = Math.atan2(s, o), o = Math.sin((1 - t) * e) / s, s = Math.sin(t * e) / s; return this._w = a * o + this._w * s, this._x = n * o + this._x * s, this._y = i * o + this._y * s, this._z = r * o + this._z * s, this._onChangeCallback(), this } }, { key: "equals", value: function(e) { return e._x === this._x && e._y === this._y && e._z === this._z && e._w === this._w } }, { key: "fromArray", value: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; return this._x = e[t], this._y = e[t + 1], this._z = e[t + 2], this._w = e[t + 3], this._onChangeCallback(), this } }, { key: "toArray", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [] , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; return e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._w, e } }, { key: "fromBufferAttribute", value: function(e, t) { return this._x = e.getX(t), this._y = e.getY(t), this._z = e.getZ(t), this._w = e.getW(t), this } }, { key: "_onChange", value: function(e) { return this._onChangeCallback = e, this } }, { key: "_onChangeCallback", value: function() {} }], [{ key: "slerp", value: function(e, t, n, i) { return n.copy(e).slerp(t, i) } }, { key: "slerpFlat", value: function(e, t, n, i, r, a, o) { var s = n[i + 0] , l = n[i + 1] , u = n[i + 2] , c = n[i + 3] , d = r[a + 0] , h = r[a + 1] , p = r[a + 2] , f = r[a + 3]; c === f && s === d && l === h && u === p || (n = 1 - o, r = 0 <= (i = s * d + l * h + u * p + c * f) ? 1 : -1, (a = 1 - i * i) > Number.EPSILON && (a = Math.sqrt(a), i = Math.atan2(a, i * r), n = Math.sin(n * i) / a, o = Math.sin(o * i) / a), s = s * n + d * (r = o * r), l = l * n + h * r, u = u * n + p * r, c = c * n + f * r, n === 1 - o && (s *= o = 1 / Math.sqrt(s * s + l * l + u * u + c * c), l *= o, u *= o, c *= o)), e[t] = s, e[t + 1] = l, e[t + 2] = u, e[t + 3] = c } }, { key: "multiplyQuaternionsFlat", value: function(e, t, n, i, r, a) { var o = n[i] , s = n[i + 1] , l = n[i + 2] , u = n[i + 3] , c = r[a] , n = r[a + 1] , i = r[a + 2] , a = r[a + 3]; return e[t] = o * a + u * c + s * i - l * n, e[t + 1] = s * a + u * n + l * c - o * i, e[t + 2] = l * a + u * i + o * n - s * c, e[t + 3] = u * a - o * c - s * n - l * i, e } }]), r }() , Cn = function() { function i() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0 , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0 , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0; O(this, i), Object.defineProperty(this, "isVector3", { value: !0 }), this.x = e, this.y = t, this.z = n } return h(i, [{ key: "set", value: function(e, t, n) { return void 0 === n && (n = this.z), this.x = e, this.y = t, this.z = n, this } }, { key: "setScalar", value: function(e) { return this.x = e, this.y = e, this.z = e, this } }, { key: "setX", value: function(e) { return this.x = e, this } }, { key: "setY", value: function(e) { return this.y = e, this } }, { key: "setZ", value: function(e) { return this.z = e, this } }, { key: "setComponent", value: function(e, t) { switch (e) { case 0: this.x = t; break; case 1: this.y = t; break; case 2: this.z = t; break; default: throw new Error("index is out of range: " + e) } return this } }, { key: "getComponent", value: function(e) { switch (e) { case 0: return this.x; case 1: return this.y; case 2: return this.z; default: throw new Error("index is out of range: " + e) } } }, { key: "clone", value: function() { return new this.constructor(this.x,this.y,this.z) } }, { key: "copy", value: function(e) { return this.x = e.x, this.y = e.y, this.z = e.z, this } }, { key: "add", value: function(e, t) { return void 0 !== t ? (console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this.z += e.z, this) } }, { key: "addScalar", value: function(e) { return this.x += e, this.y += e, this.z += e, this } }, { key: "addVectors", value: function(e, t) { return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this } }, { key: "addScaledVector", value: function(e, t) { return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this } }, { key: "sub", value: function(e, t) { return void 0 !== t ? (console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this.z -= e.z, this) } }, { key: "subScalar", value: function(e) { return this.x -= e, this.y -= e, this.z -= e, this } }, { key: "subVectors", value: function(e, t) { return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this } }, { key: "multiply", value: function(e, t) { return void 0 !== t ? (console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."), this.multiplyVectors(e, t)) : (this.x *= e.x, this.y *= e.y, this.z *= e.z, this) } }, { key: "multiplyScalar", value: function(e) { return this.x *= e, this.y *= e, this.z *= e, this } }, { key: "multiplyVectors", value: function(e, t) { return this.x = e.x * t.x, this.y = e.y * t.y, this.z = e.z * t.z, this } }, { key: "applyEuler", value: function(e) { return e && e.isEuler || console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."), this.applyQuaternion(Dn.setFromEuler(e)) } }, { key: "applyAxisAngle", value: function(e, t) { return this.applyQuaternion(Dn.setFromAxisAngle(e, t)) } }, { key: "applyMatrix3", value: function(e) { var t = this.x , n = this.y , i = this.z , e = e.elements; return this.x = e[0] * t + e[3] * n + e[6] * i, this.y = e[1] * t + e[4] * n + e[7] * i, this.z = e[2] * t + e[5] * n + e[8] * i, this } }, { key: "applyNormalMatrix", value: function(e) { return this.applyMatrix3(e).normalize() } }, { key: "applyMatrix4", value: function(e) { var t = this.x , n = this.y , i = this.z , r = e.elements , e = 1 / (r[3] * t + r[7] * n + r[11] * i + r[15]); return this.x = (r[0] * t + r[4] * n + r[8] * i + r[12]) * e, this.y = (r[1] * t + r[5] * n + r[9] * i + r[13]) * e, this.z = (r[2] * t + r[6] * n + r[10] * i + r[14]) * e, this } }, { key: "applyQuaternion", value: function(e) { var t = this.x , n = this.y , i = this.z , r = e.x , a = e.y , o = e.z , s = e.w , l = s * t + a * i - o * n , u = s * n + o * t - r * i , e = s * i + r * n - a * t , i = -r * t - a * n - o * i; return this.x = l * s + i * -r + u * -o - e * -a, this.y = u * s + i * -a + e * -r - l * -o, this.z = e * s + i * -o + l * -a - u * -r, this } }, { key: "project", value: function(e) { return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix) } }, { key: "unproject", value: function(e) { return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld) } }, { key: "transformDirection", value: function(e) { var t = this.x , n = this.y , i = this.z , e = e.elements; return this.x = e[0] * t + e[4] * n + e[8] * i, this.y = e[1] * t + e[5] * n + e[9] * i, this.z = e[2] * t + e[6] * n + e[10] * i, this.normalize() } }, { key: "divide", value: function(e) { return this.x /= e.x, this.y /= e.y, this.z /= e.z, this } }, { key: "divideScalar", value: function(e) { return this.multiplyScalar(1 / e) } }, { key: "min", value: function(e) { return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this } }, { key: "max", value: function(e) { return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this } }, { key: "clamp", value: function(e, t) { return this.x = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this.z = Math.max(e.z, Math.min(t.z, this.z)), this } }, { key: "clampScalar", value: function(e, t) { return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this.z = Math.max(e, Math.min(t, this.z)), this } }, { key: "clampLength", value: function(e, t) { var n = this.length(); return this.divideScalar(n || 1).multiplyScalar(Math.max(e, Math.min(t, n))) } }, { key: "floor", value: function() { return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this } }, { key: "ceil", value: function() { return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this } }, { key: "round", value: function() { return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this } }, { key: "roundToZero", value: function() { return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this } }, { key: "negate", value: function() { return this.x = -this.x, this.y = -this.y, this.z = -this.z, this } }, { key: "dot", value: function(e) { return this.x * e.x + this.y * e.y + this.z * e.z } }, { key: "lengthSq", value: function() { return this.x * this.x + this.y * this.y + this.z * this.z } }, { key: "length", value: function() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z) } }, { key: "manhattanLength", value: function() { return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) } }, { key: "normalize", value: function() { return this.divideScalar(this.length() || 1) } }, { key: "setLength", value: function(e) { return this.normalize().multiplyScalar(e) } }, { key: "lerp", value: function(e, t) { return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this.z += (e.z - this.z) * t, this } }, { key: "lerpVectors", value: function(e, t, n) { return this.x = e.x + (t.x - e.x) * n, this.y = e.y + (t.y - e.y) * n, this.z = e.z + (t.z - e.z) * n, this } }, { key: "cross", value: function(e, t) { return void 0 !== t ? (console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."), this.crossVectors(e, t)) : this.crossVectors(this, e) } }, { key: "crossVectors", value: function(e, t) { var n = e.x , i = e.y , r = e.z , a = t.x , e = t.y , t = t.z; return this.x = i * t - r * e, this.y = r * a - n * t, this.z = n * e - i * a, this } }, { key: "projectOnVector", value: function(e) { var t = e.lengthSq(); if (0 === t) return this.set(0, 0, 0); t = e.dot(this) / t; return this.copy(e).multiplyScalar(t) } }, { key: "projectOnPlane", value: function(e) { return Pn.copy(this).projectOnVector(e), this.sub(Pn) } }, { key: "reflect", value: function(e) { return this.sub(Pn.copy(e).multiplyScalar(2 * this.dot(e))) } }, { key: "angleTo", value: function(e) { var t = Math.sqrt(this.lengthSq() * e.lengthSq()); if (0 === t) return Math.PI / 2; t = this.dot(e) / t; return Math.acos(gn.clamp(t, -1, 1)) } }, { key: "distanceTo", value: function(e) { return Math.sqrt(this.distanceToSquared(e)) } }, { key: "distanceToSquared", value: function(e) { var t = this.x - e.x , n = this.y - e.y , e = this.z - e.z; return t * t + n * n + e * e } }, { key: "manhattanDistanceTo", value: function(e) { return Math.abs(this.x - e.x) + Math.abs(this.y - e.y) + Math.abs(this.z - e.z) } }, { key: "setFromSpherical", value: function(e) { return this.setFromSphericalCoords(e.radius, e.phi, e.theta) } }, { key: "setFromSphericalCoords", value: function(e, t, n) { var i = Math.sin(t) * e; return this.x = i * Math.sin(n), this.y = Math.cos(t) * e, this.z = i * Math.cos(n), this } }, { key: "setFromCylindrical", value: function(e) { return this.setFromCylindricalCoords(e.radius, e.theta, e.y) } }, { key: "setFromCylindricalCoords", value: function(e, t, n) { return this.x = e * Math.sin(t), this.y = n, this.z = e * Math.cos(t), this } }, { key: "setFromMatrixPosition", value: function(e) { e = e.elements; return this.x = e[12], this.y = e[13], this.z = e[14], this } }, { key: "setFromMatrixScale", value: function(e) { var t = this.setFromMatrixColumn(e, 0).length() , n = this.setFromMatrixColumn(e, 1).length() , e = this.setFromMatrixColumn(e, 2).length(); return this.x = t, this.y = n, this.z = e, this } }, { key: "setFromMatrixColumn", value: function(e, t) { return this.fromArray(e.elements, 4 * t) } }, { key: "setFromMatrix3Column", value: function(e, t) { return this.fromArray(e.elements, 3 * t) } }, { key: "equals", value: function(e) { return e.x === this.x && e.y === this.y && e.z === this.z } }, { key: "fromArray", value: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; return this.x = e[t], this.y = e[t + 1], this.z = e[t + 2], this } }, { key: "toArray", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [] , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; return e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e } }, { key: "fromBufferAttribute", value: function(e, t, n) { return void 0 !== n && console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."), this.x = e.getX(t), this.y = e.getY(t), this.z = e.getZ(t), this } }, { key: "random", value: function() { return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this } }]), i }() , Pn = new Cn , Dn = new Sn , kn = function() { function n(e, t) { O(this, n), Object.defineProperty(this, "isBox3", { value: !0 }), this.min = void 0 !== e ? e : new Cn(1 / 0,1 / 0,1 / 0), this.max = void 0 !== t ? t : new Cn(-1 / 0,-1 / 0,-1 / 0) } return h(n, [{ key: "set", value: function(e, t) { return this.min.copy(e), this.max.copy(t), this } }, { key: "setFromArray", value: function(e) { for (var t = 1 / 0, n = 1 / 0, i = 1 / 0, r = -1 / 0, a = -1 / 0, o = -1 / 0, s = 0, l = e.length; s < l; s += 3) { var u = e[s] , c = e[s + 1] , d = e[s + 2]; u < t && (t = u), c < n && (n = c), d < i && (i = d), r < u && (r = u), a < c && (a = c), o < d && (o = d) } return this.min.set(t, n, i), this.max.set(r, a, o), this } }, { key: "setFromBufferAttribute", value: function(e) { for (var t = 1 / 0, n = 1 / 0, i = 1 / 0, r = -1 / 0, a = -1 / 0, o = -1 / 0, s = 0, l = e.count; s < l; s++) { var u = e.getX(s) , c = e.getY(s) , d = e.getZ(s); u < t && (t = u), c < n && (n = c), d < i && (i = d), r < u && (r = u), a < c && (a = c), o < d && (o = d) } return this.min.set(t, n, i), this.max.set(r, a, o), this } }, { key: "setFromPoints", value: function(e) { this.makeEmpty(); for (var t = 0, n = e.length; t < n; t++) this.expandByPoint(e[t]); return this } }, { key: "setFromCenterAndSize", value: function(e, t) { t = Rn.copy(t).multiplyScalar(.5); return this.min.copy(e).sub(t), this.max.copy(e).add(t), this } }, { key: "setFromObject", value: function(e) { return this.makeEmpty(), this.expandByObject(e) } }, { key: "clone", value: function() { return (new this.constructor).copy(this) } }, { key: "copy", value: function(e) { return this.min.copy(e.min), this.max.copy(e.max), this } }, { key: "makeEmpty", value: function() { return this.min.x = this.min.y = this.min.z = 1 / 0, this.max.x = this.max.y = this.max.z = -1 / 0, this } }, { key: "isEmpty", value: function() { return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z } }, { key: "getCenter", value: function(e) { return void 0 === e && (console.warn("THREE.Box3: .getCenter() target is now required"), e = new Cn), this.isEmpty() ? e.set(0, 0, 0) : e.addVectors(this.min, this.max).multiplyScalar(.5) } }, { key: "getSize", value: function(e) { return void 0 === e && (console.warn("THREE.Box3: .getSize() target is now required"), e = new Cn), this.isEmpty() ? e.set(0, 0, 0) : e.subVectors(this.max, this.min) } }, { key: "expandByPoint", value: function(e) { return this.min.min(e), this.max.max(e), this } }, { key: "expandByVector", value: function(e) { return this.min.sub(e), this.max.add(e), this } }, { key: "expandByScalar", value: function(e) { return this.min.addScalar(-e), this.max.addScalar(e), this } }, { key: "expandByObject", value: function(e) { e.updateWorldMatrix(!1, !1); var t = e.geometry; void 0 !== t && (null === t.boundingBox && t.computeBoundingBox(), Fn.copy(t.boundingBox), Fn.applyMatrix4(e.matrixWorld), this.union(Fn)); for (var n = e.children, i = 0, r = n.length; i < r; i++) this.expandByObject(n[i]); return this } }, { key: "containsPoint", value: function(e) { return !(e.x < this.min.x || e.x > this.max.x || e.y < this.min.y || e.y > this.max.y || e.z < this.min.z || e.z > this.max.z) } }, { key: "containsBox", value: function(e) { return this.min.x <= e.min.x && e.max.x <= this.max.x && this.min.y <= e.min.y && e.max.y <= this.max.y && this.min.z <= e.min.z && e.max.z <= this.max.z } }, { key: "getParameter", value: function(e, t) { return void 0 === t && (console.warn("THREE.Box3: .getParameter() target is now required"), t = new Cn), t.set((e.x - this.min.x) / (this.max.x - this.min.x), (e.y - this.min.y) / (this.max.y - this.min.y), (e.z - this.min.z) / (this.max.z - this.min.z)) } }, { key: "intersectsBox", value: function(e) { return !(e.max.x < this.min.x || e.min.x > this.max.x || e.max.y < this.min.y || e.min.y > this.max.y || e.max.z < this.min.z || e.min.z > this.max.z) } }, { key: "intersectsSphere", value: function(e) { return this.clampPoint(e.center, Rn), Rn.distanceToSquared(e.center) <= e.radius * e.radius } }, { key: "intersectsPlane", value: function(e) { var t, n = 0 < e.normal.x ? (t = e.normal.x * this.min.x, e.normal.x * this.max.x) : (t = e.normal.x * this.max.x, e.normal.x * this.min.x); return 0 < e.normal.y ? (t += e.normal.y * this.min.y, n += e.normal.y * this.max.y) : (t += e.normal.y * this.max.y, n += e.normal.y * this.min.y), 0 < e.normal.z ? (t += e.normal.z * this.min.z, n += e.normal.z * this.max.z) : (t += e.normal.z * this.max.z, n += e.normal.z * this.min.z), t <= -e.constant && n >= -e.constant } }, { key: "intersectsTriangle", value: function(e) { return !this.isEmpty() && (this.getCenter(Hn), Vn.subVectors(this.max, Hn), In.subVectors(e.a, Hn), On.subVectors(e.b, Hn), zn.subVectors(e.c, Hn), Nn.subVectors(On, In), Un.subVectors(zn, On), Gn.subVectors(In, zn), !!Bn([0, -Nn.z, Nn.y, 0, -Un.z, Un.y, 0, -Gn.z, Gn.y, Nn.z, 0, -Nn.x, Un.z, 0, -Un.x, Gn.z, 0, -Gn.x, -Nn.y, Nn.x, 0, -Un.y, Un.x, 0, -Gn.y, Gn.x, 0], In, On, zn, Vn) && (!!Bn([1, 0, 0, 0, 1, 0, 0, 0, 1], In, On, zn, Vn) && (jn.crossVectors(Nn, Un), Bn([jn.x, jn.y, jn.z], In, On, zn, Vn)))) } }, { key: "clampPoint", value: function(e, t) { return void 0 === t && (console.warn("THREE.Box3: .clampPoint() target is now required"), t = new Cn), t.copy(e).clamp(this.min, this.max) } }, { key: "distanceToPoint", value: function(e) { return Rn.copy(e).clamp(this.min, this.max).sub(e).length() } }, { key: "getBoundingSphere", value: function(e) { return void 0 === e && console.error("THREE.Box3: .getBoundingSphere() target is now required"), this.getCenter(e.center), e.radius = .5 * this.getSize(Rn).length(), e } }, { key: "intersect", value: function(e) { return this.min.max(e.min), this.max.min(e.max), this.isEmpty() && this.makeEmpty(), this } }, { key: "union", value: function(e) { return this.min.min(e.min), this.max.max(e.max), this } }, { key: "applyMatrix4", value: function(e) { return this.isEmpty() || (Ln[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), Ln[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), Ln[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), Ln[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), Ln[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), Ln[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), Ln[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), Ln[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints(Ln)), this } }, { key: "translate", value: function(e) { return this.min.add(e), this.max.add(e), this } }, { key: "equals", value: function(e) { return e.min.equals(this.min) && e.max.equals(this.max) } }]), n }(); function Bn(e, t, n, i, r) { for (var a = 0, o = e.length - 3; a <= o; a += 3) { Wn.fromArray(e, a); var s = r.x * Math.abs(Wn.x) + r.y * Math.abs(Wn.y) + r.z * Math.abs(Wn.z) , l = t.dot(Wn) , u = n.dot(Wn) , c = i.dot(Wn); if (Math.max(-Math.max(l, u, c), Math.min(l, u, c)) > s) return !1 } return !0 } var Ln = [new Cn, new Cn, new Cn, new Cn, new Cn, new Cn, new Cn, new Cn] , Rn = new Cn , Fn = new kn , In = new Cn , On = new Cn , zn = new Cn , Nn = new Cn , Un = new Cn , Gn = new Cn , Hn = new Cn , Vn = new Cn , jn = new Cn , Wn = new Cn , Xn = new kn , qn = function() { function n(e, t) { O(this, n), this.center = void 0 !== e ? e : new Cn, this.radius = void 0 !== t ? t : -1 } return h(n, [{ key: "set", value: function(e, t) { return this.center.copy(e), this.radius = t, this } }, { key: "setFromPoints", value: function(e, t) { var n = this.center; void 0 !== t ? n.copy(t) : Xn.setFromPoints(e).getCenter(n); for (var i = 0, r = 0, a = e.length; r < a; r++) i = Math.max(i, n.distanceToSquared(e[r])); return this.radius = Math.sqrt(i), this } }, { key: "clone", value: function() { return (new this.constructor).copy(this) } }, { key: "copy", value: function(e) { return this.center.copy(e.center), this.radius = e.radius, this } }, { key: "isEmpty", value: function() { return this.radius < 0 } }, { key: "makeEmpty", value: function() { return this.center.set(0, 0, 0), this.radius = -1, this } }, { key: "containsPoint", value: function(e) { return e.distanceToSquared(this.center) <= this.radius * this.radius } }, { key: "distanceToPoint", value: function(e) { return e.distanceTo(this.center) - this.radius } }, { key: "intersectsSphere", value: function(e) { var t = this.radius + e.radius; return e.center.distanceToSquared(this.center) <= t * t } }, { key: "intersectsBox", value: function(e) { return e.intersectsSphere(this) } }, { key: "intersectsPlane", value: function(e) { return Math.abs(e.distanceToPoint(this.center)) <= this.radius } }, { key: "clampPoint", value: function(e, t) { var n = this.center.distanceToSquared(e); return void 0 === t && (console.warn("THREE.Sphere: .clampPoint() target is now required"), t = new Cn), t.copy(e), n > this.radius * this.radius && (t.sub(this.center).normalize(), t.multiplyScalar(this.radius).add(this.center)), t } }, { key: "getBoundingBox", value: function(e) { return void 0 === e && (console.warn("THREE.Sphere: .getBoundingBox() target is now required"), e = new kn), this.isEmpty() ? e.makeEmpty() : (e.set(this.center, this.center), e.expandByScalar(this.radius)), e } }, { key: "applyMatrix4", value: function(e) { return this.center.applyMatrix4(e), this.radius = this.radius * e.getMaxScaleOnAxis(), this } }, { key: "translate", value: function(e) { return this.center.add(e), this } }, { key: "equals", value: function(e) { return e.center.equals(this.center) && e.radius === this.radius } }]), n }() , Jn = new Cn , Yn = new Cn , Zn = new Cn , Qn = new Cn , Kn = new Cn , $n = new Cn , ei = new Cn , ti = function() { function n(e, t) { O(this, n), this.origin = void 0 !== e ? e : new Cn, this.direction = void 0 !== t ? t : new Cn(0,0,-1) } return h(n, [{ key: "set", value: function(e, t) { return this.origin.copy(e), this.direction.copy(t), this } }, { key: "clone", value: function() { return (new this.constructor).copy(this) } }, { key: "copy", value: function(e) { return this.origin.copy(e.origin), this.direction.copy(e.direction), this } }, { key: "at", value: function(e, t) { return void 0 === t && (console.warn("THREE.Ray: .at() target is now required"), t = new Cn), t.copy(this.direction).multiplyScalar(e).add(this.origin) } }, { key: "lookAt", value: function(e) { return this.direction.copy(e).sub(this.origin).normalize(), this } }, { key: "recast", value: function(e) { return this.origin.copy(this.at(e, Jn)), this } }, { key: "closestPointToPoint", value: function(e, t) { void 0 === t && (console.warn("THREE.Ray: .closestPointToPoint() target is now required"), t = new Cn), t.subVectors(e, this.origin); e = t.dot(this.direction); return e < 0 ? t.copy(this.origin) : t.copy(this.direction).multiplyScalar(e).add(this.origin) } }, { key: "distanceToPoint", value: function(e) { return Math.sqrt(this.distanceSqToPoint(e)) } }, { key: "distanceSqToPoint", value: function(e) { var t = Jn.subVectors(e, this.origin).dot(this.direction); return t < 0 ? this.origin.distanceToSquared(e) : (Jn.copy(this.direction).multiplyScalar(t).add(this.origin), Jn.distanceToSquared(e)) } }, { key: "distanceSqToSegment", value: function(e, t, n, i) { Yn.copy(e).add(t).multiplyScalar(.5), Zn.copy(t).sub(e).normalize(), Qn.copy(this.origin).sub(Yn); var r, a, o = .5 * e.distanceTo(t), s = -this.direction.dot(Zn), l = Qn.dot(this.direction), u = -Qn.dot(Zn), c = Qn.lengthSq(), e = Math.abs(1 - s * s); return c = 0 < e ? (a = s * l - u, t = o * e, 0 <= (r = s * u - l) ? -t <= a ? a <= t ? (r *= e = 1 / e) * (r + s * (a *= e) + 2 * l) + a * (s * r + a + 2 * u) + c : (a = o, -(r = Math.max(0, -(s * a + l))) * r + a * (a + 2 * u) + c) : (a = -o, -(r = Math.max(0, -(s * a + l))) * r + a * (a + 2 * u) + c) : a <= -t ? -(r = Math.max(0, -(-s * o + l))) * r + (a = 0 < r ? -o : Math.min(Math.max(-o, -u), o)) * (a + 2 * u) + c : a <= t ? (r = 0, (a = Math.min(Math.max(-o, -u), o)) * (a + 2 * u) + c) : -(r = Math.max(0, -(s * o + l))) * r + (a = 0 < r ? o : Math.min(Math.max(-o, -u), o)) * (a + 2 * u) + c) : (a = 0 < s ? -o : o, -(r = Math.max(0, -(s * a + l))) * r + a * (a + 2 * u) + c), n && n.copy(this.direction).multiplyScalar(r).add(this.origin), i && i.copy(Zn).multiplyScalar(a).add(Yn), c } }, { key: "intersectSphere", value: function(e, t) { Jn.subVectors(e.center, this.origin); var n = Jn.dot(this.direction) , i = Jn.dot(Jn) - n * n , e = e.radius * e.radius; if (e < i) return null; e = Math.sqrt(e - i), i = n - e, e = n + e; return i < 0 && e < 0 ? null : i < 0 ? this.at(e, t) : this.at(i, t) } }, { key: "intersectsSphere", value: function(e) { return this.distanceSqToPoint(e.center) <= e.radius * e.radius } }, { key: "distanceToPlane", value: function(e) { var t = e.normal.dot(this.direction); if (0 === t) return 0 === e.distanceToPoint(this.origin) ? 0 : null; t = -(this.origin.dot(e.normal) + e.constant) / t; return 0 <= t ? t : null } }, { key: "intersectPlane", value: function(e, t) { e = this.distanceToPlane(e); return null === e ? null : this.at(e, t) } }, { key: "intersectsPlane", value: function(e) { var t = e.distanceToPoint(this.origin); return 0 === t || e.normal.dot(this.direction) * t < 0 } }, { key: "intersectBox", value: function(e, t) { var n, i, r, a = 1 / this.direction.x, o = 1 / this.direction.y, s = 1 / this.direction.z, l = this.origin, a = 0 <= a ? (n = (e.min.x - l.x) * a, (e.max.x - l.x) * a) : (n = (e.max.x - l.x) * a, (e.min.x - l.x) * a), o = 0 <= o ? (i = (e.min.y - l.y) * o, (e.max.y - l.y) * o) : (i = (e.max.y - l.y) * o, (e.min.y - l.y) * o); return o < n || a < i ? null : ((n < i || n != n) && (n = i), (o < a || a != a) && (a = o), (s = 0 <= s ? (r = (e.min.z - l.z) * s, (e.max.z - l.z) * s) : (r = (e.max.z - l.z) * s, (e.min.z - l.z) * s)) < n || a < r ? null : ((n < r || n != n) && (n = r), (a = s < a || a != a ? s : a) < 0 ? null : this.at(0 <= n ? n : a, t))) } }, { key: "intersectsBox", value: function(e) { return null !== this.intersectBox(e, Jn) } }, { key: "intersectTriangle", value: function(e, t, n, i, r) { Kn.subVectors(t, e), $n.subVectors(n, e), ei.crossVectors(Kn, $n); n = this.direction.dot(ei); if (0 < n) { if (i) return null; a = 1 } else { if (!(n < 0)) return null; a = -1, n = -n } Qn.subVectors(this.origin, e); i = a * this.direction.dot($n.crossVectors(Qn, $n)); if (i < 0) return null; e = a * this.direction.dot(Kn.cross(Qn)); if (e < 0) return null; if (n < i + e) return null; var a = -a * Qn.dot(ei); return a < 0 ? null : this.at(a / n, r) } }, { key: "applyMatrix4", value: function(e) { return this.origin.applyMatrix4(e), this.direction.transformDirection(e), this } }, { key: "equals", value: function(e) { return e.origin.equals(this.origin) && e.direction.equals(this.direction) } }]), n }() , ni = function() { function e() { O(this, e), Object.defineProperty(this, "isMatrix4", { value: !0 }), this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0 < arguments.length && console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.") } return h(e, [{ key: "set", value: function(e, t, n, i, r, a, o, s, l, u, c, d, h, p, f, m) { var v = this.elements; return v[0] = e, v[4] = t, v[8] = n, v[12] = i, v[1] = r, v[5] = a, v[9] = o, v[13] = s, v[2] = l, v[6] = u, v[10] = c, v[14] = d, v[3] = h, v[7] = p, v[11] = f, v[15] = m, this } }, { key: "identity", value: function() { return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this } }, { key: "clone", value: function() { return (new e).fromArray(this.elements) } }, { key: "copy", value: function(e) { var t = this.elements , e = e.elements; return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t[9] = e[9], t[10] = e[10], t[11] = e[11], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15], this } }, { key: "copyPosition", value: function(e) { var t = this.elements , e = e.elements; return t[12] = e[12], t[13] = e[13], t[14] = e[14], this } }, { key: "extractBasis", value: function(e, t, n) { return e.setFromMatrixColumn(this, 0), t.setFromMatrixColumn(this, 1), n.setFromMatrixColumn(this, 2), this } }, { key: "makeBasis", value: function(e, t, n) { return this.set(e.x, t.x, n.x, 0, e.y, t.y, n.y, 0, e.z, t.z, n.z, 0, 0, 0, 0, 1), this } }, { key: "extractRotation", value: function(e) { var t = this.elements , n = e.elements , i = 1 / ii.setFromMatrixColumn(e, 0).length() , r = 1 / ii.setFromMatrixColumn(e, 1).length() , e = 1 / ii.setFromMatrixColumn(e, 2).length(); return t[0] = n[0] * i, t[1] = n[1] * i, t[2] = n[2] * i, t[3] = 0, t[4] = n[4] * r, t[5] = n[5] * r, t[6] = n[6] * r, t[7] = 0, t[8] = n[8] * e, t[9] = n[9] * e, t[10] = n[10] * e, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this } }, { key: "makeRotationFromEuler", value: function(e) { e && e.isEuler || console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order."); var t, n, i, r, a, o, s, l, u, c, d, h = this.elements, p = e.x, f = e.y, m = e.z, v = Math.cos(p), g = Math.sin(p), y = Math.cos(f), w = Math.sin(f), p = Math.cos(m), f = Math.sin(m); return "XYZ" === e.order ? (t = v * p, i = v * f, n = g * p, m = g * f, h[0] = y * p, h[4] = -y * f, h[8] = w, h[1] = i + n * w, h[5] = t - m * w, h[9] = -g * y, h[2] = m - t * w, h[6] = n + i * w, h[10] = v * y) : "YXZ" === e.order ? (t = y * f, n = w * p, h[0] = (r = y * p) + (i = w * f) * g, h[4] = n * g - t, h[8] = v * w, h[1] = v * f, h[5] = v * p, h[9] = -g, h[2] = t * g - n, h[6] = i + r * g, h[10] = v * y) : "ZXY" === e.order ? (r = y * f, a = w * p, h[0] = (s = y * p) - (o = w * f) * g, h[4] = -v * f, h[8] = a + r * g, h[1] = r + a * g, h[5] = v * p, h[9] = o - s * g, h[2] = -v * w, h[6] = g, h[10] = v * y) : "ZYX" === e.order ? (a = v * p, o = v * f, l = g * p, s = g * f, h[0] = y * p, h[4] = l * w - o, h[8] = a * w + s, h[1] = y * f, h[5] = s * w + a, h[9] = o * w - l, h[2] = -w, h[6] = g * y, h[10] = v * y) : "YZX" === e.order ? (c = v * y, l = v * w, u = g * y, d = g * w, h[0] = y * p, h[4] = d - c * f, h[8] = u * f + l, h[1] = f, h[5] = v * p, h[9] = -g * p, h[2] = -w * p, h[6] = l * f + u, h[10] = c - d * f) : "XZY" === e.order && (u = v * y, c = v * w, d = g * y, e = g * w, h[0] = y * p, h[4] = -f, h[8] = w * p, h[1] = u * f + e, h[5] = v * p, h[9] = c * f - d, h[2] = d * f - c, h[6] = g * p, h[10] = e * f + u), h[3] = 0, h[7] = 0, h[11] = 0, h[12] = 0, h[13] = 0, h[14] = 0, h[15] = 1, this } }, { key: "makeRotationFromQuaternion", value: function(e) { return this.compose(ai, e, oi) } }, { key: "lookAt", value: function(e, t, n) { var i = this.elements; return ui.subVectors(e, t), 0 === ui.lengthSq() && (ui.z = 1), ui.normalize(), si.crossVectors(n, ui), 0 === si.lengthSq() && (1 === Math.abs(n.z) ? ui.x += 1e-4 : ui.z += 1e-4, ui.normalize(), si.crossVectors(n, ui)), si.normalize(), li.crossVectors(ui, si), i[0] = si.x, i[4] = li.x, i[8] = ui.x, i[1] = si.y, i[5] = li.y, i[9] = ui.y, i[2] = si.z, i[6] = li.z, i[10] = ui.z, this } }, { key: "multiply", value: function(e, t) { return void 0 !== t ? (console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."), this.multiplyMatrices(e, t)) : this.multiplyMatrices(this, e) } }, { key: "premultiply", value: function(e) { return this.multiplyMatrices(e, this) } }, { key: "multiplyMatrices", value: function(e, t) { var n = e.elements , i = t.elements , r = this.elements , a = n[0] , o = n[4] , s = n[8] , l = n[12] , u = n[1] , c = n[5] , d = n[9] , h = n[13] , p = n[2] , f = n[6] , m = n[10] , v = n[14] , g = n[3] , y = n[7] , w = n[11] , b = n[15] , x = i[0] , E = i[4] , _ = i[8] , M = i[12] , A = i[1] , T = i[5] , S = i[9] , C = i[13] , P = i[2] , D = i[6] , k = i[10] , B = i[14] , e = i[3] , t = i[7] , n = i[11] , i = i[15]; return r[0] = a * x + o * A + s * P + l * e, r[4] = a * E + o * T + s * D + l * t, r[8] = a * _ + o * S + s * k + l * n, r[12] = a * M + o * C + s * B + l * i, r[1] = u * x + c * A + d * P + h * e, r[5] = u * E + c * T + d * D + h * t, r[9] = u * _ + c * S + d * k + h * n, r[13] = u * M + c * C + d * B + h * i, r[2] = p * x + f * A + m * P + v * e, r[6] = p * E + f * T + m * D + v * t, r[10] = p * _ + f * S + m * k + v * n, r[14] = p * M + f * C + m * B + v * i, r[3] = g * x + y * A + w * P + b * e, r[7] = g * E + y * T + w * D + b * t, r[11] = g * _ + y * S + w * k + b * n, r[15] = g * M + y * C + w * B + b * i, this } }, { key: "multiplyScalar", value: function(e) { var t = this.elements; return t[0] *= e, t[4] *= e, t[8] *= e, t[12] *= e, t[1] *= e, t[5] *= e, t[9] *= e, t[13] *= e, t[2] *= e, t[6] *= e, t[10] *= e, t[14] *= e, t[3] *= e, t[7] *= e, t[11] *= e, t[15] *= e, this } }, { key: "determinant", value: function() { var e = this.elements , t = e[0] , n = e[4] , i = e[8] , r = e[12] , a = e[1] , o = e[5] , s = e[9] , l = e[13] , u = e[2] , c = e[6] , d = e[10] , h = e[14]; return e[3] * (+r * s * c - i * l * c - r * o * d + n * l * d + i * o * h - n * s * h) + e[7] * (+t * s * h - t * l * d + r * a * d - i * a * h + i * l * u - r * s * u) + e[11] * (+t * l * c - t * o * h - r * a * c + n * a * h + r * o * u - n * l * u) + e[15] * (-i * o * u - t * s * c + t * o * d + i * a * c - n * a * d + n * s * u) } }, { key: "transpose", value: function() { var e = this.elements , t = e[1]; return e[1] = e[4], e[4] = t, t = e[2], e[2] = e[8], e[8] = t, t = e[6], e[6] = e[9], e[9] = t, t = e[3], e[3] = e[12], e[12] = t, t = e[7], e[7] = e[13], e[13] = t, t = e[11], e[11] = e[14], e[14] = t, this } }, { key: "setPosition", value: function(e, t, n) { var i = this.elements; return e.isVector3 ? (i[12] = e.x, i[13] = e.y, i[14] = e.z) : (i[12] = e, i[13] = t, i[14] = n), this } }, { key: "invert", value: function() { var e = this.elements , t = e[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] , v = e[15] , g = c * m * l - f * d * l + f * s * h - o * m * h - c * s * v + o * d * v , y = p * d * l - u * m * l - p * s * h + a * m * h + u * s * v - a * d * v , w = u * f * l - p * c * l + p * o * h - a * f * h - u * o * v + a * c * v , b = p * c * s - u * f * s - p * o * d + a * f * d + u * o * m - a * c * m , x = t * g + n * y + i * w + r * b; if (0 == x) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); x = 1 / x; return e[0] = g * x, e[1] = (f * d * r - c * m * r - f * i * h + n * m * h + c * i * v - n * d * v) * x, e[2] = (o * m * r - f * s * r + f * i * l - n * m * l - o * i * v + n * s * v) * x, e[3] = (c * s * r - o * d * r - c * i * l + n * d * l + o * i * h - n * s * h) * x, e[4] = y * x, e[5] = (u * m * r - p * d * r + p * i * h - t * m * h - u * i * v + t * d * v) * x, e[6] = (p * s * r - a * m * r - p * i * l + t * m * l + a * i * v - t * s * v) * x, e[7] = (a * d * r - u * s * r + u * i * l - t * d * l - a * i * h + t * s * h) * x, e[8] = w * x, e[9] = (p * c * r - u * f * r - p * n * h + t * f * h + u * n * v - t * c * v) * x, e[10] = (a * f * r - p * o * r + p * n * l - t * f * l - a * n * v + t * o * v) * x, e[11] = (u * o * r - a * c * r - u * n * l + t * c * l + a * n * h - t * o * h) * x, e[12] = b * x, e[13] = (u * f * i - p * c * i + p * n * d - t * f * d - u * n * m + t * c * m) * x, e[14] = (p * o * i - a * f * i - p * n * s + t * f * s + a * n * m - t * o * m) * x, e[15] = (a * c * i - u * o * i + u * n * s - t * c * s - a * n * d + t * o * d) * x, this } }, { key: "scale", value: function(e) { var t = this.elements , n = e.x , i = e.y , e = e.z; return t[0] *= n, t[4] *= i, t[8] *= e, t[1] *= n, t[5] *= i, t[9] *= e, t[2] *= n, t[6] *= i, t[10] *= e, t[3] *= n, t[7] *= i, t[11] *= e, this } }, { key: "getMaxScaleOnAxis", value: function() { var e = this.elements , t = e[0] * e[0] + e[1] * e[1] + e[2] * e[2] , n = e[4] * e[4] + e[5] * e[5] + e[6] * e[6] , e = e[8] * e[8] + e[9] * e[9] + e[10] * e[10]; return Math.sqrt(Math.max(t, n, e)) } }, { key: "makeTranslation", value: function(e, t, n) { return this.set(1, 0, 0, e, 0, 1, 0, t, 0, 0, 1, n, 0, 0, 0, 1), this } }, { key: "makeRotationX", value: function(e) { var t = Math.cos(e) , e = Math.sin(e); return this.set(1, 0, 0, 0, 0, t, -e, 0, 0, e, t, 0, 0, 0, 0, 1), this } }, { key: "makeRotationY", value: function(e) { var t = Math.cos(e) , e = Math.sin(e); return this.set(t, 0, e, 0, 0, 1, 0, 0, -e, 0, t, 0, 0, 0, 0, 1), this } }, { key: "makeRotationZ", value: function(e) { var t = Math.cos(e) , e = Math.sin(e); return this.set(t, -e, 0, 0, e, t, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this } }, { key: "makeRotationAxis", value: function(e, t) { var n = Math.cos(t) , i = Math.sin(t) , r = 1 - n , a = e.x , o = e.y , s = e.z , t = r * a , e = r * o; return this.set(t * a + n, t * o - i * s, t * s + i * o, 0, t * o + i * s, e * o + n, e * s - i * a, 0, t * s - i * o, e * s + i * a, r * s * s + n, 0, 0, 0, 0, 1), this } }, { key: "makeScale", value: function(e, t, n) { return this.set(e, 0, 0, 0, 0, t, 0, 0, 0, 0, n, 0, 0, 0, 0, 1), this } }, { key: "makeShear", value: function(e, t, n) { return this.set(1, t, n, 0, e, 1, n, 0, e, t, 1, 0, 0, 0, 0, 1), this } }, { key: "compose", value: function(e, t, n) { var i = this.elements , r = t._x , a = t._y , o = t._z , s = t._w , l = r + r , u = a + a , c = o + o , d = r * l , h = r * u , p = r * c , t = a * u , r = a * c , a = o * c , o = s * l , l = s * u , u = s * c , s = n.x , c = n.y , n = n.z; return i[0] = (1 - (t + a)) * s, i[1] = (h + u) * s, i[2] = (p - l) * s, i[3] = 0, i[4] = (h - u) * c, i[5] = (1 - (d + a)) * c, i[6] = (r + o) * c, i[7] = 0, i[8] = (p + l) * n, i[9] = (r - o) * n, i[10] = (1 - (d + t)) * n, i[11] = 0, i[12] = e.x, i[13] = e.y, i[14] = e.z, i[15] = 1, this } }, { key: "decompose", value: function(e, t, n) { var i = this.elements , r = ii.set(i[0], i[1], i[2]).length() , a = ii.set(i[4], i[5], i[6]).length() , o = ii.set(i[8], i[9], i[10]).length(); this.determinant() < 0 && (r = -r), e.x = i[12], e.y = i[13], e.z = i[14], ri.copy(this); var s = 1 / r , e = 1 / a , i = 1 / o; return ri.elements[0] *= s, ri.elements[1] *= s, ri.elements[2] *= s, ri.elements[4] *= e, ri.elements[5] *= e, ri.elements[6] *= e, ri.elements[8] *= i, ri.elements[9] *= i, ri.elements[10] *= i, t.setFromRotationMatrix(ri), n.x = r, n.y = a, n.z = o, this } }, { key: "makePerspective", value: function(e, t, n, i, r, a) { void 0 === a && console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs."); var o = this.elements , s = 2 * r / (n - i) , l = (t + e) / (t - e) , n = (n + i) / (n - i) , i = -(a + r) / (a - r) , a = -2 * a * r / (a - r); return o[0] = 2 * r / (t - e), o[4] = 0, o[8] = l, o[12] = 0, o[1] = 0, o[5] = s, o[9] = n, o[13] = 0, o[2] = 0, o[6] = 0, o[10] = i, o[14] = a, o[3] = 0, o[7] = 0, o[11] = -1, o[15] = 0, this } }, { key: "makeOrthographic", value: function(e, t, n, i, r, a) { var o = this.elements , s = 1 / (t - e) , l = 1 / (n - i) , u = 1 / (a - r) , e = (t + e) * s , i = (n + i) * l , r = (a + r) * u; return o[0] = 2 * s, o[4] = 0, o[8] = 0, o[12] = -e, o[1] = 0, o[5] = 2 * l, o[9] = 0, o[13] = -i, o[2] = 0, o[6] = 0, o[10] = -2 * u, o[14] = -r, o[3] = 0, o[7] = 0, o[11] = 0, o[15] = 1, this } }, { key: "equals", value: function(e) { for (var t = this.elements, n = e.elements, i = 0; i < 16; i++) if (t[i] !== n[i]) return !1; return !0 } }, { key: "fromArray", value: function(e) { for (var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, n = 0; n < 16; n++) this.elements[n] = e[n + t]; return this } }, { key: "toArray", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [] , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0 , n = this.elements; return e[t] = n[0], e[t + 1] = n[1], e[t + 2] = n[2], e[t + 3] = n[3], e[t + 4] = n[4], e[t + 5] = n[5], e[t + 6] = n[6], e[t + 7] = n[7], e[t + 8] = n[8], e[t + 9] = n[9], e[t + 10] = n[10], e[t + 11] = n[11], e[t + 12] = n[12], e[t + 13] = n[13], e[t + 14] = n[14], e[t + 15] = n[15], e } }]), e }() , ii = new Cn , ri = new ni , ai = new Cn(0,0,0) , oi = new Cn(1,1,1) , si = new Cn , li = new Cn , ui = new Cn , ci = function() { function r() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0 , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0 , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0 , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : r.DefaultOrder; O(this, r), Object.defineProperty(this, "isEuler", { value: !0 }), this._x = e, this._y = t, this._z = n, this._order = i } return h(r, [{ key: "x", get: function() { return this._x }, set: function(e) { this._x = e, this._onChangeCallback() } }, { key: "y", get: function() { return this._y }, set: function(e) { this._y = e, this._onChangeCallback() } }, { key: "z", get: function() { return this._z }, set: function(e) { this._z = e, this._onChangeCallback() } }, { key: "order", get: function() { return this._order }, set: function(e) { this._order = e, this._onChangeCallback() } }, { key: "set", value: function(e, t, n, i) { return this._x = e, this._y = t, this._z = n, this._order = i || this._order, this._onChangeCallback(), this } }, { key: "clone", value: function() { return new this.constructor(this._x,this._y,this._z,this._order) } }, { key: "copy", value: function(e) { return this._x = e._x, this._y = e._y, this._z = e._z, this._order = e._order, this._onChangeCallback(), this } }, { key: "setFromRotationMatrix", value: function(e, t, n) { var i = gn.clamp , e = e.elements , r = e[0] , a = e[4] , o = e[8] , s = e[1] , l = e[5] , u = e[9] , c = e[2] , d = e[6] , h = e[10]; switch (t = t || this._order) { case "XYZ": this._y = Math.asin(i(o, -1, 1)), Math.abs(o) < .9999999 ? (this._x = Math.atan2(-u, h), this._z = Math.atan2(-a, r)) : (this._x = Math.atan2(d, l), this._z = 0); break; case "YXZ": this._x = Math.asin(-i(u, -1, 1)), Math.abs(u) < .9999999 ? (this._y = Math.atan2(o, h), this._z = Math.atan2(s, l)) : (this._y = Math.atan2(-c, r), this._z = 0); break; case "ZXY": this._x = Math.asin(i(d, -1, 1)), Math.abs(d) < .9999999 ? (this._y = Math.atan2(-c, h), this._z = Math.atan2(-a, l)) : (this._y = 0, this._z = Math.atan2(s, r)); break; case "ZYX": this._y = Math.asin(-i(c, -1, 1)), Math.abs(c) < .9999999 ? (this._x = Math.atan2(d, h), this._z = Math.atan2(s, r)) : (this._x = 0, this._z = Math.atan2(-a, l)); break; case "YZX": this._z = Math.asin(i(s, -1, 1)), Math.abs(s) < .9999999 ? (this._x = Math.atan2(-u, l), this._y = Math.atan2(-c, r)) : (this._x = 0, this._y = Math.atan2(o, h)); break; case "XZY": this._z = Math.asin(-i(a, -1, 1)), Math.abs(a) < .9999999 ? (this._x = Math.atan2(d, l), this._y = Math.atan2(o, r)) : (this._x = Math.atan2(-u, h), this._y = 0); break; default: console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + t) } return this._order = t, !1 !== n && this._onChangeCallback(), this } }, { key: "setFromQuaternion", value: function(e, t, n) { return di.makeRotationFromQuaternion(e), this.setFromRotationMatrix(di, t, n) } }, { key: "setFromVector3", value: function(e, t) { return this.set(e.x, e.y, e.z, t || this._order) } }, { key: "reorder", value: function(e) { return hi.setFromEuler(this), this.setFromQuaternion(hi, e) } }, { key: "equals", value: function(e) { return e._x === this._x && e._y === this._y && e._z === this._z && e._order === this._order } }, { key: "fromArray", value: function(e) { return this._x = e[0], this._y = e[1], this._z = e[2], void 0 !== e[3] && (this._order = e[3]), this._onChangeCallback(), this } }, { key: "toArray", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [] , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; return e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._order, e } }, { key: "toVector3", value: function(e) { return e ? e.set(this._x, this._y, this._z) : new Cn(this._x,this._y,this._z) } }, { key: "_onChange", value: function(e) { return this._onChangeCallback = e, this } }, { key: "_onChangeCallback", value: function() {} }]), r }(); ci.DefaultOrder = "XYZ", ci.RotationOrders = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"]; var di = new ni , hi = new Sn , pi = function() { function e() { O(this, e), this.mask = 1 } return h(e, [{ key: "set", value: function(e) { this.mask = 1 << e | 0 } }, { key: "enable", value: function(e) { this.mask |= 1 << e | 0 } }, { key: "enableAll", value: function() { this.mask = -1 } }, { key: "toggle", value: function(e) { this.mask ^= 1 << e | 0 } }, { key: "disable", value: function(e) { this.mask &= ~(1 << e | 0) } }, { key: "disableAll", value: function() { this.mask = 0 } }, { key: "test", value: function(e) { return 0 != (this.mask & e.mask) } }]), e }() , fi = 0 , mi = new Cn , vi = new Sn , gi = new ni , yi = new Cn , wi = new Cn , bi = new Cn , xi = new Sn , Ei = new Cn(1,0,0) , _i = new Cn(0,1,0) , Mi = new Cn(0,0,1) , Ai = { type: "added" } , Ti = { type: "removed" }; function Si() { Object.defineProperty(this, "id", { value: fi++ }), this.uuid = gn.generateUUID(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = Si.DefaultUp.clone(); var e = new Cn , t = new ci , n = new Sn , i = new Cn(1,1,1); t._onChange(function() { n.setFromEuler(t, !1) }), n._onChange(function() { t.setFromQuaternion(n, void 0, !1) }), Object.defineProperties(this, { position: { configurable: !0, enumerable: !0, value: e }, rotation: { configurable: !0, enumerable: !0, value: t }, quaternion: { configurable: !0, enumerable: !0, value: n }, scale: { configurable: !0, enumerable: !0, value: i }, modelViewMatrix: { value: new ni }, normalMatrix: { value: new wn } }), this.matrix = new ni, this.matrixWorld = new ni, this.matrixAutoUpdate = Si.DefaultMatrixAutoUpdate, this.matrixWorldNeedsUpdate = !1, this.layers = new pi, this.visible = !0, this.castShadow = !1, this.receiveShadow = !1, this.frustumCulled = !0, this.renderOrder = 0, this.animations = [], this.userData = {} } Si.DefaultUp = new Cn(0,1,0), Si.DefaultMatrixAutoUpdate = !0, Si.prototype = Object.assign(Object.create(hn.prototype), { constructor: Si, isObject3D: !0, onBeforeRender: function() {}, onAfterRender: function() {}, applyMatrix4: function(e) { this.matrixAutoUpdate && this.updateMatrix(), this.matrix.premultiply(e), this.matrix.decompose(this.position, this.quaternion, this.scale) }, applyQuaternion: function(e) { return this.quaternion.premultiply(e), this }, setRotationFromAxisAngle: function(e, t) { this.quaternion.setFromAxisAngle(e, t) }, setRotationFromEuler: function(e) { this.quaternion.setFromEuler(e, !0) }, setRotationFromMatrix: function(e) { this.quaternion.setFromRotationMatrix(e) }, setRotationFromQuaternion: function(e) { this.quaternion.copy(e) }, rotateOnAxis: function(e, t) { return vi.setFromAxisAngle(e, t), this.quaternion.multiply(vi), this }, rotateOnWorldAxis: function(e, t) { return vi.setFromAxisAngle(e, t), this.quaternion.premultiply(vi), this }, rotateX: function(e) { return this.rotateOnAxis(Ei, e) }, rotateY: function(e) { return this.rotateOnAxis(_i, e) }, rotateZ: function(e) { return this.rotateOnAxis(Mi, e) }, translateOnAxis: function(e, t) { return mi.copy(e).applyQuaternion(this.quaternion), this.position.add(mi.multiplyScalar(t)), this }, translateX: function(e) { return this.translateOnAxis(Ei, e) }, translateY: function(e) { return this.translateOnAxis(_i, e) }, translateZ: function(e) { return this.translateOnAxis(Mi, e) }, localToWorld: function(e) { return e.applyMatrix4(this.matrixWorld) }, worldToLocal: function(e) { return e.applyMatrix4(gi.copy(this.matrixWorld).invert()) }, lookAt: function(e, t, n) { e.isVector3 ? yi.copy(e) : yi.set(e, t, n); n = this.parent; this.updateWorldMatrix(!0, !1), wi.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? gi.lookAt(wi, yi, this.up) : gi.lookAt(yi, wi, this.up), this.quaternion.setFromRotationMatrix(gi), n && (gi.extractRotation(n.matrixWorld), vi.setFromRotationMatrix(gi), this.quaternion.premultiply(vi.invert())) }, add: function(e) { if (1 < arguments.length) { for (var t = 0; t < arguments.length; t++) this.add(arguments[t]); return this } return e === this ? console.error("THREE.Object3D.add: object can't be added as a child of itself.", e) : e && e.isObject3D ? (null !== e.parent && e.parent.remove(e), (e.parent = this).children.push(e), e.dispatchEvent(Ai)) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", e), this }, remove: function(e) { if (1 < arguments.length) { for (var t = 0; t < arguments.length; t++) this.remove(arguments[t]); return this } var n = this.children.indexOf(e); return -1 !== n && (e.parent = null, this.children.splice(n, 1), e.dispatchEvent(Ti)), this }, clear: function() { for (var e = 0; e < this.children.length; e++) { var t = this.children[e]; t.parent = null, t.dispatchEvent(Ti) } return this.children.length = 0, this }, attach: function(e) { return this.updateWorldMatrix(!0, !1), gi.copy(this.matrixWorld).invert(), null !== e.parent && (e.parent.updateWorldMatrix(!0, !1), gi.multiply(e.parent.matrixWorld)), e.applyMatrix4(gi), e.updateWorldMatrix(!1, !1), this.add(e), this }, getObjectById: function(e) { return this.getObjectByProperty("id", e) }, getObjectByName: function(e) { return this.getObjectByProperty("name", e) }, getObjectByProperty: function(e, t) { if (this[e] === t) return this; for (var n = 0, i = this.children.length; n < i; n++) { var r = this.children[n].getObjectByProperty(e, t); if (void 0 !== r) return r } }, getWorldPosition: function(e) { return void 0 === e && (console.warn("THREE.Object3D: .getWorldPosition() target is now required"), e = new Cn), this.updateWorldMatrix(!0, !1), e.setFromMatrixPosition(this.matrixWorld) }, getWorldQuaternion: function(e) { return void 0 === e && (console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"), e = new Sn), this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(wi, e, bi), e }, getWorldScale: function(e) { return void 0 === e && (console.warn("THREE.Object3D: .getWorldScale() target is now required"), e = new Cn), this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(wi, xi, e), e }, getWorldDirection: function(e) { void 0 === e && (console.warn("THREE.Object3D: .getWorldDirection() target is now required"), e = new Cn), this.updateWorldMatrix(!0, !1); var t = this.matrixWorld.elements; return e.set(t[8], t[9], t[10]).normalize() }, raycast: function() {}, traverse: function(e) { var t = e(this); if (!t || !t.stopContinue) for (var n = this.children, i = 0, r = n.length; i < r; i++) n[i].traverse(e) }, traverseVisible: function(e) { if (!1 !== this.visible) { e(this); for (var t = this.children, n = 0, i = t.length; n < i; n++) t[n].traverseVisible(e) } }, traverseAncestors: function(e) { var t = this.parent; null !== t && (e(t), t.traverseAncestors(e)) }, updateMatrix: function() { this.matrix.compose(this.position, this.quaternion, this.scale), this.matrixWorldNeedsUpdate = !0 }, updateMatrixWorld: function(e) { this.matrixAutoUpdate && this.updateMatrix(), (this.matrixWorldNeedsUpdate || e) && (null === this.parent ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), e = !(this.matrixWorldNeedsUpdate = !1)); for (var t = this.children, n = 0, i = t.length; n < i; n++) t[n].updateMatrixWorld(e) }, updateWorldMatrix: function(e, t) { var n = this.parent; if (!0 === e && null !== n && n.updateWorldMatrix(!0, !1), this.matrixAutoUpdate && this.updateMatrix(), null === this.parent ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), !0 === t) for (var i = this.children, r = 0, a = i.length; r < a; r++) i[r].updateWorldMatrix(!1, !0) }, toJSON: function(n) { var e = void 0 === n || "string" == typeof n , t = {}; e && (n = { geometries: {}, materials: {}, textures: {}, images: {}, shapes: {}, skeletons: {}, animations: {} }, t.metadata = { version: 4.5, type: "Object", generator: "Object3D.toJSON" }); var i, r, a, o, s, l = {}; function u(e, t) { return void 0 === e[t.uuid] && (e[t.uuid] = t.toJSON(n)), t.uuid } if (l.uuid = this.uuid, l.type = this.type, "" !== this.name && (l.name = this.name), !0 === this.castShadow && (l.castShadow = !0), !0 === this.receiveShadow && (l.receiveShadow = !0), !1 === this.visible && (l.visible = !1), !1 === this.frustumCulled && (l.frustumCulled = !1), 0 !== this.renderOrder && (l.renderOrder = this.renderOrder), "{}" !== JSON.stringify(this.userData) && (l.userData = this.userData), l.layers = this.layers.mask, l.matrix = this.matrix.toArray(), !1 === this.matrixAutoUpdate && (l.matrixAutoUpdate = !1), this.isInstancedMesh && (l.type = "InstancedMesh", l.count = this.count, l.instanceMatrix = this.instanceMatrix.toJSON()), this.isMesh || this.isLine || this.isPoints) { l.geometry = u(n.geometries, this.geometry); var c = this.geometry.parameters; if (void 0 !== c && void 0 !== c.shapes) { var d = c.shapes; if (Array.isArray(d)) for (var h = 0, p = d.length; h < p; h++) { var f = d[h]; u(n.shapes, f) } else u(n.shapes, d) } } if (this.isSkinnedMesh && (l.bindMode = this.bindMode, l.bindMatrix = this.bindMatrix.toArray(), void 0 !== this.skeleton && (u(n.skeletons, this.skeleton), l.skeleton = this.skeleton.uuid)), void 0 !== this.material) if (Array.isArray(this.material)) { for (var m = [], v = 0, g = this.material.length; v < g; v++) m.push(u(n.materials, this.material[v])); l.material = m } else l.material = u(n.materials, this.material); if (0 < this.children.length) { l.children = []; for (var y = 0; y < this.children.length; y++) l.children.push(this.children[y].toJSON(n).object) } if (0 < this.animations.length) { l.animations = []; for (var w = 0; w < this.animations.length; w++) { var b = this.animations[w]; l.animations.push(u(n.animations, b)) } } return e && (i = x(n.geometries), r = x(n.materials), a = x(n.textures), o = x(n.images), s = x(n.shapes), c = x(n.skeletons), e = x(n.animations), 0 < i.length && (t.geometries = i), 0 < r.length && (t.materials = r), 0 < a.length && (t.textures = a), 0 < o.length && (t.images = o), 0 < s.length && (t.shapes = s), 0 < c.length && (t.skeletons = c), 0 < e.length && (t.animations = e)), t.object = l, t; function x(e) { var t, n = []; for (t in e) { var i = e[t]; delete i.metadata, n.push(i) } return n } }, clone: function(e) { return (new this.constructor).copy(this, e) }, copy: function(e) { var t = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1]; if (this.name = e.name, this.up.copy(e.up), this.position.copy(e.position), this.rotation.order = e.rotation.order, this.quaternion.copy(e.quaternion), this.scale.copy(e.scale), this.matrix.copy(e.matrix), this.matrixWorld.copy(e.matrixWorld), this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrixWorldNeedsUpdate = e.matrixWorldNeedsUpdate, this.layers.mask = e.layers.mask, this.visible = e.visible, this.castShadow = e.castShadow, this.receiveShadow = e.receiveShadow, this.frustumCulled = e.frustumCulled, this.renderOrder = e.renderOrder, this.userData = JSON.parse(JSON.stringify(e.userData)), !0 === t) for (var n = 0; n < e.children.length; n++) { var i = e.children[n]; this.add(i.clone()) } return this } }); var Ci = new Cn , Pi = new Cn , Di = new wn , ki = function() { function n(e, t) { O(this, n), Object.defineProperty(this, "isPlane", { value: !0 }), this.normal = void 0 !== e ? e : new Cn(1,0,0), this.constant = void 0 !== t ? t : 0 } return h(n, [{ key: "set", value: function(e, t) { return this.normal.copy(e), this.constant = t, this } }, { key: "setComponents", value: function(e, t, n, i) { return this.normal.set(e, t, n), this.constant = i, this } }, { key: "setFromNormalAndCoplanarPoint", value: function(e, t) { return this.normal.copy(e), this.constant = -t.dot(this.normal), this } }, { key: "setFromCoplanarPoints", value: function(e, t, n) { t = Ci.subVectors(n, t).cross(Pi.subVectors(e, t)).normalize(); return this.setFromNormalAndCoplanarPoint(t, e), this } }, { key: "clone", value: function() { return (new this.constructor).copy(this) } }, { key: "copy", value: function(e) { return this.normal.copy(e.normal), this.constant = e.constant, this } }, { key: "normalize", value: function() { var e = 1 / this.normal.length(); return this.normal.multiplyScalar(e), this.constant *= e, this } }, { key: "negate", value: function() { return this.constant *= -1, this.normal.negate(), this } }, { key: "distanceToPoint", value: function(e) { return this.normal.dot(e) + this.constant } }, { key: "distanceToSphere", value: function(e) { return this.distanceToPoint(e.center) - e.radius } }, { key: "projectPoint", value: function(e, t) { return void 0 === t && (console.warn("THREE.Plane: .projectPoint() target is now required"), t = new Cn), t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e) } }, { key: "intersectLine", value: function(e, t) { void 0 === t && (console.warn("THREE.Plane: .intersectLine() target is now required"), t = new Cn); var n = e.delta(Ci) , i = this.normal.dot(n); if (0 === i) return 0 === this.distanceToPoint(e.start) ? t.copy(e.start) : void 0; i = -(e.start.dot(this.normal) + this.constant) / i; return i < 0 || 1 < i ? void 0 : t.copy(n).multiplyScalar(i).add(e.start) } }, { key: "intersectsLine", value: function(e) { var t = this.distanceToPoint(e.start) , e = this.distanceToPoint(e.end); return t < 0 && 0 < e || e < 0 && 0 < t } }, { key: "intersectsBox", value: function(e) { return e.intersectsPlane(this) } }, { key: "intersectsSphere", value: function(e) { return e.intersectsPlane(this) } }, { key: "coplanarPoint", value: function(e) { return void 0 === e && (console.warn("THREE.Plane: .coplanarPoint() target is now required"), e = new Cn), e.copy(this.normal).multiplyScalar(-this.constant) } }, { key: "applyMatrix4", value: function(e, t) { t = t || Di.getNormalMatrix(e), e = this.coplanarPoint(Ci).applyMatrix4(e), t = this.normal.applyMatrix3(t).normalize(); return this.constant = -e.dot(t), this } }, { key: "translate", value: function(e) { return this.constant -= e.dot(this.normal), this } }, { key: "equals", value: function(e) { return e.normal.equals(this.normal) && e.constant === this.constant } }]), n }() , Bi = new Cn , Li = new Cn , Ri = new Cn , Fi = new Cn , Ii = new Cn , Oi = new Cn , zi = new Cn , Ni = new Cn , Ui = new Cn , Gi = new Cn , Hi = function() { function a(e, t, n) { O(this, a), this.a = void 0 !== e ? e : new Cn, this.b = void 0 !== t ? t : new Cn, this.c = void 0 !== n ? n : new Cn } return h(a, [{ key: "set", value: function(e, t, n) { return this.a.copy(e), this.b.copy(t), this.c.copy(n), this } }, { key: "setFromPointsAndIndices", value: function(e, t, n, i) { return this.a.copy(e[t]), this.b.copy(e[n]), this.c.copy(e[i]), this } }, { key: "clone", value: function() { return (new this.constructor).copy(this) } }, { key: "copy", value: function(e) { return this.a.copy(e.a), this.b.copy(e.b), this.c.copy(e.c), this } }, { key: "getArea", value: function() { return Bi.subVectors(this.c, this.b), Li.subVectors(this.a, this.b), .5 * Bi.cross(Li).length() } }, { key: "getMidpoint", value: function(e) { return void 0 === e && (console.warn("THREE.Triangle: .getMidpoint() target is now required"), e = new Cn), e.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3) } }, { key: "getNormal", value: function(e) { return a.getNormal(this.a, this.b, this.c, e) } }, { key: "getPlane", value: function(e) { return void 0 === e && (console.warn("THREE.Triangle: .getPlane() target is now required"), e = new ki), e.setFromCoplanarPoints(this.a, this.b, this.c) } }, { key: "getBarycoord", value: function(e, t) { return a.getBarycoord(e, this.a, this.b, this.c, t) } }, { key: "getUV", value: function(e, t, n, i, r) { return a.getUV(e, this.a, this.b, this.c, t, n, i, r) } }, { key: "containsPoint", value: function(e) { return a.containsPoint(e, this.a, this.b, this.c) } }, { key: "isFrontFacing", value: function(e) { return a.isFrontFacing(this.a, this.b, this.c, e) } }, { key: "intersectsBox", value: function(e) { return e.intersectsTriangle(this) } }, { key: "closestPointToPoint", value: function(e, t) { void 0 === t && (console.warn("THREE.Triangle: .closestPointToPoint() target is now required"), t = new Cn); var n = this.a , i = this.b , r = this.c; Ii.subVectors(i, n), Oi.subVectors(r, n), Ni.subVectors(e, n); var a = Ii.dot(Ni) , o = Oi.dot(Ni); if (a <= 0 && o <= 0) return t.copy(n); Ui.subVectors(e, i); var s = Ii.dot(Ui) , l = Oi.dot(Ui); if (0 <= s && l <= s) return t.copy(i); var u = a * l - s * o; if (u <= 0 && 0 <= a && s <= 0) return d = a / (a - s), t.copy(n).addScaledVector(Ii, d); Gi.subVectors(e, r); var c = Ii.dot(Gi) , e = Oi.dot(Gi); if (0 <= e && c <= e) return t.copy(r); a = c * o - a * e; if (a <= 0 && 0 <= o && e <= 0) return h = o / (o - e), t.copy(n).addScaledVector(Oi, h); o = s * e - c * l; if (o <= 0 && 0 <= l - s && 0 <= c - e) return zi.subVectors(r, i), h = (l - s) / (l - s + (c - e)), t.copy(i).addScaledVector(zi, h); var o = 1 / (o + a + u) , d = a * o , h = u * o; return t.copy(n).addScaledVector(Ii, d).addScaledVector(Oi, h) } }, { key: "equals", value: function(e) { return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c) } }], [{ key: "getNormal", value: function(e, t, n, i) { void 0 === i && (console.warn("THREE.Triangle: .getNormal() target is now required"), i = new Cn), i.subVectors(n, t), Bi.subVectors(e, t), i.cross(Bi); t = i.lengthSq(); return 0 < t ? i.multiplyScalar(1 / Math.sqrt(t)) : i.set(0, 0, 0) } }, { key: "getBarycoord", value: function(e, t, n, i, r) { Bi.subVectors(i, t), Li.subVectors(n, t), Ri.subVectors(e, t); var a = Bi.dot(Bi) , o = Bi.dot(Li) , i = Bi.dot(Ri) , n = Li.dot(Li) , e = Li.dot(Ri) , t = a * n - o * o; if (void 0 === r && (console.warn("THREE.Triangle: .getBarycoord() target is now required"), r = new Cn), 0 == t) return r.set(-2, -1, -1); t = 1 / t, n = (n * i - o * e) * t, t *= a * e - o * i; return r.set(1 - n - t, t, n) } }, { key: "containsPoint", value: function(e, t, n, i) { return this.getBarycoord(e, t, n, i, Fi), 0 <= Fi.x && 0 <= Fi.y && Fi.x + Fi.y <= 1 } }, { key: "getUV", value: function(e, t, n, i, r, a, o, s) { return this.getBarycoord(e, t, n, i, Fi), s.set(0, 0), s.addScaledVector(r, Fi.x), s.addScaledVector(a, Fi.y), s.addScaledVector(o, Fi.z), s } }, { key: "isFrontFacing", value: function(e, t, n, i) { return Bi.subVectors(n, t), Li.subVectors(e, t), Bi.cross(Li).dot(i) < 0 } }]), a }() , Vi = { aliceblue: 15792383, antiquewhite: 16444375, aqua: 65535, aquamarine: 8388564, azure: 15794175, beige: 16119260, bisque: 16770244, black: 0, blanchedalmond: 16772045, blue: 255, blueviolet: 9055202, brown: 10824234, burlywood: 14596231, cadetblue: 6266528, chartreuse: 8388352, chocolate: 13789470, coral: 16744272, cornflowerblue: 6591981, cornsilk: 16775388, crimson: 14423100, cyan: 65535, darkblue: 139, darkcyan: 35723, darkgoldenrod: 12092939, darkgray: 11119017, darkgreen: 25600, darkgrey: 11119017, darkkhaki: 12433259, darkmagenta: 9109643, darkolivegreen: 5597999, darkorange: 16747520, darkorchid: 10040012, darkred: 9109504, darksalmon: 15308410, darkseagreen: 9419919, darkslateblue: 4734347, darkslategray: 3100495, darkslategrey: 3100495, darkturquoise: 52945, darkviolet: 9699539, deeppink: 16716947, deepskyblue: 49151, dimgray: 6908265, dimgrey: 6908265, dodgerblue: 2003199, firebrick: 11674146, floralwhite: 16775920, forestgreen: 2263842, fuchsia: 16711935, gainsboro: 14474460, ghostwhite: 16316671, gold: 16766720, goldenrod: 14329120, gray: 8421504, green: 32768, greenyellow: 11403055, grey: 8421504, honeydew: 15794160, hotpink: 16738740, indianred: 13458524, indigo: 4915330, ivory: 16777200, khaki: 15787660, lavender: 15132410, lavenderblush: 16773365, lawngreen: 8190976, lemonchiffon: 16775885, lightblue: 11393254, lightcoral: 15761536, lightcyan: 14745599, lightgoldenrodyellow: 16448210, lightgray: 13882323, lightgreen: 9498256, lightgrey: 13882323, lightpink: 16758465, lightsalmon: 16752762, lightseagreen: 2142890, lightskyblue: 8900346, lightslategray: 7833753, lightslategrey: 7833753, lightsteelblue: 11584734, lightyellow: 16777184, lime: 65280, limegreen: 3329330, linen: 16445670, magenta: 16711935, maroon: 8388608, mediumaquamarine: 6737322, mediumblue: 205, mediumorchid: 12211667, mediumpurple: 9662683, mediumseagreen: 3978097, mediumslateblue: 8087790, mediumspringgreen: 64154, mediumturquoise: 4772300, mediumvioletred: 13047173, midnightblue: 1644912, mintcream: 16121850, mistyrose: 16770273, moccasin: 16770229, navajowhite: 16768685, navy: 128, oldlace: 16643558, olive: 8421376, olivedrab: 7048739, orange: 16753920, orangered: 16729344, orchid: 14315734, palegoldenrod: 15657130, palegreen: 10025880, paleturquoise: 11529966, palevioletred: 14381203, papayawhip: 16773077, peachpuff: 16767673, peru: 13468991, pink: 16761035, plum: 14524637, powderblue: 11591910, purple: 8388736, rebeccapurple: 6697881, red: 16711680, rosybrown: 12357519, royalblue: 4286945, saddlebrown: 9127187, salmon: 16416882, sandybrown: 16032864, seagreen: 3050327, seashell: 16774638, sienna: 10506797, silver: 12632256, skyblue: 8900331, slateblue: 6970061, slategray: 7372944, slategrey: 7372944, snow: 16775930, springgreen: 65407, steelblue: 4620980, tan: 13808780, teal: 32896, thistle: 14204888, tomato: 16737095, turquoise: 4251856, violet: 15631086, wheat: 16113331, white: 16777215, whitesmoke: 16119285, yellow: 16776960, yellowgreen: 10145074 } , ji = { h: 0, s: 0, l: 0 } , Wi = { h: 0, s: 0, l: 0 }; function Xi(e, t, n) { return n < 0 && (n += 1), 1 < n && --n, n < 1 / 6 ? e + 6 * (t - e) * n : n < .5 ? t : n < 2 / 3 ? e + 6 * (t - e) * (2 / 3 - n) : e } function qi(e) { return e < .04045 ? .0773993808 * e : Math.pow(.9478672986 * e + .0521327014, 2.4) } function Ji(e) { return e < .0031308 ? 12.92 * e : 1.055 * Math.pow(e, .41666) - .055 } var Yi = function() { function i(e, t, n) { return O(this, i), Object.defineProperty(this, "isColor", { value: !0 }), void 0 === t && void 0 === n ? this.set(e) : this.setRGB(e, t, n) } return h(i, [{ key: "set", value: function(e) { return e && e.isColor ? this.copy(e) : "number" == typeof e ? this.setHex(e) : "string" == typeof e && this.setStyle(e), this } }, { key: "setScalar", value: function(e) { return this.r = e, this.g = e, this.b = e, this } }, { key: "setHex", value: function(e) { return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (255 & e) / 255, this } }, { key: "setRGB", value: function(e, t, n) { return this.r = e, this.g = t, this.b = n, this } }, { key: "setHSL", value: function(e, t, n) { return e = gn.euclideanModulo(e, 1), t = gn.clamp(t, 0, 1), n = gn.clamp(n, 0, 1), 0 === t ? this.r = this.g = this.b = n : (this.r = Xi(t = 2 * n - (n = n <= .5 ? n * (1 + t) : n + t - n * t), n, e + 1 / 3), this.g = Xi(t, n, e), this.b = Xi(t, n, e - 1 / 3)), this } }, { key: "setStyle", value: function(t) { function e(e) { void 0 !== e && parseFloat(e) < 1 && console.warn("THREE.Color: Alpha component of " + t + " will be ignored.") } if (l = /^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)) { var n, i = l[1], r = l[2]; switch (i) { case "rgb": case "rgba": if (n = /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)) return this.r = Math.min(255, parseInt(n[1], 10)) / 255, this.g = Math.min(255, parseInt(n[2], 10)) / 255, this.b = Math.min(255, parseInt(n[3], 10)) / 255, e(n[4]), this; if (n = /^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)) return this.r = Math.min(100, parseInt(n[1], 10)) / 100, this.g = Math.min(100, parseInt(n[2], 10)) / 100, this.b = Math.min(100, parseInt(n[3], 10)) / 100, e(n[4]), this; break; case "hsl": case "hsla": if (n = /^(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)) { var a = parseFloat(n[1]) / 360 , o = parseInt(n[2], 10) / 100 , s = parseInt(n[3], 10) / 100; return e(n[4]), this.setHSL(a, o, s) } } } else if (l = /^\#([A-Fa-f\d]+)$/.exec(t)) { var i = l[1] , l = i.length; if (3 === l) return this.r = parseInt(i.charAt(0) + i.charAt(0), 16) / 255, this.g = parseInt(i.charAt(1) + i.charAt(1), 16) / 255, this.b = parseInt(i.charAt(2) + i.charAt(2), 16) / 255, this; if (6 === l) return this.r = parseInt(i.charAt(0) + i.charAt(1), 16) / 255, this.g = parseInt(i.charAt(2) + i.charAt(3), 16) / 255, this.b = parseInt(i.charAt(4) + i.charAt(5), 16) / 255, this } return t && 0 < t.length ? this.setColorName(t) : this } }, { key: "setColorName", value: function(e) { var t = Vi[e]; return void 0 !== t ? this.setHex(t) : console.warn("THREE.Color: Unknown color " + e), this } }, { key: "clone", value: function() { return new this.constructor(this.r,this.g,this.b) } }, { key: "copy", value: function(e) { return this.r = e.r, this.g = e.g, this.b = e.b, this } }, { key: "copyGammaToLinear", value: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 2; return this.r = Math.pow(e.r, t), this.g = Math.pow(e.g, t), this.b = Math.pow(e.b, t), this } }, { key: "copyLinearToGamma", value: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 2 , t = 0 < t ? 1 / t : 1; return this.r = Math.pow(e.r, t), this.g = Math.pow(e.g, t), this.b = Math.pow(e.b, t), this } }, { key: "convertGammaToLinear", value: function(e) { return this.copyGammaToLinear(this, e), this } }, { key: "convertLinearToGamma", value: function(e) { return this.copyLinearToGamma(this, e), this } }, { key: "copySRGBToLinear", value: function(e) { return this.r = qi(e.r), this.g = qi(e.g), this.b = qi(e.b), this } }, { key: "copyLinearToSRGB", value: function(e) { return this.r = Ji(e.r), this.g = Ji(e.g), this.b = Ji(e.b), this } }, { key: "convertSRGBToLinear", value: function() { return this.copySRGBToLinear(this), this } }, { key: "convertLinearToSRGB", value: function() { return this.copyLinearToSRGB(this), this } }, { key: "getHex", value: function() { return 255 * this.r << 16 ^ 255 * this.g << 8 ^ 255 * this.b << 0 } }, { key: "getHexString", value: function() { return ("000000" + this.getHex().toString(16)).slice(-6) } }, { key: "getHSL", value: function(e) { void 0 === e && (console.warn("THREE.Color: .getHSL() target is now required"), e = { h: 0, s: 0, l: 0 }); var t, n = this.r, i = this.g, r = this.b, a = Math.max(n, i, r), o = Math.min(n, i, r), s = (o + a) / 2; if (o === a) u = t = 0; else { var l = a - o , u = s <= .5 ? l / (a + o) : l / (2 - a - o); switch (a) { case n: t = (i - r) / l + (i < r ? 6 : 0); break; case i: t = (r - n) / l + 2; break; case r: t = (n - i) / l + 4 } t /= 6 } return e.h = t, e.s = u, e.l = s, e } }, { key: "getStyle", value: function() { return "rgb(" + (255 * this.r | 0) + "," + (255 * this.g | 0) + "," + (255 * this.b | 0) + ")" } }, { key: "offsetHSL", value: function(e, t, n) { return this.getHSL(ji), ji.h += e, ji.s += t, ji.l += n, this.setHSL(ji.h, ji.s, ji.l), this } }, { key: "add", value: function(e) { return this.r += e.r, this.g += e.g, this.b += e.b, this } }, { key: "addColors", value: function(e, t) { return this.r = e.r + t.r, this.g = e.g + t.g, this.b = e.b + t.b, this } }, { key: "addScalar", value: function(e) { return this.r += e, this.g += e, this.b += e, this } }, { key: "sub", value: function(e) { return this.r = Math.max(0, this.r - e.r), this.g = Math.max(0, this.g - e.g), this.b = Math.max(0, this.b - e.b), this } }, { key: "multiply", value: function(e) { return this.r *= e.r, this.g *= e.g, this.b *= e.b, this } }, { key: "multiplyScalar", value: function(e) { return this.r *= e, this.g *= e, this.b *= e, this } }, { key: "lerp", value: function(e, t) { return this.r += (e.r - this.r) * t, this.g += (e.g - this.g) * t, this.b += (e.b - this.b) * t, this } }, { key: "lerpHSL", value: function(e, t) { this.getHSL(ji), e.getHSL(Wi); var n = gn.lerp(ji.h, Wi.h, t) , e = gn.lerp(ji.s, Wi.s, t) , t = gn.lerp(ji.l, Wi.l, t); return this.setHSL(n, e, t), this } }, { key: "equals", value: function(e) { return e.r === this.r && e.g === this.g && e.b === this.b } }, { key: "fromArray", value: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; return this.r = e[t], this.g = e[t + 1], this.b = e[t + 2], this } }, { key: "toArray", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [] , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; return e[t] = this.r, e[t + 1] = this.g, e[t + 2] = this.b, e } }, { key: "fromBufferAttribute", value: function(e, t) { return this.r = e.getX(t), this.g = e.getY(t), this.b = e.getZ(t), !0 === e.normalized && (this.r /= 255, this.g /= 255, this.b /= 255), this } }, { key: "toJSON", value: function() { return this.getHex() } }]), i }(); Yi.NAMES = Vi, Yi.prototype.r = 1, Yi.prototype.g = 1, Yi.prototype.b = 1; var Zi = function() { function o(e, t, n, i, r) { var a = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 0; O(this, o), this.a = e, this.b = t, this.c = n, this.normal = i && i.isVector3 ? i : new Cn, this.vertexNormals = Array.isArray(i) ? i : [], this.color = r && r.isColor ? r : new Yi, this.vertexColors = Array.isArray(r) ? r : [], this.materialIndex = a } return h(o, [{ key: "clone", value: function() { return (new this.constructor).copy(this) } }, { key: "copy", value: function(e) { this.a = e.a, this.b = e.b, this.c = e.c, this.normal.copy(e.normal), this.color.copy(e.color), this.materialIndex = e.materialIndex; for (var t = 0, n = e.vertexNormals.length; t < n; t++) this.vertexNormals[t] = e.vertexNormals[t].clone(); for (var i = 0, r = e.vertexColors.length; i < r; i++) this.vertexColors[i] = e.vertexColors[i].clone(); return this } }]), o }() , Qi = 0; function Ki() { Object.defineProperty(this, "id", { value: Qi++ }), this.uuid = gn.generateUUID(), this.name = "", this.type = "Material", this.fog = !0, this.blending = K, this.side = q, this.flatShading = !1, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.blendSrc = me, this.blendDst = ve, this.blendEquation = re, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.depthFunc = Ae, this.depthTest = !0, this.depthWrite = !0, this.stencilWriteMask = 255, this.stencilFunc = 519, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = 7680, this.stencilZFail = 7680, this.stencilZPass = 7680, this.stencilWrite = !1, this.clippingPlanes = null, this.clipIntersection = !1, this.clipShadows = !1, this.shadowSide = null, this.colorWrite = !0, this.precision = null, this.polygonOffset = !1, this.polygonOffsetFactor = 0, this.polygonOffsetUnits = 0, this.dithering = !1, this.alphaTest = 0, this.premultipliedAlpha = !1, this.visible = !0, this.toneMapped = !0, this.userData = {}, this.version = 0 } function $i(e) { Ki.call(this), this.type = "MeshBasicMaterial", this.color = new Yi(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = k, this.reflectivity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframelineWidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.skinning = !1, this.morphTargets = !1, this.setValues(e) } Ki.prototype = Object.assign(Object.create(hn.prototype), { constructor: Ki, isMaterial: !0, onBeforeCompile: function() {}, customProgramCacheKey: function() { return this.onBeforeCompile.toString() }, setValues: function(e) { if (void 0 !== e) for (var t in e) { var n, i = e[t]; void 0 !== i ? "shading" !== t ? void 0 !== (n = this[t]) ? n && n.isColor ? n.set(i) : n && n.isVector3 && i && i.isVector3 ? n.copy(i) : this[t] = i : console.warn("THREE." + this.type + ": '" + t + "' is not a property of this material.") : (console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."), this.flatShading = 1 === i) : console.warn("THREE.Material: '" + t + "' parameter is undefined.") } }, toJSON: function(e) { var t = void 0 === e || "string" == typeof e; t && (e = { textures: {}, images: {} }); var n = { metadata: { version: 4.5, type: "Material", generator: "Material.toJSON" } }; function i(e) { var t, n = []; for (t in e) { var i = e[t]; delete i.metadata, n.push(i) } return n } return n.uuid = this.uuid, n.type = this.type, "" !== this.name && (n.name = this.name), this.color && this.color.isColor && (n.color = this.color.getHex()), void 0 !== this.roughness && (n.roughness = this.roughness), void 0 !== this.metalness && (n.metalness = this.metalness), this.sheen && this.sheen.isColor && (n.sheen = this.sheen.getHex()), this.emissive && this.emissive.isColor && (n.emissive = this.emissive.getHex()), this.emissiveIntensity && 1 !== this.emissiveIntensity && (n.emissiveIntensity = this.emissiveIntensity), this.specular && this.specular.isColor && (n.specular = this.specular.getHex()), void 0 !== this.shininess && (n.shininess = this.shininess), void 0 !== this.clearcoat && (n.clearcoat = this.clearcoat), void 0 !== this.clearcoatRoughness && (n.clearcoatRoughness = this.clearcoatRoughness), this.clearcoatMap && this.clearcoatMap.isTexture && (n.clearcoatMap = this.clearcoatMap.toJSON(e).uuid), this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (n.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(e).uuid), this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (n.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(e).uuid, n.clearcoatNormalScale = this.clearcoatNormalScale.toArray()), this.map && this.map.isTexture && (n.map = this.map.toJSON(e).uuid), this.matcap && this.matcap.isTexture && (n.matcap = this.matcap.toJSON(e).uuid), this.alphaMap && this.alphaMap.isTexture && (n.alphaMap = this.alphaMap.toJSON(e).uuid), this.lightMap && this.lightMap.isTexture && (n.lightMap = this.lightMap.toJSON(e).uuid), this.aoMap && this.aoMap.isTexture && (n.aoMap = this.aoMap.toJSON(e).uuid, n.aoMapIntensity = this.aoMapIntensity), this.bumpMap && this.bumpMap.isTexture && (n.bumpMap = this.bumpMap.toJSON(e).uuid, n.bumpScale = this.bumpScale), this.normalMap && this.normalMap.isTexture && (n.normalMap = this.normalMap.toJSON(e).uuid, n.normalMapType = this.normalMapType, n.normalScale = this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (n.displacementMap = this.displacementMap.toJSON(e).uuid, n.displacementScale = this.displacementScale, n.displacementBias = this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (n.roughnessMap = this.roughnessMap.toJSON(e).uuid), this.metalnessMap && this.metalnessMap.isTexture && (n.metalnessMap = this.metalnessMap.toJSON(e).uuid), this.emissiveMap && this.emissiveMap.isTexture && (n.emissiveMap = this.emissiveMap.toJSON(e).uuid), this.specularMap && this.specularMap.isTexture && (n.specularMap = this.specularMap.toJSON(e).uuid), this.envMap && this.envMap.isTexture && (n.envMap = this.envMap.toJSON(e).uuid, n.reflectivity = this.reflectivity, n.refractionRatio = this.refractionRatio, void 0 !== this.combine && (n.combine = this.combine), void 0 !== this.envMapIntensity && (n.envMapIntensity = this.envMapIntensity)), this.gradientMap && this.gradientMap.isTexture && (n.gradientMap = this.gradientMap.toJSON(e).uuid), void 0 !== this.size && (n.size = this.size), void 0 !== this.sizeAttenuation && (n.sizeAttenuation = this.sizeAttenuation), this.blending !== K && (n.blending = this.blending), !0 === this.flatShading && (n.flatShading = this.flatShading), this.side !== q && (n.side = this.side), this.vertexColors && (n.vertexColors = !0), this.opacity < 1 && (n.opacity = this.opacity), !0 === this.transparent && (n.transparent = this.transparent), n.depthFunc = this.depthFunc, n.depthTest = this.depthTest, n.depthWrite = this.depthWrite, n.stencilWrite = this.stencilWrite, n.stencilWriteMask = this.stencilWriteMask, n.stencilFunc = this.stencilFunc, n.stencilRef = this.stencilRef, n.stencilFuncMask = this.stencilFuncMask, n.stencilFail = this.stencilFail, n.stencilZFail = this.stencilZFail, n.stencilZPass = this.stencilZPass, this.rotation && 0 !== this.rotation && (n.rotation = this.rotation), !0 === this.polygonOffset && (n.polygonOffset = !0), 0 !== this.polygonOffsetFactor && (n.polygonOffsetFactor = this.polygonOffsetFactor), 0 !== this.polygonOffsetUnits && (n.polygonOffsetUnits = this.polygonOffsetUnits), this.lineWidth && 1 !== this.lineWidth && (n.lineWidth = this.lineWidth), void 0 !== this.dashSize && (n.dashSize = this.dashSize), void 0 !== this.gapSize && (n.gapSize = this.gapSize), void 0 !== this.scale && (n.scale = this.scale), !0 === this.dithering && (n.dithering = !0), 0 < this.alphaTest && (n.alphaTest = this.alphaTest), !0 === this.premultipliedAlpha && (n.premultipliedAlpha = this.premultipliedAlpha), !0 === this.wireframe && (n.wireframe = this.wireframe), 1 < this.wireframelineWidth && (n.wireframelineWidth = this.wireframelineWidth), "round" !== this.wireframeLinecap && (n.wireframeLinecap = this.wireframeLinecap), "round" !== this.wireframeLinejoin && (n.wireframeLinejoin = this.wireframeLinejoin), !0 === this.morphTargets && (n.morphTargets = !0), !0 === this.morphNormals && (n.morphNormals = !0), !0 === this.skinning && (n.skinning = !0), !1 === this.visible && (n.visible = !1), !1 === this.toneMapped && (n.toneMapped = !1), "{}" !== JSON.stringify(this.userData) && (n.userData = this.userData), t && (t = i(e.textures), e = i(e.images), 0 < t.length && (n.textures = t), 0 < e.length && (n.images = e)), n }, clone: function() { return (new this.constructor).copy(this) }, copy: function(e) { this.name = e.name, this.fog = e.fog, this.blending = e.blending, this.side = e.side, this.flatShading = e.flatShading, this.vertexColors = e.vertexColors, this.opacity = e.opacity, this.transparent = e.transparent, this.blendSrc = e.blendSrc, this.blendDst = e.blendDst, this.blendEquation = e.blendEquation, this.blendSrcAlpha = e.blendSrcAlpha, this.blendDstAlpha = e.blendDstAlpha, this.blendEquationAlpha = e.blendEquationAlpha, this.depthFunc = e.depthFunc, this.depthTest = e.depthTest, this.depthWrite = e.depthWrite, this.stencilWriteMask = e.stencilWriteMask, this.stencilFunc = e.stencilFunc, this.stencilRef = e.stencilRef, this.stencilFuncMask = e.stencilFuncMask, this.stencilFail = e.stencilFail, this.stencilZFail = e.stencilZFail, this.stencilZPass = e.stencilZPass, this.stencilWrite = e.stencilWrite; var t = e.clippingPlanes , n = null; if (null !== t) for (var i = t.length, n = new Array(i), r = 0; r !== i; ++r) n[r] = t[r].clone(); return this.clippingPlanes = n, this.clipIntersection = e.clipIntersection, this.clipShadows = e.clipShadows, this.shadowSide = e.shadowSide, this.colorWrite = e.colorWrite, this.precision = e.precision, this.polygonOffset = e.polygonOffset, this.polygonOffsetFactor = e.polygonOffsetFactor, this.polygonOffsetUnits = e.polygonOffsetUnits, this.dithering = e.dithering, this.alphaTest = e.alphaTest, this.premultipliedAlpha = e.premultipliedAlpha, this.visible = e.visible, this.toneMapped = e.toneMapped, this.userData = JSON.parse(JSON.stringify(e.userData)), this }, dispose: function() { this.dispatchEvent({ type: "dispose" }) } }), Object.defineProperty(Ki.prototype, "needsUpdate", { set: function(e) { !0 === e && this.version++ } }), (($i.prototype = Object.create(Ki.prototype)).constructor = $i).prototype.isMeshBasicMaterial = !0, $i.prototype.copy = function(e) { return Ki.prototype.copy.call(this, e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframelineWidth = e.wireframelineWidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.skinning = e.skinning, this.morphTargets = e.morphTargets, this } ; var er = new Cn , tr = new yn; function nr(e, t, n) { if (Array.isArray(e)) throw new TypeError("THREE.BufferAttribute: array should be a Typed Array."); this.name = "", this.array = e, this.itemSize = t, this.count = void 0 !== e ? e.length / t : 0, this.normalized = !0 === n, this.usage = un, this.updateRange = { offset: 0, count: -1 }, this.version = 0 } function ir(e, t, n) { nr.call(this, new Int8Array(e), t, n) } function rr(e, t, n) { nr.call(this, new Uint8Array(e), t, n) } function ar(e, t, n) { nr.call(this, new Uint8ClampedArray(e), t, n) } function or(e, t, n) { nr.call(this, new Int16Array(e), t, n) } function sr(e, t, n) { nr.call(this, new Uint16Array(e), t, n) } function lr(e, t, n) { nr.call(this, new Int32Array(e), t, n) } function ur(e, t, n) { nr.call(this, new Uint32Array(e), t, n) } function cr(e, t, n) { nr.call(this, new Uint16Array(e), t, n) } function dr(e, t, n) { nr.call(this, new Float32Array(e), t, n) } function hr(e, t, n) { nr.call(this, new Float64Array(e), t, n) } Object.defineProperty(nr.prototype, "needsUpdate", { set: function(e) { !0 === e && this.version++ } }), Object.assign(nr.prototype, { isBufferAttribute: !0, onUploadCallback: function() {}, setUsage: function(e) { return this.usage = e, this }, copy: function(e) { return this.name = e.name, this.array = new e.array.constructor(e.array), this.itemSize = e.itemSize, this.count = e.count, this.normalized = e.normalized, this.usage = e.usage, this }, copyAt: function(e, t, n) { e *= this.itemSize, n *= t.itemSize; for (var i = 0, r = this.itemSize; i < r; i++) this.array[e + i] = t.array[n + i]; return this }, copyArray: function(e) { return this.array.set(e), this }, copyColorsArray: function(e) { for (var t = this.array, n = 0, i = 0, r = e.length; i < r; i++) { var a = e[i]; void 0 === a && (console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined", i), a = new Yi), t[n++] = a.r, t[n++] = a.g, t[n++] = a.b } return this }, copyVector2sArray: function(e) { for (var t = this.array, n = 0, i = 0, r = e.length; i < r; i++) { var a = e[i]; void 0 === a && (console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined", i), a = new yn), t[n++] = a.x, t[n++] = a.y } return this }, copyVector3sArray: function(e) { for (var t = this.array, n = 0, i = 0, r = e.length; i < r; i++) { var a = e[i]; void 0 === a && (console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined", i), a = new Cn), t[n++] = a.x, t[n++] = a.y, t[n++] = a.z } return this }, copyVector4sArray: function(e) { for (var t = this.array, n = 0, i = 0, r = e.length; i < r; i++) { var a = e[i]; void 0 === a && (console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined", i), a = new Mn), t[n++] = a.x, t[n++] = a.y, t[n++] = a.z, t[n++] = a.w } return this }, applyMatrix3: function(e) { if (2 === this.itemSize) for (var t = 0, n = this.count; t < n; t++) tr.fromBufferAttribute(this, t), tr.applyMatrix3(e), this.setXY(t, tr.x, tr.y); else if (3 === this.itemSize) for (var i = 0, r = this.count; i < r; i++) er.fromBufferAttribute(this, i), er.applyMatrix3(e), this.setXYZ(i, er.x, er.y, er.z); return this }, applyMatrix4: function(e) { for (var t = 0, n = this.count; t < n; t++) er.x = this.getX(t), er.y = this.getY(t), er.z = this.getZ(t), er.applyMatrix4(e), this.setXYZ(t, er.x, er.y, er.z); return this }, applyNormalMatrix: function(e) { for (var t = 0, n = this.count; t < n; t++) er.x = this.getX(t), er.y = this.getY(t), er.z = this.getZ(t), er.applyNormalMatrix(e), this.setXYZ(t, er.x, er.y, er.z); return this }, transformDirection: function(e) { for (var t = 0, n = this.count; t < n; t++) er.x = this.getX(t), er.y = this.getY(t), er.z = this.getZ(t), er.transformDirection(e), this.setXYZ(t, er.x, er.y, er.z); return this }, set: function(e) { return this.array.set(e, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0), this }, getX: function(e) { return this.array[e * this.itemSize] }, setX: function(e, t) { return this.array[e * this.itemSize] = t, this }, getY: function(e) { return this.array[e * this.itemSize + 1] }, setY: function(e, t) { return this.array[e * this.itemSize + 1] = t, this }, getZ: function(e) { return this.array[e * this.itemSize + 2] }, setZ: function(e, t) { return this.array[e * this.itemSize + 2] = t, this }, getW: function(e) { return this.array[e * this.itemSize + 3] }, setW: function(e, t) { return this.array[e * this.itemSize + 3] = t, this }, setXY: function(e, t, n) { return e *= this.itemSize, this.array[e + 0] = t, this.array[e + 1] = n, this }, setXYZ: function(e, t, n, i) { return e *= this.itemSize, this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = i, this }, setXYZW: function(e, t, n, i, r) { return e *= this.itemSize, this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = i, this.array[e + 3] = r, this }, onUpload: function(e) { return this.onUploadCallback = e, this }, clone: function() { return new this.constructor(this.array,this.itemSize).copy(this) }, toJSON: function() { return { itemSize: this.itemSize, type: this.array.constructor.name, array: Array.prototype.slice.call(this.array), normalized: this.normalized } } }), (ir.prototype = Object.create(nr.prototype)).constructor = ir, (rr.prototype = Object.create(nr.prototype)).constructor = rr, (ar.prototype = Object.create(nr.prototype)).constructor = ar, (or.prototype = Object.create(nr.prototype)).constructor = or, sr.prototype = Object.create(nr.prototype), sr.prototype.constructor = sr, (lr.prototype = Object.create(nr.prototype)).constructor = lr, ur.prototype = Object.create(nr.prototype), ur.prototype.constructor = ur, ((cr.prototype = Object.create(nr.prototype)).constructor = cr).prototype.isFloat16BufferAttribute = !0, (dr.prototype = Object.create(nr.prototype)).constructor = dr, (hr.prototype = Object.create(nr.prototype)).constructor = hr; var pr = function() { function e() { O(this, e), this.vertices = [], this.normals = [], this.colors = [], this.uvs = [], this.uvs2 = [], this.groups = [], this.morphTargets = {}, this.skinWeights = [], this.skinIndices = [], this.boundingBox = null, this.boundingSphere = null, this.verticesNeedUpdate = !1, this.normalsNeedUpdate = !1, this.colorsNeedUpdate = !1, this.uvsNeedUpdate = !1, this.groupsNeedUpdate = !1 } return h(e, [{ key: "computeGroups", value: function(e) { for (var t, n = [], i = void 0, r = e.faces, a = 0; a < r.length; a++) { var o = r[a]; o.materialIndex !== i && (i = o.materialIndex, void 0 !== t && (t.count = 3 * a - t.start, n.push(t)), t = { start: 3 * a, materialIndex: i }) } void 0 !== t && (t.count = 3 * a - t.start, n.push(t)), this.groups = n } }, { key: "fromGeometry", value: function(e) { var t = e.faces , n = e.vertices , i = e.faceVertexUvs , r = i[0] && 0 < i[0].length , a = i[1] && 0 < i[1].length , o = e.morphTargets , s = o.length; if (0 < s) { for (var l = [], u = 0; u < s; u++) l[u] = { name: o[u].name, data: [] }; this.morphTargets.position = l } var c = e.morphNormals , d = c.length; if (0 < d) { for (var h = [], p = 0; p < d; p++) h[p] = { name: c[p].name, data: [] }; this.morphTargets.normal = h } var f = e.skinIndices , m = e.skinWeights , v = f.length === n.length , g = m.length === n.length; 0 < n.length && 0 === t.length && console.error("THREE.DirectGeometry: Faceless geometries are not supported."); for (var y = 0; y < t.length; y++) { var w = t[y]; this.vertices.push(n[w.a], n[w.b], n[w.c]); var b = w.vertexNormals; 3 === b.length ? this.normals.push(b[0], b[1], b[2]) : (E = w.normal, this.normals.push(E, E, E)); var x, E = w.vertexColors; 3 === E.length ? this.colors.push(E[0], E[1], E[2]) : (E = w.color, this.colors.push(E, E, E)), !0 === r && (void 0 !== (x = i[0][y]) ? this.uvs.push(x[0], x[1], x[2]) : (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ", y), this.uvs.push(new yn, new yn, new yn))), !0 === a && (void 0 !== (x = i[1][y]) ? this.uvs2.push(x[0], x[1], x[2]) : (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ", y), this.uvs2.push(new yn, new yn, new yn))); for (var _ = 0; _ < s; _++) { var M = o[_].vertices; l[_].data.push(M[w.a], M[w.b], M[w.c]) } for (var A = 0; A < d; A++) { var T = c[A].vertexNormals[y]; h[A].data.push(T.a, T.b, T.c) } v && this.skinIndices.push(f[w.a], f[w.b], f[w.c]), g && this.skinWeights.push(m[w.a], m[w.b], m[w.c]) } return this.computeGroups(e), this.verticesNeedUpdate = e.verticesNeedUpdate, this.normalsNeedUpdate = e.normalsNeedUpdate, this.colorsNeedUpdate = e.colorsNeedUpdate, this.uvsNeedUpdate = e.uvsNeedUpdate, this.groupsNeedUpdate = e.groupsNeedUpdate, null !== e.boundingSphere && (this.boundingSphere = e.boundingSphere.clone()), null !== e.boundingBox && (this.boundingBox = e.boundingBox.clone()), this } }]), e }(); function fr(e) { if (0 === e.length) return -1 / 0; for (var t = e[0], n = 1, i = e.length; n < i; ++n) e[n] > t && (t = e[n]); return t } var mr = { Int8Array: Int8Array, Uint8Array: Uint8Array, Uint8ClampedArray: "undefined" != typeof Uint8ClampedArray ? Uint8ClampedArray : Uint8Array, Int16Array: Int16Array, Uint16Array: Uint16Array, Int32Array: Int32Array, Uint32Array: Uint32Array, Float32Array: Float32Array, Float64Array: Float64Array }; function vr(e, t) { return new mr[e](t) } var gr = 1 , yr = new ni , wr = new Si , br = new Cn , xr = new kn , Er = new kn , _r = new Cn; function Mr() { Object.defineProperty(this, "id", { value: gr += 2 }), this.uuid = gn.generateUUID(), this.name = "", this.type = "BufferGeometry", this.index = null, this.attributes = {}, this.morphAttributes = {}, this.morphTargetsRelative = !1, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.drawRange = { start: 0, count: 1 / 0 }, this.userData = {} } Mr.prototype = Object.assign(Object.create(hn.prototype), { constructor: Mr, isBufferGeometry: !0, getIndex: function() { return this.index }, setIndex: function(e) { return Array.isArray(e) ? this.index = new (65535 < fr(e) ? ur : sr)(e,1) : this.index = e, this }, getAttribute: function(e) { return this.attributes[e] }, setAttribute: function(e, t) { return this.attributes[e] = t, this }, deleteAttribute: function(e) { return delete this.attributes[e], this }, hasAttribute: function(e) { return void 0 !== this.attributes[e] }, addGroup: function(e, t) { this.groups.push({ start: e, count: t, materialIndex: 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0 }) }, clearGroups: function() { this.groups = [] }, setDrawRange: function(e, t) { this.drawRange.start = e, this.drawRange.count = t }, applyMatrix4: function(e) { var t = this.attributes.position; void 0 !== t && (t.applyMatrix4(e), t.needsUpdate = !0); var n = this.attributes.normal; void 0 !== n && (t = (new wn).getNormalMatrix(e), n.applyNormalMatrix(t), n.needsUpdate = !0); n = this.attributes.tangent; return void 0 !== n && (n.transformDirection(e), n.needsUpdate = !0), null !== this.boundingBox && this.computeBoundingBox(), null !== this.boundingSphere && this.computeBoundingSphere(), this }, rotateX: function(e) { return yr.makeRotationX(e), this.applyMatrix4(yr), this }, rotateY: function(e) { return yr.makeRotationY(e), this.applyMatrix4(yr), this }, rotateZ: function(e) { return yr.makeRotationZ(e), this.applyMatrix4(yr), this }, translate: function(e, t, n) { return yr.makeTranslation(e, t, n), this.applyMatrix4(yr), this }, scale: function(e, t, n) { return yr.makeScale(e, t, n), this.applyMatrix4(yr), this }, lookAt: function(e) { return wr.lookAt(e), wr.updateMatrix(), this.applyMatrix4(wr.matrix), this }, center: function() { return this.computeBoundingBox(), this.boundingBox.getCenter(br).negate(), this.translate(br.x, br.y, br.z), this }, setFromObject: function(e) { var t, n, i = e.geometry; return e.isPoints || e.isLine ? (t = new dr(3 * i.vertices.length,3), n = new dr(3 * i.colors.length,3), this.setAttribute("position", t.copyVector3sArray(i.vertices)), this.setAttribute("color", n.copyColorsArray(i.colors)), i.lineDistances && i.lineDistances.length === i.vertices.length && (n = new dr(i.lineDistances.length,1), this.setAttribute("lineDistance", n.copyArray(i.lineDistances))), null !== i.boundingSphere && (this.boundingSphere = i.boundingSphere.clone()), null !== i.boundingBox && (this.boundingBox = i.boundingBox.clone())) : e.isMesh && i && i.isGeometry && this.fromGeometry(i), this }, setFromPoints: function(e) { for (var t = [], n = 0, i = e.length; n < i; n++) { var r = e[n]; t.push(r.x, r.y, r.z || 0) } return this.setAttribute("position", new dr(t,3)), this }, updateFromObject: function(e) { var t, n, i = e.geometry; if (e.isMesh) { var r = i.__directGeometry; if (!0 === i.elementsNeedUpdate && (r = void 0, i.elementsNeedUpdate = !1), void 0 === r) return this.fromGeometry(i); r.verticesNeedUpdate = i.verticesNeedUpdate, r.normalsNeedUpdate = i.normalsNeedUpdate, r.colorsNeedUpdate = i.colorsNeedUpdate, r.uvsNeedUpdate = i.uvsNeedUpdate, r.groupsNeedUpdate = i.groupsNeedUpdate, i.verticesNeedUpdate = !1, i.normalsNeedUpdate = !1, i.colorsNeedUpdate = !1, i.uvsNeedUpdate = !1, i.groupsNeedUpdate = !1, i = r } return !0 === i.verticesNeedUpdate && (void 0 !== (r = this.attributes.position) && (r.copyVector3sArray(i.vertices), r.needsUpdate = !0), i.verticesNeedUpdate = !1), !0 === i.normalsNeedUpdate && (void 0 !== (t = this.attributes.normal) && (t.copyVector3sArray(i.normals), t.needsUpdate = !0), i.normalsNeedUpdate = !1), !0 === i.colorsNeedUpdate && (void 0 !== (t = this.attributes.color) && (t.copyColorsArray(i.colors), t.needsUpdate = !0), i.colorsNeedUpdate = !1), i.uvsNeedUpdate && (void 0 !== (n = this.attributes.uv) && (n.copyVector2sArray(i.uvs), n.needsUpdate = !0), i.uvsNeedUpdate = !1), i.lineDistancesNeedUpdate && (void 0 !== (n = this.attributes.lineDistance) && (n.copyArray(i.lineDistances), n.needsUpdate = !0), i.lineDistancesNeedUpdate = !1), i.groupsNeedUpdate && (i.computeGroups(e.geometry), this.groups = i.groups, i.groupsNeedUpdate = !1), this }, fromGeometry: function(e) { return e.__directGeometry = (new pr).fromGeometry(e), this.fromDirectGeometry(e.__directGeometry) }, fromDirectGeometry: function(e) { var t, n, i, r, a = new Float32Array(3 * e.vertices.length); for (i in this.setAttribute("position", new nr(a,3).copyVector3sArray(e.vertices)), 0 < e.normals.length && (t = new Float32Array(3 * e.normals.length), this.setAttribute("normal", new nr(t,3).copyVector3sArray(e.normals))), 0 < e.colors.length && (t = new Float32Array(3 * e.colors.length), this.setAttribute("color", new nr(t,3).copyColorsArray(e.colors))), 0 < e.uvs.length && (n = new Float32Array(2 * e.uvs.length), this.setAttribute("uv", new nr(n,2).copyVector2sArray(e.uvs))), 0 < e.uvs2.length && (n = new Float32Array(2 * e.uvs2.length), this.setAttribute("uv2", new nr(n,2).copyVector2sArray(e.uvs2))), this.groups = e.groups, e.morphTargets) { for (var o = [], s = e.morphTargets[i], l = 0, u = s.length; l < u; l++) { var c = s[l] , d = new dr(3 * c.data.length,3); d.name = c.name, o.push(d.copyVector3sArray(c.data)) } this.morphAttributes[i] = o } return 0 < e.skinIndices.length && (r = new dr(4 * e.skinIndices.length,4), this.setAttribute("skinIndex", r.copyVector4sArray(e.skinIndices))), 0 < e.skinWeights.length && (r = new dr(4 * e.skinWeights.length,4), this.setAttribute("skinWeight", r.copyVector4sArray(e.skinWeights))), null !== e.boundingSphere && (this.boundingSphere = e.boundingSphere.clone()), null !== e.boundingBox && (this.boundingBox = e.boundingBox.clone()), this }, computeBoundingBox: function() { null === this.boundingBox && (this.boundingBox = new kn); var e = this.attributes.position , t = this.morphAttributes.position; if (e && e.isGLBufferAttribute) return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this), void this.boundingBox.set(new Cn(-1 / 0,-1 / 0,-1 / 0), new Cn(1 / 0,1 / 0,1 / 0)); if (void 0 !== e) { if (this.boundingBox.setFromBufferAttribute(e), t) for (var n = 0, i = t.length; n < i; n++) { var r = t[n]; xr.setFromBufferAttribute(r), this.morphTargetsRelative ? (_r.addVectors(this.boundingBox.min, xr.min), this.boundingBox.expandByPoint(_r), _r.addVectors(this.boundingBox.max, xr.max), this.boundingBox.expandByPoint(_r)) : (this.boundingBox.expandByPoint(xr.min), this.boundingBox.expandByPoint(xr.max)) } } else this.boundingBox.makeEmpty(); (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) && console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this) }, computeBoundingSphere: function() { null === this.boundingSphere && (this.boundingSphere = new qn); var e = this.attributes.position , t = this.morphAttributes.position; if (e && e.isGLBufferAttribute) return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this), void this.boundingSphere.set(new Cn, 1 / 0); if (e) { var n = this.boundingSphere.center; if (xr.setFromBufferAttribute(e), t) for (var i = 0, r = t.length; i < r; i++) { var a = t[i]; Er.setFromBufferAttribute(a), this.morphTargetsRelative ? (_r.addVectors(xr.min, Er.min), xr.expandByPoint(_r), _r.addVectors(xr.max, Er.max), xr.expandByPoint(_r)) : (xr.expandByPoint(Er.min), xr.expandByPoint(Er.max)) } xr.getCenter(n); for (var o = 0, s = 0, l = e.count; s < l; s++) _r.fromBufferAttribute(e, s), o = Math.max(o, n.distanceToSquared(_r)); if (t) for (var u = 0, c = t.length; u < c; u++) for (var d = t[u], h = this.morphTargetsRelative, p = 0, f = d.count; p < f; p++) _r.fromBufferAttribute(d, p), h && (br.fromBufferAttribute(e, p), _r.add(br)), o = Math.max(o, n.distanceToSquared(_r)); this.boundingSphere.radius = Math.sqrt(o), isNaN(this.boundingSphere.radius) && console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this) } }, computeFaceNormals: function() {}, computeVertexNormals: function() { var e = this.index , t = this.getAttribute("position"); if (void 0 !== t) { var n = this.getAttribute("normal"); if (void 0 === n) n = new nr(new Float32Array(3 * t.count),3), this.setAttribute("normal", n); else for (var i = 0, r = n.count; i < r; i++) n.setXYZ(i, 0, 0, 0); var a = new Cn , o = new Cn , s = new Cn , l = new Cn , u = new Cn , c = new Cn , d = new Cn , h = new Cn; if (e) for (var p = 0, f = e.count; p < f; p += 3) { var m = e.getX(p + 0) , v = e.getX(p + 1) , g = e.getX(p + 2); a.fromBufferAttribute(t, m), o.fromBufferAttribute(t, v), s.fromBufferAttribute(t, g), d.subVectors(s, o), h.subVectors(a, o), d.cross(h), l.fromBufferAttribute(n, m), u.fromBufferAttribute(n, v), c.fromBufferAttribute(n, g), l.add(d), u.add(d), c.add(d), n.setXYZ(m, l.x, l.y, l.z), n.setXYZ(v, u.x, u.y, u.z), n.setXYZ(g, c.x, c.y, c.z) } else for (var y = 0, w = t.count; y < w; y += 3) a.fromBufferAttribute(t, y + 0), o.fromBufferAttribute(t, y + 1), s.fromBufferAttribute(t, y + 2), d.subVectors(s, o), h.subVectors(a, o), d.cross(h), n.setXYZ(y + 0, d.x, d.y, d.z), n.setXYZ(y + 1, d.x, d.y, d.z), n.setXYZ(y + 2, d.x, d.y, d.z); this.normalizeNormals(), n.needsUpdate = !0 } }, merge: function(e, t) { if (e && e.isBufferGeometry) { void 0 === t && (t = 0, console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.")); var n, i = this.attributes; for (n in i) if (void 0 !== e.attributes[n]) for (var r = i[n].array, a = e.attributes[n], o = a.array, a = a.itemSize * t, s = Math.min(o.length, r.length - a), l = 0, u = a; l < s; l++, u++) r[u] = o[l]; return this } console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.", e) }, normalizeNormals: function() { for (var e = this.attributes.normal, t = 0, n = e.count; t < n; t++) _r.fromBufferAttribute(e, t), _r.normalize(), e.setXYZ(t, _r.x, _r.y, _r.z) }, toNonIndexed: function() { function e(e, t) { for (var n = e.array, i = e.itemSize, e = e.normalized, r = new n.constructor(t.length * i), a = 0, o = 0, s = 0, l = t.length; s < l; s++) for (var a = t[s] * i, u = 0; u < i; u++) r[o++] = n[a++]; return new nr(r,i,e) } if (null === this.index) return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."), this; var t, n = new Mr, i = this.index.array, r = this.attributes; for (t in r) { var a = e(r[t], i); n.setAttribute(t, a) } var o, s = this.morphAttributes; for (o in s) { for (var l = [], u = s[o], c = 0, d = u.length; c < d; c++) { var h = e(u[c], i); l.push(h) } n.morphAttributes[o] = l } n.morphTargetsRelative = this.morphTargetsRelative; for (var p = this.groups, f = 0, m = p.length; f < m; f++) { var v = p[f]; n.addGroup(v.start, v.count, v.materialIndex) } return n }, toJSON: function() { var e = { metadata: { version: 4.5, type: "BufferGeometry", generator: "BufferGeometry.toJSON" } }; if (e.uuid = this.uuid, e.type = this.type, "" !== this.name && (e.name = this.name), 0 < Object.keys(this.userData).length && (e.userData = this.userData), void 0 !== this.parameters) { var t, n = this.parameters; for (t in n) void 0 !== n[t] && (e[t] = n[t]); return e } e.data = { attributes: {} }; var i = this.index; null !== i && (e.data.index = { type: i.array.constructor.name, array: Array.prototype.slice.call(i.array) }); var r, a = this.attributes; for (r in a) { var o = a[r] , s = o.toJSON(e.data); "" !== o.name && (s.name = o.name), e.data.attributes[r] = s } var l, u = {}, c = !1; for (l in this.morphAttributes) { for (var d = this.morphAttributes[l], h = [], p = 0, f = d.length; p < f; p++) { var m = d[p] , v = m.toJSON(e.data); "" !== m.name && (v.name = m.name), h.push(v) } 0 < h.length && (u[l] = h, c = !0) } c && (e.data.morphAttributes = u, e.data.morphTargetsRelative = this.morphTargetsRelative); i = this.groups; 0 < i.length && (e.data.groups = JSON.parse(JSON.stringify(i))); i = this.boundingSphere; return null !== i && (e.data.boundingSphere = { center: i.center.toArray(), radius: i.radius }), e }, clone: function() { return (new Mr).copy(this) }, copy: function(e) { this.index = null, this.attributes = {}, this.morphAttributes = {}, this.groups = [], this.boundingBox = null, this.boundingSphere = null; var t = {}; this.name = e.name; var n = e.index; null !== n && this.setIndex(n.clone(t)); var i, r = e.attributes; for (i in r) { var a = r[i]; this.setAttribute(i, a.clone(t)) } var o, s = e.morphAttributes; for (o in s) { for (var l = [], u = s[o], c = 0, d = u.length; c < d; c++) l.push(u[c].clone(t)); this.morphAttributes[o] = l } this.morphTargetsRelative = e.morphTargetsRelative; for (var h = e.groups, p = 0, f = h.length; p < f; p++) { var m = h[p]; this.addGroup(m.start, m.count, m.materialIndex) } n = e.boundingBox; null !== n && (this.boundingBox = n.clone()); n = e.boundingSphere; return null !== n && (this.boundingSphere = n.clone()), this.drawRange.start = e.drawRange.start, this.drawRange.count = e.drawRange.count, this.userData = e.userData, this }, dispose: function() { this.dispatchEvent({ type: "dispose" }) } }); var Ar = new ni , Tr = new ti , Sr = new qn , Cr = new Cn , Pr = new Cn , Dr = new Cn , kr = new Cn , Br = new Cn , Lr = new Cn , Rr = new Cn , Fr = new Cn , Ir = new Cn , Or = new yn , zr = new yn , Nr = new yn , Ur = new Cn , Gr = new Cn; function Hr() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new Mr , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new $i; Si.call(this), this.type = "Mesh", this.geometry = e, this.material = t, this.updateMorphTargets() } function Vr(e, t, n, i, r, a, o, s) { t = t.side === J ? i.intersectTriangle(o, a, r, !0, s) : i.intersectTriangle(r, a, o, t.side !== Y, s); if (null === t) return null; Gr.copy(s), Gr.applyMatrix4(e.matrixWorld); s = n.ray.origin.distanceTo(Gr); return s < n.near || s > n.far ? null : { distance: s, point: Gr.clone(), object: e } } function jr(e, t, n, i, r, a, o, s, l, u, c, d) { Cr.fromBufferAttribute(r, u), Pr.fromBufferAttribute(r, c), Dr.fromBufferAttribute(r, d); var h = e.morphTargetInfluences; if (t.morphTargets && a && h) { Rr.set(0, 0, 0), Fr.set(0, 0, 0), Ir.set(0, 0, 0); for (var p = 0, f = a.length; p < f; p++) { var m = h[p] , v = a[p]; 0 !== m && (kr.fromBufferAttribute(v, u), Br.fromBufferAttribute(v, c), Lr.fromBufferAttribute(v, d), o ? (Rr.addScaledVector(kr, m), Fr.addScaledVector(Br, m), Ir.addScaledVector(Lr, m)) : (Rr.addScaledVector(kr.sub(Cr), m), Fr.addScaledVector(Br.sub(Pr), m), Ir.addScaledVector(Lr.sub(Dr), m))) } Cr.add(Rr), Pr.add(Fr), Dr.add(Ir) } e.isSkinnedMesh && (e.boneTransform(u, Cr), e.boneTransform(c, Pr), e.boneTransform(d, Dr)); i = Vr(e, t, n, i, Cr, Pr, Dr, Ur); return i && (s && (Or.fromBufferAttribute(s, u), zr.fromBufferAttribute(s, c), Nr.fromBufferAttribute(s, d), i.uv = Hi.getUV(Ur, Cr, Pr, Dr, Or, zr, Nr, new yn)), l && (Or.fromBufferAttribute(l, u), zr.fromBufferAttribute(l, c), Nr.fromBufferAttribute(l, d), i.uv2 = Hi.getUV(Ur, Cr, Pr, Dr, Or, zr, Nr, new yn)), l = new Zi(u,c,d), Hi.getNormal(Cr, Pr, Dr, l.normal), i.face = l), i } Hr.prototype = Object.assign(Object.create(Si.prototype), { constructor: Hr, isMesh: !0, copy: function(e) { return Si.prototype.copy.call(this, e), void 0 !== e.morphTargetInfluences && (this.morphTargetInfluences = e.morphTargetInfluences.slice()), void 0 !== e.morphTargetDictionary && (this.morphTargetDictionary = Object.assign({}, e.morphTargetDictionary)), this.material = e.material, this.geometry = e.geometry, this }, updateMorphTargets: function() { var e = this.geometry; if (e.isBufferGeometry) { var t = e.morphAttributes , n = Object.keys(t); if (0 < n.length) { var i = t[n[0]]; if (void 0 !== i) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (var r = 0, a = i.length; r < a; r++) { var o = i[r].name || String(r); this.morphTargetInfluences.push(0), this.morphTargetDictionary[o] = r } } } } else { e = e.morphTargets; void 0 !== e && 0 < e.length && console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.") } }, raycast: function(e, t) { var n = this.geometry , i = this.material , r = this.matrixWorld; if (void 0 !== i && (null === n.boundingSphere && n.computeBoundingSphere(), Sr.copy(n.boundingSphere), Sr.applyMatrix4(r), !1 !== e.ray.intersectsSphere(Sr) && (Ar.copy(r).invert(), Tr.copy(e.ray).applyMatrix4(Ar), null === n.boundingBox || !1 !== Tr.intersectsBox(n.boundingBox)))) if (n.isBufferGeometry) { var a = n.index , o = n.attributes.position , s = n.morphAttributes.position , l = n.morphTargetsRelative , u = n.attributes.uv , c = n.attributes.uv2 , d = n.groups , h = n.drawRange; if (null !== a) if (Array.isArray(i)) for (var p = 0, f = d.length; p < f; p++) for (var m = d[p], v = i[m.materialIndex], g = Math.max(m.start, h.start), y = Math.min(m.start + m.count, h.start + h.count); g < y; g += 3) { var w, b = a.getX(g), x = a.getX(g + 1), E = a.getX(g + 2); (w = jr(this, v, e, Tr, o, s, l, u, c, b, x, E)) && (w.faceIndex = Math.floor(g / 3), w.face.materialIndex = m.materialIndex, t.push(w)) } else for (var _ = Math.max(0, h.start), M = Math.min(a.count, h.start + h.count); _ < M; _ += 3) { var A = a.getX(_) , T = a.getX(_ + 1) , S = a.getX(_ + 2); (w = jr(this, i, e, Tr, o, s, l, u, c, A, T, S)) && (w.faceIndex = Math.floor(_ / 3), t.push(w)) } else if (void 0 !== o) if (Array.isArray(i)) for (var C = 0, P = d.length; C < P; C++) for (var D = d[C], k = i[D.materialIndex], B = Math.max(D.start, h.start), L = Math.min(D.start + D.count, h.start + h.count); B < L; B += 3) (w = jr(this, k, e, Tr, o, s, l, u, c, B, B + 1, B + 2)) && (w.faceIndex = Math.floor(B / 3), w.face.materialIndex = D.materialIndex, t.push(w)); else for (var R = Math.max(0, h.start), F = Math.min(o.count, h.start + h.count); R < F; R += 3) (w = jr(this, i, e, Tr, o, s, l, u, c, R, R + 1, R + 2)) && (w.faceIndex = Math.floor(R / 3), t.push(w)) } else if (n.isGeometry) { var I, O = Array.isArray(i), z = n.vertices, N = n.faces, n = n.faceVertexUvs[0]; 0 < n.length && (I = n); for (var U = 0, G = N.length; U < G; U++) { var H, V, j, W = N[U], X = O ? i[W.materialIndex] : i; void 0 !== X && (H = z[W.a], V = z[W.b], j = z[W.c], (w = Vr(this, X, e, Tr, H, V, j, Ur)) && (I && I[U] && (X = I[U], Or.copy(X[0]), zr.copy(X[1]), Nr.copy(X[2]), w.uv = Hi.getUV(Ur, H, V, j, Or, zr, Nr, new yn)), w.face = W, w.faceIndex = U, t.push(w))) } } } }); var Wr = function() { y(u, Mr); var l = w(u); function u() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1, a = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1, o = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 1; O(this, u), (e = l.call(this)).type = "BoxBufferGeometry", e.parameters = { width: t, height: n, depth: i, widthSegments: r, heightSegments: a, depthSegments: o }; var D = g(e) , r = Math.floor(r) , a = Math.floor(a) , o = Math.floor(o) , k = [] , B = [] , L = [] , R = [] , F = 0 , I = 0; function s(e, t, n, i, r, a, o, s, l, u, c) { for (var d = a / l, h = o / u, p = a / 2, f = o / 2, m = s / 2, v = l + 1, g = u + 1, y = 0, w = 0, b = new Cn, x = 0; x < g; x++) for (var E = x * h - f, _ = 0; _ < v; _++) b[e] = (_ * d - p) * i, b[t] = E * r, b[n] = m, B.push(b.x, b.y, b.z), b[e] = 0, b[t] = 0, b[n] = 0 < s ? 1 : -1, L.push(b.x, b.y, b.z), R.push(_ / l), R.push(1 - x / u), y += 1; for (var M = 0; M < u; M++) for (var A = 0; A < l; A++) { var T = F + A + v * M , S = F + A + v * (M + 1) , C = F + (A + 1) + v * (M + 1) , P = F + (A + 1) + v * M; k.push(T, S, P), k.push(S, C, P), w += 6 } D.addGroup(I, w, c), I += w, F += y } return s("z", "y", "x", -1, -1, i, n, t, o, a, 0), s("z", "y", "x", 1, -1, i, n, -t, o, a, 1), s("x", "z", "y", 1, 1, t, i, n, r, o, 2), s("x", "z", "y", 1, -1, t, i, -n, r, o, 3), s("x", "y", "z", 1, -1, t, n, i, r, a, 4), s("x", "y", "z", -1, -1, t, n, -i, r, a, 5), e.setIndex(k), e.setAttribute("position", new dr(B,3)), e.setAttribute("normal", new dr(L,3)), e.setAttribute("uv", new dr(R,2)), e } return h(u) }(); function Xr(e) { var t, n = {}; for (t in e) for (var i in n[t] = {}, e[t]) { var r = e[t][i]; r && (r.isColor || r.isMatrix3 || r.isMatrix4 || r.isVector2 || r.isVector3 || r.isVector4 || r.isTexture) ? n[t][i] = r.clone() : Array.isArray(r) ? n[t][i] = r.slice() : n[t][i] = r } return n } function qr(e) { for (var t = {}, n = 0; n < e.length; n++) { var i, r = Xr(e[n]); for (i in r) t[i] = r[i] } return t } var Jr = { clone: Xr, merge: qr } , Yr = "void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}" , Zr = "void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}"; function Qr(e) { Ki.call(this), this.type = "ShaderMaterial", this.defines = {}, this.uniforms = {}, this.vertexShader = Yr, this.fragmentShader = Zr, this.lineWidth = 1, this.wireframe = !1, this.wireframelineWidth = 1, this.fog = !1, this.lights = !1, this.clipping = !1, this.skinning = !1, this.morphTargets = !1, this.morphNormals = !1, this.extensions = { derivatives: !1, fragDepth: !1, drawBuffers: !1, shaderTextureLOD: !1 }, this.defaultAttributeValues = { color: [1, 1, 1], uv: [0, 0], uv2: [0, 0] }, this.index0AttributeName = void 0, this.uniformsNeedUpdate = !1, this.glslVersion = null, void 0 !== e && (void 0 !== e.attributes && console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."), this.setValues(e)) } function Kr() { Si.call(this), this.type = "Camera", this.matrixWorldInverse = new ni, this.projectionMatrix = new ni, this.projectionMatrixInverse = new ni } function $r() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 50 , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1 , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : .1 , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 2e3; Kr.call(this), this.type = "PerspectiveCamera", this.fov = e, this.zoom = 1, this.near = n, this.far = i, this.focus = 10, this.aspect = t, this.view = null, this.filmGauge = 35, this.filmOffset = 0, this.updateProjectionMatrix() } ((Qr.prototype = Object.create(Ki.prototype)).constructor = Qr).prototype.isShaderMaterial = !0, Qr.prototype.copy = function(e) { return Ki.prototype.copy.call(this, e), this.fragmentShader = e.fragmentShader, this.vertexShader = e.vertexShader, this.uniforms = Xr(e.uniforms), this.defines = Object.assign({}, e.defines), this.wireframe = e.wireframe, this.wireframelineWidth = e.wireframelineWidth, this.lights = e.lights, this.clipping = e.clipping, this.skinning = e.skinning, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.extensions = Object.assign({}, e.extensions), this.glslVersion = e.glslVersion, this } , Qr.prototype.toJSON = function(e) { var t, n = Ki.prototype.toJSON.call(this, e); for (t in n.glslVersion = this.glslVersion, n.uniforms = {}, this.uniforms) { var i = this.uniforms[t].value; i && i.isTexture ? n.uniforms[t] = { type: "t", value: i.toJSON(e).uuid } : i && i.isColor ? n.uniforms[t] = { type: "c", value: i.getHex() } : i && i.isVector2 ? n.uniforms[t] = { type: "v2", value: i.toArray() } : i && i.isVector3 ? n.uniforms[t] = { type: "v3", value: i.toArray() } : i && i.isVector4 ? n.uniforms[t] = { type: "v4", value: i.toArray() } : i && i.isMatrix3 ? n.uniforms[t] = { type: "m3", value: i.toArray() } : i && i.isMatrix4 ? n.uniforms[t] = { type: "m4", value: i.toArray() } : n.uniforms[t] = { value: i } } 0 < Object.keys(this.defines).length && (n.defines = this.defines), n.vertexShader = this.vertexShader, n.fragmentShader = this.fragmentShader; var r, a = {}; for (r in this.extensions) !0 === this.extensions[r] && (a[r] = !0); return 0 < Object.keys(a).length && (n.extensions = a), n } , Kr.prototype = Object.assign(Object.create(Si.prototype), { constructor: Kr, isCamera: !0, copy: function(e, t) { return Si.prototype.copy.call(this, e, t), this.matrixWorldInverse.copy(e.matrixWorldInverse), this.projectionMatrix.copy(e.projectionMatrix), this.projectionMatrixInverse.copy(e.projectionMatrixInverse), this }, getWorldDirection: function(e) { void 0 === e && (console.warn("THREE.Camera: .getWorldDirection() target is now required"), e = new Cn), this.updateWorldMatrix(!0, !1); var t = this.matrixWorld.elements; return e.set(-t[8], -t[9], -t[10]).normalize() }, updateMatrixWorld: function(e) { Si.prototype.updateMatrixWorld.call(this, e), this.matrixWorldInverse.copy(this.matrixWorld).invert() }, updateWorldMatrix: function(e, t) { Si.prototype.updateWorldMatrix.call(this, e, t), this.matrixWorldInverse.copy(this.matrixWorld).invert() }, clone: function() { return (new this.constructor).copy(this) } }), $r.prototype = Object.assign(Object.create(Kr.prototype), { constructor: $r, isPerspectiveCamera: !0, copy: function(e, t) { return Kr.prototype.copy.call(this, e, t), this.fov = e.fov, this.zoom = e.zoom, this.near = e.near, this.far = e.far, this.focus = e.focus, this.aspect = e.aspect, this.view = null === e.view ? null : Object.assign({}, e.view), this.filmGauge = e.filmGauge, this.filmOffset = e.filmOffset, this }, setFocalLength: function(e) { e = .5 * this.getFilmHeight() / e; this.fov = 2 * gn.RAD2DEG * Math.atan(e), this.updateProjectionMatrix() }, getFocalLength: function() { var e = Math.tan(.5 * gn.DEG2RAD * this.fov); return .5 * this.getFilmHeight() / e }, getEffectiveFOV: function() { return 2 * gn.RAD2DEG * Math.atan(Math.tan(.5 * gn.DEG2RAD * this.fov) / this.zoom) }, getFilmWidth: function() { return this.filmGauge * Math.min(this.aspect, 1) }, getFilmHeight: function() { return this.filmGauge / Math.max(this.aspect, 1) }, setViewOffset: function(e, t, n, i, r, a) { this.aspect = e / t, null === this.view && (this.view = { enabled: !0, fullWidth: 1, fullHeight: 1, offsetX: 0, offsetY: 0, width: 1, height: 1 }), this.view.enabled = !0, this.view.fullWidth = e, this.view.fullHeight = t, this.view.offsetX = n, this.view.offsetY = i, this.view.width = r, this.view.height = a, this.updateProjectionMatrix() }, clearViewOffset: function() { null !== this.view && (this.view.enabled = !1), this.updateProjectionMatrix() }, updateProjectionMatrix: function() { var e, t = this.near, n = t * Math.tan(.5 * gn.DEG2RAD * this.fov) / this.zoom, i = 2 * n, r = this.aspect * i, a = -.5 * r, o = this.view; null !== this.view && this.view.enabled && (e = o.fullWidth, s = o.fullHeight, a += o.offsetX * r / e, n -= o.offsetY * i / s, r *= o.width / e, i *= o.height / s); var s = this.filmOffset; 0 !== s && (a += t * s / this.getFilmWidth()), this.projectionMatrix.makePerspective(a, a + r, n, n - i, t, this.far), this.projectionMatrixInverse.copy(this.projectionMatrix).invert() }, toJSON: function(e) { e = Si.prototype.toJSON.call(this, e); return e.object.fov = this.fov, e.object.zoom = this.zoom, e.object.near = this.near, e.object.far = this.far, e.object.focus = this.focus, e.object.aspect = this.aspect, null !== this.view && (e.object.view = Object.assign({}, this.view)), e.object.filmGauge = this.filmGauge, e.object.filmOffset = this.filmOffset, e } }); function ea(e, t, a) { var o, s, l, u, c, d; Si.call(this), this.type = "CubeCamera", !0 === a.isWebGLCubeRenderTarget ? (this.renderTarget = a, (o = new $r(90,1,e,t)).layers = this.layers, o.up.set(0, -1, 0), o.lookAt(new Cn(1,0,0)), this.add(o), (s = new $r(90,1,e,t)).layers = this.layers, s.up.set(0, -1, 0), s.lookAt(new Cn(-1,0,0)), this.add(s), (l = new $r(90,1,e,t)).layers = this.layers, l.up.set(0, 0, 1), l.lookAt(new Cn(0,1,0)), this.add(l), (u = new $r(90,1,e,t)).layers = this.layers, u.up.set(0, 0, -1), u.lookAt(new Cn(0,-1,0)), this.add(u), (c = new $r(90,1,e,t)).layers = this.layers, c.up.set(0, -1, 0), c.lookAt(new Cn(0,0,1)), this.add(c), (d = new $r(90,1,e,t)).layers = this.layers, d.up.set(0, -1, 0), d.lookAt(new Cn(0,0,-1)), this.add(d), this.update = function(e, t) { null === this.parent && this.updateMatrixWorld(); var n = e.xr.enabled , i = e.getRenderTarget(); e.xr.enabled = !1; var r = a.texture.generateMipmaps; a.texture.generateMipmaps = !1, e.setRenderTarget(a, 0), e.render(t, o), e.setRenderTarget(a, 1), e.render(t, s), e.setRenderTarget(a, 2), e.render(t, l), e.setRenderTarget(a, 3), e.render(t, u), e.setRenderTarget(a, 4), e.render(t, c), a.texture.generateMipmaps = r, e.setRenderTarget(a, 5), e.render(t, d), e.setRenderTarget(i), e.xr.enabled = n } ) : console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.") } function ta(e, t, n, i, r, a, o, s, l, u) { En.call(this, e = void 0 !== e ? e : [], t = void 0 !== t ? t : L, n, i, r, a, o = void 0 !== o ? o : $e, s, l, u), this.flipY = !1, this._needsFlipEnvMap = !0 } function na(e, t, n) { Number.isInteger(t) && (console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"), t = n), An.call(this, e, e, t), this.texture = new ta(void 0,(t = t || {}).mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding), this.texture._needsFlipEnvMap = !1 } function ia(e, t, n, i, r, a, o, s, l, u, c, d) { En.call(this, null, a, o, s, l, u, i, r, c, d), this.image = { data: e || null, width: t || 1, height: n || 1 }, this.magFilter = void 0 !== l ? l : Re, this.minFilter = void 0 !== u ? u : Re, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.needsUpdate = !0 } (ea.prototype = Object.create(Si.prototype)).constructor = ea, ((ta.prototype = Object.create(En.prototype)).constructor = ta).prototype.isCubeTexture = !0, Object.defineProperty(ta.prototype, "images", { get: function() { return this.image }, set: function(e) { this.image = e } }), ((na.prototype = Object.create(An.prototype)).constructor = na).prototype.isWebGLCubeRenderTarget = !0, na.prototype.fromEquirectangularTexture = function(e, t) { this.texture.type = t.type, this.texture.format = et, this.texture.encoding = t.encoding, this.texture.generateMipmaps = t.generateMipmaps, this.texture.minFilter = t.minFilter, this.texture.magFilter = t.magFilter; var n = { tEquirect: { value: null } } , i = "\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t#include \n\t\t\t\t#include \n\n\t\t\t}\n\t\t" , r = "\n\n\t\t\tuniform sampler2D tEquirect;\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t}\n\t\t" , a = new Wr(5,5,5) , r = new Qr({ name: "CubemapFromEquirect", uniforms: Xr(n), vertexShader: i, fragmentShader: r, side: J, blending: Z }); r.uniforms.tEquirect.value = t; a = new Hr(a,r), r = t.minFilter; return t.minFilter === Ne && (t.minFilter = Oe), new ea(1,10,this).update(e, a), t.minFilter = r, a.geometry.dispose(), a.material.dispose(), this } , na.prototype.clear = function(e, t, n, i) { for (var r = e.getRenderTarget(), a = 0; a < 6; a++) e.setRenderTarget(this, a), e.clear(t, n, i); e.setRenderTarget(r) } , ((ia.prototype = Object.create(En.prototype)).constructor = ia).prototype.isDataTexture = !0; var ra = new qn , aa = new Cn , oa = function() { function o(e, t, n, i, r, a) { O(this, o), this.planes = [void 0 !== e ? e : new ki, void 0 !== t ? t : new ki, void 0 !== n ? n : new ki, void 0 !== i ? i : new ki, void 0 !== r ? r : new ki, void 0 !== a ? a : new ki] } return h(o, [{ key: "set", value: function(e, t, n, i, r, a) { var o = this.planes; return o[0].copy(e), o[1].copy(t), o[2].copy(n), o[3].copy(i), o[4].copy(r), o[5].copy(a), this } }, { key: "clone", value: function() { return (new this.constructor).copy(this) } }, { key: "copy", value: function(e) { for (var t = this.planes, n = 0; n < 6; n++) t[n].copy(e.planes[n]); return this } }, { key: "setFromProjectionMatrix", value: function(e) { var t = this.planes , n = e.elements , i = n[0] , r = n[1] , a = n[2] , o = n[3] , s = n[4] , l = n[5] , u = n[6] , c = n[7] , d = n[8] , h = n[9] , p = n[10] , f = n[11] , m = n[12] , v = n[13] , e = n[14] , n = n[15]; return t[0].setComponents(o - i, c - s, f - d, n - m).normalize(), t[1].setComponents(o + i, c + s, f + d, n + m).normalize(), t[2].setComponents(o + r, c + l, f + h, n + v).normalize(), t[3].setComponents(o - r, c - l, f - h, n - v).normalize(), t[4].setComponents(o - a, c - u, f - p, n - e).normalize(), t[5].setComponents(o + a, c + u, f + p, n + e).normalize(), this } }, { key: "intersectsObject", value: function(e) { var t = e.geometry; return null === t.boundingSphere && t.computeBoundingSphere(), ra.copy(t.boundingSphere).applyMatrix4(e.matrixWorld), this.intersectsSphere(ra) } }, { key: "intersectsSprite", value: function(e) { return ra.center.set(0, 0, 0), ra.radius = .7071067811865476, ra.applyMatrix4(e.matrixWorld), this.intersectsSphere(ra) } }, { key: "intersectsSphere", value: function(e) { for (var t = this.planes, n = e.center, i = -e.radius, r = 0; r < 6; r++) if (t[r].distanceToPoint(n) < i) return !1; return !0 } }, { key: "intersectsBox", value: function(e) { for (var t = this.planes, n = 0; n < 6; n++) { var i = t[n]; if (aa.x = (0 < i.normal.x ? e.max : e.min).x, aa.y = (0 < i.normal.y ? e.max : e.min).y, aa.z = (0 < i.normal.z ? e.max : e.min).z, i.distanceToPoint(aa) < 0) return !1 } return !0 } }, { key: "containsPoint", value: function(e) { for (var t = this.planes, n = 0; n < 6; n++) if (t[n].distanceToPoint(e) < 0) return !1; return !0 } }]), o }(); function sa() { var n = null , e = !1 , i = null , r = null; function a(e, t) { i(e, t), r = n.requestAnimationFrame(a) } return { start: function() { !0 !== e && null !== i && (r = n.requestAnimationFrame(a), e = !0) }, stop: function() { n.cancelAnimationFrame(r), e = !1 }, setAnimationLoop: function(e) { i = e }, setContext: function(e) { n = e } } } function la(l, e) { var u = e.isWebGL2 , c = new WeakMap; return { get: function(e) { return e.isInterleavedBufferAttribute && (e = e.data), c.get(e) }, remove: function(e) { e.isInterleavedBufferAttribute && (e = e.data); var t = c.get(e); t && (l.deleteBuffer(t.buffer), c.delete(e)) }, update: function(e, t) { var n, i, r, a, o, s; e.isGLBufferAttribute ? (!(s = c.get(e)) || s.version < e.version) && c.set(e, { buffer: e.buffer, type: e.type, bytesPerElement: e.elementSize, version: e.version }) : (e.isInterleavedBufferAttribute && (e = e.data), void 0 === (n = c.get(e)) ? c.set(e, (r = t, a = (i = e).array, o = i.usage, s = l.createBuffer(), l.bindBuffer(r, s), l.bufferData(r, a, o), i.onUploadCallback(), o = 5126, a instanceof Float32Array ? o = 5126 : a instanceof Float64Array ? console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.") : a instanceof Uint16Array ? i.isFloat16BufferAttribute ? u ? o = 5131 : console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.") : o = 5123 : a instanceof Int16Array ? o = 5122 : a instanceof Uint32Array ? o = 5125 : a instanceof Int32Array ? o = 5124 : a instanceof Int8Array ? o = 5120 : a instanceof Uint8Array && (o = 5121), { buffer: s, type: o, bytesPerElement: a.BYTES_PER_ELEMENT, version: i.version })) : n.version < e.version && (o = n.buffer, a = t, t = (i = e).array, i = i.updateRange, l.bindBuffer(a, o), -1 === i.count ? l.bufferSubData(a, 0, t) : (u ? l.bufferSubData(a, i.offset * t.BYTES_PER_ELEMENT, t, i.offset, i.count) : l.bufferSubData(a, i.offset * t.BYTES_PER_ELEMENT, t.subarray(i.offset, i.offset + i.count)), i.count = -1), n.version = e.version)) } } } var ua = function() { y(T, Mr); var A = w(T); function T() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1; O(this, T), (e = A.call(this)).type = "PlaneBufferGeometry", e.parameters = { width: t, height: n, widthSegments: i, heightSegments: r }; for (var a = t / 2, o = n / 2, s = Math.floor(i), l = Math.floor(r), u = s + 1, c = l + 1, d = t / s, h = n / l, p = [], f = [], m = [], v = [], g = 0; g < c; g++) for (var y = g * h - o, w = 0; w < u; w++) f.push(w * d - a, -y, 0), m.push(0, 0, 1), v.push(w / s), v.push(1 - g / l); for (var b = 0; b < l; b++) for (var x = 0; x < s; x++) { var E = x + u * (b + 1) , _ = x + 1 + u * (b + 1) , M = x + 1 + u * b; p.push(x + u * b, E, M), p.push(E, _, M) } return e.setIndex(p), e.setAttribute("position", new dr(f,3)), e.setAttribute("normal", new dr(m,3)), e.setAttribute("uv", new dr(v,2)), e } return h(T) }() , ca = { alphamap_fragment: "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif", alphamap_pars_fragment: "#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif", alphatest_fragment: "#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif", aomap_fragment: "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif", aomap_pars_fragment: "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif", begin_vertex: "vec3 transformed = vec3( position );", beginnormal_vertex: "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif", bsdfs: "vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif", bumpmap_pars_fragment: "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif", clipping_planes_fragment: "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif", clipping_planes_pars_fragment: "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif", clipping_planes_pars_vertex: "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif", clipping_planes_vertex: "#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif", color_fragment: "#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif", color_pars_fragment: "#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif", color_pars_vertex: "#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif", color_vertex: "#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif", common: "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}", cube_uv_reflection_fragment: "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif", defaultnormal_vertex: "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif", displacementmap_pars_vertex: "#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif", displacementmap_vertex: "#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif", emissivemap_fragment: "#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif", emissivemap_pars_fragment: "#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif", encodings_fragment: "gl_FragColor = linearToOutputTexel( gl_FragColor );", encodings_pars_fragment: "\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}", envmap_fragment: "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif", envmap_common_pars_fragment: "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif", envmap_pars_fragment: "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif", envmap_pars_vertex: "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif", envmap_physical_pars_fragment: "#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif", envmap_vertex: "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif", fog_vertex: "#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif", fog_pars_vertex: "#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif", fog_fragment: "#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif", fog_pars_fragment: "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif", gradientmap_pars_fragment: "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}", lightmap_fragment: "#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif", lightmap_pars_fragment: "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif", lights_lambert_vertex: "vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif", lights_pars_begin: "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif", lights_toon_fragment: "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;", lights_toon_pars_fragment: "varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)", lights_phong_fragment: "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;", lights_phong_pars_fragment: "varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)", lights_physical_fragment: "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif", lights_physical_pars_fragment: "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}", lights_fragment_begin: "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif", lights_fragment_maps: "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif", lights_fragment_end: "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif", logdepthbuf_fragment: "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif", logdepthbuf_pars_fragment: "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif", logdepthbuf_pars_vertex: "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif", logdepthbuf_vertex: "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif", map_fragment: "#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif", map_pars_fragment: "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif", map_particle_fragment: "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif", map_particle_pars_fragment: "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif", metalnessmap_fragment: "float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif", metalnessmap_pars_fragment: "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif", morphnormal_vertex: "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif", morphtarget_pars_vertex: "#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif", morphtarget_vertex: "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif", normal_fragment_begin: "#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;", normal_fragment_maps: "#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif", normalmap_pars_fragment: "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif", clearcoat_normal_fragment_begin: "#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif", clearcoat_normal_fragment_maps: "#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif", clearcoat_pars_fragment: "#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif", packing: "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}", premultiplied_alpha_fragment: "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif", project_vertex: "vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;", dithering_fragment: "#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif", dithering_pars_fragment: "#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif", roughnessmap_fragment: "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif", roughnessmap_pars_fragment: "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif", shadowmap_pars_fragment: "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif", shadowmap_pars_vertex: "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif", shadowmap_vertex: "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif", shadowmask_pars_fragment: "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}", skinbase_vertex: "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif", skinning_pars_vertex: "#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif", skinning_vertex: "#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif", skinnormal_vertex: "#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif", specularmap_fragment: "float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif", specularmap_pars_fragment: "#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif", tonemapping_fragment: "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif", tonemapping_pars_fragment: "#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }", transmissionmap_fragment: "#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif", transmissionmap_pars_fragment: "#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\n#endif", uv_pars_fragment: "#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif", uv_pars_vertex: "#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif", uv_vertex: "#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif", uv2_pars_fragment: "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif", uv2_pars_vertex: "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif", uv2_vertex: "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif", worldpos_vertex: "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif", background_frag: "uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}", background_vert: "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}", cube_frag: "#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}", cube_vert: "varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}", depth_frag: "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}", depth_vert: "#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}", distanceRGBA_frag: "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}", distanceRGBA_vert: "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}", equirect_frag: "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}", equirect_vert: "varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}", linedashed_frag: "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}", linedashed_vert: "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshbasic_frag: "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshbasic_vert: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshlambert_frag: "uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshlambert_vert: "#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshmatcap_frag: "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshmatcap_vert: "#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}", meshtoon_frag: "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshtoon_vert: "#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}", meshphong_frag: "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshphong_vert: "#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}", meshphysical_frag: "#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshphysical_vert: "#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}", normal_frag: "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}", normal_vert: "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}", points_frag: "uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}", points_vert: "uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}", shadow_frag: "uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}", shadow_vert: "#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", sprite_frag: "uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}", sprite_vert: "uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}" } , da = { common: { diffuse: { value: new Yi(15658734) }, opacity: { value: 1 }, map: { value: null }, uvTransform: { value: new wn }, uv2Transform: { value: new wn }, alphaMap: { value: null } }, specularmap: { specularMap: { value: null } }, envmap: { envMap: { value: null }, flipEnvMap: { value: -1 }, reflectivity: { value: 1 }, refractionRatio: { value: .98 }, maxMipLevel: { value: 0 } }, aomap: { aoMap: { value: null }, aoMapIntensity: { value: 1 } }, lightmap: { lightMap: { value: null }, lightMapIntensity: { value: 1 } }, emissivemap: { emissiveMap: { value: null } }, bumpmap: { bumpMap: { value: null }, bumpScale: { value: 1 } }, normalmap: { normalMap: { value: null }, normalScale: { value: new yn(1,1) } }, displacementmap: { displacementMap: { value: null }, displacementScale: { value: 1 }, displacementBias: { value: 0 } }, roughnessmap: { roughnessMap: { value: null } }, metalnessmap: { metalnessMap: { value: null } }, gradientmap: { gradientMap: { value: null } }, fog: { fogDensity: { value: 25e-5 }, fogNear: { value: 1 }, fogFar: { value: 2e3 }, fogColor: { value: new Yi(16777215) } }, lights: { ambientLightColor: { value: [] }, lightProbe: { value: [] }, directionalLights: { value: [], properties: { direction: {}, color: {} } }, directionalLightShadows: { value: [], properties: { shadowBias: {}, shadowNormalBias: {}, shadowRadius: {}, shadowMapSize: {} } }, directionalShadowMap: { value: [] }, directionalShadowMatrix: { value: [] }, spotLights: { value: [], properties: { color: {}, position: {}, direction: {}, distance: {}, coneCos: {}, penumbraCos: {}, decay: {} } }, spotLightShadows: { value: [], properties: { shadowBias: {}, shadowNormalBias: {}, shadowRadius: {}, shadowMapSize: {} } }, spotShadowMap: { value: [] }, spotShadowMatrix: { value: [] }, pointLights: { value: [], properties: { color: {}, position: {}, decay: {}, distance: {} } }, pointLightShadows: { value: [], properties: { shadowBias: {}, shadowNormalBias: {}, shadowRadius: {}, shadowMapSize: {}, shadowCameraNear: {}, shadowCameraFar: {} } }, pointShadowMap: { value: [] }, pointShadowMatrix: { value: [] }, hemisphereLights: { value: [], properties: { direction: {}, skyColor: {}, groundColor: {} } }, rectAreaLights: { value: [], properties: { color: {}, position: {}, width: {}, height: {} } }, ltc_1: { value: null }, ltc_2: { value: null } }, points: { diffuse: { value: new Yi(15658734) }, opacity: { value: 1 }, size: { value: 1 }, scale: { value: 1 }, map: { value: null }, alphaMap: { value: null }, uvTransform: { value: new wn } }, sprite: { diffuse: { value: new Yi(15658734) }, opacity: { value: 1 }, center: { value: new yn(.5,.5) }, rotation: { value: 0 }, map: { value: null }, alphaMap: { value: null }, uvTransform: { value: new wn } } } , ha = { basic: { uniforms: qr([da.common, da.specularmap, da.envmap, da.aomap, da.lightmap, da.fog]), vertexShader: ca.meshbasic_vert, fragmentShader: ca.meshbasic_frag }, lambert: { uniforms: qr([da.common, da.specularmap, da.envmap, da.aomap, da.lightmap, da.emissivemap, da.fog, da.lights, { emissive: { value: new Yi(0) } }]), vertexShader: ca.meshlambert_vert, fragmentShader: ca.meshlambert_frag }, phong: { uniforms: qr([da.common, da.specularmap, da.envmap, da.aomap, da.lightmap, da.emissivemap, da.bumpmap, da.normalmap, da.displacementmap, da.fog, da.lights, { emissive: { value: new Yi(0) }, specular: { value: new Yi(1118481) }, shininess: { value: 30 } }]), vertexShader: ca.meshphong_vert, fragmentShader: ca.meshphong_frag }, standard: { uniforms: qr([da.common, da.envmap, da.aomap, da.lightmap, da.emissivemap, da.bumpmap, da.normalmap, da.displacementmap, da.roughnessmap, da.metalnessmap, da.fog, da.lights, { emissive: { value: new Yi(0) }, roughness: { value: 1 }, metalness: { value: 0 }, envMapIntensity: { value: 1 } }]), vertexShader: ca.meshphysical_vert, fragmentShader: ca.meshphysical_frag }, toon: { uniforms: qr([da.common, da.aomap, da.lightmap, da.emissivemap, da.bumpmap, da.normalmap, da.displacementmap, da.gradientmap, da.fog, da.lights, { emissive: { value: new Yi(0) } }]), vertexShader: ca.meshtoon_vert, fragmentShader: ca.meshtoon_frag }, matcap: { uniforms: qr([da.common, da.bumpmap, da.normalmap, da.displacementmap, da.fog, { matcap: { value: null } }]), vertexShader: ca.meshmatcap_vert, fragmentShader: ca.meshmatcap_frag }, points: { uniforms: qr([da.points, da.fog]), vertexShader: ca.points_vert, fragmentShader: ca.points_frag }, dashed: { uniforms: qr([da.common, da.fog, { scale: { value: 1 }, dashSize: { value: 1 }, totalSize: { value: 2 } }]), vertexShader: ca.linedashed_vert, fragmentShader: ca.linedashed_frag }, depth: { uniforms: qr([da.common, da.displacementmap]), vertexShader: ca.depth_vert, fragmentShader: ca.depth_frag }, normal: { uniforms: qr([da.common, da.bumpmap, da.normalmap, da.displacementmap, { opacity: { value: 1 } }]), vertexShader: ca.normal_vert, fragmentShader: ca.normal_frag }, sprite: { uniforms: qr([da.sprite, da.fog]), vertexShader: ca.sprite_vert, fragmentShader: ca.sprite_frag }, background: { uniforms: { uvTransform: { value: new wn }, t2D: { value: null } }, vertexShader: ca.background_vert, fragmentShader: ca.background_frag }, cube: { uniforms: qr([da.envmap, { opacity: { value: 1 } }]), vertexShader: ca.cube_vert, fragmentShader: ca.cube_frag }, equirect: { uniforms: { tEquirect: { value: null } }, vertexShader: ca.equirect_vert, fragmentShader: ca.equirect_frag }, distanceRGBA: { uniforms: qr([da.common, da.displacementmap, { referencePosition: { value: new Cn }, nearDistance: { value: 1 }, farDistance: { value: 1e3 } }]), vertexShader: ca.distanceRGBA_vert, fragmentShader: ca.distanceRGBA_frag }, shadow: { uniforms: qr([da.lights, da.fog, { color: { value: new Yi(0) }, opacity: { value: 1 } }]), vertexShader: ca.shadow_vert, fragmentShader: ca.shadow_frag } }; function pa(a, o, n, s, i) { var l, u, c = new Yi(0), d = 0, h = null, p = 0, f = null; function m(e, t) { n.buffers.color.setClear(e.r, e.g, e.b, t, i) } return { getClearColor: function() { return c }, setClearColor: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1; c.set(e), m(c, d = t) }, getClearAlpha: function() { return d }, setClearAlpha: function(e) { m(c, d = e) }, render: function(e, t, n, i) { var r = !0 === t.isScene ? t.background : null; r && r.isTexture && (r = o.get(r)), t = (t = a.xr).getSession && t.getSession(), null === (r = t && "additive" === t.environmentBlendMode ? null : r) ? m(c, d) : r && r.isColor && (m(r, 1), i = !0), (a.autoClear || i) && a.clear(a.autoClearColor, a.autoClearDepth, a.autoClearStencil), r && (r.isCubeTexture || r.isWebGLCubeRenderTarget || r.mapping === z) ? (void 0 === u && ((u = new Hr(new Wr(1,1,1),new Qr({ name: "BackgroundCubeMaterial", uniforms: Xr(ha.cube.uniforms), vertexShader: ha.cube.vertexShader, fragmentShader: ha.cube.fragmentShader, side: J, depthTest: !1, depthWrite: !1, fog: !1 }))).geometry.deleteAttribute("normal"), u.geometry.deleteAttribute("uv"), u.onBeforeRender = function(e, t, n) { this.matrixWorld.copyPosition(n.matrixWorld) } , Object.defineProperty(u.material, "envMap", { get: function() { return this.uniforms.envMap.value } }), s.update(u)), r.isWebGLCubeRenderTarget && (r = r.texture), u.material.uniforms.envMap.value = r, u.material.uniforms.flipEnvMap.value = r.isCubeTexture && r._needsFlipEnvMap ? -1 : 1, h === r && p === r.version && f === a.toneMapping || (u.material.needsUpdate = !0, p = (h = r).version, f = a.toneMapping), e.unshift(u, u.geometry, u.material, 0, 0, null)) : r && r.isTexture && (void 0 === l && ((l = new Hr(new ua(2,2),new Qr({ name: "BackgroundMaterial", uniforms: Xr(ha.background.uniforms), vertexShader: ha.background.vertexShader, fragmentShader: ha.background.fragmentShader, side: q, depthTest: !1, depthWrite: !1, fog: !1 }))).geometry.deleteAttribute("normal"), Object.defineProperty(l.material, "map", { get: function() { return this.uniforms.t2D.value } }), s.update(l)), !0 === (l.material.uniforms.t2D.value = r).matrixAutoUpdate && r.updateMatrix(), l.material.uniforms.uvTransform.value.copy(r.matrix), h === r && p === r.version && f === a.toneMapping || (l.material.needsUpdate = !0, p = (h = r).version, f = a.toneMapping), e.unshift(l, l.geometry, l.material, 0, 0, null)) } } } function fa(x, E, _, M) { var a = x.getParameter(34921) , s = M.isWebGL2 ? null : E.get("OES_vertex_array_object") , l = M.isWebGL2 || null !== s , u = {} , e = h(null) , c = e; function d(e) { return M.isWebGL2 ? x.bindVertexArray(e) : s.bindVertexArrayOES(e) } function o(e) { return M.isWebGL2 ? x.deleteVertexArray(e) : s.deleteVertexArrayOES(e) } function h(e) { for (var t = [], n = [], i = [], r = 0; r < a; r++) t[r] = 0, n[r] = 0, i[r] = 0; return { geometry: null, program: null, wireframe: !1, newAttributes: t, enabledAttributes: n, attributeDivisors: i, object: e, attributes: {}, index: null } } function A() { for (var e = c.newAttributes, t = 0, n = e.length; t < n; t++) e[t] = 0 } function T(e) { S(e, 0) } function S(e, t) { var n = c.newAttributes , i = c.enabledAttributes , r = c.attributeDivisors; n[e] = 1, 0 === i[e] && (x.enableVertexAttribArray(e), i[e] = 1), r[e] !== t && ((M.isWebGL2 ? x : E.get("ANGLE_instanced_arrays"))[M.isWebGL2 ? "vertexAttribDivisor" : "vertexAttribDivisorANGLE"](e, t), r[e] = t) } function C() { for (var e = c.newAttributes, t = c.enabledAttributes, n = 0, i = t.length; n < i; n++) t[n] !== e[n] && (x.disableVertexAttribArray(n), t[n] = 0) } function P(e, t, n, i, r, a) { !0 !== M.isWebGL2 || 5124 !== n && 5125 !== n ? x.vertexAttribPointer(e, t, n, i, r, a) : x.vertexAttribIPointer(e, t, n, r, a) } function p() { t(), c !== e && d((c = e).object) } function t() { e.geometry = null, e.program = null, e.wireframe = !1 } return { setup: function(e, t, n, i, r) { var a, o = !1; l ? (a = function(e, t, n) { var i = !0 === n.wireframe , n = u[e.id]; void 0 === n && (n = {}, u[e.id] = n); e = n[t.id]; void 0 === e && (e = {}, n[t.id] = e); t = e[i]; void 0 === t && (t = h(M.isWebGL2 ? x.createVertexArray() : s.createVertexArrayOES()), e[i] = t); return t }(i, n, t), c !== a && d((c = a).object), (o = function(e, t) { var n, i = c.attributes, r = e.attributes, a = 0; for (n in r) { var o = i[n] , s = r[n]; if (void 0 === o) return !0; if (o.attribute !== s) return !0; if (o.data !== s.data) return !0; a++ } return c.attributesNum !== a || c.index !== t }(i, r)) && function(e, t) { var n, i = {}, r = e.attributes, a = 0; for (n in r) { var o = r[n] , s = {}; (s.attribute = o).data && (s.data = o.data), i[n] = s, a++ } c.attributes = i, c.attributesNum = a, c.index = t }(i, r)) : (a = !0 === t.wireframe, c.geometry === i.id && c.program === n.id && c.wireframe === a || (c.geometry = i.id, c.program = n.id, c.wireframe = a, o = !0)), !0 === e.isInstancedMesh && (o = !0), null !== r && _.update(r, 34963), o && (function(e, t, n, i) { if (!1 === M.isWebGL2 && (e.isInstancedMesh || i.isInstancedBufferGeometry) && null === E.get("ANGLE_instanced_arrays")) return; A(); var r, a = i.attributes, o = n.getAttributes(), s = t.defaultAttributeValues; for (r in o) { var l = o[r]; if (0 <= l) { var u = a[r]; if (void 0 !== u) { var c, d, h, p, f, m = u.normalized, v = u.itemSize, g = _.get(u); void 0 !== g && (c = g.buffer, d = g.type, h = g.bytesPerElement, u.isInterleavedBufferAttribute ? (p = u.data, f = p.stride, g = u.offset, p && p.isInstancedInterleavedBuffer ? (S(l, p.meshPerAttribute), void 0 === i._maxInstanceCount && (i._maxInstanceCount = p.meshPerAttribute * p.count)) : T(l), x.bindBuffer(34962, c), P(l, v, d, m, f * h, g * h)) : (u.isInstancedBufferAttribute ? (S(l, u.meshPerAttribute), void 0 === i._maxInstanceCount && (i._maxInstanceCount = u.meshPerAttribute * u.count)) : T(l), x.bindBuffer(34962, c), P(l, v, d, m, 0, 0))) } else if ("instanceMatrix" === r) { m = _.get(e.instanceMatrix); void 0 !== m && (w = m.buffer, y = m.type, S(l + 0, 1), S(l + 1, 1), S(l + 2, 1), S(l + 3, 1), x.bindBuffer(34962, w), x.vertexAttribPointer(l + 0, 4, y, !1, 64, 0), x.vertexAttribPointer(l + 1, 4, y, !1, 64, 16), x.vertexAttribPointer(l + 2, 4, y, !1, 64, 32), x.vertexAttribPointer(l + 3, 4, y, !1, 64, 48)) } else if ("instanceColor" === r) { var y, w = _.get(e.instanceColor); void 0 !== w && (y = w.buffer, w = w.type, S(l, 1), x.bindBuffer(34962, y), x.vertexAttribPointer(l, 3, w, !1, 12, 0)) } else if (void 0 !== s) { var b = s[r]; if (void 0 !== b) switch (b.length) { case 2: x.vertexAttrib2fv(l, b); break; case 3: x.vertexAttrib3fv(l, b); break; case 4: x.vertexAttrib4fv(l, b); break; default: x.vertexAttrib1fv(l, b) } } } } C() }(e, t, n, i), null !== r && x.bindBuffer(34963, _.get(r).buffer)) }, reset: p, resetDefaultState: t, dispose: function() { for (var e in p(), u) { var t, n = u[e]; for (t in n) { var i, r = n[t]; for (i in r) o(r[i].object), delete r[i]; delete n[t] } delete u[e] } }, releaseStatesOfGeometry: function(e) { if (void 0 !== u[e.id]) { var t, n = u[e.id]; for (t in n) { var i, r = n[t]; for (i in r) o(r[i].object), delete r[i]; delete n[t] } delete u[e.id] } }, releaseStatesOfProgram: function(e) { for (var t in u) { t = u[t]; if (void 0 !== t[e.id]) { var n, i = t[e.id]; for (n in i) o(i[n].object), delete i[n]; delete t[e.id] } } }, initAttributes: A, enableAttribute: T, disableUnusedAttributes: C } } function ma(a, o, s, e) { var l, u = e.isWebGL2; this.setMode = function(e) { l = e } , this.render = function(e, t) { a.drawArrays(l, e, t), s.update(t, l, 1) } , this.renderInstances = function(e, t, n) { if (0 !== n) { var i, r; if (u) i = a, r = "drawArraysInstanced"; else if (r = "drawArraysInstancedANGLE", null === (i = o.get("ANGLE_instanced_arrays"))) return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); i[r](l, e, t, n), s.update(t, l, n) } } } function va(t, n, e) { var i; function r(e) { if ("highp" === e) { if (0 < t.getShaderPrecisionFormat(35633, 36338).precision && 0 < t.getShaderPrecisionFormat(35632, 36338).precision) return "highp"; e = "mediump" } return "mediump" === e && 0 < t.getShaderPrecisionFormat(35633, 36337).precision && 0 < t.getShaderPrecisionFormat(35632, 36337).precision ? "mediump" : "lowp" } var a = "undefined" != typeof WebGL2RenderingContext && t instanceof WebGL2RenderingContext || "undefined" != typeof WebGL2ComputeRenderingContext && t instanceof WebGL2ComputeRenderingContext , o = void 0 !== e.precision ? e.precision : "highp" , s = r(o); s !== o && (console.warn("THREE.WebGLRenderer:", o, "not supported, using", s, "instead."), o = s); var l = !0 === e.logarithmicDepthBuffer , u = t.getParameter(34930) , c = t.getParameter(35660) , d = t.getParameter(3379) , h = t.getParameter(34076) , p = t.getParameter(34921) , f = t.getParameter(36347) , m = t.getParameter(36348) , v = t.getParameter(36349) , s = 0 < c , e = a || !!n.get("OES_texture_float"); return { isWebGL2: a, getMaxAnisotropy: function() { if (void 0 !== i) return i; var e = n.get("EXT_texture_filter_anisotropic"); return i = null !== e ? t.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0 }, getMaxPrecision: r, precision: o, logarithmicDepthBuffer: l, maxTextures: u, maxVertexTextures: c, maxTextureSize: d, maxCubemapSize: h, maxAttributes: p, maxVertexUniforms: f, maxVaryings: m, maxFragmentUniforms: v, vertexTextures: s, floatFragmentTextures: e, floatVertexTextures: s && e, maxSamples: a ? t.getParameter(36183) : 0 } } function ga(u) { var c = this , d = null , h = 0 , p = !1 , f = !1 , m = new ki , v = new wn , g = { value: null, needsUpdate: !1 }; function y() { g.value !== d && (g.value = d, g.needsUpdate = 0 < h), c.numPlanes = h, c.numIntersection = 0 } function w(e, t, n, i) { var r = null !== e ? e.length : 0 , a = null; if (0 !== r) { if (a = g.value, !0 !== i || null === a) { var i = n + 4 * r , o = t.matrixWorldInverse; v.getNormalMatrix(o), (null === a || a.length < i) && (a = new Float32Array(i)); for (var s = 0, l = n; s !== r; ++s, l += 4) m.copy(e[s]).applyMatrix4(o, v), m.normal.toArray(a, l), a[l + 3] = m.constant } g.value = a, g.needsUpdate = !0 } return c.numPlanes = r, c.numIntersection = 0, a } this.uniform = g, this.numPlanes = 0, this.numIntersection = 0, this.init = function(e, t, n) { var i = 0 !== e.length || t || 0 !== h || p; return p = t, d = w(e, n, 0), h = e.length, i } , this.beginShadows = function() { f = !0, w(null) } , this.endShadows = function() { f = !1, y() } , this.setState = function(e, t, n) { var i = e.clippingPlanes , r = e.clipIntersection , a = e.clipShadows , e = u.get(e); if (!p || null === i || 0 === i.length || f && !a) f ? w(null) : y(); else { var a = f ? 0 : h , o = 4 * a , s = e.clippingState || null; g.value = s; for (var s = w(i, t, o, n), l = 0; l !== o; ++l) s[l] = d[l]; e.clippingState = s, this.numIntersection = r ? this.numPlanes : 0, this.numPlanes += a } } } function ya(r) { var a = new WeakMap; function o(e, t) { return t === F ? e.mapping = L : t === I && (e.mapping = R), e } function s(e) { var t = e.target; t.removeEventListener("dispose", s); e = a.get(t); void 0 !== e && (a.delete(t), e.dispose()) } return { get: function(e) { if (e && e.isTexture) { var t = e.mapping; if (t === F || t === I) { if (a.has(e)) return o(a.get(e).texture, e.mapping); var n = e.image; if (n && 0 < n.height) { var i = r.getRenderList() , t = r.getRenderTarget() , n = new na(n.height / 2); return n.fromEquirectangularTexture(r, e), a.set(e, n), r.setRenderTarget(t), r.setRenderList(i), e.addEventListener("dispose", s), o(n.texture, e.mapping) } return null } } return e }, dispose: function() { a = new WeakMap } } } function wa(n) { var i = {}; return { has: function(e) { if (void 0 !== i[e]) return null !== i[e]; var t; switch (e) { case "WEBGL_depth_texture": t = n.getExtension("WEBGL_depth_texture") || n.getExtension("MOZ_WEBGL_depth_texture") || n.getExtension("WEBKIT_WEBGL_depth_texture"); break; case "EXT_texture_filter_anisotropic": t = n.getExtension("EXT_texture_filter_anisotropic") || n.getExtension("MOZ_EXT_texture_filter_anisotropic") || n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"); break; case "WEBGL_compressed_texture_s3tc": t = n.getExtension("WEBGL_compressed_texture_s3tc") || n.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"); break; case "WEBGL_compressed_texture_pvrtc": t = n.getExtension("WEBGL_compressed_texture_pvrtc") || n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"); break; default: t = n.getExtension(e) } return null !== (i[e] = t) }, get: function(e) { return this.has(e) || console.warn("THREE.WebGLRenderer: " + e + " extension not supported."), i[e] } } } function ba(e, g, r, a) { var o = new WeakMap , y = new WeakMap; function s(e) { var t, n = e.target, i = o.get(n); for (t in null !== i.index && g.remove(i.index), i.attributes) g.remove(i.attributes[t]); n.removeEventListener("dispose", s), o.delete(n); e = y.get(i); e && (g.remove(e), y.delete(i)), a.releaseStatesOfGeometry(i), !0 === n.isInstancedBufferGeometry && delete n._maxInstanceCount, r.memory.geometries-- } function i(e) { var t = [] , n = e.index , i = e.attributes.position , r = 0; if (null !== n) for (var a = n.array, r = n.version, o = 0, s = a.length; o < s; o += 3) { var l = a[o + 0] , u = a[o + 1] , c = a[o + 2]; t.push(l, u, u, c, c, l) } else { var d = i.array; r = i.version; for (var h = 0, p = d.length / 3 - 1; h < p; h += 3) { var f = h + 0 , m = h + 1 , v = h + 2; t.push(f, m, m, v, v, f) } } d = new (65535 < fr(t) ? ur : sr)(t,1); d.version = r; r = y.get(e); r && g.remove(r), y.set(e, d) } return { get: function(e, t) { var n = o.get(t); return n || (t.addEventListener("dispose", s), t.isBufferGeometry ? n = t : t.isGeometry && (void 0 === t._bufferGeometry && (t._bufferGeometry = (new Mr).setFromObject(e)), n = t._bufferGeometry), o.set(t, n), r.memory.geometries++, n) }, update: function(e) { var t, n = e.attributes; for (t in n) g.update(n[t], 34962); var i, r = e.morphAttributes; for (i in r) for (var a = r[i], o = 0, s = a.length; o < s; o++) g.update(a[o], 34962) }, getWireframeAttribute: function(e) { var t, n = y.get(e); return (!n || null !== (t = e.index) && n.version < t.version) && i(e), y.get(e) } } } function xa(a, o, s, e) { var l, u, c, d = e.isWebGL2; this.setMode = function(e) { l = e } , this.setIndex = function(e) { u = e.type, c = e.bytesPerElement } , this.render = function(e, t) { a.drawElements(l, t, u, e * c), s.update(t, l, 1) } , this.renderInstances = function(e, t, n) { if (0 !== n) { var i, r; if (d) i = a, r = "drawElementsInstanced"; else if (r = "drawElementsInstancedANGLE", null === (i = o.get("ANGLE_instanced_arrays"))) return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); i[r](l, t, u, e * c, n), s.update(t, l, n) } } } function Ea(e) { var i = { frame: 0, calls: 0, triangles: 0, points: 0, lines: 0 }; return { memory: { geometries: 0, textures: 0 }, render: i, programs: null, autoReset: !0, reset: function() { i.frame++, i.calls = 0, i.triangles = 0, i.points = 0, i.lines = 0 }, update: function(e, t, n) { switch (i.calls++, t) { case 4: i.triangles += n * (e / 3); break; case 1: i.lines += n * (e / 2); break; case 3: i.lines += n * (e - 1); break; case 2: i.lines += n * e; break; case 0: i.points += n * e; break; default: console.error("THREE.WebGLInfo: Unknown draw mode:", t) } } } } function _a(e, t) { return e[0] - t[0] } function Ma(e, t) { return Math.abs(t[1]) - Math.abs(e[1]) } function Aa(g) { for (var y = {}, w = new Float32Array(8), b = [], e = 0; e < 8; e++) b[e] = [e, 0]; return { update: function(e, t, n, i) { var r = e.morphTargetInfluences , a = void 0 === r ? 0 : r.length; if (void 0 === (o = y[t.id])) { for (var o = [], s = 0; s < a; s++) o[s] = [s, 0]; y[t.id] = o } for (var l = 0; l < a; l++) { var u = o[l]; u[0] = l, u[1] = r[l] } o.sort(Ma); for (var c = 0; c < 8; c++) c < a && o[c][1] ? (b[c][0] = o[c][0], b[c][1] = o[c][1]) : (b[c][0] = Number.MAX_SAFE_INTEGER, b[c][1] = 0); b.sort(_a); for (var d = n.morphTargets && t.morphAttributes.position, h = n.morphNormals && t.morphAttributes.normal, p = 0, f = 0; f < 8; f++) { var m = b[f] , v = m[0] , m = m[1]; v !== Number.MAX_SAFE_INTEGER && m ? (d && t.getAttribute("morphTarget" + f) !== d[v] && t.setAttribute("morphTarget" + f, d[v]), h && t.getAttribute("morphNormal" + f) !== h[v] && t.setAttribute("morphNormal" + f, h[v]), p += w[f] = m) : (d && !0 === t.hasAttribute("morphTarget" + f) && t.deleteAttribute("morphTarget" + f), h && !0 === t.hasAttribute("morphNormal" + f) && t.deleteAttribute("morphNormal" + f), w[f] = 0) } n = t.morphTargetsRelative ? 1 : 1 - p, i.getUniforms().setValue(g, "morphTargetBaseInfluence", n), i.getUniforms().setValue(g, "morphTargetInfluences", w) } } } function Ta(e, r, a, o) { var s = new WeakMap; function l(e) { e = e.target; e.removeEventListener("dispose", l), a.remove(e.instanceMatrix), null !== e.instanceColor && a.remove(e.instanceColor) } return { update: function(e) { var t = o.render.frame , n = e.geometry , i = r.get(e, n); return s.get(i) !== t && (n.isGeometry && i.updateFromObject(e), r.update(i), s.set(i, t)), e.isInstancedMesh && (!1 === e.hasEventListener("dispose", l) && e.addEventListener("dispose", l), a.update(e.instanceMatrix, 34962), null !== e.instanceColor && a.update(e.instanceColor, 34962)), i }, dispose: function() { s = new WeakMap } } } function Sa() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : null , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1 , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1 , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1; En.call(this, null), this.image = { data: e, width: t, height: n, depth: i }, this.magFilter = Re, this.minFilter = Re, this.wrapR = Be, this.generateMipmaps = !1, this.flipY = !1, this.needsUpdate = !0 } function Ca() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : null , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1 , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1 , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1; En.call(this, null), this.image = { data: e, width: t, height: n, depth: i }, this.magFilter = Re, this.minFilter = Re, this.wrapR = Be, this.generateMipmaps = !1, this.flipY = !1, this.needsUpdate = !0 } ha.physical = { uniforms: qr([ha.standard.uniforms, { clearcoat: { value: 0 }, clearcoatMap: { value: null }, clearcoatRoughness: { value: 0 }, clearcoatRoughnessMap: { value: null }, clearcoatNormalScale: { value: new yn(1,1) }, clearcoatNormalMap: { value: null }, sheen: { value: new Yi(0) }, transmission: { value: 0 }, transmissionMap: { value: null } }]), vertexShader: ca.meshphysical_vert, fragmentShader: ca.meshphysical_frag }, ((Sa.prototype = Object.create(En.prototype)).constructor = Sa).prototype.isDataTexture2DArray = !0, ((Ca.prototype = Object.create(En.prototype)).constructor = Ca).prototype.isDataTexture3D = !0; var Pa = new En , Da = new Sa , ka = new Ca , Ba = new ta , La = [] , Ra = [] , Fa = new Float32Array(16) , Ia = new Float32Array(9) , Oa = new Float32Array(4); function za(e, t, n) { var i = e[0]; if (i <= 0 || 0 < i) return e; var r = t * n , a = La[r]; if (void 0 === a && (a = new Float32Array(r), La[r] = a), 0 !== t) { i.toArray(a, 0); for (var o = 1, s = 0; o !== t; ++o) e[o].toArray(a, s += n) } return a } function Na(e, t) { if (e.length === t.length) { for (var n = 0, i = e.length; n < i; n++) if (e[n] !== t[n]) return; return 1 } } function Ua(e, t) { for (var n = 0, i = t.length; n < i; n++) e[n] = t[n] } function Ga(e, t) { var n = Ra[t]; void 0 === n && (n = new Int32Array(t), Ra[t] = n); for (var i = 0; i !== t; ++i) n[i] = e.allocateTextureUnit(); return n } function Ha(e, t) { var n = this.cache; n[0] !== t && (e.uniform1f(this.addr, t), n[0] = t) } function Va(e, t) { var n = this.cache; void 0 !== t.x ? n[0] === t.x && n[1] === t.y || (e.uniform2f(this.addr, t.x, t.y), n[0] = t.x, n[1] = t.y) : Na(n, t) || (e.uniform2fv(this.addr, t), Ua(n, t)) } function ja(e, t) { var n = this.cache; void 0 !== t.x ? n[0] === t.x && n[1] === t.y && n[2] === t.z || (e.uniform3f(this.addr, t.x, t.y, t.z), n[0] = t.x, n[1] = t.y, n[2] = t.z) : void 0 !== t.r ? n[0] === t.r && n[1] === t.g && n[2] === t.b || (e.uniform3f(this.addr, t.r, t.g, t.b), n[0] = t.r, n[1] = t.g, n[2] = t.b) : Na(n, t) || (e.uniform3fv(this.addr, t), Ua(n, t)) } function Wa(e, t) { var n = this.cache; void 0 !== t.x ? n[0] === t.x && n[1] === t.y && n[2] === t.z && n[3] === t.w || (e.uniform4f(this.addr, t.x, t.y, t.z, t.w), n[0] = t.x, n[1] = t.y, n[2] = t.z, n[3] = t.w) : Na(n, t) || (e.uniform4fv(this.addr, t), Ua(n, t)) } function Xa(e, t) { var n = this.cache , i = t.elements; void 0 === i ? Na(n, t) || (e.uniformMatrix2fv(this.addr, !1, t), Ua(n, t)) : Na(n, i) || (Oa.set(i), e.uniformMatrix2fv(this.addr, !1, Oa), Ua(n, i)) } function qa(e, t) { var n = this.cache , i = t.elements; void 0 === i ? Na(n, t) || (e.uniformMatrix3fv(this.addr, !1, t), Ua(n, t)) : Na(n, i) || (Ia.set(i), e.uniformMatrix3fv(this.addr, !1, Ia), Ua(n, i)) } function Ja(e, t) { var n = this.cache , i = t.elements; void 0 === i ? Na(n, t) || (e.uniformMatrix4fv(this.addr, !1, t), Ua(n, t)) : Na(n, i) || (Fa.set(i), e.uniformMatrix4fv(this.addr, !1, Fa), Ua(n, i)) } function Ya(e, t, n) { var i = this.cache , r = n.allocateTextureUnit(); i[0] !== r && (e.uniform1i(this.addr, r), i[0] = r), n.safeSetTexture2D(t || Pa, r) } function Za(e, t, n) { var i = this.cache , r = n.allocateTextureUnit(); i[0] !== r && (e.uniform1i(this.addr, r), i[0] = r), n.setTexture2DArray(t || Da, r) } function Qa(e, t, n) { var i = this.cache , r = n.allocateTextureUnit(); i[0] !== r && (e.uniform1i(this.addr, r), i[0] = r), n.setTexture3D(t || ka, r) } function Ka(e, t, n) { var i = this.cache , r = n.allocateTextureUnit(); i[0] !== r && (e.uniform1i(this.addr, r), i[0] = r), n.safeSetTextureCube(t || Ba, r) } function $a(e, t) { var n = this.cache; n[0] !== t && (e.uniform1i(this.addr, t), n[0] = t) } function eo(e, t) { var n = this.cache; Na(n, t) || (e.uniform2iv(this.addr, t), Ua(n, t)) } function to(e, t) { var n = this.cache; Na(n, t) || (e.uniform3iv(this.addr, t), Ua(n, t)) } function no(e, t) { var n = this.cache; Na(n, t) || (e.uniform4iv(this.addr, t), Ua(n, t)) } function io(e, t) { var n = this.cache; n[0] !== t && (e.uniform1ui(this.addr, t), n[0] = t) } function ro(e, t) { e.uniform1fv(this.addr, t) } function ao(e, t) { e.uniform1iv(this.addr, t) } function oo(e, t) { e.uniform2iv(this.addr, t) } function so(e, t) { e.uniform3iv(this.addr, t) } function lo(e, t) { e.uniform4iv(this.addr, t) } function uo(e, t) { t = za(t, this.size, 2); e.uniform2fv(this.addr, t) } function co(e, t) { t = za(t, this.size, 3); e.uniform3fv(this.addr, t) } function ho(e, t) { t = za(t, this.size, 4); e.uniform4fv(this.addr, t) } function po(e, t) { t = za(t, this.size, 4); e.uniformMatrix2fv(this.addr, !1, t) } function fo(e, t) { t = za(t, this.size, 9); e.uniformMatrix3fv(this.addr, !1, t) } function mo(e, t) { t = za(t, this.size, 16); e.uniformMatrix4fv(this.addr, !1, t) } function vo(e, t, n) { var i = t.length , r = Ga(n, i); e.uniform1iv(this.addr, r); for (var a = 0; a !== i; ++a) n.safeSetTexture2D(t[a] || Pa, r[a]) } function go(e, t, n) { var i = t.length , r = Ga(n, i); e.uniform1iv(this.addr, r); for (var a = 0; a !== i; ++a) n.safeSetTextureCube(t[a] || Ba, r[a]) } function yo(e, t, n) { this.id = e, this.addr = n, this.cache = [], this.setValue = function(e) { switch (e) { case 5126: return Ha; case 35664: return Va; case 35665: return ja; case 35666: return Wa; case 35674: return Xa; case 35675: return qa; case 35676: return Ja; case 5124: case 35670: return $a; case 35667: case 35671: return eo; case 35668: case 35672: return to; case 35669: case 35673: return no; case 5125: return io; case 35678: case 36198: case 36298: case 36306: case 35682: return Ya; case 35679: case 36299: case 36307: return Qa; case 35680: case 36300: case 36308: case 36293: return Ka; case 36289: case 36303: case 36311: case 36292: return Za } }(t.type) } function wo(e, t, n) { this.id = e, this.addr = n, this.cache = [], this.size = t.size, this.setValue = function(e) { switch (e) { case 5126: return ro; case 35664: return uo; case 35665: return co; case 35666: return ho; case 35674: return po; case 35675: return fo; case 35676: return mo; case 5124: case 35670: return ao; case 35667: case 35671: return oo; case 35668: case 35672: return so; case 35669: case 35673: return lo; case 35678: case 36198: case 36298: case 36306: case 35682: return vo; case 35680: case 36300: case 36308: case 36293: return go } }(t.type) } function bo(e) { this.id = e, this.seq = [], this.map = {} } wo.prototype.updateCache = function(e) { var t = this.cache; e instanceof Float32Array && t.length !== e.length && (this.cache = new Float32Array(e.length)), Ua(t, e) } , bo.prototype.setValue = function(e, t, n) { for (var i = this.seq, r = 0, a = i.length; r !== a; ++r) { var o = i[r]; o.setValue(e, t[o.id], n) } } ; var xo = /(\w+)(\])?(\[|\.)?/g; function Eo(e, t) { e.seq.push(t), e.map[t.id] = t } function _o(e, t) { this.seq = [], this.map = {}; for (var n = e.getProgramParameter(t, 35718), i = 0; i < n; ++i) { var r = e.getActiveUniform(t, i); !function(e, t, n) { var i = e.name , r = i.length; for (xo.lastIndex = 0; ; ) { var a = xo.exec(i) , o = xo.lastIndex , s = a[1] , l = "]" === a[2] , a = a[3]; if (l && (s |= 0), void 0 === a || "[" === a && o + 2 === r) { Eo(n, new (void 0 === a ? yo : wo)(s,e,t)); break } a = n.map[s]; void 0 === a && Eo(n, a = new bo(s)), n = a } }(r, e.getUniformLocation(t, r.name), this) } } function Mo(e, t, n) { t = e.createShader(t); return e.shaderSource(t, n), e.compileShader(t), t } _o.prototype.setValue = function(e, t, n, i) { t = this.map[t]; void 0 !== t && t.setValue(e, n, i) } , _o.prototype.setOptional = function(e, t, n) { t = t[n]; void 0 !== t && this.setValue(e, n, t) } , _o.upload = function(e, t, n, i) { for (var r = 0, a = t.length; r !== a; ++r) { var o = t[r] , s = n[o.id]; !1 !== s.needsUpdate && o.setValue(e, s.value, i) } } , _o.seqWithValue = function(e, t) { for (var n = [], i = 0, r = e.length; i !== r; ++i) { var a = e[i]; a.id in t && n.push(a) } return n } ; var Ao = 0; function To(e) { switch (e) { case rn: return ["Linear", "( value )"]; case an: return ["sRGB", "( value )"]; case 3002: return ["RGBE", "( value )"]; case 3004: return ["RGBM", "( value, 7.0 )"]; case 3005: return ["RGBM", "( value, 16.0 )"]; case 3006: return ["RGBD", "( value, 256.0 )"]; case 3007: return ["Gamma", "( value, float( GAMMA_FACTOR ) )"]; case 3003: return ["LogLuv", "( value )"]; default: return console.warn("THREE.WebGLProgram: Unsupported encoding:", e), ["Linear", "( value )"] } } function So(e, t, n) { var i = e.getShaderParameter(t, 35713) , r = e.getShaderInfoLog(t).trim(); return i && "" === r ? "" : "THREE.WebGLShader: gl.getShaderInfoLog() " + n + "\n" + r + function(e) { for (var t = e.split("\n"), n = 0; n < t.length; n++) t[n] = n + 1 + ": " + t[n]; return t.join("\n") }(e.getShaderSource(t)) } function Co(e, t) { t = To(t); return "vec4 " + e + "( vec4 value ) { return " + t[0] + "ToLinear" + t[1] + "; }" } function Po(e) { return "" !== e } function Do(e, t) { return e.replace(/NUM_DIR_LIGHTS/g, t.numDirLights).replace(/NUM_SPOT_LIGHTS/g, t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g, t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, t.numPointLights).replace(/NUM_HEMI_LIGHTS/g, t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g, t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, t.numPointLightShadows) } function ko(e, t) { return e.replace(/NUM_CLIPPING_PLANES/g, t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, t.numClippingPlanes - t.numClipIntersection) } var Bo = /^[ \t]*#include +<([\w\d./]+)>/gm; function Lo(e) { return e.replace(Bo, Ro) } function Ro(e, t) { var n = ca[t]; if (void 0 === n) throw new Error("Can not resolve #include <" + t + ">"); return Lo(n) } var Fo = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g , Io = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g; function Oo(e) { return e.replace(Io, No).replace(Fo, zo) } function zo(e, t, n, i) { return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."), No(0, t, n, i) } function No(e, t, n, i) { for (var r = "", a = parseInt(t); a < parseInt(n); a++) r += i.replace(/\[\s*i\s*\]/g, "[ " + a + " ]").replace(/UNROLLED_LOOP_INDEX/g, a); return r } function Uo(e) { var t = "precision " + e.precision + " float;\nprecision " + e.precision + " int;"; return "highp" === e.precision ? t += "\n#define HIGH_PRECISION" : "mediump" === e.precision ? t += "\n#define MEDIUM_PRECISION" : "lowp" === e.precision && (t += "\n#define LOW_PRECISION"), t } function Go(e, t, n, i) { var r, a, o = e.getContext(), s = n.defines, l = n.vertexShader, u = n.fragmentShader, c = (m = "SHADOWMAP_TYPE_BASIC", (f = n).shadowMapType === P ? m = "SHADOWMAP_TYPE_PCF" : 2 === f.shadowMapType ? m = "SHADOWMAP_TYPE_PCF_SOFT" : f.shadowMapType === D && (m = "SHADOWMAP_TYPE_VSM"), m), d = function(e) { var t = "ENVMAP_TYPE_CUBE"; if (e.envMap) switch (e.envMapMode) { case L: case R: t = "ENVMAP_TYPE_CUBE"; break; case z: case U: t = "ENVMAP_TYPE_CUBE_UV" } return t }(n), h = function(e) { var t = "ENVMAP_MODE_REFLECTION"; if (e.envMap) switch (e.envMapMode) { case R: case U: t = "ENVMAP_MODE_REFRACTION" } return t }(n), p = function(e) { var t = "ENVMAP_BLENDING_NONE"; if (e.envMap) switch (e.combine) { case k: t = "ENVMAP_BLENDING_MULTIPLY"; break; case 1: t = "ENVMAP_BLENDING_MIX"; break; case 2: t = "ENVMAP_BLENDING_ADD" } return t }(n), f = 0 < e.gammaFactor ? e.gammaFactor : 1, m = n.isWebGL2 ? "" : [(v = n).extensionDerivatives || v.envMapCubeUV || v.bumpMap || v.tangentSpaceNormalMap || v.clearcoatNormalMap || v.flatShading || "physical" === v.shaderID ? "#extension GL_OES_standard_derivatives : enable" : "", (v.extensionFragDepth || v.logarithmicDepthBuffer) && v.rendererExtensionFragDepth ? "#extension GL_EXT_frag_depth : enable" : "", v.extensionDrawBuffers && v.rendererExtensionDrawBuffers ? "#extension GL_EXT_draw_buffers : require" : "", (v.extensionShaderTextureLOD || v.envMap) && v.rendererExtensionShaderTextureLod ? "#extension GL_EXT_shader_texture_lod : enable" : ""].filter(Po).join("\n"), v = function(e) { var t, n = []; for (t in e) { var i = e[t]; !1 !== i && n.push("#define " + t + " " + i) } return n.join("\n") }(s), g = o.createProgram(), s = n.glslVersion ? "#version " + n.glslVersion + "\n" : ""; n.isRawShaderMaterial ? (0 < (r = [v].filter(Po).join("\n")).length && (r += "\n"), 0 < (a = [m, v].filter(Po).join("\n")).length && (a += "\n")) : (r = [Uo(n), "#define SHADER_NAME " + n.shaderName, v, n.instancing ? "#define USE_INSTANCING" : "", n.instancingColor ? "#define USE_INSTANCING_COLOR" : "", n.supportsVertexTextures ? "#define VERTEX_TEXTURES" : "", "#define GAMMA_FACTOR " + f, "#define MAX_BONES " + n.maxBones, n.useFog && n.fog ? "#define USE_FOG" : "", n.useFog && n.fogExp2 ? "#define FOG_EXP2" : "", n.map ? "#define USE_MAP" : "", n.envMap ? "#define USE_ENVMAP" : "", n.envMap ? "#define " + h : "", n.lightMap ? "#define USE_LIGHTMAP" : "", n.aoMap ? "#define USE_AOMAP" : "", n.emissiveMap ? "#define USE_EMISSIVEMAP" : "", n.bumpMap ? "#define USE_BUMPMAP" : "", n.normalMap ? "#define USE_NORMALMAP" : "", n.normalMap && n.objectSpaceNormalMap ? "#define OBJECTSPACE_NORMALMAP" : "", n.normalMap && n.tangentSpaceNormalMap ? "#define TANGENTSPACE_NORMALMAP" : "", n.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", n.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", n.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", n.displacementMap && n.supportsVertexTextures ? "#define USE_DISPLACEMENTMAP" : "", n.specularMap ? "#define USE_SPECULARMAP" : "", n.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", n.metalnessMap ? "#define USE_METALNESSMAP" : "", n.alphaMap ? "#define USE_ALPHAMAP" : "", n.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", n.vertexTangents ? "#define USE_TANGENT" : "", n.vertexColors ? "#define USE_COLOR" : "", n.vertexUvs ? "#define USE_UV" : "", n.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "", n.flatShading ? "#define FLAT_SHADED" : "", n.skinning ? "#define USE_SKINNING" : "", n.useVertexTexture ? "#define BONE_TEXTURE" : "", n.morphTargets ? "#define USE_MORPHTARGETS" : "", n.morphNormals && !1 === n.flatShading ? "#define USE_MORPHNORMALS" : "", n.doubleSided ? "#define DOUBLE_SIDED" : "", n.flipSided ? "#define FLIP_SIDED" : "", n.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", n.shadowMapEnabled ? "#define " + c : "", n.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "", n.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", n.logarithmicDepthBuffer && n.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "", "uniform mat4 modelMatrix;", "uniform mat4 modelViewMatrix;", "uniform mat4 projectionMatrix;", "uniform mat4 viewMatrix;", "uniform mat3 normalMatrix;", "uniform vec3 cameraPosition;", "uniform bool isOrthographic;", "#ifdef USE_INSTANCING", "\tattribute mat4 instanceMatrix;", "#endif", "#ifdef USE_INSTANCING_COLOR", "\tattribute vec3 instanceColor;", "#endif", "attribute vec3 position;", "attribute vec3 normal;", "attribute vec2 uv;", "#ifdef USE_TANGENT", "\tattribute vec4 tangent;", "#endif", "#ifdef USE_COLOR", "\tattribute vec3 color;", "#endif", "#ifdef USE_MORPHTARGETS", "\tattribute vec3 morphTarget0;", "\tattribute vec3 morphTarget1;", "\tattribute vec3 morphTarget2;", "\tattribute vec3 morphTarget3;", "\t#ifdef USE_MORPHNORMALS", "\t\tattribute vec3 morphNormal0;", "\t\tattribute vec3 morphNormal1;", "\t\tattribute vec3 morphNormal2;", "\t\tattribute vec3 morphNormal3;", "\t#else", "\t\tattribute vec3 morphTarget4;", "\t\tattribute vec3 morphTarget5;", "\t\tattribute vec3 morphTarget6;", "\t\tattribute vec3 morphTarget7;", "\t#endif", "#endif", "#ifdef USE_SKINNING", "\tattribute vec4 skinIndex;", "\tattribute vec4 skinWeight;", "#endif", "\n"].filter(Po).join("\n"), a = [m, Uo(n), "#define SHADER_NAME " + n.shaderName, v, n.alphaTest ? "#define ALPHATEST " + n.alphaTest + (n.alphaTest % 1 ? "" : ".0") : "", "#define GAMMA_FACTOR " + f, n.useFog && n.fog ? "#define USE_FOG" : "", n.useFog && n.fogExp2 ? "#define FOG_EXP2" : "", n.map ? "#define USE_MAP" : "", n.matcap ? "#define USE_MATCAP" : "", n.envMap ? "#define USE_ENVMAP" : "", n.envMap ? "#define " + d : "", n.envMap ? "#define " + h : "", n.envMap ? "#define " + p : "", n.lightMap ? "#define USE_LIGHTMAP" : "", n.aoMap ? "#define USE_AOMAP" : "", n.emissiveMap ? "#define USE_EMISSIVEMAP" : "", n.bumpMap ? "#define USE_BUMPMAP" : "", n.normalMap ? "#define USE_NORMALMAP" : "", n.normalMap && n.objectSpaceNormalMap ? "#define OBJECTSPACE_NORMALMAP" : "", n.normalMap && n.tangentSpaceNormalMap ? "#define TANGENTSPACE_NORMALMAP" : "", n.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", n.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", n.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", n.specularMap ? "#define USE_SPECULARMAP" : "", n.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", n.metalnessMap ? "#define USE_METALNESSMAP" : "", n.alphaMap ? "#define USE_ALPHAMAP" : "", n.sheen ? "#define USE_SHEEN" : "", n.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", n.vertexTangents ? "#define USE_TANGENT" : "", n.vertexColors || n.instancingColor ? "#define USE_COLOR" : "", n.vertexUvs ? "#define USE_UV" : "", n.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "", n.gradientMap ? "#define USE_GRADIENTMAP" : "", n.flatShading ? "#define FLAT_SHADED" : "", n.doubleSided ? "#define DOUBLE_SIDED" : "", n.flipSided ? "#define FLIP_SIDED" : "", n.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", n.shadowMapEnabled ? "#define " + c : "", n.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "", n.physicallyCorrectLights ? "#define PHYSICALLY_CORRECT_LIGHTS" : "", n.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", n.logarithmicDepthBuffer && n.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "", (n.extensionShaderTextureLOD || n.envMap) && n.rendererExtensionShaderTextureLod ? "#define TEXTURE_LOD_EXT" : "", "uniform mat4 viewMatrix;", "uniform vec3 cameraPosition;", "uniform bool isOrthographic;", n.toneMapping !== De ? "#define TONE_MAPPING" : "", n.toneMapping !== De ? ca.tonemapping_pars_fragment : "", n.toneMapping !== De ? function(e, t) { var n; switch (t) { case 1: n = "Linear"; break; case 2: n = "Reinhard"; break; case 3: n = "OptimizedCineon"; break; case 4: n = "ACESFilmic"; break; case 5: n = "Custom"; break; default: console.warn("THREE.WebGLProgram: Unsupported toneMapping:", t), n = "Linear" } return "vec3 " + e + "( vec3 color ) { return " + n + "ToneMapping( color ); }" }("toneMapping", n.toneMapping) : "", n.dithering ? "#define DITHERING" : "", ca.encodings_pars_fragment, n.map ? Co("mapTexelToLinear", n.mapEncoding) : "", n.matcap ? Co("matcapTexelToLinear", n.matcapEncoding) : "", n.envMap ? Co("envMapTexelToLinear", n.envMapEncoding) : "", n.emissiveMap ? Co("emissiveMapTexelToLinear", n.emissiveMapEncoding) : "", n.lightMap ? Co("lightMapTexelToLinear", n.lightMapEncoding) : "", (y = "linearToOutputTexel", w = To(w = n.outputEncoding), "vec4 " + y + "( vec4 value ) { return LinearTo" + w[0] + w[1] + "; }"), n.depthPacking ? "#define DEPTH_PACKING " + n.depthPacking : "", "\n"].filter(Po).join("\n")), l = ko(Do(Lo(l), n), n), u = ko(Do(Lo(u), n), n), l = Oo(l), u = Oo(u), n.isWebGL2 && !0 !== n.isRawShaderMaterial && (s = "#version 300 es\n", r = ["#define attribute in", "#define varying out", "#define texture2D texture"].join("\n") + "\n" + r, a = ["#define varying in", n.glslVersion === dn ? "" : "out highp vec4 pc_fragColor;", n.glslVersion === dn ? "" : "#define gl_FragColor pc_fragColor", "#define gl_FragDepthEXT gl_FragDepth", "#define texture2D texture", "#define textureCube texture", "#define texture2DProj textureProj", "#define texture2DLodEXT textureLod", "#define texture2DProjLodEXT textureProjLod", "#define textureCubeLodEXT textureLod", "#define texture2DGradEXT textureGrad", "#define texture2DProjGradEXT textureProjGrad", "#define textureCubeGradEXT textureGrad"].join("\n") + "\n" + a); var y, w, b, x, f = s + r + l, d = s + a + u, h = Mo(o, 35633, f), p = Mo(o, 35632, d); return o.attachShader(g, h), o.attachShader(g, p), void 0 !== n.index0AttributeName ? o.bindAttribLocation(g, 0, n.index0AttributeName) : !0 === n.morphTargets && o.bindAttribLocation(g, 0, "position"), o.linkProgram(g), e.debug.checkShaderErrors && (c = o.getProgramInfoLog(g).trim(), y = o.getShaderInfoLog(h).trim(), w = o.getShaderInfoLog(p).trim(), !(s = l = !0) === o.getProgramParameter(g, 35714) ? (l = !1, u = So(o, h, "vertex"), e = So(o, p, "fragment"), console.error("THREE.WebGLProgram: shader error: ", o.getError(), "35715", o.getProgramParameter(g, 35715), "gl.getProgramInfoLog", c, u, e), e ? console.log(d.split("\n").map(function(e, t) { return "".concat(t + 1).padEnd(5) + e }).join("\n")) : console.log(f.split("\n").map(function(e, t) { return "".concat(t + 1).padEnd(5) + e }).join("\n"))) : "" !== c ? console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()", c) : "" !== y && "" !== w || (s = !1), s && (this.diagnostics = { runnable: l, programLog: c, vertexShader: { log: y, prefix: r }, fragmentShader: { log: w, prefix: a } })), o.deleteShader(h), o.deleteShader(p), this.getUniforms = function() { return b = void 0 === b ? new _o(o,g) : b } , this.getAttributes = function() { return x = void 0 === x ? function(e, t) { for (var n = {}, i = e.getProgramParameter(t, 35721), r = 0; r < i; r++) { var a = e.getActiveAttrib(t, r).name; n[a] = e.getAttribLocation(t, a) } return n }(o, g) : x } , this.destroy = function() { i.releaseStatesOfProgram(this), o.deleteProgram(g), this.program = void 0 } , this.name = n.shaderName, this.id = Ao++, this.cacheKey = t, this.usedTimes = 1, this.program = g, this.vertexShader = h, this.fragmentShader = p, this } function Ho(d, h, p, f, o, m) { var s = [] , v = f.isWebGL2 , g = f.logarithmicDepthBuffer , y = f.floatVertexTextures , w = f.maxVertexUniforms , b = f.vertexTextures , x = f.precision , E = { MeshDepthMaterial: "depth", MeshDistanceMaterial: "distanceRGBA", MeshNormalMaterial: "normal", MeshBasicMaterial: "basic", MeshLambertMaterial: "lambert", MeshPhongMaterial: "phong", MeshToonMaterial: "toon", MeshStandardMaterial: "physical", MeshPhysicalMaterial: "physical", MeshMatcapMaterial: "matcap", LineBasicMaterial: "basic", LineDashedMaterial: "dashed", PointsMaterial: "points", ShadowMaterial: "shadow", SpriteMaterial: "sprite" } , r = ["precision", "isWebGL2", "supportsVertexTextures", "outputEncoding", "instancing", "instancingColor", "map", "mapEncoding", "matcap", "matcapEncoding", "envMap", "envMapMode", "envMapEncoding", "envMapCubeUV", "lightMap", "lightMapEncoding", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "objectSpaceNormalMap", "tangentSpaceNormalMap", "clearcoatMap", "clearcoatRoughnessMap", "clearcoatNormalMap", "displacementMap", "specularMap", "roughnessMap", "metalnessMap", "gradientMap", "alphaMap", "combine", "vertexColors", "vertexTangents", "vertexUvs", "uvsVertexOnly", "fog", "useFog", "fogExp2", "flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning", "maxBones", "useVertexTexture", "morphTargets", "morphNormals", "maxMorphTargets", "maxMorphNormals", "premultipliedAlpha", "numDirLights", "numPointLights", "numSpotLights", "numHemiLights", "numRectAreaLights", "numDirLightShadows", "numPointLightShadows", "numSpotLightShadows", "shadowMapEnabled", "shadowMapType", "toneMapping", "physicallyCorrectLights", "alphaTest", "doubleSided", "flipSided", "numClippingPlanes", "numClipIntersection", "depthPacking", "dithering", "sheen", "transmissionMap"]; function _(e) { e = e && e.isTexture ? e.encoding : e && e.isWebGLRenderTarget ? (console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."), e.texture.encoding) : rn; return e } return { getParameters: function(e, t, n, i, r) { var a, o, s = i.fog, l = e.isMeshStandardMaterial ? i.environment : null, i = h.get(e.envMap || l), l = E[e.type], u = r.isSkinnedMesh ? (u = (o = r).skeleton.bones, y ? 1024 : (o = Math.floor((w - 20) / 4), (o = Math.min(o, u.length)) < u.length ? (console.warn("THREE.WebGLRenderer: Skeleton has " + u.length + " bones. This GPU supports " + o + "."), 0) : o)) : 0; null !== e.precision && (x = f.getMaxPrecision(e.precision)) !== e.precision && console.warn("THREE.WebGLProgram.getParameters:", e.precision, "not supported, using", x, "instead."), o = l ? (a = (c = ha[l]).vertexShader, c.fragmentShader) : (a = e.vertexShader, e.fragmentShader); var c = d.getRenderTarget(); return { isWebGL2: v, shaderID: l, shaderName: e.type, vertexShader: a, fragmentShader: o, defines: e.defines, isRawShaderMaterial: !0 === e.isRawShaderMaterial, glslVersion: e.glslVersion, precision: x, instancing: !0 === r.isInstancedMesh, instancingColor: !0 === r.isInstancedMesh && null !== r.instanceColor, supportsVertexTextures: b, outputEncoding: null !== c ? _(c.texture) : d.outputEncoding, map: !!e.map, mapEncoding: _(e.map), matcap: !!e.matcap, matcapEncoding: _(e.matcap), envMap: !!i, envMapMode: i && i.mapping, envMapEncoding: _(i), envMapCubeUV: !!i && (i.mapping === z || i.mapping === U), lightMap: !!e.lightMap, lightMapEncoding: _(e.lightMap), aoMap: !!e.aoMap, emissiveMap: !!e.emissiveMap, emissiveMapEncoding: _(e.emissiveMap), bumpMap: !!e.bumpMap, normalMap: !!e.normalMap, objectSpaceNormalMap: e.normalMapType === ln, tangentSpaceNormalMap: e.normalMapType === sn, clearcoatMap: !!e.clearcoatMap, clearcoatRoughnessMap: !!e.clearcoatRoughnessMap, clearcoatNormalMap: !!e.clearcoatNormalMap, displacementMap: !!e.displacementMap, roughnessMap: !!e.roughnessMap, metalnessMap: !!e.metalnessMap, specularMap: !!e.specularMap, alphaMap: !!e.alphaMap, gradientMap: !!e.gradientMap, sheen: !!e.sheen, transmissionMap: !!e.transmissionMap, combine: e.combine, vertexTangents: e.normalMap && e.vertexTangents, vertexColors: e.vertexColors, vertexUvs: !!(e.map || e.bumpMap || e.normalMap || e.specularMap || e.alphaMap || e.emissiveMap || e.roughnessMap || e.metalnessMap || e.clearcoatMap || e.clearcoatRoughnessMap || e.clearcoatNormalMap || e.displacementMap || e.transmissionMap), uvsVertexOnly: !(e.map || e.bumpMap || e.normalMap || e.specularMap || e.alphaMap || e.emissiveMap || e.roughnessMap || e.metalnessMap || e.clearcoatNormalMap || e.transmissionMap || !e.displacementMap), fog: !!s, useFog: e.fog, fogExp2: s && s.isFogExp2, flatShading: e.flatShading, sizeAttenuation: e.sizeAttenuation, logarithmicDepthBuffer: g, skinning: e.skinning && 0 < u, maxBones: u, useVertexTexture: y, morphTargets: e.morphTargets, morphNormals: e.morphNormals, maxMorphTargets: d.maxMorphTargets, maxMorphNormals: d.maxMorphNormals, numDirLights: t.directional.length, numPointLights: t.point.length, numSpotLights: t.spot.length, numRectAreaLights: t.rectArea.length, numHemiLights: t.hemi.length, numDirLightShadows: t.directionalShadowMap.length, numPointLightShadows: t.pointShadowMap.length, numSpotLightShadows: t.spotShadowMap.length, numClippingPlanes: m.numPlanes, numClipIntersection: m.numIntersection, dithering: e.dithering, shadowMapEnabled: d.shadowMap.enabled && 0 < n.length, shadowMapType: d.shadowMap.type, toneMapping: e.toneMapped ? d.toneMapping : De, physicallyCorrectLights: d.physicallyCorrectLights, premultipliedAlpha: e.premultipliedAlpha, alphaTest: e.alphaTest, doubleSided: e.side === Y, flipSided: e.side === J, depthPacking: void 0 !== e.depthPacking && e.depthPacking, index0AttributeName: e.index0AttributeName, extensionDerivatives: e.extensions && e.extensions.derivatives, extensionFragDepth: e.extensions && e.extensions.fragDepth, extensionDrawBuffers: e.extensions && e.extensions.drawBuffers, extensionShaderTextureLOD: e.extensions && e.extensions.shaderTextureLOD, rendererExtensionFragDepth: v || p.has("EXT_frag_depth"), rendererExtensionDrawBuffers: v || p.has("WEBGL_draw_buffers"), rendererExtensionShaderTextureLod: v || p.has("EXT_shader_texture_lod"), customProgramCacheKey: e.customProgramCacheKey() } }, getProgramCacheKey: function(e) { var t = []; if (e.shaderID ? t.push(e.shaderID) : (t.push(e.fragmentShader), t.push(e.vertexShader)), void 0 !== e.defines) for (var n in e.defines) t.push(n), t.push(e.defines[n]); if (!1 === e.isRawShaderMaterial) { for (var i = 0; i < r.length; i++) t.push(e[r[i]]); t.push(d.outputEncoding), t.push(d.gammaFactor) } return t.push(e.customProgramCacheKey), t.join() }, getUniforms: function(e) { var t = E[e.type]; return t ? (t = ha[t], Jr.clone(t.uniforms)) : e.uniforms }, acquireProgram: function(e, t) { for (var n, i = 0, r = s.length; i < r; i++) { var a = s[i]; if (a.cacheKey === t) { ++(n = a).usedTimes; break } } return void 0 === n && (n = new Go(d,t,e,o), s.push(n)), n }, releaseProgram: function(e) { var t; 0 == --e.usedTimes && (t = s.indexOf(e), s[t] = s[s.length - 1], s.pop(), e.destroy()) }, programs: s } } function Vo() { var i = new WeakMap; return { get: function(e) { var t = i.get(e); return void 0 === t && i.set(e, t = {}), t }, remove: function(e) { i.delete(e) }, update: function(e, t, n) { i.get(e)[t] = n }, dispose: function() { i = new WeakMap } } } function jo(e, t) { return e.groupOrder !== t.groupOrder ? e.groupOrder - t.groupOrder : e.renderOrder !== t.renderOrder ? e.renderOrder - t.renderOrder : e.program !== t.program ? e.program.id - t.program.id : e.material.id !== t.material.id ? e.material.id - t.material.id : e.z !== t.z ? e.z - t.z : e.id - t.id } function Wo(e, t) { return e.groupOrder !== t.groupOrder ? e.groupOrder - t.groupOrder : e.renderOrder !== t.renderOrder ? e.renderOrder - t.renderOrder : e.z !== t.z ? t.z - e.z : e.id - t.id } function Xo(l) { var u = [] , c = 0 , o = [] , s = [] , d = { id: -1 }; function h(e, t, n, i, r, a) { var o = u[c] , s = l.get(n); return void 0 === o ? (o = { id: e.id, object: e, geometry: t, material: n, program: s.program || d, groupOrder: i, renderOrder: e.renderOrder, z: r, group: a }, u[c] = o) : (o.id = e.id, o.object = e, o.geometry = t, o.material = n, o.program = s.program || d, o.groupOrder = i, o.renderOrder = e.renderOrder, o.z = r, o.group = a), c++, o } return { opaque: o, transparent: s, init: function() { c = 0, o.length = 0, s.length = 0 }, push: function(e, t, n, i, r, a) { a = h(e, t, n, i, r, a), (!0 === n.transparent ? s : o).push(a) }, unshift: function(e, t, n, i, r, a) { a = h(e, t, n, i, r, a), (!0 === n.transparent ? s : o).unshift(a) }, finish: function() { for (var e = c, t = u.length; e < t; e++) { var n = u[e]; if (null === n.id) break; n.id = null, n.object = null, n.geometry = null, n.material = null, n.program = null, n.group = null } }, sort: function(e, t) { 1 < o.length && o.sort(e || jo), 1 < s.length && s.sort(t || Wo) } } } function qo(r) { var a = new WeakMap; return { get: function(e, t) { var n, i = a.get(e); return void 0 === i ? (n = new Xo(r), a.set(e, new WeakMap), a.get(e).set(t, n)) : void 0 === (n = i.get(t)) && (n = new Xo(r), i.set(t, n)), n }, dispose: function() { a = new WeakMap } } } function Jo() { var n = {}; return { get: function(e) { if (void 0 !== n[e.id]) return n[e.id]; var t; switch (e.type) { case "DirectionalLight": t = { direction: new Cn, color: new Yi }; break; case "SpotLight": t = { position: new Cn, direction: new Cn, color: new Yi, distance: 0, coneCos: 0, penumbraCos: 0, decay: 0 }; break; case "PointLight": t = { position: new Cn, color: new Yi, distance: 0, decay: 0 }; break; case "HemisphereLight": t = { direction: new Cn, skyColor: new Yi, groundColor: new Yi }; break; case "RectAreaLight": t = { color: new Yi, position: new Cn, halfWidth: new Cn, halfHeight: new Cn } } return n[e.id] = t } } } var Yo = 0; function Zo(e, t) { return (t.castShadow ? 1 : 0) - (e.castShadow ? 1 : 0) } function Qo(S, C) { for (var n, P = new Jo, D = (n = {}, { get: function(e) { if (void 0 !== n[e.id]) return n[e.id]; var t; switch (e.type) { case "DirectionalLight": case "SpotLight": t = { shadowBias: 0, shadowNormalBias: 0, shadowRadius: 1, shadowMapSize: new yn }; break; case "PointLight": t = { shadowBias: 0, shadowNormalBias: 0, shadowRadius: 1, shadowMapSize: new yn, shadowCameraNear: 1, shadowCameraFar: 1e3 } } return n[e.id] = t } }), k = { version: 0, hash: { directionalLength: -1, pointLength: -1, spotLength: -1, rectAreaLength: -1, hemiLength: -1, numDirectionalShadows: -1, numPointShadows: -1, numSpotShadows: -1 }, ambient: [0, 0, 0], probe: [], directional: [], directionalShadow: [], directionalShadowMap: [], directionalShadowMatrix: [], spot: [], spotShadow: [], spotShadowMap: [], spotShadowMatrix: [], rectArea: [], rectAreaLTC1: null, rectAreaLTC2: null, point: [], pointShadow: [], pointShadowMap: [], pointShadowMatrix: [], hemi: [] }, e = 0; e < 9; e++) k.probe.push(new Cn); var f = new Cn , m = new ni , v = new ni; return { setup: function(e) { for (var t = 0, n = 0, i = 0, r = 0; r < 9; r++) k.probe[r].set(0, 0, 0); var a = 0 , o = 0 , s = 0 , l = 0 , u = 0 , c = 0 , d = 0 , h = 0; e.sort(Zo); for (var p = 0, f = e.length; p < f; p++) { var m, v, g, y, w, b = e[p], x = b.color, E = b.intensity, _ = b.distance, M = b.shadow && b.shadow.map ? b.shadow.map.texture : null; if (b.isAmbientLight) t += x.r * E, n += x.g * E, i += x.b * E; else if (b.isLightProbe) for (var A = 0; A < 9; A++) k.probe[A].addScaledVector(b.sh.coefficients[A], E); else b.isDirectionalLight ? ((g = P.get(b)).color.copy(b.color).multiplyScalar(b.intensity), b.castShadow && (m = b.shadow, (v = D.get(b)).shadowBias = m.bias, v.shadowNormalBias = m.normalBias, v.shadowRadius = m.radius, v.shadowMapSize = m.mapSize, k.directionalShadow[a] = v, k.directionalShadowMap[a] = M, k.directionalShadowMatrix[a] = b.shadow.matrix, c++), k.directional[a] = g, a++) : b.isSpotLight ? ((v = P.get(b)).position.setFromMatrixPosition(b.matrixWorld), v.color.copy(x).multiplyScalar(E), v.distance = _, v.coneCos = Math.cos(b.angle), v.penumbraCos = Math.cos(b.angle * (1 - b.penumbra)), v.decay = b.decay, b.castShadow && (g = b.shadow, (_ = D.get(b)).shadowBias = g.bias, _.shadowNormalBias = g.normalBias, _.shadowRadius = g.radius, _.shadowMapSize = g.mapSize, k.spotShadow[s] = _, k.spotShadowMap[s] = M, k.spotShadowMatrix[s] = b.shadow.matrix, h++), k.spot[s] = v, s++) : b.isRectAreaLight ? ((y = P.get(b)).color.copy(x).multiplyScalar(E), y.halfWidth.set(.5 * b.width, 0, 0), y.halfHeight.set(0, .5 * b.height, 0), k.rectArea[l] = y, l++) : b.isPointLight ? ((w = P.get(b)).color.copy(b.color).multiplyScalar(b.intensity), w.distance = b.distance, w.decay = b.decay, b.castShadow && (x = b.shadow, (y = D.get(b)).shadowBias = x.bias, y.shadowNormalBias = x.normalBias, y.shadowRadius = x.radius, y.shadowMapSize = x.mapSize, y.shadowCameraNear = x.camera.near, y.shadowCameraFar = x.camera.far, k.pointShadow[o] = y, k.pointShadowMap[o] = M, k.pointShadowMatrix[o] = b.shadow.matrix, d++), k.point[o] = w, o++) : b.isHemisphereLight && ((w = P.get(b)).skyColor.copy(b.color).multiplyScalar(E), w.groundColor.copy(b.groundColor).multiplyScalar(E), k.hemi[u] = w, u++) } 0 < l && (C.isWebGL2 || !0 === S.has("OES_texture_float_linear") ? (k.rectAreaLTC1 = da.LTC_FLOAT_1, k.rectAreaLTC2 = da.LTC_FLOAT_2) : !0 === S.has("OES_texture_half_float_linear") ? (k.rectAreaLTC1 = da.LTC_HALF_1, k.rectAreaLTC2 = da.LTC_HALF_2) : console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")), k.ambient[0] = t, k.ambient[1] = n, k.ambient[2] = i; var T = k.hash; T.directionalLength === a && T.pointLength === o && T.spotLength === s && T.rectAreaLength === l && T.hemiLength === u && T.numDirectionalShadows === c && T.numPointShadows === d && T.numSpotShadows === h || (k.directional.length = a, k.spot.length = s, k.rectArea.length = l, k.point.length = o, k.hemi.length = u, k.directionalShadow.length = c, k.directionalShadowMap.length = c, k.pointShadow.length = d, k.pointShadowMap.length = d, k.spotShadow.length = h, k.spotShadowMap.length = h, k.directionalShadowMatrix.length = c, k.pointShadowMatrix.length = d, k.spotShadowMatrix.length = h, T.directionalLength = a, T.pointLength = o, T.spotLength = s, T.rectAreaLength = l, T.hemiLength = u, T.numDirectionalShadows = c, T.numPointShadows = d, T.numSpotShadows = h, k.version = Yo++) }, setupView: function(e, t) { for (var n = 0, i = 0, r = 0, a = 0, o = 0, s = t.matrixWorldInverse, l = 0, u = e.length; l < u; l++) { var c, d, h, p = e[l]; p.isDirectionalLight ? ((c = k.directional[n]).direction.setFromMatrixPosition(p.matrixWorld), f.setFromMatrixPosition(p.target.matrixWorld), c.direction.sub(f), c.direction.transformDirection(s), n++) : p.isSpotLight ? ((d = k.spot[r]).position.setFromMatrixPosition(p.matrixWorld), d.position.applyMatrix4(s), d.direction.setFromMatrixPosition(p.matrixWorld), f.setFromMatrixPosition(p.target.matrixWorld), d.direction.sub(f), d.direction.transformDirection(s), r++) : p.isRectAreaLight ? ((d = k.rectArea[a]).position.setFromMatrixPosition(p.matrixWorld), d.position.applyMatrix4(s), v.identity(), m.copy(p.matrixWorld), m.premultiply(s), v.extractRotation(m), d.halfWidth.set(.5 * p.width, 0, 0), d.halfHeight.set(0, .5 * p.height, 0), d.halfWidth.applyMatrix4(v), d.halfHeight.applyMatrix4(v), a++) : p.isPointLight ? ((h = k.point[i]).position.setFromMatrixPosition(p.matrixWorld), h.position.applyMatrix4(s), i++) : p.isHemisphereLight && ((h = k.hemi[o]).direction.setFromMatrixPosition(p.matrixWorld), h.direction.transformDirection(s), h.direction.normalize(), o++) } }, state: k } } function Ko(e, t) { var n = new Qo(e,t) , i = [] , r = []; return { init: function() { i.length = 0, r.length = 0 }, state: { lightsArray: i, shadowsArray: r, lights: n }, setupLights: function() { n.setup(i) }, setupLightsView: function(e) { n.setupView(i, e) }, pushLight: function(e) { i.push(e) }, pushShadow: function(e) { r.push(e) } } } function $o(i, r) { var a = new WeakMap; return { get: function(e) { var t, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; return !1 === a.has(e) ? (t = new Ko(i,r), a.set(e, []), a.get(e).push(t)) : n >= a.get(e).length ? (t = new Ko(i,r), a.get(e).push(t)) : t = a.get(e)[n], t }, dispose: function() { a = new WeakMap } } } function es(e) { Ki.call(this), this.type = "MeshDepthMaterial", this.depthPacking = 3200, this.skinning = !1, this.morphTargets = !1, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframelineWidth = 1, this.fog = !1, this.setValues(e) } function ts(e) { Ki.call(this), this.type = "MeshDistanceMaterial", this.referencePosition = new Cn, this.nearDistance = 1, this.farDistance = 1e3, this.skinning = !1, this.morphTargets = !1, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.fog = !1, this.setValues(e) } ((es.prototype = Object.create(Ki.prototype)).constructor = es).prototype.isMeshDepthMaterial = !0, es.prototype.copy = function(e) { return Ki.prototype.copy.call(this, e), this.depthPacking = e.depthPacking, this.skinning = e.skinning, this.morphTargets = e.morphTargets, this.map = e.map, this.alphaMap = e.alphaMap, this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.wireframe = e.wireframe, this.wireframelineWidth = e.wireframelineWidth, this } , ((ts.prototype = Object.create(Ki.prototype)).constructor = ts).prototype.isMeshDistanceMaterial = !0, ts.prototype.copy = function(e) { return Ki.prototype.copy.call(this, e), this.referencePosition.copy(e.referencePosition), this.nearDistance = e.nearDistance, this.farDistance = e.farDistance, this.skinning = e.skinning, this.morphTargets = e.morphTargets, this.map = e.map, this.alphaMap = e.alphaMap, this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this } ; var ns = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}" , is = "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}"; function rs(g, y, w) { var b = new oa , x = new yn , E = new yn , _ = new Mn , r = [] , a = [] , h = {} , p = { 0: J, 1: q, 2: Y } , M = new Qr({ defines: { SAMPLE_RATE: .25, HALF_SAMPLE_RATE: 1 / 8 }, uniforms: { shadow_pass: { value: null }, resolution: { value: new yn }, radius: { value: 4 } }, vertexShader: is, fragmentShader: ns }) , A = M.clone(); A.defines.HORIZONTAL_PASS = 1; var e = new Mr; e.setAttribute("position", new nr(new Float32Array([-1, -1, .5, 3, -1, .5, -1, 3, .5]),3)); var T = new Hr(e,M) , S = this; function f(e, t, n) { var i = e << 0 | t << 1 | n << 2 , n = r[i]; return void 0 === n && (n = new es({ depthPacking: on, morphTargets: e, skinning: t }), r[i] = n), n } function m(e, t, n) { var i = e << 0 | t << 1 | n << 2 , n = a[i]; return void 0 === n && (n = new ts({ morphTargets: e, skinning: t }), a[i] = n), n } function C(e, t, n, i, r, a, o) { var s, l, u = null, c = f, d = e.customDepthMaterial; return !0 === i.isPointLight && (c = m, d = e.customDistanceMaterial), u = void 0 === d ? (!(s = !1) === n.morphTargets && (s = t.morphAttributes && t.morphAttributes.position && 0 < t.morphAttributes.position.length), !(l = !1) === e.isSkinnedMesh && (!0 === n.skinning ? l = !0 : console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:", e)), c(s, l, !0 === e.isInstancedMesh)) : d, g.localClippingEnabled && !0 === n.clipShadows && 0 !== n.clippingPlanes.length && (l = u.uuid, e = n.uuid, void 0 === (d = h[l]) && (h[l] = d = {}), void 0 === (l = d[e]) && (l = u.clone(), d[e] = l), u = l), u.visible = n.visible, u.wireframe = n.wireframe, u.side = o === D ? null !== n.shadowSide ? n.shadowSide : n.side : null !== n.shadowSide ? n.shadowSide : p[n.side], u.clipShadows = n.clipShadows, u.clippingPlanes = n.clippingPlanes, u.clipIntersection = n.clipIntersection, u.wireframelineWidth = n.wireframelineWidth, u.lineWidth = n.lineWidth, !0 === i.isPointLight && !0 === u.isMeshDistanceMaterial && (u.referencePosition.setFromMatrixPosition(i.matrixWorld), u.nearDistance = r, u.farDistance = a), u } this.enabled = !1, this.autoUpdate = !0, this.needsUpdate = !1, this.type = P, this.render = function(e, t, n) { if (!1 !== S.enabled && (!1 !== S.autoUpdate || !1 !== S.needsUpdate) && 0 !== e.length) { var i = g.getRenderTarget() , r = g.getActiveCubeFace() , a = g.getActiveMipmapLevel() , o = g.state; o.setBlending(Z), o.buffers.color.setClear(1, 1, 1, 1), o.buffers.depth.setTest(!0), o.setScissorTest(!1); for (var s, l = 0, u = e.length; l < u; l++) { var c = e[l] , d = c.shadow; if (void 0 !== d) { if (!1 !== d.autoUpdate || !1 !== d.needsUpdate) { x.copy(d.mapSize); var h, p = d.getFrameExtents(); x.multiply(p), E.copy(d.mapSize), (x.x > w || x.y > w) && (x.x > w && (E.x = Math.floor(w / p.x), x.x = E.x * p.x, d.mapSize.x = E.x), x.y > w && (E.y = Math.floor(w / p.y), x.y = E.y * p.y, d.mapSize.y = E.y)), null !== d.map || d.isPointLightShadow || this.type !== D || (d.map = new An(x.x,x.y,h = { minFilter: Oe, magFilter: Oe, format: et }), d.map.texture.name = c.name + ".shadowMap", d.mapPass = new An(x.x,x.y,h), d.camera.updateProjectionMatrix()), null === d.map && (d.map = new An(x.x,x.y,{ minFilter: Re, magFilter: Re, format: et }), d.map.texture.name = c.name + ".shadowMap", d.camera.updateProjectionMatrix()), g.setRenderTarget(d.map), g.clear(); for (var f = d.getViewportCount(), m = 0; m < f; m++) { var v = d.getViewport(m); _.set(E.x * v.x, E.y * v.y, E.x * v.z, E.y * v.w), o.viewport(_), d.updateMatrices(c, m), b = d.getFrustum(), function e(t, n, i, r, a) { if (!1 === t.visible) return; var o = t.layers.test(n.layers); if (o && (t.isMesh || t.isLine || t.isPoints) && (t.castShadow || t.receiveShadow && a === D) && (!t.frustumCulled || b.intersectsObject(t))) { t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse, t.matrixWorld); var s = y.update(t) , l = t.material; if (Array.isArray(l)) for (var u = s.groups, c = 0, d = u.length; c < d; c++) { var h = u[c] , p = l[h.materialIndex]; p && p.visible && (p = C(t, s, p, r, i.near, i.far, a), g.renderBufferDirect(i, null, s, p, t, h)) } else l.visible && (o = C(t, s, l, r, i.near, i.far, a), g.renderBufferDirect(i, null, s, o, t, null)) } var f = t.children; for (var m = 0, v = f.length; m < v; m++) e(f[m], n, i, r, a) }(t, n, d.camera, c, this.type) } d.isPointLightShadow || this.type !== D || (s = d, p = n, h = void 0, h = y.update(T), M.uniforms.shadow_pass.value = s.map.texture, M.uniforms.resolution.value = s.mapSize, M.uniforms.radius.value = s.radius, g.setRenderTarget(s.mapPass), g.clear(), g.renderBufferDirect(p, null, h, M, T, null), A.uniforms.shadow_pass.value = s.mapPass.texture, A.uniforms.resolution.value = s.mapSize, A.uniforms.radius.value = s.radius, g.setRenderTarget(s.map), g.clear(), g.renderBufferDirect(p, null, h, A, T, null)), d.needsUpdate = !1 } } else console.warn("THREE.WebGLShadowMap:", c, "has no shadow.") } S.needsUpdate = !1, g.setRenderTarget(i, r, a) } } } function as(c, e, t) { var n = t.isWebGL2; var i = new function() { var t = !1 , a = new Mn , n = null , o = new Mn(0,0,0,0); return { setMask: function(e) { n === e || t || (c.colorMask(e, e, e, e), n = e) }, setLocked: function(e) { t = e }, setClear: function(e, t, n, i, r) { !0 === r && (e *= i, t *= i, n *= i), a.set(e, t, n, i), !1 === o.equals(a) && (c.clearColor(e, t, n, i), o.copy(a)) }, reset: function() { t = !1, n = null, o.set(-1, 0, 0, 0) } } } , r = new function() { var t = !1 , n = null , i = null , r = null; return { setTest: function(e) { (e ? B : L)(2929) }, setMask: function(e) { n === e || t || (c.depthMask(e), n = e) }, setFunc: function(e) { if (i !== e) { if (e) switch (e) { case Ee: c.depthFunc(512); break; case _e: c.depthFunc(519); break; case Me: c.depthFunc(513); break; case Ae: c.depthFunc(515); break; case Te: c.depthFunc(514); break; case Se: c.depthFunc(518); break; case Ce: c.depthFunc(516); break; case Pe: c.depthFunc(517); break; default: c.depthFunc(515) } else c.depthFunc(515); i = e } }, setLocked: function(e) { t = e }, setClear: function(e) { r !== e && (c.clearDepth(e), r = e) }, reset: function() { t = !1, r = i = n = null } } } , a = new function() { var t = !1 , n = null , i = null , r = null , a = null , o = null , s = null , l = null , u = null; return { setTest: function(e) { t || (e ? B : L)(2960) }, setMask: function(e) { n === e || t || (c.stencilMask(e), n = e) }, setFunc: function(e, t, n) { i === e && r === t && a === n || (c.stencilFunc(e, t, n), i = e, r = t, a = n) }, setOp: function(e, t, n) { o === e && s === t && l === n || (c.stencilOp(e, t, n), o = e, s = t, l = n) }, setLocked: function(e) { t = e }, setClear: function(e) { u !== e && (c.clearStencil(e), u = e) }, reset: function() { t = !1, u = l = s = o = a = r = i = n = null } } } , o = {} , s = null , l = null , u = null , d = null , h = null , p = null , f = null , m = null , v = null , g = !1 , y = null , w = null , b = null , x = null , E = null , _ = c.getParameter(35661) , M = !1 , A = 0 , t = c.getParameter(7938); -1 !== t.indexOf("WebGL") ? (A = parseFloat(/^WebGL (\d)/.exec(t)[1]), M = 1 <= A) : -1 !== t.indexOf("OpenGL ES") && (A = parseFloat(/^OpenGL ES (\d)/.exec(t)[1]), M = 2 <= A); var T = null , S = {} , C = new Mn , P = new Mn; function D(e, t, n) { var i = new Uint8Array(4) , r = c.createTexture(); c.bindTexture(e, r), c.texParameteri(e, 10241, 9728), c.texParameteri(e, 10240, 9728); for (var a = 0; a < n; a++) c.texImage2D(t + a, 0, 6408, 1, 1, 0, 6408, 5121, i); return r } var k = {}; function B(e) { !0 !== o[e] && (c.enable(e), o[e] = !0) } function L(e) { !1 !== o[e] && (c.disable(e), o[e] = !1) } k[3553] = D(3553, 3553, 1), k[34067] = D(34067, 34069, 6), i.setClear(0, 0, 0, 1), r.setClear(1), a.setClear(0), B(2929), r.setFunc(Ae), z(!1), N(j), B(2884), O(Z); var R, F = (H(A = {}, re, 32774), H(A, ae, 32778), H(A, oe, 32779), A); n ? (F[se] = 32775, F[ce] = 32776) : null !== (R = e.get("EXT_blend_minmax")) && (F[se] = R.MIN_EXT, F[ce] = R.MAX_EXT); var I = (H(R = {}, de, 0), H(R, he, 1), H(R, pe, 768), H(R, me, 770), H(R, xe, 776), H(R, we, 774), H(R, ge, 772), H(R, fe, 769), H(R, ve, 771), H(R, be, 775), H(R, ye, 773), R); function O(e, t, n, i, r, a, o, s) { if (e !== Z) { if (l || (B(3042), l = !0), e === ie) r = r || t, a = a || n, o = o || i, t === d && r === f || (c.blendEquationSeparate(F[t], F[r]), d = t, f = r), n === h && i === p && a === m && o === v || (c.blendFuncSeparate(I[n], I[i], I[a], I[o]), h = n, p = i, m = a, v = o), u = e, g = null; else if (e !== u || s !== g) { if (d === re && f === re || (c.blendEquation(32774), f = d = re), s) switch (e) { case K: c.blendFuncSeparate(1, 771, 1, 771); break; case ee: c.blendFunc(1, 1); break; case te: c.blendFuncSeparate(0, 0, 769, 771); break; case ne: c.blendFuncSeparate(0, 768, 0, 770); break; default: console.error("THREE.WebGLState: Invalid blending: ", e) } else switch (e) { case K: c.blendFuncSeparate(770, 771, 1, 771); break; case ee: c.blendFunc(770, 1); break; case te: c.blendFunc(0, 769); break; case ne: c.blendFunc(0, 768); break; default: console.error("THREE.WebGLState: Invalid blending: ", e) } v = m = p = h = null, u = e, g = s } } else l && (L(3042), l = !1) } function z(e) { y !== e && (e ? c.frontFace(2304) : c.frontFace(2305), y = e) } function N(e) { e !== V ? (B(2884), e !== w && (e === j ? c.cullFace(1029) : e === W ? c.cullFace(1028) : c.cullFace(1032))) : L(2884), w = e } function U(e, t, n) { e ? (B(32823), x === t && E === n || (c.polygonOffset(t, n), x = t, E = n)) : L(32823) } function G(e) { T !== (e = void 0 === e ? 33984 + _ - 1 : e) && (c.activeTexture(e), T = e) } return { buffers: { color: i, depth: r, stencil: a }, enable: B, disable: L, useProgram: function(e) { return s !== e && (c.useProgram(e), s = e, !0) }, setBlending: O, setMaterial: function(e, t) { (e.side === Y ? L : B)(2884); var n = e.side === J; z(n = t ? !n : n), e.blending === K && !1 === e.transparent ? O(Z) : O(e.blending, e.blendEquation, e.blendSrc, e.blendDst, e.blendEquationAlpha, e.blendSrcAlpha, e.blendDstAlpha, e.premultipliedAlpha), r.setFunc(e.depthFunc), r.setTest(e.depthTest), r.setMask(e.depthWrite), i.setMask(e.colorWrite), n = e.stencilWrite, a.setTest(n), n && (a.setMask(e.stencilWriteMask), a.setFunc(e.stencilFunc, e.stencilRef, e.stencilFuncMask), a.setOp(e.stencilFail, e.stencilZFail, e.stencilZPass)), U(e.polygonOffset, e.polygonOffsetFactor, e.polygonOffsetUnits) }, setFlipSided: z, setCullFace: N, setlineWidth: function(e) { e !== b && (M && c.lineWidth(e), b = e) }, setPolygonOffset: U, setScissorTest: function(e) { (e ? B : L)(3089) }, activeTexture: G, bindTexture: function(e, t) { null === T && G(); var n = S[T]; void 0 === n && (S[T] = n = { type: void 0, texture: void 0 }), n.type === e && n.texture === t || (c.bindTexture(e, t || k[e]), n.type = e, n.texture = t) }, unbindTexture: function() { var e = S[T]; void 0 !== e && void 0 !== e.type && (c.bindTexture(e.type, null), e.type = void 0, e.texture = void 0) }, compressedTexImage2D: function() { try { c.compressedTexImage2D.apply(c, arguments) } catch (e) { console.error("THREE.WebGLState:", e) } }, texImage2D: function() { try { c.texImage2D.apply(c, arguments) } catch (e) { console.error("THREE.WebGLState:", e) } }, texImage3D: function() { try { c.texImage3D.apply(c, arguments) } catch (e) { console.error("THREE.WebGLState:", e) } }, scissor: function(e) { !1 === C.equals(e) && (c.scissor(e.x, e.y, e.z, e.w), C.copy(e)) }, viewport: function(e) { !1 === P.equals(e) && (c.viewport(e.x, e.y, e.z, e.w), P.copy(e)) }, reset: function() { o = {}, g = !(S = {}), E = x = b = w = y = v = m = f = p = h = d = u = l = s = T = null, i.reset(), r.reset(), a.reset() } } } function os(b, i, x, u, r, E, c) { var e, a, _ = r.isWebGL2, t = r.maxTextures, M = r.maxCubemapSize, v = r.maxTextureSize, n = r.maxSamples, o = new WeakMap, s = !1; try { s = "undefined" != typeof OffscreenCanvas && null !== new OffscreenCanvas(1,1).getContext("2d") } catch (e) {} function l(e, t) { return s ? new OffscreenCanvas(e,t) : document.createElementNS("http://www.w3.org/1999/xhtml", "canvas") } function A(e, t, n, i) { var r = 1; if ((r = e.width > i || e.height > i ? i / Math.max(e.width, e.height) : r) < 1 || !0 === t) { if ("undefined" != typeof HTMLImageElement && e instanceof HTMLImageElement || "undefined" != typeof HTMLCanvasElement && e instanceof HTMLCanvasElement || "undefined" != typeof ImageBitmap && e instanceof ImageBitmap) { i = t ? gn.floorPowerOfTwo : Math.floor, t = i(r * e.width), r = i(r * e.height); void 0 === a && (a = l(t, r)); n = n ? l(t, r) : a; return n.width = t, n.height = r, n.getContext("2d").drawImage(e, 0, 0, t, r), console.warn("THREE.WebGLRenderer: Texture has been resized from (" + e.width + "x" + e.height + ") to (" + t + "x" + r + ")."), n } return "data"in e && console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + e.width + "x" + e.height + ")."), e } return e } function T(e) { return gn.isPowerOfTwo(e.width) && gn.isPowerOfTwo(e.height) } function S(e, t) { return e.generateMipmaps && t && e.minFilter !== Re && e.minFilter !== Oe } function C(e, t, n, i) { b.generateMipmap(e), u.get(t).__maxMipLevel = Math.log(Math.max(n, i)) * Math.LOG2E } function P(e, t, n) { if (!1 === _) return t; if (null !== e) { if (void 0 !== b[e]) return b[e]; console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '" + e + "'") } e = t; return 6403 === t && (5126 === n && (e = 33326), 5131 === n && (e = 33325), 5121 === n && (e = 33321)), 6407 === t && (5126 === n && (e = 34837), 5131 === n && (e = 34843), 5121 === n && (e = 32849)), 6408 === t && (5126 === n && (e = 34836), 5131 === n && (e = 34842), 5121 === n && (e = 32856)), 33325 !== e && 33326 !== e && 34842 !== e && 34836 !== e || i.get("EXT_color_buffer_float"), e } function d(e) { return e === Re || e === Fe || e === Ie ? 9728 : 9729 } function h(e) { var t, n = e.target; n.removeEventListener("dispose", h), t = n, void 0 !== (e = u.get(t)).__webglInit && (b.deleteTexture(e.__webglTexture), u.remove(t)), n.isVideoTexture && o.delete(n), c.memory.textures-- } function p(e) { e = e.target; e.removeEventListener("dispose", p), function(e) { var t = u.get(e) , n = u.get(e.texture); if (e) { if (void 0 !== n.__webglTexture && b.deleteTexture(n.__webglTexture), e.depthTexture && e.depthTexture.dispose(), e.isWebGLCubeRenderTarget) for (var i = 0; i < 6; i++) b.deleteFramebuffer(t.__webglFramebuffer[i]), t.__webglDepthbuffer && b.deleteRenderbuffer(t.__webglDepthbuffer[i]); else b.deleteFramebuffer(t.__webglFramebuffer), t.__webglDepthbuffer && b.deleteRenderbuffer(t.__webglDepthbuffer), t.__webglMultisampledFramebuffer && b.deleteFramebuffer(t.__webglMultisampledFramebuffer), t.__webglColorRenderbuffer && b.deleteRenderbuffer(t.__webglColorRenderbuffer), t.__webglDepthRenderbuffer && b.deleteRenderbuffer(t.__webglDepthRenderbuffer); u.remove(e.texture), u.remove(e) } }(e), c.memory.textures-- } var f = 0; function m(e, t) { var n, i = u.get(e); if (e.isVideoTexture && (r = e, n = c.render.frame, o.get(r) !== n && (o.set(r, n), r.update())), 0 < e.version && i.__version !== e.version) { var r = e.image; if (void 0 === r) console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined"); else { if (!1 !== r.complete) return void B(i, e, t); console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete") } } x.activeTexture(33984 + t), x.bindTexture(3553, i.__webglTexture) } function g(e, t) { var n = u.get(e); 0 < e.version && n.__version !== e.version ? function(e, t, n) { if (6 === t.image.length) { k(e, t), x.activeTexture(33984 + n), x.bindTexture(34067, e.__webglTexture), b.pixelStorei(37440, t.flipY); for (var i = t && (t.isCompressedTexture || t.image[0].isCompressedTexture), r = t.image[0] && t.image[0].isDataTexture, a = [], o = 0; o < 6; o++) a[o] = i || r ? r ? t.image[o].image : t.image[o] : A(t.image[o], !1, !0, M); var s, l = a[0], n = T(l) || _, u = E.convert(t.format), c = E.convert(t.type), d = P(t.internalFormat, u, c); if (D(34067, t, n), i) { for (var h = 0; h < 6; h++) { s = a[h].mipmaps; for (var p = 0; p < s.length; p++) { var f = s[p]; t.format !== et && t.format !== $e ? null !== u ? x.compressedTexImage2D(34069 + h, p, d, f.width, f.height, 0, f.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : x.texImage2D(34069 + h, p, d, f.width, f.height, 0, u, c, f.data) } } e.__maxMipLevel = s.length - 1 } else { s = t.mipmaps; for (var m = 0; m < 6; m++) if (r) { x.texImage2D(34069 + m, 0, d, a[m].width, a[m].height, 0, u, c, a[m].data); for (var v = 0; v < s.length; v++) { var g = s[v].image[m].image; x.texImage2D(34069 + m, v + 1, d, g.width, g.height, 0, u, c, g.data) } } else { x.texImage2D(34069 + m, 0, d, u, c, a[m]); for (var y = 0; y < s.length; y++) { var w = s[y]; x.texImage2D(34069 + m, y + 1, d, u, c, w.image[m]) } } e.__maxMipLevel = s.length } S(t, n) && C(34067, t, l.width, l.height), e.__version = t.version, t.onUpdate && t.onUpdate(t) } }(n, e, t) : (x.activeTexture(33984 + t), x.bindTexture(34067, n.__webglTexture)) } var y = (H(e = {}, ke, 10497), H(e, Be, 33071), H(e, Le, 33648), e) , w = (H(e = {}, Re, 9728), H(e, Fe, 9984), H(e, Ie, 9986), H(e, Oe, 9729), H(e, ze, 9985), H(e, Ne, 9987), e); function D(e, t, n) { n ? (b.texParameteri(e, 10242, y[t.wrapS]), b.texParameteri(e, 10243, y[t.wrapT]), 32879 !== e && 35866 !== e || b.texParameteri(e, 32882, y[t.wrapR]), b.texParameteri(e, 10240, w[t.magFilter]), b.texParameteri(e, 10241, w[t.minFilter])) : (b.texParameteri(e, 10242, 33071), b.texParameteri(e, 10243, 33071), 32879 !== e && 35866 !== e || b.texParameteri(e, 32882, 33071), t.wrapS === Be && t.wrapT === Be || console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."), b.texParameteri(e, 10240, d(t.magFilter)), b.texParameteri(e, 10241, d(t.minFilter)), t.minFilter !== Re && t.minFilter !== Oe && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")); n = i.get("EXT_texture_filter_anisotropic"); n && (t.type === Xe && null === i.get("OES_texture_float_linear") || t.type === qe && null === (_ || i.get("OES_texture_half_float_linear")) || (1 < t.anisotropy || u.get(t).__currentAnisotropy) && (b.texParameterf(e, n.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(t.anisotropy, r.getMaxAnisotropy())), u.get(t).__currentAnisotropy = t.anisotropy)) } function k(e, t) { void 0 === e.__webglInit && (e.__webglInit = !0, t.addEventListener("dispose", h), e.__webglTexture = b.createTexture(), c.memory.textures++) } function B(e, t, n) { var i = 3553; t.isDataTexture2DArray && (i = 35866), t.isDataTexture3D && (i = 32879), k(e, t), x.activeTexture(33984 + n), x.bindTexture(i, e.__webglTexture), b.pixelStorei(37440, t.flipY), b.pixelStorei(37441, t.premultiplyAlpha), b.pixelStorei(3317, t.unpackAlignment); var r, n = (a = t, !_ && (a.wrapS !== Be || a.wrapT !== Be || a.minFilter !== Re && a.minFilter !== Oe) && !1 === T(t.image)), a = A(t.image, n, !1, v), n = T(a) || _, o = E.convert(t.format), s = E.convert(t.type), l = P(t.internalFormat, o, s); D(i, t, n); var u = t.mipmaps; if (t.isDepthTexture) l = 6402, _ ? l = t.type === Xe ? 36012 : t.type === We ? 33190 : t.type === Qe ? 35056 : 33189 : t.type === Xe && console.error("WebGLRenderer: Floating point depth texture requires WebGL2."), t.format === rt && 6402 === l && t.type !== Ve && t.type !== We && (console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."), t.type = Ve, s = E.convert(t.type)), t.format === at && 6402 === l && (l = 34041, t.type !== Qe && (console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."), t.type = Qe, s = E.convert(t.type))), x.texImage2D(3553, 0, l, a.width, a.height, 0, o, s, null); else if (t.isDataTexture) if (0 < u.length && n) { for (var c = 0, d = u.length; c < d; c++) r = u[c], x.texImage2D(3553, c, l, r.width, r.height, 0, o, s, r.data); t.generateMipmaps = !1, e.__maxMipLevel = u.length - 1 } else x.texImage2D(3553, 0, l, a.width, a.height, 0, o, s, a.data), e.__maxMipLevel = 0; else if (t.isCompressedTexture) { for (var h = 0, p = u.length; h < p; h++) r = u[h], t.format !== et && t.format !== $e ? null !== o ? x.compressedTexImage2D(3553, h, l, r.width, r.height, 0, r.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : x.texImage2D(3553, h, l, r.width, r.height, 0, o, s, r.data); e.__maxMipLevel = u.length - 1 } else if (t.isDataTexture2DArray) x.texImage3D(35866, 0, l, a.width, a.height, a.depth, 0, o, s, a.data), e.__maxMipLevel = 0; else if (t.isDataTexture3D) x.texImage3D(32879, 0, l, a.width, a.height, a.depth, 0, o, s, a.data), e.__maxMipLevel = 0; else if (0 < u.length && n) { for (var f = 0, m = u.length; f < m; f++) r = u[f], x.texImage2D(3553, f, l, o, s, r); t.generateMipmaps = !1, e.__maxMipLevel = u.length - 1 } else x.texImage2D(3553, 0, l, o, s, a), e.__maxMipLevel = 0; S(t, n) && C(i, t, a.width, a.height), e.__version = t.version, t.onUpdate && t.onUpdate(t) } function L(e, t, n, i) { var r = E.convert(t.texture.format) , a = E.convert(t.texture.type) , o = P(t.texture.internalFormat, r, a); x.texImage2D(i, 0, o, t.width, t.height, 0, r, a, null), b.bindFramebuffer(36160, e), b.framebufferTexture2D(36160, n, i, u.get(t.texture).__webglTexture, 0), b.bindFramebuffer(36160, null) } function R(e, t, n) { var i, r, a; b.bindRenderbuffer(36161, e), t.depthBuffer && !t.stencilBuffer ? (i = 33189, n ? ((r = t.depthTexture) && r.isDepthTexture && (r.type === Xe ? i = 36012 : r.type === We && (i = 33190)), r = I(t), b.renderbufferStorageMultisample(36161, r, i, t.width, t.height)) : b.renderbufferStorage(36161, i, t.width, t.height), b.framebufferRenderbuffer(36160, 36096, 36161, e)) : t.depthBuffer && t.stencilBuffer ? (n ? (a = I(t), b.renderbufferStorageMultisample(36161, a, 35056, t.width, t.height)) : b.renderbufferStorage(36161, 34041, t.width, t.height), b.framebufferRenderbuffer(36160, 33306, 36161, e)) : (a = E.convert(t.texture.format), e = E.convert(t.texture.type), e = P(t.texture.internalFormat, a, e), n ? (n = I(t), b.renderbufferStorageMultisample(36161, n, e, t.width, t.height)) : b.renderbufferStorage(36161, e, t.width, t.height)), b.bindRenderbuffer(36161, null) } function F(e) { var t = u.get(e) , n = !0 === e.isWebGLCubeRenderTarget; if (e.depthTexture) { if (n) throw new Error("target.depthTexture not supported in Cube render targets"); !function(e, t) { if (t && t.isWebGLCubeRenderTarget) throw new Error("Depth Texture with cube render targets is not supported"); if (b.bindFramebuffer(36160, e), !t.depthTexture || !t.depthTexture.isDepthTexture) throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture"); if (u.get(t.depthTexture).__webglTexture && t.depthTexture.image.width === t.width && t.depthTexture.image.height === t.height || (t.depthTexture.image.width = t.width, t.depthTexture.image.height = t.height, t.depthTexture.needsUpdate = !0), m(t.depthTexture, 0), e = u.get(t.depthTexture).__webglTexture, t.depthTexture.format === rt) b.framebufferTexture2D(36160, 36096, 3553, e, 0); else { if (t.depthTexture.format !== at) throw new Error("Unknown depthTexture format"); b.framebufferTexture2D(36160, 33306, 3553, e, 0) } }(t.__webglFramebuffer, e) } else if (n) { t.__webglDepthbuffer = []; for (var i = 0; i < 6; i++) b.bindFramebuffer(36160, t.__webglFramebuffer[i]), t.__webglDepthbuffer[i] = b.createRenderbuffer(), R(t.__webglDepthbuffer[i], e, !1) } else b.bindFramebuffer(36160, t.__webglFramebuffer), t.__webglDepthbuffer = b.createRenderbuffer(), R(t.__webglDepthbuffer, e, !1); b.bindFramebuffer(36160, null) } function I(e) { return _ && e.isWebGLMultisampleRenderTarget ? Math.min(n, e.samples) : 0 } var O = !1 , z = !1; this.allocateTextureUnit = function() { var e = f; return t <= e && console.warn("THREE.WebGLTextures: Trying to use " + e + " texture units while this GPU supports only " + t), f += 1, e } , this.resetTextureUnits = function() { f = 0 } , this.setTexture2D = m, this.setTexture2DArray = function(e, t) { var n = u.get(e); 0 < e.version && n.__version !== e.version ? B(n, e, t) : (x.activeTexture(33984 + t), x.bindTexture(35866, n.__webglTexture)) } , this.setTexture3D = function(e, t) { var n = u.get(e); 0 < e.version && n.__version !== e.version ? B(n, e, t) : (x.activeTexture(33984 + t), x.bindTexture(32879, n.__webglTexture)) } , this.setTextureCube = g, this.setupRenderTarget = function(e) { var t = u.get(e) , n = u.get(e.texture); e.addEventListener("dispose", p), n.__webglTexture = b.createTexture(), c.memory.textures++; var i, r = !0 === e.isWebGLCubeRenderTarget, a = !0 === e.isWebGLMultisampleRenderTarget, o = T(e) || _; if (!_ || e.texture.format !== $e || e.texture.type !== Xe && e.texture.type !== qe || (e.texture.format = et, console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")), r) { t.__webglFramebuffer = []; for (var s = 0; s < 6; s++) t.__webglFramebuffer[s] = b.createFramebuffer() } else t.__webglFramebuffer = b.createFramebuffer(), a && (_ ? (t.__webglMultisampledFramebuffer = b.createFramebuffer(), t.__webglColorRenderbuffer = b.createRenderbuffer(), b.bindRenderbuffer(36161, t.__webglColorRenderbuffer), i = E.convert(e.texture.format), a = E.convert(e.texture.type), i = P(e.texture.internalFormat, i, a), a = I(e), b.renderbufferStorageMultisample(36161, a, i, e.width, e.height), b.bindFramebuffer(36160, t.__webglMultisampledFramebuffer), b.framebufferRenderbuffer(36160, 36064, 36161, t.__webglColorRenderbuffer), b.bindRenderbuffer(36161, null), e.depthBuffer && (t.__webglDepthRenderbuffer = b.createRenderbuffer(), R(t.__webglDepthRenderbuffer, e, !0)), b.bindFramebuffer(36160, null)) : console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")); if (r) { x.bindTexture(34067, n.__webglTexture), D(34067, e.texture, o); for (var l = 0; l < 6; l++) L(t.__webglFramebuffer[l], e, 36064, 34069 + l); S(e.texture, o) && C(34067, e.texture, e.width, e.height), x.bindTexture(34067, null) } else x.bindTexture(3553, n.__webglTexture), D(3553, e.texture, o), L(t.__webglFramebuffer, e, 36064, 3553), S(e.texture, o) && C(3553, e.texture, e.width, e.height), x.bindTexture(3553, null); e.depthBuffer && F(e) } , this.updateRenderTargetMipmap = function(e) { var t, n, i = e.texture; S(i, T(e) || _) && (t = e.isWebGLCubeRenderTarget ? 34067 : 3553, n = u.get(i).__webglTexture, x.bindTexture(t, n), C(t, i, e.width, e.height), x.bindTexture(t, null)) } , this.updateMultisampleRenderTarget = function(e) { var t, n, i, r; e.isWebGLMultisampleRenderTarget && (_ ? (t = u.get(e), b.bindFramebuffer(36008, t.__webglMultisampledFramebuffer), b.bindFramebuffer(36009, t.__webglFramebuffer), n = e.width, i = e.height, r = 16384, e.depthBuffer && (r |= 256), e.stencilBuffer && (r |= 1024), b.blitFramebuffer(0, 0, n, i, 0, 0, n, i, r, 9728), b.bindFramebuffer(36160, t.__webglMultisampledFramebuffer)) : console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")) } , this.safeSetTexture2D = function(e, t) { e && e.isWebGLRenderTarget && (!1 === O && (console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."), O = !0), e = e.texture), m(e, t) } , this.safeSetTextureCube = function(e, t) { e && e.isWebGLCubeRenderTarget && (!1 === z && (console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."), z = !0), e = e.texture), g(e, t) } } function ss(e, n, t) { var i = t.isWebGL2; return { convert: function(e) { var t; if (e === Ue) return 5121; if (e === Je) return 32819; if (e === Ye) return 32820; if (e === Ze) return 33635; if (e === Ge) return 5120; if (e === He) return 5122; if (e === Ve) return 5123; if (e === je) return 5124; if (e === We) return 5125; if (e === Xe) return 5126; if (e === qe) return i ? 5131 : null !== (t = n.get("OES_texture_half_float")) ? t.HALF_FLOAT_OES : null; if (e === Ke) return 6406; if (e === $e) return 6407; if (e === et) return 6408; if (e === tt) return 6409; if (e === nt) return 6410; if (e === rt) return 6402; if (e === at) return 34041; if (e === ot) return 6403; if (e === st) return 36244; if (e === lt) return 33319; if (e === ut) return 33320; if (e === ct) return 36248; if (e === dt) return 36249; if (e === ht || e === pt || e === ft || e === mt) { if (null === (t = n.get("WEBGL_compressed_texture_s3tc"))) return null; if (e === ht) return t.COMPRESSED_RGB_S3TC_DXT1_EXT; if (e === pt) return t.COMPRESSED_RGBA_S3TC_DXT1_EXT; if (e === ft) return t.COMPRESSED_RGBA_S3TC_DXT3_EXT; if (e === mt) return t.COMPRESSED_RGBA_S3TC_DXT5_EXT } if (e === vt || e === gt || e === yt || e === wt) { if (null === (t = n.get("WEBGL_compressed_texture_pvrtc"))) return null; if (e === vt) return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; if (e === gt) return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; if (e === yt) return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; if (e === wt) return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG } if (e === bt) return null !== (t = n.get("WEBGL_compressed_texture_etc1")) ? t.COMPRESSED_RGB_ETC1_WEBGL : null; if ((e === xt || e === Et) && null !== (t = n.get("WEBGL_compressed_texture_etc"))) { if (e === xt) return t.COMPRESSED_RGB8_ETC2; if (e === Et) return t.COMPRESSED_RGBA8_ETC2_EAC } return e === _t || e === Mt || e === At || e === Tt || e === St || e === Ct || e === Pt || e === Dt || e === kt || e === Bt || e === Lt || e === Rt || e === Ft || e === It || e === zt || e === Nt || e === Ut || e === Gt || e === Ht || e === Vt || e === jt || e === Wt || e === Xt || e === qt || e === Jt || e === Yt || e === Zt || e === Qt ? null !== (t = n.get("WEBGL_compressed_texture_astc")) ? e : null : e === Ot ? null !== (t = n.get("EXT_texture_compression_bptc")) ? e : null : e === Qe ? i ? 34042 : null !== (t = n.get("WEBGL_depth_texture")) ? t.UNSIGNED_INT_24_8_WEBGL : null : void 0 } } } function ls() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []; $r.call(this), this.cameras = e } function us() { Si.call(this), this.type = "Group" } function cs() { this._targetRay = null, this._grip = null, this._hand = null } function ds(p, t) { var n = this , f = null , i = 1 , m = null , r = "local-floor" , v = null , g = [] , u = new Map , s = new $r; s.layers.enable(1), s.viewport = new Mn; var l = new $r; l.layers.enable(2), l.viewport = new Mn; var y = [s, l] , w = new ls; w.layers.enable(1), w.layers.enable(2); var c = null , d = null; function a(e) { var t = u.get(e.inputSource); t && t.dispatchEvent({ type: e.type, data: e.inputSource }) } function o() { u.forEach(function(e, t) { e.disconnect(t) }), u.clear(), p.setFramebuffer(null), p.setRenderTarget(p.getRenderTarget()), A.stop(), n.isPresenting = !1, n.dispatchEvent({ type: "sessionend" }) } function h(e) { m = e, A.setContext(f), A.start(), n.isPresenting = !0, n.dispatchEvent({ type: "sessionstart" }) } function b(e) { for (var t = f.inputSources, n = 0; n < g.length; n++) u.set(t[n], g[n]); for (var i = 0; i < e.removed.length; i++) { var r = e.removed[i] , a = u.get(r); a && (a.dispatchEvent({ type: "disconnected", data: r }), u.delete(r)) } for (var o = 0; o < e.added.length; o++) { var s = e.added[o] , l = u.get(s); l && l.dispatchEvent({ type: "connected", data: s }) } } this.enabled = !1, this.isPresenting = !1, this.getController = function(e) { var t = g[e]; return void 0 === t && (t = new cs, g[e] = t), t.getTargetRaySpace() } , this.getControllerGrip = function(e) { var t = g[e]; return void 0 === t && (t = new cs, g[e] = t), t.getGripSpace() } , this.getHand = function(e) { var t = g[e]; return void 0 === t && (t = new cs, g[e] = t), t.getHandSpace() } , this.setFramebufferScaleFactor = function(e) { i = e, !0 === n.isPresenting && console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.") } , this.setReferenceSpaceType = function(e) { r = e, !0 === n.isPresenting && console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.") } , this.getReferenceSpace = function() { return m } , this.getSession = function() { return f } , this.setSession = function(e) { null !== (f = e) && (f.addEventListener("select", a), f.addEventListener("selectstart", a), f.addEventListener("selectend", a), f.addEventListener("squeeze", a), f.addEventListener("squeezestart", a), f.addEventListener("squeezeend", a), f.addEventListener("end", o), !0 !== (e = t.getContextAttributes()).xrCompatible && t.makeXRCompatible(), e = { antialias: e.antialias, alpha: e.alpha, depth: e.depth, stencil: e.stencil, framebufferScaleFactor: i }, e = new XRWebGLLayer(f,t,e), f.updateRenderState({ baseLayer: e }), f.requestReferenceSpace(r).then(h), f.addEventListener("inputsourceschange", b)) } ; var x = new Cn , E = new Cn; function _(e, t) { null === t ? e.matrixWorld.copy(e.matrix) : e.matrixWorld.multiplyMatrices(t.matrixWorld, e.matrix), e.matrixWorldInverse.copy(e.matrixWorld).invert() } this.getCamera = function(e) { w.near = l.near = s.near = e.near, w.far = l.far = s.far = e.far, c === w.near && d === w.far || (f.updateRenderState({ depthNear: w.near, depthFar: w.far }), c = w.near, d = w.far); var t = e.parent , n = w.cameras; _(w, t); for (var i = 0; i < n.length; i++) _(n[i], t); e.matrixWorld.copy(w.matrixWorld); for (var r = e.children, a = 0, o = r.length; a < o; a++) r[a].updateMatrixWorld(!0); return 2 === n.length ? function(e, t, n) { x.setFromMatrixPosition(t.matrixWorld), E.setFromMatrixPosition(n.matrixWorld); var i = x.distanceTo(E) , r = t.projectionMatrix.elements , a = n.projectionMatrix.elements , o = r[14] / (r[10] - 1) , s = r[14] / (r[10] + 1) , l = (r[9] + 1) / r[5] , u = (r[9] - 1) / r[5] , c = (r[8] - 1) / r[0] , n = (a[8] + 1) / a[0] , r = o * c , a = o * n , c = (n = i / (n - c)) * -c; t.matrixWorld.decompose(e.position, e.quaternion, e.scale), e.translateX(c), e.translateZ(n), e.matrixWorld.compose(e.position, e.quaternion, e.scale), e.matrixWorldInverse.copy(e.matrixWorld).invert(), o += n, n = s + n, e.projectionMatrix.makePerspective(r - c, i - c + a, l * s / n * o, u * s / n * o, o, n) }(w, s, l) : w.projectionMatrix.copy(s.projectionMatrix), w } ; var M = null; var A = new sa; A.setAnimationLoop(function(e, t) { if (null !== (v = t.getViewerPose(m))) { var n = v.views , i = f.renderState.baseLayer; p.setFramebuffer(i.framebuffer); var r = !1; n.length !== w.cameras.length && (r = !(w.cameras.length = 0)); for (var a = 0; a < n.length; a++) { var o = n[a] , s = i.getViewport(o) , l = y[a]; l.matrix.fromArray(o.transform.matrix), l.projectionMatrix.fromArray(o.projectionMatrix), l.viewport.set(s.x, s.y, s.width, s.height), 0 === a && w.matrix.copy(l.matrix), !0 === r && w.cameras.push(l) } } for (var u = f.inputSources, c = 0; c < g.length; c++) { var d = g[c] , h = u[c]; d.update(h, t, m) } M && M(e, t) }), this.setAnimationLoop = function(e) { M = e } , this.dispose = function() {} } function hs(a) { function l(e, t) { e.opacity.value = t.opacity, t.color && e.diffuse.value.copy(t.color), t.emissive && e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity), t.map && (e.map.value = t.map), t.alphaMap && (e.alphaMap.value = t.alphaMap), t.specularMap && (e.specularMap.value = t.specularMap); var n, i, r = a.get(t).envMap; r && (e.envMap.value = r, e.flipEnvMap.value = r.isCubeTexture && r._needsFlipEnvMap ? -1 : 1, e.reflectivity.value = t.reflectivity, e.refractionRatio.value = t.refractionRatio, void 0 !== (r = a.get(r).__maxMipLevel) && (e.maxMipLevel.value = r)), t.lightMap && (e.lightMap.value = t.lightMap, e.lightMapIntensity.value = t.lightMapIntensity), t.aoMap && (e.aoMap.value = t.aoMap, e.aoMapIntensity.value = t.aoMapIntensity), t.map ? n = t.map : t.specularMap ? n = t.specularMap : t.displacementMap ? n = t.displacementMap : t.normalMap ? n = t.normalMap : t.bumpMap ? n = t.bumpMap : t.roughnessMap ? n = t.roughnessMap : t.metalnessMap ? n = t.metalnessMap : t.alphaMap ? n = t.alphaMap : t.emissiveMap ? n = t.emissiveMap : t.clearcoatMap ? n = t.clearcoatMap : t.clearcoatNormalMap ? n = t.clearcoatNormalMap : t.clearcoatRoughnessMap && (n = t.clearcoatRoughnessMap), void 0 !== n && (!0 === (n = n.isWebGLRenderTarget ? n.texture : n).matrixAutoUpdate && n.updateMatrix(), e.uvTransform.value.copy(n.matrix)), t.aoMap ? i = t.aoMap : t.lightMap && (i = t.lightMap), void 0 !== i && (!0 === (i = i.isWebGLRenderTarget ? i.texture : i).matrixAutoUpdate && i.updateMatrix(), e.uv2Transform.value.copy(i.matrix)) } function u(e, t) { e.roughness.value = t.roughness, e.metalness.value = t.metalness, t.roughnessMap && (e.roughnessMap.value = t.roughnessMap), t.metalnessMap && (e.metalnessMap.value = t.metalnessMap), t.emissiveMap && (e.emissiveMap.value = t.emissiveMap), t.bumpMap && (e.bumpMap.value = t.bumpMap, e.bumpScale.value = t.bumpScale, t.side === J && (e.bumpScale.value *= -1)), t.normalMap && (e.normalMap.value = t.normalMap, e.normalScale.value.copy(t.normalScale), t.side === J && e.normalScale.value.negate()), t.displacementMap && (e.displacementMap.value = t.displacementMap, e.displacementScale.value = t.displacementScale, e.displacementBias.value = t.displacementBias), a.get(t).envMap && (e.envMapIntensity.value = t.envMapIntensity) } return { refreshFogUniforms: function(e, t) { e.fogColor.value.copy(t.color), t.isFog ? (e.fogNear.value = t.near, e.fogFar.value = t.far) : t.isFogExp2 && (e.fogDensity.value = t.density) }, refreshMaterialUniforms: function(e, t, n, i) { var r, a, o, s; t.isMeshBasicMaterial ? l(e, t) : t.isMeshLambertMaterial ? (l(e, t), o = e, (s = t).emissiveMap && (o.emissiveMap.value = s.emissiveMap)) : t.isMeshToonMaterial ? (l(e, t), function(e, t) { t.gradientMap && (e.gradientMap.value = t.gradientMap); t.emissiveMap && (e.emissiveMap.value = t.emissiveMap); t.bumpMap && (e.bumpMap.value = t.bumpMap, e.bumpScale.value = t.bumpScale, t.side === J && (e.bumpScale.value *= -1)); t.normalMap && (e.normalMap.value = t.normalMap, e.normalScale.value.copy(t.normalScale), t.side === J && e.normalScale.value.negate()); t.displacementMap && (e.displacementMap.value = t.displacementMap, e.displacementScale.value = t.displacementScale, e.displacementBias.value = t.displacementBias) }(e, t)) : t.isMeshPhongMaterial ? (l(e, t), function(e, t) { e.specular.value.copy(t.specular), e.shininess.value = Math.max(t.shininess, 1e-4), t.emissiveMap && (e.emissiveMap.value = t.emissiveMap); t.bumpMap && (e.bumpMap.value = t.bumpMap, e.bumpScale.value = t.bumpScale, t.side === J && (e.bumpScale.value *= -1)); t.normalMap && (e.normalMap.value = t.normalMap, e.normalScale.value.copy(t.normalScale), t.side === J && e.normalScale.value.negate()); t.displacementMap && (e.displacementMap.value = t.displacementMap, e.displacementScale.value = t.displacementScale, e.displacementBias.value = t.displacementBias) }(e, t)) : t.isMeshStandardMaterial ? (l(e, t), (t.isMeshPhysicalMaterial ? function(e, t) { u(e, t), e.reflectivity.value = t.reflectivity, e.clearcoat.value = t.clearcoat, e.clearcoatRoughness.value = t.clearcoatRoughness, t.sheen && e.sheen.value.copy(t.sheen); t.clearcoatMap && (e.clearcoatMap.value = t.clearcoatMap); t.clearcoatRoughnessMap && (e.clearcoatRoughnessMap.value = t.clearcoatRoughnessMap); t.clearcoatNormalMap && (e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale), e.clearcoatNormalMap.value = t.clearcoatNormalMap, t.side === J && e.clearcoatNormalScale.value.negate()); e.transmission.value = t.transmission, t.transmissionMap && (e.transmissionMap.value = t.transmissionMap) } : u)(e, t)) : t.isMeshMatcapMaterial ? (l(e, t), function(e, t) { t.matcap && (e.matcap.value = t.matcap); t.bumpMap && (e.bumpMap.value = t.bumpMap, e.bumpScale.value = t.bumpScale, t.side === J && (e.bumpScale.value *= -1)); t.normalMap && (e.normalMap.value = t.normalMap, e.normalScale.value.copy(t.normalScale), t.side === J && e.normalScale.value.negate()); t.displacementMap && (e.displacementMap.value = t.displacementMap, e.displacementScale.value = t.displacementScale, e.displacementBias.value = t.displacementBias) }(e, t)) : t.isMeshDepthMaterial ? (l(e, t), r = e, (a = t).displacementMap && (r.displacementMap.value = a.displacementMap, r.displacementScale.value = a.displacementScale, r.displacementBias.value = a.displacementBias)) : t.isMeshDistanceMaterial ? (l(e, t), function(e, t) { t.displacementMap && (e.displacementMap.value = t.displacementMap, e.displacementScale.value = t.displacementScale, e.displacementBias.value = t.displacementBias); e.referencePosition.value.copy(t.referencePosition), e.nearDistance.value = t.nearDistance, e.farDistance.value = t.farDistance }(e, t)) : t.isMeshNormalMaterial ? (l(e, t), function(e, t) { t.bumpMap && (e.bumpMap.value = t.bumpMap, e.bumpScale.value = t.bumpScale, t.side === J && (e.bumpScale.value *= -1)); t.normalMap && (e.normalMap.value = t.normalMap, e.normalScale.value.copy(t.normalScale), t.side === J && e.normalScale.value.negate()); t.displacementMap && (e.displacementMap.value = t.displacementMap, e.displacementScale.value = t.displacementScale, e.displacementBias.value = t.displacementBias) }(e, t)) : t.isLineBasicMaterial ? (r = t, (a = e).diffuse.value.copy(r.color), a.opacity.value = r.opacity, t.isLineDashedMaterial && (a = t, (r = e).dashSize.value = a.dashSize, r.totalSize.value = a.dashSize + a.gapSize, r.scale.value = a.scale)) : t.isPointsMaterial ? function(e, t, n, i) { e.diffuse.value.copy(t.color), e.opacity.value = t.opacity, e.size.value = t.size * n, e.scale.value = .5 * i, t.map && (e.map.value = t.map); t.alphaMap && (e.alphaMap.value = t.alphaMap); var r; t.map ? r = t.map : t.alphaMap && (r = t.alphaMap); void 0 !== r && (!0 === r.matrixAutoUpdate && r.updateMatrix(), e.uvTransform.value.copy(r.matrix)) }(e, t, n, i) : t.isSpriteMaterial ? function(e, t) { e.diffuse.value.copy(t.color), e.opacity.value = t.opacity, e.rotation.value = t.rotation, t.map && (e.map.value = t.map); t.alphaMap && (e.alphaMap.value = t.alphaMap); var n; t.map ? n = t.map : t.alphaMap && (n = t.alphaMap); void 0 !== n && (!0 === n.matrixAutoUpdate && n.updateMatrix(), e.uvTransform.value.copy(n.matrix)) }(e, t) : t.isShadowMaterial ? (e.color.value.copy(t.color), e.opacity.value = t.opacity) : t.isShaderMaterial && (t.uniformsNeedUpdate = !1) } } } function ps(e) { var r = void 0 !== (e = e || {}).canvas ? e.canvas : ((c = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas")).style.display = "block", c) , t = void 0 !== e.context ? e.context : null , n = void 0 !== e.alpha && e.alpha , i = void 0 === e.depth || e.depth , a = void 0 === e.stencil || e.stencil , o = void 0 !== e.antialias && e.antialias , s = void 0 === e.premultipliedAlpha || e.premultipliedAlpha , l = void 0 !== e.preserveDrawingBuffer && e.preserveDrawingBuffer , u = void 0 !== e.powerPreference ? e.powerPreference : "default" , c = void 0 !== e.failIfMajorPerformanceCaveat && e.failIfMajorPerformanceCaveat , g = null , y = null , d = []; this.domElement = r, this.debug = { checkShaderErrors: !0 }, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, this.sortObjects = !0, this.clippingPlanes = [], this.localClippingEnabled = !1, this.gammaFactor = 2, this.outputEncoding = rn, this.physicallyCorrectLights = !1, this.toneMapping = De, this.toneMappingExposure = 1, this.maxMorphTargets = 8, this.maxMorphNormals = 4; var p = this , h = !1 , f = null , m = 0 , v = 0 , w = null , b = null , x = -1 , E = null , _ = new Mn , M = new Mn , A = null , T = r.width , S = r.height , C = 1 , P = null , D = null , k = new Mn(0,0,T,S) , B = new Mn(0,0,T,S) , L = !1 , R = new oa , F = !1 , I = !1 , O = new ni , z = new Cn , N = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: !0 }; function U() { return null === w ? C : 1 } var G, H, V, j, W, X, q, J, Y, Z, Q, K, $, ee, te, ne, ie, re, ae, oe, se, le = t; function ue(e, t) { for (var n = 0; n < e.length; n++) { var i = e[n] , i = r.getContext(i, t); if (null !== i) return i } return null } try { var ce = { alpha: n, depth: i, stencil: a, antialias: o, premultipliedAlpha: s, preserveDrawingBuffer: l, powerPreference: u, failIfMajorPerformanceCaveat: c }; if (r.addEventListener("webglcontextlost", me, !1), r.addEventListener("webglcontextrestored", ve, !1), null === le) { var de = ["webgl2", "webgl", "experimental-webgl"]; if (!0 === p.isWebGL1Renderer && de.shift(), null === (le = ue(de, ce))) throw ue(de) ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context.") } void 0 === le.getShaderPrecisionFormat && (le.getShaderPrecisionFormat = function() { return { rangeMin: 1, rangeMax: 1, precision: 1 } } ) } catch (e) { throw console.error("THREE.WebGLRenderer: " + e.message), e } function he() { G = new wa(le), !1 === (H = new va(le,G,e)).isWebGL2 && (G.get("WEBGL_depth_texture"), G.get("OES_texture_float"), G.get("OES_texture_half_float"), G.get("OES_texture_half_float_linear"), G.get("OES_standard_derivatives"), G.get("OES_element_index_uint"), G.get("OES_vertex_array_object"), G.get("ANGLE_instanced_arrays")), G.get("OES_texture_float_linear"), oe = new ss(0,G,H), (V = new as(le,G,H)).scissor(M.copy(B).multiplyScalar(C).floor()), V.viewport(_.copy(k).multiplyScalar(C).floor()), j = new Ea, W = new Vo, X = new os(le,G,V,W,H,oe,j), q = new ya(p), J = new la(le,H), se = new fa(le,G,J,H), Y = new ba(0,J,j,se), Z = new Ta(0,Y,J,j), ie = new Aa(le), te = new ga(W), Q = new Ho(p,q,G,H,se,te), K = new hs(W), $ = new qo(W), ee = new $o(G,H), ne = new pa(p,q,V,Z,s), re = new ma(le,G,j,H), ae = new xa(le,G,j,H), j.programs = Q.programs, p.capabilities = H, p.extensions = G, p.properties = W, p.renderLists = $, p.state = V, p.info = j, p._textures = X } he(); var pe = new ds(p,le); this.xr = pe; var fe = new rs(p,Z,H.maxTextureSize); function me(e) { e.preventDefault(), console.log("THREE.WebGLRenderer: Context Lost."), h = !0 } function ve() { console.log("THREE.WebGLRenderer: Context Restored."), h = !1, he() } function ge(e) { var e = e.target; e.removeEventListener("dispose", ge), ye(e = e), W.remove(e) } function ye(e) { e = W.get(e).program; void 0 !== e && Q.releaseProgram(e) } this.shadowMap = fe, this.getContext = function() { return le } , this.getContextAttributes = function() { return le.getContextAttributes() } , this.forceContextLoss = function() { var e = G.get("WEBGL_lose_context"); e && e.loseContext() } , this.forceContextRestore = function() { var e = G.get("WEBGL_lose_context"); e && e.restoreContext() } , this.getPixelRatio = function() { return C } , this.setPixelRatio = function(e) { void 0 !== e && (C = e, this.setSize(T, S, !1)) } , this.getSize = function(e) { return void 0 === e && (console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"), e = new yn), e.set(T, S) } , this.setSize = function(e, t, n, i) { null != i && (C = i), pe.isPresenting ? console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.") : (T = e, S = t, r.width = Math.floor(e * C), r.height = Math.floor(t * C), !1 !== n && (r.style.width = e + "px", r.style.height = t + "px"), this.setViewport(0, 0, e, t)) } , this.getDrawingBufferSize = function(e) { return void 0 === e && (console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"), e = new yn), e.set(T * C, S * C).floor() } , this.setDrawingBufferSize = function(e, t, n) { T = e, S = t, C = n, r.width = Math.floor(e * n), r.height = Math.floor(t * n), this.setViewport(0, 0, e, t) } , this.getCurrentViewport = function(e) { return void 0 === e && (console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"), e = new Mn), e.copy(_) } , this.getViewport = function(e) { return e.copy(k) } , this.setViewport = function(e, t, n, i) { e.isVector4 ? k.set(e.x, e.y, e.z, e.w) : k.set(e, t, n, i), V.viewport(_.copy(k).multiplyScalar(C).floor()) } , this.getScissor = function(e) { return e.copy(B) } , this.setScissor = function(e, t, n, i) { e.isVector4 ? B.set(e.x, e.y, e.z, e.w) : B.set(e, t, n, i), V.scissor(M.copy(B).multiplyScalar(C).floor()) } , this.getScissorTest = function() { return L } , this.setScissorTest = function(e) { V.setScissorTest(L = e) } , this.setOpaqueSort = function(e) { P = e } , this.setTransparentSort = function(e) { D = e } , this.getClearColor = function(e) { return void 0 === e && (console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"), e = new Yi), e.copy(ne.getClearColor()) } , this.setClearColor = function() { ne.setClearColor.apply(ne, arguments) } , this.getClearAlpha = function() { return ne.getClearAlpha() } , this.setClearAlpha = function() { ne.setClearAlpha.apply(ne, arguments) } , this.clear = function(e, t, n) { var i = 0; void 0 !== e && !e || (i |= 16384), void 0 !== t && !t || (i |= 256), void 0 !== n && !n || (i |= 1024), le.clear(i) } , this.clearColor = function() { this.clear(!0, !1, !1) } , this.clearDepth = function() { this.clear(!1, !0, !1) } , this.clearStencil = function() { this.clear(!1, !1, !0) } , this.dispose = function() { r.removeEventListener("webglcontextlost", me, !1), r.removeEventListener("webglcontextrestored", ve, !1), $.dispose(), ee.dispose(), W.dispose(), q.dispose(), Z.dispose(), se.dispose(), pe.dispose(), be.stop() } , this.renderBufferImmediate = function(e, t) { se.initAttributes(); var n = W.get(e); e.hasPositions && !n.position && (n.position = le.createBuffer()), e.hasNormals && !n.normal && (n.normal = le.createBuffer()), e.hasUvs && !n.uv && (n.uv = le.createBuffer()), e.hasColors && !n.color && (n.color = le.createBuffer()); t = t.getAttributes(); e.hasPositions && (le.bindBuffer(34962, n.position), le.bufferData(34962, e.positionArray, 35048), se.enableAttribute(t.position), le.vertexAttribPointer(t.position, 3, 5126, !1, 0, 0)), e.hasNormals && (le.bindBuffer(34962, n.normal), le.bufferData(34962, e.normalArray, 35048), se.enableAttribute(t.normal), le.vertexAttribPointer(t.normal, 3, 5126, !1, 0, 0)), e.hasUvs && (le.bindBuffer(34962, n.uv), le.bufferData(34962, e.uvArray, 35048), se.enableAttribute(t.uv), le.vertexAttribPointer(t.uv, 2, 5126, !1, 0, 0)), e.hasColors && (le.bindBuffer(34962, n.color), le.bufferData(34962, e.colorArray, 35048), se.enableAttribute(t.color), le.vertexAttribPointer(t.color, 3, 5126, !1, 0, 0)), se.disableUnusedAttributes(), le.drawArrays(4, 0, e.count), e.count = 0 } , this.renderBufferDirect = function(e, t, n, i, r, a) { null === t && (t = N); var o = r.isMesh && r.matrixWorld.determinant() < 0 , s = Me(e, t, i, r); V.setMaterial(i, o); var l = n.index , e = n.attributes.position; if (null === l) { if (void 0 === e || 0 === e.count) return } else if (0 === l.count) return; t = 1; !0 === i.wireframe && (l = Y.getWireframeAttribute(n), t = 2), (i.morphTargets || i.morphNormals) && ie.update(r, n, i, s), se.setup(r, i, s, n, l); o = re; null !== l && (u = J.get(l), (o = ae).setIndex(u)); var s = (null !== l ? l : e).count , u = n.drawRange.start * t , l = n.drawRange.count * t , e = null !== a ? a.start * t : 0 , a = null !== a ? a.count * t : 1 / 0 , t = Math.max(u, e) , a = Math.min(s, u + l, e + a) - 1 , a = Math.max(0, a - t + 1); 0 !== a && (r.isMesh ? !0 === i.wireframe ? (V.setlineWidth(i.wireframelineWidth * U()), o.setMode(1)) : o.setMode(4) : r.isLine ? (i = i.lineWidth, V.setlineWidth((i = void 0 === i ? 1 : i) * U()), r.isLineSegments ? o.setMode(1) : r.isLineLoop ? o.setMode(2) : o.setMode(3)) : r.isPoints ? o.setMode(0) : r.isSprite && o.setMode(4), r.isInstancedMesh ? o.renderInstances(t, a, r.count) : n.isInstancedBufferGeometry ? (n = Math.min(n.instanceCount, n._maxInstanceCount), o.renderInstances(t, a, n)) : o.render(t, a)) } , this.compile = function(r, t) { (y = ee.get(r)).init(), r.traverseVisible(function(e) { e.isLight && e.layers.test(t.layers) && (y.pushLight(e), e.castShadow && y.pushShadow(e)) }), y.setupLights(); var a = new WeakMap; r.traverse(function(e) { var t = e.material; if (t) if (Array.isArray(t)) for (var n = 0; n < t.length; n++) { var i = t[n]; !1 === a.has(i) && (_e(i, r, e), a.set(i)) } else !1 === a.has(t) && (_e(t, r, e), a.set(t)) }) } ; var we = null; var be = new sa; function xe(e, t, n) { for (var i = !0 === t.isScene ? t.overrideMaterial : null, r = 0, a = e.length; r < a; r++) { var o = e[r] , s = o.object , l = o.geometry , u = null === i ? o.material : i , c = o.group; if (n.isArrayCamera) for (var d = n.cameras, h = 0, p = d.length; h < p; h++) { var f = d[h]; s.layers.test(f.layers) && (V.viewport(_.copy(f.viewport)), y.setupLightsView(f), Ee(s, t, f, l, u, c)) } else Ee(s, t, n, l, u, c) } } function Ee(e, t, n, i, r, a) { var o, s; e.onBeforeRender(p, t, n, i, r, a), e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse, e.matrixWorld), e.normalMatrix.getNormalMatrix(e.modelViewMatrix), e.isImmediateRenderObject ? (o = Me(n, t, r, e), V.setMaterial(r), se.reset(), s = o, e.render(function(e) { p.renderBufferImmediate(e, s) })) : p.renderBufferDirect(n, t, i, r, e, a), e.onAfterRender(p, t, n, i, r, a) } function _e(e, t, n) { !0 !== t.isScene && (t = N); var i = W.get(e) , r = y.state.lights , a = y.state.shadowsArray , o = r.state.version , s = Q.getParameters(e, r.state, a, t, n) , l = Q.getProgramCacheKey(s) , u = i.program , a = !0; if (void 0 === u) e.addEventListener("dispose", ge); else if (u.cacheKey !== l) ye(e); else if (i.lightsStateVersion !== o) a = !1; else { if (void 0 !== s.shaderID) { n = e.isMeshStandardMaterial ? t.environment : null; return void (i.envMap = q.get(e.envMap || n)) } a = !1 } a && (s.uniforms = Q.getUniforms(e), e.onBeforeCompile(s, p), u = Q.acquireProgram(s, l), i.program = u, i.uniforms = s.uniforms, i.outputEncoding = s.outputEncoding); s = i.uniforms; (e.isShaderMaterial || e.isRawShaderMaterial) && !0 !== e.clipping || (i.numClippingPlanes = te.numPlanes, i.numIntersection = te.numIntersection, s.clippingPlanes = te.uniform), i.environment = e.isMeshStandardMaterial ? t.environment : null, i.fog = t.fog, i.envMap = q.get(e.envMap || i.environment), i.needsLights = (e = e).isMeshLambertMaterial || e.isMeshToonMaterial || e.isMeshPhongMaterial || e.isMeshStandardMaterial || e.isShadowMaterial || e.isShaderMaterial && !0 === e.lights, i.lightsStateVersion = o, i.needsLights && (s.ambientLightColor.value = r.state.ambient, s.lightProbe.value = r.state.probe, s.directionalLights.value = r.state.directional, s.directionalLightShadows.value = r.state.directionalShadow, s.spotLights.value = r.state.spot, s.spotLightShadows.value = r.state.spotShadow, s.rectAreaLights.value = r.state.rectArea, s.ltc_1.value = r.state.rectAreaLTC1, s.ltc_2.value = r.state.rectAreaLTC2, s.pointLights.value = r.state.point, s.pointLightShadows.value = r.state.pointShadow, s.hemisphereLights.value = r.state.hemi, s.directionalShadowMap.value = r.state.directionalShadowMap, s.directionalShadowMatrix.value = r.state.directionalShadowMatrix, s.spotShadowMap.value = r.state.spotShadowMap, s.spotShadowMatrix.value = r.state.spotShadowMatrix, s.pointShadowMap.value = r.state.pointShadowMap, s.pointShadowMatrix.value = r.state.pointShadowMatrix); r = i.program.getUniforms(), s = _o.seqWithValue(r.seq, s); i.uniformsList = s } function Me(e, t, n, i) { !0 !== t.isScene && (t = N), X.resetTextureUnits(); var r = t.fog , a = n.isMeshStandardMaterial ? t.environment : null , o = null === w ? p.outputEncoding : w.texture.encoding , s = q.get(n.envMap || a) , l = W.get(n) , u = y.state.lights; !0 === F && (!0 !== I && e === E || (h = e === E && n.id === x, te.setState(n, e, h))), n.version === l.__version ? (n.fog && l.fog !== r || l.environment !== a || l.needsLights && l.lightsStateVersion !== u.state.version || void 0 !== l.numClippingPlanes && (l.numClippingPlanes !== te.numPlanes || l.numIntersection !== te.numIntersection) || l.outputEncoding !== o || l.envMap !== s) && _e(n, t, i) : (_e(n, t, i), l.__version = n.version); var c, d = !1, h = !1, a = !1, u = l.program, o = u.getUniforms(), s = l.uniforms; return V.useProgram(u.program) && (a = h = d = !0), n.id !== x && (x = n.id, h = !0), !d && E === e || (o.setValue(le, "projectionMatrix", e.projectionMatrix), H.logarithmicDepthBuffer && o.setValue(le, "logDepthBufFC", 2 / (Math.log(e.far + 1) / Math.LN2)), E !== e && (E = e, a = h = !0), !(n.isShaderMaterial || n.isMeshPhongMaterial || n.isMeshToonMaterial || n.isMeshStandardMaterial || n.envMap) || void 0 !== (c = o.map.cameraPosition) && c.setValue(le, z.setFromMatrixPosition(e.matrixWorld)), (n.isMeshPhongMaterial || n.isMeshToonMaterial || n.isMeshLambertMaterial || n.isMeshBasicMaterial || n.isMeshStandardMaterial || n.isShaderMaterial) && o.setValue(le, "isOrthographic", !0 === e.isOrthographicCamera), (n.isMeshPhongMaterial || n.isMeshToonMaterial || n.isMeshLambertMaterial || n.isMeshBasicMaterial || n.isMeshStandardMaterial || n.isShaderMaterial || n.isShadowMaterial || n.skinning) && o.setValue(le, "viewMatrix", e.matrixWorldInverse)), n.skinning && (o.setOptional(le, i, "bindMatrix"), o.setOptional(le, i, "bindMatrixInverse"), (t = i.skeleton) && (d = t.bones, H.floatVertexTextures ? (null === t.boneTexture && (c = Math.sqrt(4 * d.length), c = gn.ceilPowerOfTwo(c), c = Math.max(c, 4), (e = new Float32Array(c * c * 4)).set(t.boneMatrices), d = new ia(e,c,c,et,Xe), t.boneMatrices = e, t.boneTexture = d, t.boneTextureSize = c), o.setValue(le, "boneTexture", t.boneTexture, X), o.setValue(le, "boneTextureSize", t.boneTextureSize)) : o.setOptional(le, t, "boneMatrices"))), !h && l.receiveShadow === i.receiveShadow || (l.receiveShadow = i.receiveShadow, o.setValue(le, "receiveShadow", i.receiveShadow)), h && (o.setValue(le, "toneMappingExposure", p.toneMappingExposure), l.needsLights && (h = a, (a = s).ambientLightColor.needsUpdate = h, a.lightProbe.needsUpdate = h, a.directionalLights.needsUpdate = h, a.directionalLightShadows.needsUpdate = h, a.pointLights.needsUpdate = h, a.pointLightShadows.needsUpdate = h, a.spotLights.needsUpdate = h, a.spotLightShadows.needsUpdate = h, a.rectAreaLights.needsUpdate = h, a.hemisphereLights.needsUpdate = h), r && n.fog && K.refreshFogUniforms(s, r), K.refreshMaterialUniforms(s, n, C, S), _o.upload(le, l.uniformsList, s, X)), n.isShaderMaterial && !0 === n.uniformsNeedUpdate && (_o.upload(le, l.uniformsList, s, X), n.uniformsNeedUpdate = !1), n.isSpriteMaterial && o.setValue(le, "center", i.center), o.setValue(le, "modelViewMatrix", i.modelViewMatrix), o.setValue(le, "normalMatrix", i.normalMatrix), o.setValue(le, "modelMatrix", i.matrixWorld), u } be.setAnimationLoop(function(e) { pe.isPresenting || we && we(e) }), "undefined" != typeof window && be.setContext(window), this.setAnimationLoop = function(e) { we = e, pe.setAnimationLoop(e), null === e ? be.stop() : be.start() } , this.render = function(e, t) { var n, i, r; void 0 !== arguments[2] && (console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."), i = arguments[2]), void 0 !== arguments[3] && (console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."), r = arguments[3]), void 0 === t || !0 === t.isCamera ? !0 !== h && (se.resetDefaultState(), x = -1, !(E = null) === e.autoUpdate && e.updateMatrixWorld(), null === t.parent && t.updateMatrixWorld(), !0 === pe.enabled && !0 === pe.isPresenting && (t = pe.getCamera(t)), !0 === e.isScene && e.onBeforeRender(p, e, t, i || w), (y = ee.get(e, d.length)).init(), d.push(y), O.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), R.setFromProjectionMatrix(O), I = this.localClippingEnabled, F = te.init(this.clippingPlanes, I, t), (g = $.get(e, t)).init(), function e(t, n, i, r) { if (!1 === t.visible) return; var a = t.layers.test(n.layers); if (a) if (t.isGroup) i = t.renderOrder; else if (t.isLOD) !0 === t.autoUpdate && t.update(n); else if (t.isLight) y.pushLight(t), t.castShadow && y.pushShadow(t); else if (t.isSprite) { var o; t.frustumCulled && !R.intersectsSprite(t) || (r && z.setFromMatrixPosition(t.matrixWorld).applyMatrix4(O), o = Z.update(t), (a = t.material).visible && g.push(t, o, a, i, z.z, null)) } else if (t.isImmediateRenderObject) r && z.setFromMatrixPosition(t.matrixWorld).applyMatrix4(O), g.push(t, null, t.material, i, z.z, null); else if ((t.isMesh || t.isLine || t.isPoints) && (t.isSkinnedMesh && t.skeleton.frame !== j.render.frame && (t.skeleton.update(), t.skeleton.frame = j.render.frame), !t.frustumCulled || R.intersectsObject(t))) { r && z.setFromMatrixPosition(t.matrixWorld).applyMatrix4(O); var s = Z.update(t) , l = t.material; if (Array.isArray(l)) for (var u = s.groups, c = 0, d = u.length; c < d; c++) { var h = u[c] , p = l[h.materialIndex]; p && p.visible && g.push(t, s, p, i, z.z, h) } else l.visible && g.push(t, s, l, i, z.z, null) } var f = t.children; for (var m = 0, v = f.length; m < v; m++) e(f[m], n, i, r) }(e, t, 0, p.sortObjects), g.finish(), !0 === p.sortObjects && g.sort(P, D), !0 === F && te.beginShadows(), n = y.state.shadowsArray, fe.render(n, e, t), y.setupLights(), y.setupLightsView(t), !0 === F && te.endShadows(), !0 === this.info.autoReset && this.info.reset(), void 0 !== i && this.setRenderTarget(i), ne.render(g, e, t, r), i = g.opaque, r = g.transparent, 0 < i.length && xe(i, e, t), 0 < r.length && xe(r, e, t), !0 === e.isScene && e.onAfterRender(p, e, t), null !== w && (X.updateRenderTargetMipmap(w), X.updateMultisampleRenderTarget(w)), V.buffers.depth.setTest(!0), V.buffers.depth.setMask(!0), V.buffers.color.setMask(!0), V.setPolygonOffset(!1), d.pop(), y = 0 < d.length ? d[d.length - 1] : null, g = null) : console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.") } , this.setFramebuffer = function(e) { f !== e && null === w && le.bindFramebuffer(36160, e), f = e } , this.getActiveCubeFace = function() { return m } , this.getActiveMipmapLevel = function() { return v } , this.getRenderList = function() { return g } , this.setRenderList = function(e) { g = e } , this.getRenderTarget = function() { return w } , this.setRenderTarget = function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0 , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0; m = t, v = n, (w = e) && void 0 === W.get(e).__webglFramebuffer && X.setupRenderTarget(e); var i, r = f, a = !1; A = e ? (i = W.get(e).__webglFramebuffer, e.isWebGLCubeRenderTarget ? (r = i[t], a = !0) : r = e.isWebGLMultisampleRenderTarget ? W.get(e).__webglMultisampledFramebuffer : i, _.copy(e.viewport), M.copy(e.scissor), e.scissorTest) : (_.copy(k).multiplyScalar(C).floor(), M.copy(B).multiplyScalar(C).floor(), L), b !== r && (le.bindFramebuffer(36160, r), b = r), V.viewport(_), V.scissor(M), V.setScissorTest(A), a && (e = W.get(e.texture), le.framebufferTexture2D(36160, 36064, 34069 + t, e.__webglTexture, n)) } , this.readRenderTargetPixels = function(e, t, n, i, r, a, o) { if (e && e.isWebGLRenderTarget) { var s = W.get(e).__webglFramebuffer; if (s = e.isWebGLCubeRenderTarget && void 0 !== o ? s[o] : s) { o = !1; s !== b && (le.bindFramebuffer(36160, s), o = !0); try { var l = e.texture , u = l.format , c = l.type; if (u !== et && oe.convert(u) !== le.getParameter(35739)) return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."); if (!(c === Ue || oe.convert(c) === le.getParameter(35738) || c === Xe && (H.isWebGL2 || G.get("OES_texture_float") || G.get("WEBGL_color_buffer_float")) || c === qe && (H.isWebGL2 ? G.get("EXT_color_buffer_float") : G.get("EXT_color_buffer_half_float")))) return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type."); 36053 === le.checkFramebufferStatus(36160) ? 0 <= t && t <= e.width - i && 0 <= n && n <= e.height - r && le.readPixels(t, n, i, r, oe.convert(u), oe.convert(c), a) : console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.") } finally { o && le.bindFramebuffer(36160, b) } } } else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.") } , this.copyFramebufferToTexture = function(e, t) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0 , i = Math.pow(2, -n) , r = Math.floor(t.image.width * i) , a = Math.floor(t.image.height * i) , i = oe.convert(t.format); X.setTexture2D(t, 0), le.copyTexImage2D(3553, n, i, e.x, e.y, r, a, 0), V.unbindTexture() } , this.copyTextureToTexture = function(e, t, n) { var i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0 , r = t.image.width , a = t.image.height , o = oe.convert(n.format) , s = oe.convert(n.type); X.setTexture2D(n, 0), le.pixelStorei(37440, n.flipY), le.pixelStorei(37441, n.premultiplyAlpha), le.pixelStorei(3317, n.unpackAlignment), t.isDataTexture ? le.texSubImage2D(3553, i, e.x, e.y, r, a, o, s, t.image.data) : t.isCompressedTexture ? le.compressedTexSubImage2D(3553, i, e.x, e.y, t.mipmaps[0].width, t.mipmaps[0].height, o, t.mipmaps[0].data) : le.texSubImage2D(3553, i, e.x, e.y, o, s, t.image), 0 === i && n.generateMipmaps && le.generateMipmap(3553), V.unbindTexture() } , this.initTexture = function(e) { X.setTexture2D(e, 0), V.unbindTexture() } , this.resetState = function() { V.reset(), se.reset() } , "undefined" != typeof __THREE_DEVTOOLS__ && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{ detail: this })) } function fs(e) { ps.call(this, e) } ls.prototype = Object.assign(Object.create($r.prototype), { constructor: ls, isArrayCamera: !0 }), us.prototype = Object.assign(Object.create(Si.prototype), { constructor: us, isGroup: !0 }), Object.assign(cs.prototype, { constructor: cs, getHandSpace: function() { if (null === this._hand && (this._hand = new us, this._hand.matrixAutoUpdate = !1, this._hand.visible = !1, this._hand.joints = [], this._hand.inputState = { pinching: !1 }, window.XRHand)) for (var e = 0; e <= window.XRHand.LITTLE_PHALANX_TIP; e++) { var t = new us; t.matrixAutoUpdate = !1, t.visible = !1, this._hand.joints.push(t), this._hand.add(t) } return this._hand }, getTargetRaySpace: function() { return null === this._targetRay && (this._targetRay = new us, this._targetRay.matrixAutoUpdate = !1, this._targetRay.visible = !1), this._targetRay }, getGripSpace: function() { return null === this._grip && (this._grip = new us, this._grip.matrixAutoUpdate = !1, this._grip.visible = !1), this._grip }, dispatchEvent: function(e) { return null !== this._targetRay && this._targetRay.dispatchEvent(e), null !== this._grip && this._grip.dispatchEvent(e), null !== this._hand && this._hand.dispatchEvent(e), this }, disconnect: function(e) { return this.dispatchEvent({ type: "disconnected", data: e }), null !== this._targetRay && (this._targetRay.visible = !1), null !== this._grip && (this._grip.visible = !1), null !== this._hand && (this._hand.visible = !1), this }, update: function(e, t, n) { var i = null , r = null , a = null , o = this._targetRay , s = this._grip , l = this._hand; if (e && "visible-blurred" !== t.session.visibilityState) if (l && e.hand) for (var u, c, a = !0, d = 0; d <= window.XRHand.LITTLE_PHALANX_TIP; d++) e.hand[d] && (c = t.getJointPose(e.hand[d], n), u = l.joints[d], null !== c && (u.matrix.fromArray(c.transform.matrix), u.matrix.decompose(u.position, u.rotation, u.scale), u.jointRadius = c.radius), u.visible = null !== c, u = l.joints[window.XRHand.INDEX_PHALANX_TIP], c = l.joints[window.XRHand.THUMB_PHALANX_TIP], c = u.position.distanceTo(c.position), l.inputState.pinching && .025 < c ? (l.inputState.pinching = !1, this.dispatchEvent({ type: "pinchend", handedness: e.handedness, target: this })) : !l.inputState.pinching && c <= .015 && (l.inputState.pinching = !0, this.dispatchEvent({ type: "pinchstart", handedness: e.handedness, target: this }))); else null !== o && null !== (i = t.getPose(e.targetRaySpace, n)) && (o.matrix.fromArray(i.transform.matrix), o.matrix.decompose(o.position, o.rotation, o.scale)), null !== s && e.gripSpace && null !== (r = t.getPose(e.gripSpace, n)) && (s.matrix.fromArray(r.transform.matrix), s.matrix.decompose(s.position, s.rotation, s.scale)); return null !== o && (o.visible = null !== i), null !== s && (s.visible = null !== r), null !== l && (l.visible = null !== a), this } }), Object.assign(ds.prototype, hn.prototype), fs.prototype = Object.assign(Object.create(ps.prototype), { constructor: fs, isWebGL1Renderer: !0 }); var ms = function() { function n(e, t) { O(this, n), Object.defineProperty(this, "isFogExp2", { value: !0 }), this.name = "", this.color = new Yi(e), this.density = void 0 !== t ? t : 25e-5 } return h(n, [{ key: "clone", value: function() { return new n(this.color,this.density) } }, { key: "toJSON", value: function() { return { type: "FogExp2", color: this.color.getHex(), density: this.density } } }]), n }() , vs = function() { function i(e, t, n) { O(this, i), Object.defineProperty(this, "isFog", { value: !0 }), this.name = "", this.color = new Yi(e), this.near = void 0 !== t ? t : 1, this.far = void 0 !== n ? n : 1e3 } return h(i, [{ key: "clone", value: function() { return new i(this.color,this.near,this.far) } }, { key: "toJSON", value: function() { return { type: "Fog", color: this.color.getHex(), near: this.near, far: this.far } } }]), i }() , gs = function() { y(n, Si); var t = w(n); function n() { var e; return O(this, n), e = t.call(this), Object.defineProperty(g(e), "isScene", { value: !0 }), e.type = "Scene", e.background = null, e.environment = null, e.fog = null, e.overrideMaterial = null, e.autoUpdate = !0, "undefined" != typeof __THREE_DEVTOOLS__ && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{ detail: g(e) })), e } return h(n, [{ key: "copy", value: function(e, t) { return b(v(n.prototype), "copy", this).call(this, e, t), null !== e.background && (this.background = e.background.clone()), null !== e.environment && (this.environment = e.environment.clone()), null !== e.fog && (this.fog = e.fog.clone()), null !== e.overrideMaterial && (this.overrideMaterial = e.overrideMaterial.clone()), this.autoUpdate = e.autoUpdate, this.matrixAutoUpdate = e.matrixAutoUpdate, this } }, { key: "toJSON", value: function(e) { var t = b(v(n.prototype), "toJSON", this).call(this, e); return null !== this.background && (t.object.background = this.background.toJSON(e)), null !== this.environment && (t.object.environment = this.environment.toJSON(e)), null !== this.fog && (t.object.fog = this.fog.toJSON()), t } }]), n }(); function ys(e, t) { this.array = e, this.stride = t, this.count = void 0 !== e ? e.length / t : 0, this.usage = un, this.updateRange = { offset: 0, count: -1 }, this.version = 0, this.uuid = gn.generateUUID() } Object.defineProperty(ys.prototype, "needsUpdate", { set: function(e) { !0 === e && this.version++ } }), Object.assign(ys.prototype, { isInterleavedBuffer: !0, onUploadCallback: function() {}, setUsage: function(e) { return this.usage = e, this }, copy: function(e) { return this.array = new e.array.constructor(e.array), this.count = e.count, this.stride = e.stride, this.usage = e.usage, this }, copyAt: function(e, t, n) { e *= this.stride, n *= t.stride; for (var i = 0, r = this.stride; i < r; i++) this.array[e + i] = t.array[n + i]; return this }, set: function(e) { return this.array.set(e, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0), this }, clone: function(e) { void 0 === e.arrayBuffers && (e.arrayBuffers = {}), void 0 === this.array.buffer._uuid && (this.array.buffer._uuid = gn.generateUUID()), void 0 === e.arrayBuffers[this.array.buffer._uuid] && (e.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer); e = new ys(new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),this.stride); return e.setUsage(this.usage), e }, onUpload: function(e) { return this.onUploadCallback = e, this }, toJSON: function(e) { return void 0 === e.arrayBuffers && (e.arrayBuffers = {}), void 0 === this.array.buffer._uuid && (this.array.buffer._uuid = gn.generateUUID()), void 0 === e.arrayBuffers[this.array.buffer._uuid] && (e.arrayBuffers[this.array.buffer._uuid] = Array.prototype.slice.call(new Uint32Array(this.array.buffer))), { uuid: this.uuid, buffer: this.array.buffer._uuid, type: this.array.constructor.name, stride: this.stride } } }); var ws, bs = new Cn; function xs(e, t, n, i) { this.name = "", this.data = e, this.itemSize = t, this.offset = n, this.normalized = !0 === i } function Es(e) { Ki.call(this), this.type = "SpriteMaterial", this.color = new Yi(16777215), this.map = null, this.alphaMap = null, this.rotation = 0, this.sizeAttenuation = !0, this.transparent = !0, this.setValues(e) } Object.defineProperties(xs.prototype, { count: { get: function() { return this.data.count } }, array: { get: function() { return this.data.array } }, needsUpdate: { set: function(e) { this.data.needsUpdate = e } } }), Object.assign(xs.prototype, { isInterleavedBufferAttribute: !0, applyMatrix4: function(e) { for (var t = 0, n = this.data.count; t < n; t++) bs.x = this.getX(t), bs.y = this.getY(t), bs.z = this.getZ(t), bs.applyMatrix4(e), this.setXYZ(t, bs.x, bs.y, bs.z); return this }, setX: function(e, t) { return this.data.array[e * this.data.stride + this.offset] = t, this }, setY: function(e, t) { return this.data.array[e * this.data.stride + this.offset + 1] = t, this }, setZ: function(e, t) { return this.data.array[e * this.data.stride + this.offset + 2] = t, this }, setW: function(e, t) { return this.data.array[e * this.data.stride + this.offset + 3] = t, this }, getX: function(e) { return this.data.array[e * this.data.stride + this.offset] }, getY: function(e) { return this.data.array[e * this.data.stride + this.offset + 1] }, getZ: function(e) { return this.data.array[e * this.data.stride + this.offset + 2] }, getW: function(e) { return this.data.array[e * this.data.stride + this.offset + 3] }, setXY: function(e, t, n) { return e = e * this.data.stride + this.offset, this.data.array[e + 0] = t, this.data.array[e + 1] = n, this }, setXYZ: function(e, t, n, i) { return e = e * this.data.stride + this.offset, this.data.array[e + 0] = t, this.data.array[e + 1] = n, this.data.array[e + 2] = i, this }, setXYZW: function(e, t, n, i, r) { return e = e * this.data.stride + this.offset, this.data.array[e + 0] = t, this.data.array[e + 1] = n, this.data.array[e + 2] = i, this.data.array[e + 3] = r, this }, clone: function(e) { if (void 0 !== e) return void 0 === e.interleavedBuffers && (e.interleavedBuffers = {}), void 0 === e.interleavedBuffers[this.data.uuid] && (e.interleavedBuffers[this.data.uuid] = this.data.clone(e)), new xs(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized); console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data."); for (var t = [], n = 0; n < this.count; n++) for (var i = n * this.data.stride + this.offset, r = 0; r < this.itemSize; r++) t.push(this.data.array[i + r]); return new nr(new this.array.constructor(t),this.itemSize,this.normalized) }, toJSON: function(e) { if (void 0 !== e) return void 0 === e.interleavedBuffers && (e.interleavedBuffers = {}), void 0 === e.interleavedBuffers[this.data.uuid] && (e.interleavedBuffers[this.data.uuid] = this.data.toJSON(e)), { isInterleavedBufferAttribute: !0, itemSize: this.itemSize, data: this.data.uuid, offset: this.offset, normalized: this.normalized }; console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data."); for (var t = [], n = 0; n < this.count; n++) for (var i = n * this.data.stride + this.offset, r = 0; r < this.itemSize; r++) t.push(this.data.array[i + r]); return { itemSize: this.itemSize, type: this.array.constructor.name, array: t, normalized: this.normalized } } }), ((Es.prototype = Object.create(Ki.prototype)).constructor = Es).prototype.isSpriteMaterial = !0, Es.prototype.copy = function(e) { return Ki.prototype.copy.call(this, e), this.color.copy(e.color), this.map = e.map, this.alphaMap = e.alphaMap, this.rotation = e.rotation, this.sizeAttenuation = e.sizeAttenuation, this } ; var _s = new Cn , Ms = new Cn , As = new Cn , Ts = new yn , Ss = new yn , Cs = new ni , Ps = new Cn , Ds = new Cn , ks = new Cn , Bs = new yn , Ls = new yn , Rs = new yn; function Fs(e) { var t; Si.call(this), this.type = "Sprite", void 0 === ws && (ws = new Mr, t = new ys(new Float32Array([-.5, -.5, 0, 0, 0, .5, -.5, 0, 1, 0, .5, .5, 0, 1, 1, -.5, .5, 0, 0, 1]),5), ws.setIndex([0, 1, 2, 0, 2, 3]), ws.setAttribute("position", new xs(t,3,0,!1)), ws.setAttribute("uv", new xs(t,2,3,!1))), this.geometry = ws, this.material = void 0 !== e ? e : new Es, this.center = new yn(.5,.5) } function Is(e, t, n, i, r, a) { Ts.subVectors(e, n).addScalar(.5).multiply(i), void 0 !== r ? (Ss.x = a * Ts.x - r * Ts.y, Ss.y = r * Ts.x + a * Ts.y) : Ss.copy(Ts), e.copy(t), e.x += Ss.x, e.y += Ss.y, e.applyMatrix4(Cs) } Fs.prototype = Object.assign(Object.create(Si.prototype), { constructor: Fs, isSprite: !0, raycast: function(e, t) { null === e.camera && console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'), Ms.setFromMatrixScale(this.matrixWorld), Cs.copy(e.camera.matrixWorld), this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse, this.matrixWorld), As.setFromMatrixPosition(this.modelViewMatrix), e.camera.isPerspectiveCamera && !1 === this.material.sizeAttenuation && Ms.multiplyScalar(-As.z); var n, i = this.material.rotation; 0 !== i && (r = Math.cos(i), n = Math.sin(i)); var r, i = this.center; Is(Ps.set(-.5, -.5, 0), As, i, Ms, n, r), Is(Ds.set(.5, -.5, 0), As, i, Ms, n, r), Is(ks.set(.5, .5, 0), As, i, Ms, n, r), Bs.set(0, 0), Ls.set(1, 0), Rs.set(1, 1), null === e.ray.intersectTriangle(Ps, Ds, ks, !1, _s) && (Is(Ds.set(-.5, .5, 0), As, i, Ms, n, r), Ls.set(0, 1), null === e.ray.intersectTriangle(Ps, ks, Ds, !1, _s)) || ((r = e.ray.origin.distanceTo(_s)) < e.near || r > e.far || t.push({ distance: r, point: _s.clone(), uv: Hi.getUV(_s, Ps, Ds, ks, Bs, Ls, Rs, new yn), face: null, object: this })) }, copy: function(e) { return Si.prototype.copy.call(this, e), void 0 !== e.center && this.center.copy(e.center), this.material = e.material, this } }); var Os = new Cn , zs = new Cn; function Ns() { Si.call(this), this._currentLevel = 0, this.type = "LOD", Object.defineProperties(this, { levels: { enumerable: !0, value: [] } }), this.autoUpdate = !0 } Ns.prototype = Object.assign(Object.create(Si.prototype), { constructor: Ns, isLOD: !0, copy: function(e) { Si.prototype.copy.call(this, e, !1); for (var t = e.levels, n = 0, i = t.length; n < i; n++) { var r = t[n]; this.addLevel(r.object.clone(), r.distance) } return this.autoUpdate = e.autoUpdate, this }, addLevel: function(e) { for (var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, t = Math.abs(t), n = this.levels, i = 0; i < n.length && !(t < n[i].distance); i++) ; return n.splice(i, 0, { distance: t, object: e }), this.add(e), this }, getCurrentLevel: function() { return this._currentLevel }, getObjectForDistance: function(e) { var t = this.levels; if (0 < t.length) { for (var n = 1, i = t.length; n < i && !(e < t[n].distance); n++) ; return t[n - 1].object } return null }, raycast: function(e, t) { var n; 0 < this.levels.length && (Os.setFromMatrixPosition(this.matrixWorld), n = e.ray.origin.distanceTo(Os), this.getObjectForDistance(n).raycast(e, t)) }, update: function(e) { var t = this.levels; if (1 < t.length) { Os.setFromMatrixPosition(e.matrixWorld), zs.setFromMatrixPosition(this.matrixWorld); var n, i, r = Os.distanceTo(zs) / e.zoom; for (t[0].object.visible = !0, n = 1, i = t.length; n < i && r >= t[n].distance; n++) t[n - 1].object.visible = !1, t[n].object.visible = !0; for (this._currentLevel = n - 1; n < i; n++) t[n].object.visible = !1 } }, toJSON: function(e) { var t = Si.prototype.toJSON.call(this, e); !1 === this.autoUpdate && (t.object.autoUpdate = !1), t.object.levels = []; for (var n = this.levels, i = 0, r = n.length; i < r; i++) { var a = n[i]; t.object.levels.push({ object: a.object.uuid, distance: a.distance }) } return t } }); var Us = new Cn , Gs = new Mn , Hs = new Mn , Vs = new Cn , js = new ni; function Ws(e, t) { e && e.isGeometry && console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."), Hr.call(this, e, t), this.type = "SkinnedMesh", this.bindMode = "attached", this.bindMatrix = new ni, this.bindMatrixInverse = new ni } function Xs() { Si.call(this), this.type = "Bone" } Ws.prototype = Object.assign(Object.create(Hr.prototype), { constructor: Ws, isSkinnedMesh: !0, copy: function(e) { return Hr.prototype.copy.call(this, e), this.bindMode = e.bindMode, this.bindMatrix.copy(e.bindMatrix), this.bindMatrixInverse.copy(e.bindMatrixInverse), this.skeleton = e.skeleton, this }, bind: function(e, t) { this.skeleton = e, void 0 === t && (this.updateMatrixWorld(!0), this.skeleton.calculateInverses(), t = this.matrixWorld), this.bindMatrix.copy(t), this.bindMatrixInverse.copy(t).invert() }, pose: function() { this.skeleton.pose() }, normalizeSkinWeights: function() { for (var e = new Mn, t = this.geometry.attributes.skinWeight, n = 0, i = t.count; n < i; n++) { e.x = t.getX(n), e.y = t.getY(n), e.z = t.getZ(n), e.w = t.getW(n); var r = 1 / e.manhattanLength(); r != 1 / 0 ? e.multiplyScalar(r) : e.set(1, 0, 0, 0), t.setXYZW(n, e.x, e.y, e.z, e.w) } }, updateMatrixWorld: function(e) { Hr.prototype.updateMatrixWorld.call(this, e), "attached" === this.bindMode ? this.bindMatrixInverse.copy(this.matrixWorld).invert() : "detached" === this.bindMode ? this.bindMatrixInverse.copy(this.bindMatrix).invert() : console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode) }, boneTransform: function(e, t) { var n = this.skeleton , i = this.geometry; Gs.fromBufferAttribute(i.attributes.skinIndex, e), Hs.fromBufferAttribute(i.attributes.skinWeight, e), Us.fromBufferAttribute(i.attributes.position, e).applyMatrix4(this.bindMatrix), t.set(0, 0, 0); for (var r = 0; r < 4; r++) { var a, o = Hs.getComponent(r); 0 !== o && (a = Gs.getComponent(r), js.multiplyMatrices(n.bones[a].matrixWorld, n.boneInverses[a]), t.addScaledVector(Vs.copy(Us).applyMatrix4(js), o)) } return t.applyMatrix4(this.bindMatrixInverse) } }), Xs.prototype = Object.assign(Object.create(Si.prototype), { constructor: Xs, isBone: !0 }); var qs = new ni , Js = new ni; function Ys() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [] , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; this.uuid = gn.generateUUID(), this.bones = e.slice(0), this.boneInverses = t, this.boneMatrices = null, this.boneTexture = null, this.boneTextureSize = 0, this.frame = -1, this.init() } Object.assign(Ys.prototype, { init: function() { var e = this.bones , t = this.boneInverses; if (this.boneMatrices = new Float32Array(16 * e.length), 0 === t.length) this.calculateInverses(); else if (e.length !== t.length) { console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."), this.boneInverses = []; for (var n = 0, i = this.bones.length; n < i; n++) this.boneInverses.push(new ni) } }, calculateInverses: function() { for (var e = this.boneInverses.length = 0, t = this.bones.length; e < t; e++) { var n = new ni; this.bones[e] && n.copy(this.bones[e].matrixWorld).invert(), this.boneInverses.push(n) } }, pose: function() { for (var e = 0, t = this.bones.length; e < t; e++) { var n = this.bones[e]; n && n.matrixWorld.copy(this.boneInverses[e]).invert() } for (var i = 0, r = this.bones.length; i < r; i++) { var a = this.bones[i]; a && (a.parent && a.parent.isBone ? (a.matrix.copy(a.parent.matrixWorld).invert(), a.matrix.multiply(a.matrixWorld)) : a.matrix.copy(a.matrixWorld), a.matrix.decompose(a.position, a.quaternion, a.scale)) } }, update: function() { for (var e = this.bones, t = this.boneInverses, n = this.boneMatrices, i = this.boneTexture, r = 0, a = e.length; r < a; r++) { var o = e[r] ? e[r].matrixWorld : Js; qs.multiplyMatrices(o, t[r]), qs.toArray(n, 16 * r) } null !== i && (i.needsUpdate = !0) }, clone: function() { return new Ys(this.bones,this.boneInverses) }, getBoneByName: function(e) { for (var t = 0, n = this.bones.length; t < n; t++) { var i = this.bones[t]; if (i.name === e) return i } }, dispose: function() { null !== this.boneTexture && (this.boneTexture.dispose(), this.boneTexture = null) }, fromJSON: function(e, t) { this.uuid = e.uuid; for (var n = 0, i = e.bones.length; n < i; n++) { var r = e.bones[n] , a = t[r]; void 0 === a && (console.warn("THREE.Skeleton: No bone found with UUID:", r), a = new Xs), this.bones.push(a), this.boneInverses.push((new ni).fromArray(e.boneInverses[n])) } return this.init(), this }, toJSON: function() { var e = { metadata: { version: 4.5, type: "Skeleton", generator: "Skeleton.toJSON" }, bones: [], boneInverses: [] }; e.uuid = this.uuid; for (var t = this.bones, n = this.boneInverses, i = 0, r = t.length; i < r; i++) { var a = t[i]; e.bones.push(a.uuid); a = n[i]; e.boneInverses.push(a.toArray()) } return e } }); var Zs = new ni , Qs = new ni , Ks = [] , $s = new Hr; function el(e, t, n) { Hr.call(this, e, t), this.instanceMatrix = new nr(new Float32Array(16 * n),16), this.instanceColor = null, this.count = n, this.frustumCulled = !1 } function tl(e) { Ki.call(this), this.type = "LineBasicMaterial", this.color = new Yi(16777215), this.lineWidth = 1, this.linecap = "round", this.linejoin = "round", this.morphTargets = !1, this.setValues(e) } el.prototype = Object.assign(Object.create(Hr.prototype), { constructor: el, isInstancedMesh: !0, copy: function(e) { return Hr.prototype.copy.call(this, e), this.instanceMatrix.copy(e.instanceMatrix), this.count = e.count, this }, getColorAt: function(e, t) { t.fromArray(this.instanceColor.array, 3 * e) }, getMatrixAt: function(e, t) { t.fromArray(this.instanceMatrix.array, 16 * e) }, raycast: function(e, t) { var n = this.matrixWorld , i = this.count; if ($s.geometry = this.geometry, $s.material = this.material, void 0 !== $s.material) for (var r = 0; r < i; r++) { this.getMatrixAt(r, Zs), Qs.multiplyMatrices(n, Zs), $s.matrixWorld = Qs, $s.raycast(e, Ks); for (var a = 0, o = Ks.length; a < o; a++) { var s = Ks[a]; s.instanceId = r, s.object = this, t.push(s) } Ks.length = 0 } }, setColorAt: function(e, t) { null === this.instanceColor && (this.instanceColor = new nr(new Float32Array(3 * this.count),3)), t.toArray(this.instanceColor.array, 3 * e) }, setMatrixAt: function(e, t) { t.toArray(this.instanceMatrix.array, 16 * e) }, updateMorphTargets: function() {}, dispose: function() { this.dispatchEvent({ type: "dispose" }) } }), ((tl.prototype = Object.create(Ki.prototype)).constructor = tl).prototype.isLineBasicMaterial = !0, tl.prototype.copy = function(e) { return Ki.prototype.copy.call(this, e), this.color.copy(e.color), this.lineWidth = e.lineWidth, this.linecap = e.linecap, this.linejoin = e.linejoin, this.morphTargets = e.morphTargets, this } ; var nl = new Cn , il = new Cn , rl = new ni , al = new ti , ol = new qn; function sl() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new Mr , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new tl; Si.call(this), this.type = "Line", this.geometry = e, this.material = t, this.updateMorphTargets() } sl.prototype = Object.assign(Object.create(Si.prototype), { constructor: sl, isLine: !0, copy: function(e) { return Si.prototype.copy.call(this, e), this.material = e.material, this.geometry = e.geometry, this }, computeLineDistances: function() { var e = this.geometry; if (e.isBufferGeometry) if (null === e.index) { for (var t = e.attributes.position, n = [0], i = 1, r = t.count; i < r; i++) nl.fromBufferAttribute(t, i - 1), il.fromBufferAttribute(t, i), n[i] = n[i - 1], n[i] += nl.distanceTo(il); e.setAttribute("lineDistance", new dr(n,1)) } else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); else if (e.isGeometry) { var a = e.vertices , o = e.lineDistances; o[0] = 0; for (var s = 1, l = a.length; s < l; s++) o[s] = o[s - 1], o[s] += a[s - 1].distanceTo(a[s]) } return this }, raycast: function(e, t) { var n = this.geometry , i = this.matrixWorld , r = e.params.Line.threshold; if (null === n.boundingSphere && n.computeBoundingSphere(), ol.copy(n.boundingSphere), ol.applyMatrix4(i), ol.radius += r, !1 !== e.ray.intersectsSphere(ol)) { rl.copy(i).invert(), al.copy(e.ray).applyMatrix4(rl); var r = r / ((this.scale.x + this.scale.y + this.scale.z) / 3) , a = r * r , o = new Cn , s = new Cn , l = new Cn , u = new Cn , c = this.isLineSegments ? 2 : 1; if (n.isBufferGeometry) { var r = n.index , d = n.attributes.position; if (null !== r) for (var h = r.array, p = 0, f = h.length - 1; p < f; p += c) { var m = h[p] , v = h[p + 1]; o.fromBufferAttribute(d, m), s.fromBufferAttribute(d, v), a < al.distanceSqToSegment(o, s, u, l) || (u.applyMatrix4(this.matrixWorld), (v = e.ray.origin.distanceTo(u)) < e.near || v > e.far || t.push({ distance: v, point: l.clone().applyMatrix4(this.matrixWorld), index: p, face: null, faceIndex: null, object: this })) } else for (var g, y = 0, w = d.count - 1; y < w; y += c) o.fromBufferAttribute(d, y), s.fromBufferAttribute(d, y + 1), a < al.distanceSqToSegment(o, s, u, l) || (u.applyMatrix4(this.matrixWorld), (g = e.ray.origin.distanceTo(u)) < e.near || g > e.far || t.push({ distance: g, point: l.clone().applyMatrix4(this.matrixWorld), index: y, face: null, faceIndex: null, object: this })) } else if (n.isGeometry) for (var b, x = n.vertices, E = x.length, _ = 0; _ < E - 1; _ += c) a < al.distanceSqToSegment(x[_], x[_ + 1], u, l) || (u.applyMatrix4(this.matrixWorld), (b = e.ray.origin.distanceTo(u)) < e.near || b > e.far || t.push({ distance: b, point: l.clone().applyMatrix4(this.matrixWorld), index: _, face: null, faceIndex: null, object: this })) } }, updateMorphTargets: function() { var e = this.geometry; if (e.isBufferGeometry) { var t = e.morphAttributes , n = Object.keys(t); if (0 < n.length) { var i = t[n[0]]; if (void 0 !== i) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (var r = 0, a = i.length; r < a; r++) { var o = i[r].name || String(r); this.morphTargetInfluences.push(0), this.morphTargetDictionary[o] = r } } } } else { e = e.morphTargets; void 0 !== e && 0 < e.length && console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.") } } }); var ll = new Cn , ul = new Cn; function cl(e, t) { sl.call(this, e, t), this.type = "LineSegments" } function dl(e, t) { sl.call(this, e, t), this.type = "LineLoop" } function hl(e) { Ki.call(this), this.type = "PointsMaterial", this.color = new Yi(16777215), this.map = null, this.alphaMap = null, this.size = 1, this.sizeAttenuation = !0, this.morphTargets = !1, this.setValues(e) } cl.prototype = Object.assign(Object.create(sl.prototype), { constructor: cl, isLineSegments: !0, computeLineDistances: function() { var e = this.geometry; if (e.isBufferGeometry) if (null === e.index) { for (var t = e.attributes.position, n = [], i = 0, r = t.count; i < r; i += 2) ll.fromBufferAttribute(t, i), ul.fromBufferAttribute(t, i + 1), n[i] = 0 === i ? 0 : n[i - 1], n[i + 1] = n[i] + ll.distanceTo(ul); e.setAttribute("lineDistance", new dr(n,1)) } else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); else if (e.isGeometry) for (var a = e.vertices, o = e.lineDistances, s = 0, l = a.length; s < l; s += 2) ll.copy(a[s]), ul.copy(a[s + 1]), o[s] = 0 === s ? 0 : o[s - 1], o[s + 1] = o[s] + ll.distanceTo(ul); return this } }), dl.prototype = Object.assign(Object.create(sl.prototype), { constructor: dl, isLineLoop: !0 }), ((hl.prototype = Object.create(Ki.prototype)).constructor = hl).prototype.isPointsMaterial = !0, hl.prototype.copy = function(e) { return Ki.prototype.copy.call(this, e), this.color.copy(e.color), this.map = e.map, this.alphaMap = e.alphaMap, this.size = e.size, this.sizeAttenuation = e.sizeAttenuation, this.morphTargets = e.morphTargets, this } ; var pl = new ni , fl = new ti , ml = new qn , vl = new Cn; function gl() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new Mr , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new hl; Si.call(this), this.type = "Points", this.geometry = e, this.material = t, this.updateMorphTargets() } function yl(e, t, n, i, r, a, o) { var s = fl.distanceSqToPoint(e); s < n && (n = new Cn, fl.closestPointToPoint(e, n), n.applyMatrix4(i), (i = r.ray.origin.distanceTo(n)) < r.near || i > r.far || a.push({ distance: i, distanceToRay: Math.sqrt(s), point: n, index: t, face: null, object: o })) } function wl(t, e, n, i, r, a, o, s, l) { En.call(this, t, e, n, i, r, a, o, s, l), this.format = void 0 !== o ? o : $e, this.minFilter = void 0 !== a ? a : Oe, this.magFilter = void 0 !== r ? r : Oe, this.generateMipmaps = !1; var u = this; "requestVideoFrameCallback"in t && t.requestVideoFrameCallback(function e() { u.needsUpdate = !0, t.requestVideoFrameCallback(e) }) } function bl(e, t, n, i, r, a, o, s, l, u, c, d) { En.call(this, null, a, o, s, l, u, i, r, c, d), this.image = { width: t, height: n }, this.mipmaps = e, this.flipY = !1, this.generateMipmaps = !1 } function xl(e, t, n, i, r, a, o, s, l) { En.call(this, e, t, n, i, r, a, o, s, l), this.needsUpdate = !0 } function El(e, t, n, i, r, a, o, s, l, u) { if ((u = void 0 !== u ? u : rt) !== rt && u !== at) throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat"); En.call(this, null, i, r, a, o, s, u, n = void 0 === (n = void 0 === n && u === rt ? Ve : n) && u === at ? Qe : n, l), this.image = { width: e, height: t }, this.magFilter = void 0 !== o ? o : Re, this.minFilter = void 0 !== s ? s : Re, this.flipY = !1, this.generateMipmaps = !1 } gl.prototype = Object.assign(Object.create(Si.prototype), { constructor: gl, isPoints: !0, copy: function(e) { return Si.prototype.copy.call(this, e), this.material = e.material, this.geometry = e.geometry, this }, raycast: function(e, t) { var n = this.geometry , i = this.matrixWorld , r = e.params.Points.threshold; if (null === n.boundingSphere && n.computeBoundingSphere(), ml.copy(n.boundingSphere), ml.applyMatrix4(i), ml.radius += r, !1 !== e.ray.intersectsSphere(ml)) { pl.copy(i).invert(), fl.copy(e.ray).applyMatrix4(pl); var r = r / ((this.scale.x + this.scale.y + this.scale.z) / 3) , a = r * r; if (n.isBufferGeometry) { var r = n.index , o = n.attributes.position; if (null !== r) for (var s = r.array, l = 0, u = s.length; l < u; l++) { var c = s[l]; vl.fromBufferAttribute(o, c), yl(vl, c, a, i, e, t, this) } else for (var d = 0, h = o.count; d < h; d++) vl.fromBufferAttribute(o, d), yl(vl, d, a, i, e, t, this) } else for (var p = n.vertices, f = 0, m = p.length; f < m; f++) yl(p[f], f, a, i, e, t, this) } }, updateMorphTargets: function() { var e = this.geometry; if (e.isBufferGeometry) { var t = e.morphAttributes , n = Object.keys(t); if (0 < n.length) { var i = t[n[0]]; if (void 0 !== i) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (var r = 0, a = i.length; r < a; r++) { var o = i[r].name || String(r); this.morphTargetInfluences.push(0), this.morphTargetDictionary[o] = r } } } } else { e = e.morphTargets; void 0 !== e && 0 < e.length && console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.") } } }), wl.prototype = Object.assign(Object.create(En.prototype), { constructor: wl, clone: function() { return new this.constructor(this.image).copy(this) }, isVideoTexture: !0, update: function() { var e = this.image; !1 == "requestVideoFrameCallback"in e && e.readyState >= e.HAVE_CURRENT_DATA && (this.needsUpdate = !0) } }), ((bl.prototype = Object.create(En.prototype)).constructor = bl).prototype.isCompressedTexture = !0, ((xl.prototype = Object.create(En.prototype)).constructor = xl).prototype.isCanvasTexture = !0, ((El.prototype = Object.create(En.prototype)).constructor = El).prototype.isDepthTexture = !0; var _l = 0 , Ml = new ni , Al = new Si , Tl = new Cn; function Sl() { Object.defineProperty(this, "id", { value: _l += 2 }), this.uuid = gn.generateUUID(), this.name = "", this.type = "Geometry", this.vertices = [], this.colors = [], this.faces = [], this.faceVertexUvs = [[]], this.morphTargets = [], this.morphNormals = [], this.skinWeights = [], this.skinIndices = [], this.lineDistances = [], this.boundingBox = null, this.boundingSphere = null, this.elementsNeedUpdate = !1, this.verticesNeedUpdate = !1, this.uvsNeedUpdate = !1, this.normalsNeedUpdate = !1, this.colorsNeedUpdate = !1, this.lineDistancesNeedUpdate = !1, this.groupsNeedUpdate = !1 } Sl.prototype = Object.assign(Object.create(hn.prototype), { constructor: Sl, isGeometry: !0, applyMatrix4: function(e) { for (var t = (new wn).getNormalMatrix(e), n = 0, i = this.vertices.length; n < i; n++) this.vertices[n].applyMatrix4(e); for (var r = 0, a = this.faces.length; r < a; r++) { var o = this.faces[r]; o.normal.applyMatrix3(t).normalize(); for (var s = 0, l = o.vertexNormals.length; s < l; s++) o.vertexNormals[s].applyMatrix3(t).normalize() } return null !== this.boundingBox && this.computeBoundingBox(), null !== this.boundingSphere && this.computeBoundingSphere(), this.verticesNeedUpdate = !0, this.normalsNeedUpdate = !0, this }, rotateX: function(e) { return Ml.makeRotationX(e), this.applyMatrix4(Ml), this }, rotateY: function(e) { return Ml.makeRotationY(e), this.applyMatrix4(Ml), this }, rotateZ: function(e) { return Ml.makeRotationZ(e), this.applyMatrix4(Ml), this }, translate: function(e, t, n) { return Ml.makeTranslation(e, t, n), this.applyMatrix4(Ml), this }, scale: function(e, t, n) { return Ml.makeScale(e, t, n), this.applyMatrix4(Ml), this }, lookAt: function(e) { return Al.lookAt(e), Al.updateMatrix(), this.applyMatrix4(Al.matrix), this }, fromBufferGeometry: function(e) { var o = this , t = null !== e.index ? e.index : void 0 , n = e.attributes; if (void 0 === n.position) return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."), this; var i = n.position , s = n.normal , l = n.color , u = n.uv , c = n.uv2; void 0 !== c && (this.faceVertexUvs[1] = []); for (var r = 0; r < i.count; r++) o.vertices.push((new Cn).fromBufferAttribute(i, r)), void 0 !== l && o.colors.push((new Yi).fromBufferAttribute(l, r)); function a(e, t, n, i) { var r = void 0 === l ? [] : [o.colors[e].clone(), o.colors[t].clone(), o.colors[n].clone()] , a = void 0 === s ? [] : [(new Cn).fromBufferAttribute(s, e), (new Cn).fromBufferAttribute(s, t), (new Cn).fromBufferAttribute(s, n)] , i = new Zi(e,t,n,a,r,i); o.faces.push(i), void 0 !== u && o.faceVertexUvs[0].push([(new yn).fromBufferAttribute(u, e), (new yn).fromBufferAttribute(u, t), (new yn).fromBufferAttribute(u, n)]), void 0 !== c && o.faceVertexUvs[1].push([(new yn).fromBufferAttribute(c, e), (new yn).fromBufferAttribute(c, t), (new yn).fromBufferAttribute(c, n)]) } var d = e.groups; if (0 < d.length) for (var h = 0; h < d.length; h++) for (var p = d[h], f = p.start, m = f, v = f + p.count; m < v; m += 3) void 0 !== t ? a(t.getX(m), t.getX(m + 1), t.getX(m + 2), p.materialIndex) : a(m, m + 1, m + 2, p.materialIndex); else if (void 0 !== t) for (var g = 0; g < t.count; g += 3) a(t.getX(g), t.getX(g + 1), t.getX(g + 2)); else for (var y = 0; y < i.count; y += 3) a(y, y + 1, y + 2); return this.computeFaceNormals(), null !== e.boundingBox && (this.boundingBox = e.boundingBox.clone()), null !== e.boundingSphere && (this.boundingSphere = e.boundingSphere.clone()), this }, center: function() { return this.computeBoundingBox(), this.boundingBox.getCenter(Tl).negate(), this.translate(Tl.x, Tl.y, Tl.z), this }, normalize: function() { this.computeBoundingSphere(); var e = this.boundingSphere.center , t = this.boundingSphere.radius , n = 0 === t ? 1 : 1 / t , t = new ni; return t.set(n, 0, 0, -n * e.x, 0, n, 0, -n * e.y, 0, 0, n, -n * e.z, 0, 0, 0, 1), this.applyMatrix4(t), this }, computeFaceNormals: function() { for (var e = new Cn, t = new Cn, n = 0, i = this.faces.length; n < i; n++) { var r = this.faces[n] , a = this.vertices[r.a] , o = this.vertices[r.b] , s = this.vertices[r.c]; e.subVectors(s, o), t.subVectors(a, o), e.cross(t), e.normalize(), r.normal.copy(e) } }, computeVertexNormals: function() { for (var e = !(0 < arguments.length && void 0 !== arguments[0]) || arguments[0], t = new Array(this.vertices.length), n = 0, i = this.vertices.length; n < i; n++) t[n] = new Cn; if (e) for (var r = new Cn, a = new Cn, o = 0, s = this.faces.length; o < s; o++) { var l = this.faces[o] , u = this.vertices[l.a] , c = this.vertices[l.b] , d = this.vertices[l.c]; r.subVectors(d, c), a.subVectors(u, c), r.cross(a), t[l.a].add(r), t[l.b].add(r), t[l.c].add(r) } else { this.computeFaceNormals(); for (var h = 0, p = this.faces.length; h < p; h++) { var f = this.faces[h]; t[f.a].add(f.normal), t[f.b].add(f.normal), t[f.c].add(f.normal) } } for (var m = 0, v = this.vertices.length; m < v; m++) t[m].normalize(); for (var g = 0, y = this.faces.length; g < y; g++) { var w = this.faces[g] , b = w.vertexNormals; 3 === b.length ? (b[0].copy(t[w.a]), b[1].copy(t[w.b]), b[2].copy(t[w.c])) : (b[0] = t[w.a].clone(), b[1] = t[w.b].clone(), b[2] = t[w.c].clone()) } 0 < this.faces.length && (this.normalsNeedUpdate = !0) }, computeFlatVertexNormals: function() { this.computeFaceNormals(); for (var e = 0, t = this.faces.length; e < t; e++) { var n = this.faces[e] , i = n.vertexNormals; 3 === i.length ? (i[0].copy(n.normal), i[1].copy(n.normal), i[2].copy(n.normal)) : (i[0] = n.normal.clone(), i[1] = n.normal.clone(), i[2] = n.normal.clone()) } 0 < this.faces.length && (this.normalsNeedUpdate = !0) }, computeMorphNormals: function() { for (var e = 0, t = this.faces.length; e < t; e++) { var n = this.faces[e]; n.__originalFaceNormal ? n.__originalFaceNormal.copy(n.normal) : n.__originalFaceNormal = n.normal.clone(), n.__originalVertexNormals || (n.__originalVertexNormals = []); for (var i = 0, r = n.vertexNormals.length; i < r; i++) n.__originalVertexNormals[i] ? n.__originalVertexNormals[i].copy(n.vertexNormals[i]) : n.__originalVertexNormals[i] = n.vertexNormals[i].clone() } var a = new Sl; a.faces = this.faces; for (var o = 0, s = this.morphTargets.length; o < s; o++) { if (!this.morphNormals[o]) { this.morphNormals[o] = {}, this.morphNormals[o].faceNormals = [], this.morphNormals[o].vertexNormals = []; for (var l = this.morphNormals[o].faceNormals, u = this.morphNormals[o].vertexNormals, c = 0, d = this.faces.length; c < d; c++) { var h = new Cn , p = { a: new Cn, b: new Cn, c: new Cn }; l.push(h), u.push(p) } } var f = this.morphNormals[o]; a.vertices = this.morphTargets[o].vertices, a.computeFaceNormals(), a.computeVertexNormals(); for (var m = 0, v = this.faces.length; m < v; m++) { var g = this.faces[m] , y = f.faceNormals[m] , w = f.vertexNormals[m]; y.copy(g.normal), w.a.copy(g.vertexNormals[0]), w.b.copy(g.vertexNormals[1]), w.c.copy(g.vertexNormals[2]) } } for (var b = 0, x = this.faces.length; b < x; b++) { var E = this.faces[b]; E.normal = E.__originalFaceNormal, E.vertexNormals = E.__originalVertexNormals } }, computeBoundingBox: function() { null === this.boundingBox && (this.boundingBox = new kn), this.boundingBox.setFromPoints(this.vertices) }, computeBoundingSphere: function() { null === this.boundingSphere && (this.boundingSphere = new qn), this.boundingSphere.setFromPoints(this.vertices) }, merge: function(e, t) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0; if (e && e.isGeometry) { var i, r = this.vertices.length, a = this.vertices, o = e.vertices, s = this.faces, l = e.faces, u = this.colors, c = e.colors; void 0 !== t && (i = (new wn).getNormalMatrix(t)); for (var d = 0, h = o.length; d < h; d++) { var p = o[d].clone(); void 0 !== t && p.applyMatrix4(t), a.push(p) } for (var f = 0, m = c.length; f < m; f++) u.push(c[f].clone()); for (var v = 0, g = l.length; v < g; v++) { var y = l[v] , w = void 0 , b = void 0 , x = y.vertexNormals , E = y.vertexColors , _ = new Zi(y.a + r,y.b + r,y.c + r); _.normal.copy(y.normal), void 0 !== i && _.normal.applyMatrix3(i).normalize(); for (var M = 0, A = x.length; M < A; M++) w = x[M].clone(), void 0 !== i && w.applyMatrix3(i).normalize(), _.vertexNormals.push(w); _.color.copy(y.color); for (var T = 0, S = E.length; T < S; T++) b = E[T], _.vertexColors.push(b.clone()); _.materialIndex = y.materialIndex + n, s.push(_) } for (var C = 0, P = e.faceVertexUvs.length; C < P; C++) { var D = e.faceVertexUvs[C]; void 0 === this.faceVertexUvs[C] && (this.faceVertexUvs[C] = []); for (var k = 0, B = D.length; k < B; k++) { for (var L = D[k], R = [], F = 0, I = L.length; F < I; F++) R.push(L[F].clone()); this.faceVertexUvs[C].push(R) } } } else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.", e) }, mergeMesh: function(e) { e && e.isMesh ? (e.matrixAutoUpdate && e.updateMatrix(), this.merge(e.geometry, e.matrix)) : console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.", e) }, mergeVertices: function() { for (var e = {}, t = [], n = [], i = Math.pow(10, 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 4), r = 0, a = this.vertices.length; r < a; r++) { var o = this.vertices[r] , o = Math.round(o.x * i) + "_" + Math.round(o.y * i) + "_" + Math.round(o.z * i); void 0 === e[o] ? (e[o] = r, t.push(this.vertices[r]), n[r] = t.length - 1) : n[r] = n[e[o]] } for (var s = [], l = 0, u = this.faces.length; l < u; l++) { var c = this.faces[l]; c.a = n[c.a], c.b = n[c.b], c.c = n[c.c]; for (var d = [c.a, c.b, c.c], h = 0; h < 3; h++) if (d[h] === d[(h + 1) % 3]) { s.push(l); break } } for (var p = s.length - 1; 0 <= p; p--) { var f = s[p]; this.faces.splice(f, 1); for (var m = 0, v = this.faceVertexUvs.length; m < v; m++) this.faceVertexUvs[m].splice(f, 1) } var g = this.vertices.length - t.length; return this.vertices = t, g }, setFromPoints: function(e) { this.vertices = []; for (var t = 0, n = e.length; t < n; t++) { var i = e[t]; this.vertices.push(new Cn(i.x,i.y,i.z || 0)) } return this }, sortFacesByMaterialIndex: function() { for (var e = this.faces, t = e.length, n = 0; n < t; n++) e[n]._id = n; e.sort(function(e, t) { return e.materialIndex - t.materialIndex }); var i, r, a = this.faceVertexUvs[0], o = this.faceVertexUvs[1]; a && a.length === t && (i = []), o && o.length === t && (r = []); for (var s = 0; s < t; s++) { var l = e[s]._id; i && i.push(a[l]), r && r.push(o[l]) } i && (this.faceVertexUvs[0] = i), r && (this.faceVertexUvs[1] = r) }, toJSON: function() { var e = { metadata: { version: 4.5, type: "Geometry", generator: "Geometry.toJSON" } }; if (e.uuid = this.uuid, e.type = this.type, "" !== this.name && (e.name = this.name), void 0 !== this.parameters) { var t, n = this.parameters; for (t in n) void 0 !== n[t] && (e[t] = n[t]); return e } for (var i = [], r = 0; r < this.vertices.length; r++) { var a = this.vertices[r]; i.push(a.x, a.y, a.z) } for (var o = [], s = [], l = {}, u = [], c = {}, d = [], h = {}, p = 0; p < this.faces.length; p++) { var f, m = this.faces[p], v = void 0 !== this.faceVertexUvs[0][p], g = 0 < m.normal.length(), y = 0 < m.vertexNormals.length, w = 1 !== m.color.r || 1 !== m.color.g || 1 !== m.color.b, b = 0 < m.vertexColors.length; f = x(2, 3, v), f = x(f, 4, g), f = x(f, 5, y), f = x(f, 6, w), f = x(f, 7, b), o.push(f), o.push(m.a, m.b, m.c), o.push(m.materialIndex), v && (v = this.faceVertexUvs[0][p], o.push(M(v[0]), M(v[1]), M(v[2]))), g && o.push(E(m.normal)), y && (y = m.vertexNormals, o.push(E(y[0]), E(y[1]), E(y[2]))), w && o.push(_(m.color)), b && (m = m.vertexColors, o.push(_(m[0]), _(m[1]), _(m[2]))) } function x(e, t, n) { return n ? e | 1 << t : e & ~(1 << t) } function E(e) { var t = e.x.toString() + e.y.toString() + e.z.toString(); return void 0 !== l[t] || (l[t] = s.length / 3, s.push(e.x, e.y, e.z)), l[t] } function _(e) { var t = e.r.toString() + e.g.toString() + e.b.toString(); return void 0 !== c[t] || (c[t] = u.length, u.push(e.getHex())), c[t] } function M(e) { var t = e.x.toString() + e.y.toString(); return void 0 !== h[t] || (h[t] = d.length / 2, d.push(e.x, e.y)), h[t] } return e.data = {}, e.data.vertices = i, e.data.normals = s, 0 < u.length && (e.data.colors = u), 0 < d.length && (e.data.uvs = [d]), e.data.faces = o, e }, clone: function() { return (new Sl).copy(this) }, copy: function(e) { 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.name = e.name; for (var t = e.vertices, n = 0, i = t.length; n < i; n++) this.vertices.push(t[n].clone()); for (var r = e.colors, a = 0, o = r.length; a < o; a++) this.colors.push(r[a].clone()); for (var s = e.faces, l = 0, u = s.length; l < u; l++) this.faces.push(s[l].clone()); for (var c = 0, d = e.faceVertexUvs.length; c < d; c++) { var h = e.faceVertexUvs[c]; void 0 === this.faceVertexUvs[c] && (this.faceVertexUvs[c] = []); for (var p = 0, f = h.length; p < f; p++) { for (var m = h[p], v = [], g = 0, y = m.length; g < y; g++) { var w = m[g]; v.push(w.clone()) } this.faceVertexUvs[c].push(v) } } for (var b = e.morphTargets, x = 0, E = b.length; x < E; x++) { var _ = {}; if (_.name = b[x].name, void 0 !== b[x].vertices) { _.vertices = []; for (var M = 0, A = b[x].vertices.length; M < A; M++) _.vertices.push(b[x].vertices[M].clone()) } if (void 0 !== b[x].normals) { _.normals = []; for (var T = 0, S = b[x].normals.length; T < S; T++) _.normals.push(b[x].normals[T].clone()) } this.morphTargets.push(_) } for (var C = e.morphNormals, P = 0, D = C.length; P < D; P++) { var k = {}; if (void 0 !== C[P].vertexNormals) { k.vertexNormals = []; for (var B = 0, L = C[P].vertexNormals.length; B < L; B++) { var R = C[P].vertexNormals[B] , F = {}; F.a = R.a.clone(), F.b = R.b.clone(), F.c = R.c.clone(), k.vertexNormals.push(F) } } if (void 0 !== C[P].faceNormals) { k.faceNormals = []; for (var I = 0, O = C[P].faceNormals.length; I < O; I++) k.faceNormals.push(C[P].faceNormals[I].clone()) } this.morphNormals.push(k) } for (var z = e.skinWeights, N = 0, U = z.length; N < U; N++) this.skinWeights.push(z[N].clone()); for (var G = e.skinIndices, H = 0, V = G.length; H < V; H++) this.skinIndices.push(G[H].clone()); for (var j = e.lineDistances, W = 0, X = j.length; W < X; W++) this.lineDistances.push(j[W]); var q = e.boundingBox; null !== q && (this.boundingBox = q.clone()); q = e.boundingSphere; return null !== q && (this.boundingSphere = q.clone()), this.elementsNeedUpdate = e.elementsNeedUpdate, this.verticesNeedUpdate = e.verticesNeedUpdate, this.uvsNeedUpdate = e.uvsNeedUpdate, this.normalsNeedUpdate = e.normalsNeedUpdate, this.colorsNeedUpdate = e.colorsNeedUpdate, this.lineDistancesNeedUpdate = e.lineDistancesNeedUpdate, this.groupsNeedUpdate = e.groupsNeedUpdate, this }, dispose: function() { this.dispatchEvent({ type: "dispose" }) } }); var Cl = function() { y(l, Sl); var s = w(l); function l(e, t, n, i, r, a) { var o; return O(this, l), (o = s.call(this)).type = "BoxGeometry", o.parameters = { width: e, height: t, depth: n, widthSegments: i, heightSegments: r, depthSegments: a }, o.fromBufferGeometry(new Wr(e,t,n,i,r,a)), o.mergeVertices(), o } return h(l) }() , Pl = function() { y(v, Mr); var m = w(v); function v() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 8, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 2 * Math.PI; O(this, v), (e = m.call(this)).type = "CircleBufferGeometry", e.parameters = { radius: t, segments: n, thetaStart: i, thetaLength: r }; var n = Math.max(3, n) , a = [] , o = [] , s = [] , l = [] , u = new Cn , c = new yn; o.push(0, 0, 0), s.push(0, 0, 1), l.push(.5, .5); for (var d = 0, h = 3; d <= n; d++, h += 3) { var p = i + d / n * r; u.x = t * Math.cos(p), u.y = t * Math.sin(p), o.push(u.x, u.y, u.z), s.push(0, 0, 1), c.x = (o[h] / t + 1) / 2, c.y = (o[h + 1] / t + 1) / 2, l.push(c.x, c.y) } for (var f = 1; f <= n; f++) a.push(f, f + 1, 0); return e.setIndex(a), e.setAttribute("position", new dr(o,3)), e.setAttribute("normal", new dr(s,3)), e.setAttribute("uv", new dr(l,2)), e } return h(v) }() , Dl = function() { y(o, Sl); var a = w(o); function o(e, t, n, i) { var r; return O(this, o), (r = a.call(this)).type = "CircleGeometry", r.parameters = { radius: e, segments: t, thetaStart: n, thetaLength: i }, r.fromBufferGeometry(new Pl(e,t,n,i)), r.mergeVertices(), r } return h(o) }() , kl = function() { y(r, Mr); var i = w(r); function r() { var e, y = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, w = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1, b = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1, x = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 8, E = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1, t = 5 < arguments.length && void 0 !== arguments[5] && arguments[5], _ = 6 < arguments.length && void 0 !== arguments[6] ? arguments[6] : 0, M = 7 < arguments.length && void 0 !== arguments[7] ? arguments[7] : 2 * Math.PI; O(this, r), (e = i.call(this)).type = "CylinderBufferGeometry", e.parameters = { radiusTop: y, radiusBottom: w, height: b, radialSegments: x, heightSegments: E, openEnded: t, thetaStart: _, thetaLength: M }; var A = g(e) , x = Math.floor(x) , E = Math.floor(E) , T = [] , S = [] , C = [] , P = [] , D = 0 , k = [] , B = b / 2 , L = 0; function n(e) { for (var t = D, n = new yn, i = new Cn, r = 0, a = !0 === e ? y : w, o = !0 === e ? 1 : -1, s = 1; s <= x; s++) S.push(0, B * o, 0), C.push(0, o, 0), P.push(.5, .5), D++; for (var l = D, u = 0; u <= x; u++) { var c = u / x * M + _ , d = Math.cos(c) , c = Math.sin(c); i.x = a * c, i.y = B * o, i.z = a * d, S.push(i.x, i.y, i.z), C.push(0, o, 0), n.x = .5 * d + .5, n.y = .5 * c * o + .5, P.push(n.x, n.y), D++ } for (var h = 0; h < x; h++) { var p = t + h , f = l + h; !0 === e ? T.push(f, f + 1, p) : T.push(f + 1, f, p), r += 3 } A.addGroup(L, r, !0 === e ? 1 : 2), L += r } return function() { for (var e = new Cn, t = new Cn, n = 0, i = (w - y) / b, r = 0; r <= E; r++) { for (var a = [], o = r / E, s = o * (w - y) + y, l = 0; l <= x; l++) { var u = l / x , c = u * M + _ , d = Math.sin(c) , c = Math.cos(c); t.x = s * d, t.y = -o * b + B, t.z = s * c, S.push(t.x, t.y, t.z), e.set(d, i, c).normalize(), C.push(e.x, e.y, e.z), P.push(u, 1 - o), a.push(D++) } k.push(a) } for (var h = 0; h < x; h++) for (var p = 0; p < E; p++) { var f = k[p][h] , m = k[p + 1][h] , v = k[p + 1][h + 1] , g = k[p][h + 1]; T.push(f, m, g), T.push(m, v, g), n += 6 } A.addGroup(L, n, 0), L += n }(), !1 === t && (0 < y && n(!0), 0 < w && n(!1)), e.setIndex(T), e.setAttribute("position", new dr(S,3)), e.setAttribute("normal", new dr(C,3)), e.setAttribute("uv", new dr(P,2)), e } return h(r) }() , Bl = function() { y(c, Sl); var u = w(c); function c(e, t, n, i, r, a, o, s) { var l; return O(this, c), (l = u.call(this)).type = "CylinderGeometry", l.parameters = { radiusTop: e, radiusBottom: t, height: n, radialSegments: i, heightSegments: r, openEnded: a, thetaStart: o, thetaLength: s }, l.fromBufferGeometry(new kl(e,t,n,i,r,a,o,s)), l.mergeVertices(), l } return h(c) }() , Ll = function() { y(u, Bl); var l = w(u); function u(e, t, n, i, r, a, o) { var s; return O(this, u), (s = l.call(this, 0, e, t, n, i, r, a, o)).type = "ConeGeometry", s.parameters = { radius: e, height: t, radialSegments: n, heightSegments: i, openEnded: r, thetaStart: a, thetaLength: o }, s } return h(u) }() , Rl = function() { y(u, kl); var l = w(u); function u() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 8, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1, a = 4 < arguments.length && void 0 !== arguments[4] && arguments[4], o = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 0, s = 6 < arguments.length && void 0 !== arguments[6] ? arguments[6] : 2 * Math.PI; return O(this, u), (e = l.call(this, 0, t, n, i, r, a, o, s)).type = "ConeBufferGeometry", e.parameters = { radius: t, height: n, radialSegments: i, heightSegments: r, openEnded: a, thetaStart: o, thetaLength: s }, e } return h(u) }() , Fl = function() { y(s, Mr); var r = w(s); function s(n, a) { var e, t = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1, i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0; O(this, s), (e = r.call(this)).type = "PolyhedronBufferGeometry", e.parameters = { vertices: n, indices: a, radius: t, detail: i }; var c = [] , d = []; function f(e) { c.push(e.x, e.y, e.z) } function o(e, t) { e *= 3; t.x = n[0 + e], t.y = n[1 + e], t.z = n[2 + e] } function h(e, t, n, i) { i < 0 && 1 === e.x && (d[t] = e.x - 1), 0 === n.x && 0 === n.z && (d[t] = i / 2 / Math.PI + .5) } function p(e) { return Math.atan2(e.z, -e.x) } return function(e) { for (var t = new Cn, n = new Cn, i = new Cn, r = 0; r < a.length; r += 3) o(a[r + 0], t), o(a[r + 1], n), o(a[r + 2], i), function(e, t, n, i) { for (var r = i + 1, a = [], o = 0; o <= r; o++) { a[o] = []; for (var s = e.clone().lerp(n, o / r), l = t.clone().lerp(n, o / r), u = r - o, c = 0; c <= u; c++) a[o][c] = 0 === c && o === r ? s : s.clone().lerp(l, c / u) } for (var d = 0; d < r; d++) for (var h = 0; h < 2 * (r - d) - 1; h++) { var p = Math.floor(h / 2); h % 2 == 0 ? (f(a[d][p + 1]), f(a[d + 1][p]), f(a[d][p])) : (f(a[d][p + 1]), f(a[d + 1][p + 1]), f(a[d + 1][p])) } }(t, n, i, e) }(i), function(e) { for (var t = new Cn, n = 0; n < c.length; n += 3) t.x = c[n + 0], t.y = c[n + 1], t.z = c[n + 2], t.normalize().multiplyScalar(e), c[n + 0] = t.x, c[n + 1] = t.y, c[n + 2] = t.z }(t), function() { for (var e = new Cn, t = 0; t < c.length; t += 3) { e.x = c[t + 0], e.y = c[t + 1], e.z = c[t + 2]; var n = p(e) / 2 / Math.PI + .5 , i = function(e) { return Math.atan2(-e.y, Math.sqrt(e.x * e.x + e.z * e.z)) }(e) / Math.PI + .5; d.push(n, 1 - i) } (function() { for (var e = new Cn, t = new Cn, n = new Cn, i = new Cn, r = new yn, a = new yn, o = new yn, s = 0, l = 0; s < c.length; s += 9, l += 6) { e.set(c[s + 0], c[s + 1], c[s + 2]), t.set(c[s + 3], c[s + 4], c[s + 5]), n.set(c[s + 6], c[s + 7], c[s + 8]), r.set(d[l + 0], d[l + 1]), a.set(d[l + 2], d[l + 3]), o.set(d[l + 4], d[l + 5]), i.copy(e).add(t).add(n).divideScalar(3); var u = p(i); h(r, l + 0, e, u), h(a, l + 2, t, u), h(o, l + 4, n, u) } } )(), function() { for (var e = 0; e < d.length; e += 6) { var t = d[e + 0] , n = d[e + 2] , i = d[e + 4] , r = Math.max(t, n, i) , a = Math.min(t, n, i); .9 < r && a < .1 && (t < .2 && (d[e + 0] += 1), n < .2 && (d[e + 2] += 1), i < .2 && (d[e + 4] += 1)) } }() }(), e.setAttribute("position", new dr(c,3)), e.setAttribute("normal", new dr(c.slice(),3)), e.setAttribute("uv", new dr(d,2)), 0 === i ? e.computeVertexNormals() : e.normalizeNormals(), e } return h(s) }() , Il = function() { y(a, Fl); var r = w(a); function a() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1 , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; O(this, a); var n = (1 + Math.sqrt(5)) / 2 , i = 1 / n; return (i = r.call(this, [-1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 0, -i, -n, 0, -i, n, 0, i, -n, 0, i, n, -i, -n, 0, -i, n, 0, i, -n, 0, i, n, 0, -n, 0, -i, n, 0, -i, -n, 0, i, n, 0, i], [3, 11, 7, 3, 7, 15, 3, 15, 13, 7, 19, 17, 7, 17, 6, 7, 6, 15, 17, 4, 8, 17, 8, 10, 17, 10, 6, 8, 0, 16, 8, 16, 2, 8, 2, 10, 0, 12, 1, 0, 1, 18, 0, 18, 16, 6, 10, 2, 6, 2, 13, 6, 13, 15, 2, 16, 18, 2, 18, 3, 2, 3, 13, 18, 1, 9, 18, 9, 11, 18, 11, 3, 4, 14, 12, 4, 12, 0, 4, 0, 8, 11, 9, 5, 11, 5, 19, 11, 19, 7, 19, 5, 14, 19, 14, 4, 19, 4, 17, 1, 12, 14, 1, 14, 5, 1, 5, 9], e, t)).type = "DodecahedronBufferGeometry", i.parameters = { radius: e, detail: t }, i } return h(a) }() , Ol = function() { y(r, Sl); var i = w(r); function r(e, t) { var n; return O(this, r), (n = i.call(this)).type = "DodecahedronGeometry", n.parameters = { radius: e, detail: t }, n.fromBufferGeometry(new Il(e,t)), n.mergeVertices(), n } return h(r) }() , zl = new Cn , Nl = new Cn , Ul = new Cn , Gl = new Hi , Hl = function() { y(C, Mr); var S = w(C); function C(e, t) { var n; O(this, C), (n = S.call(this)).type = "EdgesGeometry", n.parameters = { thresholdAngle: t }, t = void 0 !== t ? t : 1, e.isGeometry && (e = (new Mr).fromGeometry(e)); for (var i, r, a, o = Math.pow(10, 4), s = Math.cos(gn.DEG2RAD * t), l = e.getIndex(), u = e.getAttribute("position"), c = (l || u).count, d = [0, 0, 0], h = ["a", "b", "c"], p = new Array(3), f = {}, m = [], v = 0; v < c; v += 3) { l ? (d[0] = l.getX(v), d[1] = l.getX(v + 1), d[2] = l.getX(v + 2)) : (d[0] = v, d[1] = v + 1, d[2] = v + 2); var g = Gl.a , y = Gl.b , w = Gl.c; if (g.fromBufferAttribute(u, d[0]), y.fromBufferAttribute(u, d[1]), w.fromBufferAttribute(u, d[2]), Gl.getNormal(Ul), p[0] = "".concat(Math.round(g.x * o), ",").concat(Math.round(g.y * o), ",").concat(Math.round(g.z * o)), p[1] = "".concat(Math.round(y.x * o), ",").concat(Math.round(y.y * o), ",").concat(Math.round(y.z * o)), p[2] = "".concat(Math.round(w.x * o), ",").concat(Math.round(w.y * o), ",").concat(Math.round(w.z * o)), p[0] !== p[1] && p[1] !== p[2] && p[2] !== p[0]) for (var b = 0; b < 3; b++) { var x = (b + 1) % 3 , E = p[b] , _ = p[x] , M = Gl[h[b]] , A = Gl[h[x]] , T = "".concat(E, "_").concat(_) , E = "".concat(_, "_").concat(E); E in f && f[E] ? (Ul.dot(f[E].normal) <= s && (m.push(M.x, M.y, M.z), m.push(A.x, A.y, A.z)), f[E] = null) : T in f || (f[T] = { index0: d[b], index1: d[x], normal: Ul.clone() }) } } for (i in f) f[i] && (r = (a = f[i]).index0, a = a.index1, zl.fromBufferAttribute(u, r), Nl.fromBufferAttribute(u, a), m.push(zl.x, zl.y, zl.z), m.push(Nl.x, Nl.y, Nl.z)); return n.setAttribute("position", new dr(m,3)), n } return h(C) }() , Vl = function(e, t, n) { n = n || 2; var i, r, a, o, s, l = t && t.length, u = l ? t[0] * n : e.length, c = jl(e, 0, u, n, !0), d = []; if (!c || c.next === c.prev) return d; if (l && (c = function(e, t, n, i) { var r, a, o, s, l = []; for (r = 0, a = t.length; r < a; r++) o = t[r] * i, s = r < a - 1 ? t[r + 1] * i : e.length, (s = jl(e, o, s, i, !1)) === s.next && (s.steiner = !0), l.push(function(e) { var t = e , n = e; for (; (t.x < n.x || t.x === n.x && t.y < n.y) && (n = t), t = t.next, t !== e; ) ; return n }(s)); for (l.sort(ql), r = 0; r < l.length; r++) !function(e, t) { (t = function(e, t) { var n, i = t, r = e.x, a = e.y, o = -1 / 0; do { if (a <= i.y && a >= 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 < s) { if ((o = s) === r) { if (a === i.y) return i; if (a === i.next.y) return i.next } n = i.x < i.next.x ? i : i.next } } } while (i = i.next, i !== t); if (!n) return null; if (r === o) return n; var l, u = n, c = n.x, d = n.y, h = 1 / 0; i = n; for (; r >= i.x && i.x >= c && r !== i.x && Yl(a < d ? r : o, a, c, d, a < d ? o : r, a, i.x, i.y) && (l = Math.abs(a - i.y) / (r - i.x), tu(i, e) && (l < h || l === h && (i.x > n.x || i.x === n.x && function(e, t) { return Zl(e.prev, e, t.prev) < 0 && Zl(t.next, e, e.next) < 0 }(n, i))) && (n = i, h = l)), i = i.next, i !== u; ) ; return n }(e, t)) && (e = nu(t, e), Wl(t, t.next), Wl(e, e.next)) }(l[r], n), n = Wl(n, n.next); return n }(e, t, c, n)), e.length > 80 * n) { for (var h = i = e[0], p = r = e[1], f = n; f < u; f += n) (a = e[f]) < h && (h = a), (o = e[f + 1]) < p && (p = o), i < a && (i = a), r < o && (r = o); s = 0 !== (s = Math.max(i - h, r - p)) ? 1 / s : 0 } return Xl(c, d, n, h, p, s), d }; function jl(e, t, n, i, r) { var a, o; if (r === 0 < function(e, t, n, i) { for (var r = 0, a = t, o = n - i; a < n; a += i) r += (e[o] - e[a]) * (e[a + 1] + e[o + 1]), o = a; return r }(e, t, n, i)) for (a = t; a < n; a += i) o = iu(a, e[a], e[a + 1], o); else for (a = n - i; t <= a; a -= i) o = iu(a, e[a], e[a + 1], o); return o && Ql(o, o.next) && (ru(o), o = o.next), o } function Wl(e, t) { if (!e) return e; t = t || e; var n, i = e; do { if (n = !1, i.steiner || !Ql(i, i.next) && 0 !== Zl(i.prev, i, i.next)) i = i.next; else { if (ru(i), (i = t = i.prev) === i.next) break; n = !0 } } while (n || i !== t); return t } function Xl(e, t, n, i, r, a, o) { if (e) { !o && a && function(e, t, n, i) { var r = e; for (; null === r.z && (r.z = Jl(r.x, r.y, t, n, i)), r.prevZ = r.prev, r.nextZ = r.next, r = r.next, r !== e; ) ; r.prevZ.nextZ = null, r.prevZ = null, function(e) { var t, n, i, r, a, o, s, l, u = 1; do { for (n = e, a = e = null, o = 0; n; ) { for (o++, i = n, t = s = 0; t < u && (s++, i = i.nextZ); t++) ; for (l = u; 0 < s || 0 < l && i; ) 0 !== s && (0 === l || !i || n.z <= i.z) ? (n = (r = n).nextZ, s--) : (i = (r = i).nextZ, l--), a ? a.nextZ = r : e = r, r.prevZ = a, a = r; n = i } } while (a.nextZ = null, u *= 2, 1 < o) }(r) }(e, i, r, a); for (var s, l, u = e; e.prev !== e.next; ) if (s = e.prev, l = e.next, a ? function(e, t, n, i) { var r = e.prev , a = e , o = e.next; if (0 <= Zl(r, a, o)) return !1; var s = (r.x < a.x ? r.x < o.x ? r : o : a.x < o.x ? a : o).x , l = (r.y < a.y ? r.y < o.y ? r : o : a.y < o.y ? a : o).y , u = (r.x > a.x ? r.x > o.x ? r : o : a.x > o.x ? a : o).x , c = (r.y > a.y ? r.y > o.y ? r : o : a.y > o.y ? a : o).y , d = Jl(s, l, t, n, i) , h = Jl(u, c, t, n, i) , p = e.prevZ , f = e.nextZ; for (; p && p.z >= d && f && f.z <= h; ) { if (p !== e.prev && p !== e.next && Yl(r.x, r.y, a.x, a.y, o.x, o.y, p.x, p.y) && 0 <= Zl(p.prev, p, p.next)) return !1; if (p = p.prevZ, f !== e.prev && f !== e.next && Yl(r.x, r.y, a.x, a.y, o.x, o.y, f.x, f.y) && 0 <= Zl(f.prev, f, f.next)) return !1; f = f.nextZ } for (; p && p.z >= d; ) { if (p !== e.prev && p !== e.next && Yl(r.x, r.y, a.x, a.y, o.x, o.y, p.x, p.y) && 0 <= Zl(p.prev, p, p.next)) return !1; p = p.prevZ } for (; f && f.z <= h; ) { if (f !== e.prev && f !== e.next && Yl(r.x, r.y, a.x, a.y, o.x, o.y, f.x, f.y) && 0 <= Zl(f.prev, f, f.next)) return !1; f = f.nextZ } return !0 }(e, i, r, a) : function(e) { var t = e.prev , n = e , i = e.next; if (0 <= Zl(t, n, i)) return !1; var r = e.next.next; for (; r !== e.prev; ) { if (Yl(t.x, t.y, n.x, n.y, i.x, i.y, r.x, r.y) && 0 <= Zl(r.prev, r, r.next)) return !1; r = r.next } return !0 }(e)) t.push(s.i / n), t.push(e.i / n), t.push(l.i / n), ru(e), e = l.next, u = l.next; else if ((e = l) === u) { o ? 1 === o ? Xl(e = function(e, t, n) { var i = e; do { var r = i.prev , a = i.next.next } while (!Ql(r, a) && Kl(r, i, i.next, a) && tu(r, a) && tu(a, r) && (t.push(r.i / n), t.push(i.i / n), t.push(a.i / n), ru(i), ru(i.next), i = e = a), i = i.next, i !== e); return Wl(i) }(Wl(e), t, n), t, n, i, r, a, 2) : 2 === o && function(e, t, n, i, r, a) { var o = e; do { for (var s = o.next.next; s !== o.prev; ) { if (o.i !== s.i && function(e, t) { return e.next.i !== t.i && e.prev.i !== t.i && !function(e, t) { var n = e; do { if (n.i !== e.i && n.next.i !== e.i && n.i !== t.i && n.next.i !== t.i && Kl(n, n.next, e, t)) return !0 } while (n = n.next, n !== e); return !1 }(e, t) && (tu(e, t) && tu(t, e) && function(e, t) { var n = e , i = !1 , r = (e.x + t.x) / 2 , a = (e.y + t.y) / 2; for (; n.y > a != n.next.y > a && n.next.y !== n.y && r < (n.next.x - n.x) * (a - n.y) / (n.next.y - n.y) + n.x && (i = !i), n = n.next, n !== e; ) ; return i }(e, t) && (Zl(e.prev, e, t.prev) || Zl(e, t.prev, t)) || Ql(e, t) && 0 < Zl(e.prev, e, e.next) && 0 < Zl(t.prev, t, t.next)) }(o, s)) { var l = nu(o, s); return o = Wl(o, o.next), l = Wl(l, l.next), Xl(o, t, n, i, r, a), Xl(l, t, n, i, r, a) } s = s.next } } while (o = o.next, o !== e) }(e, t, n, i, r, a) : Xl(Wl(e), t, n, i, r, a, 1); break } } } function ql(e, t) { return e.x - t.x } function Jl(e, t, n, i, r) { return (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = 32767 * (e - n) * r) | e << 8)) | e << 4)) | e << 2)) | e << 1)) | (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t = 32767 * (t - i) * r) | t << 8)) | t << 4)) | t << 2)) | t << 1)) << 1 } function Yl(e, t, n, i, r, a, o, s) { return 0 <= (r - o) * (t - s) - (e - o) * (a - s) && 0 <= (e - o) * (i - s) - (n - o) * (t - s) && 0 <= (n - o) * (a - s) - (r - o) * (i - s) } function Zl(e, t, n) { return (t.y - e.y) * (n.x - t.x) - (t.x - e.x) * (n.y - t.y) } function Ql(e, t) { return e.x === t.x && e.y === t.y } function Kl(e, t, n, i) { var r = eu(Zl(e, t, n)) , a = eu(Zl(e, t, i)) , o = eu(Zl(n, i, e)) , s = eu(Zl(n, i, t)); return r !== a && o !== s || (0 === r && $l(e, n, t) || (0 === a && $l(e, i, t) || (0 === o && $l(n, e, i) || !(0 !== s || !$l(n, t, i))))) } function $l(e, t, n) { return t.x <= Math.max(e.x, n.x) && t.x >= Math.min(e.x, n.x) && t.y <= Math.max(e.y, n.y) && t.y >= Math.min(e.y, n.y) } function eu(e) { return 0 < e ? 1 : e < 0 ? -1 : 0 } function tu(e, t) { return Zl(e.prev, e, e.next) < 0 ? 0 <= Zl(e, t, e.next) && 0 <= Zl(e, e.prev, t) : Zl(e, t, e.prev) < 0 || Zl(e, e.next, t) < 0 } function nu(e, t) { var n = new au(e.i,e.x,e.y) , i = new au(t.i,t.x,t.y) , r = e.next , a = t.prev; return (e.next = t).prev = e, (n.next = r).prev = n, (i.next = n).prev = i, (a.next = i).prev = a, i } function iu(e, t, n, i) { n = new au(e,t,n); return i ? (n.next = i.next, (n.prev = i).next.prev = n, i.next = n) : (n.prev = n).next = n, n } function ru(e) { e.next.prev = e.prev, e.prev.next = e.next, e.prevZ && (e.prevZ.nextZ = e.nextZ), e.nextZ && (e.nextZ.prevZ = e.prevZ) } function au(e, t, n) { this.i = e, this.x = t, this.y = n, this.prev = null, this.next = null, this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = !1 } var ou = { area: function(e) { for (var t = e.length, n = 0, i = t - 1, r = 0; r < t; i = r++) n += e[i].x * e[r].y - e[r].x * e[i].y; return .5 * n }, isClockWise: function(e) { return ou.area(e) < 0 }, triangulateShape: function(e, t) { var n = [] , i = [] , r = []; su(e), lu(n, e); var a = e.length; t.forEach(su); for (var o = 0; o < t.length; o++) i.push(a), a += t[o].length, lu(n, t[o]); for (var s = Vl(n, i), l = 0; l < s.length; l += 3) r.push(s.slice(l, l + 3)); return r } }; function su(e) { var t = e.length; 2 < t && e[t - 1].equals(e[0]) && e.pop() } function lu(e, t) { for (var n = 0; n < t.length; n++) e.push(t[n].x), e.push(t[n].y) } var uu = function() { y(a, Mr); var r = w(a); function a(e, De) { var t; O(this, a), (t = r.call(this)).type = "ExtrudeBufferGeometry", t.parameters = { shapes: e, options: De }, e = Array.isArray(e) ? e : [e]; for (var ke = g(t), Be = [], Le = [], n = 0, i = e.length; n < i; n++) !function(e) { var i = [] , t = void 0 !== De.curveSegments ? De.curveSegments : 12 , c = void 0 !== De.steps ? De.steps : 1 , n = void 0 !== De.depth ? De.depth : 100 , d = void 0 === De.bevelEnabled || De.bevelEnabled , r = void 0 !== De.bevelThickness ? De.bevelThickness : 6 , a = void 0 !== De.bevelSize ? De.bevelSize : r - 2 , o = void 0 !== De.bevelOffset ? De.bevelOffset : 0 , h = void 0 !== De.bevelSegments ? De.bevelSegments : 3 , s = De.extrudePath , u = void 0 !== De.UVGenerator ? De.UVGenerator : cu; void 0 !== De.amount && (console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."), n = De.amount); var l, p, f, m, v, g = !1; s && (l = s.getSpacedPoints(c), d = !(g = !0), p = s.computeFrenetFrames(c, !1), f = new Cn, m = new Cn, v = new Cn); d || (o = a = r = h = 0); var t = e.extractPoints(t) , y = t.shape , w = t.holes; if (!ou.isClockWise(y)) { y = y.reverse(); for (var b = 0, x = w.length; b < x; b++) { var E = w[b]; ou.isClockWise(E) && (w[b] = E.reverse()) } } for (var _ = ou.triangulateShape(y, w), M = y, A = 0, T = w.length; A < T; A++) { var S = w[A]; y = y.concat(S) } function C(e, t, n) { return t || console.error("THREE.ExtrudeGeometry: vec does not exist"), t.clone().multiplyScalar(n).add(e) } var P = y.length , D = _.length; function k(e, t, n) { var i = e.x - t.x , r = e.y - t.y , a = n.x - e.x , o = n.y - e.y , s = i * i + r * r; if (Math.abs(i * o - r * a) > Number.EPSILON) { var l = Math.sqrt(s) , u = Math.sqrt(a * a + o * o) , c = t.x - r / l , d = t.y + i / l , l = ((n.x - o / u - c) * o - (n.y + a / u - d) * a) / (i * o - r * a) , d = (u = c + i * l - e.x) * u + (c = d + r * l - e.y) * c; if (d <= 2) return new yn(u,c); l = Math.sqrt(d / 2) } else { d = !1; i > Number.EPSILON ? a > Number.EPSILON && (d = !0) : i < -Number.EPSILON ? a < -Number.EPSILON && (d = !0) : Math.sign(r) === Math.sign(o) && (d = !0), l = d ? (u = -r, c = i, Math.sqrt(s)) : (u = i, c = r, Math.sqrt(s / 2)) } return new yn(u / l,c / l) } for (var B = [], L = 0, R = M.length, F = R - 1, I = L + 1; L < R; L++, F++, I++) F === R && (F = 0), I === R && (I = 0), B[L] = k(M[L], M[F], M[I]); for (var O, z = [], N = B.concat(), U = 0, G = w.length; U < G; U++) { var H = w[U]; O = []; for (var V = 0, j = H.length, W = j - 1, X = V + 1; V < j; V++, W++, X++) W === j && (W = 0), X === j && (X = 0), O[V] = k(H[V], H[W], H[X]); z.push(O), N = N.concat(O) } for (var q = 0; q < h; q++) { for (var J = q / h, Y = r * Math.cos(J * Math.PI / 2), Z = a * Math.sin(J * Math.PI / 2) + o, Q = 0, K = M.length; Q < K; Q++) { var $ = C(M[Q], B[Q], Z); Te($.x, $.y, -Y) } for (var ee = 0, te = w.length; ee < te; ee++) { var ne = w[ee]; O = z[ee]; for (var ie = 0, re = ne.length; ie < re; ie++) { var ae = C(ne[ie], O[ie], Z); Te(ae.x, ae.y, -Y) } } } for (var oe = a + o, se = 0; se < P; se++) { var le = d ? C(y[se], N[se], oe) : y[se]; g ? (m.copy(p.normals[0]).multiplyScalar(le.x), f.copy(p.binormals[0]).multiplyScalar(le.y), v.copy(l[0]).add(m).add(f), Te(v.x, v.y, v.z)) : Te(le.x, le.y, 0) } for (var ue = 1; ue <= c; ue++) for (var ce = 0; ce < P; ce++) { var de = d ? C(y[ce], N[ce], oe) : y[ce]; g ? (m.copy(p.normals[ue]).multiplyScalar(de.x), f.copy(p.binormals[ue]).multiplyScalar(de.y), v.copy(l[ue]).add(m).add(f), Te(v.x, v.y, v.z)) : Te(de.x, de.y, n / c * ue) } for (var he = h - 1; 0 <= he; he--) { for (var pe = he / h, fe = r * Math.cos(pe * Math.PI / 2), me = a * Math.sin(pe * Math.PI / 2) + o, ve = 0, ge = M.length; ve < ge; ve++) { var ye = C(M[ve], B[ve], me); Te(ye.x, ye.y, n + fe) } for (var we = 0, be = w.length; we < be; we++) { var xe = w[we]; O = z[we]; for (var Ee = 0, _e = xe.length; Ee < _e; Ee++) { var Me = C(xe[Ee], O[Ee], me); g ? Te(Me.x, Me.y + l[c - 1].y, l[c - 1].x + fe) : Te(Me.x, Me.y, n + fe) } } } function Ae(e, t) { for (var n = e.length; 0 <= --n; ) { var i = n , r = n - 1; r < 0 && (r = e.length - 1); for (var a = 0, o = c + 2 * h; a < o; a++) { var s = P * a , l = P * (a + 1); !function(e, t, n, i) { Ce(e), Ce(t), Ce(i), Ce(t), Ce(n), Ce(i); i = Be.length / 3, i = u.generateSideWallUV(ke, Be, i - 6, i - 3, i - 2, i - 1); Pe(i[0]), Pe(i[1]), Pe(i[3]), Pe(i[1]), Pe(i[2]), Pe(i[3]) }(t + i + s, t + r + s, t + r + l, t + i + l) } } } function Te(e, t, n) { i.push(e), i.push(t), i.push(n) } function Se(e, t, n) { Ce(e), Ce(t), Ce(n); n = Be.length / 3, n = u.generateTopUV(ke, Be, n - 3, n - 2, n - 1); Pe(n[0]), Pe(n[1]), Pe(n[2]) } function Ce(e) { Be.push(i[3 * e + 0]), Be.push(i[3 * e + 1]), Be.push(i[3 * e + 2]) } function Pe(e) { Le.push(e.x), Le.push(e.y) } (function() { var e = Be.length / 3; if (d) { for (var t = 0 * P, n = 0; n < D; n++) { var i = _[n]; Se(i[2] + t, i[1] + t, i[0] + t) } for (var t = P * (c + 2 * h), r = 0; r < D; r++) { var a = _[r]; Se(a[0] + t, a[1] + t, a[2] + t) } } else { for (var o = 0; o < D; o++) { var s = _[o]; Se(s[2], s[1], s[0]) } for (var l = 0; l < D; l++) { var u = _[l]; Se(u[0] + P * c, u[1] + P * c, u[2] + P * c) } } ke.addGroup(e, Be.length / 3 - e, 0) } )(), function() { var e = Be.length / 3 , t = 0; Ae(M, t), t += M.length; for (var n = 0, i = w.length; n < i; n++) { var r = w[n]; Ae(r, t), t += r.length } ke.addGroup(e, Be.length / 3 - e, 1) }() }(e[n]); return t.setAttribute("position", new dr(Be,3)), t.setAttribute("uv", new dr(Le,2)), t.computeVertexNormals(), t } return h(a, [{ key: "toJSON", value: function() { var e = Mr.prototype.toJSON.call(this); return function(e, t, n) { if (n.shapes = [], Array.isArray(e)) for (var i = 0, r = e.length; i < r; i++) { var a = e[i]; n.shapes.push(a.uuid) } else n.shapes.push(e.uuid); void 0 !== t.extrudePath && (n.options.extrudePath = t.extrudePath.toJSON()); return n }(this.parameters.shapes, this.parameters.options, e) } }]), a }() , cu = { generateTopUV: function(e, t, n, i, r) { var a = t[3 * n] , o = t[3 * n + 1] , s = t[3 * i] , n = t[3 * i + 1] , i = t[3 * r] , r = t[3 * r + 1]; return [new yn(a,o), new yn(s,n), new yn(i,r)] }, generateSideWallUV: function(e, t, n, i, r, a) { var o = t[3 * n] , s = t[3 * n + 1] , l = t[3 * n + 2] , u = t[3 * i] , c = t[3 * i + 1] , d = t[3 * i + 2] , h = t[3 * r] , p = t[3 * r + 1] , n = t[3 * r + 2] , i = t[3 * a] , r = t[3 * a + 1] , a = t[3 * a + 2]; return Math.abs(s - c) < .01 ? [new yn(o,1 - l), new yn(u,1 - d), new yn(h,1 - n), new yn(i,1 - a)] : [new yn(s,1 - l), new yn(c,1 - d), new yn(p,1 - n), new yn(r,1 - a)] } }; var du = function() { y(r, Sl); var i = w(r); function r(e, t) { var n; return O(this, r), (n = i.call(this)).type = "ExtrudeGeometry", n.parameters = { shapes: e, options: t }, n.fromBufferGeometry(new uu(e,t)), n.mergeVertices(), n } return h(r, [{ key: "toJSON", value: function() { var e = b(v(r.prototype), "toJSON", this).call(this); return function(e, t, n) { if (n.shapes = [], Array.isArray(e)) for (var i = 0, r = e.length; i < r; i++) { var a = e[i]; n.shapes.push(a.uuid) } else n.shapes.push(e.uuid); void 0 !== t.extrudePath && (n.options.extrudePath = t.extrudePath.toJSON()); return n }(this.parameters.shapes, this.parameters.options, e) } }]), r }(); var hu = function() { y(r, Fl); var i = w(r); function r() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1 , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; O(this, r); var n = (1 + Math.sqrt(5)) / 2; return (n = i.call(this, [-1, n, 0, 1, n, 0, -1, -n, 0, 1, -n, 0, 0, -1, n, 0, 1, n, 0, -1, -n, 0, 1, -n, n, 0, -1, n, 0, 1, -n, 0, -1, -n, 0, 1], [0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11, 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8, 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9, 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1], e, t)).type = "IcosahedronBufferGeometry", n.parameters = { radius: e, detail: t }, n } return h(r) }() , pu = function() { y(r, Sl); var i = w(r); function r(e, t) { var n; return O(this, r), (n = i.call(this)).type = "IcosahedronGeometry", n.parameters = { radius: e, detail: t }, n.fromBufferGeometry(new hu(e,t)), n.mergeVertices(), n } return h(r) }() , fu = function() { y(D, Mr); var P = w(D); function D(e) { var t, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 12, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 2 * Math.PI; O(this, D), (t = P.call(this)).type = "LatheBufferGeometry", t.parameters = { points: e, segments: n, phiStart: i, phiLength: r }; for (var n = Math.floor(n), r = gn.clamp(r, 0, 2 * Math.PI), a = [], o = [], s = [], l = 1 / n, u = new Cn, c = new yn, d = 0; d <= n; d++) for (var h = i + d * l * r, p = Math.sin(h), f = Math.cos(h), m = 0; m <= e.length - 1; m++) u.x = e[m].x * p, u.y = e[m].y, u.z = e[m].x * f, o.push(u.x, u.y, u.z), c.x = d / n, c.y = m / (e.length - 1), s.push(c.x, c.y); for (var v = 0; v < n; v++) for (var g = 0; g < e.length - 1; g++) { var y = g + v * e.length , w = y + e.length , b = y + e.length + 1 , x = y + 1; a.push(y, w, x), a.push(w, b, x) } if (t.setIndex(a), t.setAttribute("position", new dr(o,3)), t.setAttribute("uv", new dr(s,2)), t.computeVertexNormals(), r === 2 * Math.PI) for (var E = t.attributes.normal.array, _ = new Cn, M = new Cn, A = new Cn, T = n * e.length * 3, S = 0, C = 0; S < e.length; S++, C += 3) _.x = E[C + 0], _.y = E[C + 1], _.z = E[C + 2], M.x = E[T + C + 0], M.y = E[T + C + 1], M.z = E[T + C + 2], A.addVectors(_, M).normalize(), E[C + 0] = E[T + C + 0] = A.x, E[C + 1] = E[T + C + 1] = A.y, E[C + 2] = E[T + C + 2] = A.z; return t } return h(D) }() , mu = function() { y(o, Sl); var a = w(o); function o(e, t, n, i) { var r; return O(this, o), (r = a.call(this)).type = "LatheGeometry", r.parameters = { points: e, segments: t, phiStart: n, phiLength: i }, r.fromBufferGeometry(new fu(e,t,n,i)), r.mergeVertices(), r } return h(o) }() , vu = function() { y(r, Fl); var i = w(r); function r() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1 , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; O(this, r); var n; return (n = i.call(this, [1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1], [0, 2, 4, 0, 4, 3, 0, 3, 5, 0, 5, 2, 1, 2, 5, 1, 5, 3, 1, 3, 4, 1, 4, 2], e, t)).type = "OctahedronBufferGeometry", n.parameters = { radius: e, detail: t }, n } return h(r) }() , gu = function() { y(r, Sl); var i = w(r); function r(e, t) { var n; return O(this, r), (n = i.call(this)).type = "OctahedronGeometry", n.parameters = { radius: e, detail: t }, n.fromBufferGeometry(new vu(e,t)), n.mergeVertices(), n } return h(r) }(); function yu(e, t, n) { Mr.call(this), this.type = "ParametricBufferGeometry", this.parameters = { func: e, slices: t, stacks: n }; var i = [] , r = [] , a = [] , o = [] , s = new Cn , l = new Cn , u = new Cn , c = new Cn , d = new Cn; e.length < 3 && console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter."); for (var h = t + 1, p = 0; p <= n; p++) for (var f = p / n, m = 0; m <= t; m++) { var v = m / t; e(v, f, l), r.push(l.x, l.y, l.z), 0 <= v - 1e-5 ? (e(v - 1e-5, f, u), c.subVectors(l, u)) : (e(1e-5 + v, f, u), c.subVectors(u, l)), 0 <= f - 1e-5 ? (e(v, f - 1e-5, u), d.subVectors(l, u)) : (e(v, 1e-5 + f, u), d.subVectors(u, l)), s.crossVectors(c, d).normalize(), a.push(s.x, s.y, s.z), o.push(v, f) } for (var g = 0; g < n; g++) for (var y = 0; y < t; y++) { var w = g * h + y + 1 , b = (g + 1) * h + y + 1 , x = (g + 1) * h + y; i.push(g * h + y, w, x), i.push(w, b, x) } this.setIndex(i), this.setAttribute("position", new dr(r,3)), this.setAttribute("normal", new dr(a,3)), this.setAttribute("uv", new dr(o,2)) } function wu(e, t, n) { Sl.call(this), this.type = "ParametricGeometry", this.parameters = { func: e, slices: t, stacks: n }, this.fromBufferGeometry(new yu(e,t,n)), this.mergeVertices() } (yu.prototype = Object.create(Mr.prototype)).constructor = yu, (wu.prototype = Object.create(Sl.prototype)).constructor = wu; var bu = function() { y(o, Sl); var a = w(o); function o(e, t, n, i) { var r; return O(this, o), (r = a.call(this)).type = "PlaneGeometry", r.parameters = { width: e, height: t, widthSegments: n, heightSegments: i }, r.fromBufferGeometry(new ua(e,t,n,i)), r.mergeVertices(), r } return h(o) }() , xu = function() { y(o, Sl); var a = w(o); function o(e, t, n, i) { var r; return O(this, o), (r = a.call(this)).type = "PolyhedronGeometry", r.parameters = { vertices: e, indices: t, radius: n, detail: i }, r.fromBufferGeometry(new Fl(e,t,n,i)), r.mergeVertices(), r } return h(o) }() , Eu = function() { y(T, Mr); var A = w(T); function T() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : .5, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 8, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1, a = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 0, o = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 2 * Math.PI; O(this, T), (e = A.call(this)).type = "RingBufferGeometry", e.parameters = { innerRadius: t, outerRadius: n, thetaSegments: i, phiSegments: r, thetaStart: a, thetaLength: o }; for (var i = Math.max(3, i), s = [], l = [], u = [], c = [], d = t, h = (n - t) / (r = Math.max(1, r)), p = new Cn, f = new yn, m = 0; m <= r; m++) { for (var v = 0; v <= i; v++) { var g = a + v / i * o; p.x = d * Math.cos(g), p.y = d * Math.sin(g), l.push(p.x, p.y, p.z), u.push(0, 0, 1), f.x = (p.x / n + 1) / 2, f.y = (p.y / n + 1) / 2, c.push(f.x, f.y) } d += h } for (var y = 0; y < r; y++) for (var w = y * (i + 1), b = 0; b < i; b++) { var x = b + w , E = x + i + 1 , _ = x + i + 2 , M = x + 1; s.push(x, E, M), s.push(E, _, M) } return e.setIndex(s), e.setAttribute("position", new dr(l,3)), e.setAttribute("normal", new dr(u,3)), e.setAttribute("uv", new dr(c,2)), e } return h(T) }() , _u = function() { y(l, Sl); var s = w(l); function l(e, t, n, i, r, a) { var o; return O(this, l), (o = s.call(this)).type = "RingGeometry", o.parameters = { innerRadius: e, outerRadius: t, thetaSegments: n, phiSegments: i, thetaStart: r, thetaLength: a }, o.fromBufferGeometry(new Eu(e,t,n,i,r,a)), o.mergeVertices(), o } return h(l) }() , Mu = function() { y(o, Mr); var a = w(o); function o(e) { var t, w = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 12; O(this, o), (t = a.call(this)).type = "ShapeBufferGeometry", t.parameters = { shapes: e, curveSegments: w }; var b = [] , x = [] , E = [] , _ = [] , n = 0 , M = 0; if (!1 === Array.isArray(e)) r(e); else for (var i = 0; i < e.length; i++) r(e[i]), t.addGroup(n, M, i), n += M, M = 0; function r(e) { var t = x.length / 3 , e = e.extractPoints(w) , n = e.shape , i = e.holes; !1 === ou.isClockWise(n) && (n = n.reverse()); for (var r = 0, a = i.length; r < a; r++) { var o = i[r]; !0 === ou.isClockWise(o) && (i[r] = o.reverse()) } for (var s = ou.triangulateShape(n, i), l = 0, u = i.length; l < u; l++) var c = i[l] , n = n.concat(c); for (var d = 0, h = n.length; d < h; d++) { var p = n[d]; x.push(p.x, p.y, 0), E.push(0, 0, 1), _.push(p.x, p.y) } for (var f = 0, m = s.length; f < m; f++) { var v = s[f] , g = v[0] + t , y = v[1] + t , v = v[2] + t; b.push(g, y, v), M += 3 } } return t.setIndex(b), t.setAttribute("position", new dr(x,3)), t.setAttribute("normal", new dr(E,3)), t.setAttribute("uv", new dr(_,2)), t } return h(o, [{ key: "toJSON", value: function() { var e = Mr.prototype.toJSON.call(this); return function(e, t) { if (t.shapes = [], Array.isArray(e)) for (var n = 0, i = e.length; n < i; n++) { var r = e[n]; t.shapes.push(r.uuid) } else t.shapes.push(e.uuid); return t }(this.parameters.shapes, e) } }]), o }(); var Au = function() { y(r, Sl); var i = w(r); function r(e, t) { var n; return O(this, r), (n = i.call(this)).type = "ShapeGeometry", "object" === X(t) && (console.warn("THREE.ShapeGeometry: Options parameter has been removed."), t = t.curveSegments), n.parameters = { shapes: e, curveSegments: t }, n.fromBufferGeometry(new Mu(e,t)), n.mergeVertices(), n } return h(r, [{ key: "toJSON", value: function() { var e = Sl.prototype.toJSON.call(this); return function(e, t) { if (t.shapes = [], Array.isArray(e)) for (var n = 0, i = e.length; n < i; n++) { var r = e[n]; t.shapes.push(r.uuid) } else t.shapes.push(e.uuid); return t }(this.parameters.shapes, e) } }]), r }(); var Tu = function() { y(D, Mr); var P = w(D); function D() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 8, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 6, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0, a = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 2 * Math.PI, o = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 0, s = 6 < arguments.length && void 0 !== arguments[6] ? arguments[6] : Math.PI; O(this, D), (e = P.call(this)).type = "SphereBufferGeometry", e.parameters = { radius: t, widthSegments: n, heightSegments: i, phiStart: r, phiLength: a, thetaStart: o, thetaLength: s }; for (var n = Math.max(3, Math.floor(n)), i = Math.max(2, Math.floor(i)), l = Math.min(o + s, Math.PI), u = 0, c = [], d = new Cn, h = new Cn, p = [], f = [], m = [], v = [], g = 0; g <= i; g++) { var y = [] , w = g / i , b = 0; 0 == g && 0 == o ? b = .5 / n : g == i && l == Math.PI && (b = -.5 / n); for (var x = 0; x <= n; x++) { var E = x / n; d.x = -t * Math.cos(r + E * a) * Math.sin(o + w * s), d.y = t * Math.cos(o + w * s), d.z = t * Math.sin(r + E * a) * Math.sin(o + w * s), f.push(d.x, d.y, d.z), h.copy(d).normalize(), m.push(h.x, h.y, h.z), v.push(E + b, 1 - w), y.push(u++) } c.push(y) } for (var _ = 0; _ < i; _++) for (var M = 0; M < n; M++) { var A = c[_][M + 1] , T = c[_][M] , S = c[_ + 1][M] , C = c[_ + 1][M + 1]; (0 !== _ || 0 < o) && p.push(A, T, C), (_ !== i - 1 || l < Math.PI) && p.push(T, S, C) } return e.setIndex(p), e.setAttribute("position", new dr(f,3)), e.setAttribute("normal", new dr(m,3)), e.setAttribute("uv", new dr(v,2)), e } return h(D) }() , Su = function() { y(u, Sl); var l = w(u); function u(e, t, n, i, r, a, o) { var s; return O(this, u), (s = l.call(this)).type = "SphereGeometry", s.parameters = { radius: e, widthSegments: t, heightSegments: n, phiStart: i, phiLength: r, thetaStart: a, thetaLength: o }, s.fromBufferGeometry(new Tu(e,t,n,i,r,a,o)), s.mergeVertices(), s } return h(u) }() , Cu = function() { y(r, Fl); var i = w(r); function r() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1 , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; O(this, r); var n; return (n = i.call(this, [1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1], [2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1], e, t)).type = "TetrahedronBufferGeometry", n.parameters = { radius: e, detail: t }, n } return h(r) }() , Pu = function() { y(r, Sl); var i = w(r); function r(e, t) { var n; return O(this, r), (n = i.call(this)).type = "TetrahedronGeometry", n.parameters = { radius: e, detail: t }, n.fromBufferGeometry(new Cu(e,t)), n.mergeVertices(), n } return h(r) }() , Du = function() { y(a, uu); var r = w(a); function a(e) { var t, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; O(this, a); var i = n.font; if (!i || !i.isFont) return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."), c(t, new Mr); e = i.generateShapes(e, n.size); return n.depth = void 0 !== n.height ? n.height : 50, void 0 === n.bevelThickness && (n.bevelThickness = 10), void 0 === n.bevelSize && (n.bevelSize = 8), void 0 === n.bevelEnabled && (n.bevelEnabled = !1), (t = r.call(this, e, n)).type = "TextBufferGeometry", t } return h(a) }() , ku = function() { y(r, Sl); var i = w(r); function r(e, t) { var n; return O(this, r), (n = i.call(this)).type = "TextGeometry", n.parameters = { text: e, parameters: t }, n.fromBufferGeometry(new Du(e,t)), n.mergeVertices(), n } return h(r) }() , Bu = function() { y(_, Mr); var E = w(_); function _() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : .4, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 8, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 6, a = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 2 * Math.PI; O(this, _), (e = E.call(this)).type = "TorusBufferGeometry", e.parameters = { radius: t, tube: n, radialSegments: i, tubularSegments: r, arc: a }; for (var i = Math.floor(i), r = Math.floor(r), o = [], s = [], l = [], u = [], c = new Cn, d = new Cn, h = new Cn, p = 0; p <= i; p++) for (var f = 0; f <= r; f++) { var m = f / r * a , v = p / i * Math.PI * 2; d.x = (t + n * Math.cos(v)) * Math.cos(m), d.y = (t + n * Math.cos(v)) * Math.sin(m), d.z = n * Math.sin(v), s.push(d.x, d.y, d.z), c.x = t * Math.cos(m), c.y = t * Math.sin(m), h.subVectors(d, c).normalize(), l.push(h.x, h.y, h.z), u.push(f / r), u.push(p / i) } for (var g = 1; g <= i; g++) for (var y = 1; y <= r; y++) { var w = (r + 1) * (g - 1) + y - 1 , b = (r + 1) * (g - 1) + y , x = (r + 1) * g + y; o.push((r + 1) * g + y - 1, w, x), o.push(w, b, x) } return e.setIndex(o), e.setAttribute("position", new dr(s,3)), e.setAttribute("normal", new dr(l,3)), e.setAttribute("uv", new dr(u,2)), e } return h(_) }() , Lu = function() { y(s, Sl); var o = w(s); function s(e, t, n, i, r) { var a; return O(this, s), (a = o.call(this)).type = "TorusGeometry", a.parameters = { radius: e, tube: t, radialSegments: n, tubularSegments: i, arc: r }, a.fromBufferGeometry(new Bu(e,t,n,i,r)), a.mergeVertices(), a } return h(s) }() , Ru = function() { y(D, Mr); var P = w(D); function D() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : .4, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 64, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 8, a = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 2, o = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 3; O(this, D), (e = P.call(this)).type = "TorusKnotBufferGeometry", e.parameters = { radius: t, tube: n, tubularSegments: i, radialSegments: r, p: a, q: o }; for (var i = Math.floor(i), r = Math.floor(r), s = [], l = [], u = [], c = [], d = new Cn, h = new Cn, p = new Cn, f = new Cn, m = new Cn, v = new Cn, g = new Cn, y = 0; y <= i; ++y) { var w = y / i * a * Math.PI * 2; C(w, a, o, t, p), C(.01 + w, a, o, t, f), v.subVectors(f, p), g.addVectors(f, p), m.crossVectors(v, g), g.crossVectors(m, v), m.normalize(), g.normalize(); for (var b = 0; b <= r; ++b) { var x = b / r * Math.PI * 2 , E = -n * Math.cos(x) , x = n * Math.sin(x); d.x = p.x + (E * g.x + x * m.x), d.y = p.y + (E * g.y + x * m.y), d.z = p.z + (E * g.z + x * m.z), l.push(d.x, d.y, d.z), h.subVectors(d, p).normalize(), u.push(h.x, h.y, h.z), c.push(y / i), c.push(b / r) } } for (var _ = 1; _ <= i; _++) for (var M = 1; M <= r; M++) { var A = (r + 1) * _ + (M - 1) , T = (r + 1) * _ + M , S = (r + 1) * (_ - 1) + M; s.push((r + 1) * (_ - 1) + (M - 1), A, S), s.push(A, T, S) } function C(e, t, n, i, r) { var a = Math.cos(e) , o = Math.sin(e) , t = n / t * e , e = Math.cos(t); r.x = i * (2 + e) * .5 * a, r.y = i * (2 + e) * o * .5, r.z = i * Math.sin(t) * .5 } return e.setIndex(s), e.setAttribute("position", new dr(l,3)), e.setAttribute("normal", new dr(u,3)), e.setAttribute("uv", new dr(c,2)), e } return h(D) }() , Fu = function() { y(u, Sl); var l = w(u); function u(e, t, n, i, r, a, o) { var s; return O(this, u), (s = l.call(this)).type = "TorusKnotGeometry", s.parameters = { radius: e, tube: t, tubularSegments: n, radialSegments: i, p: r, q: a }, void 0 !== o && console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."), s.fromBufferGeometry(new Ru(e,t,n,i,r,a)), s.mergeVertices(), s } return h(u) }() , Iu = function() { y(g, Mr); var a = w(g); function g(o) { var e, s = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 64, l = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1, u = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 8, t = 4 < arguments.length && void 0 !== arguments[4] && arguments[4]; O(this, g), (e = a.call(this)).type = "TubeBufferGeometry", e.parameters = { path: o, tubularSegments: s, radius: l, radialSegments: u, closed: t }; var c = o.computeFrenetFrames(s, t); e.tangents = c.tangents, e.normals = c.normals, e.binormals = c.binormals; var d = new Cn , h = new Cn , n = new yn , p = new Cn , f = [] , m = [] , i = [] , v = []; function r(e) { p = o.getPointAt(e / s, p); for (var t = c.normals[e], n = c.binormals[e], i = 0; i <= u; i++) { var r = i / u * Math.PI * 2 , a = Math.sin(r) , r = -Math.cos(r); h.x = r * t.x + a * n.x, h.y = r * t.y + a * n.y, h.z = r * t.z + a * n.z, h.normalize(), m.push(h.x, h.y, h.z), d.x = p.x + l * h.x, d.y = p.y + l * h.y, d.z = p.z + l * h.z, f.push(d.x, d.y, d.z) } } return function() { for (var e = 0; e < s; e++) r(e); r(!1 === t ? s : 0), function() { for (var e = 0; e <= s; e++) for (var t = 0; t <= u; t++) n.x = e / s, n.y = t / u, i.push(n.x, n.y) }(), function() { for (var e = 1; e <= s; e++) for (var t = 1; t <= u; t++) { var n = (u + 1) * (e - 1) + (t - 1) , i = (u + 1) * e + (t - 1) , r = (u + 1) * e + t , a = (u + 1) * (e - 1) + t; v.push(n, i, a), v.push(i, r, a) } }() }(), e.setIndex(v), e.setAttribute("position", new dr(f,3)), e.setAttribute("normal", new dr(m,3)), e.setAttribute("uv", new dr(i,2)), e } return h(g, [{ key: "toJSON", value: function() { var e = Mr.prototype.toJSON.call(this); return e.path = this.parameters.path.toJSON(), e } }]), g }() , Ou = function() { y(l, Sl); var s = w(l); function l(e, t, n, i, r, a) { var o; O(this, l), (o = s.call(this)).type = "TubeGeometry", o.parameters = { path: e, tubularSegments: t, radius: n, radialSegments: i, closed: r }, void 0 !== a && console.warn("THREE.TubeGeometry: taper has been removed."); r = new Iu(e,t,n,i,r); return o.tangents = r.tangents, o.normals = r.normals, o.binormals = r.binormals, o.fromBufferGeometry(r), o.mergeVertices(), o } return h(l) }() , zu = function() { y(I, Mr); var F = w(I); function I(e) { var t; O(this, I), (t = F.call(this)).type = "WireframeGeometry"; var n = [] , i = [0, 0] , r = {} , a = ["a", "b", "c"]; if (e && e.isGeometry) { for (var o, s = e.faces, l = 0, u = s.length; l < u; l++) for (var c = s[l], d = 0; d < 3; d++) { var h = c[a[d]] , p = c[a[(d + 1) % 3]]; i[0] = Math.min(h, p), i[1] = Math.max(h, p); p = i[0] + "," + i[1]; void 0 === r[p] && (r[p] = { index1: i[0], index2: i[1] }) } for (o in r) { var f = r[o] , m = e.vertices[f.index1]; n.push(m.x, m.y, m.z), m = e.vertices[f.index2], n.push(m.x, m.y, m.z) } } else if (e && e.isBufferGeometry) { var v = new Cn; if (null !== e.index) { for (var g, y = e.attributes.position, w = e.index, b = e.groups, x = 0, E = (b = 0 === b.length ? [{ start: 0, count: w.count, materialIndex: 0 }] : b).length; x < E; ++x) for (var _ = b[x], M = _.start, A = M, T = M + _.count; A < T; A += 3) for (var S = 0; S < 3; S++) { var C = w.getX(A + S) , P = w.getX(A + (S + 1) % 3); i[0] = Math.min(C, P), i[1] = Math.max(C, P); P = i[0] + "," + i[1]; void 0 === r[P] && (r[P] = { index1: i[0], index2: i[1] }) } for (g in r) { var D = r[g]; v.fromBufferAttribute(y, D.index1), n.push(v.x, v.y, v.z), v.fromBufferAttribute(y, D.index2), n.push(v.x, v.y, v.z) } } else for (var k = e.attributes.position, B = 0, L = k.count / 3; B < L; B++) for (var R = 0; R < 3; R++) v.fromBufferAttribute(k, 3 * B + R), n.push(v.x, v.y, v.z), v.fromBufferAttribute(k, 3 * B + (R + 1) % 3), n.push(v.x, v.y, v.z) } return t.setAttribute("position", new dr(n,3)), t } return h(I) }() , Nu = Object.freeze({ __proto__: null, BoxGeometry: Cl, BoxBufferGeometry: Wr, CircleGeometry: Dl, CircleBufferGeometry: Pl, ConeGeometry: Ll, ConeBufferGeometry: Rl, CylinderGeometry: Bl, CylinderBufferGeometry: kl, DodecahedronGeometry: Ol, DodecahedronBufferGeometry: Il, EdgesGeometry: Hl, ExtrudeGeometry: du, ExtrudeBufferGeometry: uu, IcosahedronGeometry: pu, IcosahedronBufferGeometry: hu, LatheGeometry: mu, LatheBufferGeometry: fu, OctahedronGeometry: gu, OctahedronBufferGeometry: vu, ParametricGeometry: wu, ParametricBufferGeometry: yu, PlaneGeometry: bu, PlaneBufferGeometry: ua, PolyhedronGeometry: xu, PolyhedronBufferGeometry: Fl, RingGeometry: _u, RingBufferGeometry: Eu, ShapeGeometry: Au, ShapeBufferGeometry: Mu, SphereGeometry: Su, SphereBufferGeometry: Tu, TetrahedronGeometry: Pu, TetrahedronBufferGeometry: Cu, TextGeometry: ku, TextBufferGeometry: Du, TorusGeometry: Lu, TorusBufferGeometry: Bu, TorusKnotGeometry: Fu, TorusKnotBufferGeometry: Ru, TubeGeometry: Ou, TubeBufferGeometry: Iu, WireframeGeometry: zu }); function Uu(e) { Ki.call(this), this.type = "ShadowMaterial", this.color = new Yi(0), this.transparent = !0, this.setValues(e) } function Gu(e) { Qr.call(this, e), this.type = "RawShaderMaterial" } function Hu(e) { Ki.call(this), this.defines = { STANDARD: "" }, this.type = "MeshStandardMaterial", this.color = new Yi(16777215), this.roughness = 1, this.metalness = 0, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Yi(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = sn, this.normalScale = new yn(1,1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.roughnessMap = null, this.metalnessMap = null, this.alphaMap = null, this.envMap = null, this.envMapIntensity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframelineWidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.skinning = !1, this.morphTargets = !1, this.morphNormals = !1, this.vertexTangents = !1, this.setValues(e) } function Vu(e) { Hu.call(this), this.defines = { STANDARD: "", PHYSICAL: "" }, this.type = "MeshPhysicalMaterial", this.clearcoat = 0, this.clearcoatMap = null, this.clearcoatRoughness = 0, this.clearcoatRoughnessMap = null, this.clearcoatNormalScale = new yn(1,1), this.clearcoatNormalMap = null, this.reflectivity = .5, Object.defineProperty(this, "ior", { get: function() { return (1 + .4 * this.reflectivity) / (1 - .4 * this.reflectivity) }, set: function(e) { this.reflectivity = gn.clamp(2.5 * (e - 1) / (e + 1), 0, 1) } }), this.sheen = null, this.transmission = 0, this.transmissionMap = null, this.setValues(e) } function ju(e) { Ki.call(this), this.type = "MeshPhongMaterial", this.color = new Yi(16777215), this.specular = new Yi(1118481), this.shininess = 30, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Yi(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = sn, this.normalScale = new yn(1,1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = k, this.reflectivity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframelineWidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.skinning = !1, this.morphTargets = !1, this.morphNormals = !1, this.setValues(e) } function Wu(e) { Ki.call(this), this.defines = { TOON: "" }, this.type = "MeshToonMaterial", this.color = new Yi(16777215), this.map = null, this.gradientMap = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Yi(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = sn, this.normalScale = new yn(1,1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.alphaMap = null, this.wireframe = !1, this.wireframelineWidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.skinning = !1, this.morphTargets = !1, this.morphNormals = !1, this.setValues(e) } function Xu(e) { Ki.call(this), this.type = "MeshNormalMaterial", this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = sn, this.normalScale = new yn(1,1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframelineWidth = 1, this.fog = !1, this.skinning = !1, this.morphTargets = !1, this.morphNormals = !1, this.setValues(e) } function qu(e) { Ki.call(this), this.type = "MeshLambertMaterial", this.color = new Yi(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Yi(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = k, this.reflectivity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframelineWidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.skinning = !1, this.morphTargets = !1, this.morphNormals = !1, this.setValues(e) } function Ju(e) { Ki.call(this), this.defines = { MATCAP: "" }, this.type = "MeshMatcapMaterial", this.color = new Yi(16777215), this.matcap = null, this.map = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = sn, this.normalScale = new yn(1,1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.alphaMap = null, this.skinning = !1, this.morphTargets = !1, this.morphNormals = !1, this.setValues(e) } function Yu(e) { tl.call(this), this.type = "LineDashedMaterial", this.scale = 1, this.dashSize = 3, this.gapSize = 1, this.setValues(e) } ((Uu.prototype = Object.create(Ki.prototype)).constructor = Uu).prototype.isShadowMaterial = !0, Uu.prototype.copy = function(e) { return Ki.prototype.copy.call(this, e), this.color.copy(e.color), this } , ((Gu.prototype = Object.create(Qr.prototype)).constructor = Gu).prototype.isRawShaderMaterial = !0, ((Hu.prototype = Object.create(Ki.prototype)).constructor = Hu).prototype.isMeshStandardMaterial = !0, Hu.prototype.copy = function(e) { return Ki.prototype.copy.call(this, e), this.defines = { STANDARD: "" }, this.color.copy(e.color), this.roughness = e.roughness, this.metalness = e.metalness, this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.roughnessMap = e.roughnessMap, this.metalnessMap = e.metalnessMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.envMapIntensity = e.envMapIntensity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframelineWidth = e.wireframelineWidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.skinning = e.skinning, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.vertexTangents = e.vertexTangents, this } , ((Vu.prototype = Object.create(Hu.prototype)).constructor = Vu).prototype.isMeshPhysicalMaterial = !0, Vu.prototype.copy = function(e) { return Hu.prototype.copy.call(this, e), this.defines = { STANDARD: "", PHYSICAL: "" }, this.clearcoat = e.clearcoat, this.clearcoatMap = e.clearcoatMap, this.clearcoatRoughness = e.clearcoatRoughness, this.clearcoatRoughnessMap = e.clearcoatRoughnessMap, this.clearcoatNormalMap = e.clearcoatNormalMap, this.clearcoatNormalScale.copy(e.clearcoatNormalScale), this.reflectivity = e.reflectivity, e.sheen ? this.sheen = (this.sheen || new Yi).copy(e.sheen) : this.sheen = null, this.transmission = e.transmission, this.transmissionMap = e.transmissionMap, this } , ((ju.prototype = Object.create(Ki.prototype)).constructor = ju).prototype.isMeshPhongMaterial = !0, ju.prototype.copy = function(e) { return Ki.prototype.copy.call(this, e), this.color.copy(e.color), this.specular.copy(e.specular), this.shininess = e.shininess, this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframelineWidth = e.wireframelineWidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.skinning = e.skinning, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this } , ((Wu.prototype = Object.create(Ki.prototype)).constructor = Wu).prototype.isMeshToonMaterial = !0, Wu.prototype.copy = function(e) { return Ki.prototype.copy.call(this, e), this.color.copy(e.color), this.map = e.map, this.gradientMap = e.gradientMap, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.alphaMap = e.alphaMap, this.wireframe = e.wireframe, this.wireframelineWidth = e.wireframelineWidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.skinning = e.skinning, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this } , ((Xu.prototype = Object.create(Ki.prototype)).constructor = Xu).prototype.isMeshNormalMaterial = !0, Xu.prototype.copy = function(e) { return Ki.prototype.copy.call(this, e), this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.wireframe = e.wireframe, this.wireframelineWidth = e.wireframelineWidth, this.skinning = e.skinning, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this } , ((qu.prototype = Object.create(Ki.prototype)).constructor = qu).prototype.isMeshLambertMaterial = !0, qu.prototype.copy = function(e) { return Ki.prototype.copy.call(this, e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframelineWidth = e.wireframelineWidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.skinning = e.skinning, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this } , ((Ju.prototype = Object.create(Ki.prototype)).constructor = Ju).prototype.isMeshMatcapMaterial = !0, Ju.prototype.copy = function(e) { return Ki.prototype.copy.call(this, e), this.defines = { MATCAP: "" }, this.color.copy(e.color), this.matcap = e.matcap, this.map = e.map, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.alphaMap = e.alphaMap, this.skinning = e.skinning, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this } , ((Yu.prototype = Object.create(tl.prototype)).constructor = Yu).prototype.isLineDashedMaterial = !0, Yu.prototype.copy = function(e) { return tl.prototype.copy.call(this, e), this.scale = e.scale, this.dashSize = e.dashSize, this.gapSize = e.gapSize, this } ; var Zu = Object.freeze({ __proto__: null, ShadowMaterial: Uu, SpriteMaterial: Es, RawShaderMaterial: Gu, ShaderMaterial: Qr, PointsMaterial: hl, MeshPhysicalMaterial: Vu, MeshStandardMaterial: Hu, MeshPhongMaterial: ju, MeshToonMaterial: Wu, MeshNormalMaterial: Xu, MeshLambertMaterial: qu, MeshDepthMaterial: es, MeshDistanceMaterial: ts, MeshBasicMaterial: $i, MeshMatcapMaterial: Ju, LineDashedMaterial: Yu, LineBasicMaterial: tl, Material: Ki }) , Qu = { arraySlice: function(e, t, n) { return Qu.isTypedArray(e) ? new e.constructor(e.subarray(t, void 0 !== n ? n : e.length)) : e.slice(t, n) }, convertArray: function(e, t, n) { return !e || !n && e.constructor === t ? e : "number" == typeof t.BYTES_PER_ELEMENT ? new t(e) : Array.prototype.slice.call(e) }, isTypedArray: function(e) { return ArrayBuffer.isView(e) && !(e instanceof DataView) }, getKeyframeOrder: function(n) { for (var e = n.length, t = new Array(e), i = 0; i !== e; ++i) t[i] = i; return t.sort(function(e, t) { return n[e] - n[t] }), t }, sortedArray: function(e, t, n) { for (var i = e.length, r = new e.constructor(i), a = 0, o = 0; o !== i; ++a) for (var s = n[a] * t, l = 0; l !== t; ++l) r[o++] = e[s + l]; return r }, flattenJSON: function(e, t, n, i) { for (var r = 1, a = e[0]; void 0 !== a && void 0 === a[i]; ) a = e[r++]; if (void 0 !== a) { var o = a[i]; if (void 0 !== o) if (Array.isArray(o)) for (; void 0 !== (o = a[i]) && (t.push(a.time), n.push.apply(n, o)), void 0 !== (a = e[r++]); ) ; else if (void 0 !== o.toArray) for (; void 0 !== (o = a[i]) && (t.push(a.time), o.toArray(n, n.length)), void 0 !== (a = e[r++]); ) ; else for (; void 0 !== (o = a[i]) && (t.push(a.time), n.push(o)), void 0 !== (a = e[r++]); ) ; } }, subclip: function(e, t, n, i) { var r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 30 , a = e.clone(); a.name = t; for (var o = [], s = 0; s < a.tracks.length; ++s) { for (var l = a.tracks[s], u = l.getValueSize(), c = [], d = [], h = 0; h < l.times.length; ++h) { var p = l.times[h] * r; if (!(p < n || i <= p)) { c.push(l.times[h]); for (var f = 0; f < u; ++f) d.push(l.values[h * u + f]) } } 0 !== c.length && (l.times = Qu.convertArray(c, l.times.constructor), l.values = Qu.convertArray(d, l.values.constructor), o.push(l)) } a.tracks = o; for (var m = 1 / 0, v = 0; v < a.tracks.length; ++v) m > a.tracks[v].times[0] && (m = a.tracks[v].times[0]); for (var g = 0; g < a.tracks.length; ++g) a.tracks[g].shift(-1 * m); return a.resetDuration(), a }, makeClipAdditive: function(v) { for (var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, g = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : v, t = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 30, n = g.tracks.length, y = e / (t = t <= 0 ? 30 : t), i = 0; i < n; ++i) (function(e) { var t = g.tracks[e] , n = t.ValueTypeName; if ("bool" === n || "string" === n) return; var i = v.tracks.find(function(e) { return e.name === t.name && e.ValueTypeName === n }); if (void 0 === i) return; var r = 0 , a = t.getValueSize(); t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (r = a / 3); var o = 0 , s = i.getValueSize(); i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (o = s / 3); var l, u = t.times.length - 1, c = void 0; c = y <= t.times[0] ? (e = r, Qu.arraySlice(t.values, e, a - r)) : y >= t.times[u] ? Qu.arraySlice(t.values, l = u * a + r, l + a - r) : (a = a - (l = r), (r = t.createInterpolant()).evaluate(y), Qu.arraySlice(r.resultBuffer, l, a)), "quaternion" === n && (new Sn).fromArray(c).normalize().conjugate().toArray(c); for (var d = i.times.length, h = 0; h < d; ++h) { var p = h * s + o; if ("quaternion" === n) Sn.multiplyQuaternionsFlat(i.values, p, c, 0, i.values, p); else for (var f = s - 2 * o, m = 0; m < f; ++m) i.values[p + m] -= c[m] } } )(i); return v.blendMode = 2501, v } }; function Ku(e, t, n, i) { this.parameterPositions = e, this._cachedIndex = 0, this.resultBuffer = void 0 !== i ? i : new t.constructor(n), this.sampleValues = t, this.valueSize = n } function $u(e, t, n, i) { Ku.call(this, e, t, n, i), this._weightPrev = -0, this._offsetPrev = -0, this._weightNext = -0, this._offsetNext = -0 } function ec(e, t, n, i) { Ku.call(this, e, t, n, i) } function tc(e, t, n, i) { Ku.call(this, e, t, n, i) } function nc(e, t, n, i) { if (void 0 === e) throw new Error("THREE.KeyframeTrack: track name is undefined"); if (void 0 === t || 0 === t.length) throw new Error("THREE.KeyframeTrack: no keyframes in track named " + e); this.name = e, this.times = Qu.convertArray(t, this.TimeBufferType), this.values = Qu.convertArray(n, this.ValueBufferType), this.setInterpolation(i || this.DefaultInterpolation) } function ic(e, t, n) { nc.call(this, e, t, n) } function rc(e, t, n, i) { nc.call(this, e, t, n, i) } function ac(e, t, n, i) { nc.call(this, e, t, n, i) } function oc(e, t, n, i) { Ku.call(this, e, t, n, i) } function sc(e, t, n, i) { nc.call(this, e, t, n, i) } function lc(e, t, n, i) { nc.call(this, e, t, n, i) } function uc(e, t, n, i) { nc.call(this, e, t, n, i) } function cc(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : -1 , n = 2 < arguments.length ? arguments[2] : void 0 , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 2500; this.name = e, this.tracks = n, this.duration = t, this.blendMode = i, this.uuid = gn.generateUUID(), this.duration < 0 && this.resetDuration() } function dc(e) { if (void 0 === e.type) throw new Error("THREE.KeyframeTrack: track type undefined, can not parse"); var t, n, i = function(e) { switch (e.toLowerCase()) { case "scalar": case "double": case "float": case "number": case "integer": return ac; case "vector": case "vector2": case "vector3": case "vector4": return uc; case "color": return rc; case "quaternion": return sc; case "bool": case "boolean": return ic; case "string": return lc } throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + e) }(e.type); return void 0 === e.times && (Qu.flattenJSON(e.keys, t = [], n = [], "value"), e.times = t, e.values = n), void 0 !== i.parse ? i.parse(e) : new i(e.name,e.times,e.values,e.interpolation) } Object.assign(Ku.prototype, { evaluate: function(e) { var t, n = this.parameterPositions, i = this._cachedIndex, r = n[i], a = n[i - 1]; e: { t: { n: { i: if (!(e < r)) { for (var o = i + 2; ; ) { if (void 0 === r) { if (e < a) break i; return i = n.length, this._cachedIndex = i, this.afterEnd_(i - 1, e, a) } if (i === o) break; if (a = r, e < (r = n[++i])) break t } t = n.length; break n } if (a <= e) break e; var s = n[1]; e < s && (i = 2, a = s); for (var l = i - 2; ; ) { if (void 0 === a) return this._cachedIndex = 0, this.beforeStart_(0, e, r); if (i === l) break; if (r = a, (a = n[--i - 1]) <= e) break t } t = i, i = 0 } for (; i < t; ) { var u = i + t >>> 1; e < n[u] ? t = u : i = 1 + u } if (r = n[i], void 0 === (a = n[i - 1])) return this._cachedIndex = 0, this.beforeStart_(0, e, r); if (void 0 === r) return i = n.length, this._cachedIndex = i, this.afterEnd_(i - 1, a, e) } this._cachedIndex = i, this.intervalChanged_(i, a, r) } return this.interpolate_(i, a, e, r) }, settings: null, DefaultSettings_: {}, getSettings_: function() { return this.settings || this.DefaultSettings_ }, copySampleValue_: function(e) { for (var t = this.resultBuffer, n = this.sampleValues, i = this.valueSize, r = e * i, a = 0; a !== i; ++a) t[a] = n[r + a]; return t }, interpolate_: function() { throw new Error("call to abstract method") }, intervalChanged_: function() {} }), Object.assign(Ku.prototype, { beforeStart_: Ku.prototype.copySampleValue_, afterEnd_: Ku.prototype.copySampleValue_ }), $u.prototype = Object.assign(Object.create(Ku.prototype), { constructor: $u, DefaultSettings_: { endingStart: en, endingEnd: en }, intervalChanged_: function(e, t, n) { var i = this.parameterPositions , r = e - 2 , a = e + 1 , o = i[r] , s = i[a]; if (void 0 === o) switch (this.getSettings_().endingStart) { case tn: r = e, o = 2 * t - n; break; case nn: o = t + i[r = i.length - 2] - i[r + 1]; break; default: r = e, o = n } if (void 0 === s) switch (this.getSettings_().endingEnd) { case tn: a = e, s = 2 * n - t; break; case nn: s = n + i[a = 1] - i[0]; break; default: a = e - 1, s = t } var l = .5 * (n - t) , u = this.valueSize; this._weightPrev = l / (t - o), this._weightNext = l / (s - n), this._offsetPrev = r * u, this._offsetNext = a * u }, interpolate_: function(e, t, n, i) { for (var r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = e * o, l = s - o, u = this._offsetPrev, c = this._offsetNext, d = this._weightPrev, e = this._weightNext, n = (n - t) / (i - t), i = n * n, t = i * n, h = -d * t + 2 * d * i - d * n, p = (1 + d) * t + (-1.5 - 2 * d) * i + (-.5 + d) * n + 1, f = (-1 - e) * t + (1.5 + e) * i + .5 * n, m = e * t - e * i, v = 0; v !== o; ++v) r[v] = h * a[u + v] + p * a[l + v] + f * a[s + v] + m * a[c + v]; return r } }), ec.prototype = Object.assign(Object.create(Ku.prototype), { constructor: ec, interpolate_: function(e, t, n, i) { for (var r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = e * o, l = s - o, u = (n - t) / (i - t), c = 1 - u, d = 0; d !== o; ++d) r[d] = a[l + d] * c + a[s + d] * u; return r } }), tc.prototype = Object.assign(Object.create(Ku.prototype), { constructor: tc, interpolate_: function(e) { return this.copySampleValue_(e - 1) } }), Object.assign(nc, { toJSON: function(e) { var t, n = e.constructor; return void 0 !== n.toJSON ? t = n.toJSON(e) : (t = { name: e.name, times: Qu.convertArray(e.times, Array), values: Qu.convertArray(e.values, Array) }, (n = e.getInterpolation()) !== e.DefaultInterpolation && (t.interpolation = n)), t.type = e.ValueTypeName, t } }), Object.assign(nc.prototype, { constructor: nc, TimeBufferType: Float32Array, ValueBufferType: Float32Array, DefaultInterpolation: $t, InterpolantFactoryMethodDiscrete: function(e) { return new tc(this.times,this.values,this.getValueSize(),e) }, InterpolantFactoryMethodLinear: function(e) { return new ec(this.times,this.values,this.getValueSize(),e) }, InterpolantFactoryMethodSmooth: function(e) { return new $u(this.times,this.values,this.getValueSize(),e) }, setInterpolation: function(e) { var t; switch (e) { case Kt: t = this.InterpolantFactoryMethodDiscrete; break; case $t: t = this.InterpolantFactoryMethodLinear; break; case 2302: t = this.InterpolantFactoryMethodSmooth } if (void 0 !== t) return this.createInterpolant = t, this; var n = "unsupported interpolation for " + this.ValueTypeName + " keyframe track named " + this.name; if (void 0 === this.createInterpolant) { if (e === this.DefaultInterpolation) throw new Error(n); this.setInterpolation(this.DefaultInterpolation) } return console.warn("THREE.KeyframeTrack:", n), this }, getInterpolation: function() { switch (this.createInterpolant) { case this.InterpolantFactoryMethodDiscrete: return Kt; case this.InterpolantFactoryMethodLinear: return $t; case this.InterpolantFactoryMethodSmooth: return 2302 } }, getValueSize: function() { return this.values.length / this.times.length }, shift: function(e) { if (0 !== e) for (var t = this.times, n = 0, i = t.length; n !== i; ++n) t[n] += e; return this }, scale: function(e) { if (1 !== e) for (var t = this.times, n = 0, i = t.length; n !== i; ++n) t[n] *= e; return this }, trim: function(e, t) { for (var n, i = this.times, r = i.length, a = 0, o = r - 1; a !== r && i[a] < e; ) ++a; for (; -1 !== o && i[o] > t; ) --o; return ++o, 0 === a && o === r || (o <= a && (a = (o = Math.max(o, 1)) - 1), n = this.getValueSize(), this.times = Qu.arraySlice(i, a, o), this.values = Qu.arraySlice(this.values, a * n, o * n)), this }, validate: function() { var e = !0 , t = this.getValueSize(); t - Math.floor(t) != 0 && (console.error("THREE.KeyframeTrack: Invalid value size in track.", this), e = !1); var n = this.times , i = this.values , r = n.length; 0 === r && (console.error("THREE.KeyframeTrack: Track is empty.", this), e = !1); for (var a = null, o = 0; o !== r; o++) { var s = n[o]; if ("number" == typeof s && isNaN(s)) { console.error("THREE.KeyframeTrack: Time is not a valid number.", this, o, s), e = !1; break } if (null !== a && s < a) { console.error("THREE.KeyframeTrack: Out of order keys.", this, o, s, a), e = !1; break } a = s } if (void 0 !== i && Qu.isTypedArray(i)) for (var l = 0, u = i.length; l !== u; ++l) { var c = i[l]; if (isNaN(c)) { console.error("THREE.KeyframeTrack: Value is not a valid number.", this, l, c), e = !1; break } } return e }, optimize: function() { for (var e = Qu.arraySlice(this.times), t = Qu.arraySlice(this.values), n = this.getValueSize(), i = 2302 === this.getInterpolation(), r = e.length - 1, a = 1, o = 1; o < r; ++o) { var s = !1 , l = e[o]; if (l !== e[o + 1] && (1 !== o || l !== l[0])) if (i) s = !0; else for (var u = o * n, c = u - n, d = u + n, h = 0; h !== n; ++h) { var p = t[u + h]; if (p !== t[c + h] || p !== t[d + h]) { s = !0; break } } if (s) { if (o !== a) { e[a] = e[o]; for (var f = o * n, m = a * n, v = 0; v !== n; ++v) t[m + v] = t[f + v] } ++a } } if (0 < r) { e[a] = e[r]; for (var g = r * n, y = a * n, w = 0; w !== n; ++w) t[y + w] = t[g + w]; ++a } return a !== e.length ? (this.times = Qu.arraySlice(e, 0, a), this.values = Qu.arraySlice(t, 0, a * n)) : (this.times = e, this.values = t), this }, clone: function() { var e = Qu.arraySlice(this.times, 0) , t = Qu.arraySlice(this.values, 0) , t = new this.constructor(this.name,e,t); return t.createInterpolant = this.createInterpolant, t } }), ic.prototype = Object.assign(Object.create(nc.prototype), { constructor: ic, ValueTypeName: "bool", ValueBufferType: Array, DefaultInterpolation: Kt, InterpolantFactoryMethodLinear: void 0, InterpolantFactoryMethodSmooth: void 0 }), rc.prototype = Object.assign(Object.create(nc.prototype), { constructor: rc, ValueTypeName: "color" }), ac.prototype = Object.assign(Object.create(nc.prototype), { constructor: ac, ValueTypeName: "number" }), oc.prototype = Object.assign(Object.create(Ku.prototype), { constructor: oc, interpolate_: function(e, t, n, i) { for (var r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = (n - t) / (i - t), l = e * o, u = l + o; l !== u; l += 4) Sn.slerpFlat(r, 0, a, l - o, a, l, s); return r } }), sc.prototype = Object.assign(Object.create(nc.prototype), { constructor: sc, ValueTypeName: "quaternion", DefaultInterpolation: $t, InterpolantFactoryMethodLinear: function(e) { return new oc(this.times,this.values,this.getValueSize(),e) }, InterpolantFactoryMethodSmooth: void 0 }), lc.prototype = Object.assign(Object.create(nc.prototype), { constructor: lc, ValueTypeName: "string", ValueBufferType: Array, DefaultInterpolation: Kt, InterpolantFactoryMethodLinear: void 0, InterpolantFactoryMethodSmooth: void 0 }), uc.prototype = Object.assign(Object.create(nc.prototype), { constructor: uc, ValueTypeName: "vector" }), Object.assign(cc, { parse: function(e) { for (var t = [], n = e.tracks, i = 1 / (e.fps || 1), r = 0, a = n.length; r !== a; ++r) t.push(dc(n[r]).scale(i)); var o = new cc(e.name,e.duration,t,e.blendMode); return o.uuid = e.uuid, o }, toJSON: function(e) { for (var t = [], n = e.tracks, e = { name: e.name, duration: e.duration, tracks: t, uuid: e.uuid, blendMode: e.blendMode }, i = 0, r = n.length; i !== r; ++i) t.push(nc.toJSON(n[i])); return e }, CreateFromMorphTargetSequence: function(e, t, n, i) { for (var r = t.length, a = [], o = 0; o < r; o++) { var s = []; (u = []).push((o + r - 1) % r, o, (o + 1) % r), s.push(0, 1, 0); var l = Qu.getKeyframeOrder(u) , u = Qu.sortedArray(u, 1, l) , s = Qu.sortedArray(s, 1, l); i || 0 !== u[0] || (u.push(r), s.push(s[0])), a.push(new ac(".morphTargetInfluences[" + t[o].name + "]",u,s).scale(1 / n)) } return new cc(e,-1,a) }, findByName: function(e, t) { var n = e; Array.isArray(e) || (n = e.geometry && e.geometry.animations || e.animations); for (var i = 0; i < n.length; i++) if (n[i].name === t) return n[i]; return null }, CreateClipsFromMorphTargetSequences: function(e, t, n) { for (var i = {}, r = /^([\w-]*?)([\d]+)$/, a = 0, o = e.length; a < o; a++) { var s, l = e[a], u = l.name.match(r); u && 1 < u.length && ((u = i[s = u[1]]) || (i[s] = u = []), u.push(l)) } var c, d = []; for (c in i) d.push(cc.CreateFromMorphTargetSequence(c, i[c], t, n)); return d }, parseAnimation: function(e, t) { if (!e) return console.error("THREE.AnimationClip: No animation in JSONLoader data."), null; for (var n = function(e, t, n, i, r) { var a; 0 !== n.length && (Qu.flattenJSON(n, a = [], n = [], i), 0 !== a.length && r.push(new e(t,a,n))) }, i = [], r = e.name || "default", a = e.fps || 30, o = e.blendMode, s = e.length || -1, l = e.hierarchy || [], u = 0; u < l.length; u++) { var c = l[u].keys; if (c && 0 !== c.length) if (c[0].morphTargets) { for (var d, h = {}, p = void 0, p = 0; p < c.length; p++) if (c[p].morphTargets) for (var f = 0; f < c[p].morphTargets.length; f++) h[c[p].morphTargets[f]] = -1; for (d in h) { for (var m = [], v = [], g = 0; g !== c[p].morphTargets.length; ++g) { var y = c[p]; m.push(y.time), v.push(y.morphTarget === d ? 1 : 0) } i.push(new ac(".morphTargetInfluence[" + d + "]",m,v)) } s = h.length * (a || 1) } else { var w = ".bones[" + t[u].name + "]"; n(uc, w + ".position", c, "pos", i), n(sc, w + ".quaternion", c, "rot", i), n(uc, w + ".scale", c, "scl", i) } } return 0 === i.length ? null : new cc(r,s,i,o) } }), Object.assign(cc.prototype, { resetDuration: function() { for (var e = 0, t = 0, n = this.tracks.length; t !== n; ++t) var i = this.tracks[t] , e = Math.max(e, i.times[i.times.length - 1]); return this.duration = e, this }, trim: function() { for (var e = 0; e < this.tracks.length; e++) this.tracks[e].trim(0, this.duration); return this }, validate: function() { for (var e = !0, t = 0; t < this.tracks.length; t++) e = e && this.tracks[t].validate(); return e }, optimize: function() { for (var e = 0; e < this.tracks.length; e++) this.tracks[e].optimize(); return this }, clone: function() { for (var e = [], t = 0; t < this.tracks.length; t++) e.push(this.tracks[t].clone()); return new cc(this.name,this.duration,e,this.blendMode) }, toJSON: function() { return cc.toJSON(this) } }); var hc = { enabled: !1, files: {}, add: function(e, t) { !1 !== this.enabled && (this.files[e] = t) }, get: function(e) { if (!1 !== this.enabled) return this.files[e] }, remove: function(e) { delete this.files[e] }, clear: function() { this.files = {} } }; function pc(e, t, n) { var i = this , r = !1 , a = 0 , o = 0 , s = void 0 , l = []; this.onStart = void 0, this.onLoad = e, this.onProgress = t, this.onError = n, this.itemStart = function(e) { o++, !1 === r && void 0 !== i.onStart && i.onStart(e, a, o), r = !0 } , this.itemEnd = function(e) { a++, void 0 !== i.onProgress && i.onProgress(e, a, o), a === o && (r = !1, void 0 !== i.onLoad && i.onLoad()) } , this.itemError = function(e) { void 0 !== i.onError && i.onError(e) } , this.resolveURL = function(e) { return s ? s(e) : e } , this.setURLModifier = function(e) { return s = e, this } , this.addHandler = function(e, t) { return l.push(e, t), this } , this.removeHandler = function(e) { e = l.indexOf(e); return -1 !== e && l.splice(e, 2), this } , this.getHandler = function(e) { for (var t = 0, n = l.length; t < n; t += 2) { var i = l[t] , r = l[t + 1]; if (i.global && (i.lastIndex = 0), i.test(e)) return r } return null } } var fc = new pc; function mc(e) { this.manager = void 0 !== e ? e : fc, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {} } Object.assign(mc.prototype, { load: function() {}, loadAsync: function(n, i) { var r = this; return new Promise(function(e, t) { r.load(n, e, i, t) } ) }, parse: function() {}, setCrossOrigin: function(e) { return this.crossOrigin = e, this }, setWithCredentials: function(e) { return this.withCredentials = e, this }, setPath: function(e) { return this.path = e, this }, setResourcePath: function(e) { return this.resourcePath = e, this }, setRequestHeader: function(e) { return this.requestHeader = e, this } }); var vc = {}; function gc(e) { mc.call(this, e) } function yc(e) { mc.call(this, e) } function wc(e) { mc.call(this, e) } function bc(e) { mc.call(this, e) } function xc(e) { mc.call(this, e) } function Ec(e) { mc.call(this, e) } function _c(e) { mc.call(this, e) } function Mc() { this.type = "Curve", this.arcLengthDivisions = 200 } function Ac(e, t, n, i, r, a, o, s) { Mc.call(this), this.type = "EllipseCurve", this.aX = e || 0, this.aY = t || 0, this.xRadius = n || 1, this.yRadius = i || 1, this.aStartAngle = r || 0, this.aEndAngle = a || 2 * Math.PI, this.aClockwise = o || !1, this.aRotation = s || 0 } function Tc(e, t, n, i, r, a) { Ac.call(this, e, t, n, n, i, r, a), this.type = "ArcCurve" } function Sc() { var r = 0 , a = 0 , o = 0 , s = 0; function l(e, t, n, i) { o = -3 * (r = e) + 3 * t - 2 * (a = n) - i, s = 2 * e - 2 * t + n + i } return { initCatmullRom: function(e, t, n, i, r) { l(t, n, r * (n - e), r * (i - t)) }, initNonuniformCatmullRom: function(e, t, n, i, r, a, o) { r = (t - e) / r - (n - e) / (r + a) + (n - t) / a, o = (n - t) / a - (i - t) / (a + o) + (i - n) / o; l(t, n, r *= a, o *= a) }, calc: function(e) { var t = e * e; return r + a * e + o * t + s * (t * e) } } } gc.prototype = Object.assign(Object.create(mc.prototype), { constructor: gc, load: function(u, e, t, n) { void 0 === u && (u = ""), void 0 !== this.path && (u = this.path + u), u = this.manager.resolveURL(u); var c = this , i = hc.get(u); if (void 0 !== i) return c.manager.itemStart(u), setTimeout(function() { e && e(i), c.manager.itemEnd(u) }, 0), i; if (void 0 === vc[u]) { var r, a = u.match(/^data:(.*?)(;base64)?,(.*)$/); if (a) { var o = a[1] , s = !!a[2] , l = a[3] , l = decodeURIComponent(l); s && (l = atob(l)); try { var d = (this.responseType || "").toLowerCase(); switch (d) { case "arraybuffer": case "blob": for (var h = new Uint8Array(l.length), p = 0; p < l.length; p++) h[p] = l.charCodeAt(p); f = "blob" === d ? new Blob([h.buffer],{ type: o }) : h.buffer; break; case "document": var f = (new DOMParser).parseFromString(l, o); break; case "json": f = JSON.parse(l); break; default: f = l } setTimeout(function() { e && e(f), c.manager.itemEnd(u) }, 0) } catch (e) { setTimeout(function() { n && n(e), c.manager.itemError(u), c.manager.itemEnd(u) }, 0) } } else { for (var m in vc[u] = [], vc[u].push({ onLoad: e, onProgress: t, onError: n }), (r = new XMLHttpRequest).open("GET", u, !0), r.addEventListener("load", function(e) { var t = this.response , n = vc[u]; if (delete vc[u], 200 === this.status || 0 === this.status) { 0 === this.status && console.warn("THREE.FileLoader: HTTP Status 0 received."), hc.add(u, t); for (var i = 0, r = n.length; i < r; i++) { var a = n[i]; a.onLoad && a.onLoad(t, e.total) } c.manager.itemEnd(u) } else { for (var o = 0, s = n.length; o < s; o++) { var l = n[o]; l.onError && l.onError(e) } c.manager.itemError(u), c.manager.itemEnd(u) } }, !1), r.addEventListener("progress", function(e) { for (var t = vc[u], n = 0, i = t.length; n < i; n++) { var r = t[n]; r.onProgress && r.onProgress(e) } }, !1), r.addEventListener("error", function(e) { var t = vc[u]; delete vc[u]; for (var n = 0, i = t.length; n < i; n++) { var r = t[n]; r.onError && r.onError(e) } c.manager.itemError(u), c.manager.itemEnd(u) }, !1), r.addEventListener("abort", function(e) { var t = vc[u]; delete vc[u]; for (var n = 0, i = t.length; n < i; n++) { var r = t[n]; r.onError && r.onError(e) } c.manager.itemError(u), c.manager.itemEnd(u) }, !1), void 0 !== this.responseType && (r.responseType = this.responseType), void 0 !== this.withCredentials && (r.withCredentials = this.withCredentials), r.overrideMimeType && r.overrideMimeType(void 0 !== this.mimeType ? this.mimeType : "text/plain"), this.requestHeader) r.setRequestHeader(m, this.requestHeader[m]); r.send(null) } return c.manager.itemStart(u), r } vc[u].push({ onLoad: e, onProgress: t, onError: n }) }, setResponseType: function(e) { return this.responseType = e, this }, setMimeType: function(e) { return this.mimeType = e, this } }), yc.prototype = Object.assign(Object.create(mc.prototype), { constructor: yc, load: function(t, n, e, i) { var r = this , a = new gc(r.manager); a.setPath(r.path), a.setRequestHeader(r.requestHeader), a.setWithCredentials(r.withCredentials), a.load(t, function(e) { try { n(r.parse(JSON.parse(e))) } catch (e) { i ? i(e) : console.error(e), r.manager.itemError(t) } }, e, i) }, parse: function(e) { for (var t = [], n = 0; n < e.length; n++) { var i = cc.parse(e[n]); t.push(i) } return t } }), wc.prototype = Object.assign(Object.create(mc.prototype), { constructor: wc, load: function(e, a, n, i) { var o = this , s = [] , l = new bl , r = new gc(this.manager); r.setPath(this.path), r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setWithCredentials(o.withCredentials); var u = 0; if (Array.isArray(e)) for (var t = 0, c = e.length; t < c; ++t) !function(t) { r.load(e[t], function(e) { e = o.parse(e, !0); s[t] = { width: e.width, height: e.height, format: e.format, mipmaps: e.mipmaps }, 6 === (u += 1) && (1 === e.mipmapCount && (l.minFilter = Oe), l.image = s, l.format = e.format, l.needsUpdate = !0, a && a(l)) }, n, i) }(t); else r.load(e, function(e) { var t = o.parse(e, !0); if (t.isCubemap) { for (var n = t.mipmaps.length / t.mipmapCount, i = 0; i < n; i++) { s[i] = { mipmaps: [] }; for (var r = 0; r < t.mipmapCount; r++) s[i].mipmaps.push(t.mipmaps[i * t.mipmapCount + r]), s[i].format = t.format, s[i].width = t.width, s[i].height = t.height } l.image = s } else l.image.width = t.width, l.image.height = t.height, l.mipmaps = t.mipmaps; 1 === t.mipmapCount && (l.minFilter = Oe), l.format = t.format, l.needsUpdate = !0, a && a(l) }, n, i); return l } }), bc.prototype = Object.assign(Object.create(mc.prototype), { constructor: bc, load: function(t, e, n, i) { void 0 !== this.path && (t = this.path + t), t = this.manager.resolveURL(t); var r = this , a = hc.get(t); if (void 0 !== a) return r.manager.itemStart(t), setTimeout(function() { e && e(a), r.manager.itemEnd(t) }, 0), a; var o = document.createElementNS("http://www.w3.org/1999/xhtml", "img"); function s() { o.removeEventListener("load", s, !1), o.removeEventListener("error", l, !1), hc.add(t, this), e && e(this), r.manager.itemEnd(t) } function l(e) { o.removeEventListener("load", s, !1), o.removeEventListener("error", l, !1), i && i(e), r.manager.itemError(t), r.manager.itemEnd(t) } return o.addEventListener("load", s, !1), o.addEventListener("error", l, !1), "data:" !== t.substr(0, 5) && void 0 !== this.crossOrigin && (o.crossOrigin = this.crossOrigin), r.manager.itemStart(t), o.src = t, o } }), xc.prototype = Object.assign(Object.create(mc.prototype), { constructor: xc, load: function(e, n, t, i) { var r = new ta , a = new bc(this.manager); a.setCrossOrigin(this.crossOrigin), a.setPath(this.path); var o = 0; for (var s = 0; s < e.length; ++s) !function(t) { a.load(e[t], function(e) { r.images[t] = e, 6 === ++o && (r.needsUpdate = !0, n && n(r)) }, void 0, i) }(s); return r } }), Ec.prototype = Object.assign(Object.create(mc.prototype), { constructor: Ec, load: function(e, t, n, i) { var r = this , a = new ia , o = new gc(this.manager); return o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setPath(this.path), o.setWithCredentials(r.withCredentials), o.load(e, function(e) { e = r.parse(e); e && (void 0 !== e.image ? a.image = e.image : void 0 !== e.data && (a.image.width = e.width, a.image.height = e.height, a.image.data = e.data), a.wrapS = void 0 !== e.wrapS ? e.wrapS : Be, a.wrapT = void 0 !== e.wrapT ? e.wrapT : Be, a.magFilter = void 0 !== e.magFilter ? e.magFilter : Oe, a.minFilter = void 0 !== e.minFilter ? e.minFilter : Oe, a.anisotropy = void 0 !== e.anisotropy ? e.anisotropy : 1, void 0 !== e.format && (a.format = e.format), void 0 !== e.type && (a.type = e.type), void 0 !== e.mipmaps && (a.mipmaps = e.mipmaps, a.minFilter = Ne), 1 === e.mipmapCount && (a.minFilter = Oe), a.needsUpdate = !0, t && t(a, e)) }, n, i), a } }), _c.prototype = Object.assign(Object.create(mc.prototype), { constructor: _c, load: function(t, n, e, i) { var r = new En , a = new bc(this.manager); return a.setCrossOrigin(this.crossOrigin), a.setPath(this.path), a.load(t, function(e) { r.image = e; e = 0 < t.search(/\.jpe?g($|\?)/i) || 0 === t.search(/^data\:image\/jpeg/); r.format = e ? $e : et, r.needsUpdate = !0, void 0 !== n && n(r) }, e, i), r } }), Object.assign(Mc.prototype, { getPoint: function() { return console.warn("THREE.Curve: .getPoint() not implemented."), null }, getPointAt: function(e, t) { e = this.getUtoTmapping(e); return this.getPoint(e, t) }, getPoints: function() { for (var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 5, t = [], n = 0; n <= e; n++) t.push(this.getPoint(n / e)); return t }, getSpacedPoints: function() { for (var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 5, t = [], n = 0; n <= e; n++) t.push(this.getPointAt(n / e)); return t }, getLength: function() { var e = this.getLengths(); return e[e.length - 1] }, getLengths: function(e) { if (void 0 === e && (e = this.arcLengthDivisions), this.cacheArcLengths && this.cacheArcLengths.length === e + 1 && !this.needsUpdate) return this.cacheArcLengths; this.needsUpdate = !1; var t, n = [], i = this.getPoint(0), r = 0; n.push(0); for (var a = 1; a <= e; a++) r += (t = this.getPoint(a / e)).distanceTo(i), n.push(r), i = t; return this.cacheArcLengths = n }, updateArcLengths: function() { this.needsUpdate = !0, this.getLengths() }, getUtoTmapping: function(e, t) { for (var n, i = this.getLengths(), r = 0, a = i.length, o = t || e * i[a - 1], s = 0, l = a - 1; s <= l; ) if ((n = i[r = Math.floor(s + (l - s) / 2)] - o) < 0) s = r + 1; else { if (!(0 < n)) { l = r; break } l = r - 1 } if (i[r = l] === o) return r / (a - 1); e = i[r]; return (r + (o - e) / (i[r + 1] - e)) / (a - 1) }, getTangent: function(e, t) { var n = e - 1e-4 , e = e + 1e-4; 1 < e && (e = 1); n = this.getPoint(n = n < 0 ? 0 : n), e = this.getPoint(e), t = t || new (n.isVector2 ? yn : Cn); return t.copy(e).sub(n).normalize(), t }, getTangentAt: function(e, t) { e = this.getUtoTmapping(e); return this.getTangent(e, t) }, computeFrenetFrames: function(e, t) { for (var n = new Cn, i = [], r = [], a = [], o = new Cn, s = new ni, l = 0; l <= e; l++) i[l] = this.getTangentAt(l / e, new Cn), i[l].normalize(); r[0] = new Cn, a[0] = new Cn; var u = Number.MAX_VALUE , c = Math.abs(i[0].x) , d = Math.abs(i[0].y) , h = Math.abs(i[0].z); c <= u && (u = c, n.set(1, 0, 0)), d <= u && (u = d, n.set(0, 1, 0)), h <= u && n.set(0, 0, 1), o.crossVectors(i[0], n).normalize(), r[0].crossVectors(i[0], o), a[0].crossVectors(i[0], r[0]); for (var p, f = 1; f <= e; f++) r[f] = r[f - 1].clone(), a[f] = a[f - 1].clone(), o.crossVectors(i[f - 1], i[f]), o.length() > Number.EPSILON && (o.normalize(), p = Math.acos(gn.clamp(i[f - 1].dot(i[f]), -1, 1)), r[f].applyMatrix4(s.makeRotationAxis(o, p))), a[f].crossVectors(i[f], r[f]); if (!0 === t) { var m = Math.acos(gn.clamp(r[0].dot(r[e]), -1, 1)); m /= e, 0 < i[0].dot(o.crossVectors(r[0], r[e])) && (m = -m); for (var v = 1; v <= e; v++) r[v].applyMatrix4(s.makeRotationAxis(i[v], m * v)), a[v].crossVectors(i[v], r[v]) } return { tangents: i, normals: r, binormals: a } }, clone: function() { return (new this.constructor).copy(this) }, copy: function(e) { return this.arcLengthDivisions = e.arcLengthDivisions, this }, toJSON: function() { var e = { metadata: { version: 4.5, type: "Curve", generator: "Curve.toJSON" } }; return e.arcLengthDivisions = this.arcLengthDivisions, e.type = this.type, e }, fromJSON: function(e) { return this.arcLengthDivisions = e.arcLengthDivisions, this } }), ((Ac.prototype = Object.create(Mc.prototype)).constructor = Ac).prototype.isEllipseCurve = !0, Ac.prototype.getPoint = function(e, t) { for (var n = t || new yn, i = 2 * Math.PI, r = this.aEndAngle - this.aStartAngle, a = Math.abs(r) < Number.EPSILON; r < 0; ) r += i; for (; i < r; ) r -= i; r < Number.EPSILON && (r = a ? 0 : i), !0 !== this.aClockwise || a || (r === i ? r = -i : r -= i); var o = this.aStartAngle + e * r , s = this.aX + this.xRadius * Math.cos(o) , l = this.aY + this.yRadius * Math.sin(o); return 0 !== this.aRotation && (t = Math.cos(this.aRotation), a = Math.sin(this.aRotation), s = (e = s - this.aX) * t - (o = l - this.aY) * a + this.aX, l = e * a + o * t + this.aY), n.set(s, l) } , Ac.prototype.copy = function(e) { return Mc.prototype.copy.call(this, e), this.aX = e.aX, this.aY = e.aY, this.xRadius = e.xRadius, this.yRadius = e.yRadius, this.aStartAngle = e.aStartAngle, this.aEndAngle = e.aEndAngle, this.aClockwise = e.aClockwise, this.aRotation = e.aRotation, this } , Ac.prototype.toJSON = function() { var e = Mc.prototype.toJSON.call(this); return e.aX = this.aX, e.aY = this.aY, e.xRadius = this.xRadius, e.yRadius = this.yRadius, e.aStartAngle = this.aStartAngle, e.aEndAngle = this.aEndAngle, e.aClockwise = this.aClockwise, e.aRotation = this.aRotation, e } , Ac.prototype.fromJSON = function(e) { return Mc.prototype.fromJSON.call(this, e), this.aX = e.aX, this.aY = e.aY, this.xRadius = e.xRadius, this.yRadius = e.yRadius, this.aStartAngle = e.aStartAngle, this.aEndAngle = e.aEndAngle, this.aClockwise = e.aClockwise, this.aRotation = e.aRotation, this } , ((Tc.prototype = Object.create(Ac.prototype)).constructor = Tc).prototype.isArcCurve = !0; var Cc = new Cn , Pc = new Sc , Dc = new Sc , kc = new Sc; function Bc() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [] , t = 1 < arguments.length && void 0 !== arguments[1] && arguments[1] , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : "centripetal" , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : .5; Mc.call(this), this.type = "CatmullRomCurve3", this.points = e, this.closed = t, this.curveType = n, this.tension = i } function Lc(e, t, n, i, r) { var a = .5 * (i - t) , t = .5 * (r - n) , r = e * e; return (2 * n - 2 * i + a + t) * (e * r) + (-3 * n + 3 * i - 2 * a - t) * r + a * e + n } function Rc(e, t, n, i) { return (r = 1 - (r = e)) * r * t + 2 * (1 - e) * e * n + e * e * i; var r } function Fc(e, t, n, i, r) { return (a = 1 - (a = e)) * a * a * t + 3 * (t = 1 - e) * t * e * n + 3 * (1 - e) * e * e * i + e * e * e * r; var a } function Ic() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new yn , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new yn , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : new yn , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : new yn; Mc.call(this), this.type = "CubicBezierCurve", this.v0 = e, this.v1 = t, this.v2 = n, this.v3 = i } function Oc() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new Cn , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new Cn , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : new Cn , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : new Cn; Mc.call(this), this.type = "CubicBezierCurve3", this.v0 = e, this.v1 = t, this.v2 = n, this.v3 = i } function zc() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new yn , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new yn; Mc.call(this), this.type = "LineCurve", this.v1 = e, this.v2 = t } function Nc() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new Cn , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new Cn; Mc.call(this), this.type = "LineCurve3", this.v1 = e, this.v2 = t } function Uc() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new yn , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new yn , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : new yn; Mc.call(this), this.type = "QuadraticBezierCurve", this.v0 = e, this.v1 = t, this.v2 = n } function Gc() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new Cn , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new Cn , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : new Cn; Mc.call(this), this.type = "QuadraticBezierCurve3", this.v0 = e, this.v1 = t, this.v2 = n } function Hc() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []; Mc.call(this), this.type = "SplineCurve", this.points = e } ((Bc.prototype = Object.create(Mc.prototype)).constructor = Bc).prototype.isCatmullRomCurve3 = !0, Bc.prototype.getPoint = function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new Cn , n = this.points , i = n.length , r = (i - (this.closed ? 0 : 1)) * e , a = Math.floor(r) , o = r - a; this.closed ? a += 0 < a ? 0 : (Math.floor(Math.abs(a) / i) + 1) * i : 0 === o && a === i - 1 && (a = i - 2, o = 1); var s = this.closed || 0 < a ? n[(a - 1) % i] : (Cc.subVectors(n[0], n[1]).add(n[0]), Cc) , l = n[a % i] , e = n[(a + 1) % i] , r = this.closed || a + 2 < i ? n[(a + 2) % i] : (Cc.subVectors(n[i - 1], n[i - 2]).add(n[i - 1]), Cc); return "centripetal" === this.curveType || "chordal" === this.curveType ? (a = "chordal" === this.curveType ? .5 : .25, n = Math.pow(s.distanceToSquared(l), a), (i = Math.pow(l.distanceToSquared(e), a)) < 1e-4 && (i = 1), n < 1e-4 && (n = i), (a = Math.pow(e.distanceToSquared(r), a)) < 1e-4 && (a = i), Pc.initNonuniformCatmullRom(s.x, l.x, e.x, r.x, n, i, a), Dc.initNonuniformCatmullRom(s.y, l.y, e.y, r.y, n, i, a), kc.initNonuniformCatmullRom(s.z, l.z, e.z, r.z, n, i, a)) : "catmullrom" === this.curveType && (Pc.initCatmullRom(s.x, l.x, e.x, r.x, this.tension), Dc.initCatmullRom(s.y, l.y, e.y, r.y, this.tension), kc.initCatmullRom(s.z, l.z, e.z, r.z, this.tension)), t.set(Pc.calc(o), Dc.calc(o), kc.calc(o)), t } , Bc.prototype.copy = function(e) { Mc.prototype.copy.call(this, e), this.points = []; for (var t = 0, n = e.points.length; t < n; t++) { var i = e.points[t]; this.points.push(i.clone()) } return this.closed = e.closed, this.curveType = e.curveType, this.tension = e.tension, this } , Bc.prototype.toJSON = function() { var e = Mc.prototype.toJSON.call(this); e.points = []; for (var t = 0, n = this.points.length; t < n; t++) { var i = this.points[t]; e.points.push(i.toArray()) } return e.closed = this.closed, e.curveType = this.curveType, e.tension = this.tension, e } , Bc.prototype.fromJSON = function(e) { Mc.prototype.fromJSON.call(this, e), this.points = []; for (var t = 0, n = e.points.length; t < n; t++) { var i = e.points[t]; this.points.push((new Cn).fromArray(i)) } return this.closed = e.closed, this.curveType = e.curveType, this.tension = e.tension, this } , ((Ic.prototype = Object.create(Mc.prototype)).constructor = Ic).prototype.isCubicBezierCurve = !0, Ic.prototype.getPoint = function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new yn , n = this.v0 , i = this.v1 , r = this.v2 , a = this.v3; return t.set(Fc(e, n.x, i.x, r.x, a.x), Fc(e, n.y, i.y, r.y, a.y)), t } , Ic.prototype.copy = function(e) { return Mc.prototype.copy.call(this, e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this.v3.copy(e.v3), this } , Ic.prototype.toJSON = function() { var e = Mc.prototype.toJSON.call(this); return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e.v3 = this.v3.toArray(), e } , Ic.prototype.fromJSON = function(e) { return Mc.prototype.fromJSON.call(this, e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this.v3.fromArray(e.v3), this } , ((Oc.prototype = Object.create(Mc.prototype)).constructor = Oc).prototype.isCubicBezierCurve3 = !0, Oc.prototype.getPoint = function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new Cn , n = this.v0 , i = this.v1 , r = this.v2 , a = this.v3; return t.set(Fc(e, n.x, i.x, r.x, a.x), Fc(e, n.y, i.y, r.y, a.y), Fc(e, n.z, i.z, r.z, a.z)), t } , Oc.prototype.copy = function(e) { return Mc.prototype.copy.call(this, e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this.v3.copy(e.v3), this } , Oc.prototype.toJSON = function() { var e = Mc.prototype.toJSON.call(this); return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e.v3 = this.v3.toArray(), e } , Oc.prototype.fromJSON = function(e) { return Mc.prototype.fromJSON.call(this, e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this.v3.fromArray(e.v3), this } , ((zc.prototype = Object.create(Mc.prototype)).constructor = zc).prototype.isLineCurve = !0, zc.prototype.getPoint = function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new yn; return 1 === e ? t.copy(this.v2) : (t.copy(this.v2).sub(this.v1), t.multiplyScalar(e).add(this.v1)), t } , zc.prototype.getPointAt = function(e, t) { return this.getPoint(e, t) } , zc.prototype.getTangent = function(e, t) { t = t || new yn; return t.copy(this.v2).sub(this.v1).normalize(), t } , zc.prototype.copy = function(e) { return Mc.prototype.copy.call(this, e), this.v1.copy(e.v1), this.v2.copy(e.v2), this } , zc.prototype.toJSON = function() { var e = Mc.prototype.toJSON.call(this); return e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e } , zc.prototype.fromJSON = function(e) { return Mc.prototype.fromJSON.call(this, e), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this } , ((Nc.prototype = Object.create(Mc.prototype)).constructor = Nc).prototype.isLineCurve3 = !0, Nc.prototype.getPoint = function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new Cn; return 1 === e ? t.copy(this.v2) : (t.copy(this.v2).sub(this.v1), t.multiplyScalar(e).add(this.v1)), t } , Nc.prototype.getPointAt = function(e, t) { return this.getPoint(e, t) } , Nc.prototype.copy = function(e) { return Mc.prototype.copy.call(this, e), this.v1.copy(e.v1), this.v2.copy(e.v2), this } , Nc.prototype.toJSON = function() { var e = Mc.prototype.toJSON.call(this); return e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e } , Nc.prototype.fromJSON = function(e) { return Mc.prototype.fromJSON.call(this, e), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this } , ((Uc.prototype = Object.create(Mc.prototype)).constructor = Uc).prototype.isQuadraticBezierCurve = !0, Uc.prototype.getPoint = function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new yn , n = this.v0 , i = this.v1 , r = this.v2; return t.set(Rc(e, n.x, i.x, r.x), Rc(e, n.y, i.y, r.y)), t } , Uc.prototype.copy = function(e) { return Mc.prototype.copy.call(this, e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this } , Uc.prototype.toJSON = function() { var e = Mc.prototype.toJSON.call(this); return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e } , Uc.prototype.fromJSON = function(e) { return Mc.prototype.fromJSON.call(this, e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this } , ((Gc.prototype = Object.create(Mc.prototype)).constructor = Gc).prototype.isQuadraticBezierCurve3 = !0, Gc.prototype.getPoint = function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new Cn , n = this.v0 , i = this.v1 , r = this.v2; return t.set(Rc(e, n.x, i.x, r.x), Rc(e, n.y, i.y, r.y), Rc(e, n.z, i.z, r.z)), t } , Gc.prototype.copy = function(e) { return Mc.prototype.copy.call(this, e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this } , Gc.prototype.toJSON = function() { var e = Mc.prototype.toJSON.call(this); return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e } , Gc.prototype.fromJSON = function(e) { return Mc.prototype.fromJSON.call(this, e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this } , ((Hc.prototype = Object.create(Mc.prototype)).constructor = Hc).prototype.isSplineCurve = !0, Hc.prototype.getPoint = function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new yn , n = this.points , i = (n.length - 1) * e , r = Math.floor(i) , a = i - r , o = n[0 === r ? r : r - 1] , e = n[r] , i = n[r > n.length - 2 ? n.length - 1 : r + 1] , r = n[r > n.length - 3 ? n.length - 1 : r + 2]; return t.set(Lc(a, o.x, e.x, i.x, r.x), Lc(a, o.y, e.y, i.y, r.y)), t } , Hc.prototype.copy = function(e) { Mc.prototype.copy.call(this, e), this.points = []; for (var t = 0, n = e.points.length; t < n; t++) { var i = e.points[t]; this.points.push(i.clone()) } return this } , Hc.prototype.toJSON = function() { var e = Mc.prototype.toJSON.call(this); e.points = []; for (var t = 0, n = this.points.length; t < n; t++) { var i = this.points[t]; e.points.push(i.toArray()) } return e } , Hc.prototype.fromJSON = function(e) { Mc.prototype.fromJSON.call(this, e), this.points = []; for (var t = 0, n = e.points.length; t < n; t++) { var i = e.points[t]; this.points.push((new yn).fromArray(i)) } return this } ; var Vc = Object.freeze({ __proto__: null, ArcCurve: Tc, CatmullRomCurve3: Bc, CubicBezierCurve: Ic, CubicBezierCurve3: Oc, EllipseCurve: Ac, LineCurve: zc, LineCurve3: Nc, QuadraticBezierCurve: Uc, QuadraticBezierCurve3: Gc, SplineCurve: Hc }); function jc() { Mc.call(this), this.type = "CurvePath", this.curves = [], this.autoClose = !1 } function Wc(e) { jc.call(this), this.type = "Path", this.currentPoint = new yn, e && this.setFromPoints(e) } function Xc(e) { Wc.call(this, e), this.uuid = gn.generateUUID(), this.type = "Shape", this.holes = [] } function qc(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1; Si.call(this), this.type = "Light", this.color = new Yi(e), this.intensity = t } function Jc(e, t, n) { qc.call(this, e, n), this.type = "HemisphereLight", this.position.copy(Si.DefaultUp), this.updateMatrix(), this.groundColor = new Yi(t) } function Yc(e) { this.camera = e, this.bias = 0, this.normalBias = 0, this.radius = 1, this.mapSize = new yn(512,512), this.map = null, this.mapPass = null, this.matrix = new ni, this.autoUpdate = !0, this.needsUpdate = !1, this._frustum = new oa, this._frameExtents = new yn(1,1), this._viewportCount = 1, this._viewports = [new Mn(0,0,1,1)] } function Zc() { Yc.call(this, new $r(50,1,.5,500)), this.focus = 1 } function Qc(e, t, n, i, r, a) { qc.call(this, e, t), this.type = "SpotLight", this.position.copy(Si.DefaultUp), this.updateMatrix(), this.target = new Si, Object.defineProperty(this, "power", { get: function() { return this.intensity * Math.PI }, set: function(e) { this.intensity = e / Math.PI } }), this.distance = void 0 !== n ? n : 0, this.angle = void 0 !== i ? i : Math.PI / 3, this.penumbra = void 0 !== r ? r : 0, this.decay = void 0 !== a ? a : 1, this.shadow = new Zc } function Kc() { Yc.call(this, new $r(90,1,.5,500)), this._frameExtents = new yn(4,2), this._viewportCount = 6, this._viewports = [new Mn(2,1,1,1), new Mn(0,1,1,1), new Mn(3,1,1,1), new Mn(1,1,1,1), new Mn(3,0,1,1), new Mn(1,0,1,1)], this._cubeDirections = [new Cn(1,0,0), new Cn(-1,0,0), new Cn(0,0,1), new Cn(0,0,-1), new Cn(0,1,0), new Cn(0,-1,0)], this._cubeUps = [new Cn(0,1,0), new Cn(0,1,0), new Cn(0,1,0), new Cn(0,1,0), new Cn(0,0,1), new Cn(0,0,-1)] } function $c(e, t, n, i) { qc.call(this, e, t), this.type = "PointLight", Object.defineProperty(this, "power", { get: function() { return 4 * this.intensity * Math.PI }, set: function(e) { this.intensity = e / (4 * Math.PI) } }), this.distance = void 0 !== n ? n : 0, this.decay = void 0 !== i ? i : 1, this.shadow = new Kc } function ed() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : -1 , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1 , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1 , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : -1 , r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : .1 , a = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 2e3; Kr.call(this), this.type = "OrthographicCamera", this.zoom = 1, this.view = null, this.left = e, this.right = t, this.top = n, this.bottom = i, this.near = r, this.far = a, this.updateProjectionMatrix() } function td() { Yc.call(this, new ed(-5,5,5,-5,.5,500)) } function nd(e, t) { qc.call(this, e, t), this.type = "DirectionalLight", this.position.copy(Si.DefaultUp), this.updateMatrix(), this.target = new Si, this.shadow = new td } function id(e, t) { qc.call(this, e, t), this.type = "AmbientLight" } function rd(e, t, n, i) { qc.call(this, e, t), this.type = "RectAreaLight", this.width = void 0 !== n ? n : 10, this.height = void 0 !== i ? i : 10 } jc.prototype = Object.assign(Object.create(Mc.prototype), { constructor: jc, add: function(e) { this.curves.push(e) }, closePath: function() { var e = this.curves[0].getPoint(0) , t = this.curves[this.curves.length - 1].getPoint(1); e.equals(t) || this.curves.push(new zc(t,e)) }, getPoint: function(e) { for (var t = e * this.getLength(), n = this.getCurveLengths(), i = 0; i < n.length; ) { if (n[i] >= t) { var r = n[i] - t , a = this.curves[i] , o = a.getLength(); return a.getPointAt(0 === o ? 0 : 1 - r / o) } i++ } return null }, getLength: function() { var e = this.getCurveLengths(); return e[e.length - 1] }, updateArcLengths: function() { this.needsUpdate = !0, this.cacheLengths = null, this.getCurveLengths() }, getCurveLengths: function() { if (this.cacheLengths && this.cacheLengths.length === this.curves.length) return this.cacheLengths; for (var e = [], t = 0, n = 0, i = this.curves.length; n < i; n++) t += this.curves[n].getLength(), e.push(t); return this.cacheLengths = e }, getSpacedPoints: function() { for (var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 40, t = [], n = 0; n <= e; n++) t.push(this.getPoint(n / e)); return this.autoClose && t.push(t[0]), t }, getPoints: function() { for (var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 12, n = [], i = 0, r = this.curves; i < r.length; i++) for (var a = r[i], o = a && a.isEllipseCurve ? 2 * t : a && (a.isLineCurve || a.isLineCurve3) ? 1 : a && a.isSplineCurve ? t * a.points.length : t, s = a.getPoints(o), l = 0; l < s.length; l++) { var u = s[l]; e && e.equals(u) || (n.push(u), e = u) } return this.autoClose && 1 < n.length && !n[n.length - 1].equals(n[0]) && n.push(n[0]), n }, copy: function(e) { Mc.prototype.copy.call(this, e), this.curves = []; for (var t = 0, n = e.curves.length; t < n; t++) { var i = e.curves[t]; this.curves.push(i.clone()) } return this.autoClose = e.autoClose, this }, toJSON: function() { var e = Mc.prototype.toJSON.call(this); e.autoClose = this.autoClose, e.curves = []; for (var t = 0, n = this.curves.length; t < n; t++) { var i = this.curves[t]; e.curves.push(i.toJSON()) } return e }, fromJSON: function(e) { Mc.prototype.fromJSON.call(this, e), this.autoClose = e.autoClose, this.curves = []; for (var t = 0, n = e.curves.length; t < n; t++) { var i = e.curves[t]; this.curves.push((new Vc[i.type]).fromJSON(i)) } return this } }), Wc.prototype = Object.assign(Object.create(jc.prototype), { constructor: Wc, setFromPoints: function(e) { this.moveTo(e[0].x, e[0].y); for (var t = 1, n = e.length; t < n; t++) this.lineTo(e[t].x, e[t].y); return this }, moveTo: function(e, t) { return this.currentPoint.set(e, t), this }, lineTo: function(e, t) { var n = new zc(this.currentPoint.clone(),new yn(e,t)); return this.curves.push(n), this.currentPoint.set(e, t), this }, quadraticCurveTo: function(e, t, n, i) { t = new Uc(this.currentPoint.clone(),new yn(e,t),new yn(n,i)); return this.curves.push(t), this.currentPoint.set(n, i), this }, bezierCurveTo: function(e, t, n, i, r, a) { i = new Ic(this.currentPoint.clone(),new yn(e,t),new yn(n,i),new yn(r,a)); return this.curves.push(i), this.currentPoint.set(r, a), this }, splineThru: function(e) { var t = new Hc([this.currentPoint.clone()].concat(e)); return this.curves.push(t), this.currentPoint.copy(e[e.length - 1]), this }, arc: function(e, t, n, i, r, a) { var o = this.currentPoint.x , s = this.currentPoint.y; return this.absarc(e + o, t + s, n, i, r, a), this }, absarc: function(e, t, n, i, r, a) { return this.absellipse(e, t, n, n, i, r, a), this }, ellipse: function(e, t, n, i, r, a, o, s) { var l = this.currentPoint.x , u = this.currentPoint.y; return this.absellipse(e + l, t + u, n, i, r, a, o, s), this }, absellipse: function(e, t, n, i, r, a, o, s) { o = new Ac(e,t,n,i,r,a,o,s); 0 < this.curves.length && ((s = o.getPoint(0)).equals(this.currentPoint) || this.lineTo(s.x, s.y)), this.curves.push(o); o = o.getPoint(1); return this.currentPoint.copy(o), this }, copy: function(e) { return jc.prototype.copy.call(this, e), this.currentPoint.copy(e.currentPoint), this }, toJSON: function() { var e = jc.prototype.toJSON.call(this); return e.currentPoint = this.currentPoint.toArray(), e }, fromJSON: function(e) { return jc.prototype.fromJSON.call(this, e), this.currentPoint.fromArray(e.currentPoint), this } }), Xc.prototype = Object.assign(Object.create(Wc.prototype), { constructor: Xc, getPointsHoles: function(e) { for (var t = [], n = 0, i = this.holes.length; n < i; n++) t[n] = this.holes[n].getPoints(e); return t }, extractPoints: function(e) { return { shape: this.getPoints(e), holes: this.getPointsHoles(e) } }, copy: function(e) { Wc.prototype.copy.call(this, e), this.holes = []; for (var t = 0, n = e.holes.length; t < n; t++) { var i = e.holes[t]; this.holes.push(i.clone()) } return this }, toJSON: function() { var e = Wc.prototype.toJSON.call(this); e.uuid = this.uuid, e.holes = []; for (var t = 0, n = this.holes.length; t < n; t++) { var i = this.holes[t]; e.holes.push(i.toJSON()) } return e }, fromJSON: function(e) { Wc.prototype.fromJSON.call(this, e), this.uuid = e.uuid, this.holes = []; for (var t = 0, n = e.holes.length; t < n; t++) { var i = e.holes[t]; this.holes.push((new Wc).fromJSON(i)) } return this } }), qc.prototype = Object.assign(Object.create(Si.prototype), { constructor: qc, isLight: !0, copy: function(e) { return Si.prototype.copy.call(this, e), this.color.copy(e.color), this.intensity = e.intensity, this }, toJSON: function(e) { e = Si.prototype.toJSON.call(this, e); return e.object.color = this.color.getHex(), e.object.intensity = this.intensity, void 0 !== this.groundColor && (e.object.groundColor = this.groundColor.getHex()), void 0 !== this.distance && (e.object.distance = this.distance), void 0 !== this.angle && (e.object.angle = this.angle), void 0 !== this.decay && (e.object.decay = this.decay), void 0 !== this.penumbra && (e.object.penumbra = this.penumbra), void 0 !== this.shadow && (e.object.shadow = this.shadow.toJSON()), e } }), Jc.prototype = Object.assign(Object.create(qc.prototype), { constructor: Jc, isHemisphereLight: !0, copy: function(e) { return qc.prototype.copy.call(this, e), this.groundColor.copy(e.groundColor), this } }), Object.assign(Yc.prototype, { _projScreenMatrix: new ni, _lightPositionWorld: new Cn, _lookTarget: new Cn, getViewportCount: function() { return this._viewportCount }, getFrustum: function() { return this._frustum }, updateMatrices: function(e) { var t = this.camera , n = this.matrix , i = this._projScreenMatrix , r = this._lookTarget , a = this._lightPositionWorld; a.setFromMatrixPosition(e.matrixWorld), t.position.copy(a), r.setFromMatrixPosition(e.target.matrixWorld), t.lookAt(r), t.updateMatrixWorld(), i.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), this._frustum.setFromProjectionMatrix(i), n.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1), n.multiply(t.projectionMatrix), n.multiply(t.matrixWorldInverse) }, getViewport: function(e) { return this._viewports[e] }, getFrameExtents: function() { return this._frameExtents }, copy: function(e) { return this.camera = e.camera.clone(), this.bias = e.bias, this.radius = e.radius, this.mapSize.copy(e.mapSize), this }, clone: function() { return (new this.constructor).copy(this) }, toJSON: function() { var e = {}; return 0 !== this.bias && (e.bias = this.bias), 0 !== this.normalBias && (e.normalBias = this.normalBias), 1 !== this.radius && (e.radius = this.radius), 512 === this.mapSize.x && 512 === this.mapSize.y || (e.mapSize = this.mapSize.toArray()), e.camera = this.camera.toJSON(!1).object, delete e.camera.matrix, e } }), Zc.prototype = Object.assign(Object.create(Yc.prototype), { constructor: Zc, isSpotLightShadow: !0, updateMatrices: function(e) { var t = this.camera , n = 2 * gn.RAD2DEG * e.angle * this.focus , i = this.mapSize.width / this.mapSize.height , r = e.distance || t.far; n === t.fov && i === t.aspect && r === t.far || (t.fov = n, t.aspect = i, t.far = r, t.updateProjectionMatrix()), Yc.prototype.updateMatrices.call(this, e) } }), Qc.prototype = Object.assign(Object.create(qc.prototype), { constructor: Qc, isSpotLight: !0, copy: function(e) { return qc.prototype.copy.call(this, e), this.distance = e.distance, this.angle = e.angle, this.penumbra = e.penumbra, this.decay = e.decay, this.target = e.target.clone(), this.shadow = e.shadow.clone(), this } }), Kc.prototype = Object.assign(Object.create(Yc.prototype), { constructor: Kc, isPointLightShadow: !0, updateMatrices: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0 , n = this.camera , i = this.matrix , r = this._lightPositionWorld , a = this._lookTarget , o = this._projScreenMatrix; r.setFromMatrixPosition(e.matrixWorld), n.position.copy(r), a.copy(n.position), a.add(this._cubeDirections[t]), n.up.copy(this._cubeUps[t]), n.lookAt(a), n.updateMatrixWorld(), i.makeTranslation(-r.x, -r.y, -r.z), o.multiplyMatrices(n.projectionMatrix, n.matrixWorldInverse), this._frustum.setFromProjectionMatrix(o) } }), $c.prototype = Object.assign(Object.create(qc.prototype), { constructor: $c, isPointLight: !0, copy: function(e) { return qc.prototype.copy.call(this, e), this.distance = e.distance, this.decay = e.decay, this.shadow = e.shadow.clone(), this } }), ed.prototype = Object.assign(Object.create(Kr.prototype), { constructor: ed, isOrthographicCamera: !0, copy: function(e, t) { return Kr.prototype.copy.call(this, e, t), this.left = e.left, this.right = e.right, this.top = e.top, this.bottom = e.bottom, this.near = e.near, this.far = e.far, this.zoom = e.zoom, this.view = null === e.view ? null : Object.assign({}, e.view), this }, setViewOffset: function(e, t, n, i, r, a) { null === this.view && (this.view = { enabled: !0, fullWidth: 1, fullHeight: 1, offsetX: 0, offsetY: 0, width: 1, height: 1 }), this.view.enabled = !0, this.view.fullWidth = e, this.view.fullHeight = t, this.view.offsetX = n, this.view.offsetY = i, this.view.width = r, this.view.height = a, this.updateProjectionMatrix() }, clearViewOffset: function() { null !== this.view && (this.view.enabled = !1), this.updateProjectionMatrix() }, updateProjectionMatrix: function() { var e = (this.right - this.left) / (2 * this.zoom) , t = (this.top - this.bottom) / (2 * this.zoom) , n = (this.right + this.left) / 2 , i = (this.top + this.bottom) / 2 , r = n - e , a = n + e , n = i + t , e = i - t; null !== this.view && this.view.enabled && (i = (this.right - this.left) / this.view.fullWidth / this.zoom, t = (this.top - this.bottom) / this.view.fullHeight / this.zoom, a = (r += i * this.view.offsetX) + i * this.view.width, e = (n -= t * this.view.offsetY) - t * this.view.height), this.projectionMatrix.makeOrthographic(r, a, n, e, this.near, this.far), this.projectionMatrixInverse.copy(this.projectionMatrix).invert() }, toJSON: function(e) { e = Si.prototype.toJSON.call(this, e); return e.object.zoom = this.zoom, e.object.left = this.left, e.object.right = this.right, e.object.top = this.top, e.object.bottom = this.bottom, e.object.near = this.near, e.object.far = this.far, null !== this.view && (e.object.view = Object.assign({}, this.view)), e } }), td.prototype = Object.assign(Object.create(Yc.prototype), { constructor: td, isDirectionalLightShadow: !0, updateMatrices: function(e) { Yc.prototype.updateMatrices.call(this, e) } }), nd.prototype = Object.assign(Object.create(qc.prototype), { constructor: nd, isDirectionalLight: !0, copy: function(e) { return qc.prototype.copy.call(this, e), this.target = e.target.clone(), this.shadow = e.shadow.clone(), this } }), id.prototype = Object.assign(Object.create(qc.prototype), { constructor: id, isAmbientLight: !0 }), rd.prototype = Object.assign(Object.create(qc.prototype), { constructor: rd, isRectAreaLight: !0, copy: function(e) { return qc.prototype.copy.call(this, e), this.width = e.width, this.height = e.height, this }, toJSON: function(e) { e = qc.prototype.toJSON.call(this, e); return e.object.width = this.width, e.object.height = this.height, e } }); var ad = function() { function t() { O(this, t), Object.defineProperty(this, "isSphericalHarmonics3", { value: !0 }), this.coefficients = []; for (var e = 0; e < 9; e++) this.coefficients.push(new Cn) } return h(t, [{ key: "set", value: function(e) { for (var t = 0; t < 9; t++) this.coefficients[t].copy(e[t]); return this } }, { key: "zero", value: function() { for (var e = 0; e < 9; e++) this.coefficients[e].set(0, 0, 0); return this } }, { key: "getAt", value: function(e, t) { var n = e.x , i = e.y , r = e.z , e = this.coefficients; return t.copy(e[0]).multiplyScalar(.282095), t.addScaledVector(e[1], .488603 * i), t.addScaledVector(e[2], .488603 * r), t.addScaledVector(e[3], .488603 * n), t.addScaledVector(e[4], n * i * 1.092548), t.addScaledVector(e[5], i * r * 1.092548), t.addScaledVector(e[6], .315392 * (3 * r * r - 1)), t.addScaledVector(e[7], n * r * 1.092548), t.addScaledVector(e[8], .546274 * (n * n - i * i)), t } }, { key: "getIrradianceAt", value: function(e, t) { var n = e.x , i = e.y , r = e.z , e = this.coefficients; return t.copy(e[0]).multiplyScalar(.886227), t.addScaledVector(e[1], 1.023328 * i), t.addScaledVector(e[2], 1.023328 * r), t.addScaledVector(e[3], 1.023328 * n), t.addScaledVector(e[4], .858086 * n * i), t.addScaledVector(e[5], .858086 * i * r), t.addScaledVector(e[6], .743125 * r * r - .247708), t.addScaledVector(e[7], .858086 * n * r), t.addScaledVector(e[8], .429043 * (n * n - i * i)), t } }, { key: "add", value: function(e) { for (var t = 0; t < 9; t++) this.coefficients[t].add(e.coefficients[t]); return this } }, { key: "addScaledSH", value: function(e, t) { for (var n = 0; n < 9; n++) this.coefficients[n].addScaledVector(e.coefficients[n], t); return this } }, { key: "scale", value: function(e) { for (var t = 0; t < 9; t++) this.coefficients[t].multiplyScalar(e); return this } }, { key: "lerp", value: function(e, t) { for (var n = 0; n < 9; n++) this.coefficients[n].lerp(e.coefficients[n], t); return this } }, { key: "equals", value: function(e) { for (var t = 0; t < 9; t++) if (!this.coefficients[t].equals(e.coefficients[t])) return !1; return !0 } }, { key: "copy", value: function(e) { return this.set(e.coefficients) } }, { key: "clone", value: function() { return (new this.constructor).copy(this) } }, { key: "fromArray", value: function(e) { for (var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, n = this.coefficients, i = 0; i < 9; i++) n[i].fromArray(e, t + 3 * i); return this } }, { key: "toArray", value: function() { for (var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, n = this.coefficients, i = 0; i < 9; i++) n[i].toArray(e, t + 3 * i); return e } }], [{ key: "getBasisAt", value: function(e, t) { var n = e.x , i = e.y , e = e.z; t[0] = .282095, t[1] = .488603 * i, t[2] = .488603 * e, t[3] = .488603 * n, t[4] = 1.092548 * n * i, t[5] = 1.092548 * i * e, t[6] = .315392 * (3 * e * e - 1), t[7] = 1.092548 * n * e, t[8] = .546274 * (n * n - i * i) } }]), t }(); function od(e, t) { qc.call(this, void 0, t), this.type = "LightProbe", this.sh = void 0 !== e ? e : new ad } function sd(e) { mc.call(this, e), this.textures = {} } od.prototype = Object.assign(Object.create(qc.prototype), { constructor: od, isLightProbe: !0, copy: function(e) { return qc.prototype.copy.call(this, e), this.sh.copy(e.sh), this }, fromJSON: function(e) { return this.intensity = e.intensity, this.sh.fromArray(e.sh), this }, toJSON: function(e) { e = qc.prototype.toJSON.call(this, e); return e.object.sh = this.sh.toArray(), e } }), sd.prototype = Object.assign(Object.create(mc.prototype), { constructor: sd, load: function(t, n, e, i) { var r = this , a = new gc(r.manager); a.setPath(r.path), a.setRequestHeader(r.requestHeader), a.setWithCredentials(r.withCredentials), a.load(t, function(e) { try { n(r.parse(JSON.parse(e))) } catch (e) { i ? i(e) : console.error(e), r.manager.itemError(t) } }, e, i) }, parse: function(e) { var t = this.textures; function n(e) { return void 0 === t[e] && console.warn("THREE.MaterialLoader: Undefined texture", e), t[e] } var i, r = new Zu[e.type]; if (void 0 !== e.uuid && (r.uuid = e.uuid), void 0 !== e.name && (r.name = e.name), void 0 !== e.color && void 0 !== r.color && r.color.setHex(e.color), void 0 !== e.roughness && (r.roughness = e.roughness), void 0 !== e.metalness && (r.metalness = e.metalness), void 0 !== e.sheen && (r.sheen = (new Yi).setHex(e.sheen)), void 0 !== e.emissive && void 0 !== r.emissive && r.emissive.setHex(e.emissive), void 0 !== e.specular && void 0 !== r.specular && r.specular.setHex(e.specular), void 0 !== e.shininess && (r.shininess = e.shininess), void 0 !== e.clearcoat && (r.clearcoat = e.clearcoat), void 0 !== e.clearcoatRoughness && (r.clearcoatRoughness = e.clearcoatRoughness), void 0 !== e.fog && (r.fog = e.fog), void 0 !== e.flatShading && (r.flatShading = e.flatShading), void 0 !== e.blending && (r.blending = e.blending), void 0 !== e.combine && (r.combine = e.combine), void 0 !== e.side && (r.side = e.side), void 0 !== e.opacity && (r.opacity = e.opacity), void 0 !== e.transparent && (r.transparent = e.transparent), void 0 !== e.alphaTest && (r.alphaTest = e.alphaTest), void 0 !== e.depthTest && (r.depthTest = e.depthTest), void 0 !== e.depthWrite && (r.depthWrite = e.depthWrite), void 0 !== e.colorWrite && (r.colorWrite = e.colorWrite), void 0 !== e.stencilWrite && (r.stencilWrite = e.stencilWrite), void 0 !== e.stencilWriteMask && (r.stencilWriteMask = e.stencilWriteMask), void 0 !== e.stencilFunc && (r.stencilFunc = e.stencilFunc), void 0 !== e.stencilRef && (r.stencilRef = e.stencilRef), void 0 !== e.stencilFuncMask && (r.stencilFuncMask = e.stencilFuncMask), void 0 !== e.stencilFail && (r.stencilFail = e.stencilFail), void 0 !== e.stencilZFail && (r.stencilZFail = e.stencilZFail), void 0 !== e.stencilZPass && (r.stencilZPass = e.stencilZPass), void 0 !== e.wireframe && (r.wireframe = e.wireframe), void 0 !== e.wireframelineWidth && (r.wireframelineWidth = e.wireframelineWidth), void 0 !== e.wireframeLinecap && (r.wireframeLinecap = e.wireframeLinecap), void 0 !== e.wireframeLinejoin && (r.wireframeLinejoin = e.wireframeLinejoin), void 0 !== e.rotation && (r.rotation = e.rotation), 1 !== e.lineWidth && (r.lineWidth = e.lineWidth), void 0 !== e.dashSize && (r.dashSize = e.dashSize), void 0 !== e.gapSize && (r.gapSize = e.gapSize), void 0 !== e.scale && (r.scale = e.scale), void 0 !== e.polygonOffset && (r.polygonOffset = e.polygonOffset), void 0 !== e.polygonOffsetFactor && (r.polygonOffsetFactor = e.polygonOffsetFactor), void 0 !== e.polygonOffsetUnits && (r.polygonOffsetUnits = e.polygonOffsetUnits), void 0 !== e.skinning && (r.skinning = e.skinning), void 0 !== e.morphTargets && (r.morphTargets = e.morphTargets), void 0 !== e.morphNormals && (r.morphNormals = e.morphNormals), void 0 !== e.dithering && (r.dithering = e.dithering), void 0 !== e.vertexTangents && (r.vertexTangents = e.vertexTangents), void 0 !== e.visible && (r.visible = e.visible), void 0 !== e.toneMapped && (r.toneMapped = e.toneMapped), void 0 !== e.userData && (r.userData = e.userData), void 0 !== e.vertexColors && ("number" == typeof e.vertexColors ? r.vertexColors = 0 < e.vertexColors : r.vertexColors = e.vertexColors), void 0 !== e.uniforms) for (var a in e.uniforms) { var o = e.uniforms[a]; switch (r.uniforms[a] = {}, o.type) { case "t": r.uniforms[a].value = n(o.value); break; case "c": r.uniforms[a].value = (new Yi).setHex(o.value); break; case "v2": r.uniforms[a].value = (new yn).fromArray(o.value); break; case "v3": r.uniforms[a].value = (new Cn).fromArray(o.value); break; case "v4": r.uniforms[a].value = (new Mn).fromArray(o.value); break; case "m3": r.uniforms[a].value = (new wn).fromArray(o.value); break; case "m4": r.uniforms[a].value = (new ni).fromArray(o.value); break; default: r.uniforms[a].value = o.value } } if (void 0 !== e.defines && (r.defines = e.defines), void 0 !== e.vertexShader && (r.vertexShader = e.vertexShader), void 0 !== e.fragmentShader && (r.fragmentShader = e.fragmentShader), void 0 !== e.extensions) for (var s in e.extensions) r.extensions[s] = e.extensions[s]; return void 0 !== e.shading && (r.flatShading = 1 === e.shading), void 0 !== e.size && (r.size = e.size), void 0 !== e.sizeAttenuation && (r.sizeAttenuation = e.sizeAttenuation), void 0 !== e.map && (r.map = n(e.map)), void 0 !== e.matcap && (r.matcap = n(e.matcap)), void 0 !== e.alphaMap && (r.alphaMap = n(e.alphaMap)), void 0 !== e.bumpMap && (r.bumpMap = n(e.bumpMap)), void 0 !== e.bumpScale && (r.bumpScale = e.bumpScale), void 0 !== e.normalMap && (r.normalMap = n(e.normalMap)), void 0 !== e.normalMapType && (r.normalMapType = e.normalMapType), void 0 !== e.normalScale && (i = e.normalScale, !1 === Array.isArray(i) && (i = [i, i]), r.normalScale = (new yn).fromArray(i)), void 0 !== e.displacementMap && (r.displacementMap = n(e.displacementMap)), void 0 !== e.displacementScale && (r.displacementScale = e.displacementScale), void 0 !== e.displacementBias && (r.displacementBias = e.displacementBias), void 0 !== e.roughnessMap && (r.roughnessMap = n(e.roughnessMap)), void 0 !== e.metalnessMap && (r.metalnessMap = n(e.metalnessMap)), void 0 !== e.emissiveMap && (r.emissiveMap = n(e.emissiveMap)), void 0 !== e.emissiveIntensity && (r.emissiveIntensity = e.emissiveIntensity), void 0 !== e.specularMap && (r.specularMap = n(e.specularMap)), void 0 !== e.envMap && (r.envMap = n(e.envMap)), void 0 !== e.envMapIntensity && (r.envMapIntensity = e.envMapIntensity), void 0 !== e.reflectivity && (r.reflectivity = e.reflectivity), void 0 !== e.refractionRatio && (r.refractionRatio = e.refractionRatio), void 0 !== e.lightMap && (r.lightMap = n(e.lightMap)), void 0 !== e.lightMapIntensity && (r.lightMapIntensity = e.lightMapIntensity), void 0 !== e.aoMap && (r.aoMap = n(e.aoMap)), void 0 !== e.aoMapIntensity && (r.aoMapIntensity = e.aoMapIntensity), void 0 !== e.gradientMap && (r.gradientMap = n(e.gradientMap)), void 0 !== e.clearcoatMap && (r.clearcoatMap = n(e.clearcoatMap)), void 0 !== e.clearcoatRoughnessMap && (r.clearcoatRoughnessMap = n(e.clearcoatRoughnessMap)), void 0 !== e.clearcoatNormalMap && (r.clearcoatNormalMap = n(e.clearcoatNormalMap)), void 0 !== e.clearcoatNormalScale && (r.clearcoatNormalScale = (new yn).fromArray(e.clearcoatNormalScale)), void 0 !== e.transmission && (r.transmission = e.transmission), void 0 !== e.transmissionMap && (r.transmissionMap = n(e.transmissionMap)), r }, setTextures: function(e) { return this.textures = e, this } }); var ld = { decodeText: function(e) { if ("undefined" != typeof TextDecoder) return (new TextDecoder).decode(e); for (var t = "", n = 0, i = e.length; n < i; n++) t += String.fromCharCode(e[n]); try { return decodeURIComponent(escape(t)) } catch (e) { return t } }, extractUrlBase: function(e) { var t = e.lastIndexOf("/"); return -1 === t ? "./" : e.substr(0, t + 1) } }; function ud() { Mr.call(this), this.type = "InstancedBufferGeometry", this.instanceCount = 1 / 0 } function cd(e, t, n, i) { "number" == typeof n && (i = n, n = !1, console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")), nr.call(this, e, t, n), this.meshPerAttribute = i || 1 } function dd(e) { mc.call(this, e) } ud.prototype = Object.assign(Object.create(Mr.prototype), { constructor: ud, isInstancedBufferGeometry: !0, copy: function(e) { return Mr.prototype.copy.call(this, e), this.instanceCount = e.instanceCount, this }, clone: function() { return (new this.constructor).copy(this) }, toJSON: function() { var e = Mr.prototype.toJSON.call(this); return e.instanceCount = this.instanceCount, e.isInstancedBufferGeometry = !0, e } }), cd.prototype = Object.assign(Object.create(nr.prototype), { constructor: cd, isInstancedBufferAttribute: !0, copy: function(e) { return nr.prototype.copy.call(this, e), this.meshPerAttribute = e.meshPerAttribute, this }, toJSON: function() { var e = nr.prototype.toJSON.call(this); return e.meshPerAttribute = this.meshPerAttribute, e.isInstancedBufferAttribute = !0, e } }), dd.prototype = Object.assign(Object.create(mc.prototype), { constructor: dd, load: function(t, n, e, i) { var r = this , a = new gc(r.manager); a.setPath(r.path), a.setRequestHeader(r.requestHeader), a.setWithCredentials(r.withCredentials), a.load(t, function(e) { try { n(r.parse(JSON.parse(e))) } catch (e) { i ? i(e) : console.error(e), r.manager.itemError(t) } }, e, i) }, parse: function(e) { var i = {} , r = {}; function t(e, t) { if (void 0 !== i[t]) return i[t]; var n = e.interleavedBuffers[t] , e = function(e, t) { if (void 0 !== r[t]) return r[t]; e = e.arrayBuffers[t], e = new Uint32Array(e).buffer; return r[t] = e }(e, n.buffer) , e = new ys(vr(n.type, e),n.stride); return e.uuid = n.uuid, i[t] = e } var n = new (e.isInstancedBufferGeometry ? ud : Mr) , a = e.data.index; void 0 !== a && (_ = vr(a.type, a.array), n.setIndex(new nr(_,1))); var o, s = e.data.attributes; for (o in s) { var l, u = s[o], c = void 0; c = u.isInterleavedBufferAttribute ? new xs(t(e.data, u.data),u.itemSize,u.offset,u.normalized) : (l = vr(u.type, u.array), new (u.isInstancedBufferAttribute ? cd : nr)(l,u.itemSize,u.normalized)), void 0 !== u.name && (c.name = u.name), n.setAttribute(o, c) } var d = e.data.morphAttributes; if (d) for (var h in d) { for (var p = d[h], f = [], m = 0, v = p.length; m < v; m++) { var g = p[m] , y = void 0; y = g.isInterleavedBufferAttribute ? new xs(t(e.data, g.data),g.itemSize,g.offset,g.normalized) : new nr(vr(g.type, g.array),g.itemSize,g.normalized), void 0 !== g.name && (y.name = g.name), f.push(y) } n.morphAttributes[h] = f } e.data.morphTargetsRelative && (n.morphTargetsRelative = !0); var w = e.data.groups || e.data.drawcalls || e.data.offsets; if (void 0 !== w) for (var b = 0, x = w.length; b !== x; ++b) { var E = w[b]; n.addGroup(E.start, E.count, E.materialIndex) } var _, a = e.data.boundingSphere; return void 0 !== a && (_ = new Cn, void 0 !== a.center && _.fromArray(a.center), n.boundingSphere = new qn(_,a.radius)), e.name && (n.name = e.name), e.userData && (n.userData = e.userData), n } }); var hd, pd = function() { y(n, mc); var t = w(n); function n(e) { return O(this, n), t.call(this, e) } return h(n, [{ key: "load", value: function(n, i, e, r) { var a = this , t = "" === this.path ? ld.extractUrlBase(n) : this.path; this.resourcePath = this.resourcePath || t; t = new gc(this.manager); t.setPath(this.path), t.setRequestHeader(this.requestHeader), t.setWithCredentials(this.withCredentials), t.load(n, function(e) { var t = null; try { t = JSON.parse(e) } catch (e) { return void 0 !== r && r(e), void console.error("THREE:ObjectLoader: Can't parse " + n + ".", e.message) } e = t.metadata; void 0 !== e && void 0 !== e.type && "geometry" !== e.type.toLowerCase() ? a.parse(t, i) : console.error("THREE.ObjectLoader: Can't load " + n) }, e, r) } }, { key: "parse", value: function(e, t) { var n = this.parseAnimations(e.animations) , i = this.parseShapes(e.shapes) , r = this.parseGeometries(e.geometries, i) , a = this.parseImages(e.images, function() { void 0 !== t && t(o) }) , i = this.parseTextures(e.textures, a) , i = this.parseMaterials(e.materials, i) , o = this.parseObject(e.object, r, i, n) , e = this.parseSkeletons(e.skeletons, o); if (this.bindSkeletons(o, e), void 0 !== t) { var s, l = !1; for (s in a) if (a[s]instanceof HTMLImageElement) { l = !0; break } !1 === l && t(o) } return o } }, { key: "parseShapes", value: function(e) { var t = {}; if (void 0 !== e) for (var n = 0, i = e.length; n < i; n++) { var r = (new Xc).fromJSON(e[n]); t[r.uuid] = r } return t } }, { key: "parseSkeletons", value: function(e, t) { var n = {} , i = {}; if (t.traverse(function(e) { e.isBone && (i[e.uuid] = e) }), void 0 !== e) for (var r = 0, a = e.length; r < a; r++) { var o = (new Ys).fromJSON(e[r], i); n[o.uuid] = o } return n } }, { key: "parseGeometries", value: function(e, t) { var n = {}; if (void 0 !== e) for (var i = new dd, r = 0, a = e.length; r < a; r++) { var o = void 0 , s = e[r]; switch (s.type) { case "PlaneGeometry": case "PlaneBufferGeometry": o = new Nu[s.type](s.width,s.height,s.widthSegments,s.heightSegments); break; case "BoxGeometry": case "BoxBufferGeometry": case "CubeGeometry": o = new Nu[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments); break; case "CircleGeometry": case "CircleBufferGeometry": o = new Nu[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength); break; case "CylinderGeometry": case "CylinderBufferGeometry": o = new Nu[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength); break; case "ConeGeometry": case "ConeBufferGeometry": o = new Nu[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength); break; case "SphereGeometry": case "SphereBufferGeometry": o = new Nu[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength); break; case "DodecahedronGeometry": case "DodecahedronBufferGeometry": case "IcosahedronGeometry": case "IcosahedronBufferGeometry": case "OctahedronGeometry": case "OctahedronBufferGeometry": case "TetrahedronGeometry": case "TetrahedronBufferGeometry": o = new Nu[s.type](s.radius,s.detail); break; case "RingGeometry": case "RingBufferGeometry": o = new Nu[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength); break; case "TorusGeometry": case "TorusBufferGeometry": o = new Nu[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc); break; case "TorusKnotGeometry": case "TorusKnotBufferGeometry": o = new Nu[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q); break; case "TubeGeometry": case "TubeBufferGeometry": o = new Nu[s.type]((new Vc[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed); break; case "LatheGeometry": case "LatheBufferGeometry": o = new Nu[s.type](s.points,s.segments,s.phiStart,s.phiLength); break; case "PolyhedronGeometry": case "PolyhedronBufferGeometry": o = new Nu[s.type](s.vertices,s.indices,s.radius,s.details); break; case "ShapeGeometry": case "ShapeBufferGeometry": for (var l = [], u = 0, c = s.shapes.length; u < c; u++) { var d = t[s.shapes[u]]; l.push(d) } o = new Nu[s.type](l,s.curveSegments); break; case "ExtrudeGeometry": case "ExtrudeBufferGeometry": l = []; for (var h = 0, p = s.shapes.length; h < p; h++) { var f = t[s.shapes[h]]; l.push(f) } var m = s.options.extrudePath; void 0 !== m && (s.options.extrudePath = (new Vc[m.type]).fromJSON(m)), o = new Nu[s.type](l,s.options); break; case "BufferGeometry": case "InstancedBufferGeometry": o = i.parse(s); break; case "Geometry": console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.'); break; default: console.warn('THREE.ObjectLoader: Unsupported geometry type "' + s.type + '"'); continue } o.uuid = s.uuid, void 0 !== s.name && (o.name = s.name), !0 === o.isBufferGeometry && void 0 !== s.userData && (o.userData = s.userData), n[s.uuid] = o } return n } }, { key: "parseMaterials", value: function(e, t) { var n = {} , i = {}; if (void 0 !== e) { var r = new sd; r.setTextures(t); for (var a = 0, o = e.length; a < o; a++) { var s = e[a]; if ("MultiMaterial" === s.type) { for (var l = [], u = 0; u < s.materials.length; u++) { var c = s.materials[u]; void 0 === n[c.uuid] && (n[c.uuid] = r.parse(c)), l.push(n[c.uuid]) } i[s.uuid] = l } else void 0 === n[s.uuid] && (n[s.uuid] = r.parse(s)), i[s.uuid] = n[s.uuid] } } return i } }, { key: "parseAnimations", value: function(e) { var t = {}; if (void 0 !== e) for (var n = 0; n < e.length; n++) { var i = e[n] , i = cc.parse(i); t[i.uuid] = i } return t } }, { key: "parseImages", value: function(e, t) { var n = this , i = {}; function r(e) { if ("string" != typeof e) return e.data ? { data: vr(e.type, e.data), width: e.width, height: e.height } : null; var t, e = e, e = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(e) ? e : n.resourcePath + e; return t = e, n.manager.itemStart(t), a.load(t, function() { n.manager.itemEnd(t) }, void 0, function() { n.manager.itemError(t), n.manager.itemEnd(t) }) } if (void 0 !== e && 0 < e.length) { var a, t = new pc(t); (a = new bc(t)).setCrossOrigin(this.crossOrigin); for (var o = 0, s = e.length; o < s; o++) { var l = e[o] , u = l.url; if (Array.isArray(u)) { i[l.uuid] = []; for (var c = 0, d = u.length; c < d; c++) { var h = r(u[c]); null !== h && (h instanceof HTMLImageElement ? i[l.uuid].push(h) : i[l.uuid].push(new ia(h.data,h.width,h.height))) } } else { var p = r(l.url); null !== p && (i[l.uuid] = p) } } } return i } }, { key: "parseTextures", value: function(e, t) { function n(e, t) { return "number" == typeof e ? e : (console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.", e), t[e]) } var i = {}; if (void 0 !== e) for (var r = 0, a = e.length; r < a; r++) { var o = e[r]; void 0 === o.image && console.warn('THREE.ObjectLoader: No "image" specified for', o.uuid), void 0 === t[o.image] && console.warn("THREE.ObjectLoader: Undefined image", o.image); var s = void 0 , l = t[o.image]; Array.isArray(l) ? (s = new ta(l), 6 === l.length && (s.needsUpdate = !0)) : (s = l && l.data ? new ia(l.data,l.width,l.height) : new En(l), l && (s.needsUpdate = !0)), s.uuid = o.uuid, void 0 !== o.name && (s.name = o.name), void 0 !== o.mapping && (s.mapping = n(o.mapping, fd)), void 0 !== o.offset && s.offset.fromArray(o.offset), void 0 !== o.repeat && s.repeat.fromArray(o.repeat), void 0 !== o.center && s.center.fromArray(o.center), void 0 !== o.rotation && (s.rotation = o.rotation), void 0 !== o.wrap && (s.wrapS = n(o.wrap[0], md), s.wrapT = n(o.wrap[1], md)), void 0 !== o.format && (s.format = o.format), void 0 !== o.type && (s.type = o.type), void 0 !== o.encoding && (s.encoding = o.encoding), void 0 !== o.minFilter && (s.minFilter = n(o.minFilter, vd)), void 0 !== o.magFilter && (s.magFilter = n(o.magFilter, vd)), void 0 !== o.anisotropy && (s.anisotropy = o.anisotropy), void 0 !== o.flipY && (s.flipY = o.flipY), void 0 !== o.premultiplyAlpha && (s.premultiplyAlpha = o.premultiplyAlpha), void 0 !== o.unpackAlignment && (s.unpackAlignment = o.unpackAlignment), i[o.uuid] = s } return i } }, { key: "parseObject", value: function(e, t, a, n) { function i(e) { return void 0 === t[e] && console.warn("THREE.ObjectLoader: Undefined geometry", e), t[e] } function r(e) { if (void 0 !== e) { if (Array.isArray(e)) { for (var t = [], n = 0, i = e.length; n < i; n++) { var r = e[n]; void 0 === a[r] && console.warn("THREE.ObjectLoader: Undefined material", r), t.push(a[r]) } return t } return void 0 === a[e] && console.warn("THREE.ObjectLoader: Undefined material", e), a[e] } } switch (e.type) { case "Scene": o = new gs, void 0 !== e.background && Number.isInteger(e.background) && (o.background = new Yi(e.background)), void 0 !== e.fog && ("Fog" === e.fog.type ? o.fog = new vs(e.fog.color,e.fog.near,e.fog.far) : "FogExp2" === e.fog.type && (o.fog = new ms(e.fog.color,e.fog.density))); break; case "PerspectiveCamera": o = new $r(e.fov,e.aspect,e.near,e.far), void 0 !== e.focus && (o.focus = e.focus), void 0 !== e.zoom && (o.zoom = e.zoom), void 0 !== e.filmGauge && (o.filmGauge = e.filmGauge), void 0 !== e.filmOffset && (o.filmOffset = e.filmOffset), void 0 !== e.view && (o.view = Object.assign({}, e.view)); break; case "OrthographicCamera": o = new ed(e.left,e.right,e.top,e.bottom,e.near,e.far), void 0 !== e.zoom && (o.zoom = e.zoom), void 0 !== e.view && (o.view = Object.assign({}, e.view)); break; case "AmbientLight": o = new id(e.color,e.intensity); break; case "DirectionalLight": o = new nd(e.color,e.intensity); break; case "PointLight": o = new $c(e.color,e.intensity,e.distance,e.decay); break; case "RectAreaLight": o = new rd(e.color,e.intensity,e.width,e.height); break; case "SpotLight": o = new Qc(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay); break; case "HemisphereLight": o = new Jc(e.color,e.groundColor,e.intensity); break; case "LightProbe": o = (new od).fromJSON(e); break; case "SkinnedMesh": o = new Ws(s = i(e.geometry),l = r(e.material)), void 0 !== e.bindMode && (o.bindMode = e.bindMode), void 0 !== e.bindMatrix && o.bindMatrix.fromArray(e.bindMatrix), void 0 !== e.skeleton && (o.skeleton = e.skeleton); break; case "Mesh": o = new Hr(s = i(e.geometry),l = r(e.material)); break; case "InstancedMesh": var o, s = i(e.geometry), l = r(e.material), u = e.count, c = e.instanceMatrix; (o = new el(s,l,u)).instanceMatrix = new nr(new Float32Array(c.array),16); break; case "LOD": o = new Ns; break; case "Line": o = new sl(i(e.geometry),r(e.material)); break; case "LineLoop": o = new dl(i(e.geometry),r(e.material)); break; case "LineSegments": o = new cl(i(e.geometry),r(e.material)); break; case "PointCloud": case "Points": o = new gl(i(e.geometry),r(e.material)); break; case "Sprite": o = new Fs(r(e.material)); break; case "Group": o = new us; break; case "Bone": o = new Xs; break; default: o = new Si } if (o.uuid = e.uuid, void 0 !== e.name && (o.name = e.name), void 0 !== e.matrix ? (o.matrix.fromArray(e.matrix), void 0 !== e.matrixAutoUpdate && (o.matrixAutoUpdate = e.matrixAutoUpdate), o.matrixAutoUpdate && o.matrix.decompose(o.position, o.quaternion, o.scale)) : (void 0 !== e.position && o.position.fromArray(e.position), void 0 !== e.rotation && o.rotation.fromArray(e.rotation), void 0 !== e.quaternion && o.quaternion.fromArray(e.quaternion), void 0 !== e.scale && o.scale.fromArray(e.scale)), void 0 !== e.castShadow && (o.castShadow = e.castShadow), void 0 !== e.receiveShadow && (o.receiveShadow = e.receiveShadow), e.shadow && (void 0 !== e.shadow.bias && (o.shadow.bias = e.shadow.bias), void 0 !== e.shadow.normalBias && (o.shadow.normalBias = e.shadow.normalBias), void 0 !== e.shadow.radius && (o.shadow.radius = e.shadow.radius), void 0 !== e.shadow.mapSize && o.shadow.mapSize.fromArray(e.shadow.mapSize), void 0 !== e.shadow.camera && (o.shadow.camera = this.parseObject(e.shadow.camera))), void 0 !== e.visible && (o.visible = e.visible), void 0 !== e.frustumCulled && (o.frustumCulled = e.frustumCulled), void 0 !== e.renderOrder && (o.renderOrder = e.renderOrder), void 0 !== e.userData && (o.userData = e.userData), void 0 !== e.layers && (o.layers.mask = e.layers), void 0 !== e.children) for (var d = e.children, h = 0; h < d.length; h++) o.add(this.parseObject(d[h], t, a, n)); if (void 0 !== e.animations) for (var p = e.animations, f = 0; f < p.length; f++) { var m = p[f]; o.animations.push(n[m]) } if ("LOD" === e.type) { void 0 !== e.autoUpdate && (o.autoUpdate = e.autoUpdate); for (var v = e.levels, g = 0; g < v.length; g++) { var y = v[g] , w = o.getObjectByProperty("uuid", y.object); void 0 !== w && o.addLevel(w, y.distance) } } return o } }, { key: "bindSkeletons", value: function(e, n) { 0 !== Object.keys(n).length && e.traverse(function(e) { var t; !0 === e.isSkinnedMesh && void 0 !== e.skeleton && (void 0 === (t = n[e.skeleton]) ? console.warn("THREE.ObjectLoader: No skeleton found with UUID:", e.skeleton) : e.bind(t, e.bindMatrix)) }) } }, { key: "setTexturePath", value: function(e) { return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."), this.setResourcePath(e) } }]), n }(), fd = { UVMapping: 300, CubeReflectionMapping: L, CubeRefractionMapping: R, EquirectangularReflectionMapping: F, EquirectangularRefractionMapping: I, CubeUVReflectionMapping: z, CubeUVRefractionMapping: U }, md = { RepeatWrapping: ke, ClampToEdgeWrapping: Be, MirroredRepeatWrapping: Le }, vd = { NearestFilter: Re, NearestMipmapNearestFilter: Fe, NearestMipmapLinearFilter: Ie, LinearFilter: Oe, LinearMipmapNearestFilter: ze, LinearMipmapLinearFilter: Ne }; function gd(e) { "undefined" == typeof createImageBitmap && console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."), "undefined" == typeof fetch && console.warn("THREE.ImageBitmapLoader: fetch() not supported."), mc.call(this, e), this.options = { premultiplyAlpha: "none" } } function yd() { this.type = "ShapePath", this.color = new Yi, this.subPaths = [], this.currentPath = null } function wd(e) { this.type = "Font", this.data = e } function bd(e) { mc.call(this, e) } gd.prototype = Object.assign(Object.create(mc.prototype), { constructor: gd, isImageBitmapLoader: !0, setOptions: function(e) { return this.options = e, this }, load: function(t, n, e, i) { void 0 === t && (t = ""), void 0 !== this.path && (t = this.path + t), t = this.manager.resolveURL(t); var r = this , a = hc.get(t); if (void 0 !== a) return r.manager.itemStart(t), setTimeout(function() { n && n(a), r.manager.itemEnd(t) }, 0), a; var o = {}; o.credentials = "anonymous" === this.crossOrigin ? "same-origin" : "include", fetch(t, o).then(function(e) { return e.blob() }).then(function(e) { return createImageBitmap(e, r.options) }).then(function(e) { hc.add(t, e), n && n(e), r.manager.itemEnd(t) }).catch(function(e) { i && i(e, t), r.manager.itemError(t), r.manager.itemEnd(t) }), r.manager.itemStart(t) } }), Object.assign(yd.prototype, { moveTo: function(e, t) { return this.currentPath = new Wc, this.subPaths.push(this.currentPath), this.currentPath.moveTo(e, t), this }, lineTo: function(e, t) { return this.currentPath.lineTo(e, t), this }, quadraticCurveTo: function(e, t, n, i) { return this.currentPath.quadraticCurveTo(e, t, n, i), this }, bezierCurveTo: function(e, t, n, i, r, a) { return this.currentPath.bezierCurveTo(e, t, n, i, r, a), this }, splineThru: function(e) { return this.currentPath.splineThru(e), this }, toShapes: function(e, t) { function n(e) { for (var t = [], n = 0, i = e.length; n < i; n++) { var r = e[n] , a = new Xc; a.curves = r.curves, t.push(a) } return t } var i, r, a, o = ou.isClockWise, s = this.subPaths; if (0 === s.length) return []; if (!0 === t) return n(s); var l = []; if (1 === s.length) return r = s[0], (a = new Xc).curves = r.curves, l.push(a), l; var u, c = !o(s[0].getPoints()), c = e ? !c : c, d = [], h = [], p = [], f = 0; h[f] = void 0, p[f] = []; for (var m = 0, v = s.length; m < v; m++) i = o(u = (r = s[m]).getPoints()), (i = e ? !i : i) ? (!c && h[f] && f++, h[f] = { s: new Xc, p: u }, h[f].s.curves = r.curves, c && f++, p[f] = []) : p[f].push({ h: r, p: u[0] }); if (!h[0]) return n(s); if (1 < h.length) { for (var g = !1, y = [], w = 0, b = h.length; w < b; w++) d[w] = []; for (var x = 0, E = h.length; x < E; x++) for (var _ = p[x], M = 0; M < _.length; M++) { for (var A = _[M], T = !0, S = 0; S < h.length; S++) !function(e, t) { for (var n = t.length, i = !1, r = n - 1, a = 0; a < n; r = a++) { var o = t[r] , s = t[a] , l = s.x - o.x , u = s.y - o.y; if (Math.abs(u) > Number.EPSILON) { if (u < 0 && (o = t[a], l = -l, s = t[r], u = -u), !(e.y < o.y || e.y > s.y)) if (e.y === o.y) { if (e.x === o.x) return 1 } else { l = u * (e.x - o.x) - l * (e.y - o.y); if (0 == l) return 1; l < 0 || (i = !i) } } else if (e.y === o.y && (s.x <= e.x && e.x <= o.x || o.x <= e.x && e.x <= s.x)) return 1 } return i }(A.p, h[S].p) || (x !== S && y.push({ froms: x, tos: S, hole: M }), T ? (T = !1, d[S].push(A)) : g = !0); T && d[x].push(A) } 0 < y.length && (g || (p = d)) } for (var C = 0, P = h.length; C < P; C++) { a = h[C].s, l.push(a); for (var D, k = 0, B = (D = p[C]).length; k < B; k++) a.holes.push(D[k].h) } return l } }), Object.assign(wd.prototype, { isFont: !0, generateShapes: function(e) { for (var t = [], n = function(e, t, n) { for (var i = Array.from ? Array.from(e) : String(e).split(""), r = t / n.resolution, a = (n.boundingBox.yMax - n.boundingBox.yMin + n.underlineThickness) * r, o = [], s = 0, l = 0, u = 0; u < i.length; u++) { var c = i[u]; "\n" === c ? (s = 0, l -= a) : (c = function(e, t, n, i, r) { var a = r.glyphs[e] || r.glyphs["?"]; if (a) { var o, s, l, u, c, d, h, p, f = new yd; if (a.o) for (var m = a._cachedOutline || (a._cachedOutline = a.o.split(" ")), v = 0, g = m.length; v < g; ) switch (m[v++]) { case "m": o = m[v++] * t + n, s = m[v++] * t + i, f.moveTo(o, s); break; case "l": o = m[v++] * t + n, s = m[v++] * t + i, f.lineTo(o, s); break; case "q": l = m[v++] * t + n, u = m[v++] * t + i, c = m[v++] * t + n, d = m[v++] * t + i, f.quadraticCurveTo(c, d, l, u); break; case "b": l = m[v++] * t + n, u = m[v++] * t + i, c = m[v++] * t + n, d = m[v++] * t + i, h = m[v++] * t + n, p = m[v++] * t + i, f.bezierCurveTo(c, d, h, p, l, u) } return { offsetX: a.ha * t, path: f } } console.error('THREE.Font: character "' + e + '" does not exists in font family ' + r.familyName + ".") }(c, r, s, l, n), s += c.offsetX, o.push(c.path)) } return o }(e, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 100, this.data), i = 0, r = n.length; i < r; i++) Array.prototype.push.apply(t, n[i].toShapes()); return t } }), bd.prototype = Object.assign(Object.create(mc.prototype), { constructor: bd, load: function(e, i, t, n) { var r = this , a = new gc(this.manager); a.setPath(this.path), a.setRequestHeader(this.requestHeader), a.setWithCredentials(r.withCredentials), a.load(e, function(t) { try { n = JSON.parse(t) } catch (e) { console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."), n = JSON.parse(t.substring(65, t.length - 2)) } var n = r.parse(n); i && i(n) }, t, n) }, parse: function(e) { return new wd(e) } }); var xd = { getContext: function() { return hd = void 0 === hd ? new (window.AudioContext || window.webkitAudioContext) : hd }, setContext: function(e) { hd = e } }; function Ed(e) { mc.call(this, e) } function _d(e, t, n) { od.call(this, void 0, n); var i = (new Yi).set(e) , n = (new Yi).set(t) , e = new Cn(i.r,i.g,i.b) , t = new Cn(n.r,n.g,n.b) , i = Math.sqrt(Math.PI) , n = i * Math.sqrt(.75); this.sh.coefficients[0].copy(e).add(t).multiplyScalar(i), this.sh.coefficients[1].copy(e).sub(t).multiplyScalar(n) } function Md(e, t) { od.call(this, void 0, t); e = (new Yi).set(e); this.sh.coefficients[0].set(e.r, e.g, e.b).multiplyScalar(2 * Math.sqrt(Math.PI)) } Ed.prototype = Object.assign(Object.create(mc.prototype), { constructor: Ed, load: function(n, i, e, r) { var a = this , t = new gc(a.manager); t.setResponseType("arraybuffer"), t.setPath(a.path), t.setRequestHeader(a.requestHeader), t.setWithCredentials(a.withCredentials), t.load(n, function(e) { try { var t = e.slice(0); xd.getContext().decodeAudioData(t, function(e) { i(e) }) } catch (e) { r ? r(e) : console.error(e), a.manager.itemError(n) } }, e, r) } }), _d.prototype = Object.assign(Object.create(od.prototype), { constructor: _d, isHemisphereLightProbe: !0, copy: function(e) { return od.prototype.copy.call(this, e), this }, toJSON: function(e) { return od.prototype.toJSON.call(this, e) } }), Md.prototype = Object.assign(Object.create(od.prototype), { constructor: Md, isAmbientLightProbe: !0, copy: function(e) { return od.prototype.copy.call(this, e), this }, toJSON: function(e) { return od.prototype.toJSON.call(this, e) } }); var Ad = new ni , Td = new ni; function Sd() { this.type = "StereoCamera", this.aspect = 1, this.eyeSep = .064, this.cameraL = new $r, this.cameraL.layers.enable(1), this.cameraL.matrixAutoUpdate = !1, this.cameraR = new $r, this.cameraR.layers.enable(2), this.cameraR.matrixAutoUpdate = !1, this._cache = { focus: null, fov: null, aspect: null, near: null, far: null, zoom: null, eyeSep: null } } Object.assign(Sd.prototype, { update: function(e) { var t, n, i, r, a, o = this._cache; o.focus === e.focus && o.fov === e.fov && o.aspect === e.aspect * this.aspect && o.near === e.near && o.far === e.far && o.zoom === e.zoom && o.eyeSep === this.eyeSep || (o.focus = e.focus, o.fov = e.fov, o.aspect = e.aspect * this.aspect, o.near = e.near, o.far = e.far, o.zoom = e.zoom, o.eyeSep = this.eyeSep, t = e.projectionMatrix.clone(), n = (a = o.eyeSep / 2) * o.near / o.focus, i = o.near * Math.tan(gn.DEG2RAD * o.fov * .5) / o.zoom, Td.elements[12] = -a, Ad.elements[12] = a, r = -i * o.aspect + n, a = i * o.aspect + n, t.elements[0] = 2 * o.near / (a - r), t.elements[8] = (a + r) / (a - r), this.cameraL.projectionMatrix.copy(t), r = -i * o.aspect - n, a = i * o.aspect - n, t.elements[0] = 2 * o.near / (a - r), t.elements[8] = (a + r) / (a - r), this.cameraR.projectionMatrix.copy(t)), this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Td), this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Ad) } }); var Cd = function() { function t(e) { O(this, t), this.autoStart = void 0 === e || e, this.startTime = 0, this.oldTime = 0, this.elapsedTime = 0, this.running = !1 } return h(t, [{ key: "start", value: function() { this.startTime = Pd(), this.oldTime = this.startTime, this.elapsedTime = 0, this.running = !0 } }, { key: "stop", value: function() { this.getElapsedTime(), this.running = !1, this.autoStart = !1 } }, { key: "getElapsedTime", value: function() { return this.getDelta(), this.elapsedTime } }, { key: "getDelta", value: function() { var e, t = 0; return this.autoStart && !this.running ? (this.start(), 0) : (this.running && (t = ((e = Pd()) - this.oldTime) / 1e3, this.oldTime = e, this.elapsedTime += t), t) } }]), t }(); function Pd() { return ("undefined" == typeof performance ? Date : performance).now() } var Dd = new Cn , kd = new Sn , Bd = new Cn , Ld = new Cn , Rd = function() { y(i, Si); var t = w(i); function i() { var e; return O(this, i), (e = t.call(this)).type = "AudioListener", e.context = xd.getContext(), e.gain = e.context.createGain(), e.gain.connect(e.context.destination), e.filter = null, e.timeDelta = 0, e._clock = new Cd, e } return h(i, [{ key: "getInput", value: function() { return this.gain } }, { key: "removeFilter", value: function() { return null !== this.filter && (this.gain.disconnect(this.filter), this.filter.disconnect(this.context.destination), this.gain.connect(this.context.destination), this.filter = null), this } }, { key: "getFilter", value: function() { return this.filter } }, { key: "setFilter", value: function(e) { return null !== this.filter ? (this.gain.disconnect(this.filter), this.filter.disconnect(this.context.destination)) : this.gain.disconnect(this.context.destination), this.filter = e, this.gain.connect(this.filter), this.filter.connect(this.context.destination), this } }, { key: "getMasterVolume", value: function() { return this.gain.gain.value } }, { key: "setMasterVolume", value: function(e) { return this.gain.gain.setTargetAtTime(e, this.context.currentTime, .01), this } }, { key: "updateMatrixWorld", value: function(e) { b(v(i.prototype), "updateMatrixWorld", this).call(this, e); var t = this.context.listener , n = this.up; this.timeDelta = this._clock.getDelta(), this.matrixWorld.decompose(Dd, kd, Bd), Ld.set(0, 0, -1).applyQuaternion(kd), t.positionX ? (e = this.context.currentTime + this.timeDelta, t.positionX.linearRampToValueAtTime(Dd.x, e), t.positionY.linearRampToValueAtTime(Dd.y, e), t.positionZ.linearRampToValueAtTime(Dd.z, e), t.forwardX.linearRampToValueAtTime(Ld.x, e), t.forwardY.linearRampToValueAtTime(Ld.y, e), t.forwardZ.linearRampToValueAtTime(Ld.z, e), t.upX.linearRampToValueAtTime(n.x, e), t.upY.linearRampToValueAtTime(n.y, e), t.upZ.linearRampToValueAtTime(n.z, e)) : (t.setPosition(Dd.x, Dd.y, Dd.z), t.setOrientation(Ld.x, Ld.y, Ld.z, n.x, n.y, n.z)) } }]), i }() , Fd = function() { y(i, Si); var n = w(i); function i(e) { var t; return O(this, i), (t = n.call(this)).type = "Audio", t.listener = e, t.context = e.context, t.gain = t.context.createGain(), t.gain.connect(e.getInput()), t.autoplay = !1, t.buffer = null, t.detune = 0, t.loop = !1, t.loopStart = 0, t.loopEnd = 0, t.offset = 0, t.duration = void 0, t.playbackRate = 1, t.isPlaying = !1, t.hasPlaybackControl = !0, t.source = null, t.sourceType = "empty", t._startedAt = 0, t._progress = 0, t._connected = !1, t.filters = [], t } return h(i, [{ key: "getOutput", value: function() { return this.gain } }, { key: "setNodeSource", value: function(e) { return this.hasPlaybackControl = !1, this.sourceType = "audioNode", this.source = e, this.connect(), this } }, { key: "setMediaElementSource", value: function(e) { return this.hasPlaybackControl = !1, this.sourceType = "mediaNode", this.source = this.context.createMediaElementSource(e), this.connect(), this } }, { key: "setMediaStreamSource", value: function(e) { return this.hasPlaybackControl = !1, this.sourceType = "mediaStreamNode", this.source = this.context.createMediaStreamSource(e), this.connect(), this } }, { key: "setBuffer", value: function(e) { return this.buffer = e, this.sourceType = "buffer", this.autoplay && this.play(), this } }, { key: "play", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0; if (!0 !== this.isPlaying) { if (!1 !== this.hasPlaybackControl) { this._startedAt = this.context.currentTime + e; e = this.context.createBufferSource(); return e.buffer = this.buffer, e.loop = this.loop, e.loopStart = this.loopStart, e.loopEnd = this.loopEnd, e.onended = this.onEnded.bind(this), e.start(this._startedAt, this._progress + this.offset, this.duration), this.isPlaying = !0, this.source = e, this.setDetune(this.detune), this.setPlaybackRate(this.playbackRate), this.connect() } console.warn("THREE.Audio: this Audio has no playback control.") } else console.warn("THREE.Audio: Audio is already playing.") } }, { key: "pause", value: function() { if (!1 !== this.hasPlaybackControl) return !0 === this.isPlaying && (this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate, !0 === this.loop && (this._progress = this._progress % (this.duration || this.buffer.duration)), this.source.stop(), this.source.onended = null, this.isPlaying = !1), this; console.warn("THREE.Audio: this Audio has no playback control.") } }, { key: "stop", value: function() { if (!1 !== this.hasPlaybackControl) return this._progress = 0, this.source.stop(), this.source.onended = null, this.isPlaying = !1, this; console.warn("THREE.Audio: this Audio has no playback control.") } }, { key: "connect", value: function() { if (0 < this.filters.length) { this.source.connect(this.filters[0]); for (var e = 1, t = this.filters.length; e < t; e++) this.filters[e - 1].connect(this.filters[e]); this.filters[this.filters.length - 1].connect(this.getOutput()) } else this.source.connect(this.getOutput()); return this._connected = !0, this } }, { key: "disconnect", value: function() { if (0 < this.filters.length) { this.source.disconnect(this.filters[0]); for (var e = 1, t = this.filters.length; e < t; e++) this.filters[e - 1].disconnect(this.filters[e]); this.filters[this.filters.length - 1].disconnect(this.getOutput()) } else this.source.disconnect(this.getOutput()); return this._connected = !1, this } }, { key: "getFilters", value: function() { return this.filters } }, { key: "setFilters", value: function(e) { return e = e || [], !0 === this._connected ? (this.disconnect(), this.filters = e.slice(), this.connect()) : this.filters = e.slice(), this } }, { key: "setDetune", value: function(e) { if (this.detune = e, void 0 !== this.source.detune) return !0 === this.isPlaying && this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, .01), this } }, { key: "getDetune", value: function() { return this.detune } }, { key: "getFilter", value: function() { return this.getFilters()[0] } }, { key: "setFilter", value: function(e) { return this.setFilters(e ? [e] : []) } }, { key: "setPlaybackRate", value: function(e) { if (!1 !== this.hasPlaybackControl) return this.playbackRate = e, !0 === this.isPlaying && this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, .01), this; console.warn("THREE.Audio: this Audio has no playback control.") } }, { key: "getPlaybackRate", value: function() { return this.playbackRate } }, { key: "onEnded", value: function() { this.isPlaying = !1 } }, { key: "getLoop", value: function() { return !1 === this.hasPlaybackControl ? (console.warn("THREE.Audio: this Audio has no playback control."), !1) : this.loop } }, { key: "setLoop", value: function(e) { if (!1 !== this.hasPlaybackControl) return this.loop = e, !0 === this.isPlaying && (this.source.loop = this.loop), this; console.warn("THREE.Audio: this Audio has no playback control.") } }, { key: "setLoopStart", value: function(e) { return this.loopStart = e, this } }, { key: "setLoopEnd", value: function(e) { return this.loopEnd = e, this } }, { key: "getVolume", value: function() { return this.gain.gain.value } }, { key: "setVolume", value: function(e) { return this.gain.gain.setTargetAtTime(e, this.context.currentTime, .01), this } }]), i }() , Id = new Cn , Od = new Sn , zd = new Cn , Nd = new Cn , Ud = function() { y(n, Fd); var t = w(n); function n(e) { return O(this, n), (e = t.call(this, e)).panner = e.context.createPanner(), e.panner.panningModel = "HRTF", e.panner.connect(e.gain), e } return h(n, [{ key: "getOutput", value: function() { return this.panner } }, { key: "getRefDistance", value: function() { return this.panner.refDistance } }, { key: "setRefDistance", value: function(e) { return this.panner.refDistance = e, this } }, { key: "getRolloffFactor", value: function() { return this.panner.rolloffFactor } }, { key: "setRolloffFactor", value: function(e) { return this.panner.rolloffFactor = e, this } }, { key: "getDistanceModel", value: function() { return this.panner.distanceModel } }, { key: "setDistanceModel", value: function(e) { return this.panner.distanceModel = e, this } }, { key: "getMaxDistance", value: function() { return this.panner.maxDistance } }, { key: "setMaxDistance", value: function(e) { return this.panner.maxDistance = e, this } }, { key: "setDirectionalCone", value: function(e, t, n) { return this.panner.coneInnerAngle = e, this.panner.coneOuterAngle = t, this.panner.coneOuterGain = n, this } }, { key: "updateMatrixWorld", value: function(e) { var t; b(v(n.prototype), "updateMatrixWorld", this).call(this, e), !0 === this.hasPlaybackControl && !1 === this.isPlaying || (this.matrixWorld.decompose(Id, Od, zd), Nd.set(0, 0, 1).applyQuaternion(Od), (t = this.panner).positionX ? (e = this.context.currentTime + this.listener.timeDelta, t.positionX.linearRampToValueAtTime(Id.x, e), t.positionY.linearRampToValueAtTime(Id.y, e), t.positionZ.linearRampToValueAtTime(Id.z, e), t.orientationX.linearRampToValueAtTime(Nd.x, e), t.orientationY.linearRampToValueAtTime(Nd.y, e), t.orientationZ.linearRampToValueAtTime(Nd.z, e)) : (t.setPosition(Id.x, Id.y, Id.z), t.setOrientation(Nd.x, Nd.y, Nd.z))) } }]), n }() , Gd = function() { function n(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 2048; O(this, n), this.analyser = e.context.createAnalyser(), this.analyser.fftSize = t, this.data = new Uint8Array(this.analyser.frequencyBinCount), e.getOutput().connect(this.analyser) } return h(n, [{ key: "getFrequencyData", value: function() { return this.analyser.getByteFrequencyData(this.data), this.data } }, { key: "getAverageFrequency", value: function() { for (var e = 0, t = this.getFrequencyData(), n = 0; n < t.length; n++) e += t[n]; return e / t.length } }]), n }(); function Hd(e, t, n) { var i, r, a; switch (this.binding = e, this.valueSize = n, t) { case "quaternion": i = this._slerp, r = this._slerpAdditive, a = this._setAdditiveIdentityQuaternion, this.buffer = new Float64Array(6 * n), this._workIndex = 5; break; case "string": case "bool": i = this._select, r = this._select, a = this._setAdditiveIdentityOther, this.buffer = new Array(5 * n); break; default: i = this._lerp, r = this._lerpAdditive, a = this._setAdditiveIdentityNumeric, this.buffer = new Float64Array(5 * n) } this._mixBufferRegion = i, this._mixBufferRegionAdditive = r, this._setIdentity = a, this._origIndex = 3, this._addIndex = 4, this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0, this.useCount = 0, this.referenceCount = 0 } Object.assign(Hd.prototype, { accumulate: function(e, t) { var n = this.buffer , i = this.valueSize , r = e * i + i , e = this.cumulativeWeight; if (0 === e) { for (var a = 0; a !== i; ++a) n[r + a] = n[a]; e = t } else this._mixBufferRegion(n, r, 0, t / (e += t), i); this.cumulativeWeight = e }, accumulateAdditive: function(e) { var t = this.buffer , n = this.valueSize , i = n * this._addIndex; 0 === this.cumulativeWeightAdditive && this._setIdentity(), this._mixBufferRegionAdditive(t, i, 0, e, n), this.cumulativeWeightAdditive += e }, apply: function(e) { var t = this.valueSize , n = this.buffer , i = e * t + t , r = this.cumulativeWeight , a = this.cumulativeWeightAdditive , o = this.binding; this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0, r < 1 && (e = t * this._origIndex, this._mixBufferRegion(n, i, e, 1 - r, t)), 0 < a && this._mixBufferRegionAdditive(n, i, this._addIndex * t, 1, t); for (var s = t, l = t + t; s !== l; ++s) if (n[s] !== n[s + t]) { o.setValue(n, i); break } }, saveOriginalState: function() { var e = this.binding , t = this.buffer , n = this.valueSize , i = n * this._origIndex; e.getValue(t, i); for (var r = n, a = i; r !== a; ++r) t[r] = t[i + r % n]; this._setIdentity(), this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0 }, restoreOriginalState: function() { var e = 3 * this.valueSize; this.binding.setValue(this.buffer, e) }, _setAdditiveIdentityNumeric: function() { for (var e = this._addIndex * this.valueSize, t = e + this.valueSize, n = e; n < t; n++) this.buffer[n] = 0 }, _setAdditiveIdentityQuaternion: function() { this._setAdditiveIdentityNumeric(), this.buffer[this._addIndex * this.valueSize + 3] = 1 }, _setAdditiveIdentityOther: function() { for (var e = this._origIndex * this.valueSize, t = this._addIndex * this.valueSize, n = 0; n < this.valueSize; n++) this.buffer[t + n] = this.buffer[e + n] }, _select: function(e, t, n, i, r) { if (.5 <= i) for (var a = 0; a !== r; ++a) e[t + a] = e[n + a] }, _slerp: function(e, t, n, i) { Sn.slerpFlat(e, t, e, t, e, n, i) }, _slerpAdditive: function(e, t, n, i, r) { r = this._workIndex * r; Sn.multiplyQuaternionsFlat(e, r, e, t, e, n), Sn.slerpFlat(e, t, e, t, e, r, i) }, _lerp: function(e, t, n, i, r) { for (var a = 1 - i, o = 0; o !== r; ++o) { var s = t + o; e[s] = e[s] * a + e[n + o] * i } }, _lerpAdditive: function(e, t, n, i, r) { for (var a = 0; a !== r; ++a) { var o = t + a; e[o] = e[o] + e[n + a] * i } } }); var Vd = "\\[\\]\\.:\\/" , jd = new RegExp("[" + Vd + "]","g") , Wd = "[^" + Vd + "]" , Xd = "[^" + Vd.replace("\\.", "") + "]" , qd = /((?:WC+[\/:])*)/.source.replace("WC", Wd) , Jd = /(WCOD+)?/.source.replace("WCOD", Xd) , Yd = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", Wd) , Zd = /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", Wd) , Qd = new RegExp("^" + qd + Jd + Yd + Zd + "$") , Kd = ["material", "materials", "bones"]; function $d(e, t, n) { n = n || eh.parseTrackName(t); this._targetGroup = e, this._bindings = e.subscribe_(t, n) } function eh(e, t, n) { this.path = t, this.parsedPath = n || eh.parseTrackName(t), this.node = eh.findNode(e, this.parsedPath.nodeName) || e, this.rootNode = e } function th() { this.uuid = gn.generateUUID(), this._objects = Array.prototype.slice.call(arguments), this.nCachedObjects_ = 0; var e = {}; this._indicesByUUID = e; for (var t = 0, n = arguments.length; t !== n; ++t) e[arguments[t].uuid] = t; this._paths = [], this._parsedPaths = [], this._bindings = [], this._bindingsIndicesByPath = {}; var i = this; this.stats = { objects: { get total() { return i._objects.length }, get inUse() { return this.total - i.nCachedObjects_ } }, get bindingsPerObject() { return i._bindings.length } } } Object.assign($d.prototype, { getValue: function(e, t) { this.bind(); var n = this._targetGroup.nCachedObjects_ , n = this._bindings[n]; void 0 !== n && n.getValue(e, t) }, setValue: function(e, t) { for (var n = this._bindings, i = this._targetGroup.nCachedObjects_, r = n.length; i !== r; ++i) n[i].setValue(e, t) }, bind: function() { for (var e = this._bindings, t = this._targetGroup.nCachedObjects_, n = e.length; t !== n; ++t) e[t].bind() }, unbind: function() { for (var e = this._bindings, t = this._targetGroup.nCachedObjects_, n = e.length; t !== n; ++t) e[t].unbind() } }), Object.assign(eh, { Composite: $d, create: function(e, t, n) { return new (e && e.isAnimationObjectGroup ? eh.Composite : eh)(e,t,n) }, sanitizeNodeName: function(e) { return e.replace(/\s/g, "_").replace(jd, "") }, parseTrackName: function(e) { var t = Qd.exec(e); if (!t) throw new Error("PropertyBinding: Cannot parse trackName: " + e); var n = { nodeName: t[2], objectName: t[3], objectIndex: t[4], propertyName: t[5], propertyIndex: t[6] } , i = n.nodeName && n.nodeName.lastIndexOf("."); if (void 0 !== i && -1 !== i && (t = n.nodeName.substring(i + 1), -1 !== Kd.indexOf(t) && (n.nodeName = n.nodeName.substring(0, i), n.objectName = t)), null === n.propertyName || 0 === n.propertyName.length) throw new Error("PropertyBinding: can not parse propertyName from trackName: " + e); return n }, findNode: function(e, r) { if (!r || "" === r || "." === r || -1 === r || r === e.name || r === e.uuid) return e; if (e.skeleton) { var t = e.skeleton.getBoneByName(r); if (void 0 !== t) return t } if (e.children) { e = function e(t) { for (var n = 0; n < t.length; n++) { var i = t[n]; if (i.name === r || i.uuid === r) return i; i = e(i.children); if (i) return i } return null }(e.children); if (e) return e } return null } }), Object.assign(eh.prototype, { _getValue_unavailable: function() {}, _setValue_unavailable: function() {}, BindingType: { Direct: 0, EntireArray: 1, ArrayElement: 2, HasFromToArray: 3 }, Versioning: { None: 0, NeedsUpdate: 1, MatrixWorldNeedsUpdate: 2 }, GetterByBindingType: [function(e, t) { e[t] = this.node[this.propertyName] } , function(e, t) { for (var n = this.resolvedProperty, i = 0, r = n.length; i !== r; ++i) e[t++] = n[i] } , function(e, t) { e[t] = this.resolvedProperty[this.propertyIndex] } , function(e, t) { this.resolvedProperty.toArray(e, t) } ], SetterByBindingTypeAndVersioning: [[function(e, t) { this.targetObject[this.propertyName] = e[t] } , function(e, t) { this.targetObject[this.propertyName] = e[t], this.targetObject.needsUpdate = !0 } , function(e, t) { this.targetObject[this.propertyName] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0 } ], [function(e, t) { for (var n = this.resolvedProperty, i = 0, r = n.length; i !== r; ++i) n[i] = e[t++] } , function(e, t) { for (var n = this.resolvedProperty, i = 0, r = n.length; i !== r; ++i) n[i] = e[t++]; this.targetObject.needsUpdate = !0 } , function(e, t) { for (var n = this.resolvedProperty, i = 0, r = n.length; i !== r; ++i) n[i] = e[t++]; this.targetObject.matrixWorldNeedsUpdate = !0 } ], [function(e, t) { this.resolvedProperty[this.propertyIndex] = e[t] } , function(e, t) { this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.needsUpdate = !0 } , function(e, t) { this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0 } ], [function(e, t) { this.resolvedProperty.fromArray(e, t) } , function(e, t) { this.resolvedProperty.fromArray(e, t), this.targetObject.needsUpdate = !0 } , function(e, t) { this.resolvedProperty.fromArray(e, t), this.targetObject.matrixWorldNeedsUpdate = !0 } ]], getValue: function(e, t) { this.bind(), this.getValue(e, t) }, setValue: function(e, t) { this.bind(), this.setValue(e, t) }, bind: function() { var e = this.node , t = this.parsedPath , n = t.objectName , i = t.propertyName , r = t.propertyIndex; if (e || (e = eh.findNode(this.rootNode, t.nodeName) || this.rootNode, this.node = e), this.getValue = this._getValue_unavailable, this.setValue = this._setValue_unavailable, e) { if (n) { var a = t.objectIndex; switch (n) { case "materials": if (!e.material) return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this); if (!e.material.materials) return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this); e = e.material.materials; break; case "bones": if (!e.skeleton) return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.", this); for (var e = e.skeleton.bones, o = 0; o < e.length; o++) if (e[o].name === a) { a = o; break } break; default: if (void 0 === e[n]) return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.", this); e = e[n] } if (void 0 !== a) { if (void 0 === e[a]) return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, e); e = e[a] } } var s = e[i]; if (void 0 !== s) { var l = this.Versioning.None; void 0 !== (this.targetObject = e).needsUpdate ? l = this.Versioning.NeedsUpdate : void 0 !== e.matrixWorldNeedsUpdate && (l = this.Versioning.MatrixWorldNeedsUpdate); var u = this.BindingType.Direct; if (void 0 !== r) { if ("morphTargetInfluences" === i) { if (!e.geometry) return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this); if (!e.geometry.isBufferGeometry) return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.", this); if (!e.geometry.morphAttributes) return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this); void 0 !== e.morphTargetDictionary[r] && (r = e.morphTargetDictionary[r]) } u = this.BindingType.ArrayElement, this.resolvedProperty = s, this.propertyIndex = r } else void 0 !== s.fromArray && void 0 !== s.toArray ? (u = this.BindingType.HasFromToArray, this.resolvedProperty = s) : Array.isArray(s) ? (u = this.BindingType.EntireArray, this.resolvedProperty = s) : this.propertyName = i; this.getValue = this.GetterByBindingType[u], this.setValue = this.SetterByBindingTypeAndVersioning[u][l] } else { t = t.nodeName; console.error("THREE.PropertyBinding: Trying to update property for track: " + t + "." + i + " but it wasn't found.", e) } } else console.error("THREE.PropertyBinding: Trying to update node for track: " + this.path + " but it wasn't found.") }, unbind: function() { this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound } }), Object.assign(eh.prototype, { _getValue_unbound: eh.prototype.getValue, _setValue_unbound: eh.prototype.setValue }), Object.assign(th.prototype, { isAnimationObjectGroup: !0, add: function() { for (var e = this._objects, t = this._indicesByUUID, n = this._paths, i = this._parsedPaths, r = this._bindings, a = r.length, o = void 0, s = e.length, l = this.nCachedObjects_, u = 0, c = arguments.length; u !== c; ++u) { var d = arguments[u] , h = d.uuid , p = t[h]; if (void 0 === p) { p = s++, t[h] = p, e.push(d); for (var f = 0, m = a; f !== m; ++f) r[f].push(new eh(d,n[f],i[f])) } else if (p < l) { var o = e[p] , v = --l , g = e[v]; e[t[g.uuid] = p] = g, e[t[h] = v] = d; for (var y = 0, w = a; y !== w; ++y) { var b = r[y] , x = b[v] , E = b[p]; b[p] = x, void 0 === E && (E = new eh(d,n[y],i[y])), b[v] = E } } else e[p] !== o && console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.") } this.nCachedObjects_ = l }, remove: function() { for (var e = this._objects, t = this._indicesByUUID, n = this._bindings, i = n.length, r = this.nCachedObjects_, a = 0, o = arguments.length; a !== o; ++a) { var s = arguments[a] , l = s.uuid , u = t[l]; if (void 0 !== u && r <= u) { var c = r++ , d = e[c]; e[t[d.uuid] = u] = d, e[t[l] = c] = s; for (var h = 0, p = i; h !== p; ++h) { var f = n[h] , m = f[c] , v = f[u]; f[u] = m, f[c] = v } } } this.nCachedObjects_ = r }, uncache: function() { for (var e = this._objects, t = this._indicesByUUID, n = this._bindings, i = n.length, r = this.nCachedObjects_, a = e.length, o = 0, s = arguments.length; o !== s; ++o) { var l = arguments[o].uuid , u = t[l]; if (void 0 !== u) if (delete t[l], u < r) { var c = --r , l = e[c] , d = --a , h = e[d]; e[t[l.uuid] = u] = l, e[t[h.uuid] = c] = h, e.pop(); for (var p = 0, f = i; p !== f; ++p) { var m = n[p] , v = m[c] , g = m[d]; m[u] = v, m[c] = g, m.pop() } } else { var y = --a , h = e[y]; 0 < y && (t[h.uuid] = u), e[u] = h, e.pop(); for (var w = 0, b = i; w !== b; ++w) { var x = n[w]; x[u] = x[y], x.pop() } } } this.nCachedObjects_ = r }, subscribe_: function(e, t) { var n = this._bindingsIndicesByPath , i = n[e] , r = this._bindings; if (void 0 !== i) return r[i]; var a = this._paths , o = this._parsedPaths , s = this._objects , l = s.length , u = this.nCachedObjects_ , c = new Array(l) , i = r.length; n[e] = i, a.push(e), o.push(t), r.push(c); for (var d = u, h = s.length; d !== h; ++d) { var p = s[d]; c[d] = new eh(p,e,t) } return c }, unsubscribe_: function(e) { var t, n, i, r, a, o = this._bindingsIndicesByPath, s = o[e]; void 0 !== s && (t = this._paths, n = this._parsedPaths, a = (i = this._bindings)[r = i.length - 1], i[o[e[r]] = s] = a, i.pop(), n[s] = n[r], n.pop(), t[s] = t[r], t.pop()) } }); var nh = function() { function c(e, t) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : t.blendMode; O(this, c), this._mixer = e, this._clip = t, this._localRoot = n, this.blendMode = i; for (var r = t.tracks, a = r.length, o = new Array(a), s = { endingStart: en, endingEnd: en }, l = 0; l !== a; ++l) { var u = r[l].createInterpolant(null); (o[l] = u).settings = s } this._interpolantSettings = s, this._interpolants = o, this._propertyBindings = new Array(a), this._cacheIndex = null, this._byClipCacheIndex = null, this._timeScaleInterpolant = null, this._weightInterpolant = null, this.loop = 2201, this._loopCount = -1, this._startTime = null, this.time = 0, this.timeScale = 1, this._effectiveTimeScale = 1, this.weight = 1, this._effectiveWeight = 1, this.repetitions = 1 / 0, this.paused = !1, this.enabled = !0, this.clampWhenFinished = !1, this.zeroSlopeAtStart = !0, this.zeroSlopeAtEnd = !0 } return h(c, [{ key: "play", value: function() { return this._mixer._activateAction(this), this } }, { key: "stop", value: function() { return this._mixer._deactivateAction(this), this.reset() } }, { key: "reset", value: function() { return this.paused = !1, this.enabled = !0, this.time = 0, this._loopCount = -1, this._startTime = null, this.stopFading().stopWarping() } }, { key: "isRunning", value: function() { return this.enabled && !this.paused && 0 !== this.timeScale && null === this._startTime && this._mixer._isActiveAction(this) } }, { key: "isScheduled", value: function() { return this._mixer._isActiveAction(this) } }, { key: "startAt", value: function(e) { return this._startTime = e, this } }, { key: "setLoop", value: function(e, t) { return this.loop = e, this.repetitions = t, this } }, { key: "setEffectiveWeight", value: function(e) { return this.weight = e, this._effectiveWeight = this.enabled ? e : 0, this.stopFading() } }, { key: "getEffectiveWeight", value: function() { return this._effectiveWeight } }, { key: "fadeIn", value: function(e) { return this._scheduleFading(e, 0, 1) } }, { key: "fadeOut", value: function(e) { return this._scheduleFading(e, 1, 0) } }, { key: "crossFadeFrom", value: function(e, t, n) { var i, r; return e.fadeOut(t), this.fadeIn(t), n && (n = (i = this._clip.duration) / (r = e._clip.duration), e.warp(1, r / i, t), this.warp(n, 1, t)), this } }, { key: "crossFadeTo", value: function(e, t, n) { return e.crossFadeFrom(this, t, n) } }, { key: "stopFading", value: function() { var e = this._weightInterpolant; return null !== e && (this._weightInterpolant = null, this._mixer._takeBackControlInterpolant(e)), this } }, { key: "setEffectiveTimeScale", value: function(e) { return this.timeScale = e, this._effectiveTimeScale = this.paused ? 0 : e, this.stopWarping() } }, { key: "getEffectiveTimeScale", value: function() { return this._effectiveTimeScale } }, { key: "setDuration", value: function(e) { return this.timeScale = this._clip.duration / e, this.stopWarping() } }, { key: "syncWith", value: function(e) { return this.time = e.time, this.timeScale = e.timeScale, this.stopWarping() } }, { key: "halt", value: function(e) { return this.warp(this._effectiveTimeScale, 0, e) } }, { key: "warp", value: function(e, t, n) { var i = this._mixer , r = i.time , a = this.timeScale , o = this._timeScaleInterpolant; null === o && (o = i._lendControlInterpolant(), this._timeScaleInterpolant = o); i = o.parameterPositions, o = o.sampleValues; return i[0] = r, i[1] = r + n, o[0] = e / a, o[1] = t / a, this } }, { key: "stopWarping", value: function() { var e = this._timeScaleInterpolant; return null !== e && (this._timeScaleInterpolant = null, this._mixer._takeBackControlInterpolant(e)), this } }, { key: "getMixer", value: function() { return this._mixer } }, { key: "getClip", value: function() { return this._clip } }, { key: "getRoot", value: function() { return this._localRoot || this._mixer._root } }, { key: "_update", value: function(e, t, n, i) { if (this.enabled) { var r = this._startTime; if (null !== r) { r = (e - r) * n; if (r < 0 || 0 === n) return; this._startTime = null, t = n * r } t *= this._updateTimeScale(e); var a = this._updateTime(t) , o = this._updateWeight(e); if (0 < o) { var s = this._interpolants , l = this._propertyBindings; if (2501 === this.blendMode) for (var u = 0, c = s.length; u !== c; ++u) s[u].evaluate(a), l[u].accumulateAdditive(o); else for (var d = 0, h = s.length; d !== h; ++d) s[d].evaluate(a), l[d].accumulate(i, o) } } else this._updateWeight(e) } }, { key: "_updateWeight", value: function(e) { var t, n, i = 0; return this.enabled && (i = this.weight, null !== (t = this._weightInterpolant) && (i *= n = t.evaluate(e)[0], e > t.parameterPositions[1] && (this.stopFading(), 0 === n && (this.enabled = !1)))), this._effectiveWeight = i } }, { key: "_updateTimeScale", value: function(e) { var t, n = 0; return this.paused || (n = this.timeScale, null !== (t = this._timeScaleInterpolant) && (n *= t.evaluate(e)[0], e > t.parameterPositions[1] && (this.stopWarping(), 0 === n ? this.paused = !0 : this.timeScale = n))), this._effectiveTimeScale = n } }, { key: "_updateTime", value: function(e) { var t, n = this._clip.duration, i = this.loop, r = this.time + e, a = this._loopCount, o = 2202 === i; if (0 === e) return -1 !== a && o && 1 == (1 & a) ? n - r : r; if (2200 === i) { -1 === a && (this._loopCount = 0, this._setEndings(!0, !0, !1)); e: { if (n <= r) r = n; else { if (!(r < 0)) { this.time = r; break e } r = 0 } this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, this.time = r, this._mixer.dispatchEvent({ type: "finished", action: this, direction: e < 0 ? -1 : 1 }) } } else if (-1 === a && (0 <= e ? this._setEndings(!(a = 0), 0 === this.repetitions, o) : this._setEndings(0 === this.repetitions, !0, o)), n <= r || r < 0 ? (r -= n * (t = Math.floor(r / n)), a += Math.abs(t), (i = this.repetitions - a) <= 0 ? (this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, this.time = r = 0 < e ? n : 0, this._mixer.dispatchEvent({ type: "finished", action: this, direction: 0 < e ? 1 : -1 })) : (1 == i ? this._setEndings(i = e < 0, !i, o) : this._setEndings(!1, !1, o), this._loopCount = a, this.time = r, this._mixer.dispatchEvent({ type: "loop", action: this, loopDelta: t }))) : this.time = r, o && 1 == (1 & a)) return n - r; return r } }, { key: "_setEndings", value: function(e, t, n) { var i = this._interpolantSettings; n ? (i.endingStart = tn, i.endingEnd = tn) : (i.endingStart = e ? this.zeroSlopeAtStart ? tn : en : nn, i.endingEnd = t ? this.zeroSlopeAtEnd ? tn : en : nn) } }, { key: "_scheduleFading", value: function(e, t, n) { var i = this._mixer , r = i.time , a = this._weightInterpolant; null === a && (a = i._lendControlInterpolant(), this._weightInterpolant = a); i = a.parameterPositions, a = a.sampleValues; return i[0] = r, a[0] = t, i[1] = r + e, a[1] = n, this } }]), c }(); function ih(e) { this._root = e, this._initMemoryManager(), this._accuIndex = 0, this.time = 0, this.timeScale = 1 } ih.prototype = Object.assign(Object.create(hn.prototype), { constructor: ih, _bindAction: function(e, t) { var n = e._localRoot || this._root , i = e._clip.tracks , r = i.length , a = e._propertyBindings , o = e._interpolants , s = n.uuid , e = this._bindingsByRootAndName , l = e[s]; void 0 === l && (e[s] = l = {}); for (var u = 0; u !== r; ++u) { var c = i[u] , d = c.name; if (void 0 !== (h = l[d])) a[u] = h; else { if (void 0 !== (h = a[u])) { null === h._cacheIndex && (++h.referenceCount, this._addInactiveBinding(h, s, d)); continue } var h, p = t && t._propertyBindings[u].binding.parsedPath; ++(h = new Hd(eh.create(n, d, p),c.ValueTypeName,c.getValueSize())).referenceCount, this._addInactiveBinding(h, s, d), a[u] = h } o[u].resultBuffer = h.buffer } }, _activateAction: function(e) { if (!this._isActiveAction(e)) { var t, n, i; null === e._cacheIndex && (t = (e._localRoot || this._root).uuid, n = e._clip.uuid, i = this._actionsByClip[n], this._bindAction(e, i && i.knownActions[0]), this._addInactiveAction(e, n, t)); for (var r = e._propertyBindings, a = 0, o = r.length; a !== o; ++a) { var s = r[a]; 0 == s.useCount++ && (this._lendBinding(s), s.saveOriginalState()) } this._lendAction(e) } }, _deactivateAction: function(e) { if (this._isActiveAction(e)) { for (var t = e._propertyBindings, n = 0, i = t.length; n !== i; ++n) { var r = t[n]; 0 == --r.useCount && (r.restoreOriginalState(), this._takeBackBinding(r)) } this._takeBackAction(e) } }, _initMemoryManager: function() { this._actions = [], this._nActiveActions = 0, this._actionsByClip = {}, this._bindings = [], this._nActiveBindings = 0, this._bindingsByRootAndName = {}, this._controlInterpolants = [], this._nActiveControlInterpolants = 0; var e = this; this.stats = { actions: { get total() { return e._actions.length }, get inUse() { return e._nActiveActions } }, bindings: { get total() { return e._bindings.length }, get inUse() { return e._nActiveBindings } }, controlInterpolants: { get total() { return e._controlInterpolants.length }, get inUse() { return e._nActiveControlInterpolants } } } }, _isActiveAction: function(e) { e = e._cacheIndex; return null !== e && e < this._nActiveActions }, _addInactiveAction: function(e, t, n) { var i = this._actions , r = this._actionsByClip , a = r[t]; void 0 === a ? (a = { knownActions: [e], actionByRoot: {} }, e._byClipCacheIndex = 0, r[t] = a) : (t = a.knownActions, e._byClipCacheIndex = t.length, t.push(e)), e._cacheIndex = i.length, i.push(e), a.actionByRoot[n] = e }, _removeInactiveAction: function(e) { var t = this._actions , n = t[t.length - 1] , i = e._cacheIndex; t[n._cacheIndex = i] = n, t.pop(), e._cacheIndex = null; var r = e._clip.uuid , a = this._actionsByClip , o = a[r] , i = o.knownActions , n = i[i.length - 1] , t = e._byClipCacheIndex; i[n._byClipCacheIndex = t] = n, i.pop(), e._byClipCacheIndex = null, delete o.actionByRoot[(e._localRoot || this._root).uuid], 0 === i.length && delete a[r], this._removeInactiveBindingsForAction(e) }, _removeInactiveBindingsForAction: function(e) { for (var t = e._propertyBindings, n = 0, i = t.length; n !== i; ++n) { var r = t[n]; 0 == --r.referenceCount && this._removeInactiveBinding(r) } }, _lendAction: function(e) { var t = this._actions , n = e._cacheIndex , i = this._nActiveActions++ , r = t[i]; t[e._cacheIndex = i] = e, t[r._cacheIndex = n] = r }, _takeBackAction: function(e) { var t = this._actions , n = e._cacheIndex , i = --this._nActiveActions , r = t[i]; t[e._cacheIndex = i] = e, t[r._cacheIndex = n] = r }, _addInactiveBinding: function(e, t, n) { var i = this._bindingsByRootAndName , r = this._bindings , a = i[t]; void 0 === a && (i[t] = a = {}), (a[n] = e)._cacheIndex = r.length, r.push(e) }, _removeInactiveBinding: function(e) { var t = this._bindings , n = e.binding , i = n.rootNode.uuid , r = n.path , a = this._bindingsByRootAndName , o = a[i] , n = t[t.length - 1] , e = e._cacheIndex; t[n._cacheIndex = e] = n, t.pop(), delete o[r], 0 === Object.keys(o).length && delete a[i] }, _lendBinding: function(e) { var t = this._bindings , n = e._cacheIndex , i = this._nActiveBindings++ , r = t[i]; t[e._cacheIndex = i] = e, t[r._cacheIndex = n] = r }, _takeBackBinding: function(e) { var t = this._bindings , n = e._cacheIndex , i = --this._nActiveBindings , r = t[i]; t[e._cacheIndex = i] = e, t[r._cacheIndex = n] = r }, _lendControlInterpolant: function() { var e = this._controlInterpolants , t = this._nActiveControlInterpolants++ , n = e[t]; return void 0 === n && (e[(n = new ec(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex = t] = n), n }, _takeBackControlInterpolant: function(e) { var t = this._controlInterpolants , n = e.__cacheIndex , i = --this._nActiveControlInterpolants , r = t[i]; t[e.__cacheIndex = i] = e, t[r.__cacheIndex = n] = r }, _controlInterpolantsResultBuffer: new Float32Array(1), clipAction: function(e, t, n) { var i = t || this._root , r = i.uuid , a = "string" == typeof e ? cc.findByName(i, e) : e , o = null !== a ? a.uuid : e , s = this._actionsByClip[o] , i = null; if (void 0 === n && (n = null !== a ? a.blendMode : 2500), void 0 !== s) { e = s.actionByRoot[r]; if (void 0 !== e && e.blendMode === n) return e; i = s.knownActions[0], null === a && (a = i._clip) } if (null === a) return null; n = new nh(this,a,t,n); return this._bindAction(n, i), this._addInactiveAction(n, o, r), n }, existingAction: function(e, t) { var n = t || this._root , t = n.uuid , n = "string" == typeof e ? cc.findByName(n, e) : e , e = n ? n.uuid : e , e = this._actionsByClip[e]; return void 0 !== e && e.actionByRoot[t] || null }, stopAllAction: function() { for (var e = this._actions, t = this._nActiveActions - 1; 0 <= t; --t) e[t].stop(); return this }, update: function(e) { e *= this.timeScale; for (var t = this._actions, n = this._nActiveActions, i = this.time += e, r = Math.sign(e), a = this._accuIndex ^= 1, o = 0; o !== n; ++o) t[o]._update(i, e, r, a); for (var s = this._bindings, l = this._nActiveBindings, u = 0; u !== l; ++u) s[u].apply(a); return this }, setTime: function(e) { for (var t = this.time = 0; t < this._actions.length; t++) this._actions[t].time = 0; return this.update(e) }, getRoot: function() { return this._root }, uncacheClip: function(e) { var t = this._actions , n = e.uuid , i = this._actionsByClip , e = i[n]; if (void 0 !== e) { for (var r = e.knownActions, a = 0, o = r.length; a !== o; ++a) { var s = r[a]; this._deactivateAction(s); var l = s._cacheIndex , u = t[t.length - 1]; s._cacheIndex = null, s._byClipCacheIndex = null, t[u._cacheIndex = l] = u, t.pop(), this._removeInactiveBindingsForAction(s) } delete i[n] } }, uncacheRoot: function(e) { var t, n = e.uuid, i = this._actionsByClip; for (t in i) { var r = i[t].actionByRoot[n]; void 0 !== r && (this._deactivateAction(r), this._removeInactiveAction(r)) } var a = this._bindingsByRootAndName[n]; if (void 0 !== a) for (var o in a) { o = a[o]; o.restoreOriginalState(), this._removeInactiveBinding(o) } }, uncacheAction: function(e, t) { t = this.existingAction(e, t); null !== t && (this._deactivateAction(t), this._removeInactiveAction(t)) } }); var rh = function() { function t(e) { O(this, t), "string" == typeof e && (console.warn("THREE.Uniform: Type parameter is no longer needed."), e = arguments[1]), this.value = e } return h(t, [{ key: "clone", value: function() { return new t(void 0 === this.value.clone ? this.value : this.value.clone()) } }]), t }(); function ah(e, t, n) { ys.call(this, e, t), this.meshPerAttribute = n || 1 } function oh(e, t, n, i, r) { this.buffer = e, this.type = t, this.itemSize = n, this.elementSize = i, this.count = r, this.version = 0 } function sh(e, t, n, i) { this.ray = new ti(e,t), this.near = n || 0, this.far = i || 1 / 0, this.camera = null, this.layers = new pi, this.params = { Mesh: {}, Line: { threshold: 1 }, LOD: {}, Points: { threshold: 1 }, Sprite: {} }, Object.defineProperties(this.params, { PointCloud: { get: function() { return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."), this.Points } } }) } function lh(e, t) { return e.distance - t.distance } function uh(e, t, n, i) { if (e.layers.test(t.layers) && e.raycast(t, n), !0 === i) for (var r = e.children, a = 0, o = r.length; a < o; a++) uh(r[a], t, n, !0) } ah.prototype = Object.assign(Object.create(ys.prototype), { constructor: ah, isInstancedInterleavedBuffer: !0, copy: function(e) { return ys.prototype.copy.call(this, e), this.meshPerAttribute = e.meshPerAttribute, this }, clone: function(e) { e = ys.prototype.clone.call(this, e); return e.meshPerAttribute = this.meshPerAttribute, e }, toJSON: function(e) { e = ys.prototype.toJSON.call(this, e); return e.isInstancedInterleavedBuffer = !0, e.meshPerAttribute = this.meshPerAttribute, e } }), Object.defineProperty(oh.prototype, "needsUpdate", { set: function(e) { !0 === e && this.version++ } }), Object.assign(oh.prototype, { isGLBufferAttribute: !0, setBuffer: function(e) { return this.buffer = e, this }, setType: function(e, t) { return this.type = e, this.elementSize = t, this }, setItemSize: function(e) { return this.itemSize = e, this }, setCount: function(e) { return this.count = e, this } }), Object.assign(sh.prototype, { set: function(e, t) { this.ray.set(e, t) }, setFromCamera: function(e, t) { t && t.isPerspectiveCamera ? (this.ray.origin.setFromMatrixPosition(t.matrixWorld), this.ray.direction.set(e.x, e.y, .5).unproject(t).sub(this.ray.origin).normalize(), this.camera = t) : t && t.isOrthographicCamera ? (this.ray.origin.set(e.x, e.y, (t.near + t.far) / (t.near - t.far)).unproject(t), this.ray.direction.set(0, 0, -1).transformDirection(t.matrixWorld), this.camera = t) : console.error("THREE.Raycaster: Unsupported camera type: " + t.type) }, intersectObject: function(e, t, n) { n = n || []; return uh(e, this, n, t), n.sort(lh), n }, intersectObjects: function(e, t, n) { var i = n || []; if (!1 === Array.isArray(e)) return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."), i; for (var r = 0, a = e.length; r < a; r++) uh(e[r], this, i, t); return i.sort(lh), i } }); var ch = function() { function i() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1 , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0 , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0; return O(this, i), this.radius = e, this.phi = t, this.theta = n, this } return h(i, [{ key: "set", value: function(e, t, n) { return this.radius = e, this.phi = t, this.theta = n, this } }, { key: "clone", value: function() { return (new this.constructor).copy(this) } }, { key: "copy", value: function(e) { return this.radius = e.radius, this.phi = e.phi, this.theta = e.theta, this } }, { key: "makeSafe", value: function() { return this.phi = Math.max(1e-6, Math.min(Math.PI - 1e-6, this.phi)), this } }, { key: "setFromVector3", value: function(e) { return this.setFromCartesianCoords(e.x, e.y, e.z) } }, { key: "setFromCartesianCoords", value: function(e, t, n) { return this.radius = Math.sqrt(e * e + t * t + n * n), 0 === this.radius ? (this.theta = 0, this.phi = 0) : (this.theta = Math.atan2(e, n), this.phi = Math.acos(gn.clamp(t / this.radius, -1, 1))), this } }]), i }() , dh = function() { function i(e, t, n) { return O(this, i), this.radius = void 0 !== e ? e : 1, this.theta = void 0 !== t ? t : 0, this.y = void 0 !== n ? n : 0, this } return h(i, [{ key: "set", value: function(e, t, n) { return this.radius = e, this.theta = t, this.y = n, this } }, { key: "clone", value: function() { return (new this.constructor).copy(this) } }, { key: "copy", value: function(e) { return this.radius = e.radius, this.theta = e.theta, this.y = e.y, this } }, { key: "setFromVector3", value: function(e) { return this.setFromCartesianCoords(e.x, e.y, e.z) } }, { key: "setFromCartesianCoords", value: function(e, t, n) { return this.radius = Math.sqrt(e * e + n * n), this.theta = Math.atan2(e, n), this.y = t, this } }]), i }() , hh = new yn , ph = function() { function n(e, t) { O(this, n), Object.defineProperty(this, "isBox2", { value: !0 }), this.min = void 0 !== e ? e : new yn(1 / 0,1 / 0), this.max = void 0 !== t ? t : new yn(-1 / 0,-1 / 0) } return h(n, [{ key: "set", value: function(e, t) { return this.min.copy(e), this.max.copy(t), this } }, { key: "setFromPoints", value: function(e) { this.makeEmpty(); for (var t = 0, n = e.length; t < n; t++) this.expandByPoint(e[t]); return this } }, { key: "setFromCenterAndSize", value: function(e, t) { t = hh.copy(t).multiplyScalar(.5); return this.min.copy(e).sub(t), this.max.copy(e).add(t), this } }, { key: "clone", value: function() { return (new this.constructor).copy(this) } }, { key: "copy", value: function(e) { return this.min.copy(e.min), this.max.copy(e.max), this } }, { key: "makeEmpty", value: function() { return this.min.x = this.min.y = 1 / 0, this.max.x = this.max.y = -1 / 0, this } }, { key: "isEmpty", value: function() { return this.max.x < this.min.x || this.max.y < this.min.y } }, { key: "getCenter", value: function(e) { return void 0 === e && (console.warn("THREE.Box2: .getCenter() target is now required"), e = new yn), this.isEmpty() ? e.set(0, 0) : e.addVectors(this.min, this.max).multiplyScalar(.5) } }, { key: "getSize", value: function(e) { return void 0 === e && (console.warn("THREE.Box2: .getSize() target is now required"), e = new yn), this.isEmpty() ? e.set(0, 0) : e.subVectors(this.max, this.min) } }, { key: "expandByPoint", value: function(e) { return this.min.min(e), this.max.max(e), this } }, { key: "expandByVector", value: function(e) { return this.min.sub(e), this.max.add(e), this } }, { key: "expandByScalar", value: function(e) { return this.min.addScalar(-e), this.max.addScalar(e), this } }, { key: "containsPoint", value: function(e) { return !(e.x < this.min.x || e.x > this.max.x || e.y < this.min.y || e.y > this.max.y) } }, { key: "containsBox", value: function(e) { return this.min.x <= e.min.x && e.max.x <= this.max.x && this.min.y <= e.min.y && e.max.y <= this.max.y } }, { key: "getParameter", value: function(e, t) { return void 0 === t && (console.warn("THREE.Box2: .getParameter() target is now required"), t = new yn), t.set((e.x - this.min.x) / (this.max.x - this.min.x), (e.y - this.min.y) / (this.max.y - this.min.y)) } }, { key: "intersectsBox", value: function(e) { return !(e.max.x < this.min.x || e.min.x > this.max.x || e.max.y < this.min.y || e.min.y > this.max.y) } }, { key: "clampPoint", value: function(e, t) { return void 0 === t && (console.warn("THREE.Box2: .clampPoint() target is now required"), t = new yn), t.copy(e).clamp(this.min, this.max) } }, { key: "distanceToPoint", value: function(e) { return hh.copy(e).clamp(this.min, this.max).sub(e).length() } }, { key: "intersect", value: function(e) { return this.min.max(e.min), this.max.min(e.max), this } }, { key: "union", value: function(e) { return this.min.min(e.min), this.max.max(e.max), this } }, { key: "translate", value: function(e) { return this.min.add(e), this.max.add(e), this } }, { key: "equals", value: function(e) { return e.min.equals(this.min) && e.max.equals(this.max) } }]), n }() , fh = new Cn , mh = new Cn , vh = function() { function n(e, t) { O(this, n), this.start = void 0 !== e ? e : new Cn, this.end = void 0 !== t ? t : new Cn } return h(n, [{ key: "set", value: function(e, t) { return this.start.copy(e), this.end.copy(t), this } }, { key: "clone", value: function() { return (new this.constructor).copy(this) } }, { key: "copy", value: function(e) { return this.start.copy(e.start), this.end.copy(e.end), this } }, { key: "getCenter", value: function(e) { return void 0 === e && (console.warn("THREE.Line3: .getCenter() target is now required"), e = new Cn), e.addVectors(this.start, this.end).multiplyScalar(.5) } }, { key: "delta", value: function(e) { return void 0 === e && (console.warn("THREE.Line3: .delta() target is now required"), e = new Cn), e.subVectors(this.end, this.start) } }, { key: "distanceSq", value: function() { return this.start.distanceToSquared(this.end) } }, { key: "distance", value: function() { return this.start.distanceTo(this.end) } }, { key: "at", value: function(e, t) { return void 0 === t && (console.warn("THREE.Line3: .at() target is now required"), t = new Cn), this.delta(t).multiplyScalar(e).add(this.start) } }, { key: "closestPointToPointParameter", value: function(e, t) { fh.subVectors(e, this.start), mh.subVectors(this.end, this.start); e = mh.dot(mh), e = mh.dot(fh) / e; return e = t ? gn.clamp(e, 0, 1) : e } }, { key: "closestPointToPoint", value: function(e, t, n) { t = this.closestPointToPointParameter(e, t); return void 0 === n && (console.warn("THREE.Line3: .closestPointToPoint() target is now required"), n = new Cn), this.delta(n).multiplyScalar(t).add(this.start) } }, { key: "applyMatrix4", value: function(e) { return this.start.applyMatrix4(e), this.end.applyMatrix4(e), this } }, { key: "equals", value: function(e) { return e.start.equals(this.start) && e.end.equals(this.end) } }]), n }(); function gh(e) { Si.call(this), this.material = e, this.render = function() {} , this.hasPositions = !1, this.hasNormals = !1, this.hasColors = !1, this.hasUvs = !1, this.positionArray = null, this.normalArray = null, this.colorArray = null, this.uvArray = null, this.count = 0 } ((gh.prototype = Object.create(Si.prototype)).constructor = gh).prototype.isImmediateRenderObject = !0; var yh = new Cn , wh = function() { y(u, Si); var l = w(u); function u(e, t) { var n; O(this, u), (n = l.call(this)).light = e, n.light.updateMatrixWorld(), n.matrix = e.matrixWorld, n.matrixAutoUpdate = !1, n.color = t; for (var e = new Mr, i = [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, -1, 1], r = 0, a = 1; r < 32; r++, a++) { var o = r / 32 * Math.PI * 2 , s = a / 32 * Math.PI * 2; i.push(Math.cos(o), Math.sin(o), 1, Math.cos(s), Math.sin(s), 1) } e.setAttribute("position", new dr(i,3)); t = new tl({ fog: !1, toneMapped: !1 }); return n.cone = new cl(e,t), n.add(n.cone), n.update(), n } return h(u, [{ key: "dispose", value: function() { this.cone.geometry.dispose(), this.cone.material.dispose() } }, { key: "update", value: function() { this.light.updateMatrixWorld(); var e = this.light.distance || 1e3 , t = e * Math.tan(this.light.angle); this.cone.scale.set(t, t, e), yh.setFromMatrixPosition(this.light.target.matrixWorld), this.cone.lookAt(yh), void 0 !== this.color ? this.cone.material.color.set(this.color) : this.cone.material.color.copy(this.light.color) } }]), u }() , bh = new Cn , xh = new ni , Eh = new ni , _h = function() { y(d, cl); var c = w(d); function d(e) { O(this, d); for (var t = function e(t) { var n = []; t && t.isBone && n.push(t); for (var i = 0; i < t.children.length; i++) n.push.apply(n, e(t.children[i])); return n }(e), n = new Mr, i = [], r = [], a = new Yi(0,0,1), o = new Yi(0,1,0), s = 0; s < t.length; s++) { var l = t[s]; l.parent && l.parent.isBone && (i.push(0, 0, 0), i.push(0, 0, 0), r.push(a.r, a.g, a.b), r.push(o.r, o.g, o.b)) } n.setAttribute("position", new dr(i,3)), n.setAttribute("color", new dr(r,3)); var u = new tl({ vertexColors: !0, depthTest: !1, depthWrite: !1, toneMapped: !1, transparent: !0 }); return (u = c.call(this, n, u)).type = "SkeletonHelper", u.isSkeletonHelper = !0, u.root = e, u.bones = t, u.matrix = e.matrixWorld, u.matrixAutoUpdate = !1, u } return h(d, [{ key: "updateMatrixWorld", value: function(e) { var t = this.bones , n = this.geometry , i = n.getAttribute("position"); Eh.copy(this.root.matrixWorld).invert(); for (var r = 0, a = 0; r < t.length; r++) { var o = t[r]; o.parent && o.parent.isBone && (xh.multiplyMatrices(Eh, o.matrixWorld), bh.setFromMatrixPosition(xh), i.setXYZ(a, bh.x, bh.y, bh.z), xh.multiplyMatrices(Eh, o.parent.matrixWorld), bh.setFromMatrixPosition(xh), i.setXYZ(a + 1, bh.x, bh.y, bh.z), a += 2) } n.getAttribute("position").needsUpdate = !0, b(v(d.prototype), "updateMatrixWorld", this).call(this, e) } }]), d }(); var Mh = function() { y(a, Hr); var r = w(a); function a(e, t, n) { O(this, a); var i = new Tu(t,4,2) , t = new $i({ wireframe: !0, fog: !1, toneMapped: !1 }); return (t = r.call(this, i, t)).light = e, t.light.updateMatrixWorld(), t.color = n, t.type = "PointLightHelper", t.matrix = t.light.matrixWorld, t.matrixAutoUpdate = !1, t.update(), t } return h(a, [{ key: "dispose", value: function() { this.geometry.dispose(), this.material.dispose() } }, { key: "update", value: function() { void 0 !== this.color ? this.material.color.set(this.color) : this.material.color.copy(this.light.color) } }]), a }() , Ah = new Cn , Th = new Yi , Sh = new Yi , Ch = function() { y(a, Si); var r = w(a); function a(e, t, n) { var i; O(this, a), (i = r.call(this)).light = e, i.light.updateMatrixWorld(), i.matrix = e.matrixWorld, i.matrixAutoUpdate = !1, i.color = n; n = new vu(t); n.rotateY(.5 * Math.PI), i.material = new $i({ wireframe: !0, fog: !1, toneMapped: !1 }), void 0 === i.color && (i.material.vertexColors = !0); t = n.getAttribute("position"), t = new Float32Array(3 * t.count); return n.setAttribute("color", new nr(t,3)), i.add(new Hr(n,i.material)), i.update(), i } return h(a, [{ key: "dispose", value: function() { this.children[0].geometry.dispose(), this.children[0].material.dispose() } }, { key: "update", value: function() { var e = this.children[0]; if (void 0 !== this.color) this.material.color.set(this.color); else { var t = e.geometry.getAttribute("color"); Th.copy(this.light.color), Sh.copy(this.light.groundColor); for (var n = 0, i = t.count; n < i; n++) { var r = n < i / 2 ? Th : Sh; t.setXYZ(n, r.r, r.g, r.b) } t.needsUpdate = !0 } e.lookAt(Ah.setFromMatrixPosition(this.light.matrixWorld).negate()) } }]), a }() , Ph = function() { y(m, cl); var f = w(m); function m() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 10 , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 10 , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 4473924 , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 8947848; O(this, m); for (var n = new Yi(n), i = new Yi(i), r = t / 2, a = e / t, o = e / 2, s = [], l = [], u = 0, c = 0, d = -o; u <= t; u++, d += a) { s.push(-o, 0, d, o, 0, d), s.push(d, 0, -o, d, 0, o); var h = u === r ? n : i; h.toArray(l, c), c += 3, h.toArray(l, c), c += 3, h.toArray(l, c), c += 3, h.toArray(l, c), c += 3 } var p = new Mr; p.setAttribute("position", new dr(s,3)), p.setAttribute("color", new dr(l,3)); var e = new tl({ vertexColors: !0, toneMapped: !1 }); return (e = f.call(this, p, e)).type = "GridHelper", e } return h(m) }() , Dh = function() { y(x, cl); var b = w(x); function x() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 10 , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 16 , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 8 , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 64 , r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 4473924 , a = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 8947848; O(this, x); for (var r = new Yi(r), a = new Yi(a), o = [], s = [], l = 0; l <= t; l++) { var u = l / t * (2 * Math.PI) , c = Math.sin(u) * e , u = Math.cos(u) * e; o.push(0, 0, 0), o.push(c, 0, u); u = 1 & l ? r : a; s.push(u.r, u.g, u.b), s.push(u.r, u.g, u.b) } for (var d = 0; d <= n; d++) for (var h = 1 & d ? r : a, p = e - e / n * d, f = 0; f < i; f++) { var m = f / i * (2 * Math.PI) , v = Math.sin(m) * p , g = Math.cos(m) * p; o.push(v, 0, g), s.push(h.r, h.g, h.b), m = (f + 1) / i * (2 * Math.PI), v = Math.sin(m) * p, g = Math.cos(m) * p, o.push(v, 0, g), s.push(h.r, h.g, h.b) } var y = new Mr; y.setAttribute("position", new dr(o,3)), y.setAttribute("color", new dr(s,3)); var w = new tl({ vertexColors: !0, toneMapped: !1 }); return (w = b.call(this, y, w)).type = "PolarGridHelper", w } return h(x) }() , kh = new Cn , Bh = new Cn , Lh = new Cn , Rh = function() { y(a, Si); var r = w(a); function a(e, t, n) { var i; O(this, a), (i = r.call(this)).light = e, i.light.updateMatrixWorld(), i.matrix = e.matrixWorld, i.matrixAutoUpdate = !1, i.color = n, void 0 === t && (t = 1); n = new Mr; n.setAttribute("position", new dr([-t, t, 0, t, t, 0, t, -t, 0, -t, -t, 0, -t, t, 0],3)); t = new tl({ fog: !1, toneMapped: !1 }); return i.lightPlane = new sl(n,t), i.add(i.lightPlane), (n = new Mr).setAttribute("position", new dr([0, 0, 0, 0, 0, 1],3)), i.targetLine = new sl(n,t), i.add(i.targetLine), i.update(), i } return h(a, [{ key: "dispose", value: function() { this.lightPlane.geometry.dispose(), this.lightPlane.material.dispose(), this.targetLine.geometry.dispose(), this.targetLine.material.dispose() } }, { key: "update", value: function() { kh.setFromMatrixPosition(this.light.matrixWorld), Bh.setFromMatrixPosition(this.light.target.matrixWorld), Lh.subVectors(Bh, kh), this.lightPlane.lookAt(Bh), void 0 !== this.color ? (this.lightPlane.material.color.set(this.color), this.targetLine.material.color.set(this.color)) : (this.lightPlane.material.color.copy(this.light.color), this.targetLine.material.color.copy(this.light.color)), this.targetLine.lookAt(Bh), this.targetLine.scale.z = Lh.length() } }]), a }() , Fh = new Cn , Ih = new Kr , Vd = function() { y(f, cl); var p = w(f); function f(e) { O(this, f); var t = new Mr , n = new tl({ color: 16777215, vertexColors: !0, toneMapped: !1 }) , i = [] , r = [] , a = {} , o = new Yi(16755200) , s = new Yi(16711680) , l = new Yi(43775) , u = new Yi(16777215) , c = new Yi(3355443); function d(e, t, n) { h(e, n), h(t, n) } function h(e, t) { i.push(0, 0, 0), r.push(t.r, t.g, t.b), void 0 === a[e] && (a[e] = []), a[e].push(i.length / 3 - 1) } return d("n1", "n2", o), d("n2", "n4", o), d("n4", "n3", o), d("n3", "n1", o), d("f1", "f2", o), d("f2", "f4", o), d("f4", "f3", o), d("f3", "f1", o), d("n1", "f1", o), d("n2", "f2", o), d("n3", "f3", o), d("n4", "f4", o), d("p", "n1", s), d("p", "n2", s), d("p", "n3", s), d("p", "n4", s), d("u1", "u2", l), d("u2", "u3", l), d("u3", "u1", l), d("c", "t", u), d("p", "c", c), d("cn1", "cn2", c), d("cn3", "cn4", c), d("cf1", "cf2", c), d("cf3", "cf4", c), t.setAttribute("position", new dr(i,3)), t.setAttribute("color", new dr(r,3)), (n = p.call(this, t, n)).type = "CameraHelper", n.camera = e, n.camera.updateProjectionMatrix && n.camera.updateProjectionMatrix(), n.matrix = e.matrixWorld, n.matrixAutoUpdate = !1, n.pointMap = a, n.update(), n } return h(f, [{ key: "update", value: function() { var e = this.geometry , t = this.pointMap; Ih.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse), Oh("c", t, e, Ih, 0, 0, -1), Oh("t", t, e, Ih, 0, 0, 1), Oh("n1", t, e, Ih, -1, -1, -1), Oh("n2", t, e, Ih, 1, -1, -1), Oh("n3", t, e, Ih, -1, 1, -1), Oh("n4", t, e, Ih, 1, 1, -1), Oh("f1", t, e, Ih, -1, -1, 1), Oh("f2", t, e, Ih, 1, -1, 1), Oh("f3", t, e, Ih, -1, 1, 1), Oh("f4", t, e, Ih, 1, 1, 1), Oh("u1", t, e, Ih, .7, 1.1, -1), Oh("u2", t, e, Ih, -.7, 1.1, -1), Oh("u3", t, e, Ih, 0, 2, -1), Oh("cf1", t, e, Ih, -1, 0, 1), Oh("cf2", t, e, Ih, 1, 0, 1), Oh("cf3", t, e, Ih, 0, -1, 1), Oh("cf4", t, e, Ih, 0, 1, 1), Oh("cn1", t, e, Ih, -1, 0, -1), Oh("cn2", t, e, Ih, 1, 0, -1), Oh("cn3", t, e, Ih, 0, -1, -1), Oh("cn4", t, e, Ih, 0, 1, -1), e.getAttribute("position").needsUpdate = !0 } }]), f }(); function Oh(e, t, n, i, r, a, o) { Fh.set(r, a, o).unproject(i); var s = t[e]; if (void 0 !== s) for (var l = n.getAttribute("position"), u = 0, c = s.length; u < c; u++) l.setXYZ(s[u], Fh.x, Fh.y, Fh.z) } var zh, Nh, Uh = new kn, Gh = function() { y(o, cl); var a = w(o); function o(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 16776960; O(this, o); var n = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]) , i = new Float32Array(24) , r = new Mr; return r.setIndex(new nr(n,1)), r.setAttribute("position", new nr(i,3)), (t = a.call(this, r, new tl({ color: t, toneMapped: !1 }))).object = e, t.type = "BoxHelper", t.matrixAutoUpdate = !1, t.update(), t } return h(o, [{ key: "update", value: function(e) { var t, n, i; void 0 !== e && console.warn("THREE.BoxHelper: .update() has no longer arguments."), void 0 !== this.object && Uh.setFromObject(this.object), Uh.isEmpty() || (t = Uh.min, n = Uh.max, (e = (i = this.geometry.attributes.position).array)[0] = n.x, e[1] = n.y, e[2] = n.z, e[3] = t.x, e[4] = n.y, e[5] = n.z, e[6] = t.x, e[7] = t.y, e[8] = n.z, e[9] = n.x, e[10] = t.y, e[11] = n.z, e[12] = n.x, e[13] = n.y, e[14] = t.z, e[15] = t.x, e[16] = n.y, e[17] = t.z, e[18] = t.x, e[19] = t.y, e[20] = t.z, e[21] = n.x, e[22] = t.y, e[23] = t.z, i.needsUpdate = !0, this.geometry.computeBoundingSphere()) } }, { key: "setFromObject", value: function(e) { return this.object = e, this.update(), this } }, { key: "copy", value: function(e) { return cl.prototype.copy.call(this, e), this.object = e.object, this } }]), o }(), Xd = function() { y(a, cl); var r = w(a); function a(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 16776960; O(this, a); var n = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]) , i = new Mr; return i.setIndex(new nr(n,1)), i.setAttribute("position", new dr([1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1],3)), (t = r.call(this, i, new tl({ color: t, toneMapped: !1 }))).box = e, t.type = "Box3Helper", t.geometry.computeBoundingSphere(), t } return h(a, [{ key: "updateMatrixWorld", value: function(e) { var t = this.box; t.isEmpty() || (t.getCenter(this.position), t.getSize(this.scale), this.scale.multiplyScalar(.5), b(v(a.prototype), "updateMatrixWorld", this).call(this, e)) } }]), a }(), Hh = function() { y(a, sl); var r = w(a); function a(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1 , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 16776960; O(this, a); var i = n , n = new Mr; n.setAttribute("position", new dr([1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0],3)), n.computeBoundingSphere(), (n = r.call(this, n, new tl({ color: i, toneMapped: !1 }))).type = "PlaneHelper", n.plane = e, n.size = t; t = new Mr; return t.setAttribute("position", new dr([1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1],3)), t.computeBoundingSphere(), n.add(new Hr(t,new $i({ color: i, opacity: .2, transparent: !0, depthWrite: !1, toneMapped: !1 }))), n } return h(a, [{ key: "updateMatrixWorld", value: function(e) { var t = -this.plane.constant; Math.abs(t) < 1e-8 && (t = 1e-8), this.scale.set(.5 * this.size, .5 * this.size, t), this.children[0].material.side = t < 0 ? J : q, this.lookAt(this.plane.normal), b(v(a.prototype), "updateMatrixWorld", this).call(this, e) } }]), a }(), Vh = new Cn, Wd = function() { y(l, Si); var s = w(l); function l(e, t, n, i, r, a) { var o; return O(this, l), (o = s.call(this)).type = "ArrowHelper", void 0 === e && (e = new Cn(0,0,1)), void 0 === t && (t = new Cn(0,0,0)), void 0 === n && (n = 1), void 0 === i && (i = 16776960), void 0 === r && (r = .2 * n), void 0 === a && (a = .2 * r), void 0 === zh && ((zh = new Mr).setAttribute("position", new dr([0, 0, 0, 0, 1, 0],3)), (Nh = new kl(0,.5,1,5,1)).translate(0, -.5, 0)), o.position.copy(t), o.line = new sl(zh,new tl({ color: i, toneMapped: !1 })), o.line.matrixAutoUpdate = !1, o.add(o.line), o.cone = new Hr(Nh,new $i({ color: i, toneMapped: !1 })), o.cone.matrixAutoUpdate = !1, o.add(o.cone), o.setDirection(e), o.setLength(n, r, a), o } return h(l, [{ key: "setDirection", value: function(e) { .99999 < e.y ? this.quaternion.set(0, 0, 0, 1) : e.y < -.99999 ? this.quaternion.set(1, 0, 0, 0) : (Vh.set(e.z, 0, -e.x).normalize(), e = Math.acos(e.y), this.quaternion.setFromAxisAngle(Vh, e)) } }, { key: "setLength", value: function(e, t, n) { void 0 === t && (t = .2 * e), void 0 === n && (n = .2 * t), this.line.scale.set(1, Math.max(1e-4, e - t), 1), this.line.updateMatrix(), this.cone.scale.set(n, t, n), this.cone.position.y = e, this.cone.updateMatrix() } }, { key: "setColor", value: function(e) { this.line.material.color.set(e), this.cone.material.color.set(e) } }, { key: "copy", value: function(e) { return b(v(l.prototype), "copy", this).call(this, e, !1), this.line.copy(e.line), this.cone.copy(e.cone), this } }]), l }(), jh = function() { y(i, cl); var n = w(i); function i() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1; O(this, i); var t = [0, 0, 0, e, 0, 0, 0, 0, 0, 0, e, 0, 0, 0, 0, 0, 0, e] , e = new Mr; e.setAttribute("position", new dr(t,3)), e.setAttribute("color", new dr([1, 0, 0, 1, .6, 0, 0, 1, 0, .6, 1, 0, 0, 0, 1, 0, .6, 1],3)); var t = new tl({ vertexColors: !0, toneMapped: !1 }); return (t = n.call(this, e, t)).type = "AxesHelper", t } return h(i) }(), Wh = new Float32Array(1), Xh = new Int32Array(Wh.buffer), qd = { toHalfFloat: function(e) { Wh[0] = e; var t = Xh[0] , n = t >> 16 & 32768 , i = t >> 12 & 2047 , e = t >> 23 & 255; return e < 103 ? n : 142 < e ? (n |= 31744, n |= (255 == e ? 0 : 1) && 8388607 & t) : e < 113 ? n |= ((i |= 2048) >> 114 - e) + (i >> 113 - e & 1) : (n |= e - 112 << 10 | i >> 1, n += 1 & i) } }, qh = Math.pow(2, 8), Jh = [.125, .215, .35, .446, .526, .582], Yh = 5 + Jh.length, Zh = (H(Jd = {}, rn, 0), H(Jd, an, 1), H(Jd, 3002, 2), H(Jd, 3004, 3), H(Jd, 3005, 4), H(Jd, 3006, 5), H(Jd, 3007, 6), Jd), Qh = new ed, Yd = rp(), Kh = Yd._lodPlanes, $h = Yd._sizeLods, ep = Yd._sigmas, tp = new Yi, np = null, Zd = (1 + Math.sqrt(5)) / 2, Jd = 1 / Zd, ip = [new Cn(1,1,1), new Cn(-1,1,1), new Cn(1,1,-1), new Cn(-1,1,-1), new Cn(0,Zd,Jd), new Cn(0,Zd,-Jd), new Cn(Jd,0,Zd), new Cn(-Jd,0,Zd), new Cn(Zd,Jd,0), new Cn(-Zd,Jd,0)], Yd = function() { function i(e) { var t, n; O(this, i), this._renderer = e, this._pingPongRenderTarget = null, this._blurMaterial = (t = 20, n = new Float32Array(t), e = new Cn(0,1,0), new Gu({ name: "SphericalGaussianBlur", defines: { n: t }, uniforms: { envMap: { value: null }, samples: { value: 1 }, weights: { value: n }, latitudinal: { value: !1 }, dTheta: { value: 0 }, mipInt: { value: 0 }, poleAxis: { value: e }, inputEncoding: { value: Zh[rn] }, outputEncoding: { value: Zh[rn] } }, vertexShader: up(), fragmentShader: "\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t".concat(cp(), "\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"), blending: Z, depthTest: !1, depthWrite: !1 })), this._equirectShader = null, this._cubemapShader = null, this._compileMaterial(this._blurMaterial) } return h(i, [{ key: "fromScene", value: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0 , n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : .1 , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 100; np = this._renderer.getRenderTarget(); var r = this._allocateTargets(); return this._sceneToCubeUV(e, n, i, r), 0 < t && this._blur(r, 0, 0, t), this._applyPMREM(r), this._cleanup(r), r } }, { key: "fromEquirectangular", value: function(e) { return this._fromTexture(e) } }, { key: "fromCubemap", value: function(e) { return this._fromTexture(e) } }, { key: "compileCubemapShader", value: function() { null === this._cubemapShader && (this._cubemapShader = lp(), this._compileMaterial(this._cubemapShader)) } }, { key: "compileEquirectangularShader", value: function() { null === this._equirectShader && (this._equirectShader = sp(), this._compileMaterial(this._equirectShader)) } }, { key: "dispose", value: function() { this._blurMaterial.dispose(), null !== this._cubemapShader && this._cubemapShader.dispose(), null !== this._equirectShader && this._equirectShader.dispose(); for (var e = 0; e < Kh.length; e++) Kh[e].dispose() } }, { key: "_cleanup", value: function(e) { this._pingPongRenderTarget.dispose(), this._renderer.setRenderTarget(np), e.scissorTest = !1, op(e, 0, 0, e.width, e.height) } }, { key: "_fromTexture", value: function(e) { np = this._renderer.getRenderTarget(); var t = this._allocateTargets(e); return this._textureToCubeUV(e, t), this._applyPMREM(t), this._cleanup(t), t } }, { key: "_allocateTargets", value: function(e) { var t = { magFilter: Re, minFilter: Re, generateMipmaps: !1, type: Ue, format: it, encoding: void 0 === (n = e) || n.type !== Ue || n.encoding !== rn && n.encoding !== an && 3007 !== n.encoding ? 3002 : e.encoding, depthBuffer: !1 } , n = ap(t); return n.depthBuffer = !e, this._pingPongRenderTarget = ap(t), n } }, { key: "_compileMaterial", value: function(e) { e = new Hr(Kh[0],e); this._renderer.compile(e, Qh) } }, { key: "_sceneToCubeUV", value: function(e, t, n, i) { var r = new $r(90,1,t,n) , a = [1, -1, 1, 1, 1, 1] , o = [1, 1, 1, -1, -1, -1] , s = this._renderer , l = s.outputEncoding , u = s.toneMapping; s.getClearColor(tp); var c = s.getClearAlpha(); s.toneMapping = De, s.outputEncoding = rn; var t = e.background; t && t.isColor && (t.convertSRGBToLinear(), n = Math.max(t.r, t.g, t.b), n = Math.min(Math.max(Math.ceil(Math.log2(n)), -128), 127), t = t.multiplyScalar(Math.pow(2, -n)), s.setClearColor(t, (n + 128) / 255), e.background = null); for (var d = 0; d < 6; d++) { var h = d % 3; 0 == h ? (r.up.set(0, a[d], 0), r.lookAt(o[d], 0, 0)) : 1 == h ? (r.up.set(0, 0, a[d]), r.lookAt(0, o[d], 0)) : (r.up.set(0, a[d], 0), r.lookAt(0, 0, o[d])), op(i, h * qh, 2 < d ? qh : 0, qh, qh), s.setRenderTarget(i), s.render(e, r) } s.toneMapping = u, s.outputEncoding = l, s.setClearColor(tp, c) } }, { key: "_textureToCubeUV", value: function(e, t) { var n = this._renderer; e.isCubeTexture ? null == this._cubemapShader && (this._cubemapShader = lp()) : null == this._equirectShader && (this._equirectShader = sp()); var i = e.isCubeTexture ? this._cubemapShader : this._equirectShader , r = new Hr(Kh[0],i) , i = i.uniforms; (i.envMap.value = e).isCubeTexture || i.texelSize.value.set(1 / e.image.width, 1 / e.image.height), i.inputEncoding.value = Zh[e.encoding], i.outputEncoding.value = Zh[t.texture.encoding], op(t, 0, 0, 3 * qh, 2 * qh), n.setRenderTarget(t), n.render(r, Qh) } }, { key: "_applyPMREM", value: function(e) { var t = this._renderer , n = t.autoClear; t.autoClear = !1; for (var i = 1; i < Yh; i++) { var r = Math.sqrt(ep[i] * ep[i] - ep[i - 1] * ep[i - 1]); this._blur(e, i - 1, i, r, ip[(i - 1) % ip.length]) } t.autoClear = n } }, { key: "_blur", value: function(e, t, n, i, r) { var a = this._pingPongRenderTarget; this._halfBlur(e, a, t, n, i, "latitudinal", r), this._halfBlur(a, e, n, n, i, "longitudinal", r) } }, { key: "_halfBlur", value: function(e, t, n, i, r, a, o) { var s = this._renderer , l = this._blurMaterial; "latitudinal" !== a && "longitudinal" !== a && console.error("blur direction must be either latitudinal or longitudinal!"); var u = new Hr(Kh[i],l) , c = l.uniforms , l = $h[n] - 1 , l = isFinite(r) ? Math.PI / (2 * l) : 2 * Math.PI / 39 , d = r / l , h = isFinite(r) ? 1 + Math.floor(3 * d) : 20; 20 < h && console.warn("sigmaRadians, ".concat(r, ", is too large and will clip, as it requested ").concat(h, " samples when the maximum is set to ").concat(20)); for (var p = [], f = 0, m = 0; m < 20; ++m) { var v = m / d , v = Math.exp(-v * v / 2); p.push(v), 0 == m ? f += v : m < h && (f += 2 * v) } for (var g = 0; g < p.length; g++) p[g] = p[g] / f; c.envMap.value = e.texture, c.samples.value = h, c.weights.value = p, c.latitudinal.value = "latitudinal" === a, o && (c.poleAxis.value = o), c.dTheta.value = l, c.mipInt.value = 8 - n, c.inputEncoding.value = Zh[e.texture.encoding], c.outputEncoding.value = Zh[e.texture.encoding]; e = $h[i]; op(t, 3 * Math.max(0, qh - 2 * e), (0 === i ? 0 : 2 * qh) + 2 * e * (4 < i ? i - 8 + 4 : 0), 3 * e, 2 * e), s.setRenderTarget(t), s.render(u, Qh) } }]), i }(); function rp() { for (var e = [], t = [], n = [], i = 8, r = 0; r < Yh; r++) { var a = Math.pow(2, i); t.push(a); var o = 1 / a; 4 < r ? o = Jh[r - 8 + 4 - 1] : 0 == r && (o = 0), n.push(o); for (var o = 1 / (a - 1), a = -o / 2, o = 1 + o / 2, s = [a, a, o, a, o, o, a, a, o, o, a, o], l = new Float32Array(108), u = new Float32Array(72), c = new Float32Array(36), d = 0; d < 6; d++) { var h = d % 3 * 2 / 3 - 1 , p = 2 < d ? 0 : -1; l.set([h, p, 0, h + 2 / 3, p, 0, h + 2 / 3, 1 + p, 0, h, p, 0, h + 2 / 3, 1 + p, 0, h, 1 + p, 0], 18 * d), u.set(s, 12 * d), c.set([d, d, d, d, d, d], 6 * d) } o = new Mr; o.setAttribute("position", new nr(l,3)), o.setAttribute("uv", new nr(u,2)), o.setAttribute("faceIndex", new nr(c,1)), e.push(o), 4 < i && i-- } return { _lodPlanes: e, _sizeLods: t, _sigmas: n } } function ap(e) { e = new An(3 * qh,3 * qh,e); return e.texture.mapping = z, e.texture.name = "PMREM.cubeUv", e.scissorTest = !0, e } function op(e, t, n, i, r) { e.viewport.set(t, n, i, r), e.scissor.set(t, n, i, r) } function sp() { return new Gu({ name: "EquirectangularToCubeUV", uniforms: { envMap: { value: null }, texelSize: { value: new yn(1,1) }, inputEncoding: { value: Zh[rn] }, outputEncoding: { value: Zh[rn] } }, vertexShader: up(), fragmentShader: "\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t".concat(cp(), "\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"), blending: Z, depthTest: !1, depthWrite: !1 }) } function lp() { return new Gu({ name: "CubemapToCubeUV", uniforms: { envMap: { value: null }, inputEncoding: { value: Zh[rn] }, outputEncoding: { value: Zh[rn] } }, vertexShader: up(), fragmentShader: "\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t".concat(cp(), "\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"), blending: Z, depthTest: !1, depthWrite: !1 }) } function up() { return "\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t" } function cp() { return "\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t" } function dp(e, t) { return console.warn("THREE.PointCloud has been renamed to THREE.Points."), new gl(e,t) } function hp(e) { console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."), Bc.call(this, e), this.type = "catmullrom", this.closed = !0 } function pp(e) { console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."), Bc.call(this, e), this.type = "catmullrom" } function fp(e) { console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."), Bc.call(this, e), this.type = "catmullrom" } Mc.create = function(e, t) { return console.log("THREE.Curve.create() has been deprecated"), e.prototype = Object.create(Mc.prototype), (e.prototype.constructor = e).prototype.getPoint = t, e } , Object.assign(jc.prototype, { createPointsGeometry: function(e) { console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."); e = this.getPoints(e); return this.createGeometry(e) }, createSpacedPointsGeometry: function(e) { console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."); e = this.getSpacedPoints(e); return this.createGeometry(e) }, createGeometry: function(e) { console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."); for (var t = new Sl, n = 0, i = e.length; n < i; n++) { var r = e[n]; t.vertices.push(new Cn(r.x,r.y,r.z || 0)) } return t } }), Object.assign(Wc.prototype, { fromPoints: function(e) { return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."), this.setFromPoints(e) } }), hp.prototype = Object.create(Bc.prototype), pp.prototype = Object.create(Bc.prototype), fp.prototype = Object.create(Bc.prototype), Object.assign(fp.prototype, { initFromArray: function() { console.error("THREE.Spline: .initFromArray() has been removed.") }, getControlPointsArray: function() { console.error("THREE.Spline: .getControlPointsArray() has been removed.") }, reparametrizeByArcLength: function() { console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.") } }), Ph.prototype.setColors = function() { console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.") } , _h.prototype.update = function() { console.error("THREE.SkeletonHelper: update() no longer needs to be called.") } , Object.assign(mc.prototype, { extractUrlBase: function(e) { return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."), ld.extractUrlBase(e) } }), mc.Handlers = { add: function() { console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.") }, get: function() { console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.") } }, Object.assign(ph.prototype, { center: function(e) { return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."), this.getCenter(e) }, empty: function() { return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."), this.isEmpty() }, isIntersectionBox: function(e) { return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(e) }, size: function(e) { return console.warn("THREE.Box2: .size() has been renamed to .getSize()."), this.getSize(e) } }), Object.assign(kn.prototype, { center: function(e) { return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."), this.getCenter(e) }, empty: function() { return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."), this.isEmpty() }, isIntersectionBox: function(e) { return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(e) }, isIntersectionSphere: function(e) { return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."), this.intersectsSphere(e) }, size: function(e) { return console.warn("THREE.Box3: .size() has been renamed to .getSize()."), this.getSize(e) } }), Object.assign(qn.prototype, { empty: function() { return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."), this.isEmpty() } }), oa.prototype.setFromMatrix = function(e) { return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."), this.setFromProjectionMatrix(e) } , vh.prototype.center = function(e) { return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."), this.getCenter(e) } , Object.assign(gn, { random16: function() { return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."), Math.random() }, nearestPowerOfTwo: function(e) { return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."), gn.floorPowerOfTwo(e) }, nextPowerOfTwo: function(e) { return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."), gn.ceilPowerOfTwo(e) } }), Object.assign(wn.prototype, { flattenToArrayOffset: function(e, t) { return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."), this.toArray(e, t) }, multiplyVector3: function(e) { return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."), e.applyMatrix3(this) }, multiplyVector3Array: function() { console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.") }, applyToBufferAttribute: function(e) { return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."), e.applyMatrix3(this) }, applyToVector3Array: function() { console.error("THREE.Matrix3: .applyToVector3Array() has been removed.") }, getInverse: function(e) { return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."), this.copy(e).invert() } }), Object.assign(ni.prototype, { extractPosition: function(e) { return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."), this.copyPosition(e) }, flattenToArrayOffset: function(e, t) { return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."), this.toArray(e, t) }, getPosition: function() { return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."), (new Cn).setFromMatrixColumn(this, 3) }, setRotationFromQuaternion: function(e) { return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."), this.makeRotationFromQuaternion(e) }, multiplyToArray: function() { console.warn("THREE.Matrix4: .multiplyToArray() has been removed.") }, multiplyVector3: function(e) { return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."), e.applyMatrix4(this) }, multiplyVector4: function(e) { return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."), e.applyMatrix4(this) }, multiplyVector3Array: function() { console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.") }, rotateAxis: function(e) { console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."), e.transformDirection(this) }, crossVector: function(e) { return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."), e.applyMatrix4(this) }, translate: function() { console.error("THREE.Matrix4: .translate() has been removed.") }, rotateX: function() { console.error("THREE.Matrix4: .rotateX() has been removed.") }, rotateY: function() { console.error("THREE.Matrix4: .rotateY() has been removed.") }, rotateZ: function() { console.error("THREE.Matrix4: .rotateZ() has been removed.") }, rotateByAxis: function() { console.error("THREE.Matrix4: .rotateByAxis() has been removed.") }, applyToBufferAttribute: function(e) { return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."), e.applyMatrix4(this) }, applyToVector3Array: function() { console.error("THREE.Matrix4: .applyToVector3Array() has been removed.") }, makeFrustum: function(e, t, n, i, r, a) { return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."), this.makePerspective(e, t, i, n, r, a) }, getInverse: function(e) { return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."), this.copy(e).invert() } }), ki.prototype.isIntersectionLine = function(e) { return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."), this.intersectsLine(e) } , Object.assign(Sn.prototype, { multiplyVector3: function(e) { return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."), e.applyQuaternion(this) }, inverse: function() { return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."), this.invert() } }), Object.assign(ti.prototype, { isIntersectionBox: function(e) { return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(e) }, isIntersectionPlane: function(e) { return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."), this.intersectsPlane(e) }, isIntersectionSphere: function(e) { return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."), this.intersectsSphere(e) } }), Object.assign(Hi.prototype, { area: function() { return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."), this.getArea() }, barycoordFromPoint: function(e, t) { return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."), this.getBarycoord(e, t) }, midpoint: function(e) { return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."), this.getMidpoint(e) }, normal: function(e) { return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."), this.getNormal(e) }, plane: function(e) { return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."), this.getPlane(e) } }), Object.assign(Hi, { barycoordFromPoint: function(e, t, n, i, r) { return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."), Hi.getBarycoord(e, t, n, i, r) }, normal: function(e, t, n, i) { return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."), Hi.getNormal(e, t, n, i) } }), Object.assign(Xc.prototype, { extractAllPoints: function(e) { return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."), this.extractPoints(e) }, extrude: function(e) { return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."), new du(this,e) }, makeGeometry: function(e) { return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."), new Au(this,e) } }), Object.assign(yn.prototype, { fromAttribute: function(e, t, n) { return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(e, t, n) }, distanceToManhattan: function(e) { return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."), this.manhattanDistanceTo(e) }, lengthManhattan: function() { return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength() } }), Object.assign(Cn.prototype, { setEulerFromRotationMatrix: function() { console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.") }, setEulerFromQuaternion: function() { console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.") }, getPositionFromMatrix: function(e) { return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."), this.setFromMatrixPosition(e) }, getScaleFromMatrix: function(e) { return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."), this.setFromMatrixScale(e) }, getColumnFromMatrix: function(e, t) { return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."), this.setFromMatrixColumn(t, e) }, applyProjection: function(e) { return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."), this.applyMatrix4(e) }, fromAttribute: function(e, t, n) { return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(e, t, n) }, distanceToManhattan: function(e) { return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."), this.manhattanDistanceTo(e) }, lengthManhattan: function() { return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength() } }), Object.assign(Mn.prototype, { fromAttribute: function(e, t, n) { return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(e, t, n) }, lengthManhattan: function() { return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength() } }), Object.assign(Sl.prototype, { computeTangents: function() { console.error("THREE.Geometry: .computeTangents() has been removed.") }, computeLineDistances: function() { console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.") }, applyMatrix: function(e) { return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(e) } }), Object.assign(Si.prototype, { getChildByName: function(e) { return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."), this.getObjectByName(e) }, renderDepth: function() { console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.") }, translate: function(e, t) { return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."), this.translateOnAxis(t, e) }, getWorldRotation: function() { console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.") }, applyMatrix: function(e) { return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(e) } }), Object.defineProperties(Si.prototype, { eulerOrder: { get: function() { return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."), this.rotation.order }, set: function(e) { console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."), this.rotation.order = e } }, useQuaternion: { get: function() { console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.") }, set: function() { console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.") } } }), Object.assign(Hr.prototype, { setDrawMode: function() { console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.") } }), Object.defineProperties(Hr.prototype, { drawMode: { get: function() { return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."), 0 }, set: function() { console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.") } } }), Object.defineProperties(Ns.prototype, { objects: { get: function() { return console.warn("THREE.LOD: .objects has been renamed to .levels."), this.levels } } }), Object.defineProperty(Ys.prototype, "useVertexTexture", { get: function() { console.warn("THREE.Skeleton: useVertexTexture has been removed.") }, set: function() { console.warn("THREE.Skeleton: useVertexTexture has been removed.") } }), Ws.prototype.initBones = function() { console.error("THREE.SkinnedMesh: initBones() has been removed.") } , Object.defineProperty(Mc.prototype, "__arcLengthDivisions", { get: function() { return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."), this.arcLengthDivisions }, set: function(e) { console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."), this.arcLengthDivisions = e } }), $r.prototype.setLens = function(e, t) { console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."), void 0 !== t && (this.filmGauge = t), this.setFocalLength(e) } , Object.defineProperties(qc.prototype, { onlyShadow: { set: function() { console.warn("THREE.Light: .onlyShadow has been removed.") } }, shadowCameraFov: { set: function(e) { console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."), this.shadow.camera.fov = e } }, shadowCameraLeft: { set: function(e) { console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."), this.shadow.camera.left = e } }, shadowCameraRight: { set: function(e) { console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."), this.shadow.camera.right = e } }, shadowCameraTop: { set: function(e) { console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."), this.shadow.camera.top = e } }, shadowCameraBottom: { set: function(e) { console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."), this.shadow.camera.bottom = e } }, shadowCameraNear: { set: function(e) { console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."), this.shadow.camera.near = e } }, shadowCameraFar: { set: function(e) { console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."), this.shadow.camera.far = e } }, shadowCameraVisible: { set: function() { console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.") } }, shadowBias: { set: function(e) { console.warn("THREE.Light: .shadowBias is now .shadow.bias."), this.shadow.bias = e } }, shadowDarkness: { set: function() { console.warn("THREE.Light: .shadowDarkness has been removed.") } }, shadowMapWidth: { set: function(e) { console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."), this.shadow.mapSize.width = e } }, shadowMapHeight: { set: function(e) { console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."), this.shadow.mapSize.height = e } } }), Object.defineProperties(nr.prototype, { length: { get: function() { return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."), this.array.length } }, dynamic: { get: function() { return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."), this.usage === cn }, set: function() { console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."), this.setUsage(cn) } } }), Object.assign(nr.prototype, { setDynamic: function(e) { return this.setUsage(!0 === e ? cn : un), this }, copyIndicesArray: function() { console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.") }, setArray: function() { console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers") } }), Object.assign(Mr.prototype, { addIndex: function(e) { console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."), this.setIndex(e) }, addAttribute: function(e, t) { return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."), t && t.isBufferAttribute || t && t.isInterleavedBufferAttribute ? "index" === e ? (console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."), this.setIndex(t), this) : this.setAttribute(e, t) : (console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."), this.setAttribute(e, new nr(t,arguments[2]))) }, addDrawCall: function(e, t, n) { void 0 !== n && console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."), console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."), this.addGroup(e, t) }, clearDrawCalls: function() { console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."), this.clearGroups() }, computeTangents: function() { console.warn("THREE.BufferGeometry: .computeTangents() has been removed.") }, computeOffsets: function() { console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.") }, removeAttribute: function(e) { return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."), this.deleteAttribute(e) }, applyMatrix: function(e) { return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(e) } }), Object.defineProperties(Mr.prototype, { drawcalls: { get: function() { return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."), this.groups } }, offsets: { get: function() { return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."), this.groups } } }), Object.defineProperties(ud.prototype, { maxInstancedCount: { get: function() { return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."), this.instanceCount }, set: function(e) { console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."), this.instanceCount = e } } }), Object.defineProperties(sh.prototype, { linePrecision: { get: function() { return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."), this.params.Line.threshold }, set: function(e) { console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."), this.params.Line.threshold = e } } }), Object.defineProperties(ys.prototype, { dynamic: { get: function() { return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."), this.usage === cn }, set: function(e) { console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."), this.setUsage(e) } } }), Object.assign(ys.prototype, { setDynamic: function(e) { return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."), this.setUsage(!0 === e ? cn : un), this }, setArray: function() { console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers") } }), Object.assign(uu.prototype, { getArrays: function() { console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.") }, addShapeList: function() { console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.") }, addShape: function() { console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.") } }), Object.assign(gs.prototype, { dispose: function() { console.error("THREE.Scene: .dispose() has been removed.") } }), Object.defineProperties(rh.prototype, { dynamic: { set: function() { console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.") } }, onUpdate: { value: function() { return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."), this } } }), Object.defineProperties(Ki.prototype, { wrapAround: { get: function() { console.warn("THREE.Material: .wrapAround has been removed.") }, set: function() { console.warn("THREE.Material: .wrapAround has been removed.") } }, overdraw: { get: function() { console.warn("THREE.Material: .overdraw has been removed.") }, set: function() { console.warn("THREE.Material: .overdraw has been removed.") } }, wrapRGB: { get: function() { return console.warn("THREE.Material: .wrapRGB has been removed."), new Yi } }, shading: { get: function() { console.error("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead.") }, set: function(e) { console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."), this.flatShading = 1 === e } }, stencilMask: { get: function() { return console.warn("THREE." + this.type + ": .stencilMask has been removed. Use .stencilFuncMask instead."), this.stencilFuncMask }, set: function(e) { console.warn("THREE." + this.type + ": .stencilMask has been removed. Use .stencilFuncMask instead."), this.stencilFuncMask = e } } }), Object.defineProperties(ju.prototype, { metal: { get: function() { return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."), !1 }, set: function() { console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead") } } }), Object.defineProperties(Vu.prototype, { transparency: { get: function() { return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."), this.transmission }, set: function(e) { console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."), this.transmission = e } } }), Object.defineProperties(Qr.prototype, { derivatives: { get: function() { return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."), this.extensions.derivatives }, set: function(e) { console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."), this.extensions.derivatives = e } } }), Object.assign(ps.prototype, { clearTarget: function(e, t, n, i) { console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."), this.setRenderTarget(e), this.clear(t, n, i) }, animate: function(e) { console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."), this.setAnimationLoop(e) }, getCurrentRenderTarget: function() { return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."), this.getRenderTarget() }, getMaxAnisotropy: function() { return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."), this.capabilities.getMaxAnisotropy() }, getPrecision: function() { return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."), this.capabilities.precision }, resetGLState: function() { return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."), this.state.reset() }, supportsFloatTextures: function() { return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."), this.extensions.get("OES_texture_float") }, supportsHalfFloatTextures: function() { return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."), this.extensions.get("OES_texture_half_float") }, supportsStandardDerivatives: function() { return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."), this.extensions.get("OES_standard_derivatives") }, supportsCompressedTextureS3TC: function() { return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."), this.extensions.get("WEBGL_compressed_texture_s3tc") }, supportsCompressedTexturePVRTC: function() { return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."), this.extensions.get("WEBGL_compressed_texture_pvrtc") }, supportsBlendMinMax: function() { return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."), this.extensions.get("EXT_blend_minmax") }, supportsVertexTextures: function() { return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."), this.capabilities.vertexTextures }, supportsInstancedArrays: function() { return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."), this.extensions.get("ANGLE_instanced_arrays") }, enableScissorTest: function(e) { console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."), this.setScissorTest(e) }, initMaterial: function() { console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.") }, addPrePlugin: function() { console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.") }, addPostPlugin: function() { console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.") }, updateShadowMap: function() { console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.") }, setFaceCulling: function() { console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.") }, allocTextureUnit: function() { console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.") }, setTexture: function() { console.warn("THREE.WebGLRenderer: .setTexture() has been removed.") }, setTexture2D: function() { console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.") }, setTextureCube: function() { console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.") }, getActiveMipMapLevel: function() { return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."), this.getActiveMipmapLevel() } }), Object.defineProperties(ps.prototype, { shadowMapEnabled: { get: function() { return this.shadowMap.enabled }, set: function(e) { console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."), this.shadowMap.enabled = e } }, shadowMapType: { get: function() { return this.shadowMap.type }, set: function(e) { console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."), this.shadowMap.type = e } }, shadowMapCullFace: { get: function() { console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.") }, set: function() { console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.") } }, context: { get: function() { return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."), this.getContext() } }, vr: { get: function() { return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"), this.xr } }, gammaInput: { get: function() { return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."), !1 }, set: function() { console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.") } }, gammaOutput: { get: function() { return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."), !1 }, set: function(e) { console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."), this.outputEncoding = !0 === e ? an : rn } }, toneMappingWhitePoint: { get: function() { return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."), 1 }, set: function() { console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.") } } }), Object.defineProperties(rs.prototype, { cullFace: { get: function() { console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.") }, set: function() { console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.") } }, renderReverseSided: { get: function() { console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.") }, set: function() { console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.") } }, renderSingleSided: { get: function() { console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.") }, set: function() { console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.") } } }), Object.defineProperties(An.prototype, { wrapS: { get: function() { return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."), this.texture.wrapS }, set: function(e) { console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."), this.texture.wrapS = e } }, wrapT: { get: function() { return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."), this.texture.wrapT }, set: function(e) { console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."), this.texture.wrapT = e } }, magFilter: { get: function() { return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."), this.texture.magFilter }, set: function(e) { console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."), this.texture.magFilter = e } }, minFilter: { get: function() { return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."), this.texture.minFilter }, set: function(e) { console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."), this.texture.minFilter = e } }, anisotropy: { get: function() { return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."), this.texture.anisotropy }, set: function(e) { console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."), this.texture.anisotropy = e } }, offset: { get: function() { return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."), this.texture.offset }, set: function(e) { console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."), this.texture.offset = e } }, repeat: { get: function() { return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."), this.texture.repeat }, set: function(e) { console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."), this.texture.repeat = e } }, format: { get: function() { return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."), this.texture.format }, set: function(e) { console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."), this.texture.format = e } }, type: { get: function() { return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."), this.texture.type }, set: function(e) { console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."), this.texture.type = e } }, generateMipmaps: { get: function() { return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."), this.texture.generateMipmaps }, set: function(e) { console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."), this.texture.generateMipmaps = e } } }), Object.defineProperties(Fd.prototype, { load: { value: function(e) { console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead."); var t = this; return (new Ed).load(e, function(e) { t.setBuffer(e) }), this } }, startTime: { set: function() { console.warn("THREE.Audio: .startTime is now .play( delay ).") } } }), Gd.prototype.getData = function() { return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."), this.getFrequencyData() } , ea.prototype.updateCubeMap = function(e, t) { return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."), this.update(e, t) } , ea.prototype.clear = function(e, t, n, i) { return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."), this.renderTarget.clear(e, t, n, i) } ; Zd = { merge: function(e, t, n) { var i; console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."), t.isMesh && (t.matrixAutoUpdate && t.updateMatrix(), i = t.matrix, t = t.geometry), e.merge(t, i, n) }, center: function(e) { return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."), e.center() } }; bn.crossOrigin = void 0, bn.loadTexture = function(e, t, n, i) { console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead."); var r = new _c; r.setCrossOrigin(this.crossOrigin); i = r.load(e, n, void 0, i); return t && (i.mapping = t), i } , bn.loadTextureCube = function(e, t, n, i) { console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead."); var r = new xc; r.setCrossOrigin(this.crossOrigin); i = r.load(e, n, void 0, i); return t && (i.mapping = t), i } , bn.loadCompressedTexture = function() { console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.") } , bn.loadCompressedTextureCube = function() { console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.") } ; Jd = { createMultiMaterialObject: function() { console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js") }, detach: function() { console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js") }, attach: function() { console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js") } }; "undefined" != typeof __THREE_DEVTOOLS__ && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{ detail: { revision: "124" } })); var mp = Object.freeze({ __proto__: null, ACESFilmicToneMapping: 4, AddEquation: re, AddOperation: 2, AdditiveAnimationBlendMode: 2501, AdditiveBlending: ee, AlphaFormat: Ke, AlwaysDepth: _e, AlwaysStencilFunc: 519, AmbientLight: id, AmbientLightProbe: Md, AnimationClip: cc, AnimationLoader: yc, AnimationMixer: ih, AnimationObjectGroup: th, AnimationUtils: Qu, ArcCurve: Tc, ArrayCamera: ls, ArrowHelper: Wd, Audio: Fd, AudioAnalyser: Gd, AudioContext: xd, AudioListener: Rd, AudioLoader: Ed, AxesHelper: jh, AxisHelper: function(e) { return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."), new jh(e) }, BackSide: J, BasicDepthPacking: 3200, BasicShadowMap: 0, BinaryTextureLoader: function(e) { return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."), new Ec(e) }, Bone: Xs, BooleanKeyframeTrack: ic, BoundingBoxHelper: function(e, t) { return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."), new Gh(e,t) }, Box2: ph, Box3: kn, Box3Helper: Xd, BoxBufferGeometry: Wr, BoxGeometry: Cl, BoxHelper: Gh, BufferAttribute: nr, BufferGeometry: Mr, BufferGeometryLoader: dd, ByteType: Ge, Cache: hc, Camera: Kr, CameraHelper: Vd, CanvasRenderer: function() { console.error("THREE.CanvasRenderer has been removed") }, CanvasTexture: xl, CatmullRomCurve3: Bc, CineonToneMapping: 3, CircleBufferGeometry: Pl, CircleGeometry: Dl, ClampToEdgeWrapping: Be, Clock: Cd, ClosedSplineCurve3: hp, Color: Yi, ColorKeyframeTrack: rc, CompressedTexture: bl, CompressedTextureLoader: wc, ConeBufferGeometry: Rl, ConeGeometry: Ll, CubeCamera: ea, CubeGeometry: Cl, CubeReflectionMapping: L, CubeRefractionMapping: R, CubeTexture: ta, CubeTextureLoader: xc, CubeUVReflectionMapping: z, CubeUVRefractionMapping: U, CubicBezierCurve: Ic, CubicBezierCurve3: Oc, CubicInterpolant: $u, CullFaceBack: j, CullFaceFront: W, CullFaceFrontBack: 3, CullFaceNone: V, Curve: Mc, CurvePath: jc, CustomBlending: ie, CustomToneMapping: 5, CylinderBufferGeometry: kl, CylinderGeometry: Bl, Cylindrical: dh, DataTexture: ia, DataTexture2DArray: Sa, DataTexture3D: Ca, DataTextureLoader: Ec, DataUtils: qd, DecrementStencilOp: 7683, DecrementWrapStencilOp: 34056, DefaultLoadingManager: fc, DepthFormat: rt, DepthStencilFormat: at, DepthTexture: El, DirectionalLight: nd, DirectionalLightHelper: Rh, DiscreteInterpolant: tc, DodecahedronBufferGeometry: Il, DodecahedronGeometry: Ol, DoubleSide: Y, DstAlphaFactor: ge, DstColorFactor: we, DynamicBufferAttribute: function(e, t) { return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."), new nr(e,t).setUsage(cn) }, DynamicCopyUsage: 35050, DynamicDrawUsage: cn, DynamicReadUsage: 35049, EdgesGeometry: Hl, EdgesHelper: function(e, t) { return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."), new cl(new Hl(e.geometry),new tl({ color: void 0 !== t ? t : 16777215 })) }, EllipseCurve: Ac, EqualDepth: Te, EqualStencilFunc: 514, EquirectangularReflectionMapping: F, EquirectangularRefractionMapping: I, Euler: ci, EventDispatcher: hn, ExtrudeBufferGeometry: uu, ExtrudeGeometry: du, Face3: Zi, Face4: function(e, t, n, i, r, a, o) { return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."), new Zi(e,t,n,r,a,o) }, FaceColors: 1, FileLoader: gc, FlatShading: 1, Float16BufferAttribute: cr, Float32Attribute: function(e, t) { return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."), new dr(e,t) }, Float32BufferAttribute: dr, Float64Attribute: function(e, t) { return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."), new hr(e,t) }, Float64BufferAttribute: hr, FloatType: Xe, Fog: vs, FogExp2: ms, Font: wd, FontLoader: bd, FrontSide: q, Frustum: oa, GLBufferAttribute: oh, GLSL1: "100", GLSL3: dn, GammaEncoding: 3007, Geometry: Sl, GeometryUtils: Zd, GreaterDepth: Ce, GreaterEqualDepth: Se, GreaterEqualStencilFunc: 518, GreaterStencilFunc: 516, GridHelper: Ph, Group: us, HalfFloatType: qe, HemisphereLight: Jc, HemisphereLightHelper: Ch, HemisphereLightProbe: _d, IcosahedronBufferGeometry: hu, IcosahedronGeometry: pu, ImageBitmapLoader: gd, ImageLoader: bc, ImageUtils: bn, ImmediateRenderObject: gh, IncrementStencilOp: 7682, IncrementWrapStencilOp: 34055, InstancedBufferAttribute: cd, InstancedBufferGeometry: ud, InstancedInterleavedBuffer: ah, InstancedMesh: el, Int16Attribute: function(e, t) { return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."), new or(e,t) }, Int16BufferAttribute: or, Int32Attribute: function(e, t) { return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."), new lr(e,t) }, Int32BufferAttribute: lr, Int8Attribute: function(e, t) { return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."), new ir(e,t) }, Int8BufferAttribute: ir, IntType: je, InterleavedBuffer: ys, InterleavedBufferAttribute: xs, Interpolant: Ku, InterpolateDiscrete: Kt, InterpolateLinear: $t, InterpolateSmooth: 2302, InvertStencilOp: 5386, JSONLoader: function() { console.error("THREE.JSONLoader has been removed.") }, KeepStencilOp: 7680, KeyframeTrack: nc, LOD: Ns, LatheBufferGeometry: fu, LatheGeometry: mu, Layers: pi, LensFlare: function() { console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js") }, LessDepth: Me, LessEqualDepth: Ae, LessEqualStencilFunc: 515, LessStencilFunc: 513, Light: qc, LightProbe: od, Line: sl, Line3: vh, LineBasicMaterial: tl, LineCurve: zc, LineCurve3: Nc, LineDashedMaterial: Yu, LineLoop: dl, LinePieces: 1, LineSegments: cl, LineStrip: 0, LinearEncoding: rn, LinearFilter: Oe, LinearInterpolant: ec, LinearMipMapLinearFilter: G, LinearMipMapNearestFilter: 1007, LinearMipmapLinearFilter: Ne, LinearMipmapNearestFilter: ze, LinearToneMapping: 1, Loader: mc, LoaderUtils: ld, LoadingManager: pc, LogLuvEncoding: 3003, LoopOnce: 2200, LoopPingPong: 2202, LoopRepeat: 2201, LuminanceAlphaFormat: nt, LuminanceFormat: tt, MOUSE: C, Material: Ki, MaterialLoader: sd, Math: gn, MathUtils: gn, Matrix3: wn, Matrix4: ni, MaxEquation: ce, Mesh: Hr, MeshBasicMaterial: $i, MeshDepthMaterial: es, MeshDistanceMaterial: ts, MeshFaceMaterial: function(e) { return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."), e }, MeshLambertMaterial: qu, MeshMatcapMaterial: Ju, MeshNormalMaterial: Xu, MeshPhongMaterial: ju, MeshPhysicalMaterial: Vu, MeshStandardMaterial: Hu, MeshToonMaterial: Wu, MinEquation: se, MirroredRepeatWrapping: Le, MixOperation: 1, MultiMaterial: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []; return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."), e.isMultiMaterial = !0, (e.materials = e).clone = function() { return e.slice() } , e }, MultiplyBlending: ne, MultiplyOperation: k, NearestFilter: Re, NearestMipMapLinearFilter: 1005, NearestMipMapNearestFilter: 1004, NearestMipmapLinearFilter: Ie, NearestMipmapNearestFilter: Fe, NeverDepth: Ee, NeverStencilFunc: 512, NoBlending: Z, NoColors: 0, NoToneMapping: De, NormalAnimationBlendMode: 2500, NormalBlending: K, NotEqualDepth: Pe, NotEqualStencilFunc: 517, NumberKeyframeTrack: ac, Object3D: Si, ObjectLoader: pd, ObjectSpaceNormalMap: ln, OctahedronBufferGeometry: vu, OctahedronGeometry: gu, OneFactor: he, OneMinusDstAlphaFactor: ye, OneMinusDstColorFactor: be, OneMinusSrcAlphaFactor: ve, OneMinusSrcColorFactor: fe, OrthographicCamera: ed, PCFShadowMap: P, PCFSoftShadowMap: 2, PMREMGenerator: Yd, ParametricBufferGeometry: yu, ParametricGeometry: wu, Particle: function(e) { return console.warn("THREE.Particle has been renamed to THREE.Sprite."), new Fs(e) }, ParticleBasicMaterial: function(e) { return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."), new hl(e) }, ParticleSystem: function(e, t) { return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."), new gl(e,t) }, ParticleSystemMaterial: function(e) { return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."), new hl(e) }, Path: Wc, PerspectiveCamera: $r, Plane: ki, PlaneBufferGeometry: ua, PlaneGeometry: bu, PlaneHelper: Hh, PointCloud: dp, PointCloudMaterial: function(e) { return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."), new hl(e) }, PointLight: $c, PointLightHelper: Mh, Points: gl, PointsMaterial: hl, PolarGridHelper: Dh, PolyhedronBufferGeometry: Fl, PolyhedronGeometry: xu, PositionalAudio: Ud, PropertyBinding: eh, PropertyMixer: Hd, QuadraticBezierCurve: Uc, QuadraticBezierCurve3: Gc, Quaternion: Sn, QuaternionKeyframeTrack: sc, QuaternionLinearInterpolant: oc, REVISION: "124", RGBADepthPacking: on, RGBAFormat: et, RGBAIntegerFormat: dt, RGBA_ASTC_10x10_Format: Rt, RGBA_ASTC_10x5_Format: kt, RGBA_ASTC_10x6_Format: Bt, RGBA_ASTC_10x8_Format: Lt, RGBA_ASTC_12x10_Format: Ft, RGBA_ASTC_12x12_Format: It, RGBA_ASTC_4x4_Format: _t, RGBA_ASTC_5x4_Format: Mt, RGBA_ASTC_5x5_Format: At, RGBA_ASTC_6x5_Format: Tt, RGBA_ASTC_6x6_Format: St, RGBA_ASTC_8x5_Format: Ct, RGBA_ASTC_8x6_Format: Pt, RGBA_ASTC_8x8_Format: Dt, RGBA_BPTC_Format: Ot, RGBA_ETC2_EAC_Format: Et, RGBA_PVRTC_2BPPV1_Format: wt, RGBA_PVRTC_4BPPV1_Format: yt, RGBA_S3TC_DXT1_Format: pt, RGBA_S3TC_DXT3_Format: ft, RGBA_S3TC_DXT5_Format: mt, RGBDEncoding: 3006, RGBEEncoding: 3002, RGBEFormat: it, RGBFormat: $e, RGBIntegerFormat: ct, RGBM16Encoding: 3005, RGBM7Encoding: 3004, RGB_ETC1_Format: bt, RGB_ETC2_Format: xt, RGB_PVRTC_2BPPV1_Format: gt, RGB_PVRTC_4BPPV1_Format: vt, RGB_S3TC_DXT1_Format: ht, RGFormat: lt, RGIntegerFormat: ut, RawShaderMaterial: Gu, Ray: ti, Raycaster: sh, RectAreaLight: rd, RedFormat: ot, RedIntegerFormat: st, ReinhardToneMapping: 2, RepeatWrapping: ke, ReplaceStencilOp: 7681, ReverseSubtractEquation: oe, RingBufferGeometry: Eu, RingGeometry: _u, SRGB8_ALPHA8_ASTC_10x10_Format: Yt, SRGB8_ALPHA8_ASTC_10x5_Format: Xt, SRGB8_ALPHA8_ASTC_10x6_Format: qt, SRGB8_ALPHA8_ASTC_10x8_Format: Jt, SRGB8_ALPHA8_ASTC_12x10_Format: Zt, SRGB8_ALPHA8_ASTC_12x12_Format: Qt, SRGB8_ALPHA8_ASTC_4x4_Format: zt, SRGB8_ALPHA8_ASTC_5x4_Format: Nt, SRGB8_ALPHA8_ASTC_5x5_Format: Ut, SRGB8_ALPHA8_ASTC_6x5_Format: Gt, SRGB8_ALPHA8_ASTC_6x6_Format: Ht, SRGB8_ALPHA8_ASTC_8x5_Format: Vt, SRGB8_ALPHA8_ASTC_8x6_Format: jt, SRGB8_ALPHA8_ASTC_8x8_Format: Wt, Scene: gs, SceneUtils: Jd, ShaderChunk: ca, ShaderLib: ha, ShaderMaterial: Qr, ShadowMaterial: Uu, Shape: Xc, ShapeBufferGeometry: Mu, ShapeGeometry: Au, ShapePath: yd, ShapeUtils: ou, ShortType: He, Skeleton: Ys, SkeletonHelper: _h, SkinnedMesh: Ws, SmoothShading: 2, Sphere: qn, SphereBufferGeometry: Tu, SphereGeometry: Su, Spherical: ch, SphericalHarmonics3: ad, Spline: fp, SplineCurve: Hc, SplineCurve3: pp, SpotLight: Qc, SpotLightHelper: wh, Sprite: Fs, SpriteMaterial: Es, SrcAlphaFactor: me, SrcAlphaSaturateFactor: xe, SrcColorFactor: pe, StaticCopyUsage: 35046, StaticDrawUsage: un, StaticReadUsage: 35045, StereoCamera: Sd, StreamCopyUsage: 35042, StreamDrawUsage: 35040, StreamReadUsage: 35041, StringKeyframeTrack: lc, SubtractEquation: ae, SubtractiveBlending: te, TOUCH: { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, TangentSpaceNormalMap: sn, TetrahedronBufferGeometry: Cu, TetrahedronGeometry: Pu, TextBufferGeometry: Du, TextGeometry: ku, Texture: En, TextureLoader: _c, TorusBufferGeometry: Bu, TorusGeometry: Lu, TorusKnotBufferGeometry: Ru, TorusKnotGeometry: Fu, Triangle: Hi, TriangleFanDrawMode: 2, TriangleStripDrawMode: 1, TrianglesDrawMode: 0, TubeBufferGeometry: Iu, TubeGeometry: Ou, UVMapping: 300, Uint16Attribute: function(e, t) { return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."), new sr(e,t) }, Uint16BufferAttribute: sr, Uint32Attribute: function(e, t) { return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."), new ur(e,t) }, Uint32BufferAttribute: ur, Uint8Attribute: function(e, t) { return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."), new rr(e,t) }, Uint8BufferAttribute: rr, Uint8ClampedAttribute: function(e, t) { return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."), new ar(e,t) }, Uint8ClampedBufferAttribute: ar, Uniform: rh, UniformsLib: da, UniformsUtils: Jr, UnsignedByteType: Ue, UnsignedInt248Type: Qe, UnsignedIntType: We, UnsignedShort4444Type: Je, UnsignedShort5551Type: Ye, UnsignedShort565Type: Ze, UnsignedShortType: Ve, VSMShadowMap: D, Vector2: yn, Vector3: Cn, Vector4: Mn, VectorKeyframeTrack: uc, Vertex: function(e, t, n) { return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."), new Cn(e,t,n) }, VertexColors: 2, VideoTexture: wl, WebGL1Renderer: fs, WebGLCubeRenderTarget: na, WebGLMultisampleRenderTarget: Tn, WebGLRenderTarget: An, WebGLRenderTargetCube: function(e, t, n) { return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."), new na(e,n) }, WebGLRenderer: ps, WebGLUtils: ss, WireframeGeometry: zu, WireframeHelper: function(e, t) { return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."), new cl(new zu(e.geometry),new tl({ color: void 0 !== t ? t : 16777215 })) }, WrapAroundEnding: nn, XHRLoader: function(e) { return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."), new gc(e) }, ZeroCurvatureEnding: en, ZeroFactor: de, ZeroSlopeEnding: tn, ZeroStencilOp: 0, sRGBEncoding: an }) , vp = [] , gp = [] , yp = [] , wp = .1 , bp = function(t, e) { var n; return "string" == typeof t || "number" == typeof t ? n = vp.find(function(e) { return e.ids.includes(t) }) : (n = vp.find(function(e) { return Up.closeTo(e.x, t.x, wp) && Up.closeTo(e.y, t.y, wp) })) ? n.addPoint(t.id) : n = new xp(t.x,t.y,{ record: !0, id: t.id },e), n || console.log("no point!"), n } , xp = function() { y(r, yn); var i = w(r); function r(e, t) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}; return O(this, r), t = i.call(this, e, t), n.record && (t.id = n.id, null == t.id && (t.id = "add_" + vp.length), t.ids = [t.id], vp.push(g(t))), t.type = n.type || "", t.lines = [], t } return h(r, [{ key: "addPoint", value: function(e) { this.ids.push(e) } }, { key: "searchLineByFactor", value: function(i, r, t) { var a, o = this, e = this.lines.filter(function(e) { return e.searchTime < 2 }); if (0 != e.length) return 1 == e.length || 1 == (e = e.filter(function(e) { return e != t })).length ? e[0] : (e.forEach(function(e) { var t = e.getVector(); e.points[1] == o && t.negate(); var n = Up.getVec2Angle(i, t); new Cn(i.x,i.y,0).cross(new Cn(t.x,t.y,0)).z < 0 && (n *= -1), (!a || "min" == r && n < a.factor || "max" == r && n > a.factor) && (a = { line: e, factor: n }) }), a.line) } }]), r }() , Ep = 0 , _p = function() { function a(t) { var n = this; if (O(this, a), t.points[0] != t.points[1]) { if (this.points = t.points, this.type = t.type || "line", "line" == this.type) { var e = gp.find(function(e) { return e.points.includes(t.points[0]) && e.points.includes(t.points[1]) }); if (e) return null != t.id && e.ids.push(t.id), e; this.id = null == t.id ? "line" + Ep++ : t.id, this.ids = [this.id], t.dontWriteToPoint || this.points.forEach(function(e) { e.lines.push(n) }), t.isChild || gp.push(this), this.searchTime = 0 } this.children = [], this.parents = [], this.match = [] } } return h(a, [{ key: "getAngleInfo", value: function() { var e, t = (e = this.points, (t = {}).angle = e[1].clone().sub(e[0]).angle(), Up.closeTo(t.angle, 2 * Math.PI) ? t.angle -= 2 * Math.PI : (t.angle > Math.PI || Up.closeTo(t.angle, Math.PI)) && (t.angle -= Math.PI, t.reverse = !0), t); this.angle = t.angle, this.reverse = t.reverse } }, { key: "getIntersectWithLine", value: function(e, t) { var n = this , i = e.points.find(function(e) { return n.points.includes(e) }); if (i) return { point: i, type: "joint" }; t = Up.isLineIntersect(e.points, this.points, !1, t); return t ? { point: t, type: "intersect" } : void 0 } }, { key: "writeToPoint", value: function() { var t = this; this.points.forEach(function(e) { e.lines.includes(t) || e.lines.push(t) }) } }, { key: "checkIfParent", value: function(t) { return this == t || this.parents.find(function(e) { return e.checkIfParent(t) }) } }, { key: "splitByPoint", value: function(e) { var t = this , n = new a({ points: [e, this.points[0]], dontWriteToPoint: !0, hasntsure: !0 }) , i = new a({ points: [e, this.points[1]], dontWriteToPoint: !0, hasntsure: !0 }); if (n.points && i.points) { if (!(this.checkIfParent(n) || this.checkIfParent(i) || n.checkIfParent(this) || i.checkIfParent(this))) { var e = function(e) { t.children.push(e), e.parents.push(t), gp.includes(e) || gp.push(e), e.writeToPoint() }; e(n), e(i); e = this.points[0].lines.indexOf(this); return -1 < e && this.points[0].lines.splice(e, 1), -1 < (e = this.points[1].lines.indexOf(this)) && this.points[1].lines.splice(e, 1), [n, i] } console.warn("splitByPoint 发现parent和children一样") } else console.warn("splitByPoint 线有点相同") } }, { key: "splitByPoints", value: function(n) { var i = this; (n = n.map(function(e) { return { dis: e.distanceTo(i.points[0]), point: e } })).sort(function(e, t) { return e.dis - t.dis }); var r = []; n.forEach(function(e, t) { t = new a({ points: [e.point, 0 == t ? i.points[0] : n[t - 1].point], group: i.group, dontWriteToPoint: !0, hasntsure: !0 }); r.push(t) }); var 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), gp.includes(e) || gp.push(e), e.writeToPoint(), e.writeToPoint() }), -1 < (e = this.points[0].lines.indexOf(this)) && this.points[0].lines.splice(e, 1), -1 < (e = this.points[1].lines.indexOf(this)) && this.points[1].lines.splice(e, 1)) } }, { key: "getAllSlices", value: function() { var n = []; return function e(t) { 0 == t.children.length ? n.push(t) : t.children.forEach(e) }(this), n } }, { key: "getVector", value: function() { return this.points[1].clone().sub(this.points[0]) } }, { key: "getLength", value: function() { return this.points[0].distanceTo(this.points[1]) } }, { key: "getCenter", value: function() { return this.points[1].clone().add(this.points[0]).multiplyScalar(.5) } }]), a }() , Mp = 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 Ap(t, n) { return gp.find(function(e) { return e.points.includes(t) && e.points.includes(n) }) } function Tp(e, t) { if (e instanceof Cp && (e = e.points), t instanceof Cp && (t = t.points), e.length != t.length) return !1; if (e.lines && t.lines) { if (0 == Mp(e.lines, t.lines).length) return !0 } else if (Pp(e, t)) return !0 } var Sp = 0 , Cp = h(function e(t) { O(this, e), this.id = Sp++, this.type = t.type || "normal", this.points = t.points, this.lines = t.lines, yp.push(this), this.child = [], this.parent = [], this.smallNeibours = []; t = Up.getArea(this.points); this.area = Math.abs(t), this.isClockwise = t < 0 }) , Pp = function(e, t) { for (var n, i, r = [], a = 0, o = e.length; a < o; a++) -1 < t.indexOf(e[a]) && r.push(e[a]); for (var s = 0, l = t.length; s < l; s++) { var u = r.indexOf(t[s]); if (-1 == u) return !1; if (0 == s) i = u; else if (1 == s) { if ((n = u - i) == l - 1 ? n = -1 : n == 1 - l && (n = 1), -1 != n && 1 != n) return !1 } else if (u != (i + n * s + l) % l) return !1 } return { sameAxis: 0 < n } } , Dp = function e(t, n, i) { if (0 == n.children.length) { if (Up.ifPointAtLineBound(t, n.points, i)) return n } else for (var r = 0; r < n.children.length; r++) { var a = e(t, n.children[r], i); if (a) return a } }; function kp() { var e, c = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; vp = [], gp = [], yp = [], Ep = Sp = 0, c.points = c.points || [], c.lines = c.lines || [], (u = c).points.forEach(function(e) { Np.expandByPoint(new yn(e.x,e.y)) }), wp = null != u.precision ? u.precision : (e = Np.getSize(new yn), gn.clamp(Math.max(e.x, e.y) / 70, .2, 2)), u.points.forEach(function(e) { return bp(e) }), u.lines.forEach(function(e) { new _p({ points: [bp(e.p1), bp(e.p2)], id: e.id }) }), c.dontSliceLines || function() { for (var e = gp.length, t = function n(e, t) { if (e != t) { null == e.angle && e.getAngleInfo(), null == t.angle && t.getAngleInfo(); var i = e.getIntersectWithLine(t, wp); if (i) if ("intersect" == i.type) { var r = bp(i.point, "whenGetSliceLines") , a = Dp(r, e) , o = Dp(r, t); if (a = (a = a || Dp(r, e, wp)) || Dp(r, e, 2 * wp), o = (o = o || Dp(r, t, wp)) || Dp(r, t, 2 * wp), !a || !o) return console.warn("atWhichChildLine仍旧找不到 :" + e.id + "," + t.id + ", pointId: " + r.id), a || console.warn("找不到line1"), void (o || console.warn("找不到line2")); a.points.find(function(e) { return e == r }) && o.points.find(function(e) { return e == r }) || (a.points.find(function(e) { return e == r }) ? o.splitByPoint(r) : o.points.find(function(e) { return e == r }) ? a.splitByPoint(r) : (a.splitByPoint(r), o.splitByPoint(r))) } else r = i.point, Up.closeTo(e.angle, t.angle) && (l = e.getAllSlices(), u = t.getAllSlices(), 1 < l.length || 1 < u.length ? l.forEach(function(t) { u.forEach(function(e) { n(t, e) }) }) : (s = e.points.find(function(e) { return e != r }), c = t.points.find(function(e) { return e != r }), Up.ifPointAtLineBound(s, t.points) ? t.splitByPoint(s) : Up.ifPointAtLineBound(c, e.points) && e.splitByPoint(c))); else if (Up.closeTo(e.angle, t.angle)) { var o = e.getVector() , i = e.points[0].clone().sub(t.points[0]) , s = Up.getVec2Cos(o, i); if (Up.closeTo(s, -1, 1e-4) || Up.closeTo(s, 1, 1e-4)) { var l = e.getAllSlices() , u = t.getAllSlices(); if (1 < l.length || 1 < u.length) l.forEach(function(t) { u.forEach(function(e) { n(t, e) }) }); else { var c = e.points[0] , o = e.reverse == t.reverse ? t.points[0] : t.points[1] , i = e.points[1] , s = e.reverse == t.reverse ? t.points[1] : t.points[0] , l = o.clone().sub(i) , o = s.clone().sub(c); if (l.length() < o.length()) { s = c.clone().sub(i); if (1.57 <= Up.getVec2Angle(l, s)) return } else { var d = i.clone().sub(c); if (1.57 <= Up.getVec2Angle(o, d)) return } d = function(e, t) { var n = Up.ifPointAtLineBound(e.points[0], t.points) , i = Up.ifPointAtLineBound(e.points[1], t.points); if (n && i) return t.splitByPoints(e.points), !0; if (n || i) { i = n ? e.points[0] : e.points[1], n = n ? e.points[1] : e.points[0], n = t.points[0].distanceTo(n) < t.points[1].distanceTo(n) ? t.points[0] : t.points[1]; return e.splitByPoint(n), t.splitByPoint(i), !0 } } ; d(e, t) || d(t, e) } } } } }, n = 0; n < e; n++) for (var i = gp[n], r = n + 1; r < e; r++) t(i, gp[r]) }(); for (var n = function e(t, n, i, r) { if (s = i.includes("big") ? n ? (a = n.points[n.points.length - 1], o = t.clone().sub(a), t.searchLineByFactor(o, "min", Ap(t, a))) : (o = i.includes("Left") ? new yn(1,0) : new yn(-1,0), t.searchLineByFactor(o, "min")) : n ? (a = n.points[n.points.length - 1], o = t.clone().sub(a), t.searchLineByFactor(o, "max", Ap(t, a))) : (o = new yn(1,0), t.searchLineByFactor(o, "min"))) { s.searchTime++, r.includes(s) || r.push(s); var a = s.points.find(function(e) { return t != e }) , o = n ? n.points.concat([t]) : [t] , s = n ? n.lines.concat([s]) : [s]; return a == o[0] ? function(t, e, n) { if (!c.onlyGetOutRing || "small" != n) { if ("small" != n && !c.onlyGetOutRing) return t; for (var i = []; t.length; ) { for (var r = [], a = !1, o = 0; o < t.length; o++) { if (r.includes(t[o])) { var s = r.indexOf(t[o]) , l = t.slice(s, o) , u = e.slice(s, o); t.splice(s, o - s), e.splice(s, o - s), 2 < l.length && (yp.find(function(e) { return Tp(l, e) }) || i.push(new Cp({ points: l, lines: u }))), a = !0; break } r.push(t[o]), a = !1 } if (!a) { 2 < t.length && (yp.find(function(e) { return Tp(t, e) }) || i.push(new Cp({ points: t, lines: e }))); break } } "small" != n && i.forEach(function(e) { return e.isOutRing = !0 }) } }(o, s, i) : e(a, { lines: s, points: o }, i, r) } }; ; ) { var i = [] , r = null; if (vp.forEach(function(e) { e.lines.find(function(e) { return e.searchTime < 2 }) && (!r || e.x < r.x) && (r = e) }), !r) break; n(r, null, "bigLeft", i); for (i = i.filter(function(e) { return e.searchTime < 2 }); 0 < i.length; ) if ("break" === function() { var t = []; if (i.forEach(function(e) { return e.points.forEach(function(e) { t.includes(e) || t.push(e) }) }), r = null, t.forEach(function(e) { e.lines.find(function(e) { return e.searchTime < 2 }) && (!r || e.x < r.x) && (r = e) }), !r) return "break"; n(r, null, "small", i), i = i.filter(function(e) { return e.searchTime < 2 }) }()) break } for (var o = yp.length, t = 0; t < o; t++) for (var a = yp[t], s = t + 1; s < o; s++) { var l = yp[s]; (function(e, t) { return e.filter(function(e) { return t.includes(e) }) } )(a.lines, l.lines).length && (a.smallNeibours.push(l), l.smallNeibours.push(a)) } yp.forEach(function(e) { for (var t = 0; t < o; t++) { var n = yp[t]; if (e != n && !e.smallNeibours.includes(n)) { for (var i = void 0, r = 0; r < e.points.length && (i = Up.isPointInArea(n.points, null, e.points[r])) && i.atLine; r++) ; if (i) { if (i.atLine) { var a = Up.getCenterOfGravityPoint(e.points); if (!Up.isPointInArea(n.points, null, a)) continue } n.child.push(e), e.parent.push(n) } } } }); var u = yp.filter(function(e) { return !e.isClockwise }); return 0 < u.length && u.forEach(function(n) { var e, i; 0 < n.smallNeibours.length && (Mp(n.lines, (e = n.smallNeibours.concat(n.child).map(function(e) { return e.lines }), i = [], e.forEach(function(e) { e.forEach(function(e) { var t = i.indexOf(e); -1 < t ? i.splice(t, 1) : i.push(e) }) }), i)).every(function(t) { return n.child.find(function(e) { return e.lines.includes(t) }) }) && (console.log("%c删除非最小环 ring" + n.id, "color:#00f"), console.log(n), yp.splice(yp.indexOf(n), 1), n.child.forEach(function(e) { var t = e.parent.indexOf(n); -1 < t && e.parent.splice(t, 1) }), n.parent.forEach(function(e) { var t = e.child.indexOf(n); -1 < t && e.child.splice(t, 1) }), n.smallNeibours.forEach(function(e) { var t = e.smallNeibours.indexOf(n); -1 < t && e.smallNeibours.splice(t, 1) }))) }), yp.forEach(function(t) { t.parent.length && (t.closetParent = t.parent.find(function(e) { return e.parent.length == t.parent.length - 1 }), t.closetParent.closetChilds || (t.closetParent.closetChilds = []), t.closetParent.closetChilds.push(t)) }), yp.map(function(e) { return { id: e.id, points: e.points.map(function(e) { return { id: e.ids[0], x: e.x, y: e.y } }), area: e.area, closetParent: e.closetParent && e.closetParent.id, closetChilds: e.closetChilds && e.closetChilds.map(function(e) { return e.id }) } }) } var Bp, Lp, Rp, Fp, Ip, Op, zp, Np = new ph, Up = { getBaseLog: function(e, t) { return Math.log(t) / Math.log(e) }, convertVector: { ZupToYup: function(e) { return new Cn(e.x,e.z,-e.y) }, YupToZup: function(e) { return new Cn(e.x,-e.z,e.y) } }, convertQuaternion: { ZupToYup: function(e) { var t = new ci(-Math.PI / 2,0,0) , t = (new Sn).setFromEuler(t); return e.clone().premultiply(t) }, YupToZup: function(e) { var t = new ci(Math.PI / 2,0,0) , t = (new Sn).setFromEuler(t); return e.clone().premultiply(t) } }, convertVisionQuaternion: function(e) { return new Sn(e.x,e.z,-e.y,e.w).multiply((new Sn).setFromAxisAngle(new Cn(0,1,0), gn.degToRad(90))) }, invertVisionQuaternion: function(e) { e = e.clone().multiply((new Sn).setFromAxisAngle(new Cn(0,1,0), gn.degToRad(-90))); return new Sn(e.x,-e.z,e.y,e.w) }, getVec2Angle: function(e, t) { return Math.acos(gn.clamp(this.getVec2Cos(e, t), -1, 1)) }, getVec2Cos: function(e, t) { return e.dot(t) / e.length() / t.length() }, getAngle: function(e, t, n) { var i = e.angleTo(t); return e.clone().cross(t)[n] < 0 && (i *= -1), i }, closeTo: function(t, n) { function i(e, t) { return Math.abs(e - t) < r } var r = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1e-6; if ("number" == typeof t) return i(t, n); function e(e) { return null == t[e] || i(t[e], n[e]) } return e("x") && e("y") && e("z") && e("w") }, toPrecision: function(e, t) { function n(e, t) { return t = Math.pow(10, t), Math.round(e * t) / t } if (e instanceof Array) { for (var i = 0; i < e.length; i++) e[i] = n(e[i], t); return e } if (e instanceof Object) { for (var i in e) e[i] = n(e[i], t); return e } return n(e, t) }, isEmptyQuaternion: function(e) { return 0 === Math.abs(e.x) && 0 === Math.abs(e.y) && 0 === Math.abs(e.z) && 0 === Math.abs(e.w) }, projectPositionToCanvas: function(e, t, n) { (n = n || new Cn).copy(e); var i = .5 * $("#player").width() , e = .5 * $("#player").height(); return n.project(t), n.x = n.x * i + i, n.y = -n.y * e + e, n }, handelPadResize: !1, getOffset: function(e, t, n) { var i = "left" == e ? t.offsetLeft : t.offsetTop; for (n = n || $("body")[0]; (t = t.offsetParent) && t != n; ) i += "left" == e ? t.offsetLeft : t.offsetTop; return i }, constrainedTurn: function(e) { e %= 2 * Math.PI; return e > Math.PI ? e - 2 * Math.PI : e < -Math.PI ? e + 2 * Math.PI : e }, getFOVDotThreshold: function(e) { return Math.cos(gn.degToRad(e / 2)) }, transform2DForwardVectorByCubeFace: function(e, t, n, i) { switch (e) { case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_X: n.set(1, t.y, t.x); break; case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_X: n.set(-1, t.y, -t.x); break; case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_Y: n.set(-t.x, 1, -t.y); break; case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: n.set(-t.x, -1, t.y); break; case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_Z: n.set(-t.x, t.y, 1); break; case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: n.set(t.x, t.y, -1) } i && n.normalize() }, getFootPoint: function(e, t, n, i) { if (t.equals(n)) return t.clone(); var r = e.clone().sub(t) , a = t.clone().sub(n) , e = a.length() , r = r.dot(a) / e , e = t.clone().add(a.multiplyScalar(r / e)); return e = i && 0 < e.clone().sub(t).dot(e.clone().sub(n)) ? (e.distanceTo(t) < e.distanceTo(n) ? t : n).clone() : e }, getCenterOfGravityPoint: function(e) { for (var t = 0, n = 0, i = 0, r = 1; r <= e.length; r++) { var a = e[r % e.length].x , o = e[r % e.length].y , s = e[r - 1].x , l = e[r - 1].y , u = (a * l - o * s) / 2; t += u, n += u * (a + s) / 3, i += u * (o + l) / 3 } return { x: n /= t, y: i /= t } }, getBound: function(e) { for (var t = new ph, n = 0, i = e.length; n < i; n++) t.expandByPoint(e[n]); return t }, isPointInArea: function(e, t, n, i) { var r = this , a = this.getBound(e); if (n.x < a.min.x || n.x > a.max.x || n.y < a.min.y || n.y > a.max.y) return !1; for (var o = !1, s = n.x, l = n.y, u = 0, c = e.length - 1; u < e.length; c = u++) { var d = e[u].x , h = e[u].y , p = e[c].x , f = e[c].y; if ((d - s) * (f - l) == (d - s) * (h - l) && s >= Math.min(d, p) && s <= Math.max(d, p) && l >= Math.min(h, f) && l <= Math.max(h, f)) return { atLine: !0 }; l < h != l < f && s < (p - d) * (l - h) / (f - h) + d && (o = !o) } return o && t ? !t.some(function(e) { return r.isPointInArea(e, null, n, i) }) : o }, getArea: function(e) { for (var t = e.length, n = 0, i = t - 1, r = 0; r < t; i = r++) n += e[i].x * e[r].y - e[r].x * e[i].y; return -.5 * n }, isInBetween: function(e, t, n, i) { return e <= t && t <= n || n <= t && t <= e || this.closeTo(e, t, i) || this.closeTo(t, n, i) }, ifPointAtLineBound: function(e, t, n) { return Up.isInBetween(t[0].x, e.x, t[1].x, n) && Up.isInBetween(t[0].y, e.y, t[1].y, n) }, isLineIntersect: function(e, t, n, i) { var r = e[1].y - e[0].y , a = e[0].x - e[1].x , o = r * e[0].x + a * e[0].y , s = t[1].y - t[0].y , l = t[0].x - t[1].x , u = s * t[0].x + l * t[0].y , c = r * l - s * a; if (0 == c) return !1; a = (l * o - a * u) / c, c = (r * u - s * o) / c; return n || Up.ifPointAtLineBound({ x: a, y: c }, e, i) && Up.ifPointAtLineBound({ x: a, y: c }, t, i) ? { x: a, y: c } : void 0 }, getNormal2d: function() { var e, t, n, i = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, r = i.vec ? (n = i.vec.x, i.vec.y) : (n = i.p1.x - i.p2.x, i.p1.y - i.p2.y); if (0 != r) t = -n * (e = 1) / r; else { if (0 == n) return console.log("两个点一样"), null; e = -r * (t = 1) / n } i = new Cn(e,0,t), r = new Cn(n,0,r); return 0 < i.cross(r).y && (e *= -1, t *= -1), new yn(e,t).normalize() }, getQuaBetween2Vector: function(e, t, n) { var i = e.angleTo(t) , t = e.clone().cross(t).normalize(); return 0 == t.length() ? (new Sn).setFromAxisAngle(n, i) : (new Sn).setFromAxisAngle(t, i) }, getScaleForConstantSize: (Lp = new Cn, Rp = new Cn, Fp = new Cn, Ip = new Cn, Op = new Cn, function() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; return Bp = t.width2d || (e = "OrthographicCamera" == t.camera.type ? 200 / t.camera.zoom : t.position.distanceTo(t.camera.position), t.maxSize - (t.maxSize - t.minSize) * gn.smoothstep(e, t.nearBound, t.farBound)), Lp.copy(t.position).project(t.camera), Rp.set(t.resolution.x / 2, t.resolution.y / 2, 1).multiply(Lp), Fp.set(Bp / 2, 0, 0).add(Rp), Ip.set(2 / t.resolution.x, 2 / t.resolution.y, 1).multiply(Fp), Op.copy(Ip).unproject(t.camera), Op.distanceTo(t.position) } ), getCrossPointAtRect: function(e, t, n, i, r, a) { var o = (t.x - e.x) / (t.y - e.y) , n = t.x >= e.x ? n + r : r , r = n; return ((n = 1 / o * (r - e.x) + e.y) < a || a + i < n) && (r = o * ((n = n < a ? a : a + i) - e.y) + e.x), new yn(r,n) }, getDirFromUV: function(e) { var t = Math.cos(e.y * Math.PI) , n = 2 * Math.PI * e.x - Math.PI , i = (Math.PI, -Math.PI / 2 <= n && n < Math.PI / 2 ? 1 : -1) , e = Math.tan(n) , n = Math.sqrt((1 - t * t) / (1 + e * e)) , e = e * n; return n * i < 0 && (n *= -1, e *= -1), this.convertVector.YupToZup(new Cn(e *= -1,t,n)) }, getUVfromDir: function(e) { (e = this.convertVector.ZupToYup(e)).x *= -1; var t = Math.atan2(e.x, e.z) / (2 * Math.PI) + .5 , e = Math.acos(e.y) / Math.PI; return new yn(t,e) }, getDirByLonLat: function(e, t) { var n = new Cn , t = gn.degToRad(90 - t) , e = gn.degToRad(e); return n.x = Math.sin(t) * Math.cos(e), n.y = Math.cos(t), n.z = Math.sin(t) * Math.sin(e), n }, projectPointAtPlane: function() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; return (e = new ki).setFromCoplanarPoints.apply(e, Q(t.facePoints)).projectPoint(t.point, new Cn) }, getPolygonsMixedRings: function(e, t) { var n = [] , r = [] , a = 0; return e.forEach(function(e) { return n.push.apply(n, Q(e.map(function(e) { return (new yn).copy(e) }))) }), e.forEach(function(e, t) { for (var n = e.length, i = 0; i < n; ) r.push({ p1: i + a, p2: (i + 1) % n + a }), i++; a += n }), n.forEach(function(e, t) { e.id = t }), kp({ points: n, lines: r, onlyGetOutRing: t }).filter(function(e) { return null == e.closetParent }) }, getQuaFromPosAim: function(e, t) { t = (new ni).lookAt(e, t, new Cn(0,0,1)); return (new Sn).setFromRotationMatrix(t) }, getBoundByPoints: function(e, t) { var n = new kn; e.forEach(function(e) { n.expandByPoint(e) }); e = n.getCenter(new Cn); return t && (t = (new kn).setFromCenterAndSize(e, t), n.union(t)), { bounding: n, size: n.getSize(new Cn), center: e } } }; Potree.math = Up, "performance"in window == 0 && (window.performance = {}), "now"in window.performance == 0 && (zp = Date.now(), performance.timing && performance.timing.navigationStart && (zp = performance.timing.navigationStart), window.performance.now = function() { return Date.now() - zp } ); var Gp = { config: { withCredentials: !(ps.prototype.paramThreeToGL = function(e) { var t, n = this.extensions, i = this.getContext(); if (e === ke) return i.REPEAT; if (e === Be) return i.CLAMP_TO_EDGE; if (e === Le) return i.MIRRORED_REPEAT; if (e === Re) return i.NEAREST; if (1004 === e) return i.NEAREST_MIPMAP_NEAREST; if (1005 === e) return i.NEAREST_MIPMAP_LINEAR; if (e === Oe) return i.LINEAR; if (1007 === e) return i.LINEAR_MIPMAP_NEAREST; if (e === G) return i.LINEAR_MIPMAP_LINEAR; if (e === Ue) return i.UNSIGNED_BYTE; if (e === Je) return i.UNSIGNED_SHORT_4_4_4_4; if (e === Ye) return i.UNSIGNED_SHORT_5_5_5_1; if (e === Ze) return i.UNSIGNED_SHORT_5_6_5; if (e === Ge) return i.BYTE; if (e === He) return i.SHORT; if (e === Ve) return i.UNSIGNED_SHORT; if (e === je) return i.INT; if (e === We) return i.UNSIGNED_INT; if (e === Xe) return i.FLOAT; if (null !== (t = n.get("OES_texture_half_float")) && e === qe) return t.HALF_FLOAT_OES; if (e === Ke) return i.ALPHA; if (e === $e) return i.RGB; if (e === et) return i.RGBA; if (e === tt) return i.LUMINANCE; if (e === nt) return i.LUMINANCE_ALPHA; if (e === re) return i.FUNC_ADD; if (e === ae) return i.FUNC_SUBTRACT; if (e === oe) return i.FUNC_REVERSE_SUBTRACT; if (e === de) return i.ZERO; if (e === he) return i.ONE; if (e === pe) return i.SRC_COLOR; if (e === fe) return i.ONE_MINUS_SRC_COLOR; if (e === me) return i.SRC_ALPHA; if (e === ve) return i.ONE_MINUS_SRC_ALPHA; if (e === ge) return i.DST_ALPHA; if (e === ye) return i.ONE_MINUS_DST_ALPHA; if (e === we) return i.DST_COLOR; if (e === be) return i.ONE_MINUS_DST_COLOR; if (e === xe) return i.SRC_ALPHA_SATURATE; if (null !== (t = n.get("WEBGL_compressed_texture_s3tc"))) { if (e === ht) return t.COMPRESSED_RGB_S3TC_DXT1_EXT; if (e === pt) return t.COMPRESSED_RGBA_S3TC_DXT1_EXT; if (e === ft) return t.COMPRESSED_RGBA_S3TC_DXT3_EXT; if (e === mt) return t.COMPRESSED_RGBA_S3TC_DXT5_EXT } if (null !== (t = n.get("WEBGL_compressed_texture_pvrtc"))) { if (e === vt) return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; if (e === gt) return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; if (e === yt) return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; if (e === wt) return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG } if (null !== (t = n.get("WEBGL_compressed_texture_etc1")) && e === bt) return t.COMPRESSED_RGB_ETC1_WEBGL; if (null !== (t = n.get("EXT_blend_minmax"))) { if (e === se) return t.MIN_EXT; if (e === ce) return t.MAX_EXT } return 0 } ), customHeaders: [{ header: null, value: null }] }, createXMLHttpRequest: function() { var e, t, n = new XMLHttpRequest; return this.config.customHeaders && Array.isArray(this.config.customHeaders) && 0 < this.config.customHeaders.length && (e = n.open, t = this.config.customHeaders, n.open = function() { e.apply(this, [].slice.call(arguments)), t.forEach(function(e) { e.header && e.value && n.setRequestHeader(e.header, e.value) }) } ), n } } , Hp = { "pointcloud.vs": '\nprecision highp float;\nprecision highp int;\n\n#define max_clip_polygons 8\n#define PI 3.141592653589793\n\n \n\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 /*\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n */\n#endif \n\n\n\n\n \n\n//--------------\n\n\n\n\n\nattribute vec3 position;\nattribute vec3 color;\nattribute float intensity;\nattribute float classification;\nattribute float returnNumber;\nattribute float numberOfReturns;\nattribute float pointSourceID;\nattribute vec4 indices; //每个点的index\nattribute float spacing;\nattribute float gpsTime;\nattribute vec3 normal;\nattribute float aExtra;\n\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat4 uViewInv;\n\n//uniform float uScreenWidth;\n//uniform float uScreenHeight;\nuniform vec2 resolution;\n\n\nuniform float fov;\nuniform float near;\nuniform float far;\n\n\n\n\nuniform bool uDebug;\n\nuniform bool uUseOrthographicCamera;\nuniform float uOrthoWidth;\nuniform float uOrthoHeight;\n\n#define CLIPTASK_NONE 0\n#define CLIPTASK_HIGHLIGHT 1\n#define CLIPTASK_SHOW_INSIDE 2\n#define CLIPTASK_SHOW_OUTSIDE 3\n\n#define CLIPMETHOD_INSIDE_ANY 0\n#define CLIPMETHOD_INSIDE_ALL 1\n\nuniform int clipTask;\nuniform int clipMethod;\n#if defined(num_clipboxes) && num_clipboxes > 0\n\tuniform mat4 clipBoxes[num_clipboxes];\n#endif\n\n#if defined(num_clipspheres) && num_clipspheres > 0\n\tuniform mat4 uClipSpheres[num_clipspheres];\n#endif\n\n#if defined(num_clippolygons) && num_clippolygons > 0\n\tuniform int uClipPolygonVCount[num_clippolygons];\n\tuniform vec3 uClipPolygonVertices[num_clippolygons * 8];\n\tuniform mat4 uClipPolygonWVP[num_clippolygons];\n#endif\n\n\nuniform float size;\nuniform float minSize;\nuniform float maxSize;\n\nuniform float uPCIndex;\nuniform float uOctreeSpacing;\nuniform float uNodeSpacing;\nuniform float uOctreeSize;\nuniform vec3 uBBSize;\nuniform float uLevel;\nuniform float uVNStart;\nuniform bool uIsLeafNode;\n\nuniform vec3 uColor;\nuniform float uOpacity; \nvarying float vOpacity; //add\n\n\n\nuniform vec2 elevationRange;\nuniform vec2 intensityRange;\n\nuniform vec2 uFilterReturnNumberRange;\nuniform vec2 uFilterNumberOfReturnsRange;\nuniform vec2 uFilterPointSourceIDClipRange;\nuniform vec2 uFilterGPSTimeClipRange;\n//uniform float ufilterByNormalThreshold; \n\nuniform float uGpsScale;\nuniform float uGpsOffset;\n\nuniform vec2 uNormalizedGpsBufferRange;\n\nuniform vec3 uIntensity_gbc;\nuniform vec3 uRGB_gbc;\nuniform vec3 uExtra_gbc;\n\nuniform float uTransition;\nuniform float wRGB;\nuniform float wIntensity;\nuniform float wElevation;\nuniform float wClassification;\nuniform float wReturnNumber;\nuniform float wSourceID;\n\nuniform vec2 uExtraNormalizedRange;\nuniform vec2 uExtraRange;\nuniform float uExtraScale;\nuniform float uExtraOffset;\n\nuniform vec3 uShadowColor;\n\nuniform sampler2D visibleNodes;\nuniform sampler2D gradient;\nuniform sampler2D classificationLUT;\n\n#if defined(color_type_matcap)\nuniform sampler2D matcapTextureUniform;\n#endif\nuniform bool backfaceCulling;\n\n#if defined(num_shadowmaps) && num_shadowmaps > 0\nuniform sampler2D uShadowMap[num_shadowmaps];\nuniform mat4 uShadowWorldView[num_shadowmaps];\nuniform mat4 uShadowProj[num_shadowmaps];\n#endif\n\n\n\nvarying vec3\tvColor;\nvarying float\tvLogDepth;\nvarying vec3\tvViewPosition;\nvarying float \tvRadius;\nvarying float \tvPointSize;\n\n\nfloat round(float number){\n\treturn floor(number + 0.5);\n}\n\n// \n// ### ######## ### ######## ######## #### ## ## ######## ###### #### ######## ######## ###### \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## ######## ## ## ## ## ###### ###### ## ## ###### ###### \n// ######### ## ## ######### ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ######## ## ## ## ## #### ### ######## ###### #### ######## ######## ###### \n// \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\n\n// ---------------------\n// OCTREE\n// ---------------------\n\n#if (defined(adaptive_point_size) || defined(color_type_level_of_detail)) && defined(tree_type_octree)\n/**\n * number of 1-bits up to inclusive index position\n * number is treated as if it were an integer in the range 0-255\n *\n */\nint numberOfOnes(int number, int index){\n\tint numOnes = 0;\n\tint tmp = 128;\n\tfor(int i = 7; i >= 0; i--){\n\t\t\n\t\tif(number >= tmp){\n\t\t\tnumber = number - tmp;\n\n\t\t\tif(i <= index){\n\t\t\t\tnumOnes++;\n\t\t\t}\n\t\t}\n\t\t\n\t\ttmp = tmp / 2;\n\t}\n\n\treturn numOnes;\n}\n\n\n/**\n * checks whether the bit at index is 1\n * number is treated as if it were an integer in the range 0-255\n *\n */\nbool isBitSet(int number, int index){\n\n\t// weird multi else if due to lack of proper array, int and bitwise support in WebGL 1.0\n\tint powi = 1;\n\tif(index == 0){\n\t\tpowi = 1;\n\t}else if(index == 1){\n\t\tpowi = 2;\n\t}else if(index == 2){\n\t\tpowi = 4;\n\t}else if(index == 3){\n\t\tpowi = 8;\n\t}else if(index == 4){\n\t\tpowi = 16;\n\t}else if(index == 5){\n\t\tpowi = 32;\n\t}else if(index == 6){\n\t\tpowi = 64;\n\t}else if(index == 7){\n\t\tpowi = 128;\n\t}else{\n\t\treturn false;\n\t}\n\n\tint ndp = number / powi;\n\n\treturn mod(float(ndp), 2.0) != 0.0;\n}\n\n\n/**\n * find the LOD at the point position\n */\nfloat getLOD(){//////\n\t \n\tvec3 offset = vec3(0.0, 0.0, 0.0);\n\tint iOffset = int(uVNStart);\n\tfloat depth = uLevel;\n\tfor(float i = 0.0; i <= 30.0; i++){\n\t\tfloat nodeSizeAtLevel = uOctreeSize / pow(2.0, i + uLevel + 0.0);\n\t\t\n\t\tvec3 index3d = (position-offset) / nodeSizeAtLevel;\n\t\tindex3d = floor(index3d + 0.5);\n\t\tint index = int(round(4.0 * index3d.x + 2.0 * index3d.y + index3d.z));\n\t\t\n\t\tvec4 value = texture2D(visibleNodes, vec2(float(iOffset) / 2048.0, 0.0));\n\t\tint mask = int(round(value.r * 255.0));\n\n\t\tif(isBitSet(mask, index)){\n\t\t\t// there are more visible child nodes at this position\n\t\t\tint advanceG = int(round(value.g * 255.0)) * 256;\n\t\t\tint advanceB = int(round(value.b * 255.0));\n\t\t\tint advanceChild = numberOfOnes(mask, index - 1);\n\t\t\tint advance = advanceG + advanceB + advanceChild;\n\n\t\t\tiOffset = iOffset + advance;\n\t\t\t\n\t\t\tdepth++;\n\t\t}else{\n\t\t\t// no more visible child nodes at this position\n\t\t\t//return value.a * 255.0;\n\n\t\t\tfloat lodOffset = (255.0 * value.a) / 10.0 - 10.0;\n\n\t\t\treturn depth + lodOffset;\n\t\t}\n\t\t\n\t\toffset = offset + (vec3(1.0, 1.0, 1.0) * nodeSizeAtLevel * 0.5) * index3d;\n\t}\n\t\t\n\treturn depth;\n}\n\nfloat getSpacing(){\n\tvec3 offset = vec3(0.0, 0.0, 0.0);\n\tint iOffset = int(uVNStart);\n\tfloat depth = uLevel;\n\tfloat spacing = uNodeSpacing;\n\tfor(float i = 0.0; i <= 30.0; i++){\n\t\tfloat nodeSizeAtLevel = uOctreeSize / pow(2.0, i + uLevel + 0.0);\n\t\t\n\t\tvec3 index3d = (position-offset) / nodeSizeAtLevel;\n\t\tindex3d = floor(index3d + 0.5);\n\t\tint index = int(round(4.0 * index3d.x + 2.0 * index3d.y + index3d.z));\n\t\t\n\t\tvec4 value = texture2D(visibleNodes, vec2(float(iOffset) / 2048.0, 0.0));\n\t\tint mask = int(round(value.r * 255.0));\n\t\tfloat spacingFactor = value.a;\n\n\t\tif(i > 0.0){\n\t\t\tspacing = spacing / (255.0 * spacingFactor);\n\t\t}\n\t\t\n\n\t\tif(isBitSet(mask, index)){\n\t\t\t// there are more visible child nodes at this position\n\t\t\tint advanceG = int(round(value.g * 255.0)) * 256;\n\t\t\tint advanceB = int(round(value.b * 255.0));\n\t\t\tint advanceChild = numberOfOnes(mask, index - 1);\n\t\t\tint advance = advanceG + advanceB + advanceChild;\n\n\t\t\tiOffset = iOffset + advance;\n\n\t\t\t//spacing = spacing / (255.0 * spacingFactor);\n\t\t\t//spacing = spacing / 3.0;\n\t\t\t\n\t\t\tdepth++;\n\t\t}else{\n\t\t\t// no more visible child nodes at this position\n\t\t\treturn spacing;\n\t\t}\n\t\t\n\t\toffset = offset + (vec3(1.0, 1.0, 1.0) * nodeSizeAtLevel * 0.5) * index3d;\n\t}\n\t\t\n\treturn spacing;\n}\n\nfloat getPointSizeAttenuation(){\n\treturn pow(2.0, getLOD());\n}\n\n\n#endif\n\n\n// ---------------------\n// KD-TREE\n// ---------------------\n\n#if (defined(adaptive_point_size) || defined(color_type_level_of_detail)) && defined(tree_type_kdtree)\n\nfloat getLOD(){\n\tvec3 offset = vec3(0.0, 0.0, 0.0);\n\tfloat iOffset = 0.0;\n\tfloat depth = 0.0;\n\t\t\n\t\t\n\tvec3 size = uBBSize;\t\n\tvec3 pos = position;\n\t\t\n\tfor(float i = 0.0; i <= 1000.0; i++){\n\t\t\n\t\tvec4 value = texture2D(visibleNodes, vec2(iOffset / 2048.0, 0.0));\n\t\t\n\t\tint children = int(value.r * 255.0);\n\t\tfloat next = value.g * 255.0;\n\t\tint split = int(value.b * 255.0);\n\t\t\n\t\tif(next == 0.0){\n\t\t \treturn depth;\n\t\t}\n\t\t\n\t\tvec3 splitv = vec3(0.0, 0.0, 0.0);\n\t\tif(split == 1){\n\t\t\tsplitv.x = 1.0;\n\t\t}else if(split == 2){\n\t\t \tsplitv.y = 1.0;\n\t\t}else if(split == 4){\n\t\t \tsplitv.z = 1.0;\n\t\t}\n\t\t\n\t\tiOffset = iOffset + next;\n\t\t\n\t\tfloat factor = length(pos * splitv / size);\n\t\tif(factor < 0.5){\n\t\t\t// left\n\t\tif(children == 0 || children == 2){\n\t\t\t\treturn depth;\n\t\t\t}\n\t\t}else{\n\t\t\t// right\n\t\t\tpos = pos - size * splitv * 0.5;\n\t\t\tif(children == 0 || children == 1){\n\t\t\t\treturn depth;\n\t\t\t}\n\t\t\tif(children == 3){\n\t\t\t\tiOffset = iOffset + 1.0;\n\t\t\t}\n\t\t}\n\t\tsize = size * ((1.0 - (splitv + 1.0) / 2.0) + 0.5);\n\t\t\n\t\tdepth++;\n\t}\n\t\t\n\t\t\n\treturn depth;\t\n}\n\nfloat getPointSizeAttenuation(){\n\treturn 0.5 * pow(1.3, getLOD());\n}\n\n#endif\n\n\n\n// \n// ### ######## ######## ######## #### ######## ## ## ######## ######## ###### \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ######## ## ######## ## ## ## ###### ###### \n// ######### ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## #### ######## ####### ## ######## ###### \n// \n\n\n\n// formula adapted from: http://www.dfstudios.co.uk/articles/programming/image-programming-algorithms/image-processing-algorithms-part-5-contrast-adjustment/\nfloat getContrastFactor(float contrast){\n\treturn (1.0158730158730156 * (contrast + 1.0)) / (1.0158730158730156 - contrast);\n}\n\nvec3 getRGB(){\n\tvec3 rgb = color;\n\t\n\trgb = pow(rgb, vec3(uRGB_gbc.x));\n\trgb = rgb + uRGB_gbc.y;\n\trgb = (rgb - 0.5) * getContrastFactor(uRGB_gbc.z) + 0.5;\n\trgb = clamp(rgb, 0.0, 1.0);\n\n\treturn rgb;\n}\n\nfloat getIntensity(){\n\tfloat w = (intensity - intensityRange.x) / (intensityRange.y - intensityRange.x);\n\tw = pow(w, uIntensity_gbc.x);\n\tw = w + uIntensity_gbc.y;\n\tw = (w - 0.5) * getContrastFactor(uIntensity_gbc.z) + 0.5;\n\tw = clamp(w, 0.0, 1.0);\n\n\treturn w;\n}\n\nvec3 getGpsTime(){\n\n\tfloat w = (gpsTime + uGpsOffset) * uGpsScale;\n\n\n\tvec3 c = texture2D(gradient, vec2(w, 1.0 - w)).rgb;\n\n\n\t// vec2 r = uNormalizedGpsBufferRange;\n\t// float w = gpsTime * (r.y - r.x) + r.x;\n\t// w = clamp(w, 0.0, 1.0);\n\t// vec3 c = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\t\n\treturn c;\n}\n\nvec3 getElevation(){\n\tvec4 world = modelMatrix * vec4( position, 1.0 );\n\tfloat w = (world.z - elevationRange.x) / (elevationRange.y - elevationRange.x);\n\tvec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\t\n\treturn cElevation;\n}\n\nvec4 getClassification(){\n\tvec2 uv = vec2(classification / 255.0, 0.5);\n\tvec4 classColor = texture2D(classificationLUT, uv);\n\t\n\treturn classColor;\n}\n\nvec3 getReturns(){\n\n\t// 0b 00_000_111\n\tfloat rn = mod(returnNumber, 8.0);\n\t// 0b 00_111_000\n\tfloat nr = mod(returnNumber / 8.0, 8.0);\n\n\tif(nr <= 1.0){\n\t\treturn vec3(1.0, 0.0, 0.0);\n\t}else{\n\t\treturn vec3(0.0, 1.0, 0.0);\n\t}\n\n\t// return vec3(nr / 4.0, 0.0, 0.0);\n\n\t// if(nr == 1.0){\n\t// \treturn vec3(1.0, 1.0, 0.0);\n\t// }else{\n\t// \tif(rn == 1.0){\n\t// \t\treturn vec3(1.0, 0.0, 0.0);\n\t// \t}else if(rn == nr){\n\t// \t\treturn vec3(0.0, 0.0, 1.0);\n\t// \t}else{\n\t// \t\treturn vec3(0.0, 1.0, 0.0);\n\t// \t}\n\t// }\n\n\t// if(numberOfReturns == 1.0){\n\t// \treturn vec3(1.0, 1.0, 0.0);\n\t// }else{\n\t// \tif(returnNumber == 1.0){\n\t// \t\treturn vec3(1.0, 0.0, 0.0);\n\t// \t}else if(returnNumber == numberOfReturns){\n\t// \t\treturn vec3(0.0, 0.0, 1.0);\n\t// \t}else{\n\t// \t\treturn vec3(0.0, 1.0, 0.0);\n\t// \t}\n\t// }\n}\n\nvec3 getReturnNumber(){\n\tif(numberOfReturns == 1.0){\n\t\treturn vec3(1.0, 1.0, 0.0);\n\t}else{\n\t\tif(returnNumber == 1.0){\n\t\t\treturn vec3(1.0, 0.0, 0.0);\n\t\t}else if(returnNumber == numberOfReturns){\n\t\t\treturn vec3(0.0, 0.0, 1.0);\n\t\t}else{\n\t\t\treturn vec3(0.0, 1.0, 0.0);\n\t\t}\n\t}\n}\n\nvec3 getNumberOfReturns(){\n\tfloat value = numberOfReturns;\n\n\tfloat w = value / 6.0;\n\n\tvec3 color = texture2D(gradient, vec2(w, 1.0 - w)).rgb;\n\n\treturn color;\n}\n\nvec3 getSourceID(){\n\tfloat w = mod(pointSourceID, 10.0) / 10.0;\n\treturn texture2D(gradient, vec2(w,1.0 - w)).rgb;\n}\n\nvec3 getCompositeColor(){\n\tvec3 c;\n\tfloat w;\n\n\tc += wRGB * getRGB();\n\tw += wRGB;\n\t\n\tc += wIntensity * getIntensity() * vec3(1.0, 1.0, 1.0);\n\tw += wIntensity;\n\t\n\tc += wElevation * getElevation();\n\tw += wElevation;\n\t\n\tc += wReturnNumber * getReturnNumber();\n\tw += wReturnNumber;\n\t\n\tc += wSourceID * getSourceID();\n\tw += wSourceID;\n\t\n\tvec4 cl = wClassification * getClassification();\n\tc += cl.a * cl.rgb;\n\tw += wClassification * cl.a;\n\n\tc = c / w;\n\t\n\tif(w == 0.0){\n\t\t//c = color;\n\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t}\n\t\n\treturn c;\n}\n\n\nvec3 getNormal(){\n\t//vec3 n_hsv = vec3( modelMatrix * vec4( normal, 0.0 )) * 0.5 + 0.5; // (n_world.xyz + vec3(1.,1.,1.)) / 2.;\n\tvec3 n_view = normalize( vec3(modelViewMatrix * vec4( normal, 0.0 )) );\n\treturn n_view;\n}\nbool applyBackfaceCulling() {\n\t// Black not facing vertices / Backface culling\n \n\tvec3 e = normalize(vec3(modelViewMatrix * vec4( position, 1. )));\n\tvec3 n = getNormal(); // normalize( vec3(modelViewMatrix * vec4( normal, 0.0 )) );\n\n\tif((uUseOrthographicCamera && n.z <= 0.) || (!uUseOrthographicCamera && dot( n, e ) >= 0.)) { \n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}\n\n#if defined(color_type_matcap)\n// Matcap Material\nvec3 getMatcap(){ \n\tvec3 eye = normalize( vec3( modelViewMatrix * vec4( position, 1. ) ) ); \n\tif(uUseOrthographicCamera) { \n\t\teye = vec3(0., 0., -1.);\n\t}\n\tvec3 r_en = reflect( eye, getNormal() ); // or r_en = e - 2. * dot( n, e ) * n;\n\tfloat m = 2. * sqrt(pow( r_en.x, 2. ) + pow( r_en.y, 2. ) + pow( r_en.z + 1., 2. ));\n\tvec2 vN = r_en.xy / m + .5;\n\treturn texture2D(matcapTextureUniform, vN).rgb; \n}\n#endif\n\nvec3 getExtra(){\n\n\tfloat w = (aExtra + uExtraOffset) * uExtraScale;\n\tw = clamp(w, 0.0, 1.0);\n\n\tvec3 color = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n\t// vec2 r = uExtraNormalizedRange;\n\n\t// float w = aExtra * (r.y - r.x) + r.x;\n\n\t// w = (w - uExtraRange.x) / (uExtraRange.y - uExtraRange.x);\n\n\t// w = clamp(w, 0.0, 1.0);\n\n\t// vec3 color = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n\treturn color;\n}\n\nvec3 getColor(){\n\tvec3 color;\n\t\n\t#ifdef color_type_rgba\n\t\tcolor = getRGB();\n \n \n\t#elif defined color_type_height || defined color_type_elevation\n\t\tcolor = getElevation();\n\t#elif defined color_type_rgb_height\n\t\tvec3 cHeight = getElevation();\n\t\tcolor = (1.0 - uTransition) * getRGB() + uTransition * cHeight;\n\t#elif defined color_type_depth\n\t\tfloat linearDepth = gl_Position.w;\n\t\tfloat expDepth = (gl_Position.z / gl_Position.w) * 0.5 + 0.5;\n\t\tcolor = vec3(linearDepth, expDepth, 0.0);\n\t\t//color = vec3(1.0, 0.5, 0.3);\n\t#elif defined color_type_intensity\n\t\tfloat w = getIntensity();\n\t\tcolor = vec3(w, w, w);\n\t#elif defined color_type_gps_time\n\t\tcolor = getGpsTime();\n\t#elif defined color_type_intensity_gradient\n\t\tfloat w = getIntensity();\n\t\tcolor = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\t#elif defined color_type_color\n\t\tcolor = uColor;\n\t#elif defined color_type_level_of_detail\n\t\tfloat depth = getLOD();\n\t\tfloat w = depth / 10.0;\n\t\tcolor = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\t#elif defined color_type_indices\n\t\tcolor = indices.rgb;\n\t#elif defined color_type_classification\n\t\tvec4 cl = getClassification(); \n\t\tcolor = cl.rgb;\n\t#elif defined color_type_return_number\n\t\tcolor = getReturnNumber();\n\t#elif defined color_type_returns\n\t\tcolor = getReturns();\n\t#elif defined color_type_number_of_returns\n\t\tcolor = getNumberOfReturns();\n\t#elif defined color_type_source_id\n\t\tcolor = getSourceID();\n\t#elif defined color_type_point_source_id\n\t\tcolor = getSourceID();\n\t#elif defined color_type_normal\n\t\tcolor = (modelMatrix * vec4(normal, 0.0)).xyz;\n\t#elif defined color_type_phong\n\t\tcolor = color;\n\t#elif defined color_type_composite\n\t\tcolor = getCompositeColor();\n\t#elif defined color_type_matcap\n\t\tcolor = getMatcap();\n\t#else \n\t\tcolor = getExtra();\n\t#endif\n\t\n\tif (backfaceCulling && applyBackfaceCulling()){\n //color = vec3(0.);\n }\n //applyBackfaceCulling直接返回false或者注释color = vec3(0.);都没问题\n\treturn color;\n}\n\nfloat getPointSize(){\n\tfloat pointSize = 1.0;\n\t\n\tfloat slope = tan(fov / 2.0);\n\tfloat projFactor = -0.5 * resolution.y / (slope * vViewPosition.z);\n \n \n \n /*\n\tfloat scale = length(\n\t\tmodelViewMatrix * vec4(0, 0, 0, 1) - \n\t\tmodelViewMatrix * vec4(uOctreeSpacing, 0, 0, 1)\n\t) / uOctreeSpacing;\n \n\tprojFactor = projFactor * scale;\n\t*/\n \n \n\tfloat r = uOctreeSpacing * 1.7;\n\t//vRadius = r;\n \n \n\t#if defined fixed_point_size\n\t\tpointSize = size;\n\t#elif defined attenuated_point_size\n\t\tif(uUseOrthographicCamera){\n\t\t\tpointSize = size * 10.0; //加个乘数\n\t\t}else{ //近大远小,模拟真实mesh,边缘放大\n\t\t\t//pointSize = size * spacing * projFactor; //spacing是attribute 为空 如果有这个值就能更自适应填补\n //pointSize = size * uOctreeSpacing * projFactor / 18.0; //直接用cloud的spacing里,不过因为都一样所以可能没有什么意义\n\t\t\t//pointSize = pointSize * projFactor;\n pointSize = size * projFactor ;\n\t\t}\n\t#elif defined adaptive_point_size\n\t\tif(uUseOrthographicCamera) {\n\t\t\tfloat worldSpaceSize = 1.0 * size * r / getPointSizeAttenuation();\n\t\t\tpointSize = (worldSpaceSize / uOrthoWidth) * resolution.x; //uScreenWidth;\n\t\t} else {\n\t\t\tfloat worldSpaceSize = 1.0 * size * r / getPointSizeAttenuation();\n\t\t\tpointSize = worldSpaceSize * projFactor;\n\t\t}\n\t#endif\n\n\tpointSize = max(minSize, pointSize);\n\tpointSize = min(maxSize, pointSize);\n\t\n\tvRadius = pointSize / projFactor;\n\n\treturn pointSize;\n}\n\n#if defined(num_clippolygons) && num_clippolygons > 0\nbool pointInClipPolygon(vec3 point, int polyIdx) {\n\n\tmat4 wvp = uClipPolygonWVP[polyIdx];\n\t//vec4 screenClipPos = uClipPolygonVP[polyIdx] * modelMatrix * vec4(point, 1.0);\n\t//screenClipPos.xy = screenClipPos.xy / screenClipPos.w * 0.5 + 0.5;\n\n\tvec4 pointNDC = wvp * vec4(point, 1.0);\n\tpointNDC.xy = pointNDC.xy / pointNDC.w;\n\n\tint j = uClipPolygonVCount[polyIdx] - 1;\n\tbool c = false;\n\tfor(int i = 0; i < 8; i++) {\n\t\tif(i == uClipPolygonVCount[polyIdx]) {\n\t\t\tbreak;\n\t\t}\n\n\t\t//vec4 verti = wvp * vec4(uClipPolygonVertices[polyIdx * 8 + i], 1);\n\t\t//vec4 vertj = wvp * vec4(uClipPolygonVertices[polyIdx * 8 + j], 1);\n\n\t\t//verti.xy = verti.xy / verti.w;\n\t\t//vertj.xy = vertj.xy / vertj.w;\n\n\t\t//verti.xy = verti.xy / verti.w * 0.5 + 0.5;\n\t\t//vertj.xy = vertj.xy / vertj.w * 0.5 + 0.5;\n\n\t\tvec3 verti = uClipPolygonVertices[polyIdx * 8 + i];\n\t\tvec3 vertj = uClipPolygonVertices[polyIdx * 8 + j];\n\n\t\tif( ((verti.y > pointNDC.y) != (vertj.y > pointNDC.y)) && \n\t\t\t(pointNDC.x < (vertj.x-verti.x) * (pointNDC.y-verti.y) / (vertj.y-verti.y) + verti.x) ) {\n\t\t\tc = !c;\n\t\t}\n\t\tj = i;\n\t}\n\n\treturn c;\n}\n#endif\n\nvoid doClipping(){\n\n\t{\n\t\tvec4 cl = getClassification(); \n\t\tif(cl.a == 0.0){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\n\t#if defined(clip_return_number_enabled)\n\t{ // return number filter\n\t\tvec2 range = uFilterReturnNumberRange;\n\t\tif(returnNumber < range.x || returnNumber > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\t#if defined(clip_number_of_returns_enabled)\n\t{ // number of return filter\n\t\tvec2 range = uFilterNumberOfReturnsRange;\n\t\tif(numberOfReturns < range.x || numberOfReturns > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\t#if defined(clip_gps_enabled)\n\t{ // GPS time filter\n\t\tfloat time = (gpsTime + uGpsOffset) * uGpsScale;\n\t\tvec2 range = uFilterGPSTimeClipRange;\n\n\t\tif(time < range.x || time > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\t#if defined(clip_point_source_id_enabled)\n\t{ // point source id filter\n\t\tvec2 range = uFilterPointSourceIDClipRange;\n\t\tif(pointSourceID < range.x || pointSourceID > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\tint clipVolumesCount = 0;\n\tint insideCount = 0;\n\n\t#if defined(num_clipboxes) && num_clipboxes > 0\n\t\tfor(int i = 0; i < num_clipboxes; i++){\n\t\t\tvec4 clipPosition = clipBoxes[i] * modelMatrix * vec4( position, 1.0 );\n\t\t\tbool inside = -0.5 <= clipPosition.x && clipPosition.x <= 0.5;\n\t\t\tinside = inside && -0.5 <= clipPosition.y && clipPosition.y <= 0.5;\n\t\t\tinside = inside && -0.5 <= clipPosition.z && clipPosition.z <= 0.5;\n\n\t\t\tinsideCount = insideCount + (inside ? 1 : 0);\n\t\t\tclipVolumesCount++;\n\t\t}\t\n\t#endif\n\n\t#if defined(num_clippolygons) && num_clippolygons > 0\n\t\tfor(int i = 0; i < num_clippolygons; i++) {\n\t\t\tbool inside = pointInClipPolygon(position, i);\n\n\t\t\tinsideCount = insideCount + (inside ? 1 : 0);\n\t\t\tclipVolumesCount++;\n\t\t}\n\t#endif\n\n\tbool insideAny = insideCount > 0;\n\tbool insideAll = (clipVolumesCount > 0) && (clipVolumesCount == insideCount);\n\n\tif(clipMethod == CLIPMETHOD_INSIDE_ANY){\n\t\tif(insideAny && clipTask == CLIPTASK_HIGHLIGHT){\n\t\t\tvColor.r += 0.5;\n\t\t}else if(!insideAny && clipTask == CLIPTASK_SHOW_INSIDE){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n\t\t}else if(insideAny && clipTask == CLIPTASK_SHOW_OUTSIDE){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n\t\t}\n\t}else if(clipMethod == CLIPMETHOD_INSIDE_ALL){\n\t\tif(insideAll && clipTask == CLIPTASK_HIGHLIGHT){\n\t\t\tvColor.r += 0.5;\n\t\t}else if(!insideAll && clipTask == CLIPTASK_SHOW_INSIDE){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n\t\t}else if(insideAll && clipTask == CLIPTASK_SHOW_OUTSIDE){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n\t\t}\n\t}\n}\n\n\n\n// \n// ## ## ### #### ## ## \n// ### ### ## ## ## ### ## \n// #### #### ## ## ## #### ## \n// ## ### ## ## ## ## ## ## ## \n// ## ## ######### ## ## #### \n// ## ## ## ## ## ## ### \n// ## ## ## ## #### ## ## \n//\n\n\nvec2 getSamplerCoord( vec3 direction ) \n{\n direction = normalize(direction);\n float tx=atan(direction.x,-direction.y)/(PI*2.0)+0.5;\n float ty=acos(direction.z)/PI;\n\n return vec2(tx,ty);\n} \n\nvec3 transformAxis( vec3 direction ) //navvis->4dkk\n{\n float y = direction.y;\n direction.y = direction.z;\n direction.z = -y;\n return direction;\n}\n\nvoid main() {\n //bool filtered_by_normal = false; \n float normalZ = 0.0;\n\n\n\n #ifdef use_filter_by_normal\n /*if(abs(getNormal().z) > 0.4) { //ufilterByNormalThreshold 暂定 3\n\t\t\t// Move point outside clip space space to discard it.\n\t\t\t//gl_Position = vec4(0.0, 0.0, 2.0, 1.0); //gl_Position的可视区域是 x,y,z都是[-1,1] \n //return;\n //filtered_by_normal = true; //标记一下。不直接不绘制,因为有的法线都是垂直向上\n \n\t\t}*/\n \n normalZ = abs(getNormal().z);\n #endif\n \n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0 );\n vViewPosition = mvPosition.xyz;\n gl_Position = projectionMatrix * mvPosition;\n vLogDepth = log2(-mvPosition.z);\n \n \n \n // COLOR\n //加-------------------\n #if defined(usePanoMap)\n vec4 worldPosition = modelMatrix * vec4(position, 1.0);\n \n vec3 positionLocalToPanoCenter0 = worldPosition.xyz - pano0Position;\n vec3 vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz; \n vWorldPosition0.x *= -1.0;\n vWorldPosition0 = transformAxis(vWorldPosition0);\n \n vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;\n vec3 vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz; \n vWorldPosition1.x *= -1.0;\n vWorldPosition1 = transformAxis(vWorldPosition1);\n \n /*\n vec2 samplerCoord0 = getSamplerCoord(vWorldPosition0.xyz);\n vec2 samplerCoord1 = getSamplerCoord(vWorldPosition1.xyz); \n vec4 colorFromPano0 = texture2D(pano0Map,samplerCoord0);\n vec4 colorFromPano1 = texture2D(pano1Map,samplerCoord1);\n */\n \n \n \n \n vec4 colorFromPano0=textureCube(pano0Map,vWorldPosition0.xyz);\n vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1.xyz);\n\n vColor = mix(colorFromPano0,colorFromPano1,progress).xyz; \n\n \n //float easeInOutRatio = 0.0; //缓冲,渐变点云到贴图的颜色 \n if(progress < easeInOutRatio){\n float easeProgress = (easeInOutRatio - progress) / easeInOutRatio;\n vec3 vColor1 = getColor();\n vColor = mix(vColor,vColor1,easeProgress); \n }else if(progress > 1.0 - easeInOutRatio){ \n float easeProgress = (progress - (1.0 - easeInOutRatio) ) / easeInOutRatio;\n vec3 vColor1 = getColor();\n vColor = mix(vColor,vColor1,easeProgress); \n }\n \n\n #else\n \n vColor = getColor();\n \n #endif\n \n \n //------------------- \n \n #ifdef attenuated_opacity \n //zoom不会改变z 所以这并不是用在分屏时候的\n //vOpacity = uOpacity * exp(-length(-mvPosition.xyz) / 1000.0); // e为底的指数函数 opacityAttenuation = 1000\n vOpacity = uOpacity * exp(gl_Position.z/50.0); \n vOpacity = clamp(vOpacity, 0.001, 1.0); \n /*if(filtered_by_normal){//垂直朝相机时降低透明度 \n vOpacity *= 0.2; \n vOpacity = clamp(vOpacity, 0.0001, 0.1); \n } */ \n #else\n vOpacity = uOpacity;\n /*if(filtered_by_normal){//垂直朝相机时降低透明度 \n /*if(filtered_by_normal){//垂直朝相机时降低透明度 \n vOpacity *= 0.3; \n vOpacity = clamp(vOpacity, 0.0001, 0.1); \n }*/ \n \n vOpacity *= max(0.1, (1.0 - normalZ));\n #endif\n\t \n\n // POINT SIZE\n float pointSize = getPointSize();\n \n gl_PointSize = pointSize;\n vPointSize = pointSize;\n\n \n \n \n \n\n // only for "replacing" approaches\n // if(getLOD() != uLevel){\n // \tgl_Position = vec4(10.0, 10.0, 10.0, 1.0);\n // }\n\n\n #if defined hq_depth_pass\n float originalDepth = gl_Position.w;\n float adjustedDepth = originalDepth + 2.0 * vRadius;\n float adjust = adjustedDepth / originalDepth;\n\n mvPosition.xyz = mvPosition.xyz * adjust;\n gl_Position = projectionMatrix * mvPosition;\n #endif\n\n\n // CLIPPING\n doClipping();\n\n #if defined(num_clipspheres) && num_clipspheres > 0\n for(int i = 0; i < num_clipspheres; i++){\n vec4 sphereLocal = uClipSpheres[i] * mvPosition;\n\n float distance = length(sphereLocal.xyz);\n\n if(distance < 1.0){\n float w = distance;\n vec3 cGradient = texture2D(gradient, vec2(w, 1.0 - w)).rgb;\n \n vColor = cGradient;\n //vColor = cGradient * 0.7 + vColor * 0.3;\n }\n }\n #endif\n\n #if defined(num_shadowmaps) && num_shadowmaps > 0\n\n const float sm_near = 0.1;\n const float sm_far = 10000.0;\n\n for(int i = 0; i < num_shadowmaps; i++){\n vec3 viewPos = (uShadowWorldView[i] * vec4(position, 1.0)).xyz;\n float distanceToLight = abs(viewPos.z);\n \n vec4 projPos = uShadowProj[i] * uShadowWorldView[i] * vec4(position, 1);\n vec3 nc = projPos.xyz / projPos.w;\n \n float u = nc.x * 0.5 + 0.5;\n float v = nc.y * 0.5 + 0.5;\n\n vec2 sampleStep = vec2(1.0 / (2.0*1024.0), 1.0 / (2.0*1024.0)) * 1.5;\n vec2 sampleLocations[9];\n sampleLocations[0] = vec2(0.0, 0.0);\n sampleLocations[1] = sampleStep;\n sampleLocations[2] = -sampleStep;\n sampleLocations[3] = vec2(sampleStep.x, -sampleStep.y);\n sampleLocations[4] = vec2(-sampleStep.x, sampleStep.y);\n\n sampleLocations[5] = vec2(0.0, sampleStep.y);\n sampleLocations[6] = vec2(0.0, -sampleStep.y);\n sampleLocations[7] = vec2(sampleStep.x, 0.0);\n sampleLocations[8] = vec2(-sampleStep.x, 0.0);\n\n float visibleSamples = 0.0;\n float numSamples = 0.0;\n\n float bias = vRadius * 2.0;\n\n for(int j = 0; j < 9; j++){\n vec4 depthMapValue = texture2D(uShadowMap[i], vec2(u, v) + sampleLocations[j]);\n\n float linearDepthFromSM = depthMapValue.x + bias;\n float linearDepthFromViewer = distanceToLight;\n\n if(linearDepthFromSM > linearDepthFromViewer){\n visibleSamples += 1.0;\n }\n\n numSamples += 1.0;\n }\n\n float visibility = visibleSamples / numSamples;\n\n if(u < 0.0 || u > 1.0 || v < 0.0 || v > 1.0 || nc.x < -1.0 || nc.x > 1.0 || nc.y < -1.0 || nc.y > 1.0 || nc.z < -1.0 || nc.z > 1.0){\n //vColor = vec3(0.0, 0.0, 0.2);\n }else{\n //vColor = vec3(1.0, 1.0, 1.0) * visibility + vec3(1.0, 1.0, 1.0) * vec3(0.5, 0.0, 0.0) * (1.0 - visibility);\n vColor = vColor * visibility + vColor * uShadowColor * (1.0 - visibility);\n }\n\n\n }\n\n #endif\n\n \n \n}\n', "pointcloud.fs": "\n#if defined paraboloid_point_shape\n\t#extension GL_EXT_frag_depth : enable\n#endif\n#define PI 3.141592653589793\n\n\n\nprecision highp float;\nprecision highp int;\n\n/*\n#if defined(usePanoMap) \n \n uniform samplerCube pano0Map; //随便设置一个samplerCube去使用都会让点云消失\n uniform samplerCube pano1Map;\n \n uniform float progress;\n uniform float easeInOutRatio;\n\n \n uniform vec3 pano0Position;\n uniform mat4 pano0Matrix; \n uniform vec3 pano1Position;\n uniform mat4 pano1Matrix;\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n\n#endif \n*/\n\n\n\n//------------\n\n\n\n\n\nuniform mat4 viewMatrix;\nuniform mat4 uViewInv;\nuniform mat4 uProjInv;\nuniform vec3 cameraPosition;\n\n\nuniform mat4 projectionMatrix;\n//uniform float uOpacity;\nvarying float vOpacity; //add\n\nuniform float blendHardness;\nuniform float blendDepthSupplement;\nuniform float fov;\nuniform float uSpacing;\nuniform float near;\nuniform float far;\nuniform float uPCIndex;\nuniform float uScreenWidth;\nuniform float uScreenHeight;\n\nvarying vec3\tvColor;\nvarying float\tvLogDepth;\nvarying vec3\tvViewPosition;\nvarying float\tvRadius;\nvarying float \tvPointSize;\nvarying vec3 \tvPosition;\n\n\nfloat specularStrength = 1.0;\n\n\nvec2 getSamplerCoord( vec3 direction ) \n{\n direction = normalize(direction);\n float tx=atan(direction.x,-direction.y)/(PI*2.0)+0.5;\n float ty=acos(direction.z)/PI;\n\n return vec2(tx,ty);\n} \n\n\n\n\nvoid main() {\n\n vec3 color = vColor; \n\t \n \n /*#if defined(usePanoMap) //加 经测试,即使全部写在fragment里也是无论pointsize多大都是一个点一个颜色,所以干脆写在vectex里\n \n \n vec4 colorFromPano0=textureCube(pano0Map,vWorldPosition0.xyz);\n vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1.xyz);\n \n color = mix(colorFromPano0,colorFromPano1,progress).xyz; \n \n \n //float easeInOutRatio = 0.0; //缓冲,渐变点云到贴图的颜色 \n if(progress < easeInOutRatio){\n float easeProgress = (easeInOutRatio - progress) / easeInOutRatio; \n color = mix(color,vColor,easeProgress); \n }else if(progress > 1.0 - easeInOutRatio){ \n float easeProgress = (progress - (1.0 - easeInOutRatio) ) / easeInOutRatio; \n color = mix(color,vColor,easeProgress); \n }\n \n \n #else \n color = vColor;\n #endif*/\n \n \n \n\tfloat depth = gl_FragCoord.z;\n\n\t#if defined(circle_point_shape) || defined(paraboloid_point_shape) \n\t\tfloat u = 2.0 * gl_PointCoord.x - 1.0;\n\t\tfloat v = 2.0 * gl_PointCoord.y - 1.0;\n\t#endif\n\t\n\t#if defined(circle_point_shape) \n\t\tfloat cc = u*u + v*v;\n\t\tif(cc > 1.0){\n\t\t\tdiscard;\n\t\t}\n\t#endif\n\t\n\n \n\n\t\n \n #if defined color_type_indices //pick point recognize\n\t\tgl_FragColor = vec4(color, uPCIndex / 255.0); //uPCIndex : node Index\n\t#else\n\t\tgl_FragColor = vec4(color, vOpacity);\n\t#endif\n \n \n \n \n \n \n \n \n\n\t#if defined paraboloid_point_shape\n\t\tfloat wi = 0.0 - ( u*u + v*v);\n\t\tvec4 pos = vec4(vViewPosition, 1.0);\n\t\tpos.z += wi * vRadius;\n\t\tfloat linearDepth = -pos.z;\n\t\tpos = projectionMatrix * pos;\n\t\tpos = pos / pos.w;\n\t\tfloat expDepth = pos.z;\n\t\tdepth = (pos.z + 1.0) / 2.0;\n\t\tgl_FragDepthEXT = depth;\n\t\t\n\t\t#if defined(color_type_depth)\n\t\t\tcolor.r = linearDepth;\n\t\t\tcolor.g = expDepth;\n\t\t#endif\n\t\t\n\t\t#if defined(use_edl)\n\t\t\tgl_FragColor.a = log2(linearDepth);\n\t\t#endif\n\t\t\n\t#else\n\t\t#if defined(use_edl)\n\t\t\tgl_FragColor.a = vLogDepth;\n\t\t#endif\n\t#endif\n\n\t#if defined(weighted_splats)\n\t\tfloat distance = 2.0 * length(gl_PointCoord.xy - 0.5);\n\t\tfloat weight = max(0.0, 1.0 - distance);\n\t\tweight = pow(weight, 1.5);\n\n\t\tgl_FragColor.a = weight;\n\t\tgl_FragColor.xyz = gl_FragColor.xyz * weight;\n\t#endif\n\n\t//gl_FragColor = vec4(0.0, 0.7, 0.0, 1.0);\n\t\n}\n\n\n", "pointcloud_sm.vs": "\nprecision mediump float;\nprecision mediump int;\n\nattribute vec3 position;\nattribute vec3 color;\n\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\n\nuniform float uScreenWidth;\nuniform float uScreenHeight;\nuniform float near;\nuniform float far;\n\nuniform float uSpacing;\nuniform float uOctreeSize;\nuniform float uLevel;\nuniform float uVNStart;\n\nuniform sampler2D visibleNodes;\n\nvarying float vLinearDepth;\nvarying vec3 vColor;\n\n#define PI 3.141592653589793\n\n\n\n// ---------------------\n// OCTREE\n// ---------------------\n\n#if defined(adaptive_point_size)\n/**\n * number of 1-bits up to inclusive index position\n * number is treated as if it were an integer in the range 0-255\n *\n */\nfloat numberOfOnes(float number, float index){\n\tfloat tmp = mod(number, pow(2.0, index + 1.0));\n\tfloat numOnes = 0.0;\n\tfor(float i = 0.0; i < 8.0; i++){\n\t\tif(mod(tmp, 2.0) != 0.0){\n\t\t\tnumOnes++;\n\t\t}\n\t\ttmp = floor(tmp / 2.0);\n\t}\n\treturn numOnes;\n}\n\n\n/**\n * checks whether the bit at index is 1\n * number is treated as if it were an integer in the range 0-255\n *\n */\nbool isBitSet(float number, float index){\n\treturn mod(floor(number / pow(2.0, index)), 2.0) != 0.0;\n}\n\n\n/**\n * find the LOD at the point position\n */\nfloat getLOD(){\n\t\n\tvec3 offset = vec3(0.0, 0.0, 0.0);\n\tfloat iOffset = uVNStart;\n\tfloat depth = uLevel;\n\tfor(float i = 0.0; i <= 30.0; i++){\n\t\tfloat nodeSizeAtLevel = uOctreeSize / pow(2.0, i + uLevel + 0.0);\n\t\t\n\t\tvec3 index3d = (position-offset) / nodeSizeAtLevel;\n\t\tindex3d = floor(index3d + 0.5);\n\t\tfloat index = 4.0 * index3d.x + 2.0 * index3d.y + index3d.z;\n\t\t\n\t\tvec4 value = texture2D(visibleNodes, vec2(iOffset / 2048.0, 0.0));\n\t\tfloat mask = value.r * 255.0;\n\t\tif(isBitSet(mask, index)){\n\t\t\t// there are more visible child nodes at this position\n\t\t\tiOffset = iOffset + value.g * 255.0 * 256.0 + value.b * 255.0 + numberOfOnes(mask, index - 1.0);\n\t\t\tdepth++;\n\t\t}else{\n\t\t\t// no more visible child nodes at this position\n\t\t\treturn depth;\n\t\t}\n\t\t\n\t\toffset = offset + (vec3(1.0, 1.0, 1.0) * nodeSizeAtLevel * 0.5) * index3d;\n\t}\n\t\t\n\treturn depth;\n}\n\n#endif\n\nfloat getPointSize(){\n\tfloat pointSize = 1.0;\n\t\n\tfloat slope = tan(fov / 2.0);\n\tfloat projFactor = -0.5 * uScreenHeight / (slope * vViewPosition.z);\n\t\n\tfloat r = uOctreeSpacing * 1.5;\n\tvRadius = r;\n\t#if defined fixed_point_size\n\t\tpointSize = size;\n\t#elif defined attenuated_point_size\n\t\tif(uUseOrthographicCamera){\n\t\t\tpointSize = size;\t\t\t\n\t\t}else{\n\t\t\tpointSize = pointSize * projFactor;\n\t\t}\n\t#elif defined adaptive_point_size\n\t\tif(uUseOrthographicCamera) {\n\t\t\tfloat worldSpaceSize = 1.5 * size * r / getPointSizeAttenuation();\n\t\t\tpointSize = (worldSpaceSize / uOrthoWidth) * uScreenWidth;\n\t\t} else {\n\t\t\tfloat worldSpaceSize = 1.5 * size * r / getPointSizeAttenuation();\n\t\t\tpointSize = worldSpaceSize * projFactor;\n\t\t}\n\t#endif\n\n\tpointSize = max(minSize, pointSize);\n\tpointSize = min(maxSize, pointSize);\n\t\n\tvRadius = pointSize / projFactor;\n\n\treturn pointSize;\n}\n\n\nvoid main() {\n\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tvLinearDepth = gl_Position.w;\n\n\tfloat pointSize = getPointSize();\n\tgl_PointSize = pointSize;\n\n}\n", "pointcloud_sm.fs": "\nprecision mediump float;\nprecision mediump int;\n\nvarying vec3 vColor;\nvarying float vLinearDepth;\n\nvoid main() {\n\n\t//gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n\t//gl_FragColor = vec4(vColor, 1.0);\n\t//gl_FragColor = vec4(vLinearDepth, pow(vLinearDepth, 2.0), 0.0, 1.0);\n\tgl_FragColor = vec4(vLinearDepth, vLinearDepth / 30.0, vLinearDepth / 30.0, 1.0);\n\t\n}\n\n\n", "normalize.vs": "\nprecision mediump float;\nprecision mediump int;\n\nattribute vec3 position;\nattribute vec2 uv;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nvarying vec2 vUv;\n\nvoid main() {\n\tvUv = uv;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);\n}", "normalize.fs": "\n#extension GL_EXT_frag_depth : enable\n\nprecision mediump float;\nprecision mediump int;\n\nuniform sampler2D uWeightMap;\nuniform sampler2D uDepthMap;\n\nvarying vec2 vUv;\n\nvoid main() {\n\tfloat depth = texture2D(uDepthMap, vUv).r;\n\t\n\tif(depth >= 1.0){\n\t\tdiscard;\n\t}\n\n\tgl_FragColor = vec4(depth, 1.0, 0.0, 1.0);\n\n\tvec4 color = texture2D(uWeightMap, vUv); \n\tcolor = color / color.w;\n\t\n\tgl_FragColor = vec4(color.xyz, 1.0); \n\t\n\tgl_FragDepthEXT = depth;\n\n\n}", "normalize_and_edl.fs": "\n#extension GL_EXT_frag_depth : enable\n\n// \n// adapted from the EDL shader code from Christian Boucheny in cloud compare:\n// https://github.com/cloudcompare/trunk/tree/master/plugins/qEDL/shaders/EDL\n//\n\nprecision mediump float;\nprecision mediump int;\n\nuniform sampler2D uWeightMap;\nuniform sampler2D uEDLMap;\nuniform sampler2D uDepthMap;\n\nuniform float screenWidth;\nuniform float screenHeight;\nuniform vec2 neighbours[NEIGHBOUR_COUNT];\nuniform float edlStrength;\nuniform float radius;\n\nvarying vec2 vUv;\n\nfloat response(float depth){\n\tvec2 uvRadius = radius / vec2(screenWidth, screenHeight);\n\t\n\tfloat sum = 0.0;\n\t\n\tfor(int i = 0; i < NEIGHBOUR_COUNT; i++){\n\t\tvec2 uvNeighbor = vUv + uvRadius * neighbours[i];\n\t\t\n\t\tfloat neighbourDepth = texture2D(uEDLMap, uvNeighbor).a;\n\n\t\tif(neighbourDepth != 0.0){\n\t\t\tif(depth == 0.0){\n\t\t\t\tsum += 100.0;\n\t\t\t}else{\n\t\t\t\tsum += max(0.0, depth - neighbourDepth);\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn sum / float(NEIGHBOUR_COUNT);\n}\n\nvoid main() {\n\n\tfloat edlDepth = texture2D(uEDLMap, vUv).a;\n\tfloat res = response(edlDepth);\n\tfloat shade = exp(-res * 300.0 * edlStrength);\n\n\tfloat depth = texture2D(uDepthMap, vUv).r;\n\tif(depth >= 1.0 && res == 0.0){\n\t\tdiscard;\n\t}\n\t\n\tvec4 color = texture2D(uWeightMap, vUv); \n\tcolor = color / color.w;\n\tcolor = color * shade;\n\n\tgl_FragColor = vec4(color.xyz, 1.0); \n\n\tgl_FragDepthEXT = depth;\n}", "edl.vs": "\nprecision mediump float;\nprecision mediump int;\n\nattribute vec3 position;\nattribute vec2 uv;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nvarying vec2 vUv;\n\nvoid main() {\n\tvUv = uv;\n\t\n\tvec4 mvPosition = modelViewMatrix * vec4(position,1.0);\n\n\tgl_Position = projectionMatrix * mvPosition;\n}", "edl.fs": "\n#extension GL_EXT_frag_depth : enable\n\n// \n// adapted from the EDL shader code from Christian Boucheny in cloud compare:\n// https://github.com/cloudcompare/trunk/tree/master/plugins/qEDL/shaders/EDL\n//\n\nprecision mediump float;\nprecision mediump int;\n\n//uniform float screenWidth;\n//uniform float screenHeight;\nuniform vec2 resolution;\n\n\nuniform vec2 neighbours[NEIGHBOUR_COUNT];\nuniform float edlStrength;\nuniform float radius;\nuniform float opacity;\n\n//uniform float uNear;\n//uniform float uFar;\n\nuniform mat4 uProj;\n\nuniform sampler2D uEDLColor;\nuniform sampler2D uEDLDepth;\n\nvarying vec2 vUv;\n\nuniform int useEDL;\n\nfloat response(float depth){\n\tvec2 uvRadius = radius / resolution; //vec2(screenWidth, screenHeight);\n\t\n\tfloat sum = 0.0;\n\t\n\tfor(int i = 0; i < NEIGHBOUR_COUNT; i++){\n\t\tvec2 uvNeighbor = vUv + uvRadius * neighbours[i];\n\t\t//获取周围八个格子的值\n\t\tfloat neighbourDepth = texture2D(uEDLColor, uvNeighbor).a;\n\t\tneighbourDepth = (neighbourDepth == 1.0) ? 0.0 : neighbourDepth;\n\n\t\tif(neighbourDepth != 0.0){\n\t\t\t//if(depth == 0.0){\n\t\t\t//\tsum += 100.0;\n\t\t\t//}else{\n\t\t\t\tsum += max(0.0, depth - neighbourDepth); //获取差值\n\t\t\t//}\n\t\t}\n\t}\n\t\n\treturn sum / float(NEIGHBOUR_COUNT);\n}\n\nvoid main(){\n\tvec4 cEDL = texture2D(uEDLColor, vUv);\n\t\n\tfloat depth = cEDL.a;\n\tdepth = (depth == 1.0) ? 0.0 : depth;\n \n if(depth == 0.0){ //去掉这句就能在无点云像素的地方渲染outline,但会遮住其他mesh\n\t\tdiscard;\n\t}\n \n \n if(useEDL == 1){\n float res = response(depth);\n \n //if(depth == 0.0 && res == 0.0){ //test\n // discard;\n //}\n \n float shade = exp(-res * 300.0 * edlStrength); //自然常数e为底的指数函数\n\n gl_FragColor = vec4(cEDL.rgb * shade, opacity); \n \n //const vec3 outlineColor = vec3(1.0,0.0,0.0);//test -outline\n //gl_FragColor = vec4(mix(cEDL.rgb, outlineColor, -res), opacity );\n }else{//加 不改颜色的情况 \n gl_FragColor = vec4(cEDL.rgb, opacity);\n } \n \n \n { // write regular hyperbolic depth values to depth buffer 修改深度\n float dl = pow(2.0, depth);\n\n vec4 dp = uProj * vec4(0.0, 0.0, -dl, 1.0);\n float pz = dp.z / dp.w;\n float fragDepth = (pz + 1.0) / 2.0;\n\n gl_FragDepthEXT = fragDepth;\n }\n\t\n}\n", "blur.vs": "\nvarying vec2 vUv;\n\nvoid main() {\n\tvUv = uv;\n\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);\n}", "blur.fs": "\nuniform mat4 projectionMatrix;\n\nuniform float screenWidth;\nuniform float screenHeight;\nuniform float near;\nuniform float far;\n\nuniform sampler2D map;\n\nvarying vec2 vUv;\n\nvoid main() {\n\n\tfloat dx = 1.0 / screenWidth;\n\tfloat dy = 1.0 / screenHeight;\n\n\tvec3 color = vec3(0.0, 0.0, 0.0);\n\tcolor += texture2D(map, vUv + vec2(-dx, -dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2( 0, -dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2(+dx, -dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2(-dx, 0)).rgb;\n\tcolor += texture2D(map, vUv + vec2( 0, 0)).rgb;\n\tcolor += texture2D(map, vUv + vec2(+dx, 0)).rgb;\n\tcolor += texture2D(map, vUv + vec2(-dx, dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2( 0, dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2(+dx, dy)).rgb;\n\n\tcolor = color / 9.0;\n\t\n\tgl_FragColor = vec4(color, 1.0);\n}", "depthBasic.vs": "\n \n\nvarying vec2 vUv;\nvoid main() {\n \n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n} \n ", "depthBasic.fs": "varying vec2 vUv;\nuniform float opacity;\n\nuniform vec3 baseColor;\nuniform vec3 backColor;\nuniform float occlusionDistance;\nuniform float clipDistance;\nuniform float maxClipFactor;\n\n\n#if defined use_map\n uniform sampler2D map; \n#endif\n \n#if defined(GL_EXT_frag_depth) && defined(useDepth) \n //似乎通过gl.getExtension('EXT_frag_depth')得到的GL_EXT_frag_depth\n \n uniform sampler2D depthTexture;\n uniform float nearPlane;\n uniform float farPlane; \n uniform vec2 resolution;\n uniform vec2 viewportOffset; // viewportOffset 范围从0-整个画布的像素\n \n float convertToLinear(float zValue)\n {\n float z = zValue * 2.0 - 1.0;\n return (2.0 * nearPlane * farPlane) / (farPlane + nearPlane - z * (farPlane - nearPlane));\n }\n#endif\n \nvoid main() {\n \n \n vec4 color = vec4(baseColor, opacity);\n \n \n \n #if defined(GL_EXT_frag_depth) && defined(useDepth)\n // mixFactor and clipFactor define the color mixing proportion between the states of\n // full visibility and occluded visibility\n // and\n // full visibility and total invisibility\n \n float mixFactor = 0.0;\n float clipFactor = 0.0;\n \n \n // The linear depth value of the current fragment\n float fragDepth = convertToLinear(gl_FragCoord.z);\n\n // The coordinates of the current fragment in the depth texture\n vec2 depthTxtCoords = vec2(gl_FragCoord.x-viewportOffset.x, gl_FragCoord.y - viewportOffset.y) / resolution;\n \n // The linear depth value of the pixel occupied by this fragment in the depth buffer\n float textureDepth = convertToLinear(texture2D(depthTexture, depthTxtCoords).r);\n\n // The difference between the two depths\n float delta = fragDepth - textureDepth;\n\n if (delta > 0.0)//差距\n {\n // occlusionDistance and clipDistance define the width of the respective zones and\n // mixFactor and clipFactor express the interpolation between the two colors depending on the position\n // of the current fragment withing those zones.\n \n \n mixFactor = clamp(delta / occlusionDistance, 0.0, 1.0);\n clipFactor = clamp(delta / clipDistance, 0.0, maxClipFactor);\n }\n \n // If the fragment is totally transparent, don't bother drawing it\n if (clipFactor == 1.0)\n {\n discard;\n }else{\n \n #if defined use_map\n color = texture2D(map, vUv) * color; \n #endif\n \n \n \n color = vec4(mix(color.rgb, backColor, mixFactor), color.a * (1.0 - clipFactor));\n }\n \n #else\n #if defined use_map\n color = texture2D(map, vUv) * color;\n #endif \n #endif\n \n gl_FragColor = color;\n \n}\n", "copyCubeMap.vs": "varying vec3 vWorldPos;\nvec3 transformAxis( vec3 direction ) //navvis->4dkk\n{\n float y = direction.y;\n direction.y = direction.z;\n direction.z = -y;\n return direction;\n}\nvoid main() {\n vWorldPos = vec3(-position.x, -position.y, position.z);\n //vWorldPos = transformAxis(vWorldPos);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n} \n ", "copyCubeMap.fs": "varying vec3 vWorldPos;\nuniform float alpha;\nuniform samplerCube tDiffuse;\n\n\nvoid main() {\n vec4 texColor = textureCube(tDiffuse, vWorldPos);\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n} \n ", "basicTextured.vs": "varying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n} \n ", "basicTextured.fs": "varying vec2 vUv;\nuniform float alpha;\nuniform sampler2D tDiffuse;\n\n\nvoid main() {\n vec4 texColor = texture2D(tDiffuse, vUv);\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n}\n" } , Vp = document.createElement("canvas") , jp = function() { var i = Vp.getContext("webgl") || Vp.getContext("experimental-webgl"); if (null === i) return null; var e = i.getShaderPrecisionFormat(i.VERTEX_SHADER, i.HIGH_FLOAT) , t = i.getShaderPrecisionFormat(i.VERTEX_SHADER, i.MEDIUM_FLOAT) , n = i.getShaderPrecisionFormat(i.FRAGMENT_SHADER, i.HIGH_FLOAT) , r = i.getShaderPrecisionFormat(i.FRAGMENT_SHADER, i.MEDIUM_FLOAT) , n = 0 < e.precision && 0 < n.precision , r = 0 < t.precision && 0 < r.precision , r = n ? "highp" : r ? "mediump" : "lowp"; return { SHADER_INTERPOLATION: { isSupported: function() { return i.getExtension("EXT_frag_depth") && 8 <= i.getParameter(i.MAX_VARYING_VECTORS) } }, SHADER_SPLATS: { isSupported: function() { return i.getExtension("EXT_frag_depth") && i.getExtension("OES_texture_float") && 8 <= i.getParameter(i.MAX_VARYING_VECTORS) } }, SHADER_EDL: { isSupported: function() { return i.getExtension("EXT_frag_depth") && i.getExtension("OES_texture_float") && 8 <= i.getParameter(i.MAX_VARYING_VECTORS) } }, EXT_DEPTH: { isSupported: function() { if (A.detectIOS()) { var e = A.iosVersion() , t = e.major , n = e.minor , e = e.patch; if (15 == t && 4 == n && 1 == e) return console.warn("检测到是ios15.4.1, 关闭EXT_frag_depth"), !1 } return i.getExtension("EXT_frag_depth") } }, precision: r } }() , Wp = function() { y(s, Qr); var o = w(s); function s() { var n, e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; O(this, s); var t, i = viewer.renderer.getSize(new yn), r = i.width, a = i.height, i = { resolution: { type: "v2", value: new yn(r,a) }, viewportOffset: { type: "v2", value: new yn(0,0) }, nearPlane: { type: "f", value: .1 }, farPlane: { type: "f", value: 1e4 }, depthTexture: { type: "t", value: null }, opacity: { type: "f", value: 1 }, map: { type: "t", value: e.map }, baseColor: { type: "v3", value: e.color ? new Yi(e.color) : new Yi("#ffffff") }, backColor: { type: "v3", value: e.backColor ? new Yi(e.backColor) : new Yi("#ddd") }, clipDistance: { type: "f", value: e.clipDistance || 4 }, occlusionDistance: { type: "f", value: e.occlusionDistance || 1 }, maxClipFactor: { type: "f", value: e.maxClipFactor || 1 } }, r = {}, a = e.useDepth && jp.EXT_DEPTH.isSupported(); return a && (r.useDepth = ""), e.map && (r.use_map = ""), n = o.call(this, { uniforms: i, vertexShader: Hp["depthBasic.vs"], fragmentShader: Hp["depthBasic.fs"], depthWrite: !1, depthTest: !1, transparent: null == e.transparent || e.transparent, side: e.side || 0, defines: r }), null != e.opacity && (n.opacity = e.opacity), a && (n.useDepth_ = !0), n.useDepth && (t = function(e) { var t = e.viewport , e = t.offset || new yn; n.uniforms.resolution.value.copy(t.resolution2), n.uniforms.viewportOffset.value.copy(e) } , a = viewer.mainViewport, t({ viewport: a }), viewer.addEventListener("resize", function(e) { n.useDepth && e.viewport && !e.viewport.camera.isPerspectiveCamera || t(e) }), viewer.addEventListener("render.begin", function(e) { e.viewport.camera.isPerspectiveCamera && n.updateDepthParams(e) }), n.updateDepthParams()), n } return h(s, [{ key: "updateDepthParams", value: function() { var e, t; this.useDepth && (t = (e = (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).viewport || viewer.mainViewport).camera, this.uniforms.depthTexture.value = viewer.getPRenderer().getRtEDL(e).depthTexture, this.uniforms.nearPlane.value = t.near, this.uniforms.farPlane.value = t.far) } }, { key: "map", set: function(e) { this.uniforms.map.value = e } }, { key: "useDepth", get: function() { return this.useDepth_ }, set: function(e) { this.useDepth_ != e && (e && jp.EXT_DEPTH.isSupported() ? (this.defines.useDepth = "", this.updateDepthParams()) : delete this.defines.useDepth, this.useDepth_ = e, this.needsUpdate = !0) } }, { key: "opacity", get: function() { return this.uniforms.opacity.value }, set: function(e) { this.uniforms && (this.uniforms.opacity.value = e) } }]), s }() , Xp = new ua(1,1) , qp = function() { y(a, Hr); var r = w(a); function a(e) { var t; O(this, a), (t = r.call(this, Xp, e.mat || new Wp({ map: e.map, useDepth: e.useDepth }))).root = e.root || g(t), t.renderOrder = null != e.renderOrder ? e.renderOrder : 4, t.pickOrder = e.pickOrder || 0, t.sizeInfo = e.sizeInfo, t.dontFixOrient = e.dontFixOrient, t.root.matrixAutoUpdate = !1, t.matrixMap = new Map, t.name = e.name || "sprite", t.useViewport = null, t.viewports = e.viewports, t.visible_ = !0; function n(e) { t.update(e) } viewer.mapViewer && viewer.mapViewer.addEventListener("camera_changed", n), viewer.addEventListener("camera_changed", n); function i(e) { t.applyMatrix(e) } return viewer.addEventListener("raycaster", i), viewer.addEventListener("render.begin", i), t.addEventListener("dispose", function() { viewer.mapViewer && viewer.mapViewer.removeEventListener("camera_changed", n), viewer.removeEventListener("camera_changed", n), viewer.removeEventListener("raycaster", i), viewer.removeEventListener("render.begin", i), t.dispose() }), t } return h(a, [{ key: "visible", get: function() { return this.visible_ }, set: function(e) { (this.visible_ = e) && this.update() } }, { key: "update", value: function(e) { var t, n, i, r = this; e ? this.visible && this.root && (this.viewports && !this.viewports.includes(e.viewport) || "magnifier" != e.viewport.name && (i = e.viewport.camera, this.dontFixOrient || this.root.quaternion.copy(i.quaternion), (t = this.sizeInfo) && (this.root.updateMatrix(), this.root.updateMatrixWorld(!0), i = t.restricMeshScale ? (n = i.position.distanceTo(this.root.getWorldPosition(new Cn))) < t.nearBound ? t.scale * n / t.nearBound : t.scale : Up.getScaleForConstantSize($.extend(t, { camera: i, position: this.root.getWorldPosition(new Cn), resolution: e.viewport.resolution })), isNaN(i) || this.root.scale.set(i, i, i)), this.root.updateMatrix(), this.root.updateMatrixWorld(!0), this.matrixMap.set(e.viewport, this.root.matrix.clone()), this.useViewport = e.viewport)) : (this.viewports || viewer.viewports).forEach(function(e) { r.update({ viewport: e }) }) } }, { key: "applyMatrix", value: function(e) { var t; "magnifier" != (e = e || { viewport: viewer.mainViewport }).viewport.name && (this.viewports && !this.viewports.includes(e.viewport) || this.visible && this.root && ((t = this.matrixMap.get(e.viewport)) || (this.update(e), t = this.matrixMap.get(e.viewport)), e.viewport != this.useViewport && (this.useViewport = e.viewport, this.root.matrix.copy(t), 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) } }]), a }() , Jp = function() { y(r, Si); var i = w(r); function r() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; O(this, r); var t = i.call(this) , n = new En; return n.minFilter = Oe, n.magFilter = Oe, t.sprite = new qp(Object.assign({ root: g(t) }, e, { map: n })), t.add(t.sprite), t.fontWeight = null == e.fontWeight ? "Bold" : e.fontWeight, t.rectBorderThick = e.rectBorderThick || 0, t.textBorderThick = e.textBorderThick || 0, t.fontface = "Arial", t.fontsize = e.fontsize || 16, t.textBorderColor = e.textBorderColor || { r: 0, g: 0, b: 0, a: 0 }, t.backgroundColor = e.backgroundColor || { r: 255, g: 255, b: 255, a: 1 }, t.textColor = e.textColor || { r: 0, g: 0, b: 0, a: 1 }, t.borderColor = e.borderColor || { r: 0, g: 0, b: 0, a: 0 }, t.borderRadius = e.borderRadius || 6, null != e.text && t.setText(e.text), t.name = e.name, t.addEventListener("dispose", t.dispose.bind(g(t))), t } return h(r, [{ key: "setText", value: function(e) { this.text !== e && (this.text = e + "", this.updateTexture()) } }, { key: "setTextColor", value: function(e) { this.textColor = e, this.updateTexture() } }, { key: "setBorderColor", value: function(e) { this.borderColor = e, this.updateTexture() } }, { key: "setBackgroundColor", value: function(e) { this.backgroundColor = e, this.updateTexture() } }, { key: "setPos", value: function(e) { this.position.copy(e), this.sprite.update() } }, { key: "update", value: function() { this.sprite.update() } }, { key: "setVisible", value: function(e) { this.visible = e } }, { key: "setUniforms", value: function(e, t) { this.sprite.setUniforms(e, t) } }, { key: "updateTexture", value: function() { var e = document.createElement("canvas") , t = e.getContext("2d"); t.font = this.fontWeight + " " + this.fontsize + "px " + this.fontface; var n = t.measureText(this.text).width , i = new yn(this.fontsize,Math.max(.4 * this.fontsize, 10)) , r = 2 * i.x + n + 2 * this.rectBorderThick , n = 2 * i.y + this.fontsize + 2 * this.rectBorderThick; t.canvas.width = r, t.canvas.height = n, t.font = this.fontWeight + " " + this.fontsize + "px " + this.fontface; t.textBaseline = "middle", t.strokeStyle = "rgba(" + this.borderColor.r + "," + this.borderColor.g + "," + this.borderColor.b + "," + this.borderColor.a + ")", t.lineWidth = this.rectBorderThick, t.fillStyle = "rgba(" + this.backgroundColor.r + "," + this.backgroundColor.g + "," + this.backgroundColor.b + "," + this.backgroundColor.a + ")", this.roundRect(t, this.rectBorderThick / 2, this.rectBorderThick / 2, r - this.rectBorderThick, n - this.rectBorderThick, this.borderRadius), this.textBorderThick && (t.strokeStyle = "rgba(" + this.textBorderColor.r + "," + this.textBorderColor.g + "," + this.textBorderColor.b + "," + this.textBorderColor.a + ")", t.lineWidth = this.textBorderThick, t.strokeText(this.text, this.rectBorderThick + i.x, n / 2 + 2)), t.fillStyle = "rgba(" + this.textColor.r + "," + this.textColor.g + "," + this.textColor.b + "," + this.textColor.a + ")", t.fillText(this.text, this.rectBorderThick + i.x, n / 2 + 2); e = new En(e); e.minFilter = Oe, e.magFilter = Oe, e.needsUpdate = !0, this.sprite.material.map && this.sprite.material.map.dispose(), this.sprite.material.map = e, this.sprite.scale.set(.01 * r, .01 * n, 1) } }, { key: "roundRect", value: function(e, t, n, i, r, a) { e.beginPath(), e.moveTo(t + a, n), e.lineTo(t + i - a, n), e.arcTo(t + i, n, t + i, n + a, a), e.lineTo(t + i, n + r - a), e.arcTo(t + i, n + r, t + i - a, n + r, a), e.lineTo(t + a, n + r), e.arcTo(t, n + r, t, n + r - a, a), e.lineTo(t, n + a), e.arcTo(t, n, t + a, n, a), e.closePath(), e.fill(), e.stroke() } }, { key: "dispose", value: function() { this.sprite.material.uniforms.map.value.dispose(), this.parent && this.parent.remove(this), this.sprite.dispatchEvent({ type: "dispose" }), this.removeAllListeners() } }]), r }() , Yp = function() { y(i, Si); var n = w(i); function i() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; return O(this, i), "Volume" === (e = n.call(this)).constructor.name && console.warn("Can't create object of class Volume directly. Use classes BoxVolume or SphereVolume instead."), e._clip = t.clip || !1, e._visible = !0, e._modifiable = t.modifiable || !0, e.addEventListener("select", function(e) {}), e.addEventListener("deselect", function(e) {}), e } return h(i, [{ key: "visible", get: function() { return this._visible }, set: function(e) { this._visible !== e && (this._visible = e, this.dispatchEvent({ type: "visibility_changed", object: this })) } }, { key: "getVolume", value: function() { console.warn("override this in subclass") } }, { key: "update", value: function() {} }, { key: "raycast", value: function(e, t) {} }, { key: "clip", get: function() { return this._clip }, set: function(e) { this._clip !== e && (this._clip = e, this.update(), this.dispatchEvent({ type: "clip_changed", object: this })) } }, { key: "modifieable", get: function() { return this._modifiable }, set: function(e) { this._modifiable = e, this.update() } }]), i }() , Zp = function() { y(a, Yp); var r = w(a); function a() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; O(this, a), (e = r.call(this, t)).constructor.counter = void 0 === e.constructor.counter ? 0 : e.constructor.counter + 1, e.name = "box_" + e.constructor.counter; var n = new Cl(1,1,1); n.computeBoundingBox(); var i = new Sl , t = Cn; return i.vertices.push(new t(-.5,-.5,.5), new t(.5,-.5,.5), new t(.5,-.5,.5), new t(.5,-.5,-.5), new t(.5,-.5,-.5), new t(-.5,-.5,-.5), new t(-.5,-.5,-.5), new t(-.5,-.5,.5), new t(-.5,.5,.5), new t(.5,.5,.5), new t(.5,.5,.5), new t(.5,.5,-.5), new t(.5,.5,-.5), new t(-.5,.5,-.5), new t(-.5,.5,-.5), new t(-.5,.5,.5), new t(-.5,-.5,.5), new t(-.5,.5,.5), new t(.5,-.5,.5), new t(.5,.5,.5), new t(.5,-.5,-.5), new t(.5,.5,-.5), new t(-.5,-.5,-.5), new t(-.5,.5,-.5)), e.material = new $i({ color: 65280, transparent: !0, opacity: .3, depthTest: !0, depthWrite: !1 }), e.box = new Hr(n,e.material), e.box.geometry.computeBoundingBox(), e.boundingBox = e.box.geometry.boundingBox, e.add(e.box), e.frame = new cl(i,new tl({ color: 0 })), e.add(e.frame), viewer.setObjectLayers(g(e), "volume"), e.update(), e } return h(a, [{ key: "update", value: function() { this.boundingBox = this.box.geometry.boundingBox, this.boundingSphere = this.boundingBox.getBoundingSphere(new qn), this._clip ? this.box.visible = !1 : this.box.visible = !0 } }, { key: "raycast", value: function(e, t) { var n = []; this.box.raycast(e, n), 0 < n.length && t.push({ distance: (n = n[0]).distance, object: this, point: n.point.clone() }) } }, { key: "getVolume", value: function() { return Math.abs(this.scale.x * this.scale.y * this.scale.z) } }]), a }() , Qp = function() { y(_, Yp); var E = w(_); function _() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; O(this, _), (e = E.call(this, t)).constructor.counter = void 0 === e.constructor.counter ? 0 : e.constructor.counter + 1, e.name = "sphere_" + e.constructor.counter; var n = new Su(1,32,32); n.computeBoundingBox(), e.material = new $i({ color: 65280, transparent: !0, opacity: .3, depthTest: !0, depthWrite: !1 }), e.sphere = new Hr(n,e.material), e.sphere.visible = !1, e.sphere.geometry.computeBoundingBox(), e.boundingBox = e.sphere.geometry.boundingBox, e.add(e.sphere); for (var i = new Sl, r = 0; r < 8; r++) for (var a = r / 8 * Math.PI * 2, o = Math.cos(a), s = Math.sin(a), l = 0; l <= 64; l++) { var u = l / 64 * Math.PI * 2 , c = u + 2 * Math.PI / 64 , d = Math.sin(u) , h = Math.cos(u) , u = Math.sin(c) , c = Math.cos(c) , d = new Cn(o * h,s * h,d); i.vertices.push(d); u = new Cn(o * c,s * c,u); i.vertices.push(u) } for (var p = 0; p <= 6; p++) { var f = (1 - (f = p / 6)) * (-Math.PI / 2) + f * (Math.PI / 2) , m = Math.sin(f); console.log(f, m); for (var v = 0; v <= 64; v++) { var g = v / 64 * Math.PI * 2 , y = g + 2 * Math.PI / 64 , w = Math.cos(g) , b = Math.sin(g) , x = Math.cos(y) , g = Math.sin(y) , y = Math.sqrt(1 - m * m) , b = new Cn(w * y,b * y,m); i.vertices.push(b); y = new Cn(x * y,g * y,m); i.vertices.push(y) } } e.frame = new cl(i,new tl({ color: 0 })), e.add(e.frame); t = new $i({ wireframe: !0, color: 0 }); return e.frame = new Hr(n,t), e.update(), e } return h(_, [{ key: "update", value: function() { this.boundingBox = this.sphere.geometry.boundingBox, this.boundingSphere = this.boundingBox.getBoundingSphere(new qn) } }, { key: "raycast", value: function(e, t) { var n = []; this.sphere.raycast(e, n), 0 < n.length && t.push({ distance: (n = n[0]).distance, object: this, point: n.point.clone() }) } }, { key: "getVolume", value: function() { return 4 / 3 * Math.PI * this.scale.x * this.scale.y * this.scale.z } }]), _ }() , Kp = function() { y(n, Si); var t = w(n); function n() { var e; return O(this, n), (e = t.call(this)).constructor.counter = void 0 === e.constructor.counter ? 0 : e.constructor.counter + 1, e.name = "Profile_" + e.constructor.counter, e.points = [], e.spheres = [], e.edges = [], e.boxes = [], e.width = 1, e.height = 20, e._modifiable = !0, e.sphereGeometry = new Su(.4,10,10), e.color = new Yi(16711680), e.lineColor = new Yi(16711680), e } return h(n, [{ key: "createSphereMaterial", value: function() { return new qu({ color: 16711680, depthTest: !1, depthWrite: !1 }) } }, { key: "getSegments", value: function() { for (var e = [], t = 0; t < this.points.length - 1; t++) { var n = this.points[t].clone() , i = this.points[t + 1].clone(); e.push({ start: n, end: i }) } return e } }, { key: "getSegmentMatrices", value: function() { var e, t = [], n = ue(this.getSegments()); try { for (n.s(); !(e = n.n()).done; ) { var i = e.value , r = i.start , a = i.end , o = new Si , s = void 0; window.axisYup ? (s = r.clone().setY(0).distanceTo(a.clone().setY(0)), o.scale.set(s, 1e4, this.width)) : (s = r.clone().setZ(0).distanceTo(a.clone().setZ(0)), o.scale.set(s, 1e4, this.width), o.up.set(0, 0, 1)); var l = (new Cn).addVectors(r, a).multiplyScalar(.5) , u = (new Cn).subVectors(a, r) , c = new Cn(u.y,-u.x,0); o.position.set(0, 0, 0), o.lookAt(c), o.position.copy(l), o.updateMatrixWorld(), t.push(o.matrixWorld) } } catch (e) { n.e(e) } finally { n.f() } return t } }, { key: "addMarker", value: function(e) { var n = this; this.points.push(e); var t, i, r = new Hr(this.sphereGeometry,this.createSphereMaterial()); this.add(r), this.spheres.push(r), 1 < this.points.length && ((t = new Sl).vertices.push(new Cn, new Cn), t.colors.push(this.lineColor, this.lineColor, this.lineColor), (i = new tl({ vertexColors: 2, lineWidth: 2, transparent: !0, opacity: .4 })).depthTest = !1, (i = new sl(t,i)).visible = !1, this.add(i), this.edges.push(i), (i = new Hr(new Cl(1,1,1),new $i({ color: 16711680, transparent: !0, opacity: .2 }))).visible = !1, this.add(i), this.boxes.push(i)); r.addEventListener("drag", function(e) { var t = Jf.getMousePointCloudIntersection(e.drag.end, e.viewer.scene.getActiveCamera(), e.viewer, e.viewer.scene.pointclouds); !t || -1 !== (e = n.spheres.indexOf(e.drag.object)) && n.setPosition(e, t.location) }), r.addEventListener("drop", function(e) { e = n.spheres.indexOf(e.drag.object); -1 !== e && n.dispatchEvent({ type: "marker_dropped", profile: n, index: e }) }), r.addEventListener("mouseover", function(e) { return e.object.material.emissive.setHex(8947848) }), r.addEventListener("mouseleave", function(e) { return e.object.material.emissive.setHex(0) }), this.dispatchEvent({ type: "marker_added", profile: this, sphere: r }), this.setPosition(this.points.length - 1, e) } }, { key: "removeMarker", value: function(e) { this.points.splice(e, 1), this.remove(this.spheres[e]); var t = 0 === e ? 0 : e - 1; this.remove(this.edges[t]), this.edges.splice(t, 1), this.remove(this.boxes[t]), this.boxes.splice(t, 1), this.spheres.splice(e, 1), this.update(), this.dispatchEvent({ type: "marker_removed", profile: this }) } }, { key: "setPosition", value: function(e, t) { var n = this.points[e]; n.copy(t); n = { type: "marker_moved", profile: this, index: e, position: n.clone() }; this.dispatchEvent(n), this.update() } }, { key: "setWidth", value: function(e) { this.width = e, this.dispatchEvent({ type: "width_changed", profile: this, width: e }), this.update() } }, { key: "getWidth", value: function() { return this.width } }, { key: "update", value: function() { if (0 !== this.points.length) if (1 !== this.points.length) { for (var e = this.points[0].clone(), t = this.points[0].clone(), n = new Cn, i = this.points.length - 1, r = 0; r <= i; r++) { var a = this.points[r] , o = this.spheres[r] , s = 0 === r ? i : r - 1 , l = this.points[s] , u = this.edges[s] , c = this.edges[r] , s = this.boxes[s]; o.position.copy(a), this._modifiable ? o.visible = !0 : o.visible = !1, u && (u.geometry.vertices[1].copy(a), u.geometry.verticesNeedUpdate = !0, u.geometry.computeBoundingSphere()), c && (c.geometry.vertices[0].copy(a), c.geometry.verticesNeedUpdate = !0, c.geometry.computeBoundingSphere()), s && (u = l, c = a, l = void 0, window.axisYup ? l = u.clone().setY(0).distanceTo(c.clone().setY(0)) : (l = u.clone().setZ(0).distanceTo(c.clone().setZ(0)), s.up.set(0, 0, 1)), s.scale.set(l, 1e6, this.width), l = (new Cn).addVectors(u, c).multiplyScalar(.5), u = (new Cn).subVectors(c, u), u = new Cn(u.y,-u.x,0), s.position.set(0, 0, 0), s.lookAt(u), s.position.copy(l)), n.add(a), e.min(a), t.max(a) } n.multiplyScalar(1 / this.points.length); for (var d = 0; d < this.boxes.length; d++) this.boxes[d].position.z = e.z + (t.z - e.z) / 2 } else { var h = this.points[0]; this.spheres[0].position.copy(h) } } }, { key: "raycast", value: function(e, t) { for (var n = 0; n < this.points.length; n++) this.spheres[n].raycast(e, t); for (var i = 0; i < t.length; i++) { var r = t[i]; r.distance = e.ray.origin.distanceTo(r.point) } t.sort(function(e, t) { return e.distance - t.distance }) } }, { key: "modifiable", get: function() { return this._modifiable }, set: function(e) { this._modifiable = e, this.update() } }]), n }() , $p = function() { y(r, hn); var i = w(r); function r() { var t, e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; O(this, r), (t = i.call(this)).position = e.pos, t.text = e.text || "", t.elem = $('
'), e.className && t.elem.addClass(e.className), t.elem.find("a").html(t.text), $("#potree_labels").append(t.elem), t.pos2d = new Cn, t.dom = e.dom || viewer.renderArea, t.camera = e.camera || viewer.scene.getActiveCamera(); function n(e) { t.update(e) } return viewer.addEventListener("camera_changed", n), t.addEventListener("dispose", function() { viewer.removeEventListener("camera_changed", n), t.dispose() }), t } return h(r, [{ key: "update", value: function() { var e; this.position && !this.elem.hasClass("unvisible") && ((e = Jf.getPos2d(this.position, this.camera, this.dom, viewer.mainViewport)).trueSide ? (this.elem.css({ left: e.pos.x + "px", top: e.pos.y + "px" }), this.elem.removeClass("hide"), this.pos2d = e.vector) : this.elem.addClass("hide")) } }, { key: "setVisible", value: function(e) { e ? (this.elem.removeClass("unvisible"), this.update()) : this.elem.addClass("unvisible") } }, { key: "setText", value: function(e) { this.text = e || "", this.elem.find("a").html(this.text) } }, { key: "setPos", value: function(e) { this.position = e } }, { key: "dispose", value: function() { this.elem.remove(), this.removeAllListeners() } }]), r }() , ef = new kn , tf = new Cn , nf = function() { y(n, ud); var t = w(n); function n() { var e; O(this, n), (e = t.call(this)).isLineSegmentsGeometry = !0, e.type = "LineSegmentsGeometry"; return e.setIndex([0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5]), e.setAttribute("position", new dr([-1, 2, 0, 1, 2, 0, -1, 1, 0, 1, 1, 0, -1, 0, 0, 1, 0, 0, -1, -1, 0, 1, -1, 0],3)), e.setAttribute("uv", new dr([-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2],2)), e } return h(n, [{ key: "applyMatrix4", value: function(e) { var t = this.attributes.instanceStart , n = this.attributes.instanceEnd; return void 0 !== t && (t.applyMatrix4(e), n.applyMatrix4(e), t.needsUpdate = !0), null !== this.boundingBox && this.computeBoundingBox(), null !== this.boundingSphere && this.computeBoundingSphere(), this } }, { key: "setPositions", value: function(e) { e instanceof Float32Array ? t = e : Array.isArray(e) && (t = new Float32Array(e)); var t = new ah(t,6,1); return this.setAttribute("instanceStart", new xs(t,3,0)), this.setAttribute("instanceEnd", new xs(t,3,3)), this.computeBoundingBox(), this.computeBoundingSphere(), this } }, { key: "setColors", value: function(e) { e instanceof Float32Array ? t = e : Array.isArray(e) && (t = new Float32Array(e)); var t = new ah(t,6,1); return this.setAttribute("instanceColorStart", new xs(t,3,0)), this.setAttribute("instanceColorEnd", new xs(t,3,3)), this } }, { key: "fromWireframeGeometry", value: function(e) { return this.setPositions(e.attributes.position.array), this } }, { key: "fromEdgesGeometry", value: function(e) { return this.setPositions(e.attributes.position.array), this } }, { key: "fromMesh", value: function(e) { return this.fromWireframeGeometry(new zu(e.geometry)), this } }, { key: "fromLineSegments", value: function(e) { e = e.geometry; return this.setPositions(e.attributes.position.array), this } }, { key: "computeBoundingBox", value: function() { null === this.boundingBox && (this.boundingBox = new kn); var e = this.attributes.instanceStart , t = this.attributes.instanceEnd; void 0 !== e && void 0 !== t && (this.boundingBox.setFromBufferAttribute(e), ef.setFromBufferAttribute(t), this.boundingBox.union(ef)) } }, { key: "computeBoundingSphere", value: function() { null === this.boundingSphere && (this.boundingSphere = new qn), null === this.boundingBox && this.computeBoundingBox(); var e = this.attributes.instanceStart , t = this.attributes.instanceEnd; if (void 0 !== e && void 0 !== t) { var n = this.boundingSphere.center; this.boundingBox.getCenter(n); for (var i = 0, r = 0, a = e.count; r < a; r++) tf.fromBufferAttribute(e, r), i = Math.max(i, n.distanceToSquared(tf)), tf.fromBufferAttribute(t, r), i = Math.max(i, n.distanceToSquared(tf)); this.boundingSphere.radius = Math.sqrt(i), isNaN(this.boundingSphere.radius) && console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.", this) } } }, { key: "toJSON", value: function() {} }, { key: "applyMatrix", value: function(e) { return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."), this.applyMatrix4(e) } }]), n }(); da.line = { worldUnits: { value: 1 }, lineWidth: { value: 1 }, resolution: { value: new yn(1,1) }, viewportOffset: { value: new yn(0,0) }, dashScale: { value: 1 }, dashSize: { value: 1 }, dashOffset: { value: 0 }, gapSize: { value: 1 }, opacity: { value: 1 }, backColor: { type: "v3", value: new Yi("#ddd") }, clipDistance: { type: "f", value: 4 }, occlusionDistance: { type: "f", value: 1 }, maxClipFactor: { type: "f", value: 1 }, depthTexture: { value: null }, nearPlane: { value: .1 }, farPlane: { value: 1e5 } }, ha.line = { uniforms: Jr.merge([da.common, da.fog, da.line]), vertexShader: "\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform float lineWidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * lineWidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * lineWidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for lineWidth\n\t\t\t\toffset *= lineWidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for lineWidth\n\t\t\t\toffset *= lineWidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t", fragmentShader: "\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float lineWidth;\n uniform vec3 backColor;\n uniform float occlusionDistance;\n uniform float clipDistance;\n uniform float maxClipFactor;\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\n //加\n #if defined(GL_EXT_frag_depth) && defined(useDepth) \n uniform sampler2D depthTexture;\n uniform float nearPlane;\n uniform float farPlane; \n uniform vec2 resolution;\n uniform vec2 viewportOffset;\n #endif\n\n\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\n #if defined(GL_EXT_frag_depth) && defined(useDepth) \n float convertToLinear(float zValue)\n {\n float z = zValue * 2.0 - 1.0;\n return (2.0 * nearPlane * farPlane) / (farPlane + nearPlane - z * (farPlane - nearPlane));\n }\n #endif\n\n\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\t/*#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif*/\n \n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n \n \n bool unvisible = mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize;\n //加\n #ifdef DASH_with_depth\n \n #else \n if (unvisible) discard; // todo - FIX\n #endif\n\t\t\t#endif\n \n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / lineWidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\n //加\n #if defined(GL_EXT_frag_depth) && defined(useDepth) \n \n float mixFactor = 0.0;\n float clipFactor = 0.0;\n\n float fragDepth = convertToLinear(gl_FragCoord.z);\n\n vec2 depthTxtCoords = vec2(gl_FragCoord.x - viewportOffset.x, gl_FragCoord.y - viewportOffset.y) / resolution;\n\n float textureDepth = convertToLinear(texture2D(depthTexture, depthTxtCoords).r);\n\n float delta = fragDepth - textureDepth;\n\n if (delta > 0.0)\n {\n \n mixFactor = clamp(delta / occlusionDistance, 0.0, 1.0);\n clipFactor = clamp(delta / clipDistance, 0.0, maxClipFactor);\n }\n \n if (clipFactor == 1.0)\n {\n discard;\n }\n \n vec4 backColor_ = vec4(backColor, opacity); //vec4(0.8,0.8,0.8, 0.8*opacity);\n \n #ifdef DASH_with_depth \n // 只在被遮住的部分显示虚线, 所以若同时是虚线不可见部分和被遮住时, a为0\n if(unvisible) backColor_.a = 0.0;\n #endif \n \n //vec4 diffuseColor = vec4(mix(diffuse, backColor_, mixFactor), opacity*(1.0 - clipFactor));\n \n \n \n diffuseColor = mix(diffuseColor, backColor_ , mixFactor); \n \n \n diffuseColor.a *= (1.0 - clipFactor); \n \n #endif\n\n\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t\t//gl_FragColor = vec4( diffuseColor.rgb, alpha );\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t" }; var rf, af, of, sf, lf = function() { y(r, Qr); var i = w(r); function r(e) { var n; O(this, r), (n = i.call(this, { type: "LineMaterial", uniforms: Jr.clone(ha.line.uniforms), vertexShader: ha.line.vertexShader, fragmentShader: ha.line.fragmentShader, clipping: !0 })).isLineMaterial = !0, n.lineWidth_ = 0, n.supportExtDepth = e.supportExtDepth, n.depthTestWhenPick = !1, e.color && (n.color = new Yi(e.color)), e.backColor && (n.uniforms.backColor.value = new Yi(e.backColor)), e.clipDistance && (n.uniforms.clipDistance.value = e.clipDistance), e.occlusionDistance && (n.uniforms.occlusionDistance.value = e.occlusionDistance), e.maxClipFactor && (n.uniforms.maxClipFactor.value = e.maxClipFactor), Object.defineProperties(g(n), { color: { enumerable: !0, get: function() { return this.uniforms.diffuse.value }, set: function(e) { this.uniforms.diffuse.value = e } }, worldUnits: { enumerable: !0, get: function() { return "WORLD_UNITS"in this.defines }, set: function(e) { !0 === e ? this.defines.WORLD_UNITS = "" : delete this.defines.WORLD_UNITS } }, lineWidth: { enumerable: !0, get: function() { return this.lineWidth_ }, set: function(e) { this.uniforms.lineWidth.value = e * window.devicePixelRatio, this.lineWidth_ = e } }, dashed: { enumerable: !0, get: function() { return Boolean("USE_DASH"in this.defines) }, set: function(e) { Boolean(e) !== Boolean("USE_DASH"in this.defines) && (this.needsUpdate = !0), !0 === e ? this.defines.USE_DASH = "" : delete this.defines.USE_DASH } }, dashScale: { enumerable: !0, get: function() { return this.uniforms.dashScale.value }, set: function(e) { this.uniforms.dashScale.value = e } }, dashSize: { enumerable: !0, get: function() { return this.uniforms.dashSize.value }, set: function(e) { this.uniforms.dashSize.value = e } }, dashOffset: { enumerable: !0, get: function() { return this.uniforms.dashOffset.value }, set: function(e) { this.uniforms.dashOffset.value = e } }, gapSize: { enumerable: !0, get: function() { return this.uniforms.gapSize.value }, set: function(e) { this.uniforms.gapSize.value = e } }, opacity: { enumerable: !0, get: function() { return this.uniforms.opacity.value }, set: function(e) { this.uniforms.opacity.value = e } }, resolution: { enumerable: !0, get: function() { return this.uniforms.resolution.value }, set: function(e) { this.uniforms.resolution.value.copy(e) } }, alphaToCoverage: { enumerable: !0, get: function() { return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines) }, set: function(e) { Boolean(e) !== Boolean("USE_ALPHA_TO_COVERAGE"in this.defines) && (this.needsUpdate = !0), !0 === e ? (this.defines.USE_ALPHA_TO_COVERAGE = "", this.extensions.derivatives = !0) : (delete this.defines.USE_ALPHA_TO_COVERAGE, this.extensions.derivatives = !1) } }, useDepth: { enumerable: !0, get: function() { return "useDepth"in this.defines }, set: function(e) { (e = e && !!this.supportExtDepth) != this.useDepth && (e ? (this.defines.useDepth = "", this.updateDepthParams()) : delete this.defines.useDepth, this.needsUpdate = !0) } }, dashWithDepth: { enumerable: !0, get: function() { return "DASH_with_depth"in this.defines }, set: function(e) { (e = e && !!this.supportExtDepth) != this.dashWithDepth && (e ? this.defines.DASH_with_depth = "" : delete this.defines.DASH_with_depth, this.needsUpdate = !0) } } }), n.setValues(e); function t(e) { var t = e.viewport , e = t.offset || new yn; n.uniforms.resolution.value.copy(t.resolution2), n.uniforms.viewportOffset.value.copy(e), n.lineWidth = n.lineWidth_ } e = viewer.mainViewport; return t({ viewport: e }), viewer.addEventListener("resize", function(e) { t(e) }), n.supportExtDepth && (n.updateDepthParams(), viewer.addEventListener("render.begin", function(e) { e.viewport.camera.isPerspectiveCamera && n.updateDepthParams(e) })), n } return h(r, [{ key: "updateDepthParams", value: function() { var e, t; this.useDepth && (t = (e = (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).viewport || viewer.mainViewport).camera, this.uniforms.depthTexture.value = viewer.getPRenderer().getRtEDL(e).depthTexture, this.uniforms.nearPlane.value = t.near, this.uniforms.farPlane.value = t.far) } }]), r }(), uf = new Cn, cf = new Cn, df = new Mn, hf = new Mn, pf = new Mn, ff = new Cn, mf = new ni, vf = new vh, gf = new Cn, yf = new kn, wf = new qn, bf = new Mn; function xf(e, t, n) { return bf.set(0, 0, -t, 1).applyMatrix4(e.projectionMatrix), bf.multiplyScalar(1 / bf.w), bf.x = sf / n.width, bf.y = sf / n.height, bf.applyMatrix4(e.projectionMatrixInverse), bf.multiplyScalar(1 / bf.w), Math.abs(Math.max(bf.x, bf.y)) } var Ef, _f = function() { y(i, Hr); var n = w(i); function i() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new nf , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new lf({ color: 16777215 * Math.random() }); return O(this, i), (t = n.call(this, e, t)).isLineSegments2 = !0, t.type = "LineSegments2", t } return h(i, [{ key: "computeLineDistances", value: function() { for (var e = this.geometry, t = e.attributes.instanceStart, n = e.attributes.instanceEnd, i = new Float32Array(2 * t.count), r = 0, a = 0, o = t.count; r < o; r++, a += 2) uf.fromBufferAttribute(t, r), cf.fromBufferAttribute(n, r), i[a] = 0 === a ? 0 : i[a - 1], i[a + 1] = i[a] + uf.distanceTo(cf); var s = new ah(i,2,1); return e.setAttribute("instanceDistanceStart", new xs(s,1,0)), e.setAttribute("instanceDistanceEnd", new xs(s,1,1)), this } }, { key: "raycast", value: function(e, t) { var n = this.material.worldUnits , i = e.camera; null !== i || n || console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'); var r = void 0 !== e.params.Line2 && e.params.Line2.threshold || 0; rf = e.ray; var a = this.matrixWorld , o = this.geometry , e = this.material; sf = e.lineWidth + r, af = o.attributes.instanceStart, of = o.attributes.instanceEnd, null === o.boundingSphere && o.computeBoundingSphere(), wf.copy(o.boundingSphere).applyMatrix4(a), r = n ? .5 * sf : xf(i, Math.max(i.near, wf.distanceToPoint(rf.origin)), e.resolution), wf.radius += r, !1 !== rf.intersectsSphere(wf) && (null === o.boundingBox && o.computeBoundingBox(), yf.copy(o.boundingBox).applyMatrix4(a), e = n ? .5 * sf : xf(i, Math.max(i.near, yf.distanceToPoint(rf.origin)), e.resolution), yf.expandByScalar(e), !1 !== rf.intersectsBox(yf) && (n ? function(e, t) { for (var n = 0, i = af.count; n < i; n++) { vf.start.fromBufferAttribute(af, n), vf.end.fromBufferAttribute(of, n); var r = new Cn , a = new Cn; rf.distanceSqToSegment(vf.start, vf.end, a, r), a.distanceTo(r) < .5 * sf && t.push({ point: a, pointOnLine: r, distance: rf.origin.distanceTo(a), object: e, face: null, faceIndex: n, uv: null, uv2: null }) } }(this, t) : function(e, t, n) { var i = t.projectionMatrix , r = e.material.resolution , a = e.matrixWorld , o = e.geometry , s = o.attributes.instanceStart , l = o.attributes.instanceEnd , u = -t.near; rf.at(1, pf), pf.w = 1, pf.applyMatrix4(t.matrixWorldInverse), pf.applyMatrix4(i), pf.multiplyScalar(1 / pf.w), pf.x *= r.x / 2, pf.y *= r.y / 2, pf.z = 0, ff.copy(pf), mf.multiplyMatrices(t.matrixWorldInverse, a); for (var c, d, h, p = 0, f = s.count; p < f; p++) df.fromBufferAttribute(s, p), hf.fromBufferAttribute(l, p), df.w = 1, hf.w = 1, df.applyMatrix4(mf), hf.applyMatrix4(mf), df.z > u && hf.z > u || (df.z > u ? (c = df.z - hf.z, c = (df.z - u) / c, df.lerp(hf, c)) : hf.z > u && (d = hf.z - df.z, h = (hf.z - u) / d, hf.lerp(df, h)), df.applyMatrix4(i), hf.applyMatrix4(i), df.multiplyScalar(1 / df.w), hf.multiplyScalar(1 / hf.w), df.x *= r.x / 2, df.y *= r.y / 2, hf.x *= r.x / 2, hf.y *= r.y / 2, vf.start.copy(df), vf.start.z = 0, vf.end.copy(hf), vf.end.z = 0, d = vf.closestPointToPointParameter(ff, !0), vf.at(d, gf), d = -1 <= (h = gn.lerp(df.z, hf.z, d)) && h <= 1, h = ff.distanceTo(gf) < .5 * sf, d && h && (vf.start.fromBufferAttribute(s, p), vf.end.fromBufferAttribute(l, p), vf.start.applyMatrix4(a), vf.end.applyMatrix4(a), d = new Cn, h = new Cn, rf.distanceSqToSegment(vf.start, vf.end, h, d), n.push({ point: h, pointOnLine: d, distance: rf.origin.distanceTo(h), object: e, face: null, faceIndex: p, uv: null, uv2: null }))) }(this, i, t))) } }]), i }(), Mf = function() { y(r, nf); var t = w(r); function r() { var e; return O(this, r), (e = t.call(this)).isLineGeometry = !0, e.type = "LineGeometry", e } return h(r, [{ key: "setPositions", value: function(e) { for (var t = e.length - 3, n = new Float32Array(2 * t), i = 0; i < t; i += 3) n[2 * i] = e[i], n[2 * i + 1] = e[i + 1], n[2 * i + 2] = e[i + 2], n[2 * i + 3] = e[i + 3], n[2 * i + 4] = e[i + 4], n[2 * i + 5] = e[i + 5]; return b(v(r.prototype), "setPositions", this).call(this, n), this } }, { key: "setColors", value: function(e) { for (var t = e.length - 3, n = new Float32Array(2 * t), i = 0; i < t; i += 3) n[2 * i] = e[i], n[2 * i + 1] = e[i + 1], n[2 * i + 2] = e[i + 2], n[2 * i + 3] = e[i + 3], n[2 * i + 4] = e[i + 4], n[2 * i + 5] = e[i + 5]; return b(v(r.prototype), "setColors", this).call(this, n), this } }, { key: "fromLine", value: function(e) { e = e.geometry; return this.setPositions(e.attributes.position.array), this } }]), r }(), Af = function() { y(i, _f); var n = w(i); function i() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : new Mf , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : new lf({ color: 16777215 * Math.random() }); return O(this, i), (t = n.call(this, e, t)).isLine2 = !0, t.type = "Line2", t } return h(i) }(), Tf = new Yi(1,1,1), Sf = { createLine: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {} , n = t.mat || (n = { lineWidth: t.lineWidth || 1, color: t.color || Tf, transparent: !t.dontAlwaysSeen, depthTest: !!t.dontAlwaysSeen }, t.deshed && (n.dashSize = t.dashSize || .1, n.gapSize = t.gapSize || .1), new mp[t.deshed ? "LineDashedMaterial" : "LineBasicMaterial"](n)) , n = new cl(new Mr,n); return n.renderOrder = t.renderOrder || 4, this.moveLine(n, e), n }, moveLine: function(e, t) { var n; 0 != t.length && (n = [], t.forEach(function(e) { return n.push(e.x, e.y, e.z) }), e.geometry.setAttribute("position", new dr(n,3)), e.geometry.attributes.position.needsUpdate = !0, e.geometry.computeBoundingSphere(), e.material instanceof Yu && (e.computeLineDistances(), e.geometry.verticesNeedUpdate = !0)) }, createFatLineMat: function(e) { var t = !!jp.EXT_DEPTH.isSupported() , t = $.extend({}, { lineWidth: 5, color: 16777215, transparent: !0, depthWrite: !1, depthTest: !1, dashSize: .1, gapSize: .1 }, e, { dashed: (!e.dashWithDepth || t) && !!e.dashed, dashWithDepth: !!e.dashWithDepth, useDepth: !!e.useDepth, supportExtDepth: t }); return new lf(t) }, createFatLine: function(e, t) { var n = new Mf; n.setColors(t.color || [1, 1, 1]); t = t.material || this.createFatLineMat(t), t = new Af(n,t); return t.scale.set(1, 1, 1), t.renderOrder = 2, this.moveFatLine(t, e), t }, moveFatLine: function(e, t) { var n = e.geometry , i = []; t.forEach(function(e) { i.push.apply(i, Q(e.toArray())) }), 0 < i.length ? ((n = n || (e.geometry = new Mf)).attributes.instanceEnd && n.attributes.instanceEnd.data.array.length != i.length && (n.dispose(), n = new Mf, e.geometry = n), n.setPositions(i), null != e.material.defines.USE_DASH && (e.geometry.computeBoundingSphere(), e.computeLineDistances())) : (n.dispose(), e.geometry = new Mf) }, updateLine: function(e, t) { e instanceof Af ? Sf.moveFatLine(e, t) : Sf.moveLine(e, t) }, createBoldLine: function(e, t) { function n() { i.lastVector = r; var e = (t = new Cn(0,-1,0)).clone().cross(r).normalize() , t = t.angleTo(r); i.quaternion.setFromAxisAngle(e, t) } var i = (t = t || {}) && t.cylinder , r = e[1].clone().sub(e[0]); if (t && "init" == t.type) { if ((i = new Hr).material = t.mat, 0 == r.length()) return i; n() } if (0 == r.length()) return i; if ("update" != t.type) { var a = e[0].clone().add(e[1]).multiplyScalar(.5); if (i.position.copy(a), (!i.lastVector || "moveAndRotate" == t.type || i.lastVector && 0 < r.angleTo(i.lastVector)) && n(), config.isEdit && !objects.mainDesign.editing) return i } var o = e[0].distanceTo(e[1]) , s = t && t.standPos || objects.player.position , l = config.isMobile ? 20 : 40 , u = e[0].distanceTo(s) , c = e[1].distanceTo(s) , a = Up.getFootPoint(s, e[0], e[1]); return o = t.constantBold || "panorama" != objects.player.mode ? [new yn(.1,o / 2), new yn(.1,-o / 2)] : 0 < a.clone().sub(e[0]).dot(a.clone().sub(e[1])) ? [new yn(u / l,o / 2), new yn(c / l,-o / 2)] : (s = a.distanceTo(s), e = a.distanceTo(e[0]), [new yn(u / l,o / 2), new yn(s / l,o / 2 - e), new yn(c / l,-o / 2)]), i.geometry && i.geometry.dispose(), i.geometry = new fu(o,4), i.renderOrder = 2, i }, updateBoldLine: function(e, t, n, i, r) { this.createBoldLine(t, { type: n, cylinder: e, standPos: i, constantBold: r }) } }, Cf = { getShape: function(e, t) { var r = new Xc; r.moveTo(e[0].x, e[0].y); for (var n = 1, i = e.length; n < i; n++) r.lineTo(e[n].x, e[n].y); return t && t.forEach(function(e) { var t = new Wc; t.moveTo(e[0].x, e[0].y); for (var n = 1, i = e.length; n < i; n++) t.lineTo(e[n].x, e[n].y); r.holes.push(t) }), r }, getShapeGeo: function(e, t) { return new Mu(this.getShape(e, t)) }, getExtrudeGeo: function(e, t) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {} , t = this.getShape(e, t); n.extrudePath && (i = extrudePath.reduce(function(e, t, n, i) { return 0 == n ? 0 : e + t.distanceTo(i[n - 1]) }, 0), n.extrudePath = new Bc(extrudePath,n.closed,"catmullrom",n.tension)); var i = $.extend(n, { steps: null != n.steps ? n.steps : n.extrudePath ? Math.round(i / .3) : 1, bevelEnabled: !1 }); return new uu(t,i) }, getUnPosPlaneGeo: (Ch = new Uint16Array([0, 1, 2, 0, 2, 3]), pu = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]), (Ef = new Mr).setIndex(new nr(Ch,1)), Ef.setAttribute("uv", new nr(pu,2)), function() { return Ef } ), getPlaneGeo: function(e, t, n, i) { var r = this.getUnPosPlaneGeo().clone() , i = [e.x, e.y, e.z, t.x, t.y, t.z, n.x, n.y, n.z, i.x, i.y, i.z]; return r.setAttribute("position", new dr(i,3)), r.computeVertexNormals(), r.computeBoundingSphere(), r }, drawPlane: function(e, t, n, i, r) { return new Hr(this.getPlaneGeo(e, t, n, i),r) }, movePlane: function(e, t, n, i, r) { r = new Float32Array([t.x, t.y, t.z, n.x, n.y, n.z, i.x, i.y, i.z, r.x, r.y, r.z]); e.geometry.addAttribute("position", new nr(r,3)), e.geometry.computeBoundingSphere() }, createGeometry: function(e, t, n, i) { var r, a, o, s = new Mr, l = []; return e.forEach(function(e) { return l.push(e.x, e.y, e.z) }), s.setAttribute("position", new dr(l,3)), t && (r = [], t.forEach(function(e) { return r.push.apply(r, Q(e)) }), s.setIndex(r)), n && (a = [], n.forEach(function(e) { return a.push(e.x, e.y) }), s.setAttribute("uv", new dr(a,2))), i && (o = [], i.forEach(function(e) { return o.push(e.x, e.y, e.z) }), s.setAttribute("normal", new dr(o,3))), s }, updateGeometry: function(e, t, n, i, r) { var a, o, s, l = []; return t.forEach(function(e) { return l.push(e.x, e.y, e.z) }), e.setAttribute("position", new dr(l,3)), e.attributes.position.needsUpdate = !0, n && (a = [], n.forEach(function(e) { return a.push.apply(a, Q(e)) }), e.setIndex(a)), i && (o = [], i.forEach(function(e) { return o.push(e.x, e.y) }), e.setAttribute("uv", new dr(o,2))), r && (s = [], r.forEach(function(e) { return s.push(e.x, e.y, e.z) }), e.setAttribute("normal", new dr(s,3))), e.computeBoundingSphere(), e } }, Pf = new vh, Df = function() { y(a, Si); var r = w(a); function a(e, t) { var n, i; for (i in O(this, a), (n = r.call(this)).type = e, n.maxMarkers = Number.MAX_SAFE_INTEGER, n.transformData(t), t) n[i] = t[i]; return n.closed && "2d" == n.dimension && (n.areaPlane = n.createAreaPlane(), n.add(n.areaPlane)), n.points = [], n.markers = [], n.edges = [], n.center, n } return h(a, [{ key: "initData", value: function(e) { var n = this; if ("merge" == Potree.settings.editType) if (this.dataset_points) { if (this.dataset_points = this.dataset_points.map(function(e) { return e && (new Cn).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 = ue(e.points); try { for (i.s(); !(t = i.n()).done; ) { var r = t.value , a = (new Cn).copy(r); this.addMarker({ point: a }) } } catch (e) { i.e(e) } finally { i.f() } return "merge" != Potree.settings.editType && (null != this.datasetId ? this.dataset_points && (this.dataset_points = this.dataset_points.map(function(e) { return e && (new Cn).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.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 n = this , i = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {} , e = null == i.index ? this.points.length : i.index; this.points = [].concat(Q(this.points.slice(0, e)), [i.point], Q(this.points.slice(e, this.points.length))), i.marker && (this.add(i.marker), this.markers = [].concat(Q(this.markers.slice(0, e)), [i.marker], Q(this.markers.slice(e, this.markers.length))), this.updateMarker(i.marker, i.point), i.marker.addEventListener("drag", this.dragMarker.bind(this)), i.marker.addEventListener("drop", this.dropMarker.bind(this)), i.marker.addEventListener("addHoverEvent", function e(t) { i.marker.addEventListener("mouseover", function(e) { n.setMarkerSelected(e.object, "hover", "single"), viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "markerMove" }) }), i.marker.addEventListener("mouseleave", function(e) { n.setMarkerSelected(e.object, "unhover", "single"), viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "markerMove" }) }), i.marker.removeEventListener("addHoverEvent", e) }), this.isNew || i.marker.dispatchEvent("addHoverEvent")), i.edge && (this.add(i.edge), this.edges = [].concat(Q(this.edges.slice(0, e)), [i.edge], Q(this.edges.slice(e, this.edges.length)))) } }, { key: "dragMarker", value: function(e) { var t, n; if (e.hoverViewport == e.drag.dragViewport) { if (viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "polygon_AtWrongPlace" }), (n = "mapViewport" == e.drag.dragViewport.name) && this.unableDragAtMap) e.drag.object = null; else if (e.drag.object.isDragging = !0, t = e.intersect && (e.intersect.orthoIntersect || e.intersect.location)) { var i = this.markers.indexOf(e.drag.object); return -1 !== i && (this.dragChange(t.clone(), i, n), this.points_datasets && (e.intersect.pointcloud ? this.points_datasets[i] = e.intersect.pointcloud.dataset_id : e.intersect.object ? this.points_datasets[i] = e.intersect.object.dataset_id : this.points_datasets[i] = null)), this.editStateChange(!0), !0 } } else viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "polygon_AtWrongPlace" }) } }, { key: "dragChange", value: function(e, t, n) { var i = this , r = this.markers.length , a = this.points[t]; n && e.setZ(a.z); var o = e.clone(); if (this.faceDirection && 2 == this.maxMarkers && 2 == r) { var s = this.markers[0].position; a = "horizontal" == this.faceDirection ? o.clone().setZ(s.z) : s.clone().setZ(o.z), Sf.updateLine(this.guideLine, [o, a]), o = a, this.guideLine.visible = !0 } else if (1 < r) { var l, u = this.points.map(function(e) { return e.clone() }); if (u[t].copy(o), "horizontal" == this.faceDirection) 2 == r && o.setZ(u[0].z), this.facePlane || (this.facePlane = (new ki).setFromNormalAndCoplanarPoint(new Cn(0,0,1), this.points[0])); else if ("vertical" == this.faceDirection) if (2 == r) this.isRect && (c = u[0].clone().sub(o), Math.sqrt(c.x * c.x + c.y * c.y) > Math.abs(c.z) ? o.setZ(u[0].z) : (o.setX(u[0].x), o.setY(u[0].y))); else { this.cannotConfirmNormal = !0; for (var c, d, h = this.isRect ? 1 : r - 2, p = 0; p < h; p++) { var f = u[p].clone() , m = u[p + 1].clone() , m = f.sub(m); if (0 != m.x || 0 != m.y) { this.cannotConfirmNormal = !1; break } } this.facePlane && !this.cannotConfirmNormal || (c = kf(u.map(function(e) { return new yn(e.x,e.y) }), 2)) && (d = Up.getNormal2d({ p1: c[0], p2: c[1] }), d = new Cn(d.x,d.y,0), this.facePlane = (new ki).setFromNormalAndCoplanarPoint(d, this.points[0])) } if (2 < r) { if (this.faceDirection || (3 != r && !this.isRect || (this.cannotConfirmNormal = !0), this.facePlane && !this.cannotConfirmNormal || (l = kf(u, 3)) && (this.facePlane = (d = new ki).setFromCoplanarPoints.apply(d, Q(l)))), this.facePlane && !this.cannotConfirmNormal) if (n) { if (Pf.set(o.clone().setZ(1e5), o.clone().setZ(-1e5)), !(o = this.facePlane.intersectLine(Pf, new Cn))) return } else o = this.facePlane.projectPoint(e, new Cn); if (u[t].copy(o), this.isRect && (s = u[(t - 2 + r) % r], l = u[(t - 1 + r) % r], s.equals(l) && ("vertical" == this.faceDirection ? l.add(new Cn(0,0,1e-4)) : l.add(new Cn(0,1e-4,0))), l = (n = Up.getFootPoint(o, s, l)).clone().sub(o), l = s.clone().sub(l), u[(t - 1 + r) % r].copy(n), u[(t + 1) % r].copy(l), this.setPosition((t - 1 + r) % r, n), this.setPosition((t + 1) % r, l)), this.getPoint2dInfo(u), !this.isRect && 3 < r && this.intersectSelf(this.point2dInfo.points2d)) return viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "polygon_isIntersectSelf" }), void (this.isIntersectSelf = !0); this.isIntersectSelf = !1, viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "polygon_isIntersectSelf" }) } 1 < r && (this.faceDirection || 3 < r) && this.guideLine && (Sf.updateLine(this.guideLine, [e, o]), this.guideLine.visible = !0) } if (this.restrictArea) { e = this.restrictArea.holes.concat(this.restrictArea.parentHoles).filter(function(e) { return e != i && 2 < e.points.length }).map(function(e) { return e.points }); if (!Up.isPointInArea(this.restrictArea.points, e, o)) return viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "polygon_AtWrongPlace" }), void (this.isAtWrongPlace = !0) } viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "polygon_AtWrongPlace" }), this.isAtWrongPlace = !1, this.setPosition(t, o), this.update(), this.dispatchEvent({ type: "dragChange", index: t }) } }, { key: "dropMarker", value: function(e) { if (this.isNew && e.pressDistance > Potree.config.clickMaxDragDis) return this.continueDrag(null, e); if (e.isTouch) { if (e.hoverViewport != viewer.mainViewport && this.unableDragAtMap) return viewer.dispatchEvent({ type: "reticule_forbit", v: !0 }), this.continueDrag(null, e); viewer.dispatchEvent({ type: "reticule_forbit", v: !1 }), this.dragMarker(e) } if (e.button != C.RIGHT && (this.isIntersectSelf && this.isNew || this.isAtWrongPlace && this.isNew || !e.isAtDomElement && this.isNew || e.hoverViewport != viewer.mainViewport && this.unableDragAtMap || !kf(this.points, this.points.length))) return this.continueDrag(null, e); var t = this.markers.indexOf(e.drag.object); return -1 !== t && (this.dispatchEvent({ type: "marker_dropped", index: t }), 2 < this.markers.length && this.facePlane && (this.cannotConfirmNormal = !1), this.guideLine && (this.guideLine.visible = !1)), this.setMarkerSelected(e.drag.object, "unhover", "single"), this.editStateChange(!1), e.drag.endDragFun && e.drag.endDragFun(e), !0 } }, { key: "getFacePlane", value: function() { var e; this.points.length < 3 || (this.facePlane = (e = new ki).setFromCoplanarPoints.apply(e, Q(this.points.slice(0, 3)))) } }, { key: "getPoint2dInfo", value: function(e) { var t, n; this.facePlane && (t = e[0].clone(), n = Up.getQuaBetween2Vector(this.facePlane.normal, new Cn(0,0,1), new Cn(0,0,1)), e = e.map(function(e) { return e.clone().applyQuaternion(n) }), this.point2dInfo = { originPoint0: t, points2d: e, quaInverse: n.clone().invert() }) } }, { key: "setPosition", value: function(e, t) { var n = this.points[e]; n.copy(t); e = this.markers[e]; this.updateMarker(e, n) } }, { key: "updateMarker", value: function(e, t) { e.position.copy(t), e.update() } }, { key: "intersectSelf", value: function(e) { for (var t = e.length, n = 0; n < t; n++) for (var i = n + 2; i < t; i++) if (!(Math.abs(i - t - n) < 2)) { var r = e[n] , a = e[n + 1] , o = e[i] , s = e[(i + 1) % t]; if (!(r.equals(a) || o.equals(s) || r.equals(o) || a.equals(o) || r.equals(s) || a.equals(s))) if (Up.isLineIntersect([r, a], [o, s], !1, .001)) return !0 } } }, { key: "removeMarker", value: function(e) { this.points.splice(e, 1); var t = this.markers[e]; this.markers.splice(e, 1), t.dispatchEvent({ type: "dispose" }); var n = e , i = this.edges[n]; i && (this.remove(i), this.edges.splice(n, 1), i.dispatchEvent({ type: "dispose" })), this.point2dInfo && this.point2dInfo.points2d.splice(e, 1), this.dispatchEvent({ type: "removeMarker", index: e, marker: t }) } }, { key: "createAreaPlane", value: function(e) { return new Hr(new Sl,e) } }, { key: "updateAreaPlane", value: function() { var e, t; this.point2dInfo && (this.areaPlane.geometry.dispose(), 2 < this.points.length ? (this.areaPlane.geometry = Cf.getShapeGeo(this.point2dInfo.points2d), t = Up.getCenterOfGravityPoint(this.point2dInfo.points2d), (e = this.point2dInfo.points2d[0].clone()).z = 0, e.applyQuaternion(this.point2dInfo.quaInverse), e = this.point2dInfo.originPoint0.clone().sub(e), (t = new Cn(t.x,t.y,0)).applyQuaternion(this.point2dInfo.quaInverse), this.areaPlane.quaternion.copy(this.point2dInfo.quaInverse), this.areaPlane.position.copy(e), t.add(e), this.center = t) : this.areaPlane.geometry = new Sl) } }, { key: "update", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; if (0 !== this.points.length) { for (var t = this.points.length - 1, n = 0; n <= t; n++) { var i = this.points[n] , r = this.points[t < n + 1 ? 0 : n + 1]; this.points[0 === n ? t : n - 1]; e.ifUpdateMarkers && this.updateMarker(this.markers[n], i); var a = this.edges[n]; a && Sf.updateLine(a, [i, r]) } this.areaPlane && this.updateAreaPlane(), viewer.mapViewer && viewer.mapViewer.dispatchEvent("content_changed") } } }, { key: "dispose", value: function() { this.parent.remove(this), this.markers.concat(this.edges).forEach(function(e) { return e.dispatchEvent({ type: "dispose" }) }) } }, { key: "reDraw", value: function() { for (var e = this.points.length - (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0); 0 < e; ) this.removeMarker(--e); this.point2dInfo = null, this.facePlane = null } }, { key: "setMarkerSelected", value: function() {} }, { key: "editStateChange", value: function(e) { e || (viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "polygon_isIntersectSelf" }), viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "polygon_AtWrongPlace" }), viewer.dispatchEvent({ type: "reticule_forbit", v: !1 }), this.markers.forEach(function(e) { return e.isDragging = !1 })) } }, { key: "transformData", value: function() {} }, { key: "setSelected", value: function() {} }, { key: "continueDrag", value: function(e, t) { var n = this , i = e || t.drag.object; return i.isDragging = !0, setTimeout(function() { n.parent && i.isDragging && viewer.inputHandler.startDragging(i, { endDragFun: t.drag.endDragFun, notPressMouse: t.drag.notPressMouse, dragViewport: t.drag.dragViewport }) }, 1) } }]), a }(); function kf(e, t) { for (var n = [], i = 0; i < e.length; i++) { var r = e[i]; if (!n.find(function(e) { return e.equals(r) }) && (n.push(r), n.length == t)) break } if (n.length == t) return n } var Bf, Lf, Rf = new _c, mu = new Yi(T.measure.default.color), Ff = new Yi(T.measure.highlight.color), If = new Yi(T.measure.color), pd = new Yi(T.measure.textColor), Of = { clipDistance: 4, occlusionDistance: 1 }, zf = { clipDistance: 6, occlusionDistance: 2 }, Nf = { minSize: 25, maxSize: 65, nearBound: .2, farBound: 4 }, Uf = { width2d: 200 }, Gf = { backgroundColor: { r: 255 * mu.r, g: 255 * mu.g, b: 255 * mu.b, a: T.measure.default.opacity }, textColor: { r: 255 * pd.r, g: 255 * pd.g, b: 255 * pd.b, a: 1 }, fontsize: 16, useDepth: !0, renderOrder: 5, pickOrder: 5 }, Hf = { backgroundColor: { r: 255, g: 255, b: 255, a: 1 }, textColor: { r: 0, g: 0, b: 0, a: 1 }, fontsize: 14, renderOrder: 4, pickOrder: 4 }, gu = gn.degToRad(5), Vf = gu, jf = Math.PI / 2 - gu, Wf = function() { y(m, Df); var n = w(m); function m(e) { var t; return O(this, m), e.dimension = "2d", (t = n.call(this, "measure", e)).constructor.counter = void 0 === t.constructor.counter ? 0 : t.constructor.counter + 1, t.name = t.measureType + t.constructor.counter, t.markerLabels = [], t.edgeLabels = [], t.angleLabels = [], t.coordinateLabels = [], t.area = { value: 0, string: "" }, t.closed && (t.areaLabel = t.createAreaLabel(), t.add(t.areaLabel)), (2 < t.maxMarkers || t.faceDirection) && t.createGuideLine(), "Distance" == t.measureType && t.createHorVerGuideLine(), t.selectStates = {}, t.setUnitSystem(e.unit || viewer.unitConvert.UnitService.defaultSystem), viewer.setObjectLayers(g(t), "measure"), t.initData(e), t.points_datasets || (t.points_datasets = []), t.addEventListener("marker_dropped", function(e) { t.updateDatasetBelong(e.index) }), t.addEventListener("isVisible", function() { viewer.mapViewer && viewer.mapViewer.dispatchEvent({ type: "content_changed" }) }), t } return h(m, [{ key: "initData", value: function(e) { b(v(m.prototype), "initData", this).call(this, e) ? this.edges.forEach(function(e) { e.dispatchEvent("addHoverEvent") }) : this.failBuilded = !0 } }, { key: "updateDatasetBelong", value: function(e) { var t = this; if ("merge" != Potree.settings.editType) { this.datasetId; var n, i = { id: null, count: 0 }, r = {}; for (n in this.points_datasets.forEach(function(e) { null != e && (r[e] ? r[e]++ : r[e] = 1) }), r) r[n] > i.count && (i = { id: n, count: r[n] }); this.datasetId = 0 < i.count ? i.id : null, null == this.datasetId ? this.dataset_points = null : this.dataset_points = this.points.map(function(e) { return Potree.Utils.datasetPosTransform({ toDataset: !0, datasetId: t.datasetId, position: e.clone() }) }) } else this.dataset_points[e] = Potree.Utils.datasetPosTransform({ toDataset: !0, datasetId: this.points_datasets[e], position: this.points[e].clone() }) } }, { key: "transformByPointcloud", value: function() { var t = this; null != this.datasetId && (this.points = this.dataset_points.map(function(e) { return Potree.Utils.datasetPosTransform({ fromDataset: !0, datasetId: t.datasetId, position: e.clone() }) }), this.getPoint2dInfo(this.points), this.update({ ifUpdateMarkers: !0 }), this.setSelected(!1)) } }, { key: "update", value: function() { var a = this , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; if (b(v(m.prototype), "update", this).call(this, e), this.showCoordinates && 0 < this.points.length) { var t = this.points[0]; this.markers[0].position.copy(t); var n = this.coordinateLabels[0] , i = viewer.transform.lonlatToLocal.inverse(t.toArray()) , e = viewer.transform.lonlatTo4550.forward(i) , e = [t.toArray(), i, e].map(function(e) { return e.map(function(e) { return Jf.addCommas(e.toFixed(10)) }).join(", ") }).join("
"); return n.setText(e), n.setPos(t), void n.setVisible(!0) } for (var r, o, s, l = function(e, t, n, i) { var r = (new Cn).addVectors(t, n).multiplyScalar(.5); e.setPos(r), i = null == i ? t.distanceTo(n) : i; n = viewer.unitConvert.convert(i, "distance", 3, a.unitSystem, .1, !0); return e.setText(n), i }, u = this.points.length - 1, c = 0; c <= u; c++) { var d, h, p = this.points[c], f = this.points[u < c + 1 ? 0 : c + 1]; this.points[0 === c ? u : c - 1]; this.showDistances && (d = this.edgeLabels[c], h = p.distanceTo(f), d.shouldVisi = (c < u || this.isRect || this.closed && !this.isNew) && 0 < h, d.setVisible(d.shouldVisi), d.visible && l(d, p, f, h)) } "Distance" == this.measureType && 1 < this.points.length && (o = this.points[0].z > this.points[1].z ? (r = this.points[0], this.points[1]) : (r = this.points[1], this.points[0]), s = new Cn(r.x,r.y,o.z), n = r.distanceTo(s) / o.distanceTo(s), n = Math.atan(n), this.shouldShowHorVerGuide = Vf < n && n < jf, Sf.updateLine(this.verGuideEdge, [r, s]), Sf.updateLine(this.horGuideEdge, [o, s]), l(this.verEdgeLabel, r, s), l(this.horEdgeLabel, o, s), this.verGuideEdge.visible = this.horGuideEdge.visible = this.shouldShowHorVerGuide, this.verEdgeLabel.visible = this.horEdgeLabel.visible = this.shouldShowHorVerGuide), this.showArea && this.point2dInfo && (o = Math.abs(Up.getArea(this.point2dInfo.points2d)), s = viewer.unitConvert.convert(o, "area", 3, this.unitSystem), this.area = { value: o, string: s }, this.areaLabel.setPos(this.center), this.areaLabel.setText(s), this.areaLabel.setVisible(!0)) } }, { key: "addMarker", value: function() { var t, e, n = this, i = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, r = new qp({ mat: this.getMarkerMaterial("default"), sizeInfo: Nf, name: "measure_point" }); return viewer.setObjectLayers(r, "measure"), r.pickOrder = r.renderOrder = 3, r.markerSelectStates = {}, r.addEventListener("startDragging", function(e) { "MainView" == e.drag.dragViewport.name && viewer.inputHandler.dispatchEvent({ type: "isMeasuring", v: !0, cause: "startDragging" }) }), r.addEventListener("drop", function(e) { viewer.inputHandler.dispatchEvent({ type: "isMeasuring", v: !1, cause: "stopDragging" }) }), (t = Sf.createFatLine([], { material: this.getLineMat("edgeDefault") })).pickOrder = 0, viewer.setObjectLayers(t, "measure"), t.addEventListener("addHoverEvent", function e() { t.addEventListener("mouseover", function(e) { n.setSelected(!0, "edge") }), t.addEventListener("mouseleave", function(e) { n.setSelected(!1, "edge") }), t.removeEventListener("addHoverEvent", e) }), b(v(m.prototype), "addMarker", this).call(this, { point: i.point, marker: r, edge: t }), this.showEdges && (e = this.createEdgeLabel("edgeLabel", !this.closed), this.edgeLabels.push(e)), this.showCoordinates && ((e = new $p({ className: "measure_pointPos", camera: viewer.scene.getActiveCamera() })).setVisible(!1), this.coordinateLabels.push(e)), this.dispatchEvent({ type: "marker_added", measurement: this, marker: r }), this.update(), r } }, { key: "editStateChange", value: function(e) { var t = this; b(v(m.prototype), "editStateChange", this).call(this, e), e ? this.isEditing || (this.dispatchEvent({ type: "editStateChange", state: !0 }), this.setEdgesDisplay(!0), clearTimeout(this.editStateTimer)) : this.editStateTimer = setTimeout(function() { t.isEditing || (t.dispatchEvent({ type: "editStateChange", state: !1 }), t.setEdgesDisplay(!1)) }, 100), this.isEditing = e } }, { key: "setMarkerSelected", value: function(e, t, n) { e.markerSelectStates[n] = t; var i, r = !1; for (i in e.markerSelectStates) if ("hover" == e.markerSelectStates[i]) { r = !0; break } e.material = r ? this.getMarkerMaterial("select") : this.getMarkerMaterial("default"), e.selected = r, viewer.mapViewer && viewer.mapViewer.dispatchEvent("content_changed") } }, { key: "setEdgesDisplay", value: function(t, e) { this.closed && this.edgeLabels.forEach(function(e) { return e.setVisible(!(!t || !e.shouldVisi)) }), e || "Distance" != this.measureType || (this.horEdgeLabel.visible = this.verEdgeLabel.visible = this.horGuideEdge.visible = this.verGuideEdge.visible = !(!t || !this.shouldShowHorVerGuide)) } }, { key: "setSelected", value: function(e, t) { var n = this; t && (this.selectStates[t] = e); var i, r = !1; for (i in this.selectStates) if (this.selectStates[i]) { r = !0; break } r ? (this.markers.forEach(function(e) { return n.setMarkerSelected(e, "hover", "selectAll") }), this.edges.forEach(function(e) { return e.material = n.getLineMat("edgeSelect") }), this.areaPlane && (this.areaPlane.material = Lf.selected), this.setEdgesDisplay(!0, "screenshot" == t), this.areaLabel && Xf(this.areaLabel, !0), this.closed || this.edgeLabels.forEach(function(e) { return Xf(e, !0) })) : (this.markers.forEach(function(e) { return n.setMarkerSelected(e, "unhover", "selectAll") }), this.edges.forEach(function(e) { return e.material = n.getLineMat("edgeDefault") }), this.areaPlane && (this.areaPlane.material = Lf.default), this.setEdgesDisplay(!1, "screenshot" == t), this.areaLabel && Xf(this.areaLabel, !1), this.closed || this.edgeLabels.forEach(function(e) { return Xf(e, !1) })), this.selected = r, viewer.mapViewer && viewer.mapViewer.dispatchEvent("content_changed"), "byList" != t && this.dispatchEvent({ type: "highlight", state: this.selected }) } }, { key: "removeMarker", value: function(e) { b(v(m.prototype), "removeMarker", this).call(this, e), this.points_datasets.splice(e, 1), this.dataset_points && this.dataset_points.splice(e, 1), this.coordinateLabels.splice(e, 1); this.edgeLabels[e] && (this.edgeLabels[e].dispose(), this.edgeLabels.splice(e, 1)), this.update(), this.dispatchEvent({ type: "marker_removed", measurement: this }) } }, { key: "setPosition", value: function(e, t) { b(v(m.prototype), "setPosition", this).call(this, e, t); t = { type: "marker_moved", measure: this, index: e, position: t.clone() }; this.dispatchEvent(t) } }, { key: "dispose", value: function() { var e = this.edgeLabels.concat(this.coordinateLabels); this.areaLabel && e.push(this.areaLabel), e.forEach(function(e) { return e.dispatchEvent({ type: "dispose" }) }), b(v(m.prototype), "dispose", this).call(this) } }, { key: "getTotalDistance", value: function() { if (0 === this.points.length) return 0; for (var e, t = 0, n = 1; n < this.points.length; n++) { var i = this.points[n - 1] , r = this.points[n]; t += i.distanceTo(r) } return this.closed && 1 < this.points.length && (e = this.points[0], t += this.points[this.points.length - 1].distanceTo(e)), t } }, { key: "getAngleBetweenLines", value: function(e, t, n) { t = (new Cn).subVectors(t, e), e = (new Cn).subVectors(n, e); return 0 === Math.sqrt(t.lengthSq() * e.lengthSq()) ? 0 : t.angleTo(e) } }, { key: "getAngle", value: function(e) { if (this.points.length < 3 || e >= this.points.length) return 0; var t = 0 === e ? this.points[this.points.length - 1] : this.points[e - 1] , n = this.points[e] , e = this.points[(e + 1) % this.points.length]; return this.getAngleBetweenLines(n, t, e) } }, { key: "getCenter", value: function() { return 3 <= this.points.length ? this.center.clone() : 2 == this.points.length ? this.points[0].clone().add(this.points[1]).multiplyScalar(.5) : this.points[0].clone() } }, { key: "createGuideLine", value: function() { var e = Sf.createFatLine([], { material: this.getLineMat("guide") }); e.visible = !1, this.guideLine = e, this.add(e) } }, { key: "createHorVerGuideLine", value: function() { var e = Sf.createFatLine([], { material: this.getLineMat("guide") }); e.visible = !1, this.verGuideEdge = e; e = Sf.createFatLine([], { material: this.getLineMat("guide") }); e.visible = !1, this.horGuideEdge = e, this.add(this.verGuideEdge), this.add(this.horGuideEdge), this.verEdgeLabel = this.createEdgeLabel("verGuideEdge"), this.horEdgeLabel = this.createEdgeLabel("horGuideEdge") } }, { key: "createEdgeLabel", value: function(e, t) { var n = this , e = new Jp($.extend(t ? Gf : Hf, { sizeInfo: Uf, name: e || "edgeLabel" })); return t && (e.addEventListener("mouseover", function() { n.setSelected(!0, "edgeLabel") }), e.addEventListener("mouseleave", function() { n.setSelected(!1, "edgeLabel") }), e.addEventListener("click", function() { viewer.focusOnObject(n, "measure") })), e.visible = !1, e.sprite.material.depthTestWhenPick = !0, viewer.setObjectLayers(e, "measure"), this.add(e), e } }, { key: "createAreaLabel", value: function() { var e = this , t = new Jp($.extend(Gf, { sizeInfo: Uf, name: "areaLabel_" })); return t.addEventListener("mouseover", function() { e.setSelected(!0, "areaLabel") }), t.addEventListener("mouseleave", function() { e.setSelected(!1, "areaLabel") }), t.addEventListener("click", function() { viewer.focusOnObject(e, "measure") }), viewer.setObjectLayers(t, "measure"), t.visible = !1, t } }, { key: "getMarkerMaterial", value: function(e) { return Bf || (Bf = { default: new Wp($.extend({}, Of, { transparent: !0, opacity: 1, map: Rf.load(Potree.resourcePath + "/textures/pic_point_s32.png"), useDepth: !0 })), select: new $i({ transparent: !0, opacity: 1, depthTest: !1, map: Rf.load(Potree.resourcePath + "/textures/pic_point32.png") }) }, m.markerMats = Bf), Bf[e] } }, { key: "getLineMat", value: function(e) { return (m.lineMats = !m.lineMats ? { edgeDefault: Sf.createFatLineMat({ color: T.measure.default.color, lineWidth: T.measure.lineWidth, useDepth: !0, dashWithDepth: !0, dashed: !0, dashSize: .04, gapSize: .04, transparent: !0, opacity: T.measure.default.opacity, depthTestWhenPick: !0 }), edgeSelect: Sf.createFatLineMat({ color: T.measure.highlight.color, dashSize: .5, gapSize: .2, lineWidth: T.measure.lineWidth, transparent: !0, opacity: T.measure.highlight.opacity }), guide: Sf.createFatLineMat({ color: T.measure.guide.color, dashSize: .1, gapSize: .02, dashed: !0, lineWidth: T.measure.lineWidth }) } : m.lineMats)[e] } }, { key: "createAreaPlane", value: function() { return Lf || (Lf = { default: new Wp($.extend({}, zf, { color: If, side: Y, opacity: .2, transparent: !0, useDepth: !0 })), selected: new $i({ color: If, side: Y, opacity: .3, transparent: !0 }) }, m.planeMats = Lf), b(v(m.prototype), "createAreaPlane", this).call(this, Lf.default) } }, { key: "raycast", value: function(e, t) { for (var n = 0; n < this.points.length; n++) this.markers[n].raycast(e, t); for (var i = 0; i < t.length; i++) { var r = t[i]; r.distance = e.ray.origin.distanceTo(r.point) } t.sort(function(e, t) { return e.distance - t.distance }) } }, { key: "transformData", value: function(e) { "Point" == e.measureType ? (e.showCoordinates = !0, e.closed = !0, e.maxMarkers = 1, e.minMarkers = 1) : "Distance" == e.measureType ? (e.showDistances = !0, e.closed = !1, e.showEdges = !0, e.maxMarkers = 2, e.minMarkers = 2) : "Ver Distance" == e.measureType ? (e.showDistances = !0, e.closed = !1, e.showEdges = !0, e.maxMarkers = 2, e.minMarkers = 2, e.faceDirection = "vertical", e.unableDragAtMap = !0) : "Hor Distance" == e.measureType ? (e.showDistances = !0, e.closed = !1, e.showEdges = !0, e.maxMarkers = 2, e.minMarkers = 2, e.faceDirection = "horizontal") : "Area" == e.measureType ? (e.showDistances = !0, e.showArea = !0, e.showEdges = !0, e.closed = !0, e.minMarkers = 3) : "Hor Area" == e.measureType ? (e.showDistances = !0, e.showArea = !0, e.showEdges = !0, e.closed = !0, e.minMarkers = 3, e.faceDirection = "horizontal") : "Ver Area" == e.measureType ? (e.showDistances = !0, e.showArea = !0, e.showEdges = !0, e.closed = !0, e.minMarkers = 3, e.faceDirection = "vertical", e.unableDragAtMap = !0) : "Rect Area" == e.measureType ? (e.showDistances = !0, e.showArea = !0, e.showEdges = !0, e.closed = !0, e.minMarkers = 4, e.maxMarkers = 4) : "Hor Rect Area" == e.measureType ? (e.showDistances = !0, e.showArea = !0, e.showEdges = !0, e.closed = !0, e.minMarkers = 4, e.maxMarkers = 4, e.isRect = !0, e.faceDirection = "horizontal") : "Ver Rect Area" == e.measureType && (e.showDistances = !0, e.showArea = !0, e.showEdges = !0, e.closed = !0, e.minMarkers = 4, e.maxMarkers = 4, e.isRect = !0, e.faceDirection = "vertical", e.unableDragAtMap = !0) } }, { key: "setUnitSystem", value: function(e) { e != this.unitSystem && (this.unitSystem = e, this.update()) } }, { key: "reDraw", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0; b(v(m.prototype), "reDraw", this).call(this, e), "Distance" == this.measureType && (this.shouldShowHorVerGuide = !1, this.setEdgesDisplay(!1)), this.showArea && (this.area = { value: 0 }, this.areaLabel && this.areaLabel.setVisible(!1)), viewer.inputHandler.dispatchEvent({ type: "isMeasuring", v: !0, cause: "reDraw" }) } }]), m }(); function Xf(e, t) { t ? (e.backgroundColor = { r: 255 * Ff.r, g: 255 * Ff.g, b: 255 * Ff.b, a: T.measure.highlight.opacity }, e.backgroundColor.a = T.measure.highlight.opacity, e.sprite.material.useDepth = !1) : (e.backgroundColor = Gf.backgroundColor, e.backgroundColor.a = T.measure.default.opacity, e.sprite.material.useDepth = !0), e.updateTexture() } var qf = function() { y(r, Si); var i = w(r); function r(e) { var t, n; return O(this, r), (n = i.call(this)).constructor.counter = void 0 === n.constructor.counter ? 0 : n.constructor.counter + 1, n.name = "polygon_clip_volume_" + n.constructor.counter, n.camera = e.clone(), (t = n.camera.rotation).set.apply(t, Q(e.rotation.toArray())), n.camera.rotation.order = e.rotation.order, n.camera.updateMatrixWorld(), n.camera.updateProjectionMatrix(), n.camera.matrixWorldInverse.copy(n.camera.matrixWorld).invert(), n.viewMatrix = n.camera.matrixWorldInverse.clone(), n.projMatrix = n.camera.projectionMatrix.clone(), n.markers = [], n.initialized = !1, n } return h(r, [{ key: "addMarker", value: function() { function t(e) { var t = e.viewer.renderer.getSize(new yn) , t = new Cn(e.drag.end.x / t.width * 2 - 1,e.drag.end.y / t.height * -2 + 1,0); i.position.copy(t) } function n(e) { r() } var i = new Hr , r = function(e) { i.removeEventListener("drag", t), i.removeEventListener("drop", n) }; i.addEventListener("drag", t), i.addEventListener("drop", n), this.markers.push(i) } }, { key: "removeLastMarker", value: function() { 0 < this.markers.length && this.markers.splice(this.markers.length - 1, 1) } }]), r }() , Jf = function() { function g() { O(this, g) } var t, n, i; return h(g, null, [{ key: "loadShapefileFeatures", value: (i = r(regeneratorRuntime.mark(function e(t, n) { var i, r, a, o; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return i = [], r = function() { n(i) } , e.next = 4, shapefile.open(t); case 4: a = e.sent; case 5: return e.next = 8, a.read(); case 8: if ((o = e.sent).done) return r(), e.abrupt("break", 15); e.next = 12; break; case 12: o.value && "Feature" === o.value.type && void 0 !== o.value.geometry && i.push(o.value), e.next = 5; break; case 15: case "end": return e.stop() } }, e) })), function(e, t) { return i.apply(this, arguments) } ) }, { key: "toString", value: function(e) { return null != e.x ? e.x.toFixed(2) + ", " + e.y.toFixed(2) + ", " + e.z.toFixed(2) : "" + e } }, { key: "normalizeURL", value: function(e) { e = new URL(e); return e.protocol + "//" + e.hostname + e.pathname.replace(/\/+/g, "/") } }, { key: "pathExists", value: function(e) { var t = Gp.createXMLHttpRequest(); return t.open("GET", e, !1), t.send(null), 200 === t.status } }, { key: "debugSphere", value: function(e, t, n, i) { var r = new Su(1,8,8) , i = void 0 !== i ? new $i({ color: i }) : new Xu , i = new Hr(r,i); return i.position.copy(t), i.scale.set(n, n, n), e.add(i), i } }, { key: "debugLine", value: function(e, t, n, i) { var r = new tl({ color: i }) , a = new Sl , i = new Cn(0,0,0) , n = n.clone().sub(t); a.vertices.push(i, n); r = new sl(a,r); return r.position.copy(t), e.add(r), { node: r, set: function(e, t) { a.vertices[0].copy(e), a.vertices[1].copy(t), a.verticesNeedUpdate = !0 } } } }, { key: "debugCircle", value: function(e, t, n, i, r) { for (var r = new tl({ color: r }), a = new Sl, o = 0; o <= 32; o++) { var s = 2 * Math.PI * (o / 32) , l = 2 * Math.PI * (o + 1) / 32 , s = new Cn(Math.cos(s),Math.sin(s),0) , l = new Cn(Math.cos(l),Math.sin(l),0); a.vertices.push(s, l) } r = new sl(a,r); r.position.copy(t), r.scale.set(n, n, n), e.add(r) } }, { key: "debugBox", value: function(e, t) { var n, i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : new ni, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 16776960, a = [[t.min.x, t.min.y, t.min.z], [t.min.x, t.min.y, t.max.z], [t.min.x, t.max.y, t.min.z], [t.min.x, t.max.y, t.max.z], [t.max.x, t.min.y, t.min.z], [t.max.x, t.min.y, t.max.z], [t.max.x, t.max.y, t.min.z], [t.max.x, t.max.y, t.max.z]].map(function(e) { return B(Cn, Q(e)) }), o = t.getCenter(new Cn), t = [{ position: [t.min.x, o.y, o.z], color: 16711680 }, { position: [t.max.x, o.y, o.z], color: 8912896 }, { position: [o.x, t.min.y, o.z], color: 65280 }, { position: [o.x, t.max.y, o.z], color: 34816 }, { position: [o.x, o.y, t.min.z], color: 255 }, { position: [o.x, o.y, t.max.z], color: 136 }], s = ue(a); try { for (s.s(); !(n = s.n()).done; ) { var l = n.value.clone().applyMatrix4(i); g.debugSphere(e, l, .1, 16711680) } } catch (e) { s.e(e) } finally { s.f() } for (var u = 0, c = [[0, 4], [4, 5], [5, 1], [1, 0], [2, 6], [6, 7], [7, 3], [3, 2], [0, 2], [4, 6], [5, 7], [1, 3]]; u < c.length; u++) { var d = c[u] , h = a[d[0]].clone().applyMatrix4(i) , d = a[d[1]].clone().applyMatrix4(i); g.debugLine(e, h, d, r) } for (var p = 0, f = t; p < f.length; p++) { var m = f[p] , v = B(Cn, Q(m.position)).applyMatrix4(i); g.debugSphere(e, v, .1, m.color) } } }, { key: "debugPlane", value: function(e, t) { t = new Hh(t,2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1,3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 255); e.add(t) } }, { key: "computeTransformedBoundingBox", value: function(e, t) { e = [new Cn(e.min.x,e.min.y,e.min.z).applyMatrix4(t), new Cn(e.min.x,e.min.y,e.min.z).applyMatrix4(t), new Cn(e.max.x,e.min.y,e.min.z).applyMatrix4(t), new Cn(e.min.x,e.max.y,e.min.z).applyMatrix4(t), new Cn(e.min.x,e.min.y,e.max.z).applyMatrix4(t), new Cn(e.min.x,e.max.y,e.max.z).applyMatrix4(t), new Cn(e.max.x,e.max.y,e.min.z).applyMatrix4(t), new Cn(e.max.x,e.min.y,e.max.z).applyMatrix4(t), new Cn(e.max.x,e.max.y,e.max.z).applyMatrix4(t)], t = new kn; return t.setFromPoints(e), t } }, { key: "addCommas", value: function(e) { for (var e = (e += "").split("."), t = e[0], e = 1 < e.length ? "." + e[1] : "", n = /(\d+)(\d{3})/; n.test(t); ) t = t.replace(n, "$1,$2"); return t + e } }, { key: "removeCommas", value: function(e) { return e.replace(/,/g, "") } }, { key: "createWorker", value: function(e) { e = new Blob([e],{ type: "application/javascript" }); return new Worker(URL.createObjectURL(e)) } }, { key: "moveTo", value: function(e, t, n) { var i = e.view , r = e.getActiveCamera() , e = TWEEN.Easing.Quartic.Out , t = new TWEEN.Tween(i.position).to(t, 500); t.easing(e), t.start(); var t = r.position.distanceTo(n) , a = (new Cn).addVectors(r.position, r.getWorldDirection(new Cn).clone().multiplyScalar(t)) , n = new TWEEN.Tween(a).to(n, 500); n.easing(e), n.onUpdate(function() { i.lookAt(a) }), n.onComplete(function() { i.lookAt(a) }), n.start() } }, { key: "loadSkybox", value: function(e) { var t = new Si , n = new $r(75,window.innerWidth / window.innerHeight,1,1e5); window.axisYup || n.up.set(0, 0, 1); for (var i = new gs, r = ".jpg", a = [e + "px" + r, e + "nx" + r, e + "py" + r, e + "ny" + r, e + "pz" + r, e + "nz" + r], o = [], s = 0; s < 6; s++) !function(e) { var t = new $i({ map: null, side: J, depthTest: !1, depthWrite: !1, color: 4343126 }); o.push(t), (new _c).load(a[e], function(e) { t.map = e, t.needsUpdate = !0, t.color.setHex(16777215) }, function(e) {}, function(e) { console.log("An error happened", e) }) }(s); r = new Hr(new Cl(700,700,700),o); return i.add(r), i.traverse(function(e) { return e.frustumCulled = !1 }), i.rotation.x = Math.PI / 2, t.children.push(n), n.parent = t, { camera: n, scene: i, parent: t } } }, { key: "createGrid", value: function(e, t, n, i) { for (var i = new tl({ color: i || 8947848 }), r = new Sl, a = 0; a <= t; a++) r.vertices.push(new Cn(-n * e / 2,a * n - n * t / 2,0)), r.vertices.push(new Cn(+n * e / 2,a * n - n * t / 2,0)); for (var o = 0; o <= e; o++) r.vertices.push(new Cn(o * n - n * e / 2,-n * t / 2,0)), r.vertices.push(new Cn(o * n - n * e / 2,+n * t / 2,0)); i = new cl(r,i); return i.receiveShadow = !0, i } }, { key: "createBackgroundTexture", value: function(e, t) { function n(e, t) { return 1 / (2 * Math.PI) * Math.exp(-(e * e + t * t) / 2) } for (var i = new Uint8Array(3 * (e * t)), r = [1, 1.5, 1.7], a = n(0, 0), o = 0; o < e; o++) for (var s = 0; s < t; s++) { var l = o + e * s , u = n(2 * (o / e * 2 - 1), 2 * (s / t * 2 - 1)) / a , c = (.5 * u + .5) * (c = (Math.random() + Math.random() + Math.random()) / 3) * .03; c *= .4, i[3 * l + 0] = 255 * (u / 15 + .05 + c) * r[0], i[3 * l + 1] = 255 * (u / 15 + .05 + c) * r[1], i[3 * l + 2] = 255 * (u / 15 + .05 + c) * r[2] } var d = new ia(i,e,t,$e); return d.needsUpdate = !0, d } }, { key: "getMousePointCloudIntersection", value: function(e, t, n, i, r, a) { var o = 6 < arguments.length && void 0 !== arguments[6] ? arguments[6] : {}; if (a && 0 != a.length) { var s = r.renderer; e ? (o.x = t.x, o.y = e.resolution.y - t.y) : (o.x = t.x, o.y = s.domElement.clientHeight - t.y); t = new sh; t.setFromCamera(n, i); var l, u, c = t.ray, d = null, h = 1 / 0, p = null, f = null, m = new Map; o.isMeasuring || "showPanos" == Potree.settings.displayMode ? (l = Potree.settings.pointDensity, Potree.settings.pointDensity = "magnifier", a.forEach(function(e) { m.set(e, e.temp.pointSize), u = e.material.pointSizeType, e.material.pointSizeType = Potree.config.material.pointSizeType, e.changePointSize(2 * Potree.config.material.realPointSize, !0) }), Potree.updatePointClouds(a, i, e.resolution)) : (1 < r.viewports.filter(function(e) { return !e.noPointcloud && e.active }).length || o.cameraChanged) && (e.beforeRender && e.beforeRender(), Potree.updatePointClouds(a, i, e.resolution)); var v, g = [], y = ue(a); try { for (y.s(); !(v = y.n()).done; ) { var w, b = v.value, x = b.pick(r, e, i, c, o); x && (g.push(b), (w = i.position.distanceTo(x.position)) < h && (h = w, d = b, p = x.position, f = x)) } } catch (e) { y.e(e) } finally { y.f() } return !o.isMeasuring && "showPanos" != Potree.settings.displayMode || (Potree.settings.pointDensity = l, a.forEach(function(e) { e.material.pointSizeType = u, e.changePointSize(m.get(e)) })), d ? { location: p, distance: h, pointcloud: d, point: f, pointclouds: g, normal: (new Cn).fromArray(f.normal) } : null } } }, { key: "renderTargetToDataUrl", value: function(e, t, n, i) { var r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : .7 , a = new Uint8Array(4 * (t * n)); return i.readRenderTargetPixels(e, 0, 0, t, n, a), Potree.Utils.pixelsArrayToDataUrl(a, t, n, r) } }, { key: "pixelsArrayToDataUrl", value: function(e, t, n) { var i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : .7 , r = document.createElement("canvas"); r.width = t, r.height = n; var a = r.getContext("2d"); e = new e.constructor(e); for (var o = 4 * t, s = 0; s < parseInt(n / 2); s++) { var l = n - s - 1 , u = e.slice(s * o, s * o + o) , c = e.slice(l * o, l * o + o); e.set(c, s * o), e.set(u, l * o) } t = a.createImageData(t, n); return t.data.set(e), a.putImageData(t, 0, 0), r.toDataURL(i) } }, { key: "removeListeners", value: function(e, t) { void 0 !== e._listeners && e._listeners[t] && delete e._listeners[t] } }, { key: "mouseToRay", value: function(e, t) { var n = new Cn(e.x,e.y,1) , e = new Cn(e.x,e.y,-1); n.unproject(t), e.unproject(t); n = (new Cn).subVectors(n, e).normalize(); return new ti(e,n) } }, { key: "getPos2d", value: function(e, t, n, i) { var r = Up.closeTo(t.position, e, 1e-5) ? new Cn(0,0,1.5) : e.clone().project(t) , a = (r.x + 1) / 2 * n.clientWidth * i.width , e = (1 - (r.y + 1) / 2) * n.clientHeight * i.height , t = i.left * n.clientWidth , i = (1 - i.bottom - i.height) * n.clientHeight , n = r.x <= 1 && -1 <= r.x && r.x <= 1 && -1 <= r.y; return { pos: new yn(t + a,i + e), vector: r, trueSide: r.z < 1, inSight: n, posInViewport: new yn(a,e) } } }, { key: "projectedRadius", value: function(e, t, n, i, r) { if (t instanceof ed) return g.projectedRadiusOrtho(e, t.projectionMatrix, i, r); if (t instanceof $r) return g.projectedRadiusPerspective(e, t.fov * Math.PI / 180, n, r); throw new Error("invalid parameters") } }, { key: "projectedRadiusPerspective", value: function(e, t, n, i) { return e * (1 / Math.tan(t / 2) / n * i / 2) } }, { key: "projectedRadiusOrtho", value: function(e, t, n, i) { var r = new Mn(0) , e = new Mn(e); return r.applyMatrix4(t), e.applyMatrix4(t), r = new Cn(r.x,r.y,r.z), e = new Cn(e.x,e.y,e.z), r.x = .5 * (r.x + 1) * n, r.y = .5 * (r.y + 1) * i, e.x = .5 * (e.x + 1) * n, e.y = .5 * (e.y + 1) * i, r.distanceTo(e) } }, { key: "topView", value: function(e, t) { e.position.set(0, 1, 0), e.rotation.set(-Math.PI / 2, 0, 0), e.zoomTo(t, 1) } }, { key: "frontView", value: function(e, t) { e.position.set(0, 0, 1), e.rotation.set(0, 0, 0), e.zoomTo(t, 1) } }, { key: "leftView", value: function(e, t) { e.position.set(-1, 0, 0), e.rotation.set(0, -Math.PI / 2, 0), e.zoomTo(t, 1) } }, { key: "rightView", value: function(e, t) { e.position.set(1, 0, 0), e.rotation.set(0, Math.PI / 2, 0), e.zoomTo(t, 1) } }, { key: "findClosestGpsTime", value: function(e, t) { var n, i = performance.now(), r = [], a = ue(t.scene.pointclouds); try { for (a.s(); !(n = a.n()).done; ) { var o = n.value; r.push(o.root); var s, l = ue(o.root.children); try { for (l.s(); !(s = l.n()).done; ) { var u = s.value; u && r.push(u) } } catch (e) { l.e(e) } finally { l.f() } } } catch (e) { a.e(e) } finally { a.f() } for (var c = null, d = 1 / 0, h = 1 / 0, p = 0, f = r; p < f.length; p++) { var m = f[p]; if (null != m.geometryNode && null != m.geometryNode.geometry && null != m.sceneNode) for (var v = m.geometryNode.geometry.attributes["gps-time"], g = v.potree.range, y = 0; y < v.array.length; y++) { var w = (w = v.array[y]) * (g[1] - g[0]) + g[0] , w = Math.abs(e - w); w < h && (d = y, h = w, c = m) } } t = c.geometryNode.geometry, t = new Cn(t.attributes.position.array[3 * d + 0],t.attributes.position.array[3 * d + 1],t.attributes.position.array[3 * d + 2]); t.applyMatrix4(c.sceneNode.matrixWorld); i = performance.now() - i; return console.log("duration: ".concat(i.toFixed(3), "ms")), { node: c, index: d, position: t } } }, { key: "frustumSphereIntersection", value: function(e, t) { for (var n = e.planes, i = t.center, r = -t.radius, a = Number.MAX_VALUE, o = 0; o < 6; o++) { var s = n[o].distanceToPoint(i); if (s < r) return 0; a = Math.min(a, s) } return a >= t.radius ? 2 : 1 } }, { key: "generateDataTexture", value: function(e, t, n) { for (var i = e * t, r = new Uint8Array(4 * e * t), a = Math.floor(255 * n.r), o = Math.floor(255 * n.g), s = Math.floor(255 * n.b), l = 0; l < i; l++) r[3 * l] = a, r[3 * l + 1] = o, r[3 * l + 2] = s; t = new ia(r,e,t,et); return t.needsUpdate = !0, t.magFilter = Re, t } }, { key: "getParameterByName", value: function(e) { e = e.replace(/[[]/, "\\[").replace(/[\]]/, "\\]"); e = new RegExp("[\\?&]" + e + "=([^&#]*)").exec(document.location.search); return null === e ? null : decodeURIComponent(e[1].replace(/\+/g, " ")) } }, { key: "setParameter", value: function(e, t) { e = e.replace(/[[]/, "\\[").replace(/[\]]/, "\\]"); var n = new RegExp("([\\?&])(" + e + "=([^&#]*))").exec(document.location.search) , i = window.location.href; i = null === n ? (0 === window.location.search.length ? i += "?" : i += "&", i + e + "=" + t) : i.replace(n[2], e + "=" + t), window.history.replaceState({}, "", i) } }, { key: "createChildAABB", value: function(e, t) { var n = e.min.clone() , i = e.max.clone() , e = (new Cn).subVectors(i, n); return 0 < (1 & t) ? n.z += e.z / 2 : i.z -= e.z / 2, 0 < (2 & t) ? n.y += e.y / 2 : i.y -= e.y / 2, 0 < (4 & t) ? n.x += e.x / 2 : i.x -= e.x / 2, new kn(n,i) } }, { key: "clipboardCopy", value: function(e) { var t = document.createElement("textarea"); t.style.position = "fixed", t.style.top = 0, t.style.left = 0, t.style.width = "2em", t.style.height = "2em", t.style.padding = 0, t.style.border = "none", t.style.outline = "none", t.style.boxShadow = "none", t.style.background = "transparent", t.value = e, document.body.appendChild(t), t.select(); try { document.execCommand("copy") ? console.log("copied text to clipboard") : console.log("copy to clipboard failed") } catch (e) { console.log("error while trying to copy to clipboard") } document.body.removeChild(t) } }, { key: "getMeasurementIcon", value: function(e) { return e instanceof Wf ? !e.showDistances || e.showArea || e.showAngles ? e.showDistances && e.showArea && !e.showAngles ? "".concat(Potree.resourcePath, "/icons/area.svg") : 1 === e.maxMarkers ? "".concat(Potree.resourcePath, "/icons/point.svg") : e.showDistances || e.showArea || !e.showAngles ? e.showHeight ? "".concat(Potree.resourcePath, "/icons/height.svg") : "".concat(Potree.resourcePath, "/icons/distance.svg") : "".concat(Potree.resourcePath, "/icons/angle.png") : "".concat(Potree.resourcePath, "/icons/distance.svg") : e instanceof Kp ? "".concat(Potree.resourcePath, "/icons/profile.svg") : e instanceof Yp ? "".concat(Potree.resourcePath, "/icons/volume.svg") : e instanceof qf ? "".concat(Potree.resourcePath, "/icons/clip-polygon.svg") : void 0 } }, { key: "lineToLineIntersection", value: function(e, t, n, i) { function r(e, t, n, i) { return (a[e].x - a[t].x) * (a[n].x - a[i].x) + (a[e].y - a[t].y) * (a[n].y - a[i].y) + (a[e].z - a[t].z) * (a[n].z - a[i].z) } var a = [e, t, n, i] , o = (r(0, 2, 3, 2) * r(3, 2, 1, 0) - r(0, 2, 1, 0) * r(3, 2, 3, 2)) / (r(1, 0, 1, 0) * r(3, 2, 3, 2) - r(3, 2, 1, 0) * r(3, 2, 1, 0)) , s = (r(0, 2, 3, 2) + o * r(3, 2, 1, 0)) / r(3, 2, 3, 2) , t = t.clone().sub(e) , i = i.clone().sub(n) , o = e.clone().add(t.multiplyScalar(o)) , s = n.clone().add(i.multiplyScalar(s)); return o.clone().add(s).multiplyScalar(.5) } }, { key: "computeCircleCenter", value: function(e, t, n) { var i = t.clone().sub(e) , r = n.clone().sub(e) , a = r.clone().cross(i).normalize() , i = i.clone().cross(a).normalize() , a = r.clone().cross(a).normalize() , t = e.clone().add(t).multiplyScalar(.5) , e = e.clone().add(n).multiplyScalar(.5) , n = t , t = t.clone().add(i) , i = e , a = e.clone().add(a); return g.lineToLineIntersection(n, t, i, a) } }, { key: "getNorthVec", value: function(e, t, n) { if (n) { proj4.defs("pointcloud", n); var i = proj4("pointcloud", "WGS84") , r = i.forward(e.toArray()) , a = i.forward([e.x, e.y + t]) , n = Math.sqrt(Math.pow(a[0] - r[0], 2) + Math.pow(a[1] - r[1], 2)) , a = [r[0], r[1] + n] , a = i.inverse(a); return B(Cn, Q(a).concat([e.z])).sub(e) } return new Cn(0,1,0).multiplyScalar(t) } }, { key: "computeAzimuth", value: function(e, t, n) { var i; return -(n ? (n = (i = n.includes("EPSG") ? proj4(n, "WGS84") : (proj4.defs("pointcloud", n), proj4("pointcloud", "WGS84"))).forward(e.toArray()), n = [(i = i.forward(t.toArray()))[0] - n[0], i[1] - n[1]], Math.atan2(n[1], n[0]) - Math.PI / 2) : (e = [t.x - e.x, t.y - e.y], Math.atan2(e[1], e[0]) - Math.PI / 2)) } }, { key: "loadScript", value: (n = r(regeneratorRuntime.mark(function e(n) { return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return e.abrupt("return", new Promise(function(e) { var t; document.getElementById(n) ? e() : ((t = document.createElement("script")).id = n, t.onload = function() { e() } , t.src = n, document.body.appendChild(t)) } )); case 1: case "end": return e.stop() } }, e) })), function(e) { return n.apply(this, arguments) } ) }, { key: "createSvgGradient", value: function(e) { var t = "".concat(Math.random(), "_").concat(Date.now()) , n = "http://www.w3.org/2000/svg" , i = document.createElementNS(n, "svg"); i.setAttributeNS(null, "width", "2em"), i.setAttributeNS(null, "height", "3em"); var r = document.createElementNS(n, "defs") , a = document.createElementNS(n, "linearGradient"); a.setAttributeNS(null, "id", t), a.setAttributeNS(null, "gradientTransform", "rotate(90)"); for (var o = e.length - 1; 0 <= o; o--) { var s = e[o] , l = parseInt(100 - 100 * s[0]) , u = N(s[1].toArray().map(function(e) { return parseInt(255 * e) }), 3) , c = u[0] , d = u[1] , s = u[2] , u = document.createElementNS(n, "stop"); u.setAttributeNS(null, "offset", "".concat(l, "%")), u.setAttributeNS(null, "stop-color", "rgb(".concat(c, ", ").concat(d, ", ").concat(s, ")")), a.appendChild(u) } r.appendChild(a), i.appendChild(r); r = document.createElementNS(n, "rect"); return r.setAttributeNS(null, "width", "100%"), r.setAttributeNS(null, "height", "100%"), r.setAttributeNS(null, "fill", 'url("#'.concat(t, '")')), r.setAttributeNS(null, "stroke", "black"), r.setAttributeNS(null, "stroke-width", "0.1em"), i.appendChild(r), i } }, { key: "waitAny", value: (t = r(regeneratorRuntime.mark(function e(n) { return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return e.abrupt("return", new Promise(function(t) { n.map(function(e) { e.then(function() { t() }) }) } )); case 1: case "end": return e.stop() } }, e) })), function(e) { return t.apply(this, arguments) } ) }]), g }(); Jf.screenPass = new function() { this.screenScene = new gs, this.screenQuad = new Hr(new ua(2,2,1)), this.screenQuad.material.depthTest = !0, this.screenQuad.material.depthWrite = !0, this.screenQuad.material.transparent = !0, this.screenScene.add(this.screenQuad), this.camera = new Kr, this.render = function(e, t, n) { this.screenQuad.material = t, void 0 === n || e.setRenderTarget(n), e.render(this.screenScene, this.camera) } } , Jf.computePointcloudsBound = function(e) { var t = new kn; return e.forEach(function(e) { e.updateBound(), t.union(e.bound) }), { boundSize: t.getSize(new Cn), center: t.getCenter(new Cn), boundingBox: t } } , Jf.convertScreenPositionToNDC = function(e, t, n, i) { return (e = e || new yn).x = t.x / n * 2 - 1, e.y = -t.y / i * 2 + 1, e } , Jf.convertNDCToScreenPosition = function(e, t, n, i) { return (t = t || new yn).x = Math.round((e.x + 1) / 2 * n), t.y = Math.round(-(e.y - 1) / 2 * i), t } , Jf.getOrthoCameraMoveVec = function(e, t) { var n = t.right / t.zoom , i = t.top / t.zoom , r = new Cn; return r.set(e.x * n, e.y * i, 0).applyQuaternion(t.quaternion), r } , Jf.VectorFactory = { fromArray: function(e) { if (e) return (e.length < 2 || 3 < e.length) && console.error("Wrong number of ordinates for a point!"), (new (3 === e.length ? Cn : yn)).fromArray(e) }, fromArray3: function(e) { if (e) return 3 !== e.length && console.error("Wrong number of ordinates for a point!"), (new Cn).fromArray(e) }, fromArray2: function(e) { if (e) return 2 !== e.length && console.error("Wrong number of ordinates for a point!"), (new yn).fromArray(e) }, toString: function(e) { return e.x.toFixed(8) + "," + e.y.toFixed(8) + "," + e.z.toFixed(3) } }, Jf.QuaternionFactory = { rot90: (new Sn).setFromAxisAngle(new Cn(0,0,1), gn.degToRad(-90)), fromArray: function(e) { if (e) return 4 !== e.length && console.error("Wrong number of ordinates for a quaternion!"), new Sn(e[1],e[2],e[3],e[0]).multiply(this.rot90) }, toArray: function(e) { if (e) { e = e.clone().multiply(a).toArray(); return [e[3], e[0], e[1], e[2]] } }, fromLonLat: function(e) { if (e) return (new Sn).setFromEuler(new ci(e.lon,e.lat,0)) }, toLonLat: function(e) { if (e) { e = (new ci).setFromQuaternion(e); return { lon: e.x, lat: e.y } } } }, Jf.datasetPosTransform = function() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, n = t.pointcloud || viewer.scene.pointclouds.find(function(e) { return e.dataset_id == t.datasetId }); if (n ? e = "merge" == Potree.settings.editType ? t.fromDataset ? n.matrixWorld : (new ni).copy(n.matrixWorld).invert() : t.fromDataset ? n.transformMatrix : n.transformInvMatrix : !Potree.settings.intersectOnObjs || (n = t.object || viewer.objs.children.find(function(e) { return e.dataset_id == t.datasetId })) && (e = t.fromDataset ? n.matrixWorld : (new ni).copy(n.matrixWorld).invert()), e) return (new Cn).copy(t.position).applyMatrix4(e); null != t.datasetId && console.error("datasetPosTransform找不到datasetId为".concat(t.datasetId, "的数据集或模型,请检查数据, 模型未创建或删除")) } , Jf.datasetRotTransform = function() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, n = t.pointcloud || viewer.scene.pointclouds.find(function(e) { return e.dataset_id == t.datasetId }); if (n) { if (t.rotation) i = (new ni).makeRotationFromEuler(t.rotation); else if (t.quaternion) i = (new ni).makeRotationFromQuaternion(t.quaternion); else { if (!t.matrix) return; i = t.matrix.clone() } var n = t.fromDataset ? n.rotateMatrix : n.rotateInvMatrix , i = (new ni).multiplyMatrices(n, i); return t.getRotation ? e = (new ci).setFromRotationMatrix(i) : t.getQuaternion ? e = (new Sn).setFromRotationMatrix(i) : t.getMatrix && (e = i), e } } , Jf.isInsideFrustum = function(e, t) { var n = new ni; n.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse); t = new oa; return t.setFromProjectionMatrix(n), e instanceof qn ? t.intersectsSphere(e) : t.intersectsBox(e) } , Jf.isInsideBox = function(e, t) { var n = new oa; if (n.setFromProjectionMatrix(t), e instanceof kn) return n.intersectsSphere(e); if (e instanceof Array) { var i = new qn; return i.setFromPoints(e), this.isInsideBox(i, t) } return e instanceof qn ? n.intersectsSphere(e) : e instanceof Cn ? n.containsPoint(e) : void 0 } , Jf.getIntersect = function(e, t, n, i) { var r; e.updateMatrixWorld(), i || (i = new sh, r = new Cn(n.x,n.y,-1).unproject(e), e = new Cn(n.x,n.y,1).unproject(e).sub(r).normalize(), i.set(r, e)), t.forEach(function(e) { i.layers.enable(Up.getBaseLog(e.layers.mask, 2)) }); t = i.intersectObjects(t); return 0 === t.length ? null : t[0] } ; var Yf, Zf = function() { y(i, hn); var n = w(i); function i() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; return O(this, i), (e = n.call(this)).icon = t.icon || "", e.tooltip = t.tooltip, void 0 !== t.onclick && (e.onclick = t.onclick), e } return h(i, [{ key: "onclick", value: function(e) {} }, { key: "pairWith", value: function(e) {} }, { key: "setIcon", value: function(e) { var t = this.icon; e !== t && (this.icon = e, this.dispatchEvent({ type: "icon_changed", action: this, icon: e, oldIcon: t })) } }]), i }(), Qf = function() { function a(e, t, n, i, r) { O(this, a), this.path = e, this.length = this.path.spline.getLength(), this.speed = i, this.callback = r, this.tween = null, this.startPoint = Math.max(t, 0), this.endPoint = Math.min(n, this.length), this.t = 0 } return h(a, [{ key: "start", value: function() { var t = this , e = 0 < arguments.length && void 0 !== arguments[0] && arguments[0]; this.tween && (this.tween.stop(), this.tween = null); var n = e ? this.t : this.startPoint / this.length , i = this.endPoint / this.length , e = (i - n) * this.length * 1e3 / this.speed , r = { t: n }; this.tween = new TWEEN.Tween(r).to({ t: i }, e), this.tween.easing(TWEEN.Easing.Linear.None), this.tween.onUpdate(function(e) { t.t = r.t, t.callback(r.t) }), this.tween.onComplete(function() { t.repeat && t.start() }), setTimeout(function() { t.tween.start() }, 0) } }, { key: "stop", value: function() { this.tween && (this.tween.stop(), this.tween = null, this.t = 0) } }, { key: "pause", value: function() { this.tween && (this.tween.stop(), TWEEN.remove(this.tween), this.tween = null) } }, { key: "resume", value: function() { this.start(!0) } }, { key: "getPoint", value: function(e) { return this.path.spline.getPoint(e) } }]), a }(), Yd = function() { function t() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []; O(this, t), this.points = e, this.spline = new Bc(e) } return h(t, [{ key: "get", value: function(e) { return this.spline.getPoint(e) } }, { key: "getLength", value: function() { return this.spline.getLength() } }, { key: "animate", value: function(e, t, n, i) { i = new Qf(this,e,t,n,i); return i.start(), i } }, { key: "pause", value: function() { this.tween && this.tween.stop() } }, { key: "resume", value: function() { this.tween && this.tween.start() } }, { key: "getGeometry", value: function() { for (var e, t = new Sl, n = 0, i = 0; i <= 1; i += .002) { var r = this.spline.getPoint(i); t.vertices[n] = new Cn(r.x,r.y,r.z), n++ } return this.closed && (e = this.spline.getPoint(0), t.vertices[n] = new Cn(e.x,e.y,e.z)), t } }, { key: "closed", get: function() { return this.spline.closed }, set: function(e) { this.spline.closed = e } }]), t }(), Kf = function() { y(s, hn); var o = w(s); function s() { var n, e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; O(this, s), (n = o.call(this)).scene = null, n._title = e.title || "No Title", n._description = e.description || "", n.offset = new Cn, n.uuid = gn.generateUUID(), e.position ? null != e.position.x ? n.position = e.position : n.position = B(Cn, Q(e.position)) : n.position = null, n.cameraPosition = e.cameraPosition instanceof Array ? (new Cn).fromArray(e.cameraPosition) : e.cameraPosition, n.cameraTarget = e.cameraTarget instanceof Array ? (new Cn).fromArray(e.cameraTarget) : e.cameraTarget, !n.cameraTarget && n.position && (n.cameraTarget = n.position.clone()), n.radius = e.radius, n.view = e.view || null, n.keepOpen = !1, n.descriptionVisible = !1, n.showDescription = !0, n.actions = e.actions || [], n.isHighlighted = !1, n._visible = !0, n.__visible = !0, n._display = !0, n._expand = !1, n.collapseThreshold = [e.collapseThreshold, 100].find(function(e) { return void 0 !== e }), n.children = [], n.parent = null, n.boundingBox = new kn; e = le.resourcePath + "/icons/close.svg"; n.domElement = $('\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t').concat(n._description, "\n\t\t\t\t
\n\t\t\t
\n\t\t")), n.elTitlebar = n.domElement.find(".annotation-titlebar"), n.elTitle = n.elTitlebar.find(".annotation-label"), n.elTitle.append(n._title), n.elDescription = n.domElement.find(".annotation-description"), n.elDescriptionClose = n.elDescription.find(".annotation-description-close"), n.clickTitle = function() { n.moveHere(n.scene.getActiveCamera()), n.dispatchEvent({ type: "click", target: g(n) }), viewer.renderer.domElement.focus() } , n.elTitle.click(n.clickTitle), n.actions = n.actions.map(function(e) { return e instanceof Zf ? e : new Zf(e) }); var t, i = ue(n.actions); try { for (i.s(); !(t = i.n()).done; ) t.value.pairWith(g(n)) } catch (e) { i.e(e) } finally { i.f() } var r, a = ue(n.actions.filter(function(e) { return void 0 === e.showIn || e.showIn.includes("scene") })); try { for (a.s(); !(r = a.n()).done; ) !function() { var e = r.value , t = $('')); n.elTitlebar.append(t), t.click(function() { return e.onclick({ annotation: g(n) }) }) }() } catch (e) { a.e(e) } finally { a.f() } return n.elDescriptionClose.hover(function(e) { return n.elDescriptionClose.css("opacity", "1") }, function(e) { return n.elDescriptionClose.css("opacity", "0.5") }), n.elDescriptionClose.click(function(e) { return n.setHighlighted(!1) }), n.domElement.mouseenter(function(e) { return n.setHighlighted(!0) }), n.domElement.mouseleave(function(e) { return n.setHighlighted(!1) }), n.domElement.on("touchstart", function(e) { n.setHighlighted(!n.isHighlighted) }), n.display = !1, n } return h(s, [{ key: "installHandles", value: function(o) { var i, r, a, s, l, u, c, d, e, h = this; void 0 === this.handles && (i = $('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t'), r = i.find("svg")[0], a = i.find("line")[0], s = i.find("circle")[0], l = i.find("circle")[1], u = function(e, t) { s.setAttribute("cx", "".concat(e.x)), s.setAttribute("cy", "".concat(e.y)), l.setAttribute("cx", "".concat(t.x)), l.setAttribute("cy", "".concat(t.y)), a.setAttribute("x1", e.x), a.setAttribute("y1", e.y), a.setAttribute("x2", t.x), a.setAttribute("y2", t.y); var n = r.getBBox(); r.setAttribute("width", "".concat(n.width)), r.setAttribute("height", "".concat(n.height)), r.setAttribute("viewBox", "".concat(n.x, " ").concat(n.y, " ").concat(n.width, " ").concat(n.height)); n = e.y - t.y, t = e.x - t.x; 0 < n && (e.y = e.y - n), 0 < t && (e.x = e.x - t), i.css("left", "".concat(e.x, "px")), i.css("top", "".concat(e.y, "px")) } , $(o.renderArea).append(i), c = this.position.clone(), d = this.offset.clone(), $(this.domElement).draggable({ start: function(e, t) { c = h.position.clone(), d = h.offset.clone(), $(h.domElement).find(".annotation-titlebar").css("pointer-events", "none"), console.log($(h.domElement).find(".annotation-titlebar")) }, stop: function() { $(h.domElement).find(".annotation-titlebar").css("pointer-events", "") }, drag: function(e, t) { var n = o.renderer.getSize(new yn).width , i = -(t.originalPosition.left - t.position.left) / n * 2 , r = (t.originalPosition.top - t.position.top) / n * 2 , t = o.scene.getActiveCamera() , n = (new Cn).addVectors(c, d).project(t).clone(); n.x += i, n.y += r; n = n.clone(); n.unproject(t); n = (new Cn).subVectors(n, h.position); h.offset.copy(n) } }), o.addEventListener("update", e = function() { h.position; function e(e) { var t = i.getActiveCamera() , n = new Cn , t = (new ni).multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse); return (t = new Mn(e.x,e.y,e.z,1).applyMatrix4(t)).w = Math.max(t.w, .1), t.divideScalar(t.w), n.copy(t), n.x = r * (n.x + 1) / 2, n.y = a * (1 - (n.y + 1) / 2), n } var i = o.scene , t = o.renderer.getSize(new yn) , r = t.width , a = t.height , n = h.position.clone() , t = (new Cn).addVectors(h.position, h.offset) , n = e(n) , t = e(t); u(n, t) } ), this.handles = { domElement: i, setCoordinates: u, updateCallback: e }) } }, { key: "removeHandles", value: function(e) { void 0 !== this.handles && (this.handles.domElement.remove(), e.removeEventListener("update", this.handles.updateCallback), delete this.handles) } }, { key: "visible", get: function() { return this._visible }, set: function(e) { this._visible !== e && (this._visible = e, this.dispatchEvent({ type: "visibility_changed", annotation: this })) } }, { key: "display", get: function() { return this._display }, set: function(e) { this._display !== e && ((this._display = e) ? this.domElement.show() : this.domElement.hide()) } }, { key: "expand", get: function() { return this._expand }, set: function(e) { this._expand !== e && (e ? this.display = !1 : (this.display = !0, this.traverseDescendants(function(e) { e.display = !1 })), this._expand = e) } }, { key: "title", get: function() { return this._title }, set: function(e) { this._title !== e && (this._title = e, this.elTitle.empty(), this.elTitle.append(this._title), this.dispatchEvent({ type: "annotation_changed", annotation: this })) } }, { key: "description", get: function() { return this._description }, set: function(e) { this._description !== e && (this._description = e, (e = this.elDescription.find(".annotation-description-content")).empty(), e.append(this._description), this.dispatchEvent({ type: "annotation_changed", annotation: this })) } }, { key: "add", value: function(e) { if (!this.children.includes(e)) { this.children.push(e), e.parent = this; var t = []; e.traverse(function(e) { t.push(e) }); for (var n = 0, i = t; n < i.length; n++) for (var r = i[n], a = this; null !== a; ) a.dispatchEvent({ type: "annotation_added", annotation: r }), a = a.parent } } }, { key: "level", value: function() { return null === this.parent ? 0 : this.parent.level() + 1 } }, { key: "hasChild", value: function(e) { return this.children.includes(e) } }, { key: "remove", value: function(t) { this.hasChild(t) && (t.removeAllChildren(), t.dispose(), this.children = this.children.filter(function(e) { return e !== t }), t.parent = null) } }, { key: "removeAllChildren", value: function() { var t = this; this.children.forEach(function(e) { 0 < e.children.length && e.removeAllChildren(), t.remove(e) }) } }, { key: "updateBounds", value: function() { var e = new kn; this.position && e.expandByPoint(this.position); var t, n = ue(this.children); try { for (n.s(); !(t = n.n()).done; ) { var i = t.value; i.updateBounds(), e.union(i.boundingBox) } } catch (e) { n.e(e) } finally { n.f() } this.boundingBox.copy(e) } }, { key: "traverse", value: function(e) { var t = e(this); if (void 0 === t || !0 === t) { var n, i = ue(this.children); try { for (i.s(); !(n = i.n()).done; ) n.value.traverse(e) } catch (e) { i.e(e) } finally { i.f() } } } }, { key: "traverseDescendants", value: function(e) { var t, n = ue(this.children); try { for (n.s(); !(t = n.n()).done; ) t.value.traverse(e) } catch (e) { n.e(e) } finally { n.f() } } }, { key: "flatten", value: function() { var t = []; return this.traverse(function(e) { t.push(e) }), t } }, { key: "descendants", value: function() { var t = this , n = []; return this.traverse(function(e) { e !== t && n.push(e) }), n } }, { key: "setHighlighted", value: function(e) { e ? (this.domElement.css("opacity", "0.8"), this.elTitlebar.css("box-shadow", "0 0 5px #fff"), this.domElement.css("z-index", "1000"), this._description && (this.descriptionVisible = !0, this.elDescription.fadeIn(200), this.elDescription.css("position", "relative"))) : (this.domElement.css("opacity", "0.5"), this.elTitlebar.css("box-shadow", ""), this.domElement.css("z-index", "100"), this.descriptionVisible = !1, this.elDescription.css("display", "none")), this.isHighlighted = e } }, { key: "hasView", value: function() { var e = (e = null != this.cameraTarget.x) && null != this.cameraPosition.x , t = void 0 !== this.radius; return e || t } }, { key: "moveHere", value: function(e) { var t, n, i, r, a, o; this.hasView() && (t = this.scene.view, n = TWEEN.Easing.Quartic.Out, o = this.cameraTarget || this.position || this.boundingBox.getCenter(new Cn), this.cameraPosition ? (a = this.cameraPosition, Jf.moveTo(this.scene, a, o)) : this.radius && (a = t.direction, a = o.clone().add(a.multiplyScalar(-this.radius)), i = t.radius, r = this.radius, (a = new TWEEN.Tween(t.position).to(a, 500)).easing(n), a.start(), (a = new TWEEN.Tween({ x: 0 }).to({ x: 1 }, 500).onUpdate(function() { t.radius = this.x * r + (1 - this.x) * i })).easing(n), a.start())) } }, { key: "dispose", value: function() { this.domElement.parentElement && this.domElement.parentElement.removeChild(this.domElement) } }, { key: "toString", value: function() { return "Annotation: " + this._title } }]), s }(), $f = function() { function r(e) { O(this, r); for (var t = 0, n = Object.keys(e); t < n.length; t++) { var i = n[t]; this[i] = e[i] } } return h(r, [{ key: "inspect", value: function() { return "Enum(".concat(this.name, ": ").concat(this.value, ")") } }]), r }(), Mh = function() { function a(e) { O(this, a), this.object = e; for (var t = 0, n = Object.keys(e); t < n.length; t++) { var i = n[t] , r = e[i]; "object" === X(r) ? r.name = i : r = { name: i, value: r }, this[i] = new $f(r) } } return h(a, [{ key: "fromValue", value: function(e) { for (var t = 0, n = Object.keys(this.object); t < n.length; t++) { var i = n[t]; if (this[i].value === e) return this[i] } throw new Error("No enum for value: ".concat(e)) } }]), a }(), em = { ORTHOGRAPHIC: 0, PERSPECTIVE: 1, VR: 2 }, tm = { NONE: 0, HIGHLIGHT: 1, SHOW_INSIDE: 2, SHOW_OUTSIDE: 3 }, nm = { INSIDE_ANY: 0, INSIDE_ALL: 1 }, im = { CLAMP: 0, REPEAT: 1, MIRRORED_REPEAT: 2 }, rm = { NONE: 0, LEFT: 1, RIGHT: 2, MIDDLE: 4 }, am = { FIXED: 0, ATTENUATED: 1, ADAPTIVE: 2 }, om = { SQUARE: 0, CIRCLE: 1, PARABOLOID: 2 }, sm = { OCTREE: 0, KDTREE: 1 }, lm = { METER: { code: "m", unitspermeter: 1 }, FEET: { code: "ft", unitspermeter: 3.28084 }, INCH: { code: "″", unitspermeter: 39.3701 } }, um = { GL_TEXTURE_CUBE_MAP_POSITIVE_X: 0, GL_TEXTURE_CUBE_MAP_NEGATIVE_X: 1, GL_TEXTURE_CUBE_MAP_POSITIVE_Y: 2, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: 3, GL_TEXTURE_CUBE_MAP_POSITIVE_Z: 4, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: 5 }, cm = { BASE: 1, STANDARD: 2, HIGH: 3, ULTRAHIGH: 4 }, dm = { PanoRenderComplete: "panorama.render.complete", TileRenderFailure: "panorama.tile.render.failed", TileRenderSuccess: "panorama.tile.render.success", TileUploadAttempted: "panorama.tile.upload.attempted", UploadAttemptedForAllTiles: "panorama.upload.attempted.all.tiles", ZoomLevelRenderStarted: "panorama.zoom.render.started" }, hm = { TileDownloadSuccess: "tiledownloader.download.success", TileDownloadFailure: "tiledownloader.download.failure", PanoDownloadComplete: "tiledownloader.pano.download.complete" }, pm = { UP: new Cn(0,1,0), DOWN: new Cn(0,-1,0), LEFT: new Cn(-1,0,0), RIGHT: new Cn(1,0,0), FORWARD: new Cn(0,0,-1), BACK: new Cn(0,0,1) }, fm = {}; for (Yf in pm) fm[Yf] = Up.convertVector.YupToZup(pm[Yf]); var mm, vm = Object.freeze({ None: 0, Queued: 1, ForceQueued: 2, Downloading: 3, Downloaded: 4, DownloadFailed: 5 }), gm = { Enter: "panorama.enter", Exit: "panorama.exit", LoadComplete: "panorama.load.complete", LoadFailed: "panorama.load.failed", TileLoaded: "panorama.tile.loaded", VideoRendered: "panorama.video.rendered" }, Dh = function() { function e() { O(this, e), this._listeners = {} } return h(e, [{ key: "addEventListener", value: function(e, t) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0 , i = this._listeners; void 0 === i[e] && (i[e] = []), -1 === i[e].indexOf(t) && (i[e].push({ listener: t, importance: n }), i[e] = i[e].sort(function(e, t) { return t.importance - e.importance })) } }, { key: "hasEventListener", value: function(e, t) { var n = this._listeners; return void 0 !== n[e] && -1 !== n[e].indexOf(t) } }, { key: "removeEventListener", value: function(e, t) { var n = this._listeners[e]; void 0 === n || (e = n.find(function(e) { return e.listener == t })) && n.splice(n.indexOf(e), 1) } }, { key: "removeEventListeners", value: function(e) { void 0 !== this._listeners[e] && delete this._listeners[e] } }, { key: "dispatchEvent", value: function(e) { var t = this._listeners[(e = "string" == typeof e ? { type: e } : e).type]; if (void 0 !== t) { e.target = this; var n, i = ue(t.slice(0)); try { for (i.s(); !(n = i.n()).done; ) { var r = n.value.listener.call(this, e); if (r && r.stopContinue) break } } catch (e) { i.e(e) } finally { i.f() } } } }, { key: "removeAllListeners", value: function() { this._listeners = {} } }]), e }(), ym = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40, DELETE: 46, BACKSPACE: 8, A: "A".charCodeAt(0), S: "S".charCodeAt(0), D: "D".charCodeAt(0), W: "W".charCodeAt(0), Q: "Q".charCodeAt(0), E: "E".charCodeAt(0), R: "R".charCodeAt(0), F: "F".charCodeAt(0) }, wm = h(function e(t) { O(this, e), this.previous = null, this.next = null, this.node = t }), xu = function() { function e() { O(this, e), this.first = null, this.last = null, this.items = {}, this.elements = 0, this.numPoints = 0 } return h(e, [{ key: "size", value: function() { return this.elements } }, { key: "contains", value: function(e) { return null == this.items[e.id] } }, { key: "touch", value: function(e) { var t; e.loaded && (null == this.items[e.id] ? ((t = new wm(e)).previous = this.last, null !== (this.last = t).previous && (t.previous.next = t), this.items[e.id] = t, this.elements++, null === this.first && (this.first = t), this.numPoints += e.numPoints) : null === (t = this.items[e.id]).previous ? null !== t.next && (this.first = t.next, this.first.previous = null, t.previous = this.last, t.next = null, (this.last = t).previous.next = t) : null === t.next || (t.previous.next = t.next, t.next.previous = t.previous, t.previous = this.last, t.next = null, (this.last = t).previous.next = t)) } }, { key: "remove", value: function(e) { var t = this.items[e.id]; t && (1 === this.elements ? (this.first = null, this.last = null) : (t.previous || (this.first = t.next, this.first.previous = null), t.next || (this.last = t.previous, this.last.next = null), t.previous && t.next && (t.previous.next = t.next, t.next.previous = t.previous)), delete this.items[e.id], this.elements--, this.numPoints -= e.numPoints) } }, { key: "getLRUItem", value: function() { return null === this.first ? null : this.first.node } }, { key: "toString", value: function() { for (var e = "{ ", t = this.first; null !== t; ) e += t.node.id, null !== t.next && (e += ", "), t = t.next; return e += "}", e += "(" + this.size() + ")" } }, { key: "freeMemory", value: function() { if (!(this.elements <= 1)) for (var e = 2 * viewer.viewports.length * Potree.pointBudget; this.numPoints > e; ) { var t = this.getLRUItem(); t && this.disposeSubtree(t) } } }, { key: "disposeSubtree", value: function(e) { var t = [e]; e.traverse(function(e) { e.loaded && t.push(e) }); for (var n = 0, i = t; n < i.length; n++) { var r = i[n]; r.dispose(), this.remove(r) } } }, { key: "disposeDescendants", value: function(e) { var t = []; for (t.push(e); 0 < t.length; ) { var n, i = t.pop(); for (n in i.dispose(), this.remove(i), i.children) i.children.hasOwnProperty(n) && i.children[n].loaded && t.push(i.children[n]) } } }]), e }(), bm = function() { y(n, hn); var t = w(n); function n() { var e; return O(this, n), (e = t.call(this)).needsTransformUpdate = !0, e } return h(n, [{ key: "getChildren", value: function() { throw new Error("override function") } }, { key: "getBoundingBox", value: function() { throw new Error("override function") } }, { key: "isLoaded", value: function() { throw new Error("override function") } }, { key: "isGeometryNode", value: function() { throw new Error("override function") } }, { key: "isTreeNode", value: function() { throw new Error("override function") } }, { key: "getLevel", value: function() { throw new Error("override function") } }, { key: "getBoundingSphere", value: function() { throw new Error("override function") } }]), n }(), xm = function() { y(t, Si); var e = w(t); function t() { return O(this, t), e.call(this) } return h(t, [{ key: "initialized", value: function() { return null !== this.root } }]), t }(), Em = { DATA_TYPE_DOUBLE: { ordinal: 0, name: "double", size: 8 }, DATA_TYPE_FLOAT: { ordinal: 1, name: "float", size: 4 }, DATA_TYPE_INT8: { ordinal: 2, name: "int8", size: 1 }, DATA_TYPE_UINT8: { ordinal: 3, name: "uint8", size: 1 }, DATA_TYPE_INT16: { ordinal: 4, name: "int16", size: 2 }, DATA_TYPE_UINT16: { ordinal: 5, name: "uint16", size: 2 }, DATA_TYPE_INT32: { ordinal: 6, name: "int32", size: 4 }, DATA_TYPE_UINT32: { ordinal: 7, name: "uint32", size: 4 }, DATA_TYPE_INT64: { ordinal: 8, name: "int64", size: 8 }, DATA_TYPE_UINT64: { ordinal: 9, name: "uint64", size: 8 } }, _m = 0; for (mm in Em) Em[_m] = Em[mm], _m++; function Mm(e) { return Tm[e] || e } var Am = h(function e(t, n, i) { O(this, e), this.name = t, this.type = n, this.numElements = i, this.byteSize = this.numElements * this.type.size, this.description = "", this.range = [1 / 0, -1 / 0] }) , Tm = { COLOR_PACKED: "rgba", RGBA: "rgba", INTENSITY: "intensity", CLASSIFICATION: "classification", GPS_TIME: "gps-time" }; Am.POSITION_CARTESIAN = new Am("POSITION_CARTESIAN",Em.DATA_TYPE_FLOAT,3), Am.RGBA_PACKED = new Am(Mm("COLOR_PACKED"),Em.DATA_TYPE_INT8,4), Am.COLOR_PACKED = Am.RGBA_PACKED, Am.RGB_PACKED = new Am("COLOR_PACKED",Em.DATA_TYPE_INT8,3), Am.NORMAL_FLOATS = new Am("NORMAL_FLOATS",Em.DATA_TYPE_FLOAT,3), Am.INTENSITY = new Am(Mm("INTENSITY"),Em.DATA_TYPE_UINT16,1), Am.CLASSIFICATION = new Am(Mm("CLASSIFICATION"),Em.DATA_TYPE_UINT8,1), Am.NORMAL_SPHEREMAPPED = new Am("NORMAL_SPHEREMAPPED",Em.DATA_TYPE_UINT8,2), Am.NORMAL_OCT16 = new Am("NORMAL_OCT16",Em.DATA_TYPE_UINT8,2), Am.NORMAL = new Am("NORMAL",Em.DATA_TYPE_FLOAT,3), Am.RETURN_NUMBER = new Am("RETURN_NUMBER",Em.DATA_TYPE_UINT8,1), Am.NUMBER_OF_RETURNS = new Am("NUMBER_OF_RETURNS",Em.DATA_TYPE_UINT8,1), Am.SOURCE_ID = new Am("SOURCE_ID",Em.DATA_TYPE_UINT16,1), Am.INDICES = new Am("INDICES",Em.DATA_TYPE_UINT32,1), Am.SPACING = new Am("SPACING",Em.DATA_TYPE_FLOAT,1), Am.GPS_TIME = new Am(Mm("GPS_TIME"),Em.DATA_TYPE_DOUBLE,1); var Sm = function() { function i(e) { if (O(this, i), this.attributes = [], this.byteSize = 0, this.size = 0, this.vectors = [], null != e) for (var t = 0; t < e.length; t++) { var n = e[t] , n = Am[n]; this.attributes.push(n), this.byteSize += n.byteSize, this.size++ } } return h(i, [{ key: "add", value: function(e) { this.attributes.push(e), this.byteSize += e.byteSize, this.size++ } }, { key: "addVector", value: function(e) { this.vectors.push(e) } }, { key: "hasNormals", value: function() { for (var e in this.attributes) { e = this.attributes[e]; if (e === Am.NORMAL_SPHEREMAPPED || e === Am.NORMAL_FLOATS || e === Am.NORMAL || e === Am.NORMAL_OCT16) return !0 } return !1 } }]), i }() , Cm = function() { function t() { O(this, t) } return h(t, null, [{ key: "toVector3", value: function(e, t) { return (new Cn).fromArray(e, t || 0) } }, { key: "toBox3", value: function(e) { return new kn(t.toVector3(e),t.toVector3(e, 3)) } }, { key: "findDim", value: function(e, t) { e = e.find(function(e) { return e.name == t }); if (!e) throw new Error("Failed to find " + t + " in schema"); return e } }, { key: "sphereFrom", value: function(e) { return e.getBoundingSphere(new qn) } }]), t }() , Ud = h(function e(t, n) { O(this, e); n.version; var i = n.schema , r = n.bounds , a = n.boundsConforming , o = [Cm.findDim(i, "X"), Cm.findDim(i, "Y"), Cm.findDim(i, "Z")] , s = o.map(function(e) { return e.scale || 1 }) , o = o.map(function(e) { return e.offset || 0 }); this.eptScale = Cm.toVector3(s), this.eptOffset = Cm.toVector3(o), this.url = t, this.info = n, this.type = "ept", this.schema = i, this.span = n.span || n.ticks, this.boundingBox = Cm.toBox3(r), this.tightBoundingBox = Cm.toBox3(a), this.offset = Cm.toVector3([0, 0, 0]), this.boundingSphere = Cm.sphereFrom(this.boundingBox), this.tightBoundingSphere = Cm.sphereFrom(this.tightBoundingBox), this.version = new Potree.Version("1.7"), this.projection = null, this.fallbackProjection = null, n.srs && n.srs.horizontal && (this.projection = n.srs.authority + ":" + n.srs.horizontal), n.srs.wkt && (this.projection ? this.fallbackProjection = n.srs.wkt : this.projection = n.srs.wkt); try { proj4(this.projection) } catch (e) { this.projection = null } a = new Sm; a.add(Am.POSITION_CARTESIAN), a.add(new Am("rgba",Em.DATA_TYPE_UINT8,4)), a.add(new Am("intensity",Em.DATA_TYPE_UINT16,1)), a.add(new Am("classification",Em.DATA_TYPE_UINT8,1)), a.add(new Am("gps-time",Em.DATA_TYPE_DOUBLE,1)), a.add(new Am("returnNumber",Em.DATA_TYPE_UINT8,1)), a.add(new Am("number of returns",Em.DATA_TYPE_UINT8,1)), a.add(new Am("return number",Em.DATA_TYPE_UINT8,1)), a.add(new Am("source id",Em.DATA_TYPE_UINT16,1)), this.pointAttributes = a, this.spacing = (this.boundingBox.max.x - this.boundingBox.min.x) / this.span; n.hierarchyType; n = n.dataType; if ("laszip" == n) this.loader = new Potree.EptLaszipLoader; else if ("binary" == n) this.loader = new Potree.EptBinaryLoader; else { if ("zstandard" != n) throw new Error("Could not read data type: " + n); this.loader = new Potree.EptZstandardLoader } }) , _u = function() { function o(e, t, n, i, r, a) { O(this, o), this.ept = e, this.b = t, this.d = n, this.x = i || 0, this.y = r || 0, this.z = a || 0 } return h(o, [{ key: "name", value: function() { return this.d + "-" + this.x + "-" + this.y + "-" + this.z } }, { key: "step", value: function(e, t, n) { var i = this.b.min.clone() , r = this.b.max.clone() , a = (new Cn).subVectors(r, i); return e ? i.x += a.x / 2 : r.x -= a.x / 2, t ? i.y += a.y / 2 : r.y -= a.y / 2, n ? i.z += a.z / 2 : r.z -= a.z / 2, new Potree.EptKey(this.ept,new kn(i,r),this.d + 1,2 * this.x + e,2 * this.y + t,2 * this.z + n) } }, { key: "children", value: function() { for (var e = [], t = 0; t < 2; ++t) for (var n = 0; n < 2; ++n) for (var i = 0; i < 2; ++i) { var r = this.step(t, n, i).name(); e.includes(r) || (e = e.concat(r)) } return e } }]), o }() , Jd = function() { y(l, bm); var e, s = w(l); function l(e, t, n, i, r, a) { var o; O(this, l), (o = s.call(this)).ept = e, o.key = new Potree.EptKey(o.ept,t || o.ept.boundingBox,n || 0,i,r,a), o.id = l.IDCount++, o.geometry = null, o.boundingBox = o.key.b, o.tightBoundingBox = o.boundingBox, o.spacing = o.ept.spacing / Math.pow(2, o.key.d), o.boundingSphere = Cm.sphereFrom(o.boundingBox), o.hasChildren = !1, o.children = {}, o.numPoints = -1, o.level = o.key.d, o.loaded = !1, o.loading = !1, o.oneTimeDisposeHandlers = []; a = o.key; return o.name = o.toPotreeName(a.d, a.x, a.y, a.z), o.index = parseInt(o.name.charAt(o.name.length - 1)), o } return h(l, [{ key: "isGeometryNode", value: function() { return !0 } }, { key: "getLevel", value: function() { return this.level } }, { key: "isTreeNode", value: function() { return !1 } }, { key: "isLoaded", value: function() { return this.loaded } }, { key: "getBoundingSphere", value: function() { return this.boundingSphere } }, { key: "getBoundingBox", value: function() { return this.boundingBox } }, { key: "url", value: function() { return this.ept.url + "ept-data/" + this.filename() } }, { key: "getNumPoints", value: function() { return this.numPoints } }, { key: "filename", value: function() { return this.key.name() } }, { key: "getChildren", value: function() { for (var e = [], t = 0; t < 8; t++) this.children[t] && e.push(this.children[t]); return e } }, { key: "addChild", value: function(e) { (this.children[e.index] = e).parent = this } }, { key: "load", value: function() { this.loaded || this.loading || Potree.numNodesLoading >= Potree.maxNodesLoading || (this.loading = !0, ++Potree.numNodesLoading, -1 == this.numPoints && this.loadHierarchy(), this.loadPoints()) } }, { key: "loadPoints", value: function() { this.ept.loader.load(this) } }, { key: "loadHierarchy", value: (e = r(regeneratorRuntime.mark(function e() { var l, t, u, c = this; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return ((l = {})[this.filename()] = this).hasChildren = !1, t = "".concat(this.ept.url, "ept-hierarchy/").concat(this.filename(), ".json"), e.next = 6, fetch(t); case 6: return t = e.sent, e.next = 9, t.json(); case 9: u = e.sent, Object.keys(u).sort(function(e, t) { var n = N(e.split("-").map(function(e) { return parseInt(e, 10) }), 4) , i = n[0] , r = n[1] , a = n[2] , o = n[3] , s = N(t.split("-").map(function(e) { return parseInt(e, 10) }), 4) , e = s[0] , n = s[1] , t = s[2] , s = s[3]; return i < e ? -1 : e < i ? 1 : r < n ? -1 : n < r ? 1 : a < t ? -1 : t < a ? 1 : o < s ? -1 : s < o ? 1 : 0 }).forEach(function(e) { var t = N(e.split("-").map(function(e) { return parseInt(e, 10) }), 4) , n = t[0] , i = t[1] , r = t[2] , a = t[3] , o = 1 & i , s = 1 & r , t = 1 & a , a = l[n - 1 + "-" + (i >> 1) + "-" + (r >> 1) + "-" + (a >> 1)]; a && (a.hasChildren = !0, s = a.key.step(o, s, t), (t = new Potree.PointCloudEptGeometryNode(c.ept,s.b,s.d,s.x,s.y,s.z)).level = n, t.numPoints = u[e], a.addChild(t), l[s.name()] = t) }); case 12: case "end": return e.stop() } }, e, this) })), function() { return e.apply(this, arguments) } ) }, { key: "doneLoading", value: function(e, t, n, i) { e.boundingBox = this.boundingBox, this.geometry = e, this.tightBoundingBox = t, this.numPoints = n, this.mean = i, this.loaded = !0, this.loading = !1, --Potree.numNodesLoading } }, { key: "toPotreeName", value: function(e, t, n, i) { for (var r = "r", a = 0; a < e; ++a) { var o = 1 << e - a - 1 , s = 0; t & o && (s += 4), n & o && (s += 2), i & o && (s += 1), r += s } return r } }, { key: "dispose", value: function() { if (this.geometry && null != this.parent) { this.geometry.dispose(), this.geometry = null, this.loaded = !1; for (var e = 0; e < this.oneTimeDisposeHandlers.length; e++) (0, this.oneTimeDisposeHandlers[e])(); this.oneTimeDisposeHandlers = [] } } }]), l }(); Jd.IDCount = 0; var Pm = function() { y(n, hn); var t = w(n); function n() { var e; return O(this, n), (e = t.call(this)).url = null, e.octreeDir = null, e.spacing = 0, e.boundingBox = null, e.root = null, e.nodes = null, e.pointAttributes = null, e.hierarchyStepSize = -1, e.loader = null, e } return h(n) }() , Dm = function() { y(E, bm); var r = w(E); function E(e, t, n) { var i; return O(this, E), (i = r.call(this)).id = E.IDCount++, i.name = e, i.index = parseInt(e.charAt(e.length - 1)), i.pcoGeometry = t, i.geometry = null, i.boundingBox = n, i.boundingSphere = n.getBoundingSphere(new qn), i.children = {}, i.numPoints = 0, i.level = null, i.loaded = !1, i.oneTimeDisposeHandlers = [], i } return h(E, [{ key: "isGeometryNode", value: function() { return !0 } }, { key: "getLevel", value: function() { return this.level } }, { key: "isTreeNode", value: function() { return !1 } }, { key: "isLoaded", value: function() { return this.loaded } }, { key: "getBoundingSphere", value: function() { return this.boundingSphere } }, { key: "getBoundingBox", value: function() { return this.boundingBox } }, { key: "getChildren", value: function() { for (var e = [], t = 0; t < 8; t++) this.children[t] && e.push(this.children[t]); return e } }, { key: "getURL", value: function() { var e = "" , t = this.pcoGeometry.loader.version; return t.equalOrHigher("1.5") ? e = this.pcoGeometry.octreeDir + "/" + this.getHierarchyPath() + "/" + this.name : (t.equalOrHigher("1.4") || t.upTo("1.3")) && (e = this.pcoGeometry.octreeDir + "/" + this.name), e } }, { key: "getHierarchyPath", value: function() { for (var e = "r/", t = this.pcoGeometry.hierarchyStepSize, n = this.name.substr(1), i = Math.floor(n.length / t), r = 0; r < i; r++) e += n.substr(r * t, t) + "/"; return e = e.slice(0, -1) } }, { key: "addChild", value: function(e) { (this.children[e.index] = e).parent = this } }, { key: "load", value: function() { !0 === this.loading || !0 === this.loaded || Potree.numNodesLoading >= Potree.maxNodesLoading || (this.loading = !0, Potree.numNodesLoading++, this.pcoGeometry.loader.version.equalOrHigher("1.5") && this.level % this.pcoGeometry.hierarchyStepSize == 0 && this.hasChildren ? this.loadHierachyThenPoints() : this.loadPoints()) } }, { key: "loadPoints", value: function() { this.pcoGeometry.loader.load(this) } }, { key: "loadHierachyThenPoints", value: function(e) { var t = this; if (t.level % t.pcoGeometry.hierarchyStepSize == 0) { var n = t.pcoGeometry.octreeDir + "/" + t.getHierarchyPath() + "/" + t.name + ".hrc"; n += "?m=" + t.pcoGeometry.timeStamp; var i = Gp.createXMLHttpRequest(); i.open("GET", n, !0), i.responseType = "arraybuffer", i.overrideMimeType("text/plain; charset=x-user-defined"), i.onreadystatechange = function() { var e; 4 === i.readyState && (200 === i.status || 0 === i.status ? (e = i.response, function(e, t) { performance.now(); var n = new DataView(t) , i = [] , r = n.getUint8(0) , a = n.getUint32(1, !0); e.numPoints = a, i.push({ children: r, numPoints: a, name: e.name }); for (var o = [], s = 5; 0 < i.length; ) { for (var l, u, c, d = i.shift(), h = 1, p = 0; p < 8; p++) 0 != (d.children & h) && (l = d.name + p, u = n.getUint8(s), c = n.getUint32(s + 1, !0), i.push({ children: u, numPoints: c, name: l }), o.push({ children: u, numPoints: c, name: l }), s += 5), h *= 2; if (s === t.byteLength) break } for (var f = {}, m = (f[e.name] = e).pcoGeometry, v = 0; v < o.length; v++) { var g = o[v].name , y = o[v].numPoints , w = parseInt(g.charAt(g.length - 1)) , b = f[g.substring(0, g.length - 1)] , x = g.length - 1; m.dispatchEvent({ type: "updateNodeMaxLevel", level: x }); w = new E(g,m,Jf.createChildAABB(b.boundingBox, w)); w.level = x, w.numPoints = y, w.hasChildren = 0 < o[v].children, w.spacing = m.spacing / Math.pow(2, x), b.addChild(w), f[g] = w } performance.now(); e.loadPoints() }(t, e)) : (console.log("Failed to load file! HTTP status: " + i.status + ", file: " + n), Potree.numNodesLoading--)) } ; try { i.send(null) } catch (e) { console.log("fehler beim laden der punktwolke: " + e) } } } }, { 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, this.dispatchEvent({ type: "dispose" }); for (var e = 0; e < this.oneTimeDisposeHandlers.length; e++) (0, this.oneTimeDisposeHandlers[e])(); this.oneTimeDisposeHandlers = [] } } }, { key: "traverse", value: function(e, t) { for (var n, i = (t = void 0 === t ? !0 : t) ? [this] : []; void 0 !== (n = i.pop()); ) { e(n); for (var r = 0, a = n.children; r < a.length; r++) { var o = a[r]; null !== o && i.push(o) } } } }]), E }() , km = { SPECTRAL: [[Dm.IDCount = 0, new Yi(.3686,.3098,.6353)], [.1, new Yi(.1961,.5333,.7412)], [.2, new Yi(.4,.7608,.6471)], [.3, new Yi(.6706,.8667,.6431)], [.4, new Yi(.902,.9608,.5961)], [.5, new Yi(1,1,.749)], [.6, new Yi(.9961,.8784,.5451)], [.7, new Yi(.9922,.6824,.3804)], [.8, new Yi(.9569,.4275,.2627)], [.9, new Yi(.8353,.2431,.3098)], [1, new Yi(.6196,.0039,.2588)]], PLASMA: [[0, new Yi(.241,.015,.61)], [.1, new Yi(.387,.001,.654)], [.2, new Yi(.524,.025,.653)], [.3, new Yi(.651,.125,.596)], [.4, new Yi(.752,.227,.513)], [.5, new Yi(.837,.329,.431)], [.6, new Yi(.907,.435,.353)], [.7, new Yi(.963,.554,.272)], [.8, new Yi(.992,.681,.195)], [.9, new Yi(.987,.822,.144)], [1, new Yi(.94,.975,.131)]], YELLOW_GREEN: [[0, new Yi(.1647,.2824,.3451)], [.1, new Yi(.1338,.3555,.4227)], [.2, new Yi(.061,.4319,.4864)], [.3, new Yi(0,.5099,.5319)], [.4, new Yi(0,.5881,.5569)], [.5, new Yi(.137,.665,.5614)], [.6, new Yi(.2906,.7395,.5477)], [.7, new Yi(.4453,.8099,.5201)], [.8, new Yi(.6102,.8748,.485)], [.9, new Yi(.7883,.9323,.4514)], [1, new Yi(.9804,.9804,.4314)]], VIRIDIS: [[0, new Yi(.267,.005,.329)], [.1, new Yi(.283,.141,.458)], [.2, new Yi(.254,.265,.53)], [.3, new Yi(.207,.372,.553)], [.4, new Yi(.164,.471,.558)], [.5, new Yi(.128,.567,.551)], [.6, new Yi(.135,.659,.518)], [.7, new Yi(.267,.749,.441)], [.8, new Yi(.478,.821,.318)], [.9, new Yi(.741,.873,.15)], [1, new Yi(.993,.906,.144)]], INFERNO: [[0, new Yi(.077,.042,.206)], [.1, new Yi(.225,.036,.388)], [.2, new Yi(.373,.074,.432)], [.3, new Yi(.522,.128,.42)], [.4, new Yi(.665,.182,.37)], [.5, new Yi(.797,.255,.287)], [.6, new Yi(.902,.364,.184)], [.7, new Yi(.969,.516,.063)], [.8, new Yi(.988,.683,.072)], [.9, new Yi(.961,.859,.298)], [1, new Yi(.988,.998,.645)]], GRAYSCALE: [[0, new Yi(0,0,0)], [1, new Yi(1,1,1)]], TURBO: [[0, new Yi(.18995,.07176,.23217)], [.07, new Yi(.25107,.25237,.63374)], [.13, new Yi(.27628,.42118,.89123)], [.2, new Yi(.25862,.57958,.99876)], [.27, new Yi(.15844,.73551,.92305)], [.33, new Yi(.09267,.86554,.7623)], [.4, new Yi(.19659,.94901,.59466)], [.47, new Yi(.42778,.99419,.38575)], [.53, new Yi(.64362,.98999,.23356)], [.6, new Yi(.80473,.92452,.20459)], [.67, new Yi(.93301,.81236,.22667)], [.73, new Yi(.99314,.67408,.20348)], [.8, new Yi(.9836,.49291,.12849)], [.87, new Yi(.92105,.31489,.05475)], [.93, new Yi(.81608,.18462,.01809)], [1, new Yi(.66449,.08436,.00424)]], RAINBOW: [[0, new Yi(.278,0,.714)], [1 / 6, new Yi(0,0,1)], [2 / 6, new Yi(0,1,1)], [.5, new Yi(0,1,0)], [4 / 6, new Yi(1,1,0)], [5 / 6, new Yi(1,.64,0)], [1, new Yi(1,0,0)]], CONTOUR: [[0, new Yi(0,0,0)], [.03, new Yi(0,0,0)], [.04, new Yi(1,1,1)], [1, new Yi(1,1,1)]] } , Bm = { 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] } } }; Object.defineProperty(Bm, "RANDOM", { get: function() { for (var e = {}, t = 0; t <= 255; t++) e[t] = new Mn(Math.random(),Math.random(),Math.random()); return e.DEFAULT = new Mn(Math.random(),Math.random(),Math.random()), e } }); var Lm, Rm = function() { y(s, Gu); var o = w(s); function s() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; O(this, s), (e = o.call(this)).visibleNodesTexture = Jf.generateDataTexture(2048, 1, new Yi(16777215)), e.visibleNodesTexture.minFilter = Re, e.visibleNodesTexture.magFilter = Re; function n(e, t) { return void 0 !== e ? e : t } var i = n(t.size, 1) , r = n(t.minSize, 2) , a = n(t.maxSize, 1550) , t = n(t.treeType, sm.OCTREE); e._pointSizeType = am.FIXED, e._shape = om.SQUARE, e._useClipBox = !1, e.clipBoxes = [], e.clipPolygons = [], e._weighted = !1, e._gradient = km.RAINBOW, e.gradientTexture = s.generateGradientTexture(e._gradient), e._matcap = "matcap.jpg", e.matcapTexture = Potree.PointCloudMaterial.generateMatcapTexture(e._matcap), e.lights = !1, e.fog = !1, e._treeType = t, e._useEDL = !1, e.defines = new Map, e.ranges = new Map, e._activeAttributeName = null, e._defaultIntensityRangeChanged = !1, e._defaultElevationRangeChanged = !1; t = new ia(new Uint8Array(1024),256,1,et); return t.magFilter = Re, t.needsUpdate = !0, e.classificationTexture = t, e.attributes = { position: { type: "fv", value: [] }, color: { type: "fv", value: [] }, normal: { type: "fv", value: [] }, intensity: { type: "f", value: [] }, classification: { type: "f", value: [] }, returnNumber: { type: "f", value: [] }, numberOfReturns: { type: "f", value: [] }, pointSourceID: { type: "f", value: [] }, indices: { type: "fv", value: [] } }, e.uniforms = { level: { type: "f", value: 0 }, vnStart: { type: "f", value: 0 }, spacing: { type: "f", value: 1 }, blendHardness: { type: "f", value: 2 }, blendDepthSupplement: { type: "f", value: 0 }, fov: { type: "f", value: 1 }, resolution: { type: "v2", value: new yn }, near: { type: "f", value: .1 }, far: { type: "f", value: 1 }, uColor: { type: "c", value: new Yi(16777215) }, uOpacity: { type: "f", value: 1 }, size: { type: "f", value: i }, minSize: { type: "f", value: r }, maxSize: { type: "f", value: a }, octreeSize: { type: "f", value: 0 }, bbSize: { type: "fv", value: [0, 0, 0] }, elevationRange: { type: "2fv", value: [0, 0] }, clipBoxCount: { type: "f", value: 0 }, clipPolygonCount: { type: "i", value: 0 }, clipBoxes: { type: "Matrix4fv", value: [] }, clipPolygons: { type: "3fv", value: [] }, clipPolygonVCount: { type: "iv", value: [] }, clipPolygonVP: { type: "Matrix4fv", value: [] }, visibleNodes: { type: "t", value: e.visibleNodesTexture }, pcIndex: { type: "f", value: 0 }, gradient: { type: "t", value: e.gradientTexture }, classificationLUT: { type: "t", value: e.classificationTexture }, uHQDepthMap: { type: "t", value: null }, toModel: { type: "Matrix4f", value: [] }, diffuse: { type: "fv", value: [1, 1, 1] }, transition: { type: "f", value: .5 }, intensityRange: { type: "fv", value: [1 / 0, -1 / 0] }, intensity_gbc: { type: "fv", value: [1, 0, 0] }, uRGB_gbc: { type: "fv", value: [1, 0, 0] }, wRGB: { type: "f", value: 1 }, wIntensity: { type: "f", value: 0 }, wElevation: { type: "f", value: 0 }, wClassification: { type: "f", value: 0 }, wReturnNumber: { type: "f", value: 0 }, wSourceID: { type: "f", value: 0 }, useOrthographicCamera: { type: "b", value: !1 }, elevationGradientRepat: { type: "i", value: im.CLAMP }, clipTask: { type: "i", value: 1 }, clipMethod: { type: "i", value: 1 }, uShadowColor: { type: "3fv", value: [0, 0, 0] }, uExtraScale: { type: "f", value: 1 }, uExtraOffset: { type: "f", value: 0 }, uExtraRange: { type: "2fv", value: [0, 1] }, uExtraGammaBrightContr: { type: "3fv", value: [1, 0, 0] }, uFilterReturnNumberRange: { type: "fv", value: [0, 7] }, uFilterNumberOfReturnsRange: { type: "fv", value: [0, 7] }, uFilterGPSTimeClipRange: { type: "fv", value: [0, 7] }, uFilterPointSourceIDClipRange: { type: "fv", value: [0, 65535] }, matcapTextureUniform: { type: "t", value: e.matcapTexture }, backfaceCulling: { type: "b", value: !1 }, progress: { type: "f", value: 0 }, easeInOutRatio: { type: "f", value: .3 }, pano0Map: { type: "t", value: null }, pano0Position: { type: "v3", value: new Cn }, pano0Matrix: { type: "m4", value: new ni }, pano1Map: { type: "t", value: null }, pano1Position: { type: "v3", value: new Cn }, pano1Matrix: { type: "m4", value: new ni } }, e.classification = Bm.DEFAULT, e.defaultAttributeValues.normal = [0, 0, 0], e.defaultAttributeValues.classification = [0, 0, 0], e.defaultAttributeValues.indices = [0, 0, 0, 0], e.vertexShader = Hp["pointcloud.vs"], e.fragmentShader = Hp["pointcloud.fs"], e.vertexColors = 2, e.updateShaderSource(), e } return h(s, [{ key: "setDefine", value: function(e, t) { null != t ? this.defines.get(e) !== t && (this.defines.set(e, t), this.updateShaderSource()) : this.removeDefine(e) } }, { key: "removeDefine", value: function(e) { this.defines.delete(e) } }, { key: "updateShaderSource", value: function() { var e = Hp["pointcloud.vs"] , t = Hp["pointcloud.fs"] , n = this.getDefines() , i = e.indexOf("#version ") , r = t.indexOf("#version ") , e = 0 <= i ? e.replace(/(#version .*)/, "$1\n".concat(n)) : "".concat(n, "\n").concat(e) , t = 0 <= r ? t.replace(/(#version .*)/, "$1\n".concat(n)) : "".concat(n, "\n").concat(t); this.vertexShader = e, this.fragmentShader = t, 1 !== this.opacity || this.useFilterByNormal ? (this.opacity < 1 || this.useFilterByNormal) && !this.useEDL && (this.blending = ee, this.transparent = !0, this.depthTest = !1, this.depthWrite = !0, this.depthFunc = _e) : (this.blending = Z, this.transparent = !1, this.depthTest = !0, this.depthWrite = !0, this.depthFunc = Ae), this.weighted && (this.blending = ee, this.transparent = !0, this.depthTest = !0, this.depthWrite = !1), this.needsUpdate = !0 } }, { key: "getDefines", value: function() { var e, t = []; this.pointSizeType === am.FIXED ? t.push("#define fixed_point_size") : this.pointSizeType === am.ATTENUATED ? t.push("#define attenuated_point_size") : this.pointSizeType === am.ADAPTIVE && t.push("#define adaptive_point_size"), jp.EXT_DEPTH.isSupported() || this.shape !== om.PARABOLOID || (this.shape = om.SQUARE), this.shape === om.SQUARE ? t.push("#define square_point_shape") : this.shape === om.CIRCLE ? t.push("#define circle_point_shape") : this.shape === om.PARABOLOID && t.push("#define paraboloid_point_shape"), (this._useEDL || this.fakeEDL) && t.push("#define use_edl"), this.activeAttributeName && (e = this.activeAttributeName.replace(/[^a-zA-Z0-9]/g, "_"), t.push("#define color_type_".concat(e))), this._treeType === sm.OCTREE ? t.push("#define tree_type_octree") : this._treeType === sm.KDTREE && t.push("#define tree_type_kdtree"), this.weighted && t.push("#define weighted_splats"); var n, i = ue(this.defines); try { for (i.s(); !(n = i.n()).done; ) { var r = N(n.value, 2) , a = (r[0], r[1]); t.push(a) } } catch (e) { i.e(e) } finally { i.f() } return t.join("\n") } }, { key: "setClipBoxes", value: function(e) { if (e) { var t = this.clipBoxes.length !== e.length && (0 === e.length || 0 === this.clipBoxes.length); this.uniforms.clipBoxCount.value = this.clipBoxes.length, this.clipBoxes = e, t && this.updateShaderSource(), this.uniforms.clipBoxes.value = new Float32Array(16 * this.clipBoxes.length); for (var n = 0; n < this.clipBoxes.length; n++) { var i = e[n]; this.uniforms.clipBoxes.value.set(i.inverse.elements, 16 * n) } for (var r = 0; r < this.uniforms.clipBoxes.value.length; r++) Number.isNaN(this.uniforms.clipBoxes.value[r]) && (this.uniforms.clipBoxes.value[r] = 1 / 0) } } }, { key: "setClipPolygons", value: function(e, t) { e && (this.clipPolygons = e, this.clipPolygons.length !== e.length && this.updateShaderSource()) } }, { key: "gradient", get: function() { return this._gradient }, set: function(e) { this._gradient !== e && (this._gradient = e, this.gradientTexture = s.generateGradientTexture(this._gradient), this.uniforms.gradient.value = this.gradientTexture) } }, { key: "matcap", get: function() { return this._matcap }, set: function(e) { this._matcap !== e && (this._matcap = e, this.matcapTexture = Potree.PointCloudMaterial.generateMatcapTexture(this._matcap), this.uniforms.matcapTextureUniform.value = this.matcapTexture) } }, { key: "useOrthographicCamera", get: function() { return this.uniforms.useOrthographicCamera.value }, set: function(e) { this.uniforms.useOrthographicCamera.value !== e && (this.uniforms.useOrthographicCamera.value = e) } }, { key: "backfaceCulling", get: function() { return this.uniforms.backfaceCulling.value }, set: function(e) { this.uniforms.backfaceCulling.value !== e && (this.uniforms.backfaceCulling.value = e, this.dispatchEvent({ type: "backface_changed", target: this })) } }, { key: "recomputeClassification", value: function() { for (var e = this.classification, t = this.classificationTexture.image.data, n = [1, 1, 1, 1], i = !1, r = 0; r < 256; r++) { var a = void 0 , o = !0; e[r] ? (a = e[r].color, o = e[r].visible) : e[r % 32] ? (a = e[r % 32].color, o = e[r % 32].visible) : e.DEFAULT ? (a = e.DEFAULT.color, o = e.DEFAULT.visible) : a = n; var s = parseInt(255 * a[0]) , l = parseInt(255 * a[1]) , u = parseInt(255 * a[2]) , a = o ? parseInt(255 * a[3]) : 0; t[4 * r + 0] !== s && (t[4 * r + 0] = s, i = !0), t[4 * r + 1] !== l && (t[4 * r + 1] = l, i = !0), t[4 * r + 2] !== u && (t[4 * r + 2] = u, i = !0), t[4 * r + 3] !== a && (t[4 * r + 3] = a, i = !0) } i && (this.classificationTexture.needsUpdate = !0, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "spacing", get: function() { return this.uniforms.spacing.value }, set: function(e) { this.uniforms.spacing.value !== e && (this.uniforms.spacing.value = e) } }, { key: "useClipBox", get: function() { return this._useClipBox }, set: function(e) { this._useClipBox !== e && (this._useClipBox = e, this.updateShaderSource()) } }, { key: "clipTask", get: function() { return this.uniforms.clipTask.value }, set: function(e) { this.uniforms.clipTask.value = e } }, { key: "elevationGradientRepat", get: function() { return this.uniforms.elevationGradientRepat.value }, set: function(e) { this.uniforms.elevationGradientRepat.value = e } }, { key: "clipMethod", get: function() { return this.uniforms.clipMethod.value }, set: function(e) { this.uniforms.clipMethod.value = e } }, { key: "weighted", get: function() { return this._weighted }, set: function(e) { this._weighted !== e && (this._weighted = e, this.updateShaderSource()) } }, { key: "fov", get: function() { return this.uniforms.fov.value }, set: function(e) { this.uniforms.fov.value !== e && (this.uniforms.fov.value = e) } }, { key: "resolution", get: function() { return this.uniforms.resolution.value }, set: function(e) { this.uniforms.resolution.value.copy(e) } }, { key: "near", get: function() { return this.uniforms.near.value }, set: function(e) { this.uniforms.near.value !== e && (this.uniforms.near.value = e) } }, { key: "far", get: function() { return this.uniforms.far.value }, set: function(e) { this.uniforms.far.value !== e && (this.uniforms.far.value = e) } }, { key: "opacity", get: function() { return this.uniforms.uOpacity.value }, set: function(e) { this.uniforms && this.uniforms.uOpacity && this.uniforms.uOpacity.value !== e && (this.uniforms.uOpacity.value = e, this.updateShaderSource(), this.dispatchEvent({ type: "opacity_changed", target: this }), this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "activeAttributeName", get: function() { return this._activeAttributeName }, set: function(e) { this._activeAttributeName !== e && (this._activeAttributeName = e, this.updateShaderSource(), this.dispatchEvent({ type: "active_attribute_changed", target: this }), this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "pointSizeType", get: function() { return this._pointSizeType }, set: function(e) { this._pointSizeType !== (e = "string" == typeof e ? am[e] : e) && (this._pointSizeType = e, this.updateShaderSource(), this.dispatchEvent({ type: "point_size_type_changed", target: this }), this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "useEDL", get: function() { return this._useEDL }, set: function(e) { this._useEDL !== e && (this._useEDL = e, this.updateShaderSource()) } }, { key: "fakeEDL", get: function() { return this._fakeEDL }, set: function(e) { this._fakeEDL !== e && (this._fakeEDL = e, this.updateShaderSource()) } }, { key: "color", get: function() { return this.uniforms.uColor.value }, set: function(e) { var t, n; e != this.color_ && ("string" != typeof (t = e) || (n = Potree.config.colors[e]) && (t = (new Yi).fromArray(n).multiplyScalar(1 / 255)), this.uniforms.uColor.value.set(t), this.dispatchEvent({ type: "color_changed", target: this }), this.dispatchEvent({ type: "material_property_changed", target: this }), this.color_ = e) } }, { key: "shape", get: function() { return this._shape }, set: function(e) { this._shape !== e && (this._shape = e, this.updateShaderSource(), this.dispatchEvent({ type: "point_shape_changed", target: this }), this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "treeType", get: function() { return this._treeType }, set: function(e) { this._treeType !== e && (this._treeType = e, this.updateShaderSource()) } }, { key: "bbSize", get: function() { return this.uniforms.bbSize.value }, set: function(e) { this.uniforms.bbSize.value = e } }, { key: "size", get: function() { return this.uniforms.size.value }, set: function(e) { this.uniforms.size.value !== e && (this.uniforms.size.value = e, this.dispatchEvent({ type: "point_size_changed", target: this }), this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "minSize", get: function() { return this.uniforms.minSize.value }, set: function(e) { this.uniforms.minSize.value !== e && (this.uniforms.minSize.value = e, this.dispatchEvent({ type: "point_size_changed", target: this }), this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "elevationRange", get: function() { return this.uniforms.elevationRange.value }, set: function(e) { this.uniforms.elevationRange.value[0] === e[0] && this.uniforms.elevationRange.value[1] === e[1] || (this.uniforms.elevationRange.value = e, this._defaultElevationRangeChanged = !0, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "heightMin", get: function() { return this.uniforms.elevationRange.value[0] }, set: function(e) { this.elevationRange = [e, this.elevationRange[1]] } }, { key: "heightMax", get: function() { return this.uniforms.elevationRange.value[1] }, set: function(e) { this.elevationRange = [this.elevationRange[0], e] } }, { key: "transition", get: function() { return this.uniforms.transition.value }, set: function(e) { this.uniforms.transition.value = e } }, { key: "intensityRange", get: function() { return this.uniforms.intensityRange.value }, set: function(e) { e instanceof Array && 2 === e.length && (e[0] === this.uniforms.intensityRange.value[0] && e[1] === this.uniforms.intensityRange.value[1] || (this.uniforms.intensityRange.value = e, this._defaultIntensityRangeChanged = !0, this.dispatchEvent({ type: "material_property_changed", target: this }))) } }, { key: "intensityGamma", get: function() { return this.uniforms.intensity_gbc.value[0] }, set: function(e) { this.uniforms.intensity_gbc.value[0] !== e && (this.uniforms.intensity_gbc.value[0] = e, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "intensityContrast", get: function() { return this.uniforms.intensity_gbc.value[2] }, set: function(e) { this.uniforms.intensity_gbc.value[2] !== e && (this.uniforms.intensity_gbc.value[2] = e, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "intensityBrightness", get: function() { return this.uniforms.intensity_gbc.value[1] }, set: function(e) { this.uniforms.intensity_gbc.value[1] !== e && (this.uniforms.intensity_gbc.value[1] = e, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "rgbGamma", get: function() { return this.uniforms.uRGB_gbc.value[0] }, set: function(e) { this.uniforms.uRGB_gbc.value[0] !== e && (this.uniforms.uRGB_gbc.value[0] = e, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "rgbContrast", get: function() { return this.uniforms.uRGB_gbc.value[2] }, set: function(e) { this.uniforms.uRGB_gbc.value[2] !== e && (this.uniforms.uRGB_gbc.value[2] = e, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "rgbBrightness", get: function() { return this.uniforms.uRGB_gbc.value[1] }, set: function(e) { this.uniforms.uRGB_gbc.value[1] !== e && (this.uniforms.uRGB_gbc.value[1] = e, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "extraGamma", get: function() { return this.uniforms.uExtraGammaBrightContr.value[0] }, set: function(e) { this.uniforms.uExtraGammaBrightContr.value[0] !== e && (this.uniforms.uExtraGammaBrightContr.value[0] = e, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "extraBrightness", get: function() { return this.uniforms.uExtraGammaBrightContr.value[1] }, set: function(e) { this.uniforms.uExtraGammaBrightContr.value[1] !== e && (this.uniforms.uExtraGammaBrightContr.value[1] = e, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "extraContrast", get: function() { return this.uniforms.uExtraGammaBrightContr.value[2] }, set: function(e) { this.uniforms.uExtraGammaBrightContr.value[2] !== e && (this.uniforms.uExtraGammaBrightContr.value[2] = e, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "getRange", value: function(e) { return this.ranges.get(e) } }, { key: "setRange", value: function(e, t) { var n = !1 , i = this.ranges.get(e) , n = null == i || null == t || (i[0] !== t[0] || i[1] !== t[1]); this.ranges.set(e, t), n && this.dispatchEvent({ type: "material_property_changed", target: this }) } }, { key: "extraRange", get: function() { return this.uniforms.uExtraRange.value }, set: function(e) { e instanceof Array && 2 === e.length && (e[0] === this.uniforms.uExtraRange.value[0] && e[1] === this.uniforms.uExtraRange.value[1] || (this.uniforms.uExtraRange.value = e, this._defaultExtraRangeChanged = !0, this.dispatchEvent({ type: "material_property_changed", target: this }))) } }, { key: "weightRGB", get: function() { return this.uniforms.wRGB.value }, set: function(e) { this.uniforms.wRGB.value !== e && (this.uniforms.wRGB.value = e, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "weightIntensity", get: function() { return this.uniforms.wIntensity.value }, set: function(e) { this.uniforms.wIntensity.value !== e && (this.uniforms.wIntensity.value = e, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "weightElevation", get: function() { return this.uniforms.wElevation.value }, set: function(e) { this.uniforms.wElevation.value !== e && (this.uniforms.wElevation.value = e, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "weightClassification", get: function() { return this.uniforms.wClassification.value }, set: function(e) { this.uniforms.wClassification.value !== e && (this.uniforms.wClassification.value = e, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "weightReturnNumber", get: function() { return this.uniforms.wReturnNumber.value }, set: function(e) { this.uniforms.wReturnNumber.value !== e && (this.uniforms.wReturnNumber.value = e, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "weightSourceID", get: function() { return this.uniforms.wSourceID.value }, set: function(e) { this.uniforms.wSourceID.value !== e && (this.uniforms.wSourceID.value = e, this.dispatchEvent({ type: "material_property_changed", target: this })) } }, { key: "disableEvents", value: function() { void 0 === this._hiddenListeners && (this._hiddenListeners = this._listeners, this._listeners = {}) } }, { key: "enableEvents", value: function() { this._listeners = this._hiddenListeners, this._hiddenListeners = void 0 } }, { key: "setProjectedPanos", value: function(e, t, n, i) { this.usePanoMap = !0, null != n && (this.uniforms.progress.value = n), this.uniforms.pano0Map.value = e.getSkyboxTexture(), this.uniforms.pano0Position.value.copy(e.position), this.uniforms.pano0Matrix.value.copy(e.panoMatrix), this.uniforms.easeInOutRatio.value = i || 0, this.uniforms.pano1Map.value = t.getSkyboxTexture(), this.uniforms.pano1Position.value.copy(t.position), this.uniforms.pano1Matrix.value.copy(t.panoMatrix) } }, { key: "stopProjectedPanos", value: function() { this.usePanoMap = !1 } }], [{ key: "generateGradientTexture", value: function(e) { var t = document.createElement("canvas"); t.width = 64, t.height = 64; var n = t.getContext("2d"); n.rect(0, 0, 64, 64); for (var i = n.createLinearGradient(0, 0, 64, 64), r = 0; r < e.length; r++) { var a = e[r]; i.addColorStop(a[0], "#" + a[1].getHexString()) } n.fillStyle = i, n.fill(); t = new xl(t); return t.needsUpdate = !0, t.minFilter = Oe, t.wrap = ke, t.repeat = 2, t } }, { key: "generateMatcapTexture", value: function(e) { e = new URL(Potree.resourcePath + "/textures/matcap/" + e).href, e = (new _c).load(e); return e.magFilter = e.minFilter = Oe, e.needsUpdate = !0, e } }]), s }(), Fm = { sortByScore: function(e, t, i) { e = t ? Fm.filterAll(e, t) : e; return 0 === e.length ? null : e.map(function(n) { return { item: n, score: i.reduce(function(e, t) { return e + t(n) }, 0) } }).sort(function(e, t) { return t.score - e.score }) }, filterAll: function(e, n) { return e.filter(function(t) { return n.every(function(e) { return e(t) }) }) }, find: function(e, t, n, i) { if (i) { i = this.sortByScore(e, t, n); return i && i[0] && i[0].item } var r = t ? Fm.filterAll(e, t) : e; return 0 === r.length ? null : (n && n.forEach(function(e) { r = Fm.stableSort(r, e) }), r[0]) }, stableSort: function(e, i) { return e.map(function(e, t) { return { value: e, index: t } }).sort(function(e, t) { var n = i(e.value, t.value); return 0 !== n ? n : e.index - t.index }).map(function(e) { return e.value }) }, average: function(e, t) { if (0 === e.length) return null; for (var n = 0, i = 0, r = 0; r < e.length; r++) n += t ? e[r][t] : e[r], i++; return n / i }, getMixedSet: function(e, t) { return e.filter(function(e) { return t.includes(e) }) }, getUnionSet: function(t, e) { return t.concat(e.filter(function(e) { return !t.includes(e) })) }, getDifferenceSet: 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) }, getDifferenceSetMuti: function(e) { var n = []; return e.forEach(function(e) { e.forEach(function(e) { var t = n.indexOf(e); -1 < t ? n.splice(t, 1) : n.push(e) }) }), n }, CloneJson: function(e) { e = JSON.stringify(e); return JSON.parse(e) }, CloneObject: function(t, e, n) { var i, r = this, a = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : []; if (a.push(Si), !t || "number" == typeof t || "string" == typeof t || t instanceof Function || a.some(function(e) { return t instanceof e })) return t; if (e = e || {}, t instanceof Array) return t.map(function(e) { return r.CloneObject(e) }); if (t.clone instanceof Function) return t.clone(); for (i in t) t[i]instanceof Object && !n ? e[i] = this.CloneObject(t[i]) : e[i] = t[i]; return e }, CloneClassObject: function(e) { var t = new e.constructor; return this.CopyClassObject(t, e), t }, CopyClassObject: function(e, t) { for (var n in t) { if (n in t.__proto__) break; e[n] = this.CloneObject(t[n], null) } }, ifSame: (Lm = function(n, e) { if (n == e) return !0; if (!n || !e) return !1; if (n.constructor != e.constructor) return !1; if (n instanceof Array) { if (n.length != e.length) return !1; for (var i = e.slice(0), t = 0; t < n.length; t++) { var r, a = function(t) { if (null == (r = i.find(function(e) { return ifSame(n[t], e) })) && !i.includes(r) && !n.includes(r)) return { v: !1 }; var e = i.indexOf(r); i.splice(e, 1) }(t); if ("object" === X(a)) return a.v } return !0 } if (n.equals instanceof Function) return n.equals(e); if ("number" == typeof n || "string" == typeof n) return !(!isNaN(n) || !isNaN(e)) || n == e; if ("object" == X(n)) { var o, s = Object.keys(n), l = Object.keys(e); if (!ifSame(s, l)) return !1; for (o in n) if (!ifSame(n[o], e[o])) return !1; return !0 } console.log("isSame出现例外") } , Im.toString = function() { return Lm.toString() } , Im), replaceAll: function(e, t, n) { t = new RegExp(t,"g"); return e.replace(t, n) }, downloadFile: function(e, t, n) { var i = document.createElementNS("http://www.w3.org/1999/xhtml", "a"); i.href = e, i.download = t; t = document.createEvent("MouseEvents"); t.initMouseEvent("click", !0, !1, window, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null), i.dispatchEvent(t), n && n() }, intervalTool: { list: [], isWaiting: function(t, n, i) { var r = this; this.list.includes(t) || n() && (this.list.push(t), setTimeout(function() { var e = r.list.indexOf(t); r.list.splice(e, 1), r.isWaiting(t, n, i) }, i)) } }, pushToGroupAuto: function(t, n, i) { i = i || function() {} ; var r, a = n.filter(function(e) { return e.find(function(e) { return t[0] == e || i(e, t[0]) || t[1] == e || t[1] && i(e, t[1]) }) }); a.length ? (t.forEach(function(e) { a[0].includes(e) || a[0].push(e) }), 1 < a.length && (r = [], a.forEach(function(e) { r = Fm.getUnionSet(r, e), n.splice(n.indexOf(e), 1) }), n.push(r))) : n.push(t) }, addOrRemoveDefine: function(e, t, n) { var i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : "" , r = e.defines; if ("add" == n) { if (null != r[t] && r[t] == i) return; r[t] = i } else { if (null != r[t]) return; delete r[t] } e.needsUpdate = !0 }, makeTexDontResize: function(e) { !e || e.image && gn.isPowerOfTwo(e.image.width) && gn.isPowerOfTwo(e.image.height) || (e.wrapS = e.wrapT = Be, e.minFilter = Oe) } }; function Im(e, t) { return Lm.apply(this, arguments) } new ua(1,1); function Om(e, t) { var n = zm.get(e); return n || (t = new $i({ color: (new Yi).setHSL(Math.random(), .5, .9), transparent: !0, side: 2, opacity: t ? .3 : .9 }), zm.set(e, t), t) } var zm = new Map , Nm = function() { y(n, bm); var t = w(n); function n() { var e; return O(this, n), (e = t.call(this)).children = [], e.sceneNode = null, e.octree = null, e } return h(n, [{ key: "getNumPoints", value: function() { return this.geometryNode.numPoints } }, { key: "isLoaded", value: function() { return !0 } }, { key: "isTreeNode", value: function() { return !0 } }, { key: "isGeometryNode", value: function() { return !1 } }, { key: "getLevel", value: function() { return this.geometryNode.level } }, { key: "getBoundingSphere", value: function() { return this.geometryNode.boundingSphere } }, { key: "getBoundingBox", value: function() { return this.geometryNode.boundingBox } }, { key: "getChildren", value: function() { for (var e = [], t = 0; t < 8; t++) this.children[t] && e.push(this.children[t]); return e } }, { key: "getPointsInBox", value: function(e) { if (!this.sceneNode) return null; for (var t = this.geometryNode.buffer, n = t.offset("position"), i = t.stride, r = new DataView(t.data), e = e.matrixWorld.clone().invert(), a = (new ni).multiplyMatrices(e, this.sceneNode.matrixWorld), o = [], s = new Mn, l = 0; l < t.numElements; l++) { var u = r.getFloat32(l * i + n + 0, !0) , c = r.getFloat32(l * i + n + 4, !0) , d = r.getFloat32(l * i + n + 8, !0); s.set(u, c, d, 1), s.applyMatrix4(a), -.5 < s.x && s.x < .5 && -.5 < s.y && s.y < .5 && -.5 < s.z && s.z < .5 && (s.set(u, c, d, 1).applyMatrix4(this.sceneNode.matrixWorld), o.push(new Cn(s.x,s.y,s.z))) } return o } }, { key: "name", get: function() { return this.geometryNode.name } }]), n }() , Um = function() { y(u, xm); var l = w(u); function u(e, t) { var i; O(this, u), (i = l.call(this)).pcoGeometry = e, i.boundingBox = i.pcoGeometry.tightBoundingBox, i.boundingSphere = i.boundingBox.getBoundingSphere(new qn), i.material = t || new Rm, i.visiblePointsTarget = 2e6, i.minimumNodePixelSize = 150, i.level = 0, i.position.copy(e.offset), i.updateMatrix(), i.nodeMaxLevel = 0, i.maxLevel = 1 / 0, i.temp = { sizeFitToLevel: {}, opacity: {} }, i.panos = [], i.matrixAutoUpdate = !1, i.orientationUser = 0, i.translateUser = new Cn, i.rotateMatrix = new ni, i.transformMatrix = new ni, i.transformInvMatrix = new ni, i.rotateInvMatrix = new ni, i.nodeMaxLevelPredict = i.predictNodeMaxLevel(), i.testMaxNodeCount = i.testMaxNodeCount2 = 0, i.material.spacing = i.pcoGeometry.spacing; for (var r = "rgba", a = 0, o = ["rgba", "rgb", "intensity", "classification"]; a < o.length; a++) { var n = function() { var t = o[a] , e = i.pcoGeometry.pointAttributes.attributes.find(function(e) { return e.name === t }); if (!e) return "continue"; var n = "Array" === e.range[0].constructor.name ? e.range[0] : [e.range[0]] , e = "Array" === e.range[1].constructor.name ? e.range[1] : [e.range[1]] , n = B(Cn, Q(n)) , e = B(Cn, Q(e)); return 0 === n.distanceTo(e) ? "continue" : (r = t, "break") }(); if ("continue" !== n && "break" === n) break } i.material.activeAttributeName = r, i.showBoundingBox = !1, i.boundingBoxNodes = [], i.loadQueue = [], i.visibleBounds = new kn, i.visibleNodes = [], i.visibleGeometry = [], i.generateDEM = !1, i.profileRequests = [], i.name = "", i._visible = !0; var s = [i.pcoGeometry.tightBoundingBox, i.getBoundingBoxWorld()].find(function(e) { return void 0 !== e }); i.updateMatrixWorld(!0); t = (s = Jf.computeTransformedBoundingBox(s, i.matrixWorld)).min.z, s = s.max.z; return i.material.heightMin = t, i.material.heightMax = s, i.projection = e.projection, i.fallbackProjection = e.fallbackProjection, i.root = i.pcoGeometry.root, i.pcoGeometry.addEventListener("updateNodeMaxLevel", i.updateNodeMaxLevel.bind(g(i))), i.isPointcloud = !0, i } return h(u, [{ key: "updateNodeMaxLevel", value: function(e) { e = Math.max(e.level, this.nodeMaxLevel); e != this.nodeMaxLevel && (this.nodeMaxLevel = e, console.log("updateNodeMaxLevel " + this.dataset_id + " : " + this.nodeMaxLevel), this.setPointLevel(), Potree.settings.sizeFitToLevel || this.changePointSize()) } }, { key: "testMaxNodeLevel", value: function() { if (!this.testMaxNodeLevelDone) { if (0 == this.nodeMaxLevel) return !0; if (!viewer.atDatasets.includes(this)) return !0; var e = this.visibleNodes.map(function(e) { return e.getLevel() }); if (Math.max.apply(null, e) < this.maxLevel) return !0; e = this.maxLevel; this.maxLevel = 12, Potree.updatePointClouds([this], viewer.scene.getActiveCamera(), viewer.mainViewport.resolution); this.visibleNodes.map(function(e) { return e.getLevel() }); return (this.maxLevel = e, this.testMaxNodeCount++, 500 < this.testMaxNodeCount) ? (console.log("testMaxNodeLevel次数超出,强制结束:", this.dataset_id, this.nodeMaxLevel, this.nodeMaxLevelPredict.min), void (this.testMaxNodeLevelDone = "moreThanMaxCount")) : this.nodeMaxLevel < this.nodeMaxLevelPredict.min || (this.testMaxNodeCount2++, this.testMaxNodeCount2 < 50 || void (this.testMaxNodeLevelDone = !0)) } } }, { key: "setPointLevel", value: function() { var e = Potree.settings.pointDensity , e = Potree.config.pointDensity[e]; e && (e = e.percentByUser && null != Potree.settings.UserDensityPercent ? Potree.settings.UserDensityPercent : e.maxLevelPercent, this.maxLevel = Math.round(e * this.nodeMaxLevel), Potree.settings.sizeFitToLevel && this.changePointSize(), this.changePointOpacity()) } }, { key: "predictNodeMaxLevel", value: function() { var e = .005 , t = .014; return { min: Math.log2(this.material.spacing / t), max: Math.log2(this.material.spacing / e) } } }, { key: "getHighestNodeSpacing", value: function() { return this.material.spacing / Math.pow(2, this.nodeMaxLevel) } }, { key: "setName", value: function(e) { this.name !== e && (this.name = e, this.dispatchEvent({ type: "name_changed", name: e, pointcloud: this })) } }, { key: "getName", value: function() { return this.name } }, { key: "getAttribute", value: function(t) { var e = this.pcoGeometry.pointAttributes.attributes.find(function(e) { return e.name === t }); return e || null } }, { key: "getAttributes", value: function() { return this.pcoGeometry.pointAttributes } }, { key: "toTreeNode", value: function(l, t) { var u = this , c = new Nm , e = new gl(l.geometry,this.material); e.name = l.name, e.position.copy(l.boundingBox.min), e.frustumCulled = !1, e.onBeforeRender = function(e, t, n, i, r, a) { var o, s; r.program && (e.getContext().useProgram(r.program.program), r.program.getUniforms().map.level && (o = l.getLevel(), r.uniforms.level.value = o, r.program.getUniforms().map.level.setValue(e.getContext(), o)), u.visibleNodeTextureOffsets && r.program.getUniforms().map.vnStart && (s = u.visibleNodeTextureOffsets.get(c), r.uniforms.vnStart.value = s, r.program.getUniforms().map.vnStart.setValue(e.getContext(), s)), r.program.getUniforms().map.pcIndex && (s = c.pcIndex || u.visibleNodes.indexOf(c), r.uniforms.pcIndex.value = s, r.program.getUniforms().map.pcIndex.setValue(e.getContext(), s))) } , c.geometryNode = l, c.sceneNode = e, c.pointcloud = this, c.children = []; for (var n, i = 0; i < 8; i++) c.children[i] = l.children[i]; t ? (n = parseInt(l.name[l.name.length - 1]), t.sceneNode.add(e), t.children[n] = c) : (this.root = c, this.add(e)); return l.oneTimeDisposeHandlers.push(function() { var e = parseInt(l.name[l.name.length - 1]); t.sceneNode.remove(c.sceneNode), t.children[e] = l }), c } }, { key: "buildTexMesh11", value: function(D, i) { var k = this , r = Date.now(); if (this.splitSprites || ((e = new Si).name = "splitSprites_" + this.name, e.matrixAutoUpdate = !1, e.matrix.copy(this.matrix), e.matrixWorld.copy(this.matrixWorld), this.splitSprites = e, viewer.scene.scene.add(e), this.areaPlanes = []), null == this.texMeshUseLevel || D.level == this.texMeshUseLevel) { var h, e = function() { var M = k.material.spacing / Math.pow(2, D.level); if (3 < M) return { v: void 0 }; var A = 1.4 * M; null == k.texMeshUseLevel && (k.texMeshUseLevel = D.level, console.log("texMeshUseLevel ", D.level)); var e = D.geometry , t = e.attributes.position.count , n = Math.min(t, 6e3) , t = Math.min(5e3, n); console.warn("check points count:", n - t); var a = e.attributes.position.array , o = e.attributes.normal.array , s = (new Cn(0,1,0), new Cn, []) , l = [] , T = Math.pow(1.8 * M, 2) , u = Math.cos(gn.degToRad(5)) , c = [] , S = 0 , C = 0 , P = new Si; P.name = "sub_splitSprites_" + D.name, P.position.copy(i.position), P.rotation.copy(i.rotation), k.splitSprites.add(P); for (var d = t; d < n; d++) !function() { var i = new Cn(a[3 * d],a[3 * d + 1],a[3 * d + 2]) , r = new Cn(o[3 * d],o[3 * d + 1],o[3 * d + 2]); i.nor = r, i.index = d, s.push(i), l.push(r); var t, e = c.filter(function(e) { if (!(1e3 < e.length)) return e.some(function(e) { var t = e.distanceToSquared(i) , n = e.nor.dot(r); if (t < T && u < n) return t / T - e.nor.dot(r) < 0 }) }); 0 == e.length && (h = [], c.push(h), e = [h]), 1 == e.length ? i.belongTo = e[0] : 1 < e.length && (t = [], e.forEach(function(e) { t.push.apply(t, Q(e)); e = c.indexOf(e); c.splice(e, 1) }), c.push(t), (i.belongTo = t).forEach(function(e) { e.belongTo = t })), i.belongTo.push(i) }(); c.forEach(function(e, n) { if (e.length <= 6) S += e.length; else { C++, e.sort(function(e, t) { return e.index - t.index }), console.log("开始解析 ".concat(D.name, " - 第").concat(n, "组,总第").concat(e[0].index, "个点,组内有").concat(e.length, "个点")); var i = Om(e, !0); e.forEach(function(e, t) { t = new Jp({ text: n + "-" + t + " (" + e.index + ")" + D.name, dontFixOrient: !0, backgroundColor: { r: 255 * i.color.r, g: 255 * i.color.g, b: 255 * i.color.b, a: .6 } }); t.lookAt(e.nor), t.position.copy(e), t.scale.set(A / 3, A / 3, A / 3), P.add(t) }); for (var t, r = e.reduce(function(e, t) { return e.add(t) }, new Cn).multiplyScalar(1 / e.length), a = [], o = e.slice(0).sort(function(e, t) { return e.distanceToSquared(r) - t.distanceToSquared(r) }), s = o.length, l = (t = 7 <= s ? (n = [.02, .15, .4, .55, .7, .86, .99].map(function(e) { return Math.round(e * (s - 1)) })).map(function(e) { return o[e] }) : o).length, u = 0; u < l; u++) for (var c = u + 1; c < l; c++) for (var d = c + 1; d < l; d++) { var h = t[u] , p = t[c] , f = t[d] , h = (new Cn).subVectors(h, f) , f = (new Cn).subVectors(p, f) , f = h.cross(f).normalize(); a[0] && f.dot(a[0]) < 0 && f.negate(), console.log("nor", f), a.push(f) } var m = a.reduce(function(e, t) { return e.add(t) }, new Cn).normalize(); console.log("aveNor", m, "avePos", r, n); var v = (new ki).setFromNormalAndCoplanarPoint(m, r) , g = e.map(function(e) { return v.projectPoint(e, new Cn) }) , m = g[0].clone() , y = Up.getQuaBetween2Vector(v.normal, new Cn(0,0,1), new Cn(0,0,1)) , w = g.map(function(e) { return e.clone().applyQuaternion(y) }) , b = y.clone().invert() , x = []; w.forEach(function(e, t) { e.id = t; for (var n = 0; n < t; n++) e.distanceToSquared(w[n]) < 1.5 * T && x.push({ p1: n, p2: t }) }), console.log("points count:", w.length, "lines:", x); var E, _, e = kp({ points: w, lines: x, onlyGetOutRing: !0, precision: Math.max(M / 10, .01) }); console.log("rings:", e), e && ((E = i.clone()).opacity = .5, (g = w[0].clone()).z = 0, g.applyQuaternion(b), _ = m.clone().sub(g), e.forEach(function(e) { e = new Hr(Cf.getShapeGeo(e.points),E); e.quaternion.copy(b), e.position.copy(_), e.name = "areaPlane_" + n, P.add(e), k.areaPlanes.push(e) })) } }), console.log(D.name, "中:"), console.log("removed point count: ", S), console.log(c), console.log("comebine mesh Len:", C), console.log("computeTime: " + (Date.now() - r)) }(); if ("object" === X(e)) return e.v } } }, { key: "buildTexMesh", value: function(w, b) { var x = this; w.level <= 0 && function() { var e = Date.now() , t = new Si; t.name = "splitSprites_" + w.name, t.matrixAutoUpdate = !1, t.matrix.copy(x.matrix), t.matrixWorld.copy(x.matrixWorld), viewer.scene.scene.add(t); var n = new Mr , i = x.material.spacing / Math.pow(2, w.level) , r = 1.4 * i; console.log("spriteWidth:", r); var t = w.geometry , a = t.attributes.position.count , o = t.attributes.position.array , s = t.attributes.normal.array , l = new Cn(0,1,0) , u = new Cn , c = [] , d = [] , h = [] , p = [] , f = [new Cn(-1,1,0), new Cn(1,1,0), new Cn(-1,-1,0), new Cn(1,-1,0)] , m = [0, 2, 1, 2, 3, 1]; f.forEach(function(e) { return e.multiplyScalar(r / 2) }); for (var v, g, i = [], t = 0, y = 0; y < a; y++) g = v = void 0, v = new Cn(o[3 * y],o[3 * y + 1],o[3 * y + 2]), g = new Cn(s[3 * y],s[3 * y + 1],s[3 * y + 2]), v.nor = g, c.push(v), d.push(g); for (y = 0; y < a; y++) (function() { var e = c[y] , t = d[y]; if (.2 < Math.abs(t.z)) return; var n = (new ni).lookAt(t, u, l); n.elements[12] = e.x, n.elements[13] = e.y, n.elements[14] = e.z, f.forEach(function(e) { e = e.clone(); e.applyMatrix4(n), h.push.apply(h, Q(e.toArray())) }), m.forEach(function(e) { p.push(e + 4 * y) }) } )(); console.log("removed count: ", t), console.log(i), console.log("computeTime: " + (Date.now() - e)), n.setAttribute("position", new dr(new Float32Array(h),3)), n.setIndex(p); e = new Hr(n,Om("use")); e.name = w.name, e.position.copy(b.position), e.rotation.copy(b.rotation), (b.sprites = e).pointsNode = b, 0 == w.level && ((n = new Si).name = "spriteNodeRoot", n.matrixAutoUpdate = !1, n.matrix.copy(x.matrix), n.matrixWorld.copy(x.matrixWorld), viewer.scene.scene.add(n), x.spriteNodeRoot = n), x.spriteNodeRoot.add(e), viewer.setObjectLayers(e, "sceneObjects") }() } }, { key: "updateVisibleBounds", value: function() { for (var e = [], t = 0; t < this.visibleNodes.length; t++) { for (var n = this.visibleNodes[t], i = !0, r = 0; r < n.children.length; r++) { var a = n.children[r]; a instanceof Nm ? i = i && !a.sceneNode.visible : a instanceof Dm && (i = !0) } i && e.push(n) } this.visibleBounds.min = new Cn(1 / 0,1 / 0,1 / 0), this.visibleBounds.max = new Cn(-1 / 0,-1 / 0,-1 / 0); for (var o = 0; o < e.length; o++) { var s = e[o]; this.visibleBounds.expandByPoint(s.getBoundingBox().min), this.visibleBounds.expandByPoint(s.getBoundingBox().max) } } }, { key: "updateMaterial", value: function(e, t, n, i, r) { e.fov = n.fov * (Math.PI / 180), e.resolution = r, e.near = n.near, e.far = n.far, e.uniforms.octreeSize.value = this.pcoGeometry.boundingBox.getSize(new Cn).x } }, { key: "computeVisibilityTextureData", value: function(e, t) { Potree.measureTimings && performance.mark("computeVisibilityTextureData-start"); var n = new Uint8Array(4 * e.length) , i = new Map; (e = e.slice()).sort(function(e, t) { e = e.geometryNode.name, t = t.geometryNode.name; return e.length !== t.length ? e.length - t.length : e < t ? -1 : t < e ? 1 : 0 }); new Cn; for (var r = new Map, a = new Array(e.length).fill(1 / 0), o = 0; o < e.length; o++) { var s, l, u = e[o]; r.set(u.name, u), i.set(u, o), 0 < o && (s = parseInt(u.name.slice(-1)), l = u.name.slice(0, -1), l = r.get(l), a[l = i.get(l)] = Math.min(a[l], o - l), n[4 * l + 0] = n[4 * l + 0] | 1 << s, n[4 * l + 1] = a[l] >> 8, n[4 * l + 2] = a[l] % 256); var u = u.geometryNode.density; "number" == typeof u ? (u = Math.log2(u) / 2 - 1.5, n[4 * o + 3] = 10 * (10 + u)) : n[4 * o + 3] = 100 } return Potree.measureTimings && (performance.mark("computeVisibilityTextureData-end"), performance.measure("render.computeVisibilityTextureData", "computeVisibilityTextureData-start", "computeVisibilityTextureData-end")), { data: n, offsets: i } } }, { key: "nodeIntersectsProfile", value: function(e, t) { for (var n = e.boundingBox.clone().applyMatrix4(this.matrixWorld).getBoundingSphere(new qn), i = !1, r = 0; r < t.points.length - 1; r++) var a = new Cn(t.points[r + 0].x,t.points[r + 0].y,n.center.z) , o = new Cn(t.points[r + 1].x,t.points[r + 1].y,n.center.z) , o = new vh(a,o).closestPointToPoint(n.center, !0, new Cn).distanceTo(n.center) , i = i || o < n.radius + t.width; return i } }, { key: "deepestNodeAt", value: function(e) { for (var t = this.matrixWorld.clone().invert(), n = e.clone().applyMatrix4(t), i = this.root; ; ) { var r, a = null, o = ue(i.children); try { for (o.s(); !(r = o.n()).done; ) { var s = r.value; void 0 !== s && s.getBoundingBox().containsPoint(n) && (a = s) } } catch (e) { o.e(e) } finally { o.f() } if (!(null !== a && a instanceof Nm)) break; i = a } return i } }, { key: "nodesOnRay", value: function(e, t) { for (var n = [], i = t.clone(), r = 0; r < e.length; r++) { var a = e[r] , o = a.getBoundingSphere().clone().applyMatrix4(this.matrixWorld); i.intersectsSphere(o) && n.push(a) } return n } }, { key: "updateMatrixWorld", value: function(e) { !0 === this.matrixAutoUpdate && this.updateMatrix(), !0 !== this.matrixWorldNeedsUpdate && !0 !== e || (this.parent ? this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix) : this.matrixWorld.copy(this.matrix), this.matrixWorldNeedsUpdate = !1) } }, { key: "hideDescendants", value: function(e) { for (var t = [], n = 0; n < e.children.length; n++) { var i = e.children[n]; i.visible && t.push(i) } for (; 0 < t.length; ) { var r = t.shift(); r.visible = !1; for (var a = 0; a < r.children.length; a++) { var o = r.children[a]; o.visible && t.push(o) } } } }, { key: "moveToOrigin", value: function() { this.position.set(0, 0, 0), this.updateMatrixWorld(!0); var e = this.boundingBox , t = this.matrixWorld , t = Jf.computeTransformedBoundingBox(e, t); this.position.set(0, 0, 0).sub(t.getCenter(new Cn)) } }, { key: "moveToGroundPlane", value: function() { this.updateMatrixWorld(!0); var e = this.boundingBox , t = this.matrixWorld , t = Jf.computeTransformedBoundingBox(e, t); this.position.y += -t.min.y } }, { key: "getBoundingBoxWorld", value: function() { this.updateMatrixWorld(!0); var e = this.boundingBox , t = this.matrixWorld; return Jf.computeTransformedBoundingBox(e, t) } }, { key: "getPointsInProfile", value: function(e, t, n) { if (n) { n = new Potree.ProfileRequest(this,e,t,n); return this.profileRequests.push(n), n } for (var i = { segments: [], boundingBox: new kn, projectedBoundingBox: new ph }, r = 0; r < e.points.length - 1; r++) { var a = e.points[r] , o = e.points[r + 1] , s = this.getProfile(a, o, e.width, t); i.segments.push({ start: a, end: o, points: s, project: null }), i.boundingBox.expandByPoint(s.boundingBox.min), i.boundingBox.expandByPoint(s.boundingBox.max) } for (var l = new Cn, u = 0; u < i.segments.length; u++) { var c = i.segments[u] , d = c.start , h = c.end , p = function(e, t, n, i) { var r = e , t = t , a = n , o = i , i = new Cn(1,0,0) , t = (new Cn).subVectors(t, r); t.y = 0, t.normalize(); var s = Math.acos(i.dot(t)); return 0 < t.z && (s = -s), function(e) { var t = (new ni).makeTranslation(-r.x, -o.min.y, -r.z) , n = (new ni).makeRotationY(-s) , i = (new ni).makeTranslation(a.x, 0, 0) , e = e.clone(); return e.applyMatrix4(t), e.applyMatrix4(n), e.applyMatrix4(i), e } }(d, h, l.clone(), i.boundingBox.clone()); c.project = p, l.x += new Cn(d.x,0,d.z).distanceTo(new Cn(h.x,0,h.z)), l.y += h.y - d.y } return i.projectedBoundingBox.min.x = 0, i.projectedBoundingBox.min.y = i.boundingBox.min.y, i.projectedBoundingBox.max.x = l.x, i.projectedBoundingBox.max.y = i.boundingBox.max.y, i } }, { key: "getProfile", value: function(e, t, n, i, r) { r = new Potree.ProfileRequest(e,t,n,i,r); this.profileRequests.push(r) } }, { key: "getVisibleExtent", value: function() { return this.visibleBounds.applyMatrix4(this.matrixWorld) } }, { key: "intersectsPoint", value: function(e) { if (!(this.pcoGeometry.root && this.pcoGeometry.root.geometry)) return !1; if (void 0 === this.signedDistanceField) { for (var t = new Float32Array(Math.pow(32, 3)).fill(1 / 0), n = this.pcoGeometry.root.geometry.attributes.position, i = this.boundingBox, r = n.count, a = 0; a < r; a += 3) { var o = n.array[3 * a + 0] , s = n.array[3 * a + 1] , l = n.array[3 * a + 2]; t[parseInt(Math.min(o / i.max.x * 32, 31)) + 32 * parseInt(Math.min(s / i.max.y * 32, 31)) + 32 * parseInt(Math.min(l / i.max.z * 32, 31)) * 32] = 0 } this.signedDistanceField = { resolution: 32, field: t } } var u = this.signedDistanceField , c = this.boundingBox , d = this.matrixWorld.clone().invert() , h = e.clone().applyMatrix4(d) , p = u.resolution , e = parseInt(p * (h.x / c.max.x)) , d = parseInt(p * (h.y / c.max.y)) , c = parseInt(p * (h.z / c.max.z)); return !(e < 0 || d < 0 || c < 0) && (!(p <= e || p <= d || p <= c) && 0 === u.field[e + d * p + c * p * p]) } }, { key: "pick", value: function(e, t, n, i) { var r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : {} , a = e.renderer , o = e.pRenderer; performance.mark("pick-start"); function s(e, t) { return null != e ? e : t } var l = gn.clamp(Math.round(80 * (1.1 - this.maxLevel / this.nodeMaxLevel)), 5, 100) , u = s(r.pickWindowSize, l) , c = (s(r.pickOutsideClipRegion, !1), t ? t.resolution : a.getSize(new yn)) , e = Math.ceil(s(r.width, c.width)) , l = Math.ceil(s(r.height, c.height)) , t = s(r.pointSizeType, this.material.pointSizeType) , c = s(r.pointSize, this.material.size) , d = this.nodesOnRay(this.visibleNodes, i); if (0 === d.length) return null; this.pickState || (f = new gs, (p = new Potree.PointCloudMaterial).activeAttributeName = "indices", h = new An(1,1,{ minFilter: Oe, magFilter: Re, format: et }), this.pickState = { renderTarget: h, material: p, scene: f }); var h = this.pickState , p = h.material; p.pointSizeType = t, p.shape = Potree.PointShape.PARABOLOID, p.uniforms.uFilterReturnNumberRange.value = this.material.uniforms.uFilterReturnNumberRange.value, p.uniforms.uFilterNumberOfReturnsRange.value = this.material.uniforms.uFilterNumberOfReturnsRange.value, p.uniforms.uFilterGPSTimeClipRange.value = this.material.uniforms.uFilterGPSTimeClipRange.value, p.uniforms.uFilterPointSourceIDClipRange.value = this.material.uniforms.uFilterPointSourceIDClipRange.value, p.activeAttributeName = "indices", p.size = c, p.uniforms.minSize.value = this.material.uniforms.minSize.value, p.uniforms.maxSize.value = this.material.uniforms.maxSize.value, p.classification = this.material.classification, p.recomputeClassification(), r.pickClipped ? (p.clipBoxes = this.material.clipBoxes, p.uniforms.clipBoxes = this.material.uniforms.clipBoxes, this.material.clipTask === Potree.ClipTask.HIGHLIGHT ? p.clipTask = Potree.ClipTask.NONE : p.clipTask = this.material.clipTask, p.clipMethod = this.material.clipMethod) : p.clipBoxes = [], this.updateMaterial(p, d, n, a, new yn(e,l)), h.renderTarget.setSize(e, l); var f = new yn(r.x,r.y) , t = a.getContext(); t.enable(t.SCISSOR_TEST), t.scissor(parseInt(f.x - (u - 1) / 2), parseInt(f.y - (u - 1) / 2), parseInt(u), parseInt(u)), a.state.buffers.depth.setTest(p.depthTest), a.state.buffers.depth.setMask(p.depthWrite), a.state.setBlending(Z), a.setRenderTarget(h.renderTarget), t.clearColor(0, 0, 0, 0), a.clear(!0, !0, !0); c = this.material; this.material = p, o.renderOctree(this, d, n, h.renderTarget), window.testScreen && (h = Potree.Utils.renderTargetToDataUrl(h.renderTarget, e, l, a), Fm.downloadFile(h, "screenshot.jpg"), window.testScreen = 0), this.material = c; function m(e, t, n) { return Math.min(Math.max(t, e), n) } e = parseInt(m(f.x - (u - 1) / 2, 0, e)), f = parseInt(m(f.y - (u - 1) / 2, 0, l)), l = new Uint8Array(4 * (u * u)); t.readPixels(e, f, u, u, t.RGBA, t.UNSIGNED_BYTE, l), a.setRenderTarget(null), a.state.reset(), a.setScissorTest(!1), t.disable(t.SCISSOR_TEST); for (var v = l, g = new Uint32Array(l.buffer), y = (Number.MAX_VALUE, []), w = 0; w < u; w++) for (var b = 0; b < u; b++) { var x = w + b * u , E = Math.pow(w - (u - 1) / 2, 2) + Math.pow(b - (u - 1) / 2, 2) , _ = v[4 * x + 3]; v[4 * x + 3] = 0; x = g[x]; 0 === _ && 0 === x || void 0 === _ || void 0 === x || (_ = { pIndex: x, pcIndex: _, distanceToCenter: E }, !r.all && 0 < y.length ? E < y[0].distanceToCenter && (y[0] = _) : y.push(_)) } for (var M = 0, A = y; M < A.length; M++) { var T = A[M] , S = {}; if (!d[T.pcIndex]) return null; var C, P = d[T.pcIndex], D = P.sceneNode, k = P.geometryNode.geometry; for (C in k.attributes) { var B, L, R, F, I = k.attributes[C]; "position" === C ? (B = I.array[3 * T.pIndex + 0], L = I.array[3 * T.pIndex + 1], R = I.array[3 * T.pIndex + 2], (R = new Cn(B,L,R)).applyMatrix4(D.matrixWorld), S[C] = R) : "indices" === C || (F = I.array.slice(I.itemSize * T.pIndex, I.itemSize * (T.pIndex + 1)), I.potree && function() { var e = I.potree , t = e.scale , n = e.offset; F = F.map(function(e) { return e / t + n }) }(), S[C] = F) } T.point = S } return performance.mark("pick-end"), performance.measure("pick", "pick-start", "pick-end"), r.all ? y.map(function(e) { return e.point }) : 0 === y.length ? null : y[0].point } }, { key: "getFittedBoxGen", value: regeneratorRuntime.mark(function e(t) { var n, i, r, a, o, s, l, u, c, d, h, p, f, m, v, g, y; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: n = performance.now(), i = new kn, r = t.matrixWorld.clone().invert(), a = ue(this.visibleNodes), e.prev = 4, a.s(); case 6: if ((g = a.n()).done) { e.next = 21; break } if ((o = g.value).sceneNode) { e.next = 10; break } return e.abrupt("continue", 19); case 10: for (s = o.geometryNode.buffer, l = s.offset("position"), u = s.stride, c = new DataView(s.data), d = (new ni).multiplyMatrices(r, o.sceneNode.matrixWorld), h = new Mn, p = 0; p < s.numElements; p++) f = c.getFloat32(p * u + l + 0, !0), m = c.getFloat32(p * u + l + 4, !0), v = c.getFloat32(p * u + l + 8, !0), h.set(f, m, v, 1), h.applyMatrix4(d), -.5 < h.x && h.x < .5 && -.5 < h.y && h.y < .5 && -.5 < h.z && h.z < .5 && i.expandByPoint(h); return void (e.next = 19); case 19: e.next = 6; break; case 21: e.next = 26; break; case 23: e.prev = 23, e.t0 = e.catch(4), a.e(e.t0); case 26: return e.prev = 26, a.f(), e.finish(26); case 29: return y = i.getCenter(new Cn).applyMatrix4(t.matrixWorld), (g = new Si).position.copy(y), g.scale.copy(t.scale), g.rotation.copy(t.rotation), y = (new Cn).subVectors(i.max, i.min), g.scale.multiply(y), y = performance.now() - n, console.log("duration: ", y), e.next = 40, g; case 40: case "end": return e.stop() } }, e, this, [[4, 23, 26, 29]]) }) }, { key: "getFittedBox", value: function(e) { var t, n = performance.now(), i = new kn, r = e.matrixWorld.clone().invert(), a = ue(this.visibleNodes); try { for (a.s(); !(t = a.n()).done; ) { var o = t.value; if (o.sceneNode && !(o.getLevel() > 1 / 0)) for (var s = o.geometryNode.buffer, l = s.offset("position"), u = s.stride, c = new DataView(s.data), d = (new ni).multiplyMatrices(r, o.sceneNode.matrixWorld), h = new Mn, p = 0; p < s.numElements; p++) { var f = c.getFloat32(p * u + l + 0, !0) , m = c.getFloat32(p * u + l + 4, !0) , v = c.getFloat32(p * u + l + 8, !0); h.set(f, m, v, 1), h.applyMatrix4(d), -.5 < h.x && h.x < .5 && -.5 < h.y && h.y < .5 && -.5 < h.z && h.z < .5 && i.expandByPoint(h) } } } catch (e) { a.e(e) } finally { a.f() } var g = i.getCenter(new Cn).applyMatrix4(e.matrixWorld) , y = new Si; y.position.copy(g), y.scale.copy(e.scale), y.rotation.copy(e.rotation); e = (new Cn).subVectors(i.max, i.min); y.scale.multiply(e); n = performance.now() - n; return console.log("duration: ", n), y } }, { key: "progress", get: function() { return this.visibleNodes.length / this.visibleGeometry.length } }, { key: "find", value: function(e) { var t, n = null, i = ue(e); try { for (i.s(); !(t = i.n()).done; ) var r = t.value , n = "r" === r ? this.root : n.children[r] } catch (e) { i.e(e) } finally { i.f() } return n } }, { key: "visible", get: function() { return this._visible }, set: function(e) { e !== this._visible && (this._visible = e, this.dispatchEvent({ type: "visibility_changed", pointcloud: this })) } }, { key: "changePointSize", value: function(e, t) { if (this.material.pointSizeType != am.ATTENUATED) return e && (this.material.size = e); var n; null == e ? e = this.temp.pointSize : this.temp.pointSize = e, e /= Potree.config.material.realPointSize / Potree.config.material.pointSize, e = 6 * Math.pow(e, 1.05), t || Potree.settings.sizeFitToLevel ? (n = this.temp.pointSize + ":" + this.maxLevel + ":" + this.nodeMaxLevel, (t = this.temp.sizeFitToLevel[n]) ? this.material.size = t : (t = this.material.spacing / Math.pow(2, this.maxLevel), t *= 0 < this.nodeMaxLevel ? Math.max(.1, Math.pow(this.maxLevel / this.nodeMaxLevel, 1.3)) : .1, this.material.size = 3 * t * e, this.temp.sizeFitToLevel[n] = this.material.size)) : this.material.size = .035 * e } }, { key: "changePointOpacity", value: function(e, t) { var n, i, r, a; null == e ? e = this.temp.pointOpacity : this.temp.pointOpacity = e, 1 == e ? this.material.opacity = 1 : (n = (Potree.settings.sizeFitToLevel ? "sizeFit:" : "") + (t ? "canMoreThanOne:" : "") + this.temp.pointOpacity + ":" + this.maxLevel + ":" + this.nodeMaxLevel, (i = this.temp.opacity[n]) ? this.material.opacity = i : (Potree.settings.sizeFitToLevel ? (r = this.material.spacing / Math.pow(1.4, this.maxLevel), a = this.material.spacing / Math.pow(1.4, this.nodeMaxLevel), a = Math.min(1 / r, 1 / a / 3), this.material.opacity = r * a * e) : (r = this.material.spacing / Math.pow(1.8, this.maxLevel), a = this.material.spacing / Math.pow(1.8, this.nodeMaxLevel), a = Math.min(1 / r, 1 / a / 6), this.material.opacity = r * a * e), t || (this.material.opacity = gn.clamp(this.material.opacity, 0, .999)), this.temp.opacity[n] = this.material.opacity)) } }, { key: "updateBound", value: function() { var e = this.pcoGeometry.tightBoundingBox.clone().applyMatrix4(this.matrixWorld); this.bound = e } }, { key: "getPanosBound", value: function() { var e; 0 < this.panos.length ? (e = new Cn(1,1,1), this.panosBound = Up.getBoundByPoints(this.panos.map(function(e) { return e.position }), e)) : this.panosBound = null } }, { key: "getUnrotBoundPoint", value: function(e) { var t = this , n = this.pcoGeometry.tightBoundingBox; return "all" == e ? [new Cn(n.min.x,n.min.y,n.min.z), new Cn(n.max.x,n.min.y,n.min.z), new Cn(n.max.x,n.max.y,n.min.z), new Cn(n.min.x,n.max.y,n.min.z), new Cn(n.min.x,n.min.y,n.max.z), new Cn(n.max.x,n.min.y,n.max.z), new Cn(n.max.x,n.max.y,n.max.z), new Cn(n.min.x,n.max.y,n.max.z)].map(function(e) { return e.applyMatrix4(t.matrixWorld) }) : [new Cn(n.min.x,n.min.y,0), new Cn(n.max.x,n.min.y,0), new Cn(n.max.x,n.max.y,0), new Cn(n.min.x,n.max.y,0)].map(function(e) { return e.applyMatrix4(t.matrixWorld) }) } }, { key: "ifContainsPoint", value: function(e) { if (this.bound && this.bound.containsPoint(e)) { var t = this.getUnrotBoundPoint(); return Up.isPointInArea(t, null, e) } } }, { key: "getVolume", value: function() { var e = this.getUnrotBoundPoint(); return Math.abs(Up.getArea(e)) * (this.bound.max.z - this.bound.min.z) } }]), u }() , Gm = function() { function e() { O(this, e), this.boundingBox = new kn, this.numPoints = 0, this.data = {} } return h(e, [{ key: "add", value: function(e) { var t, n = this.numPoints, i = n + e.numPoints, r = Object.keys(this.data), a = Object.keys(e.data), o = ue(new Set([].concat(Q(r), Q(a)))); try { for (o.s(); !(t = o.n()).done; ) { var s, l, u, c, d, h = t.value; r.includes(h) && a.includes(h) ? ((s = new this.data[h].constructor(this.data[h].length + e.data[h].length)).set(this.data[h], 0), s.set(e.data[h], this.data[h].length), this.data[h] = s) : r.includes(h) && !a.includes(h) ? (l = this.data[h].length / this.numPoints, (u = new this.data[h].constructor(l * i)).set(this.data[h], 0), this.data[h] = u) : !r.includes(h) && a.includes(h) && (c = e.data[h].length / e.numPoints, (d = new e.data[h].constructor(c * i)).set(e.data[h], c * n), this.data[h] = d) } } catch (e) { o.e(e) } finally { o.f() } this.numPoints = i, this.boundingBox.union(e.boundingBox) } }]), e }() , Hm = function() { y(a, cl); var r = w(a); function a(e, t) { O(this, a), void 0 === t && (t = 16776960); var n = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]) , i = new Float32Array([e.min.x, e.min.y, e.min.z, e.max.x, e.min.y, e.min.z, e.max.x, e.min.y, e.max.z, e.min.x, e.min.y, e.max.z, e.min.x, e.max.y, e.min.z, e.max.x, e.max.y, e.min.z, e.max.x, e.max.y, e.max.z, e.min.x, e.max.y, e.max.z]) , e = new Mr; e.setIndex(new nr(n,1)), e.setAttribute("position", new nr(i,3)); t = new tl({ color: t }); return r.call(this, e, t) } return h(a) }(); function Vm(e, t, n) { for (var i = [], r = [], a = new BinaryHeap(function(e) { return 1 / e.weight } ), o = 0; o < e.length; o++) { var s = e[o]; if (s.initialized()) { s.numVisibleNodes = 0, s.numVisiblePoints = 0, s.deepestVisibleLevel = 0, s.visibleNodes = [], s.visibleGeometry = [], t.updateMatrixWorld(); var l = new oa , u = t.matrixWorldInverse , c = s.matrixWorld , d = t.clone(); d.near = Math.min(t.near, .1), d.updateProjectionMatrix(); d = t.projectionMatrix, u = (new ni).multiply(d).multiply(u).multiply(c); l.setFromProjectionMatrix(u), i.push(l); l = t.matrixWorld, c = c.clone().invert(), l = (new ni).multiply(c).multiply(l), l = (new Cn).setFromMatrixPosition(l); r.push(l), (s.visible || s.unvisibleReasons && 1 == s.unvisibleReasons.length && "displayMode" == s.unvisibleReasons[0].reason && null !== s.root) && a.push({ pointcloud: o, node: s.root, weight: Number.MAX_VALUE }), s.root.isTreeNode() && s.hideDescendants(s.root.sceneNode); for (var h = 0; h < s.boundingBoxNodes.length; h++) s.boundingBoxNodes[h].visible = !1 } } return { frustums: i, camObjPositions: r, priorityQueue: a } } function jm(r, e, t) { var n = 0 , i = new Map(r.map(function(e) { return [e, 0] })) , a = [] , o = [] , s = [] , l = 1 / 0 , u = Vm(r, e) , c = u.frustums , d = u.camObjPositions , h = u.priorityQueue , p = 0 , f = (t.x, t.y); Potree._pointcloudTransformVersion || (Potree._pointcloudTransformVersion = new Map); var m, v = Potree._pointcloudTransformVersion, g = ue(r); try { for (g.s(); !(m = g.n()).done; ) { var y, w = m.value; viewer.getObjVisiByReason(w, "datasetSelection") && (w.updateMatrixWorld(), v.has(w) ? (y = v.get(w)).transform.equals(w.matrixWorld) || (y.number++, y.transform.copy(w.matrixWorld), w.dispatchEvent({ type: "transformation_changed", target: w })) : v.set(w, { number: 0, transform: w.matrixWorld.clone() })) } } catch (e) { g.e(e) } finally { g.f() } for (; 0 < h.size(); ) { var b = h.pop() , x = b.node , E = b.parent , _ = r[b.pointcloud] , M = x.getBoundingBox() , A = c[b.pointcloud] , T = d[b.pointcloud] , S = A.intersectsBox(M) , C = null == _.maxLevel ? 1 / 0 : _.maxLevel , A = x.getLevel() , S = S; S = (S = (S = S && !(n + x.getNumPoints() > Potree.pointBudget)) && !(i.get(_) + x.getNumPoints() > _.pointBudget)) && A <= C; C = _.material.clipBoxes; if (0 < C.length) { var P, D = 0, k = 0, B = ue(C); try { for (B.s(); !(P = B.n()).done; ) { var L = P.value , R = _.matrixWorld.clone().invert() , F = (R.multiply(L.box.matrixWorld), new Cn(.5,0,0).applyMatrix4(R)) , I = new Cn(-.5,0,0).applyMatrix4(R) , O = new Cn(0,.5,0).applyMatrix4(R) , z = new Cn(0,-.5,0).applyMatrix4(R) , N = new Cn(0,0,.5).applyMatrix4(R) , U = new Cn(0,0,-.5).applyMatrix4(R) , G = (new Cn).subVectors(I, F).normalize() , H = G.clone().multiplyScalar(-1) , V = (new Cn).subVectors(z, O).normalize() , j = V.clone().multiplyScalar(-1) , W = (new Cn).subVectors(U, N).normalize() , X = W.clone().multiplyScalar(-1) , q = (new ki).setFromNormalAndCoplanarPoint(G, F) , J = (new ki).setFromNormalAndCoplanarPoint(H, I) , Y = (new ki).setFromNormalAndCoplanarPoint(V, O) , Z = (new ki).setFromNormalAndCoplanarPoint(j, z) , Q = (new ki).setFromNormalAndCoplanarPoint(W, N) , K = (new ki).setFromNormalAndCoplanarPoint(X, U); new oa(q,J,Y,Z,Q,K).intersectsBox(M) && D++, k++ } } catch (e) { B.e(e) } finally { B.f() } _.material.clipTask === tm.SHOW_INSIDE ? _.material.clipMethod === nm.INSIDE_ANY && 0 < D || _.material.clipMethod === nm.INSIDE_ALL && D === k || (S = !1) : (_.material.clipTask, tm.SHOW_OUTSIDE) } if (x.spacing ? l = Math.min(l, x.spacing) : x.geometryNode && x.geometryNode.spacing && (l = Math.min(l, x.geometryNode.spacing)), n + x.getNumPoints() > Potree.pointBudget) break; if (S) { n += x.getNumPoints(); S = i.get(_); i.set(_, S + x.getNumPoints()), _.numVisibleNodes++, _.numVisiblePoints += x.getNumPoints(), !x.isGeometryNode() || E && !E.isTreeNode() || (x.isLoaded() && p < 2 ? (x = _.toTreeNode(x, E), p++) : (s.push({ pointcloud: _, node: x }), o.push(x))), x.isTreeNode() && (le.lru.touch(x.geometryNode), x.sceneNode.visible = !0, x.sceneNode.material = _.material, a.push(x), _.visibleNodes.push(x), void 0 === x._transformVersion && (x._transformVersion = -1), E = v.get(_), x._transformVersion !== E.number && (x.sceneNode.updateMatrix(), x.sceneNode.matrixWorld.multiplyMatrices(_.matrixWorld, x.sceneNode.matrix), x._transformVersion = E.number), _.showBoundingBox && !x.boundingBoxNode && x.getBoundingBox ? ((E = new Hm(x.getBoundingBox())).matrixAutoUpdate = !1, _.boundingBoxNodes.push(E), x.boundingBoxNode = E, x.boundingBoxNode.matrix.copy(_.matrixWorld)) : _.showBoundingBox ? (x.boundingBoxNode.visible = !0, x.boundingBoxNode.matrix.copy(_.matrixWorld)) : !_.showBoundingBox && x.boundingBoxNode && (x.boundingBoxNode.visible = !1)); for (var $ = x.getChildren(), ee = 0; ee < $.length; ee++) { var te = $[ee] , ne = 0; if (e.isPerspectiveCamera) { var ie = te.getBoundingSphere() , re = ie.center , ae = T.x - re.x , oe = T.y - re.y , re = T.z - re.z , oe = Math.sqrt(ae * ae + oe * oe + re * re) , re = ie.radius , ie = e.fov * Math.PI / 180 , ie = re * (.5 * f / (Math.tan(ie / 2) * oe)); if (ie < _.minimumNodePixelSize) continue; ne = ie, oe - re < 0 && (ne = Number.MAX_VALUE) } else re = te.getBoundingBox(), ne = (te.getBoundingSphere().center.distanceTo(T), re.max.clone().sub(re.min).length()); h.push({ pointcloud: b.pointcloud, node: te, parent: x, weight: ne }) } } } !function() { var e, t = ue(r.filter(function(e) { return e.generateDEM && e.dem instanceof Potree.DEM })); try { for (t.s(); !(e = t.n()).done; ) { var n = e.value , i = n.visibleNodes.filter(function(e) { return e.getLevel() <= 4 }); n.dem.update(i) } } catch (e) { t.e(e) } finally { t.f() } }(); for (var se = 0; se < Math.min(Potree.maxNodesLoading, s.length); se++) s[se].node.load(s[se].pointcloud.pcoGeometry); return { visibleNodes: a, numVisiblePoints: n, lowestSpacing: l } } function Wm(e, t) { var n; if (t === ke) return e.REPEAT; if (t === Be) return e.CLAMP_TO_EDGE; if (t === Le) return e.MIRRORED_REPEAT; if (t === Re) return e.NEAREST; if (1004 === t) return e.NEAREST_MIPMAP_NEAREST; if (1005 === t) return e.NEAREST_MIPMAP_LINEAR; if (t === Oe) return e.LINEAR; if (1007 === t) return e.LINEAR_MIPMAP_NEAREST; if (t === G) return e.LINEAR_MIPMAP_LINEAR; if (t === Ue) return e.UNSIGNED_BYTE; if (t === Je) return e.UNSIGNED_SHORT_4_4_4_4; if (t === Ye) return e.UNSIGNED_SHORT_5_5_5_1; if (t === Ze) return e.UNSIGNED_SHORT_5_6_5; if (t === Ge) return e.BYTE; if (t === He) return e.SHORT; if (t === Ve) return e.UNSIGNED_SHORT; if (t === je) return e.INT; if (t === We) return e.UNSIGNED_INT; if (t === Xe) return e.FLOAT; if (t === qe && null !== (n = extensions.get("OES_texture_half_float"))) return n.HALF_FLOAT_OES; if (t === Ke) return e.ALPHA; if (t === $e) return e.RGB; if (t === et) return e.RGBA; if (t === tt) return e.LUMINANCE; if (t === nt) return e.LUMINANCE_ALPHA; if (t === rt) return e.DEPTH_COMPONENT; if (t === at) return e.DEPTH_STENCIL; if (t === re) return e.FUNC_ADD; if (t === ae) return e.FUNC_SUBTRACT; if (t === oe) return e.FUNC_REVERSE_SUBTRACT; if (t === de) return e.ZERO; if (t === he) return e.ONE; if (t === pe) return e.SRC_COLOR; if (t === fe) return e.ONE_MINUS_SRC_COLOR; if (t === me) return e.SRC_ALPHA; if (t === ve) return e.ONE_MINUS_SRC_ALPHA; if (t === ge) return e.DST_ALPHA; if (t === ye) return e.ONE_MINUS_DST_ALPHA; if (t === we) return e.DST_COLOR; if (t === be) return e.ONE_MINUS_DST_COLOR; if (t === xe) return e.SRC_ALPHA_SATURATE; if ((t === ht || t === RGBA_S3TC_DXT1_Format || t === ft || t === RGBA_S3TC_DXT5_Format) && null !== (n = extensions.get("WEBGL_compressed_texture_s3tc"))) { if (t === ht) return n.COMPRESSED_RGB_S3TC_DXT1_EXT; if (t === pt) return n.COMPRESSED_RGBA_S3TC_DXT1_EXT; if (t === ft) return n.COMPRESSED_RGBA_S3TC_DXT3_EXT; if (t === mt) return n.COMPRESSED_RGBA_S3TC_DXT5_EXT } if ((t === vt || t === gt || t === yt || t === wt) && null !== (n = extensions.get("WEBGL_compressed_texture_pvrtc"))) { if (t === vt) return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; if (t === gt) return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; if (t === yt) return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; if (t === wt) return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG } if (t === bt && null !== (n = extensions.get("WEBGL_compressed_texture_etc1"))) return n.COMPRESSED_RGB_ETC1_WEBGL; if ((t === se || t === ce) && null !== (n = extensions.get("EXT_blend_minmax"))) { if (t === se) return n.MIN_EXT; if (t === ce) return n.MAX_EXT } return t === UnsignedInt248Type && null !== (n = extensions.get("WEBGL_depth_texture")) ? n.UNSIGNED_INT_24_8_WEBGL : 0 } var Xm = { position: { name: "position", location: 0 }, color: { name: "color", location: 1 }, rgba: { name: "color", location: 1 }, intensity: { name: "intensity", location: 2 }, classification: { name: "classification", location: 3 }, returnNumber: { name: "returnNumber", location: 4 }, "return number": { name: "returnNumber", location: 4 }, returns: { name: "returnNumber", location: 4 }, numberOfReturns: { name: "numberOfReturns", location: 5 }, "number of returns": { name: "numberOfReturns", location: 5 }, pointSourceID: { name: "pointSourceID", location: 6 }, "source id": { name: "pointSourceID", location: 6 }, "point source id": { name: "pointSourceID", location: 6 }, indices: { name: "indices", location: 7 }, normal: { name: "normal", location: 8 }, spacing: { name: "spacing", location: 9 }, "gps-time": { name: "gpsTime", location: 10 }, aExtra: { name: "aExtra", location: 11 } } , qm = function() { function r(e, t, n, i) { O(this, r), this.gl = e, this.name = t, this.vsSource = n, this.fsSource = i, this.cache = new Map, this.vs = null, this.fs = null, this.program = null, this.uniformLocations = {}, this.attributeLocations = {}, this.uniformBlockIndices = {}, this.uniformBlocks = {}, this.uniforms = {}, this.update(n, i) } return h(r, [{ key: "update", value: function(e, t) { this.vsSource = e, this.fsSource = t, this.linkProgram() } }, { key: "compileShader", value: function(e, t) { var n = this.gl; if (n.shaderSource(e, t), n.compileShader(e), !n.getShaderParameter(e, n.COMPILE_STATUS)) { e = n.getShaderInfoLog(e), t = t.split("\n").map(function(e, t) { return "".concat(t + 1).padEnd(5) + e }).join("\n"); throw "could not compile shader ".concat(this.name, ": ").concat(e, ", \n").concat(t) } } }, { key: "linkProgram", value: function() { performance.now(); var e = this.gl; this.uniformLocations = {}, this.attributeLocations = {}, this.uniforms = {}, e.useProgram(null); var t = this.cache.get("".concat(this.vsSource, ", ").concat(this.fsSource)); if (t) return this.program = t.program, this.vs = t.vs, this.fs = t.fs, this.attributeLocations = t.attributeLocations, this.uniformLocations = t.uniformLocations, this.uniformBlocks = t.uniformBlocks, void (this.uniforms = t.uniforms); if (this.vs = e.createShader(e.VERTEX_SHADER), this.fs = e.createShader(e.FRAGMENT_SHADER), this.program = e.createProgram(), !e.isProgram(this.program)) return viewer.dispatchEvent("webglError", { msg: "potreeRenderer创建program失败" }), console.log(this.vs), void console.log(this.fs); for (var n = 0, i = Object.keys(Xm); n < i.length; n++) { var r = i[n] , a = Xm[r].location , r = Xm[r].name; e.bindAttribLocation(this.program, a, r) } this.compileShader(this.vs, this.vsSource), this.compileShader(this.fs, this.fsSource); var o = this.program; if (e.attachShader(o, this.vs), e.attachShader(o, this.fs), e.linkProgram(o), e.detachShader(o, this.vs), e.detachShader(o, this.fs), !e.getProgramParameter(o, e.LINK_STATUS)) { var s = e.getProgramInfoLog(o); throw "could not link program ".concat(this.name, ": ").concat(s) } for (var l = e.getProgramParameter(o, e.ACTIVE_ATTRIBUTES), u = 0; u < l; u++) { var c = e.getActiveAttrib(o, u) , d = e.getAttribLocation(o, c.name); this.attributeLocations[c.name] = d } for (var h = e.getProgramParameter(o, e.ACTIVE_UNIFORMS), p = 0; p < h; p++) { var f = e.getActiveUniform(o, p) , m = e.getUniformLocation(o, f.name); this.uniformLocations[f.name] = m, this.uniforms[f.name] = { location: m, value: null } } if ("undefined" != typeof WebGL2RenderingContext && e instanceof WebGL2RenderingContext) for (var v = e.getProgramParameter(o, e.ACTIVE_UNIFORM_BLOCKS), g = 0; g < v; g++) { var y = e.getActiveUniformBlockName(o, g) , w = e.getUniformBlockIndex(o, y); this.uniformBlockIndices[y] = w, e.uniformBlockBinding(o, w, w); var b = e.getActiveUniformBlockParameter(o, w, e.UNIFORM_BLOCK_DATA_SIZE) , x = e.createBuffer(); e.bindBuffer(e.UNIFORM_BUFFER, x), e.bufferData(e.UNIFORM_BUFFER, b, e.DYNAMIC_READ), e.bindBufferBase(e.UNIFORM_BUFFER, w, x), e.bindBuffer(e.UNIFORM_BUFFER, null), this.uniformBlocks[y] = { name: y, index: w, dataSize: b, buffer: x } } s = { program: this.program, vs: this.vs, fs: this.fs, attributeLocations: this.attributeLocations, uniformLocations: this.uniformLocations, uniforms: this.uniforms, uniformBlocks: this.uniformBlocks }; this.cache.set("".concat(this.vsSource, ", ").concat(this.fsSource), s); performance.now() } }, { key: "setUniformMatrix4", value: function(e, t) { var n = this.gl , e = this.uniformLocations[e]; null != e && (t = new Float32Array(t.elements), n.uniformMatrix4fv(e, !1, t)) } }, { key: "setUniform1f", value: function(e, t) { var n = this.gl , e = this.uniforms[e]; void 0 !== e && e.value !== t && (e.value = t, n.uniform1f(e.location, t)) } }, { key: "setUniformBoolean", value: function(e, t) { var n = this.gl , e = this.uniforms[e]; void 0 !== e && e.value !== t && (e.value = t, n.uniform1i(e.location, t)) } }, { key: "setUniformTexture", value: function(e, t) { var n = this.gl , e = this.uniformLocations[e]; null != e && n.uniform1i(e, t) } }, { key: "setUniform2f", value: function(e, t) { var n = this.gl , e = this.uniformLocations[e]; null != e && n.uniform2f(e, t[0], t[1]) } }, { key: "setUniform3f", value: function(e, t) { var n = this.gl , e = this.uniformLocations[e]; null != e && n.uniform3f(e, t[0], t[1], t[2]) } }, { key: "setUniform", value: function(e, t) { t.constructor === ni ? this.setUniformMatrix4(e, t) : "number" == typeof t ? this.setUniform1f(e, t) : "boolean" == typeof t ? this.setUniformBoolean(e, t) : t instanceof Jm ? this.setUniformTexture(e, t) : t instanceof Array ? 2 === t.length ? this.setUniform2f(e, t) : 3 === t.length && this.setUniform3f(e, t) : console.error("unhandled uniform type: ", e, t) } }, { key: "setUniform1i", value: function(e, t) { var n = this.gl , e = this.uniformLocations[e]; null != e && n.uniform1i(e, t) } }]), r }() , Jm = function() { function n(e, t) { O(this, n), this.gl = e, this.texture = t, this.id = e.createTexture(), this.target = e.TEXTURE_2D, this.version = -1, this.update(t) } return h(n, [{ key: "update", value: function() { var e, t, n, i, r, a, o, s; this.texture.image ? (e = this.gl, t = this.texture, this.version !== t.version && (this.target = e.TEXTURE_2D, e.bindTexture(this.target, this.id), n = Wm(e, t.format), i = t.image.width, r = t.image.height, a = n, o = Wm(e, t.type), e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, t.flipY), e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, t.premultiplyAlpha), e.pixelStorei(e.UNPACK_ALIGNMENT, t.unpackAlignment), t instanceof ia ? (s = t.image.data, e.texParameteri(this.target, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(this.target, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texParameteri(this.target, e.TEXTURE_MAG_FILTER, Wm(e, t.magFilter)), e.texParameteri(this.target, e.TEXTURE_MIN_FILTER, Wm(e, t.minFilter)), e.texImage2D(this.target, 0, n, i, r, 0, a, o, s)) : (t instanceof xl || t instanceof En) && (s = t.image, e.texParameteri(this.target, e.TEXTURE_WRAP_S, Wm(e, t.wrapS)), e.texParameteri(this.target, e.TEXTURE_WRAP_T, Wm(e, t.wrapT)), e.texParameteri(this.target, e.TEXTURE_MAG_FILTER, Wm(e, t.magFilter)), e.texParameteri(this.target, e.TEXTURE_MIN_FILTER, Wm(e, t.minFilter)), e.texImage2D(this.target, 0, n, n, o, s), t instanceof En && e.generateMipmap(e.TEXTURE_2D)), e.bindTexture(this.target, null), this.version = t.version)) : this.version = this.texture.version } }]), n }() , Ym = h(function e() { O(this, e), this.numElements = 0, this.vao = null, this.vbos = new Map }) , Zm = function() { function t(e) { O(this, t), this.threeRenderer = e, this.gl = this.threeRenderer.getContext(), this.buffers = new Map, this.shaders = new Map, this.textures = new Map, this.glTypeMapping = new Map, this.glTypeMapping.set(Float32Array, this.gl.FLOAT), this.glTypeMapping.set(Uint8Array, this.gl.UNSIGNED_BYTE), this.glTypeMapping.set(Uint16Array, this.gl.UNSIGNED_SHORT), this.toggle = 0 } return h(t, [{ key: "deleteBuffer", value: function(e) { var t = this.gl , n = this.buffers.get(e); if (null != n) { for (var i in e.attributes) t.deleteBuffer(n.vbos.get(i).handle); this.buffers.delete(e) } } }, { key: "createBuffer", value: function(n) { var e, i = this, t = this.gl, r = new Ym; for (e in r.vao = t.createVertexArray(), r.numElements = n.attributes.position.count, t.bindVertexArray(r.vao), n.attributes) { var a = n.attributes[e] , o = t.createBuffer(); t.bindBuffer(t.ARRAY_BUFFER, o), t.bufferData(t.ARRAY_BUFFER, a.array, t.STATIC_DRAW); var s, l = a.normalized, u = this.glTypeMapping.get(a.array.constructor); void 0 === Xm[e] || (s = Xm[e].location, t.vertexAttribPointer(s, a.itemSize, u, l, 0, 0), t.enableVertexAttribArray(s)), r.vbos.set(e, { handle: o, name: e, count: a.count, itemSize: a.itemSize, type: n.attributes.position.array.constructor, version: 0 }) } return t.bindBuffer(t.ARRAY_BUFFER, null), t.bindVertexArray(null), n.addEventListener("dispose", function e(t) { i.deleteBuffer(n), n.removeEventListener("dispose", e) }), r } }, { key: "updateBuffer", value: function(e) { var t, n = this.gl, i = this.buffers.get(e); for (t in n.bindVertexArray(i.vao), e.attributes) { var r = e.attributes[t] , a = r.normalized , o = this.glTypeMapping.get(r.array.constructor) , s = null; i.vbos.has(t) ? (s = i.vbos.get(t).handle, i.vbos.get(t).version = r.version) : (s = n.createBuffer(), i.vbos.set(t, { handle: s, name: t, count: r.count, itemSize: r.itemSize, type: e.attributes.position.array.constructor, version: r.version })), n.bindBuffer(n.ARRAY_BUFFER, s), n.bufferData(n.ARRAY_BUFFER, r.array, n.STATIC_DRAW), void 0 === Xm[t] || (s = Xm[t].location, n.vertexAttribPointer(s, r.itemSize, o, a, 0, 0), n.enableVertexAttribArray(s)) } n.bindBuffer(n.ARRAY_BUFFER, null), n.bindVertexArray(null) } }, { key: "traverse", value: function(e) { for (var t = [], n = [e]; 0 < n.length; ) { var i = n.pop(); i instanceof xm ? t.push(i) : (i = i.children.filter(function(e) { return e.visible }), n.push.apply(n, Q(i))) } return { octrees: t } } }, { key: "renderNodes", value: function(N, e, U, t, n, G, i) { var H = this; le.measureTimings && performance.mark("renderNodes-start"); var V = this.gl , j = i.material || N.material , W = null == i.shadowMaps ? [] : i.shadowMaps , X = t.matrixWorldInverse; i.viewOverride && (X = i.viewOverride); var q, J = new ni, Y = new Float32Array(16), Z = 0, r = ue(e); try { for (r.s(); !(q = r.n()).done; ) (function() { var e = q.value; if (void 0 !== le.debug.allowedNodes && !le.debug.allowedNodes.includes(e.name)) return; var t = e.sceneNode.matrixWorld; J.multiplyMatrices(X, t), U && (r = U.offsets.get(e), G.setUniform1f("uVNStart", r)); var n = e.getLevel(); e.debug ? G.setUniform("uDebug", !0) : G.setUniform("uDebug", !1); var i = G.uniformLocations.modelMatrix; i && (Y.set(t.elements), V.uniformMatrix4fv(i, !1, Y)); for (var r = G.uniformLocations.modelViewMatrix, a = 0; a < 16; a++) Y[a] = J.elements[a]; if (V.uniformMatrix4fv(r, !1, Y), j.clipPolygons && 0 < j.clipPolygons.length) { var o, s = [], l = [], u = ue(j.clipPolygons); try { for (u.s(); !(o = u.n()).done; ) { var c = o.value , d = c.viewMatrix , h = c.projMatrix.clone().multiply(d).multiply(t); s.push(c.markers.length), l.push(h) } } catch (e) { u.e(e) } finally { u.f() } for (var r = (i = []).concat.apply(i, Q(l.map(function(e) { return e.elements }))), p = new Array(24 * j.clipPolygons.length), f = 0; f < j.clipPolygons.length; f++) for (var m = j.clipPolygons[f], v = 0; v < m.markers.length; v++) p[24 * f + (3 * v + 0)] = m.markers[v].position.x, p[24 * f + (3 * v + 1)] = m.markers[v].position.y, p[24 * f + (3 * v + 2)] = m.markers[v].position.z; i = G.uniformLocations["uClipPolygonVCount[0]"]; V.uniform1iv(i, s); i = G.uniformLocations["uClipPolygonWVP[0]"]; V.uniformMatrix4fv(i, !1, r); r = G.uniformLocations["uClipPolygonVertices[0]"]; V.uniform3fv(r, p) } if (G.setUniform1f("uLevel", n), G.setUniform1f("uNodeSpacing", e.geometryNode.estimatedSpacing), G.setUniform1f("uPCIndex", Z), 0 < W.length) { var g = G.uniformLocations["uShadowMap[0]"]; G.setUniform3f("uShadowColor", j.uniforms.uShadowColor.value); var y = new Array(W.length).fill(5).map(function(e, t) { return e + t }); V.uniform1iv(g, y); for (var w = 0; w < W.length; w++) { var b = W[w] , x = y[w] , b = H.threeRenderer.properties.get(b.target.texture).__webglTexture; V.activeTexture(V["TEXTURE".concat(x)]), V.bindTexture(V.TEXTURE_2D, b) } var n = W.map(function(e) { return e.camera.matrixWorldInverse }).map(function(e) { return (new ni).multiplyMatrices(e, t) }) , g = (g = []).concat.apply(g, Q(n.map(function(e) { return e.elements }))) , n = G.uniformLocations["uShadowWorldView[0]"]; V.uniformMatrix4fv(n, !1, g); g = (n = []).concat.apply(n, Q(W.map(function(e) { return e.camera.projectionMatrix.elements }))), n = G.uniformLocations["uShadowProj[0]"]; V.uniformMatrix4fv(n, !1, g) } var E = e.geometryNode.geometry; E.attributes["gps-time"] && (E.attributes["gps-time"], g = (A = (e = (g = N.getAttribute("gps-time")).initialRange)[1] - e[0]) / (M = (_ = g.range)[1] - _[0]), A = -(_[0] - e[0]) / A, g = Number.isNaN(g) ? 1 : g, A = Number.isNaN(A) ? 0 : A, G.setUniform1f("uGpsScale", g), G.setUniform1f("uGpsOffset", A), A = [((A = j.uniforms.uFilterGPSTimeClipRange.value)[0] - _[0]) / M, (A[1] - _[0]) / M], G.setUniform2f("uFilterGPSTimeClipRange", A)); var _ = j.uniforms.uFilterReturnNumberRange.value , M = j.uniforms.uFilterNumberOfReturnsRange.value , A = j.uniforms.uFilterPointSourceIDClipRange.value; G.setUniform2f("uFilterReturnNumberRange", _), G.setUniform2f("uFilterNumberOfReturnsRange", M), G.setUniform2f("uFilterPointSourceIDClipRange", A); var T = null; if (H.buffers.has(E)) for (var S in T = H.buffers.get(E), E.attributes) E.attributes[S].version > T.vbos.get(S).version && H.updateBuffer(E); else T = H.createBuffer(E), H.buffers.set(E, T); if (V.bindVertexArray(T.vao), void 0 === Xm[j.activeAttributeName] && Object.keys(E.attributes).includes(j.activeAttributeName)) { var C, P = Xm.aExtra.location; for (C in E.attributes) { E.attributes[C]; var D = T.vbos.get(C); V.bindBuffer(V.ARRAY_BUFFER, D.handle), V.disableVertexAttribArray(P) } var k = j.activeAttributeName , M = E.attributes[k] , A = T.vbos.get(k); void 0 !== M && void 0 !== A && (B = H.glTypeMapping.get(M.array.constructor), L = M.normalized, V.bindBuffer(V.ARRAY_BUFFER, A.handle), V.vertexAttribPointer(P, M.itemSize, B, L, 0, 0), V.enableVertexAttribArray(P)); var A = N.pcoGeometry.pointAttributes.attributes.find(function(e) { return e.name === k }) , M = (M = j.getRange(k)) || A.range , B = A.initialRange , L = B[1] - B[0] , A = M = M || [0, 1] , M = L / (A[1] - A[0]) , L = -(A[0] - B[0]) / L , M = Number.isNaN(M) ? 1 : M , L = Number.isNaN(L) ? 0 : L; G.setUniform1f("uExtraScale", M), G.setUniform1f("uExtraOffset", L) } else for (var R in E.attributes) { var F, I, O = E.attributes[R], z = T.vbos.get(R); void 0 !== Xm[R] && (F = Xm[R].location, I = H.glTypeMapping.get(O.array.constructor), R = O.normalized, V.bindBuffer(V.ARRAY_BUFFER, z.handle), V.vertexAttribPointer(F, O.itemSize, I, R, 0, 0), V.enableVertexAttribArray(F)) } L = T.numElements; V.drawArrays(V.POINTS, 0, L), Z++ } )() } catch (e) { r.e(e) } finally { r.f() } V.bindVertexArray(null), le.measureTimings && (performance.mark("renderNodes-end"), performance.measure("render.renderNodes", "renderNodes-start", "renderNodes-end")) } }, { key: "renderOctree", value: function(e, t, n, i) { var r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : {} , a = this.gl , o = r.material || e.material , s = null == r.shadowMaps ? [] : r.shadowMaps , l = n.matrixWorldInverse , u = n.matrixWorld; r.viewOverride && (u = (l = r.viewOverride).clone().invert()); var c = n.projectionMatrix , d = c.clone().invert() , h = null , p = null , f = 0; 0 <= o.pointSizeType && (o.pointSizeType !== am.ADAPTIVE && "level of detail" !== o.activeAttributeName || (g = null != r.vnTextureNodes ? r.vnTextureNodes : t, p = e.computeVisibilityTextureData(g, n), (y = o.visibleNodesTexture).image.data.set(p.data), y.needsUpdate = !0)), this.shaders.has(o) || (w = [o.vertexShader, o.fragmentShader], b = new qm(a,"pointcloud",w[0],w[1]), this.shaders.set(o, b)); var h = this.shaders.get(o) , m = [o.vertexShader, o.fragmentShader] , v = m[0] , g = m[1] , y = o.snapEnabled ? o.numSnapshots : 0 , w = o.clipBoxes && o.clipBoxes.length ? o.clipBoxes.length : 0 , b = r.clipSpheres && r.clipSpheres.length ? r.clipSpheres.length : 0 , m = o.clipPolygons && o.clipPolygons.length ? o.clipPolygons.length : 0 , b = ["#define num_shadowmaps ".concat(s.length), "#define num_snapshots ".concat(y), "#define num_clipboxes ".concat(w), "#define num_clipspheres ".concat(b), "#define num_clippolygons ".concat(m)]; o.usePanoMap && b.push("#define usePanoMap"), o.useFilterByNormal && b.push("#define use_filter_by_normal"), e.pcoGeometry.root.isLoaded() && ((x = e.pcoGeometry.root.geometry.attributes)["gps-time"] && b.push("#define clip_gps_enabled"), x["return number"] && b.push("#define clip_return_number_enabled"), x["number of returns"] && b.push("#define clip_number_of_returns_enabled"), (x["source id"] || x["point source id"]) && b.push("#define clip_point_source_id_enabled")); var m = b.join("\n") , x = v.indexOf("#version ") , b = g.indexOf("#version ") , v = 0 <= x ? v.replace(/(#version .*)/, "$1\n".concat(m)) : "".concat(m, "\n").concat(v) , g = 0 <= b ? g.replace(/(#version .*)/, "$1\n".concat(m)) : "".concat(m, "\n").concat(g); h.update(v, g), o.needsUpdate = !1; for (var E = 0, _ = Object.keys(o.uniforms); E < _.length; E++) { var M = _[E] , A = o.uniforms[M]; "t" != A.type || (A = A.value) && "pano0Map" != M && "pano1Map" != M && (this.textures.has(A) || (M = new Jm(a,A), this.textures.set(A, M)), this.textures.get(A).update()) } a.useProgram(h.program); if ((void 0 !== r.transparent ? r.transparent && o.opacity < 1 : !o.usePanoMap && (o.useFilterByNormal || o.opacity < 1)) ? (a.enable(a.BLEND), a.blendFunc(a.SRC_ALPHA, a.ONE), a.depthMask(!1), a.disable(a.DEPTH_TEST)) : (a.disable(a.BLEND), a.depthMask(!0), a.enable(a.DEPTH_TEST)), void 0 !== r.blendFunc && (a.enable(a.BLEND), a.blendFunc.apply(a, Q(r.blendFunc))), void 0 !== r.depthTest && (!0 === r.depthTest ? a.enable(a.DEPTH_TEST) : a.disable(a.DEPTH_TEST)), void 0 !== r.depthWrite && (!0 === r.depthWrite ? a.depthMask(!0) : a.depthMask(!1)), h.setUniformMatrix4("projectionMatrix", c), h.setUniformMatrix4("viewMatrix", l), h.setUniformMatrix4("uViewInv", u), h.setUniformMatrix4("uProjInv", d), h.setUniform2f("resolution", o.resolution.toArray()), h.setUniform1f("fov", Math.PI * n.fov / 180), h.setUniform1f("near", n.near), h.setUniform1f("far", n.far), n instanceof ed ? (h.setUniform("uUseOrthographicCamera", !0), h.setUniform("uOrthoWidth", n.right - n.left), h.setUniform("uOrthoHeight", n.top - n.bottom)) : h.setUniform("uUseOrthographicCamera", !1), o.clipBoxes.length + o.clipPolygons.length === 0 ? h.setUniform1i("clipTask", tm.NONE) : h.setUniform1i("clipTask", o.clipTask), h.setUniform1i("clipMethod", o.clipMethod), o.clipBoxes && 0 < o.clipBoxes.length && (d = h.uniformLocations["clipBoxes[0]"], a.uniformMatrix4fv(d, !1, o.uniforms.clipBoxes.value)), r.clipSpheres && 0 < r.clipSpheres.length) { var T, S = [], C = ue(r.clipSpheres); try { for (C.s(); !(T = C.n()).done; ) { var P = T.value.matrixWorld , D = n.matrixWorld , k = P.clone().invert() , B = (new ni).multiplyMatrices(k, D); S.push(B) } } catch (e) { C.e(e) } finally { C.f() } var L = (R = []).concat.apply(R, Q(S.map(function(e) { return e.elements }))) , R = h.uniformLocations["uClipSpheres[0]"]; a.uniformMatrix4fv(R, !1, L) } h.setUniform1f("size", o.usePanoMap ? Potree.config.material.absolutePanoramaSize * Math.min(window.devicePixelRatio, 2) : o.size), h.setUniform1f("maxSize", o.uniforms.maxSize.value), h.setUniform1f("minSize", o.uniforms.minSize.value), h.setUniform1f("uOctreeSpacing", o.spacing), h.setUniform("uOctreeSize", o.uniforms.octreeSize.value), h.setUniform3f("uColor", o.color.toArray()), h.setUniform1f("uOpacity", o.usePanoMap ? 1 : o.opacity), h.setUniform2f("elevationRange", o.elevationRange), h.setUniform2f("intensityRange", o.intensityRange), h.setUniform3f("uIntensity_gbc", [o.intensityGamma, o.intensityBrightness, o.intensityContrast]), h.setUniform3f("uRGB_gbc", [o.rgbGamma, o.rgbBrightness, o.rgbContrast]), h.setUniform1f("uTransition", o.transition), h.setUniform1f("wRGB", o.weightRGB), h.setUniform1f("wIntensity", o.weightIntensity), h.setUniform1f("wElevation", o.weightElevation), h.setUniform1f("wClassification", o.weightClassification), h.setUniform1f("wReturnNumber", o.weightReturnNumber), h.setUniform1f("wSourceID", o.weightSourceID), h.setUniform("backfaceCulling", o.uniforms.backfaceCulling.value); R = this.textures.get(o.visibleNodesTexture); R && (h.setUniform1i("visibleNodesTexture", f), a.activeTexture(a.TEXTURE0 + f), a.bindTexture(R.target, R.id), f++); L = this.textures.get(o.gradientTexture); h.setUniform1i("gradient", f), a.activeTexture(a.TEXTURE0 + f), a.bindTexture(L.target, L.id); R = o.elevationGradientRepeat; R === im.REPEAT ? (a.texParameteri(L.target, a.TEXTURE_WRAP_S, a.REPEAT), a.texParameteri(L.target, a.TEXTURE_WRAP_T, a.REPEAT)) : R === im.MIRRORED_REPEAT ? (a.texParameteri(L.target, a.TEXTURE_WRAP_S, a.MIRRORED_REPEAT), a.texParameteri(L.target, a.TEXTURE_WRAP_T, a.MIRRORED_REPEAT)) : (a.texParameteri(L.target, a.TEXTURE_WRAP_S, a.CLAMP_TO_EDGE), a.texParameteri(L.target, a.TEXTURE_WRAP_T, a.CLAMP_TO_EDGE)), f++; R = this.textures.get(o.classificationTexture); h.setUniform1i("classificationLUT", f), a.activeTexture(a.TEXTURE0 + f), a.bindTexture(R.target, R.id), f++; L = this.textures.get(o.matcapTexture); if (h.setUniform1i("matcapTextureUniform", f), a.activeTexture(a.TEXTURE0 + f), a.bindTexture(L.target, L.id), f++, !0 === o.snapEnabled) { var R = h.uniformLocations["uSnapshot[0]"] , F = h.uniformLocations["uSnapshotDepth[0]"] , L = f , I = new Array(5).fill(L).map(function(e, t) { return e + t }) , O = new Array(5).fill(1 + Math.max.apply(Math, Q(I))).map(function(e, t) { return e + t }) , f = 1 + Math.max.apply(Math, Q(O)); a.uniform1iv(R, I), a.uniform1iv(F, O); for (var z = 0; z < 5; z++) { var N = o.uniforms.uSnapshot.value[z] , U = o.uniforms.uSnapshotDepth.value[z]; if (!N) break; var G = this.threeRenderer.properties.get(N).__webglTexture , H = this.threeRenderer.properties.get(U).__webglTexture , N = I[z] , U = O[z]; a.activeTexture(a["TEXTURE".concat(N)]), a.bindTexture(a.TEXTURE_2D, G), a.activeTexture(a["TEXTURE".concat(U)]), a.bindTexture(a.TEXTURE_2D, H) } var F = (R = []).concat.apply(R, Q(o.uniforms.uSnapView.value.map(function(e) { return e.elements }))) , R = h.uniformLocations["uSnapView[0]"]; a.uniformMatrix4fv(R, !1, F); var F = (R = []).concat.apply(R, Q(o.uniforms.uSnapProj.value.map(function(e) { return e.elements }))) , R = h.uniformLocations["uSnapProj[0]"]; a.uniformMatrix4fv(R, !1, F); F = (R = []).concat.apply(R, Q(o.uniforms.uSnapProjInv.value.map(function(e) { return e.elements }))), R = h.uniformLocations["uSnapProjInv[0]"]; a.uniformMatrix4fv(R, !1, F); F = (R = []).concat.apply(R, Q(o.uniforms.uSnapViewInv.value.map(function(e) { return e.elements }))), R = h.uniformLocations["uSnapViewInv[0]"]; a.uniformMatrix4fv(R, !1, F) } o.usePanoMap && (h.setUniform1f("progress", o.uniforms.progress.value), h.setUniform1f("easeInOutRatio", o.uniforms.easeInOutRatio.value), h.setUniform3f("pano0Position", o.uniforms.pano0Position.value.toArray()), h.setUniform3f("pano1Position", o.uniforms.pano1Position.value.toArray()), h.setUniform("pano0Matrix", o.uniforms.pano0Matrix.value), h.setUniform("pano1Matrix", o.uniforms.pano1Matrix.value), (F = o.uniforms.pano0Map.value) && (this.threeRenderer._textures.safeSetTextureCube(F, ++f), h.setUniform1i("pano0Map", f)), (F = o.uniforms.pano1Map.value) && (this.threeRenderer._textures.safeSetTextureCube(F, ++f), h.setUniform1i("pano1Map", f))), this.renderNodes(e, t, p, n, i, h, r), a.activeTexture(a.TEXTURE2), a.bindTexture(a.TEXTURE_2D, null), a.activeTexture(a.TEXTURE0), a.disable(a.BLEND), a.depthMask(!0), a.enable(a.DEPTH_TEST) } }, { key: "render", value: function(e, t) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : {} , r = this.gl; null != n && this.threeRenderer.setRenderTarget(n); var a, o = ue(this.traverse(e).octrees); try { for (o.s(); !(a = o.n()).done; ) { var s = a.value , l = s.visibleNodes; this.renderOctree(s, l, t, n, i) } } catch (e) { o.e(e) } finally { o.f() } r.activeTexture(r.TEXTURE1), r.bindTexture(r.TEXTURE_2D, null), r.bindBuffer(r.ARRAY_BUFFER, null), r.bindVertexArray(null), this.threeRenderer.resetState() } }]), t }() , Qm = function() { function u(e) { O(this, u), this.profile = e, this.segments = [], this.boundingBox = new kn; for (var t = 0; t < e.points.length - 1; t++) { var n = e.points[t] , i = e.points[t + 1] , r = new Cn(n.x,n.y,0) , a = new Cn(i.x,i.y,0) , o = (new Cn).addVectors(a, r).multiplyScalar(.5) , s = r.distanceTo(a) , l = (new Cn).subVectors(a, r).normalize() , a = new Cn(0,0,1) , a = (new Cn).crossVectors(l, a).normalize() , s = { start: n, end: i, cutPlane: (new ki).setFromNormalAndCoplanarPoint(a, r), halfPlane: (new ki).setFromNormalAndCoplanarPoint(l, o), length: s, points: new Gm }; this.segments.push(s) } } return h(u, [{ key: "size", value: function() { var e, t = 0, n = ue(this.segments); try { for (n.s(); !(e = n.n()).done; ) t += e.value.points.numPoints } catch (e) { n.e(e) } finally { n.f() } return t } }]), u }() , _h = function() { function r(e, t, n, i) { O(this, r), this.pointcloud = e, this.profile = t, this.maxDepth = n || Number.MAX_VALUE, this.callback = i, this.temporaryResult = new Qm(this.profile), this.pointsServed = 0, this.highestLevelServed = 0, this.priorityQueue = new BinaryHeap(function(e) { return 1 / e.weight } ), this.initialize() } return h(r, [{ key: "initialize", value: function() { this.priorityQueue.push({ node: this.pointcloud.pcoGeometry.root, weight: 1 / 0 }) } }, { key: "traverse", value: function(e) { for (var t = [], n = 0; n < 8; n++) { var i = e.children[n]; i && this.pointcloud.nodeIntersectsProfile(i, this.profile) && t.push(i) } for (; 0 < t.length; ) { var r = t.pop() , a = r.boundingSphere.radius; if (this.priorityQueue.push({ node: r, weight: a }), r.level < this.maxDepth) for (var o = 0; o < 8; o++) { var s = r.children[o]; s && this.pointcloud.nodeIntersectsProfile(s, this.profile) && t.push(s) } } } }, { key: "update", value: function() { this.updateGeneratorInstance || (this.updateGeneratorInstance = this.updateGenerator()), this.updateGeneratorInstance.next().done && (this.updateGeneratorInstance = null) } }, { key: "updateGenerator", value: regeneratorRuntime.mark(function e() { var t, n, i, r, a, o, s, l; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: performance.now(), t = 1, n = [], i = 0; case 4: if (!(i < Math.min(t, this.priorityQueue.size()))) { e.next = 13; break } if (r = this.priorityQueue.pop(), (a = r.node).level > this.maxDepth) return e.abrupt("continue", 10); e.next = 9; break; case 9: a.loaded ? (n.push(a), le.lru.touch(a), this.highestLevelServed = Math.max(a.getLevel(), this.highestLevelServed), o = a.pcoGeometry, o = o ? o.hierarchyStepSize : 1, (0 === a.getLevel() || a.level % o == 0 && a.hasChildren) && this.traverse(a)) : (a.load(), this.priorityQueue.push(r)); case 10: i++, e.next = 4; break; case 13: if (!(0 < n.length)) { e.next = 33; break } s = ue(this.getPointsInsideProfile(n, this.temporaryResult)), e.prev = 15, s.s(); case 17: if ((l = s.n()).done) { e.next = 24; break } if (l.value) { e.next = 22; break } return !(e.next = 22); case 22: e.next = 17; break; case 24: e.next = 29; break; case 26: e.prev = 26, e.t0 = e.catch(15), s.e(e.t0); case 29: return e.prev = 29, s.f(), e.finish(29); case 32: 100 < this.temporaryResult.size() && (this.pointsServed += this.temporaryResult.size(), this.callback.onProgress({ request: this, points: this.temporaryResult }), this.temporaryResult = new Qm(this.profile)); case 33: return 0 === this.priorityQueue.size() && (0 < this.temporaryResult.size() && (this.pointsServed += this.temporaryResult.size(), this.callback.onProgress({ request: this, points: this.temporaryResult }), this.temporaryResult = new Qm(this.profile)), this.callback.onFinish({ request: this }), 0 <= (l = this.pointcloud.profileRequests.indexOf(this)) && this.pointcloud.profileRequests.splice(l, 1)), e.next = 36, !0; case 36: case "end": return e.stop() } }, e, this, [[15, 26, 29, 32]]) }) }, { key: "getAccepted", value: regeneratorRuntime.mark(function e(t, n, i, r, a, o, s) { var l, u, c, d, h, p, f, m, v, g, y; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: l = performance.now(), u = new Uint32Array(t), c = new Float64Array(t), d = new Float32Array(3 * t), h = 0, p = new Cn, f = new Cn, m = new Float32Array(n.geometry.attributes.position.array), v = 0; case 9: if (!(v < t)) { e.next = 24; break } if (p.set(m[3 * v + 0], m[3 * v + 1], m[3 * v + 2]), p.applyMatrix4(i), g = Math.abs(r.cutPlane.distanceToPoint(p)), y = Math.abs(r.halfPlane.distanceToPoint(p)), g < this.profile.width / 2 && y < r.length / 2 && (f.subVectors(p, r.start), y = a.dot(f), u[h] = v, c[h] = y + s, o.boundingBox.expandByPoint(p), p.sub(this.pointcloud.position), d[3 * h + 0] = p.x, d[3 * h + 1] = p.y, d[3 * h + 2] = p.z, h++), v % 1e3 != 0) { e.next = 21; break } if (4 < performance.now() - l) return !(e.next = 20); e.next = 21; break; case 20: l = performance.now(); case 21: v++, e.next = 9; break; case 24: return u = u.subarray(0, h), c = c.subarray(0, h), d = d.subarray(0, 3 * h), e.next = 29, [u, c, d]; case 29: case "end": return e.stop() } }, e, this) }) }, { key: "getPointsInsideProfile", value: regeneratorRuntime.mark(function e(t, n) { var i, r, a, o, s, l, u, c, d, h, p, f, m, v, g, y, w, b, x, E, _, M, A, T, S, C, P, D, k, B, L, R, F, I, O, z; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: i = performance.now(), r = 0, a = ue(n.segments), e.prev = 4, a.s(); case 6: if ((d = a.n()).done) { e.next = 86; break } o = d.value, s = ue(t), e.prev = 9, s.s(); case 11: if ((h = s.n()).done) { e.next = 75; break } if (l = h.value, u = l.numPoints, c = l.geometry, u) { e.next = 17; break } return e.abrupt("continue", 73); case 17: if (p = l.boundingBox.clone().applyMatrix4(this.pointcloud.matrixWorld), d = p.getBoundingSphere(new qn), h = new Cn(o.start.x,o.start.y,d.center.z), p = new Cn(o.end.x,o.end.y,d.center.z), p = new vh(h,p).closestPointToPoint(d.center, !0, new Cn), p = p.distanceTo(d.center), p < d.radius + n.profile.width) { e.next = 26; break } return e.abrupt("continue", 73); case 26: y = (new Cn).subVectors(o.end, o.start).setZ(0), w = y.clone().normalize(), f = new Gm, g = (v = new ni).makeTranslation.apply(v, Q(l.boundingBox.min.toArray())), y = (new ni).multiplyMatrices(this.pointcloud.matrixWorld, g), g = v = m = null, y = ue(this.getAccepted(u, l, y, o, w, f, r)), e.prev = 36, y.s(); case 38: if ((w = y.n()).done) { e.next = 53; break } if (b = w.value) { e.next = 47; break } return performance.now(), !(e.next = 44); case 44: i = performance.now(), e.next = 51; break; case 47: x = N(b, 3), m = x[0], v = x[1], g = x[2]; case 51: e.next = 38; break; case 53: e.next = 58; break; case 55: e.prev = 55, e.t0 = e.catch(36), y.e(e.t0); case 58: return e.prev = 58, y.f(), e.finish(58); case 61: if (4 < performance.now() - i) return !(e.next = 65); e.next = 66; break; case 65: i = performance.now(); case 66: f.data.position = g, x = Object.keys(c.attributes).filter(function(e) { return !["position", "indices"].includes(e) }), E = ue(x); try { for (E.s(); !(_ = E.n()).done; ) { for (M = _.value, A = c.attributes[M], T = A.array.length / u, parseInt(T), S = A.array.constructor, C = new S(T * m.length), P = A.array, D = C, k = 0; k < m.length; k++) B = m[k], R = (L = B * T) + T, F = P.subarray(L, R), D.set(F, k * T); f.data[M] = C } } catch (e) { E.e(e) } finally { E.f() } f.data.mileage = v, f.numPoints = m.length, o.points.add(f); case 73: e.next = 11; break; case 75: e.next = 80; break; case 77: e.prev = 77, e.t1 = e.catch(9), s.e(e.t1); case 80: return e.prev = 80, s.f(), e.finish(80); case 83: r += o.length; case 84: e.next = 6; break; case 86: e.next = 91; break; case 88: e.prev = 88, e.t2 = e.catch(4), a.e(e.t2); case 91: return e.prev = 91, a.f(), e.finish(91); case 94: I = ue(n.segments); try { for (I.s(); !(O = I.n()).done; ) z = O.value, n.boundingBox.union(z.points.boundingBox) } catch (e) { I.e(e) } finally { I.f() } return e.next = 98, !0; case 98: case "end": return e.stop() } }, e, this, [[4, 88, 91, 94], [9, 77, 80, 83], [36, 55, 58, 61]]) }) }, { key: "finishLevelThenCancel", value: function() { this.cancelRequested || (this.maxDepth = this.highestLevelServed, this.cancelRequested = !0) } }, { key: "cancel", value: function() { this.callback.onCancel(), this.priorityQueue = new BinaryHeap(function(e) { return 1 / e.weight } ); var e = this.pointcloud.profileRequests.indexOf(this); 0 <= e && this.pointcloud.profileRequests.splice(e, 1) } }]), r }() , Km = function() { function n(e) { O(this, n); var t = -1 === (this.version = e).indexOf(".") ? e.length : e.indexOf("."); this.versionMajor = parseInt(e.substr(0, t)), this.versionMinor = parseInt(e.substr(t + 1)), 0 === this.versionMinor.length && (this.versionMinor = 0) } return h(n, [{ key: "newerThan", value: function(e) { e = new n(e); return this.versionMajor > e.versionMajor || this.versionMajor === e.versionMajor && this.versionMinor > e.versionMinor } }, { key: "equalOrHigher", value: function(e) { e = new n(e); return this.versionMajor > e.versionMajor || this.versionMajor === e.versionMajor && this.versionMinor >= e.versionMinor } }, { key: "upTo", value: function(e) { return !this.newerThan(e) } }]), n }() , ch = function() { function e() { O(this, e), this.workers = {} } return h(e, [{ key: "getWorker", value: function(e) { var t; return this.workers[e] || (this.workers[e] = []), 0 === this.workers[e].length && (t = new Worker(e), this.workers[e].push(t)), this.workers[e].pop() } }, { key: "returnWorker", value: function(e, t) { this.workers[e].push(t) } }]), e }(); function $m(e) { var t, n = e.material, i = [], r = ue(n.ranges); try { for (r.s(); !(t = r.n()).done; ) { var a = N(t.value, 2) , o = a[0] , s = a[1]; i.push({ name: o, value: s }) } } catch (e) { r.e(e) } finally { r.f() } "number" == typeof n.elevationRange[0] && i.push({ name: "elevationRange", value: n.elevationRange }), "number" == typeof n.intensityRange[0] && i.push({ name: "intensityRange", value: n.intensityRange }); var l = Object.entries(Potree.PointSizeType).find(function(e) { return e[1] === n.pointSizeType })[0] , l = { activeAttributeName: n.activeAttributeName, ranges: i, size: n.size, minSize: n.minSize, pointSizeType: l, matcap: n.matcap }; return { name: e.name, url: e.pcoGeometry.url, position: e.position.toArray(), rotation: e.rotation.toArray(), scale: e.scale.toArray(), material: l } } function ev(e) { return { uuid: e.uuid, name: e.name, points: e.points.map(function(e) { return e.toArray() }), height: e.height, width: e.width } } function tv(e) { return { uuid: e.uuid, type: e.constructor.name, name: e.name, position: e.position.toArray(), rotation: e.rotation.toArray(), scale: e.scale.toArray(), visible: e.visible, clip: e.clip } } function nv(e) { var t = e.controlPoints.map(function(e) { return { position: e.position.toArray(), target: e.target.toArray() } }); return { uuid: e.uuid, name: e.name, duration: e.duration, t: e.t, curveType: e.curveType, visible: e.visible, controlPoints: t } } function iv(e) { return { uuid: e.uuid, name: e.name, measureType: e.measureType, points: e.points.map(function(e) { return e.toArray() }) } } function rv(e) { return { cameraParamsPath: e.cameraParamsPath, imageParamsPath: e.imageParamsPath } } function av(e) { return { path: e.path } } function ov(e) { var i = new Map; e.scene.annotations.traverseDescendants(function(e) { var t, n = (n = { uuid: (t = e).uuid, title: t.title.toString(), description: t.description, position: t.position.toArray(), offset: t.offset.toArray(), children: [] }, t.cameraPosition && (n.cameraPosition = t.cameraPosition.toArray()), t.cameraTarget && (n.cameraTarget = t.cameraTarget.toArray()), void 0 !== t.radius && (n.radius = t.radius), n); i.set(e, n) }); var t, n = ue(i); try { for (n.s(); !(t = n.n()).done; ) { var r, a = N(t.value, 2), o = a[0], s = a[1], l = ue(o.children); try { for (l.s(); !(r = l.n()).done; ) { var u = r.value , c = i.get(u); s.children.push(c) } } catch (e) { l.e(e) } finally { l.f() } } } catch (e) { n.e(e) } finally { n.f() } return e.scene.annotations.children.map(function(e) { return i.get(e) }) } function sv(e) { return (lv = lv || { position: Sf.createFatLineMat({ color: yv, lineWidth: 3 }), target: Sf.createFatLineMat({ color: wv, lineWidth: 3 }), frustum: Sf.createFatLineMat({ color: yv, lineWidth: 2 }), aimAtTarget: new tl({ color: wv }) })[e] } var lv, uv = function() { y(a, hn); var r = w(a); function a(e, t) { var n; O(this, a), (n = r.call(this)).position = e, n.color = "#" + new Yi(t).getHexString(), n.svg = n.create(), n.visible_ = !0; function i() { n.update() } return viewer.addEventListener("camera_changed", i), n.addEventListener("dispose", function() { viewer.removeEventListener("camera_changed", i) }), n } return h(a, [{ key: "create", value: function() { var o = this , e = "http://www.w3.org/2000/svg" , t = document.createElementNS(e, "svg"); t.setAttribute("width", "2em"), t.setAttribute("height", "2em"), t.setAttribute("position", "absolute"), t.style.left = "50px", t.style.top = "50px", t.style.position = "absolute", t.style.zIndex = "10000", t.style.cursor = "grab", t.style.transform = "translate(-50%,-50%)"; e = document.createElementNS(e, "circle"); e.setAttributeNS(null, "cx", "1em"), e.setAttributeNS(null, "cy", "1em"), e.setAttributeNS(null, "r", "0.5em"), e.setAttributeNS(null, "style", "fill: " + this.color + "; stroke: black; stroke-width: 0.2em;"), t.appendChild(e), viewer.renderer.domElement.parentElement.appendChild(t); function n(e) { o.selectedElement = t, document.addEventListener("mousemove", r) } function i(e) { o.selectedElement = null, document.removeEventListener("mousemove", r) } var r = function(e) { var t, n, i, r, a; o.selectedElement && (e.preventDefault(), a = viewer.renderer.domElement.getBoundingClientRect(), t = e.clientX - a.x, n = e.clientY - a.y, i = (r = viewer.renderer.getSize(new yn)).width, e = r.height, a = viewer.scene.getActiveCamera(), (r = o.position.clone().project(a)).x = (t / i - .5) / .5, r.y = (-(n - e) / e - .5) / .5, a = r.clone().unproject(a), o.position.set(a.x, a.y, a.z), o.update(), o.dispatchEvent({ type: "dragged", position: o.position })) }; return t.addEventListener("mousedown", n), t.addEventListener("mouseup", i), t.style.display = this.visible ? "" : "none", this.addEventListener("dispose", function() { t.removeEventListener("mousedown", n), t.removeEventListener("mouseup", i) }), t } }, { key: "visible", get: function() { return this.visible_ }, set: function(e) { (this.visible_ = e) ? this.update() : this.svg.style.display = "none" } }, { key: "update", value: function() { if (this.visible) { var e = viewer.scene.getActiveCamera() , e = Potree.Utils.getPos2d(this.position, e, viewer.renderArea, viewer.mainViewport); if (!e.trueSide) return this.svg.style.display = "none"; this.svg.style.left = e.posInViewport.x, this.svg.style.top = e.posInViewport.y, this.svg.style.display = "" } } }, { key: "dispose", value: function() { this.svg.remove(), this.dispatchEvent("dispose") } }]), a }(), cv = (new ua(1,1), function() { y(r, qp); var i = w(r); function r(e) { var t, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; return O(this, r), n.sizeInfo = { width2d: 60 }, (t = i.call(this, n)).position.copy(e), t.dragStyle = n.dragStyle || "default", t.bindEvent(), t } return h(r, [{ key: "bindEvent", value: function() { var r, a, o = this; this.addEventListener("drag", function(e) { var t, n, i = viewer.scene.getActiveCamera(); r ? (t = (new yn).subVectors(e.pointer, a), (n = r.clone()).x += t.x, n.y += t.y, n = n.clone().unproject(i), o.position.set(n.x, n.y, n.z)) : (r = o.position.clone().project(i), a = e.pointer.clone()), o.update(), o.dispatchEvent({ type: "dragged", position: o.position }) }), this.addEventListener("drop", function(e) { a = r = null }), this.addEventListener("mouseover", function(e) { viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "markerMove" }) }), this.addEventListener("mouseleave", function(e) { viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "markerMove" }) }) } }]), r }()), dv = new Hr(new Tu(.08,.08,3,2),new $i({ color: "#f88" })), hv = function() { y(u, Si); var l = w(u); function u(e, t, n, i) { var r, a = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : {}; O(this, u), (r = l.call(this)).curve = new Bc(e,!1,"centripetal"), r.name = i || "curveNode", r.handleMat = a.handleMat, r.lineMat = t, r.createPath(), r.color = n, r.handles = [], r.wholeLength = 0, r.viewports = a.viewports || [viewer.mainViewport]; for (var o = 0, s = r.points.length; o < s; o++) r.handles.push(r.createHandle(r.points[o])); return r.visible_ = !0, Potree.settings.isTest && (r.spheres = new Si, r.add(r.spheres)), r.updatePath(), r } return h(u, [{ key: "addPoint", value: function(e, t, n) { var i = this.points.length; null == t && (t = i); var r = this.createHandle(e); this.handles = [].concat(Q(this.handles.slice(0, t)), [r], Q(this.handles.slice(t, i))), this.points = [].concat(Q(this.points.slice(0, t)), [e], Q(this.points.slice(t, i))), n && (this.updatePath(), this.updateHandle(t)) } }, { key: "removePoint", value: function(e) { this.handles[e].dispose(), this.handles.splice(e, 1), this.points.splice(e, 1), this.updatePath() } }, { key: "createPath", value: function() { var e = Sf.createFatLine([], this.lineMat); this.line = e, this.add(e) } }, { key: "updatePath", value: function() { var n = this; this.curve.needsUpdate = !0; var e = this.points.length; if (this.wholeLength = this.points.reduce(function(e, t, n, i) { return 0 == n ? 0 : e + t.distanceTo(i[n - 1]) }, 0), 1 < e) { var t = gn.clamp(Math.ceil(5 * this.wholeLength), 30, 500) , t = this.curve.getSpacedPoints(t); if (this.needsPercent) { this.pointsPercent = [0]; for (var i = [0], r = 0, a = t[0], o = 1; o < e; o++) { var s = this.points[o]; r += s.distanceTo(a), a = s, i.push(r) } for (var l = 1; l < e; l++) this.pointsPercent.push(0 == r ? l / e : i[l] / r) } Potree.settings.isTest && (this.spheres.children.forEach(function(e) { return e.visible = !1 }), t.forEach(function(e, t) { t = n.spheres.children[t]; t || (t = dv.clone(), n.spheres.add(t)), t.position.copy(e), t.visible = !0 })) } else t = []; Sf.updateLine(this.line, t), this.dispatchEvent("updatePath") } }, { key: "createHandle", value: function(e) { var n, i = this; return this.handleMat ? (n = new cv(e,{ mat: this.handleMat, viewports: this.viewports }), this.add(n)) : n = new uv(e,this.color), n.visible = this.visible, n.addEventListener("dragged", function(e) { var t = i.handles.indexOf(n); i.points[t].copy(e.position), i.updatePath(), i.dispatchEvent({ type: "dragCurvePoint", index: t }) }), n } }, { key: "updateHandle", value: function(e) { this.visible && this.handles[e].update() } }, { key: "updateHandles", value: function() { var n = this; this.handles.forEach(function(e, t) { n.updateHandle(t) }) } }, { key: "update", value: function() { this.updateHandles(), this.updatePath() } }, { key: "visible", get: function() { return this.visible_ }, set: function(t) { t != this.visible_ && (this.visible_ = t, this.visible = t, this.handles && (this.handles.forEach(function(e) { return e.visible = t }), t && this.updateHandles())) } }, { key: "points", get: function() { return this.curve.points }, set: function(e) { this.curve.points = e } }, { key: "getPointAt", value: function(e) { return this.curve.getPointAt(e) } }, { key: "getSpacedPoints", value: function(e) { return this.curve.getSpacedPoints(e) } }, { key: "dispose", value: function() { this.parent && this.parent.remove(this), this.handles.forEach(function(e) { return e.dispose() }), this.line.geometry && this.line.geometry.dispose() } }]), u }(), pv = { getEaseOut: function(r) { var e = (r = Math.round(r)) < 2 ? (r = Math.PI / 2, pv.easeOutSine) : function(e, t, n, i) { return 2 < r && console.log(r), -n / Math.pow(-i, r) * Math.pow(e - i, r) + n } ; return { k: r, easeFun: e } }, linearTween: function(e, t, n, i) { return n * e / i + t }, easeInQuad: function(e, t, n, i) { return n * (e /= i) * e + t }, easeOutQuad: function(e, t, n, i) { return -n * (e /= i) * (e - 2) + t }, easeInOutQuad: function(e, t, n, i) { return (e /= i / 2) < 1 ? n / 2 * e * e + t : -n / 2 * (--e * (e - 2) - 1) + t }, easeInCubic: function(e, t, n, i) { return n * (e /= i) * e * e + t }, easeOutCubic: function(e, t, n, i) { return e /= i, n * (--e * e * e + 1) + t }, easeInOutCubic: function(e, t, n, i) { return (e /= i / 2) < 1 ? n / 2 * e * e * e + t : n / 2 * ((e -= 2) * e * e + 2) + t }, easeInQuart: function(e, t, n, i) { return n * (e /= i) * e * e * e + t }, easeOutQuart: function(e, t, n, i) { return e /= i, -n * (--e * e * e * e - 1) + t }, easeInOutQuart: function(e, t, n, i) { return (e /= i / 2) < 1 ? n / 2 * e * e * e * e + t : -n / 2 * ((e -= 2) * e * e * e - 2) + t }, easeInQuint: function(e, t, n, i) { return n * (e /= i) * e * e * e * e + t }, easeOutQuint: function(e, t, n, i) { return e /= i, n * (--e * e * e * e * e + 1) + t }, easeInOutQuint: function(e, t, n, i) { return (e /= i / 2) < 1 ? n / 2 * e * e * e * e * e + t : n / 2 * ((e -= 2) * e * e * e * e + 2) + t }, easeInSine: function(e, t, n, i) { return -n * Math.cos(e / i * (Math.PI / 2)) + n + t }, easeOutSine: function(e, t, n, i) { return console.log("easeOutSine"), n * Math.sin(e / i * (Math.PI / 2)) + t }, easeInOutSine: function(e, t, n, i) { return -n / 2 * (Math.cos(Math.PI * e / i) - 1) + t }, easeInExpo: function(e, t, n, i) { return n * Math.pow(2, 10 * (e / i - 1)) + t }, easeOutExpo: function(e, t, n, i) { return n * (1 - Math.pow(2, -10 * e / i)) + t }, easeInOutExpo: function(e, t, n, i) { return (e /= i / 2) < 1 ? n / 2 * Math.pow(2, 10 * (e - 1)) + t : (e--, n / 2 * (2 - Math.pow(2, -10 * e)) + t) }, easeInCirc: function(e, t, n, i) { return e /= i, -n * (Math.sqrt(1 - e * e) - 1) + t }, easeOutCirc: function(e, t, n, i) { return e /= i, e--, n * Math.sqrt(1 - e * e) + t }, easeInOutCirc: function(e, t, n, i) { return (e /= i / 2) < 1 ? -n / 2 * (Math.sqrt(1 - e * e) - 1) + t : (e -= 2, n / 2 * (Math.sqrt(1 - e * e) + 1) + t) }, easeInElastic: function(e, t, n, i) { var r = 1.70158 , a = 0 , o = n; return 0 === e ? t : 1 == (e /= i) ? t + n : (a = a || .3 * i, r = o < Math.abs(n) ? (o = n, a / 4) : a / (2 * Math.PI) * Math.asin(n / o), -(o * Math.pow(2, 10 * --e) * Math.sin((e * i - r) * (2 * Math.PI) / a)) + t) }, easeOutElastic: function(e, t, n, i) { var r = 1.70158 , a = 0 , o = n; return 0 === e ? t : 1 == (e /= i) ? t + n : (a = a || .3 * i, r = o < Math.abs(n) ? (o = n, a / 4) : a / (2 * Math.PI) * Math.asin(n / o), o * Math.pow(2, -10 * e) * Math.sin((e * i - r) * (2 * Math.PI) / a) + n + t) }, easeInOutElastic: function(e, t, n, i) { var r = 1.70158 , a = 0 , o = n; return 0 === e ? t : 2 == (e /= i / 2) ? t + n : (a = a || i * (.3 * 1.5), r = o < Math.abs(n) ? (o = n, a / 4) : a / (2 * Math.PI) * Math.asin(n / o), e < 1 ? o * Math.pow(2, 10 * --e) * Math.sin((e * i - r) * (2 * Math.PI) / a) * -.5 + t : o * Math.pow(2, -10 * --e) * Math.sin((e * i - r) * (2 * Math.PI) / a) * .5 + n + t) }, easeInBack: function(e, t, n, i, r) { return n * (e /= i) * e * (((r = void 0 === r ? 1.70158 : r) + 1) * e - r) + t }, easeOutBack: function(e, t, n, i, r) { return n * ((e = e / i - 1) * e * (((r = void 0 === r ? 1.70158 : r) + 1) * e + r) + 1) + t }, easeInOutBack: function(e, t, n, i, r) { return void 0 === r && (r = 1.70158), (e /= i / 2) < 1 ? n / 2 * (e * e * ((1 + (r *= 1.525)) * e - r)) + t : n / 2 * ((e -= 2) * e * ((1 + (r *= 1.525)) * e + r) + 2) + t }, easeOutBounce: function(e, t, n, i) { return (e /= i) < 1 / 2.75 ? n * (7.5625 * e * e) + t : e < 2 / 2.75 ? n * (7.5625 * (e -= 1.5 / 2.75) * e + .75) + t : e < 2.5 / 2.75 ? n * (7.5625 * (e -= 2.25 / 2.75) * e + .9375) + t : n * (7.5625 * (e -= 2.625 / 2.75) * e + .984375) + t }, easeInBounce: function(e, t, n, i) { return n - pv.easeOutBounce(i - e, 0, n, i) + t }, easeInOutBounce: function(e, t, n, i) { return e < i / 2 ? .5 * pv.easeInBounce(2 * e, 0, n, i) + t : .5 * pv.easeOutBounce(x, 2 * e - i, 0, n, i) + .5 * n + t } }, fv = function(t, n, i) { var r = t.clone(); return n = n.clone(), function(e) { t.set(r.x * (1 - e) + n.x * e, r.y * (1 - e) + n.y * e, r.z * (1 - e) + n.z * e), i && i(t, e) } }, mv = function(t, n, i) { var r = t.clone(); return function(e) { t.copy(r).slerp(n, e), i && i(t, e) } }, vv = function(t, n, i, r) { var a = t[n]; return function(e) { t[n] = a * (1 - e) + i * e, r && r(t[n]) } }, gv = { globalDone: null, funcs: [], counter: 0, uniqueID: 0, start: function(e, t, n, i, r, a, o, s) { return this.funcs.push({ func: e, current: -(i = i || 0) * Math.abs(t), duration: (1 - Math.max(i, 0)) * Math.abs(t), done: n, easing: r || pv.linearTween, cycling: t < 0, running: !0, debug: i < 0, name: a || "T" + this.counter, id: void 0 === o ? this.counter : o, paused: !1, cancelFun: s }), e(0, 16), this.counter += 1, e }, trigger: function(e) { var t = void 0 === e.delayRatio ? 0 : e.delayRatio , n = e.func || function() {} , i = void 0 === e.duration ? 0 : e.duration; void 0 !== e.cycling && e.cycling && (i = -Math.abs(i)); var r = e.done || null , a = e.easing || pv.linearTween , o = e.name || "R" + this.counter , e = void 0 === e.id ? this.counter : e.id; return this.start(n, i, r, t, a, o, e) }, setTimeout: function(e, t, n) { n = void 0 === n ? this.counter : n; return this.trigger({ done: e, duration: void 0 === t ? 0 : t, name: "O" + this.counter, id: n }) }, pause: function() { this.paused = !0 }, resume: function() { this.paused = !1 }, update: function(n) { this.funcs.forEach(function(e) { var t; e.paused || (e.current += 1e3 * n, e.current < 0) || (e.current >= e.duration && !e.cycling ? (t = e.easing(1, 0, 1, 1), e.func(t, 1e3 * n), e.done && e.done(), e.running = !1) : (t = e.easing(e.current % e.duration / e.duration, 0, 1, 1), e.func(t, 1e3 * n) && (e.done && e.done(), e.running = !1))) }); var e = this.funcs.length; this.funcs = this.funcs.filter(function(e) { return e.running }); var t = this.funcs.length; 0 < e && 0 === t && this.globalDone && (t = this.globalDone, this.globalDone = null, t()) }, adjustSpeed: function(e, t) { for (var n = this.getById(e), i = 0; i < n.length; i++) { var r = n[i]; r.duration /= t, r.current /= t } }, getById: function(t) { return this.funcs.filter(function(e) { return t === e.id }) }, get: function(e) { for (var t = 0; t < this.funcs.length; t += 1) if (this.funcs[t].func === e) return this.funcs[t]; return null }, isRunning: function(e) { e = this.get(e); return null !== e && e.running }, countActive: function() { for (var e = 0, t = 0; t < this.funcs.length; t += 1) e += this.funcs[t].running; return e }, listActive: function() { for (var e = [], t = 0; t < this.funcs.length; t += 1) this.funcs[t].running && e.push(this.funcs[t].name); return e }, done: function(e) { this.globalDone = e }, cancelById: function(e, n) { var i = void 0 === e ? 0 : e , r = []; this.funcs = this.funcs.filter(function(e) { var t = e.id == i; return t && n && e.cancelFun && r.push(e.cancelFun), !t }), r.forEach(function(e) { e() }) }, cancel: function(t) { this.funcs = this.funcs.filter(function(e) { return e.func !== t }) }, getUniqueId: function() { return --this.uniqueID, this.uniqueID } }, yv = "red", wv = "blue", bv = function() { y(c, hn); var n = w(c); function c(e) { var t; return O(this, c), (t = n.call(this)).viewer = e, t.selectedElement = null, t.uuid = gn.generateUUID(), t.node = new Si, t.node.name = "camera animation", t.viewer.scene.scene.add(t.node), t.frustum = t.createFrustum(), t.node.add(t.frustum), t.name = "Camera Animation", t.curveType = "centripetal", t.visible = !0, t.targets = [], t.createPath(), t.duration = 5, t.percent = 0, t.currentIndex = 0, t.durations = [], t.quaternions = [], Potree.settings.isTest || t.setVisible(!1), t.addEventListener("dispose", function() { t.dispose() }), t.targetLines = new Si, t.node.add(t.targetLines), t } return h(c, [{ key: "createControlPoint", value: function(e, t) { var n, i = this, r = this.posCurve.points.length, a = new Cn, o = new Cn; null == e && (e = r), t ? (a.copy(t.position), o.copy(t.target)) : 2 <= r && 0 === e ? (n = (new Cn).subVectors(this.posCurve.points[0], this.posCurve.points[1]), a.copy(this.posCurve.points[0]).add(n), (new Cn).subVectors(this.targets[0].position, this.targets[1].position), o.copy(this.targets[0].position).add(n)) : 2 <= r && e === r ? (s = (new Cn).subVectors(this.posCurve.points[r - 1], this.posCurve.points[r - 2]), a.copy(this.posCurve.points[r - 2]).add(s), (new Cn).subVectors(this.targets[r - 1].position, this.targets[r - 2].position), o.copy(this.targets[r - 2].position).add(s)) : 2 <= r && (a.copy(this.posCurve.points[e - 1].clone().add(this.posCurve.points[e]).multiplyScalar(.5)), o.copy(this.targets[r - 1].position.clone().add(this.targets[r]).multiplyScalar(.5))), this.posCurve.addPoint(a, e); var s = new uv(o,wv); s.visible = this.visible, this.targets = [].concat(Q(this.targets.slice(0, e)), [s], Q(this.targets.slice(e, r))), this.useDurSlice && (this.durations = [].concat(Q(this.durations.slice(0, e)), [t.duration], Q(this.durations.slice(e, r)))), this.dispatchEvent({ type: "controlpoint_added", index: e }); o = Sf.createLine([a, o], { mat: sv("aimAtTarget") }); this.targetLines.children = [].concat(Q(this.targetLines.children.slice(0, e)), [o], Q(this.targetLines.children.slice(e, r))), this.targets[e].addEventListener("dragged", function(e) { i.updatePathCallback(), i.dragPointCallback(e) }) } }, { key: "dragPointCallback", value: function(e) { var t = e.index; null == e.index && (t = this.targets.indexOf(e.target)), Sf.moveLine(this.targetLines.children[t], [this.posCurve.points[t], this.targets[t].position]), this.updateFrustum() } }, { key: "updatePathCallback", value: function() { this.quaternions = []; for (var e = this.posCurve.points.length, t = 0; t < e; t++) { var n = Up.getQuaFromPosAim(this.posCurve.points[t], this.targets[t].position); this.quaternions.push(n) } this.reMapCurvePercent() } }, { key: "removeControlPoint", value: function(e) { this.posCurve.removePoint(e), this.targets[e].dispose(), this.targets.splice(e, 1), this.dispatchEvent({ type: "controlpoint_removed", index: e }), this.targetLines.remove(this.targetLines.children[e]), this.useDurSlice && this.durations.splice(e, 1) } }, { key: "createPath", value: function() { this.posCurve = new hv([],sv("position"),yv,"posCurve"), this.posCurve.needsPercent = !0, this.node.add(this.posCurve), this.posCurve.addEventListener("dragCurvePoint", this.dragPointCallback.bind(this)), this.posCurve.addEventListener("updatePath", this.updatePathCallback.bind(this)) } }, { key: "createFrustum", value: function() { var e = [new Cn(0,0,0), new Cn(-.3,-.3,1), new Cn(0,0,0), new Cn(.3,-.3,1), new Cn(0,0,0), new Cn(.3,.3,1), new Cn(0,0,0), new Cn(-.3,.3,1), new Cn(-.3,-.3,1), new Cn(.3,-.3,1), new Cn(.3,-.3,1), new Cn(.3,.3,1), new Cn(.3,.3,1), new Cn(-.3,.3,1), new Cn(-.3,.3,1), new Cn(-.3,-.3,1)]; e.forEach(function(e) { return e.z *= -1 }); e = Sf.createFatLine(e, { material: sv("frustum") }); return e.visible = !1, e } }, { key: "reMapCurvePercent", value: function() { var e = this.posCurve.points.length; if (e < 2) return this.newPointsPercents = []; var t = [0]; if (this.useDurSlice) { for (var n = [0], i = 0, r = 0; r < e - 1; r++) { var a = this.durations[r]; i += a, n.push(i) } for (var o = 1; o < e; o++) t.push(0 == i ? o / e : n[o] / i) } else { for (var s = this.duration / e, l = Math.min(.8, s), u = gn.clamp(.8 * Math.PI, l, s), c = this.posCurve.pointsPercent, d = 1; d < e; d++) { var h, p = (c[d] - c[d - 1]) * this.duration, f = l; p < u && (h = this.quaternions[d].angleTo(this.quaternions[d - 1]), f = gn.clamp(.8 * h, l, s)), p = Math.max(p, f), p = t[d - 1] + p / this.duration, t.push(p) } var m, v = t[e - 1]; Up.closeTo(v, 1) || (m = 1 / v, t = t.map(function(e) { return e * m })) } this.newPointsPercents = t } }, { key: "at", value: function(e, t, n) { var i, r = e = gn.clamp(e, 0, 1); r < 1 ? (this.currentIndex = this.newPointsPercents.findIndex(function(e) { return r < e }) - 1, e = this.newPointsPercents[this.currentIndex], i = this.newPointsPercents[this.currentIndex + 1], s = (r - e) / (i - e), i = this.posCurve.pointsPercent[this.currentIndex], r = i + (this.posCurve.pointsPercent[this.currentIndex + 1] - i) * s, e = this.quaternions[this.currentIndex + 1], i = this.quaternions[this.currentIndex], i = (new Sn).copy(i), mv(i, e)(s)) : (this.currentIndex = this.posCurve.points.length - 1, i = Up.getQuaFromPosAim(this.posCurve.points[this.currentIndex], this.targets[this.currentIndex].position)); var a, o, s = this.posCurve.getPointAt(r); return null != t ? (o = Potree.settings.tourTestCameraMove ? (a = this.frustum.quaternion.clone(), this.frustum.position.clone()) : (a = (o = viewer.scene.getActiveCamera()).quaternion.clone(), o.position.clone()), n = n || 1 / Potree.settings.cameraAniSmoothRatio, n = gn.clamp(n *= 60 * t, 0, 1), mv(a, i)(n), fv(o, s)(n)) : (a = i, o = s), { position: o, rotation: (new ci).setFromQuaternion(a) } } }, { key: "set", value: function(e) { this.percent = e } }, { key: "setVisible", value: function(t) { this.node.visible = t, this.posCurve.visible = t, this.targets.forEach(function(e) { return e.visible = t }), this.visible = t } }, { key: "setDuration", value: function(e) { e != this.duration && (this.duration = e, this.quaternions.length == this.posCurve.points.length && this.reMapCurvePercent()) } }, { key: "getDuration", value: function(e) { return this.duration } }, { key: "play", value: function() { var i = this , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; if (this.onUpdate) return console.error("已经开始播放"); var r = 0 , a = 0; null != e.percent ? r = e.percent : e.index && (a = index, r = this.posCurve.pointsPercent[index]); var o = this.duration; this.originalyVisible = this.visible, Potree.settings.tourTestCameraMove || this.setVisible(!1); var s, l = 0, u = Potree.settings.cameraAniSmoothRatio / 60 * 3, c = 0; this.onUpdate = function(e) { if (i.posCurve.points.length < 2) return 1 == i.posCurve.points.length && (viewer.scene.view.position.copy(i.posCurve.points[0]), viewer.scene.view.rotation = (new ci).setFromQuaternion(i.quaternions[0])), void i.pause(); var t; s ? t = (performance.now() - s) / 1e3 / o + r : (t = 0, l += e.delta, n = .2, console.log("延迟开始"), .25 < l && (s = performance.now())), i.set(t); var n = i.at(t, e.delta, n); a != i.currentIndex && (a = i.currentIndex, console.log("updateCurrentIndex", a), i.dispatchEvent({ type: "updateCurrentIndex", currentIndex: a })), Potree.settings.tourTestCameraMove || (viewer.scene.view.position.copy(n.position), viewer.scene.view.rotation = n.rotation), i.updateFrustum(n), 1 <= t && (u < c ? i.pause() : (c += e.delta, console.log("延迟结束"))) } , this.viewer.addEventListener("update", this.onUpdate) } }, { key: "pause", value: function() { this.setVisible(this.originalyVisible), this.viewer.removeEventListener("update", this.onUpdate), this.dispatchEvent("playDone"), this.onUpdate = null } }, { key: "updateFrustum", value: function(e) { var t = this.frustum; 1 < this.posCurve.points.length ? (t.visible = !0, e = e || this.at(this.percent), t.position.copy(e.position), t.rotation.copy(e.rotation)) : t.visible = !1 } }, { key: "changeCallback", value: function() { this.posCurve.update(), this.targets.forEach(function(e) { return e.update() }), this.updateFrustum() } }, { key: "dispose", value: function() { this.posCurve.dispose(), this.targets.forEach(function(e) { return e.dispose() }), this.durations = [], this.node.parent.remove(this.node) } }], [{ key: "defaultFromView", value: function(e) { for (var t = new c(e), n = e.scene.getActiveCamera(), e = e.scene.view.getPivot(), i = new Cn(.3 * n.position.x + .7 * e.x,.3 * n.position.y + .7 * e.y,.3 * n.position.z + .7 * e.z), r = new Cn(.05 * n.position.x + .95 * e.x,.05 * n.position.y + .95 * e.y,.05 * n.position.z + .95 * e.z), a = Jf.computeAzimuth(n.position, e), o = 0; o < 5; o++) { var s = 1.5 * Math.PI * (o / 5) + a , l = 2 * Math.cos(s) , u = 2 * Math.sin(s) , s = new Cn(i.x + l,i.y + u,i.z) , u = new Cn(r.x + .1 * l,r.y + .1 * u,r.z); t.createControlPoint(null, { position: s, target: u }) } return t.changeCallback(), t } }]), c }(); function xv(d, e) { if (e) { var t, n = function e(t, n) { var i, r; if (!(i = t, r = null, d.scene.annotations.traverse(function(e) { e.uuid === i.uuid && (r = e) }), r)) { var a, o, s, l, u = ((s = new Kf({ position: (a = t).position, title: a.title, cameraPosition: a.cameraPosition, cameraTarget: a.cameraTarget })).description = a.description, s.uuid = a.uuid, a.offset && (o = s.offset).set.apply(o, Q(a.offset)), s), c = ue(t.children); try { for (c.s(); !(l = c.n()).done; ) e(l.value, u) } catch (e) { c.e(e) } finally { c.f() } n.add(u) } }, i = ue(e); try { for (i.s(); !(t = i.n()).done; ) n(t.value, d.scene.annotations) } catch (e) { i.e(e) } finally { i.f() } } } function Ev() { return (Ev = r(regeneratorRuntime.mark(function e(r, a, o) { var s, l, u, c, d, h, p, f, m, v, g, y, w, b, x; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: if ("Potree" !== a.type) return console.error("not a valid Potree project"), e.abrupt("return"); e.next = 3; break; case 3: n = r, (i = a.settings) && (n.setPointBudget(i.pointBudget), n.setFOV(i.fov), n.setEDLEnabled(i.edlEnabled), n.setEDLRadius(i.edlRadius), n.setEDLStrength(i.edlStrength), n.setBackground(i.background), n.setMinNodeSize(i.minNodeSize), n.setShowBoundingBox(i.showBoundingBoxes)), t = r, n = a.view, i = void 0, (i = t.scene.view.position).set.apply(i, Q(n.position)), (t = t.scene.view).lookAt.apply(t, Q(n.target)), s = ue(a.measurements); try { for (s.s(); !(l = s.n()).done; ) u = l.value, function(e, t) { e.scene.measurements.find(function(e) { return e.uuid === t.uuid }) || (t.points = t.points.map(function(e) { return B(Cn, Q(e)) }), e.measuringTool.createMeasureFromData(t)) }(r, u) } catch (e) { s.e(e) } finally { s.f() } c = ue(a.volumes); try { for (c.s(); !(d = c.n()).done; ) h = d.value, function(e, t) { var n, i; e.scene.volumes.find(function(e) { return e.uuid === t.uuid }) || ((i = new Potree[t.type]).uuid = t.uuid, i.name = t.name, (n = i.position).set.apply(n, Q(t.position)), (n = i.rotation).set.apply(n, Q(t.rotation)), (n = i.scale).set.apply(n, Q(t.scale)), i.visible = t.visible, i.clip = t.clip, e.scene.addVolume(i)) }(r, h) } catch (e) { c.e(e) } finally { c.f() } p = ue(a.cameraAnimations); try { for (p.s(); !(f = p.n()).done; ) m = f.value, function(e, t) { if (!e.scene.cameraAnimations.find(function(e) { return e.uuid === t.uuid })) { var n = new bv(e); n.uuid = t.uuid, n.name = t.name, n.duration = t.duration, n.t = t.t, n.curveType = t.curveType, n.visible = t.visible, n.controlPoints = []; var i, r = ue(t.controlPoints); try { for (r.s(); !(i = r.n()).done; ) { var a, o, s = i.value, l = n.createControlPoint(); (a = l.position).set.apply(a, Q(s.position)), (o = l.target).set.apply(o, Q(s.target)) } } catch (e) { r.e(e) } finally { r.f() } e.scene.addCameraAnimation(n) } }(r, m) } catch (e) { p.e(e) } finally { p.f() } v = ue(a.profiles); try { for (v.s(); !(g = v.n()).done; ) y = g.value, function(e, t) { var n = t.name , i = t.points; if (!e.scene.profiles.find(function(e) { return e.uuid === t.uuid })) { var r = new Potree.Profile; r.name = n, r.uuid = t.uuid, r.setWidth(t.width); var a, o = ue(i); try { for (o.s(); !(a = o.n()).done; ) { var s = a.value; r.addMarker(B(Cn, Q(s))) } } catch (e) { o.e(e) } finally { o.f() } e.scene.addProfile(r) } }(r, y) } catch (e) { v.e(e) } finally { v.f() } if (a.orientedImages) { w = ue(a.orientedImages); try { for (w.s(); !(b = w.n()).done; ) x = b.value, function(t, e) { var n = e.cameraParamsPath , i = e.imageParamsPath; t.scene.orientedImages.find(function(e) { return e.imageParamsPath === i }) || Potree.OrientedImageLoader.load(n, i, t).then(function(e) { t.scene.addOrientedImages(e) }) }(r, x) } catch (e) { w.e(e) } finally { w.f() } } xv(r, a.annotations), t = r, (n = a.classification) && t.setClassifications(n), o && o(); case 17: case "end": return e.stop() } var t, n, i }, e) }))).apply(this, arguments) } var _v = function() { y(i, Gu); var n = w(i); function i() { O(this, i); var e = n.call(this) , t = { resolution: { type: "v2", value: new yn }, edlStrength: { type: "f", value: 1 }, uNear: { type: "f", value: 1 }, uFar: { type: "f", value: 1 }, radius: { type: "f", value: 1 }, neighbours: { type: "2fv", value: [] }, depthMap: { type: "t", value: null }, uEDLColor: { type: "t", value: null }, uEDLDepth: { type: "t", value: null }, opacity: { type: "f", value: 1 }, uProj: { type: "Matrix4fv", value: [] }, useEDL: { type: "i", value: 1 } }; return e.setValues({ uniforms: t, vertexShader: e.getDefines() + Hp["edl.vs"], fragmentShader: e.getDefines() + Hp["edl.fs"], lights: !1 }), e.neighbourCount = 8, e } return h(i, [{ key: "getDefines", value: function() { var e = ""; return e += "#define NEIGHBOUR_COUNT " + this.neighbourCount + "\n" } }, { key: "updateShaderSource", value: function() { var e = this.getDefines() + Hp["edl.vs"] , t = this.getDefines() + Hp["edl.fs"]; this.setValues({ vertexShader: e, fragmentShader: t }), this.uniforms.neighbours.value = this.neighbours, this.needsUpdate = !0 } }, { key: "neighbourCount", get: function() { return this._neighbourCount }, set: function(e) { if (this._neighbourCount !== e) { this._neighbourCount = e, this.neighbours = new Float32Array(2 * this._neighbourCount); for (var t = 0; t < this._neighbourCount; t++) this.neighbours[2 * t + 0] = Math.cos(2 * t * Math.PI / this._neighbourCount), this.neighbours[2 * t + 1] = Math.sin(2 * t * Math.PI / this._neighbourCount); this.updateShaderSource() } } }]), i }() , Mv = function() { y(n, Gu); var t = w(n); function n() { O(this, n); var e; return (e = t.call(this)).setValues({ uniforms: { screenWidth: { type: "f", value: 0 }, screenHeight: { type: "f", value: 0 }, edlStrength: { type: "f", value: 1 }, radius: { type: "f", value: 1 }, neighbours: { type: "2fv", value: [] }, uEDLMap: { type: "t", value: null }, uDepthMap: { type: "t", value: null }, uWeightMap: { type: "t", value: null } }, vertexShader: e.getDefines() + Hp["normalize.vs"], fragmentShader: e.getDefines() + Hp["normalize_and_edl.fs"] }), e.neighbourCount = 8, e } return h(n, [{ key: "getDefines", value: function() { var e = ""; return e += "#define NEIGHBOUR_COUNT " + this.neighbourCount + "\n" } }, { key: "updateShaderSource", value: function() { var e = this.getDefines() + Hp["normalize.vs"] , t = this.getDefines() + Hp["normalize_and_edl.fs"]; this.setValues({ vertexShader: e, fragmentShader: t }), this.uniforms.neighbours.value = this.neighbours, this.needsUpdate = !0 } }, { key: "neighbourCount", get: function() { return this._neighbourCount }, set: function(e) { if (this._neighbourCount !== e) { this._neighbourCount = e, this.neighbours = new Float32Array(2 * this._neighbourCount); for (var t = 0; t < this._neighbourCount; t++) this.neighbours[2 * t + 0] = Math.cos(2 * t * Math.PI / this._neighbourCount), this.neighbours[2 * t + 1] = Math.sin(2 * t * Math.PI / this._neighbourCount); this.updateShaderSource() } } }]), n }() , Av = function() { y(n, Gu); var t = w(n); function n() { O(this, n); var e; return (e = t.call(this)).setValues({ uniforms: { uDepthMap: { type: "t", value: null }, uWeightMap: { type: "t", value: null } }, vertexShader: e.getDefines() + Hp["normalize.vs"], fragmentShader: e.getDefines() + Hp["normalize.fs"] }), e } return h(n, [{ key: "getDefines", value: function() { return "" } }, { key: "updateShaderSource", value: function() { var e = this.getDefines() + Hp["normalize.vs"] , t = this.getDefines() + Hp["normalize.fs"]; this.setValues({ vertexShader: e, fragmentShader: t }), this.needsUpdate = !0 } }]), n }() , Tv = function() { function d(e, t) { O(this, d), this.version = "string" == typeof e ? new Km(e) : e, this.extension = t } var n; return h(d, [{ key: "load", value: function(t) { var n, i, r = this; t.loaded || (n = t.getURL(), this.version.equalOrHigher("1.4") && (n += ".".concat(this.extension)), (i = Gp.createXMLHttpRequest()).open("GET", n, !0), i.responseType = "arraybuffer", i.overrideMimeType("text/plain; charset=x-user-defined"), i.onreadystatechange = function() { var e; 4 === i.readyState && (200 === i.status || 0 === i.status ? (e = i.response, r.parse(t, e)) : console.log("Failed to load file! HTTP status: " + i.status + ", file: " + n)) } , i.send(null)) } }, { key: "parse", value: (n = r(regeneratorRuntime.mark(function e(t, n) { var i, r, a, o, s, l, u, c; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return i = new LASFile(n), r = new Sv(t), e.prev = 2, e.next = 5, i.open(); case 5: i.isOpen = !0, e.next = 12; break; case 8: return e.prev = 8, e.t0 = e.catch(2), console.log("failed to open file. :("), e.abrupt("return"); case 12: return e.next = 14, i.getHeader(); case 14: a = e.sent, s = 0, l = (o = 1) <= 1 ? a.pointsCount : a.pointsCount / o, u = !0; case 19: if (u) return e.next = 22, i.readData(1e6, 0, o); e.next = 29; break; case 22: c = e.sent, r.push(new LASDecoder(c.buffer,a.pointsFormatId,a.pointsStructSize,c.count,a.scale,a.offset,a.mins,a.maxs)), s += c.count, d.progressCB(s / l), u = c.hasMoreData, e.next = 19; break; case 29: return a.totalRead = s, a.versionAsString = i.versionAsString, a.isCompressed = i.isCompressed, d.progressCB(1), e.prev = 33, e.next = 36, i.close(); case 36: i.isOpen = !1, e.next = 43; break; case 39: throw e.prev = 39, e.t1 = e.catch(33), console.error("failed to close las/laz file!!!"), e.t1; case 43: case "end": return e.stop() } }, e, null, [[2, 8], [33, 39]]) })), function(e, t) { return n.apply(this, arguments) } ) }, { key: "handle", value: function(e, t) {} }], [{ key: "progressCB", value: function() {} }]), d }() , Sv = function() { function t(e) { O(this, t), this.node = e } return h(t, [{ key: "push", value: function(h) { var p = this , f = Potree.scriptPath + "/workers/LASDecoderWorker.js" , m = Potree.workerPool.getWorker(f) , v = this.node.pcoGeometry.pointAttributes; m.onmessage = function(i) { var e = new Mr , t = h.pointsCount , n = new Float32Array(i.data.position) , r = new Uint8Array(i.data.color) , a = new Float32Array(i.data.intensity) , o = new Uint8Array(i.data.classification) , s = new Uint8Array(i.data.returnNumber) , l = new Uint8Array(i.data.numberOfReturns) , u = new Uint16Array(i.data.pointSourceID) , c = new Uint8Array(i.data.indices); e.setAttribute("position", new nr(n,3)), e.setAttribute("color", new nr(r,4,!0)), e.setAttribute("intensity", new nr(a,1)), e.setAttribute("classification", new nr(o,1)), e.setAttribute("return number", new nr(s,1)), e.setAttribute("number of returns", new nr(l,1)), e.setAttribute("source id", new nr(u,1)), e.setAttribute("indices", new nr(c,4)), e.attributes.indices.normalized = !0; for (var d in i.data.ranges) !function(t) { var e = i.data.ranges[t] , n = v.attributes.find(function(e) { return e.name === t }); n.range[0] = Math.min(n.range[0], e[0]), n.range[1] = Math.max(n.range[1], e[1]) }(d); c = new kn((new Cn).fromArray(i.data.tightBoundingBox.min),(new Cn).fromArray(i.data.tightBoundingBox.max)); e.boundingBox = p.node.boundingBox, p.node.tightBoundingBox = c, p.node.geometry = e, p.node.numPoints = t, p.node.loaded = !0, p.node.loading = !1, Potree.numNodesLoading--, p.node.mean = B(Cn, Q(i.data.mean)), Potree.workerPool.returnWorker(f, m) } ; var e = { buffer: h.arrayb, numPoints: h.pointsCount, pointSize: h.pointSize, pointFormatID: 2, scale: h.scale, offset: h.offset, mins: h.mins, maxs: h.maxs }; m.postMessage(e, [e.buffer]) } }]), t }() , Cv = function() { function i(e, t, n) { O(this, i), this.version = "string" == typeof e ? new Km(e) : e, this.boundingBox = t, this.scale = n } return h(i, [{ key: "load", value: function(t) { var n = this; if (!t.loaded) { var i = t.getURL(); this.version.equalOrHigher("1.4") && (i += ".bin"), i += "?m=" + t.pcoGeometry.timeStamp; var r = Gp.createXMLHttpRequest(); r.open("GET", i, !0), r.responseType = "arraybuffer", r.overrideMimeType("text/plain; charset=x-user-defined"), r.onreadystatechange = function() { if (4 === r.readyState) { if (200 !== r.status && 0 !== r.status || null === r.response) throw new Error("Failed to load file! HTTP status: ".concat(r.status, ", file: ").concat(i)); var e = r.response; n.parse(t, e) } } ; try { r.send(null) } catch (e) { console.log("fehler beim laden der punktwolke: " + e) } } } }, { key: "parse", value: function(o, e) { var s = o.pcoGeometry.pointAttributes , t = e.byteLength / o.pcoGeometry.pointAttributes.byteSize; this.version.upTo("1.5") && (o.numPoints = t); var l = Potree.scriptPath + "/workers/BinaryDecoderWorker.js" , u = Potree.workerPool.getWorker(l); u.onmessage = function(e) { var t = e.data , r = t.attributeBuffers , n = new kn((new Cn).fromArray(t.tightBoundingBox.min),(new Cn).fromArray(t.tightBoundingBox.max)); Potree.workerPool.returnWorker(l, u); var i, a = new Mr; for (i in r) !function(e) { var t, n = r[e].buffer, i = r[e].attribute; "POSITION_CARTESIAN" === e ? a.setAttribute("position", new nr(new Float32Array(n),3)) : "rgba" === e ? a.setAttribute("rgba", new nr(new Uint8Array(n),4,!0)) : "NORMAL_SPHEREMAPPED" === e || "NORMAL_OCT16" === e || "NORMAL" === e ? a.setAttribute("normal", new nr(new Float32Array(n),3)) : "INDICES" === e ? ((t = new nr(new Uint8Array(n),4)).normalized = !0, a.setAttribute("indices", t)) : "SPACING" === e ? (t = new nr(new Float32Array(n),1), a.setAttribute("spacing", t)) : ((n = new nr(new Float32Array(n),1)).potree = { offset: r[e].offset, scale: r[e].scale, preciseBuffer: r[e].preciseBuffer, range: i.range }, a.setAttribute(e, n), (n = s.attributes.find(function(e) { return e.name === i.name })).range[0] = Math.min(n.range[0], i.range[0]), n.range[1] = Math.max(n.range[1], i.range[1]), 0 === o.getLevel() && (n.initialRange = i.range)) }(i); n.max.sub(n.min), n.min.set(0, 0, 0); e = e.data.buffer.byteLength / s.byteSize; o.numPoints = e, o.geometry = a, o.mean = B(Cn, Q(t.mean)), o.tightBoundingBox = n, o.loaded = !0, o.loading = !1, o.estimatedSpacing = t.estimatedSpacing, Potree.numNodesLoading-- } ; e = { buffer: e, pointAttributes: s, version: this.version.version, min: [o.boundingBox.min.x, o.boundingBox.min.y, o.boundingBox.min.z], offset: [o.pcoGeometry.offset.x, o.pcoGeometry.offset.y, o.pcoGeometry.offset.z], scale: this.scale, spacing: o.spacing, hasChildren: o.hasChildren, name: o.name }; u.postMessage(e, [e.buffer]) } }]), i }(); function Pv(e) { var t = new Km(e.version) , n = { COLOR_PACKED: "rgba", RGBA: "rgba", INTENSITY: "intensity", CLASSIFICATION: "classification", GPS_TIME: "gps-time" } , i = []; if (t.upTo("1.7")) { var r, a = ue(e.pointAttributes); try { for (a.s(); !(r = a.n()).done; ) { var o = r.value , s = Am[o] , l = { name: s.name, size: s.byteSize, elements: s.numElements, elementSize: s.byteSize / s.numElements, type: s.type.name, description: "" }; i.push(l) } } catch (e) { a.e(e) } finally { a.f() } } else i.push.apply(i, Q(e.pointAttributes)); for (var u = new Sm, c = { int8: Em.DATA_TYPE_INT8, int16: Em.DATA_TYPE_INT16, int32: Em.DATA_TYPE_INT32, int64: Em.DATA_TYPE_INT64, uint8: Em.DATA_TYPE_UINT8, uint16: Em.DATA_TYPE_UINT16, uint32: Em.DATA_TYPE_UINT32, uint64: Em.DATA_TYPE_UINT64, double: Em.DATA_TYPE_DOUBLE, float: Em.DATA_TYPE_FLOAT }, d = 0, h = i; d < h.length; d++) { var p, f, m, v = h[d]; null != v.name ? (p = (m = v.name, n[m] || m), f = c[v.type], m = v.elements, v.description, m = new Am(p,f,m), u.add(m)) : (v = Am[v], u.add(v)) } return void 0 !== i.find(function(e) { return "NormalX" === e.name }) && void 0 !== i.find(function(e) { return "NormalY" === e.name }) && void 0 !== i.find(function(e) { return "NormalZ" === e.name }) && u.addVector({ name: "NORMAL", attributes: ["NormalX", "NormalY", "NormalZ"] }), u } function Dv() { var e = new Sm; return e.add(Am.POSITION_CARTESIAN), e.add(new Am("rgba",Em.DATA_TYPE_UINT8,4)), e.add(new Am("intensity",Em.DATA_TYPE_UINT16,1)), e.add(new Am("classification",Em.DATA_TYPE_UINT8,1)), e.add(new Am("gps-time",Em.DATA_TYPE_DOUBLE,1)), e.add(new Am("number of returns",Em.DATA_TYPE_UINT8,1)), e.add(new Am("return number",Em.DATA_TYPE_UINT8,1)), e.add(new Am("source id",Em.DATA_TYPE_UINT16,1)), e } var kv = function() { function e() { O(this, e) } return h(e, [{ key: "loadPointAttributes", value: function(e) { for (var t = e.pointAttributes, n = new Sm, i = 0; i < t.length; i++) { var r = Am[t[i]]; n.add(r) } return n } }, { key: "createChildAABB", value: function(e, t) { var n = e.min.clone() , i = e.max.clone() , e = (new Cn).subVectors(i, n); return 0 < (1 & t) ? n.z += e.z / 2 : i.z -= e.z / 2, 0 < (2 & t) ? n.y += e.y / 2 : i.y -= e.y / 2, 0 < (4 & t) ? n.x += e.x / 2 : i.x -= e.x / 2, new kn(n,i) } }], [{ key: "load", value: function(h, e, p) { try { var f = new Pm; f.timeStamp = e, f.url = h; var m = Gp.createXMLHttpRequest(); m.open("GET", h + "?m=" + e, !0), m.onreadystatechange = function() { if (4 === m.readyState && (200 === m.status || 0 === m.status)) { var e = JSON.parse(m.responseText) , t = new Km(e.version); 0 === e.octreeDir.indexOf("http") ? f.octreeDir = e.octreeDir : f.octreeDir = h + "/../" + e.octreeDir, f.spacing = e.spacing, f.hierarchyStepSize = e.hierarchyStepSize, f.pointAttributes = e.pointAttributes; var n = new Cn(e.boundingBox.lx,e.boundingBox.ly,e.boundingBox.lz) , i = new Cn(e.boundingBox.ux,e.boundingBox.uy,e.boundingBox.uz) , r = new kn(n,i) , i = r.clone(); e.tightBoundingBox && (i.min.copy(new Cn(e.tightBoundingBox.lx,e.tightBoundingBox.ly,e.tightBoundingBox.lz)), i.max.copy(new Cn(e.tightBoundingBox.ux,e.tightBoundingBox.uy,e.tightBoundingBox.uz))); n = n.clone(); r.min.sub(n), r.max.sub(n), i.min.sub(n), i.max.sub(n), f.boundingBox = r, f.tightBoundingBox = i, f.boundingSphere = r.getBoundingSphere(new qn), f.tightBoundingSphere = i.getBoundingSphere(new qn), f.offset = n, "LAS" === e.pointAttributes ? (f.loader = new Tv(e.version,"las"), f.pointAttributes = Dv()) : "LAZ" === e.pointAttributes ? (f.loader = new Tv(e.version,"laz"), f.pointAttributes = Dv()) : (f.loader = new Cv(e.version,r,e.scale), f.pointAttributes = Pv(e)); var a = {} , r = new Dm("r",f,r); if (r.level = 0, r.hasChildren = !0, r.spacing = f.spacing, t.upTo("1.5") ? r.numPoints = e.hierarchy[0][1] : r.numPoints = 0, f.root = r, f.root.load(), a.r = r, t.upTo("1.4")) for (var o = 1; o < e.hierarchy.length; o++) { var s = e.hierarchy[o][0] , l = e.hierarchy[o][1] , u = parseInt(s.charAt(s.length - 1)) , c = a[s.substring(0, s.length - 1)] , d = s.length - 1 , u = Jf.createChildAABB(c.boundingBox, u) , u = new Dm(s,f,u); u.level = d, u.numPoints = l, u.spacing = f.spacing / Math.pow(2, d), c.addChild(u), a[s] = u } f.nodes = a, p(f) } } , m.send(null) } catch (e) { console.log("loading failed: '" + h + "'"), console.log(e), p() } } }]), e }() , Bv = function() { function e() { O(this, e) } var n; return h(e, null, [{ key: "load", value: (n = r(regeneratorRuntime.mark(function e(t, n) { var i, r; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return e.next = 2, fetch(t); case 2: return i = e.sent, e.next = 5, i.json(); case 5: r = e.sent, i = t.substr(0, t.lastIndexOf("ept.json")), i = new Potree.PointCloudEptGeometry(i,r), r = new Potree.PointCloudEptGeometryNode(i), i.root = r, i.root.load(), n(i); case 12: case "end": return e.stop() } }, e) })), function(e, t) { return n.apply(this, arguments) } ) }]), e }() , Lv = function() { function e() { O(this, e) } return h(e, [{ key: "extension", value: function() { return ".bin" } }, { key: "workerPath", value: function() { return Potree.scriptPath + "/workers/EptBinaryDecoderWorker.js" } }, { key: "load", value: function(t) { var n = this; if (!t.loaded) { var i = t.url() + this.extension() , r = Gp.createXMLHttpRequest(); r.open("GET", i, !0), r.responseType = "arraybuffer", r.overrideMimeType("text/plain; charset=x-user-defined"), r.onreadystatechange = function() { var e; 4 === r.readyState && (200 === r.status ? (e = r.response, n.parse(t, e)) : console.log("Failed " + i + ": " + r.status)) } ; try { r.send(null) } catch (e) { console.log("Failed request: " + e) } } } }, { key: "parse", value: function(s, e) { var l = this.workerPath() , u = Potree.workerPool.getWorker(l); u.onmessage = function(e) { var t = new Mr , n = e.data.numPoints , i = new Float32Array(e.data.position); t.setAttribute("position", new nr(i,3)); var r, a, i = new Uint8Array(e.data.indices); t.setAttribute("indices", new nr(i,4)), e.data.color && (i = new Uint8Array(e.data.color), t.setAttribute("color", new nr(i,4,!0))), e.data.intensity && (r = new Float32Array(e.data.intensity), t.setAttribute("intensity", new nr(r,1))), e.data.classification && (r = new Uint8Array(e.data.classification), t.setAttribute("classification", new nr(r,1))), e.data.returnNumber && (a = new Uint8Array(e.data.returnNumber), t.setAttribute("return number", new nr(a,1))), e.data.numberOfReturns && (a = new Uint8Array(e.data.numberOfReturns), t.setAttribute("number of returns", new nr(a,1))), e.data.pointSourceId && (o = new Uint16Array(e.data.pointSourceId), t.setAttribute("source id", new nr(o,1))), t.attributes.indices.normalized = !0; var o = new kn((new Cn).fromArray(e.data.tightBoundingBox.min),(new Cn).fromArray(e.data.tightBoundingBox.max)); s.doneLoading(t, o, n, B(Cn, Q(e.data.mean))), Potree.workerPool.returnWorker(l, u) } ; e = { buffer: e, schema: s.ept.schema, scale: s.ept.eptScale, offset: s.ept.eptOffset, mins: [(e = s.key.b.min).x, e.y, e.z] }; u.postMessage(e, [e.buffer]) } }]), e }() , wh = function() { function e() { O(this, e) } var n; return h(e, [{ key: "load", value: function(t) { var n, i, r = this; t.loaded || (n = t.url() + ".laz", (i = Gp.createXMLHttpRequest()).open("GET", n, !0), i.responseType = "arraybuffer", i.overrideMimeType("text/plain; charset=x-user-defined"), i.onreadystatechange = function() { var e; 4 === i.readyState && (200 === i.status ? (e = i.response, r.parse(t, e)) : console.log("Failed " + n + ": " + i.status)) } , i.send(null)) } }, { key: "parse", value: (n = r(regeneratorRuntime.mark(function e(t, n) { var i, r, a, o, s, l, u, c, d; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return i = new LASFile(n), r = new Rv(t), e.prev = 2, e.next = 5, i.open(); case 5: return i.isOpen = !0, e.next = 8, i.getHeader(); case 8: a = e.sent, o = 0, s = (d = function(e) { return [e.x, e.y, e.z] } )(t.key.b.min), l = d(t.key.b.max), u = !0; case 14: if (u) return e.next = 17, i.readData(1e6, 0, 1); e.next = 26; break; case 17: c = e.sent, (d = new LASDecoder(c.buffer,a.pointsFormatId,a.pointsStructSize,c.count,a.scale,a.offset,s,l)).extraBytes = a.extraBytes, d.pointsFormatId = a.pointsFormatId, r.push(d), o += c.count, u = c.hasMoreData, e.next = 14; break; case 26: return a.totalRead = o, a.versionAsString = i.versionAsString, a.isCompressed = i.isCompressed, e.next = 31, i.close(); case 31: i.isOpen = !1, e.next = 42; break; case 34: if (e.prev = 34, e.t0 = e.catch(2), console.error("Error reading LAZ:", e.t0), i.isOpen) return e.next = 40, i.close(); e.next = 41; break; case 40: i.isOpen = !1; case 41: throw e.t0; case 42: case "end": return e.stop() } }, e, null, [[2, 34]]) })), function(e, t) { return n.apply(this, arguments) } ) }]), e }() , Rv = function() { function t(e) { O(this, t), this.node = e } return h(t, [{ key: "push", value: function(h) { var p = this , f = Potree.scriptPath + "/workers/EptLaszipDecoderWorker.js" , m = Potree.workerPool.getWorker(f); m.onmessage = function(e) { var t = new Mr , n = h.pointsCount , i = new Float32Array(e.data.position) , r = new Uint8Array(e.data.color) , a = new Float32Array(e.data.intensity) , o = new Uint8Array(e.data.classification) , s = new Uint8Array(e.data.returnNumber) , l = new Uint8Array(e.data.numberOfReturns) , u = new Uint16Array(e.data.pointSourceID) , c = new Uint8Array(e.data.indices) , d = new Float32Array(e.data.gpsTime); t.setAttribute("position", new nr(i,3)), t.setAttribute("rgba", new nr(r,4,!0)), t.setAttribute("intensity", new nr(a,1)), t.setAttribute("classification", new nr(o,1)), t.setAttribute("return number", new nr(s,1)), t.setAttribute("number of returns", new nr(l,1)), t.setAttribute("source id", new nr(u,1)), t.setAttribute("indices", new nr(c,4)), t.setAttribute("gpsTime", new nr(d,1)), p.node.gpsTime = e.data.gpsMeta, t.attributes.indices.normalized = !0; d = new kn((new Cn).fromArray(e.data.tightBoundingBox.min),(new Cn).fromArray(e.data.tightBoundingBox.max)); p.node.doneLoading(t, d, n, B(Cn, Q(e.data.mean))), Potree.workerPool.returnWorker(f, m) } ; var e = { buffer: h.arrayb, numPoints: h.pointsCount, pointSize: h.pointSize, pointFormatID: h.pointsFormatId, scale: h.scale, offset: h.offset, mins: h.mins, maxs: h.maxs }; m.postMessage(e, [e.buffer]) } }]), t }() , Pu = function() { y(t, Lv); var e = w(t); function t() { return O(this, t), e.apply(this, arguments) } return h(t, [{ key: "extension", value: function() { return ".zst" } }, { key: "workerPath", value: function() { return Potree.scriptPath + "/workers/EptZstandardDecoderWorker.js" } }]), t }() , ku = function() { function e() { O(this, e), this.transform = null } var t, n; return h(e, [{ key: "load", value: (n = r(regeneratorRuntime.mark(function e(t) { var n, i, r, a, o, s, l; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return n = new lf({ color: 16711680, lineWidth: 3, resolution: new yn(1e3,1e3), dashed: !1 }), e.next = 3, this.loadShapefileFeatures(t); case 3: l = e.sent, i = new Si, r = ue(l); try { for (r.s(); !(a = r.n()).done; ) o = a.value, s = this.featureToSceneNode(o, n), i.add(s) } catch (e) { r.e(e) } finally { r.f() } return l = { features: l, node: i, setResolution: function(e, t) { n.resolution.set(e, t) } }, e.abrupt("return", l); case 10: case "end": return e.stop() } }, e, this) })), function(e) { return n.apply(this, arguments) } ) }, { key: "featureToSceneNode", value: function(e, t) { var n = e.geometry , i = (new Yi(1,1,1), this.transform); if (null === i && (i = { forward: function(e) { return e } }), "Point" === e.geometry.type) { var r = new Hr(new Su(1,18,18),new Xu) , a = N(n.coordinates, 2) , o = a[0] , a = a[1] , o = i.forward([o, a]); return (a = r.position).set.apply(a, Q(o).concat([20])), r.scale.set(10, 10, 10), r } if ("LineString" === n.type) { for (var s = [], l = new Cn(1 / 0,1 / 0,1 / 0), u = 0; u < n.coordinates.length; u++) { var c = N(n.coordinates[u], 2) , d = c[0] , c = c[1] , c = i.forward([d, c]); l.x = Math.min(l.x, c[0]), l.y = Math.min(l.y, c[1]), l.z = Math.min(l.z, 20), s.push.apply(s, Q(c).concat([20])), 0 < u && u < n.coordinates.length - 1 && s.push.apply(s, Q(c).concat([20])) } for (var h = 0; h < s.length; h += 3) s[h + 0] -= l.x, s[h + 1] -= l.y, s[h + 2] -= l.z; r = new Mf; r.setPositions(s); r = new Af(r,t); return r.computeLineDistances(), r.scale.set(1, 1, 1), r.position.copy(l), r } if ("Polygon" === n.type) { var p, f = ue(n.coordinates); try { for (f.s(); !(p = f.n()).done; ) { for (var m = p.value, v = [], g = new Cn(1 / 0,1 / 0,1 / 0), y = 0; y < m.length; y++) { var w = N(m[y], 2) , b = w[0] , x = w[1] , E = i.forward([b, x]); g.x = Math.min(g.x, E[0]), g.y = Math.min(g.y, E[1]), g.z = Math.min(g.z, 20), v.push.apply(v, Q(E).concat([20])), 0 < y && y < m.length - 1 && v.push.apply(v, Q(E).concat([20])) } for (var _ = 0; _ < v.length; _ += 3) v[_ + 0] -= g.x, v[_ + 1] -= g.y, v[_ + 2] -= g.z; var M = new Mf; M.setPositions(v); var A = new Af(M,t); return A.computeLineDistances(), A.scale.set(1, 1, 1), A.position.copy(g), A } } catch (e) { f.e(e) } finally { f.f() } } else console.log("unhandled feature: ", e) } }, { key: "loadShapefileFeatures", value: (t = r(regeneratorRuntime.mark(function e(t) { var n, i, r; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return n = [], e.next = 3, shapefile.open(t); case 3: i = e.sent; case 4: return e.next = 7, i.read(); case 7: if ((r = e.sent).done) return e.abrupt("break", 13); e.next = 10; break; case 10: r.value && "Feature" === r.value.type && void 0 !== r.value.geometry && n.push(r.value), e.next = 4; break; case 13: return e.abrupt("return", n); case 14: case "end": return e.stop() } }, e) })), function(e) { return t.apply(this, arguments) } ) }]), e }() , Fv = { landuse: [.5, .5, .5], natural: [0, 1, 0], places: [1, 0, 1], points: [0, 1, 1], roads: [1, 1, 0], waterways: [0, 0, 1], default: [.9, .6, .1] }; var Iv, Ov, zv, Nv, Uv, Gv, Hv = h(function e() { O(this, e), this.path = null, this.node = null }), Fu = function() { function _() { O(this, _) } var n, i; return h(_, null, [{ key: "loadUrl", value: (i = r(regeneratorRuntime.mark(function e(t, n) { var i; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return e.next = 2, Promise.all([Jf.loadScript("".concat(Potree.scriptPath, "/lazylibs/geopackage/geopackage.js")), Jf.loadScript("".concat(Potree.scriptPath, "/lazylibs/sql.js/sql-wasm.js"))]); case 2: return e.next = 4, fetch(t); case 4: return i = e.sent, e.next = 7, i.arrayBuffer(); case 7: return i = e.sent, (n = n || {}).source = t, e.abrupt("return", _.loadBuffer(i, n)); case 11: case "end": return e.stop() } }, e) })), function(e, t) { return i.apply(this, arguments) } ) }, { key: "loadBuffer", value: (n = r(regeneratorRuntime.mark(function e(x, E) { var t; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return e.next = 2, Promise.all([Jf.loadScript("".concat(Potree.scriptPath, "/lazylibs/geopackage/geopackage.js")), Jf.loadScript("".concat(Potree.scriptPath, "/lazylibs/sql.js/sql-wasm.js"))]); case 2: return E = E || {}, t = function() { var t = r(regeneratorRuntime.mark(function e(t) { var n, i, r, a, o, s, l, u, c, d, h, p, f, m, v, g, y, w, b; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return n = (n = E.transform) || { forward: function(e) { return e } }, i = "".concat(Potree.scriptPath, "/lazylibs/sql.js/sql-wasm.wasm"), e.next = 5, initSqlJs({ locateFile: function(e) { return i } }); case 5: return e.sent, o = new Uint8Array(x), e.next = 9, geopackage.open(o); case 9: r = e.sent, window.data = r, (o = new Si).name = E.source, o.potree = { source: E.source }, (a = new Hv).path = E.source, a.node = o, o = r.getTables(), s = ue(o.features); try { for (s.s(); !(l = s.n()).done; ) for (c = l.value, d = r.getFeatureDao(c), h = (h = d.getBoundingBox()).projectBoundingBox(d.projection, "EPSG:4326"), p = r.queryForGeoJSONFeaturesInTable(c, h), f = new lf({ color: (u = new Yi).setRGB.apply(u, Q(Fv[c] || Fv.default)), lineWidth: 2, resolution: new yn(1e3,1e3), dashed: !1 }), (m = new Si).name = c, a.node.add(m), v = 0, g = Object.entries(p); v < g.length; v++) y = N(g[v], 2), y[0], w = y[1], b = _.featureToSceneNode(w, f, d.projection, n), m.add(b) } catch (e) { s.e(e) } finally { s.f() } t(a); case 21: case "end": return e.stop() } }, e) })); return function(e) { return t.apply(this, arguments) } }(), e.abrupt("return", new Promise(t)); case 5: case "end": return e.stop() } }, e) })), function(e, t) { return n.apply(this, arguments) } ) }, { key: "featureToSceneNode", value: function(e, t, n, i) { var r = e.geometry; new Yi(1,1,1); if ("Point" === e.geometry.type) { var a = new Hr(new Su(1,18,18),new Xu) , o = N(r.coordinates, 2) , s = o[0] , o = o[1] , s = i.forward(n.forward([s, o])); return (o = a.position).set.apply(o, Q(s).concat([20])), a.scale.set(10, 10, 10), a } if ("LineString" === r.type) { for (var l = [], u = new Cn(1 / 0,1 / 0,1 / 0), c = 0; c < r.coordinates.length; c++) { var d = N(r.coordinates[c], 2) , h = d[0] , d = d[1] , d = i.forward(n.forward([h, d])); u.x = Math.min(u.x, d[0]), u.y = Math.min(u.y, d[1]), u.z = Math.min(u.z, 20), l.push.apply(l, Q(d).concat([20])), 0 < c && c < r.coordinates.length - 1 && l.push.apply(l, Q(d).concat([20])) } for (var p = 0; p < l.length; p += 3) l[p + 0] -= u.x, l[p + 1] -= u.y, l[p + 2] -= u.z; a = new Mf; a.setPositions(l); a = new Af(a,t); return a.computeLineDistances(), a.scale.set(1, 1, 1), a.position.copy(u), a } if ("Polygon" === r.type) { var f, m = ue(r.coordinates); try { for (m.s(); !(f = m.n()).done; ) { for (var v = f.value, g = [], y = new Cn(1 / 0,1 / 0,1 / 0), w = 0; w < v.length; w++) { var b = N(v[w], 2) , x = b[0] , E = b[1] , _ = i.forward(n.forward([x, E])); y.x = Math.min(y.x, _[0]), y.y = Math.min(y.y, _[1]), y.z = Math.min(y.z, 20), g.push.apply(g, Q(_).concat([20])), 0 < w && w < v.length - 1 && g.push.apply(g, Q(_).concat([20])) } for (var M = 0; M < g.length; M += 3) g[M + 0] -= y.x, g[M + 1] -= y.y, g[M + 2] -= y.z; var A = new Mf; A.setPositions(g); var T = new Af(A,t); return T.computeLineDistances(), T.scale.set(1, 1, 1), T.position.copy(y), T } } catch (e) { m.e(e) } finally { m.f() } } else console.log("unhandled feature: ", e) } }]), _ }(), Vv = function() { y(o, Si); var a = w(o); function o() { var n, e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; O(this, o), (n = a.call(this)).constructor.counter = void 0 === n.constructor.counter ? 0 : n.constructor.counter + 1, n.name = "clip_volume_" + n.constructor.counter; var t = e.alpha || 0 , i = e.beta || 0 , e = e.gamma || 0; n.rotation.x = t, n.rotation.y = i, n.rotation.z = e, n.clipOffset = .001, n.clipRotOffset = 1; t = new Cl(1,1,1); t.computeBoundingBox(); i = new Sl; i.vertices.push(new Cn(-.5,-.5,.5)), i.vertices.push(new Cn(.5,-.5,.5)), i.vertices.push(new Cn(.5,-.5,.5)), i.vertices.push(new Cn(.5,-.5,-.5)), i.vertices.push(new Cn(.5,-.5,-.5)), i.vertices.push(new Cn(-.5,-.5,-.5)), i.vertices.push(new Cn(-.5,-.5,-.5)), i.vertices.push(new Cn(-.5,-.5,.5)), i.vertices.push(new Cn(-.5,.5,.5)), i.vertices.push(new Cn(.5,.5,.5)), i.vertices.push(new Cn(.5,.5,.5)), i.vertices.push(new Cn(.5,.5,-.5)), i.vertices.push(new Cn(.5,.5,-.5)), i.vertices.push(new Cn(-.5,.5,-.5)), i.vertices.push(new Cn(-.5,.5,-.5)), i.vertices.push(new Cn(-.5,.5,.5)), i.vertices.push(new Cn(-.5,-.5,.5)), i.vertices.push(new Cn(-.5,.5,.5)), i.vertices.push(new Cn(.5,-.5,.5)), i.vertices.push(new Cn(.5,.5,.5)), i.vertices.push(new Cn(.5,-.5,-.5)), i.vertices.push(new Cn(.5,.5,-.5)), i.vertices.push(new Cn(-.5,-.5,-.5)), i.vertices.push(new Cn(-.5,.5,-.5)), i.colors.push(new Cn(1,1,1)); e = new Sl; e.vertices.push(new Cn(-.5,-.5,0)), e.vertices.push(new Cn(-.5,.5,0)), e.vertices.push(new Cn(.5,.5,0)), e.vertices.push(new Cn(.5,-.5,0)), e.vertices.push(new Cn(-.5,.5,0)), e.vertices.push(new Cn(.5,.5,0)), e.vertices.push(new Cn(-.5,-.5,0)), e.vertices.push(new Cn(.5,-.5,0)), n.dimension = new Cn(1,1,1), n.material = new $i({ color: 65280, transparent: !0, opacity: .3, depthTest: !0, depthWrite: !1 }), n.box = new Hr(t,n.material), n.box.geometry.computeBoundingBox(), n.boundingBox = n.box.geometry.boundingBox, n.add(n.box), n.frame = new cl(i,new tl({ color: 0 })), n.add(n.frame), n.planeFrame = new cl(e,new tl({ color: 16711680 })), n.add(n.planeFrame), n.setScaleZ(.1); function r(e, t, n) { var i = new $i({ color: n, depthTest: !1, depthWrite: !1 }) , r = new Sl; return r.vertices.push(new Cn(0,0,0)), r.vertices.push(new Cn(0,1,0)), (r = new sl(r,new tl({ color: n, depthTest: !1, depthWrite: !1, transparent: !0 }))).name = e + "_shaft", (n = new Hr(new Bl(0,.04,.1,10,1,!1),i)).name = e + "_head", n.position.y = 1, (i = new Si).name = e, i.add(r), i.add(n), i } return n.arrowX = r("arrow_x", new Cn(1,0,0), 16711680), n.arrowY = r("arrow_y", new Cn(0,1,0), 65280), n.arrowZ = r("arrow_z", new Cn(0,0,1), 255), n.arrowX.rotation.z = -Math.PI / 2, n.arrowZ.rotation.x = Math.PI / 2, n.arrowX.visible = !1, n.arrowY.visible = !1, n.arrowZ.visible = !1, n.add(n.arrowX), n.add(n.arrowY), n.add(n.arrowZ), n.addEventListener("ui_select", function(e) { n.arrowX.visible = !0, n.arrowY.visible = !0, n.arrowZ.visible = !0 }), n.addEventListener("ui_deselect", function(e) { n.arrowX.visible = !1, n.arrowY.visible = !1, n.arrowZ.visible = !1 }), n.addEventListener("select", function(e) { var t = $("#" + n.name + " .scene_header"); t.next().is(":visible") || t.click() }), n.addEventListener("deselect", function(e) { var t = $("#" + n.name + " .scene_header"); t.next().is(":visible") && t.click() }), n.update(), n } return h(o, [{ key: "setClipOffset", value: function(e) { this.clipOffset = e } }, { key: "setClipRotOffset", value: function(e) { this.clipRotOffset = e } }, { key: "setScaleX", value: function(e) { this.box.scale.x = e, this.frame.scale.x = e, this.planeFrame.scale.x = e } }, { key: "setScaleY", value: function(e) { this.box.scale.y = e, this.frame.scale.y = e, this.planeFrame.scale.y = e } }, { key: "setScaleZ", value: function(e) { this.box.scale.z = e, this.frame.scale.z = e, this.planeFrame.scale.z = e } }, { key: "offset", value: function(e) { var t = e.cs || null , n = e.axis || null , e = e.dir || null; t && n && e && ("x" === n ? "local" === t ? this.position.add(this.localX.clone().multiplyScalar(e * this.clipOffset)) : "global" === t && (this.position.x = this.position.x + e * this.clipOffset) : "y" === n ? "local" === t ? this.position.add(this.localY.clone().multiplyScalar(e * this.clipOffset)) : "global" === t && (this.position.y = this.position.y + e * this.clipOffset) : "z" === n && ("local" === t ? this.position.add(this.localZ.clone().multiplyScalar(e * this.clipOffset)) : "global" === t && (this.position.z = this.position.z + e * this.clipOffset)), this.dispatchEvent({ type: "clip_volume_changed", viewer: viewer, volume: this })) } }, { key: "rotate", value: function(e) { var t = e.cs || null , n = e.axis || null , e = e.dir || null; t && n && e && ("local" === t ? "x" === n ? this.rotateOnAxis(new Cn(1,0,0), e * this.clipRotOffset * Math.PI / 180) : "y" === n ? this.rotateOnAxis(new Cn(0,1,0), e * this.clipRotOffset * Math.PI / 180) : "z" === n && this.rotateOnAxis(new Cn(0,0,1), e * this.clipRotOffset * Math.PI / 180) : "global" === t && (t = new Mn(1,0,0,0), "y" === n ? t = new Mn(0,1,0,0) : "z" === n && (t = new Mn(0,0,1,0)), this.updateMatrixWorld(), n = newthis.matrixWorld.clone().invert(), t = t.applyMatrix4(n).normalize(), t = new Cn(t.x,t.y,t.z), this.rotateOnAxis(t, e * this.clipRotOffset * Math.PI / 180)), this.updateLocalSystem(), this.dispatchEvent({ type: "clip_volume_changed", viewer: viewer, volume: this })) } }, { key: "update", value: function() { this.boundingBox = this.box.geometry.boundingBox, this.boundingSphere = this.boundingBox.getBoundingSphere(new qn), this.box.visible = !1, this.updateLocalSystem() } }, { key: "updateLocalSystem", value: function() { var e = this.getWorldQuaternion(); this.localX = new Cn(1,0,0).applyQuaternion(e).normalize(), this.localY = new Cn(0,1,0).applyQuaternion(e).normalize(), this.localZ = new Cn(0,0,1).applyQuaternion(e).normalize() } }, { key: "raycast", value: function(e, t) { var n = []; this.box.raycast(e, n), 0 < n.length && t.push({ distance: (n = n[0]).distance, object: this, point: n.point.clone() }) } }]), o }(), jv = function() { y(i, hn); var n = w(i); function i(e) { var t; return O(this, i), (t = n.call(this)).viewer = e, t.maxPolygonVertices = 8, t.addEventListener("start_inserting_clipping_volume", function(e) { t.viewer.dispatchEvent({ type: "cancel_insertions" }) }), t.sceneMarker = new gs, t.sceneVolume = new gs, t.sceneVolume.name = "scene_clip_volume", t.viewer.inputHandler.registerInteractiveScene(t.sceneVolume), t.onRemove = function(e) { t.sceneVolume.remove(e.volume) } , t.onAdd = function(e) { t.sceneVolume.add(e.volume) } , t.viewer.inputHandler.addEventListener("delete", function(e) { e.selection.filter(function(e) { return e instanceof Vv }).forEach(function(e) { return t.viewer.scene.removeClipVolume(e) }), e.selection.filter(function(e) { return e instanceof qf }).forEach(function(e) { return t.viewer.scene.removePolygonClipVolume(e) }) }), t } return h(i, [{ key: "setScene", value: function(e) { this.scene !== e && (this.scene && (this.scene.removeEventListeners("clip_volume_added", this.onAdd), this.scene.removeEventListeners("clip_volume_removed", this.onRemove), this.scene.removeEventListeners("polygon_clip_volume_added", this.onAdd), this.scene.removeEventListeners("polygon_clip_volume_removed", this.onRemove)), this.scene = e, this.scene.addEventListener("clip_volume_added", this.onAdd), this.scene.addEventListener("clip_volume_removed", this.onRemove), this.scene.addEventListener("polygon_clip_volume_added", this.onAdd), this.scene.addEventListener("polygon_clip_volume_removed", this.onRemove)) } }, { key: "startInsertion", value: function() { var t = this; if (!((0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).type || null)) return null; var e = this.viewer.renderer.domElement , n = this.viewer.renderer.getSize(new yn) , r = $('\n\t\t\n\n\t\t\t\n\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\n\t\t\t\n\t\t')); $(e.parentElement).append(r); var a = new qf(this.viewer.scene.getActiveCamera().clone()); this.dispatchEvent({ type: "start_inserting_clipping_volume" }), this.viewer.scene.addPolygonClipVolume(a), this.sceneMarker.add(a); function i(i) { i.button === C.LEFT ? (a.addMarker(), r.find("polyline").each(function(e, t) { var n = r[0].createSVGPoint(); n.x = i.offsetX, n.y = i.offsetY; t.points.appendItem(n) }), a.markers.length > t.maxPolygonVertices && o.callback(), t.viewer.inputHandler.startDragging(a.markers[a.markers.length - 1])) : i.button === C.RIGHT && o.callback(i) } var o = { callback: null }; return o.callback = function(e) { r.remove(), 3 < a.markers.length ? (a.removeLastMarker(), a.initialized = !0) : t.viewer.scene.removePolygonClipVolume(a), t.viewer.renderer.domElement.removeEventListener("mouseup", i, !0), t.viewer.removeEventListener("cancel_insertions", o.callback), t.viewer.inputHandler.enabled = !0 } , this.viewer.addEventListener("cancel_insertions", o.callback), this.viewer.renderer.domElement.addEventListener("mouseup", i, !0), this.viewer.inputHandler.enabled = !1, a.addMarker(), this.viewer.inputHandler.startDragging(a.markers[a.markers.length - 1]), a } }, { key: "update", value: function() {} }]), i }(); Ou = {}, Iv = new Mh({ LITTLE: "II", BIG: "MM" }), Ov = new Mh({ BYTE: { value: 1, bytes: 1 }, ASCII: { value: 2, bytes: 1 }, SHORT: { value: 3, bytes: 2 }, LONG: { value: 4, bytes: 4 }, RATIONAL: { value: 5, bytes: 8 }, SBYTE: { value: 6, bytes: 1 }, UNDEFINED: { value: 7, bytes: 1 }, SSHORT: { value: 8, bytes: 2 }, SLONG: { value: 9, bytes: 4 }, SRATIONAL: { value: 10, bytes: 8 }, FLOAT: { value: 11, bytes: 4 }, DOUBLE: { value: 12, bytes: 8 } }), zv = new Mh({ IMAGE_WIDTH: 256, IMAGE_HEIGHT: 257, BITS_PER_SAMPLE: 258, COMPRESSION: 259, PHOTOMETRIC_INTERPRETATION: 262, STRIP_OFFSETS: 273, ORIENTATION: 274, SAMPLES_PER_PIXEL: 277, ROWS_PER_STRIP: 278, STRIP_BYTE_COUNTS: 279, X_RESOLUTION: 282, Y_RESOLUTION: 283, PLANAR_CONFIGURATION: 284, RESOLUTION_UNIT: 296, SOFTWARE: 305, COLOR_MAP: 320, SAMPLE_FORMAT: 339, MODEL_PIXEL_SCALE: 33550, MODEL_TIEPOINT: 33922, GEO_KEY_DIRECTORY: 34735, GEO_DOUBLE_PARAMS: 34736, GEO_ASCII_PARAMS: 34737 }), Nv = new Map([[Ov.BYTE, Uint8Array], [Ov.ASCII, Uint8Array], [Ov.SHORT, Uint16Array], [Ov.LONG, Uint32Array], [Ov.RATIONAL, Uint32Array], [Ov.SBYTE, Int8Array], [Ov.UNDEFINED, Uint8Array], [Ov.SSHORT, Int16Array], [Ov.SLONG, Int32Array], [Ov.SRATIONAL, Int32Array], [Ov.FLOAT, Float32Array], [Ov.DOUBLE, Float64Array]]), Uv = h(function e(t, n, i, r, a) { O(this, e), this.tag = t, this.type = n, this.count = i, this.offset = r, this.value = a }), Gv = h(function e() { O(this, e), this.width = 0, this.height = 0, this.buffer = null, this.metadata = [] }), rh = function() { function e() { O(this, e) } return h(e, null, [{ key: "read", value: function(e) { var t = String.fromCharCode.apply(String, Q(Array.from(e.slice(0, 2)))); Iv.fromValue(t); if (42 !== e.readUInt8(2)) throw new Error("not a valid tiff file"); var n = e.readUInt32LE(4); console.log("offsetToFirstIFD", n); for (var r = [], i = n, a = 0; a < 100; ) { console.log("currentIFDOffset", i); var o = e.readUInt16LE(i) , s = e.readUInt32LE(i + 2 + 12 * o); console.log("next offset: ", i + 2 + 12 * o); for (var l = e.slice(i + 2, i + 2 + 12 * o), u = 0; u < o; u++) { var c, d = zv.fromValue(l.readUInt16LE(12 * u)), h = Ov.fromValue(l.readUInt16LE(12 * u + 2)), p = l.readUInt32LE(12 * u + 4), f = l.readUInt32LE(12 * u + 8), m = h.bytes * p, v = void 0; m <= 4 ? v = f : ((c = new Uint8Array(m)).set(e.slice(f, f + m)), v = new (Nv.get(h))(c.buffer), h === Ov.ASCII && (v = String.fromCharCode.apply(String, Q(v)))); v = new Uv(d,h,p,f,v); r.push(v) } if (console.log("nextIFDOffset", s), 0 === s) break; i = s, a++ } for (var t = function(e) { var t, n = ue(r); try { for (n.s(); !(t = n.n()).done; ) { var i = t.value; if (i.tag === e) return i } } catch (e) { n.e(e) } finally { n.f() } return null }, g = t(zv.IMAGE_WIDTH).value, n = t(zv.IMAGE_HEIGHT).value, y = (t(zv.COMPRESSION).value, t(zv.ROWS_PER_STRIP).value), w = t(zv.STRIP_OFFSETS), b = t(zv.STRIP_BYTE_COUNTS), x = Math.ceil(n / y), E = [], _ = 0; _ < b.count; _++) { var M = b.type , A = b.offset + _ * M.bytes , T = void 0; M === Ov.SHORT ? T = e.readUInt16LE(A) : M === Ov.LONG && (T = e.readUInt32LE(A)), E.push(T) } for (var S = [], C = 0; C < w.count; C++) { var P = w.type , D = w.offset + C * P.bytes , k = void 0; P === Ov.SHORT ? k = e.readUInt16LE(D) : P === Ov.LONG && (k = e.readUInt32LE(D)), S.push(k) } for (var B = new Uint8Array(g * n * 3), L = 0, R = 0; R < x; R++) for (var F = S[R], I = E[R], O = e.slice(F, F + I), z = 3 * g, N = 0; N < y; N++) { var U = O.slice(N * z, N * z + z); if (B.set(U, L * z), U.length !== z) break; L++ } console.log("width: ".concat(g)), console.log("height: ".concat(n)), console.log("numStrips: ".concat(x)), console.log("stripByteCounts", E.join(", ")), console.log("stripOffsets", S.join(", ")); t = new Gv; return t.width = g, t.height = n, t.buffer = B, t.metadata = r, t } }]), e }(), Ch = function() { function e() { O(this, e) } return h(e, null, [{ key: "toTiffBuffer", value: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {} , n = new Uint8Array([73, 73, 42, 0, 8, 0, 0, 0]) , i = [e.width, e.height] , r = i[0] , a = i[1] , i = [new Uv(zv.IMAGE_WIDTH,Ov.SHORT,1,null,r), new Uv(zv.IMAGE_HEIGHT,Ov.SHORT,1,null,a), new Uv(zv.BITS_PER_SAMPLE,Ov.SHORT,4,null,new Uint16Array([8, 8, 8, 8])), new Uv(zv.COMPRESSION,Ov.SHORT,1,null,1), new Uv(zv.PHOTOMETRIC_INTERPRETATION,Ov.SHORT,1,null,2), new Uv(zv.ORIENTATION,Ov.SHORT,1,null,1), new Uv(zv.SAMPLES_PER_PIXEL,Ov.SHORT,1,null,4), new Uv(zv.ROWS_PER_STRIP,Ov.LONG,1,null,a), new Uv(zv.STRIP_BYTE_COUNTS,Ov.LONG,1,null,r * a * 3), new Uv(zv.PLANAR_CONFIGURATION,Ov.SHORT,1,null,1), new Uv(zv.RESOLUTION_UNIT,Ov.SHORT,1,null,1), new Uv(zv.SOFTWARE,Ov.ASCII,6,null,"......"), new Uv(zv.STRIP_OFFSETS,Ov.LONG,1,null,null), new Uv(zv.X_RESOLUTION,Ov.RATIONAL,1,null,new Uint32Array([1, 1])), new Uv(zv.Y_RESOLUTION,Ov.RATIONAL,1,null,new Uint32Array([1, 1]))]; t.ifdEntries && i.push.apply(i, Q(t.ifdEntries)); for (var o = 10 + 12 * i.length + 4, s = new Map, l = new Map, u = 0, c = i; u < c.length; u++) { var d = c[u] , h = new ArrayBuffer(12) , p = new DataView(h); d.type.bytes, d.count; p.setUint16(0, d.tag.value, !0), p.setUint16(2, d.type.value, !0), p.setUint32(4, d.count, !0), 1 === d.count && d.type.bytes <= 4 ? p.setUint32(8, d.value, !0) : (p.setUint32(8, o, !0), p = new Uint8Array(d.count * d.type.bytes), d.type === Ov.ASCII ? p.set(new Uint8Array(d.value.split("").map(function(e) { return e.charCodeAt(0) }))) : p.set(new Uint8Array(d.value.buffer)), l.set(d.tag, p), o += p.byteLength), s.set(d.tag, h) } t = o; new DataView(s.get(zv.STRIP_OFFSETS)).setUint32(8, t, !0); function f(e) { var t, n = e.reduce(function(e, t) { return e + t.byteLength }, 0), i = new Uint8Array(n), r = 0, a = ue(e); try { for (a.s(); !(t = a.n()).done; ) { var o = t.value; i.set(new Uint8Array(o), r), r += o.byteLength } } catch (e) { a.e(e) } finally { a.f() } return i } return { width: r, height: a, buffer: f([n, f([new Uint16Array([i.length])].concat(Q(s.values()), [new Uint32Array([0])])), f(Q(l.values())), e.buffer]) } } }]), e }(), Ou.Tag = zv, Ou.Type = Ov, Ou.IFDEntry = Uv, Ou.Image = Gv, Ou.Reader = rh, Ou.Exporter = Ch; var Wv = function() { y(o, hn); var a = w(o); function o(t) { var n; O(this, o), (n = a.call(this)).viewer = t, n.renderer = t.renderer, n.viewer.addEventListener("start_inserting_measurement", function(e) { n.viewer.dispatchEvent({ type: "cancel_insertions" }) }), n.showLabels = !0, n.scene = new gs, n.scene.name = "scene_measurement", n.viewer.inputHandler.registerInteractiveScene(n.scene), n.onRemove = function(e) { e.measurement.dispose() } , n.onAdd = function(e) { n.scene.add(e.measurement) } ; var e, i = ue(t.scene.measurements); try { for (i.s(); !(e = i.n()).done; ) { var r = e.value; n.onAdd({ measurement: r }) } } catch (e) { i.e(e) } finally { i.f() } return t.addEventListener("camera_changed", function(e) { e.viewport == t.mainViewport && n.update() }), t.addEventListener("render.pass.perspective_overlay", n.render.bind(g(n))), t.addEventListener("scene_changed", n.onSceneChange.bind(g(n))), t.scene.addEventListener("measurement_added", n.onAdd), t.scene.addEventListener("measurement_removed", n.onRemove), t.addEventListener("resize", n.setSize.bind(g(n))), n } return h(o, [{ 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 Wf(e); if (!e.failBuilded) return viewer.scene.addMeasurement(e), e.guideLine && (e.guideLine.visible = !1), e } }, { key: "update", value: function() {} }, { 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: "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() { function e(e, t) { return null != e ? e : t } var i = this , r = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {} , a = 1 < arguments.length ? arguments[1] : void 0; this.viewer.renderer.domElement; r.showDistances = null === r.showDistances || r.showDistances, r.showArea = e(r.showArea, !1), r.showAngles = e(r.showAngles, !1), r.showCoordinates = e(r.showCoordinates, !1), r.showHeight = e(r.showHeight, !1), r.showCircle = e(r.showCircle, !1), r.showAzimuth = e(r.showAzimuth, !1), r.showEdges = e(r.showEdges, !0), r.closed = e(r.closed, !1), r.maxMarkers = e(r.maxMarkers, 1 / 0), r.direction = r.direction, r.type = r.type, r.showGuideLine = e(r.showGuideLine, !1), r.isRect = e(r.isRect, !1); var o, s = new Wf(r); this.scene.add(s), s.isNew = !0, this.viewer.dispatchEvent({ type: "start_inserting_measurement", measure: s }), s.addEventListener("editStateChange", this.editStateChange.bind(this)), s.editStateChange(!0); var l = function(e) { var t, n = s.points.length; e.button == C.LEFT || e.isTouch ? n >= s.maxMarkers ? u({ finish: !0 }) : (t = s.addMarker({ point: s.points[n - 1].clone() }), r.isRect && 3 == s.markers.length ? s.addMarker({ point: s.points[0].clone() }) : (s.markers[n].visible = !1, s.edges[n].visible = !1), s.edges[n - 1].visible = !0, s.markers[n - 1].visible = !0, s.editStateChange(!0), t.isDragging = !0, s.continueDrag(t, e)) : e.button === C.RIGHT && (e.pressDistance < Potree.config.clickMaxDragDis ? u(e) : s.continueDrag(null, e)) } , u = function e() { var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; if (s.isNew) { if (null != r.minMarkers && !t.finish && s.markers.length <= r.minMarkers) return s.markers[0].removeEventListener("mousedown", e), s.reDraw(), i.viewer.addEventListener("global_click", p, 10), void s.editStateChange(!0); !t.finish && 3 < s.markers.length && (s.removeMarker(s.points.length - 1), s.markers[0].removeEventListener("mouseover", d), s.markers[0].removeEventListener("mouseleave", h), s.markers[0].removeEventListener("click", c)), s.isNew = !1; var n = s.points.length; n && (s.markers[n - 1].visible = !0, s.edges[n - 1].visible = !0, s.markers.forEach(function(e) { e.dispatchEvent("addHoverEvent") }), s.edges.forEach(function(e) { e.dispatchEvent("addHoverEvent") })), clearTimeout(o), 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: "isMeasuring", v: !1, cause: "stopInsertion" }), t.remove || a && a() } } , c = function(e) { e.measure && e.measure != s || (console.log("Exit: " + s.id), e.remove && viewer.scene.removeMeasurement(s), s.editStateChange(!1), i.viewer.inputHandler.drag && !e.remove ? i.viewer.inputHandler.drag.object.dispatchEvent({ type: "drop", drag: i.viewer.inputHandler.drag, viewer: i.viewer, pressDistance: 0, button: C.RIGHT }) : u({ finish: !0, remove: e.remove }), i.viewer.inputHandler.drag = null) }; this.viewer.addEventListener("cancel_insertions", c); var d = function(e) { s.setMarkerSelected(e.object, "hover", "single") } , h = function(e) { s.setMarkerSelected(e.object, "unhover", "single") } , p = function e(t) { if (!f(t) && t.button !== C.RIGHT) { var n = t.intersect && (t.intersect.orthoIntersect || t.intersect.location); if (!n) return s.dispatchEvent("intersectNoPointcloud"); "mapViewport" == t.drag.dragViewport.name && (n = n.clone().setZ(viewer.mainViewport.camera.position.z)); n = s.addMarker({ point: n }); return n.isDragging = !0, i.viewer.inputHandler.startDragging(n, { endDragFun: l, notPressMouse: !0 }), t.drag = i.viewer.inputHandler.drag, t.drag.endDragFun = l, t.drag.notPressMouse = !0, s.dragMarker(t), s.dropMarker(t), 1 < s.maxMarkers && (s.markers[1].visible = !1, s.edges[1].visible = !1), 2 < s.maxMarkers && !s.isRect && (s.markers[0].addEventListener("mouseover", d), s.markers[0].addEventListener("mouseleave", h), s.markers[0].addEventListener("click", c)), i.viewer.removeEventListener("global_click", e), { stopContinue: !0 } } }; viewer.inputHandler.dispatchEvent({ type: "isMeasuring", v: !0, cause: "startInsertion" }), this.viewer.addEventListener("global_click", p, 10); var f = function(e) { if (s.unableDragAtMap && "mapViewport" == e.hoverViewport.name) return e.isTouch ? viewer.dispatchEvent({ type: "reticule_forbit", v: !0 }) : viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "polygon_AtWrongPlace" }), !0; e.isTouch ? viewer.dispatchEvent({ type: "reticule_forbit", v: !1 }) : viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "polygon_AtWrongPlace" }) }; return s.unableDragAtMap && this.viewer.addEventListener("global_mousemove", f), this.viewer.scene.addMeasurement(s), s } }, { key: "render", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; 0 != this.scene.children.length && (viewer.setCameraLayers(e.camera, ["measure"]), e.screenshot ? (this.viewer.ssaaRenderPass.sampleLevel = 4, this.viewer.composer.render(this.scene, e.camera)) : this.viewer.renderer.render(this.scene, e.camera)) } }]), o }() , Xv = function() { function n(e) { O(this, n), this.content = e; var t = "".concat(le.resourcePath, "/icons/close.svg"); this.element = $('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t
')), this.elClose = this.element.find("img[name=close]"), this.elContainer = this.element.find("span[name=content_container]"), "string" == typeof e ? this.elContainer.append($("".concat(e, ""))) : this.elContainer.append(e) } return h(n, [{ key: "setMessage", value: function(e) { this.elContainer.empty(), "string" == typeof e ? this.elContainer.append($("".concat(e, ""))) : this.elContainer.append(e) } }]), n }() , pu = function() { function t(e) { O(this, t), this.potreeRenderer = e, this.threeRenderer = this.potreeRenderer.threeRenderer, this.target = new An(2048,2048,{ minFilter: Oe, magFilter: Oe, format: et, type: Xe }), this.target.depthTexture = new El, this.target.depthTexture.type = We, this.threeRenderer.setClearColor(16711680, 1); e = this.threeRenderer.getRenderTarget(); this.threeRenderer.setRenderTarget(this.target), this.threeRenderer.setRenderTarget(e) } return h(t, [{ key: "setLight", value: function(e) { var t = 180 * (this.light = e).angle / Math.PI , n = e.shadow.mapSize.width / e.shadow.mapSize.height , i = 0 === e.distance ? 1e4 : e.distance; this.camera = new $r(t,n,.1,i), this.camera.up.set(0, 0, 1), this.camera.position.copy(e.position); e = (new Cn).subVectors(e.position, e.getWorldDirection(new Cn)); this.camera.lookAt(e), this.camera.updateProjectionMatrix(), this.camera.updateMatrix(), this.camera.updateMatrixWorld(), this.camera.matrixWorldInverse.copy(this.camera.matrixWorld).invert() } }, { key: "setSize", value: function(e, t) { this.target.width === e && this.target.height === t || this.target.dispose(), this.target.setSize(e, t) } }, { key: "render", value: function(e, t) { this.threeRenderer.setClearColor(0, 1); var n = this.threeRenderer.getRenderTarget(); this.threeRenderer.setRenderTarget(this.target), this.threeRenderer.clear(!0, !0, !0), this.potreeRenderer.render(e, this.camera, this.target, {}), this.threeRenderer.setRenderTarget(n) } }]), t }() , qv = function() { y(o, hn); var a = w(o); function o(e) { var t; O(this, o), (t = a.call(this)).viewer = e, t.renderer = e.renderer, t.addEventListener("start_inserting_profile", function(e) { t.viewer.dispatchEvent({ type: "cancel_insertions" }) }), t.scene = new gs, t.scene.name = "scene_profile", t.light = new $c(16777215,1), t.scene.add(t.light), t.viewer.inputHandler.registerInteractiveScene(t.scene), t.onRemove = function(e) { return t.scene.remove(e.profile) } , t.onAdd = function(e) { return t.scene.add(e.profile) } ; var n, i = ue(e.scene.profiles); try { for (i.s(); !(n = i.n()).done; ) { var r = n.value; t.onAdd({ profile: r }) } } catch (e) { i.e(e) } finally { i.f() } return e.addEventListener("update", t.update.bind(g(t))), e.addEventListener("render.pass.perspective_overlay", t.render.bind(g(t))), e.addEventListener("scene_changed", t.onSceneChange.bind(g(t))), e.scene.addEventListener("profile_added", t.onAdd), e.scene.addEventListener("profile_removed", t.onRemove), t } return h(o, [{ key: "onSceneChange", value: function(e) { e.oldScene && (e.oldScene.removeEventListeners("profile_added", this.onAdd), e.oldScene.removeEventListeners("profile_removed", this.onRemove)), e.scene.addEventListener("profile_added", this.onAdd), e.scene.addEventListener("profile_removed", this.onRemove) } }, { key: "startInsertion", value: function() { var r = this , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {} , t = this.viewer.renderer.domElement , a = new Kp; a.name = e.name || "Profile", this.dispatchEvent({ type: "start_inserting_profile", profile: a }), this.scene.add(a); function n(e) { var t, n, i; e.button === C.LEFT ? (a.points.length <= 1 && (n = (t = r.viewer.scene.getActiveCamera()).position.distanceTo(a.points[0]), i = r.viewer.renderer.getSize(new yn), i = Jf.projectedRadius(1, t, n, i.width, i.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 === C.RIGHT && o.callback() } var o = { callback: null }; return o.callback = function(e) { a.removeMarker(a.points.length - 1), t.removeEventListener("mouseup", n, !1), r.viewer.removeEventListener("cancel_insertions", o.callback) } , this.viewer.addEventListener("cancel_insertions", o.callback), t.addEventListener("mouseup", n, !1), a.addMarker(new Cn(0,0,0)), this.viewer.inputHandler.startDragging(a.spheres[a.spheres.length - 1]), this.viewer.scene.addProfile(a), a } }, { key: "update", value: function() { var e = this.viewer.scene.getActiveCamera() , t = this.viewer.scene.profiles , n = this.viewer.renderer.getSize(new yn) , i = n.width , r = n.height; this.light.position.copy(e.position); var a, o = ue(t); try { for (o.s(); !(a = o.n()).done; ) { var s, l = ue(a.value.spheres); try { for (l.s(); !(s = l.n()).done; ) { var u = s.value , c = e.position.distanceTo(u.getWorldPosition(new Cn)) , d = 15 / Jf.projectedRadius(1, e, c, i, r); u.scale.set(d, d, d) } } catch (e) { l.e(e) } finally { l.f() } } } catch (e) { o.e(e) } finally { o.f() } } }, { key: "render", value: function() { this.viewer.renderer.render(this.scene, this.viewer.scene.getActiveCamera()) } }]), o }() , Jv = function() { y(i, hn); var n = w(i); function i(e) { var t; return O(this, i), (t = n.call(this)).viewer = e, t.scene = new gs, e.addEventListener("update", t.update.bind(g(t))), e.addEventListener("render.pass.perspective_overlay", t.render.bind(g(t))), e.addEventListener("scene_changed", t.onSceneChange.bind(g(t))), t } return h(i, [{ key: "onSceneChange", value: function(e) { console.log("scene changed") } }, { key: "startInsertion", value: function() { var w = this , e = this.viewer.renderer.domElement , b = new Zp; b.position.set(12345, 12345, 12345), b.showVolumeLabel = !1, b.visible = !1, b.update(), this.viewer.scene.addVolume(b), this.importance = 10; var x = $('
'); $(e.parentElement).append(x), x.css("right", "10px"), x.css("bottom", "10px"); function E(e) { w.importance = 0, $(x).remove(), w.viewer.inputHandler.deselectAll(), w.viewer.inputHandler.toggleSelection(b); var t = e.viewer.scene.getActiveCamera() , n = e.viewer.renderer.getSize(new yn) , i = (new yn).addVectors(e.drag.end, e.drag.start).multiplyScalar(.5) , r = new Cn(0,0,.5); Jf.convertScreenPositionToNDC(r, i, n.width, n.height); var a = Jf.mouseToRay(r, t, n.width, n.height); w.removeEventListener("drag", _), w.removeEventListener("drop", E); var o, s, l, u = [], c = [], d = ue(w.viewer.scene.pointclouds); try { for (d.s(); !(o = d.n()).done; ) { var h, p, f, m, v, g, y = o.value; y.visible && ((h = t.clone()).left = -b.scale.x / 2, h.right = +b.scale.x / 2, h.top = +b.scale.y / 2, h.bottom = -b.scale.y / 2, h.near = -b.scale.z / 2, h.far = +b.scale.z / 2, h.rotation.copy(b.rotation), h.position.copy(b.position), h.updateMatrix(), h.updateMatrixWorld(), h.updateProjectionMatrix(), h.matrixWorldInverse.copy(h.matrixWorld).invert(), p = new ti(h.getWorldPosition(new Cn),h.getWorldDirection(new Cn)), f = new ti(p.origin.clone().add(p.direction.clone().multiplyScalar(b.scale.z)),p.direction.clone().multiplyScalar(-1)), (new yn).subVectors(e.drag.end, e.drag.start), m = { width: 16, height: 16, pickWindowSize: 16, all: !0, pickClipped: !0, pointSizeType: am.FIXED, pointSize: 1 }, v = y.pick(viewer, null, h, p, m), h.rotateX(Math.PI), h.updateMatrix(), h.updateMatrixWorld(), h.updateProjectionMatrix(), h.matrixWorldInverse.copy(h.matrixWorld).invert(), g = y.pick(viewer, null, h, f, m), v && u.push.apply(u, Q(v)), g && c.push.apply(c, Q(g))) } } catch (e) { d.e(e) } finally { d.f() } (0 < u.length || 0 < c.length) && (s = new vh(a.origin,(new Cn).addVectors(a.origin, a.direction)), i = u.map(function(e) { return s.closestPointToPoint(e.position, !1, new Cn) }).sort(function(e, t) { return a.origin.distanceTo(e) - a.origin.distanceTo(t) }), n = c.map(function(e) { return s.closestPointToPoint(e.position, !1, new Cn) }).sort(function(e, t) { return a.origin.distanceTo(t) - a.origin.distanceTo(e) }), i = 0 == i.length ? (l = n[n.length - 1], n[0]) : 0 == n.length ? (l = i[i.length - 1], i[0]) : (l = i[0], n[0]), n = l.distanceTo(i), i = (new Cn).addVectors(l, i).multiplyScalar(.5), b.scale.z = 1.1 * n, i = i.project(t), r.setZ(i.z), r.unproject(t), b.position.copy(r)), b.clip = !0 } var _ = function(e) { b.visible = !0; var t = e.drag.start , n = e.drag.end , i = new ph; i.expandByPoint(t), i.expandByPoint(n), x.css("left", "".concat(i.min.x, "px")), x.css("top", "".concat(i.min.y, "px")), x.css("width", "".concat(i.max.x - i.min.x, "px")), x.css("height", "".concat(i.max.y - i.min.y, "px")); var r = e.viewer.scene.getActiveCamera() , a = e.viewer.renderer.getSize(new yn) , t = new yn(r.right - r.left,r.top - r.bottom) , n = (new yn).addVectors(e.drag.end, e.drag.start).multiplyScalar(.5) , i = new Cn(0,0,.5); Jf.convertScreenPositionToNDC(i, n, a.width, a.height), i.unproject(r); n = (new yn).subVectors(e.drag.end, e.drag.start); n.divide(a).multiply(t), b.position.copy(i), b.up.copy(r.up), b.rotation.copy(r.rotation), b.scale.set(n.x, n.y, 1e5), e.consume() }; return this.addEventListener("drag", _), this.addEventListener("drop", E), viewer.inputHandler.addInputListener(this), b } }, { key: "update", value: function(e) {} }, { key: "render", value: function() { this.viewer.renderer.render(this.scene, this.viewer.scene.getActiveCamera()) } }]), i }() , mu = function() { y(r, Si); var i = w(r); function r(e, t) { var n; O(this, r), (n = i.call(this)).light = e, n.color = t, n.updateMatrix(), n.updateMatrixWorld(); e = new Su(1,32,32), t = new Xu; n.sphere = new Hr(e,t), n.sphere.scale.set(.5, .5, .5), n.add(n.sphere); e = new Float32Array([0, 0, 0, 0, 0, -1, 0, 0, 0, -1, -1, -1, 0, 0, 0, 1, -1, -1, 0, 0, 0, 1, 1, -1, 0, 0, 0, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1]), t = new Mr; t.setAttribute("position", new nr(e,3)); e = new tl; return n.frustum = new cl(t,e), n.add(n.frustum), n.update(), n } return h(r, [{ key: "update", value: function() { this.light.updateMatrix(), this.light.updateMatrixWorld(); var e = this.light.position , t = (new Cn).addVectors(this.light.position, this.light.getWorldDirection(new Cn).multiplyScalar(-1)) , t = (new Sn).setFromRotationMatrix((new ni).lookAt(e, t, new Cn(0,0,1))); this.setRotationFromQuaternion(t), this.position.copy(e); t = 0 < this.light.distance ? this.light.distance : 1e3, e = t * Math.tan(.5 * this.light.angle); this.frustum.scale.set(e, e, t) } }]), r }() , Yv = 6710886 , Zv = function() { function r(e) { var s = this; O(this, r), this.viewer = e, this.scene = new gs, this.modesEnabled = { scale: !0, translation: !0, rotation: !0 }, this.selection = [], this.pivot = new Cn, this.dragging = !1, this.showPickVolumes = !1, this.viewer.inputHandler.registerInteractiveScene(this.scene), this.viewer.inputHandler.addEventListener("selection_changed", function(e) { var t, n = ue(s.selection); try { for (n.s(); !(t = n.n()).done; ) { var i = t.value; s.viewer.inputHandler.blacklist.delete(i) } } catch (e) { n.e(e) } finally { n.f() } s.selection = e.selection; var r, a = ue(s.selection); try { for (a.s(); !(r = a.n()).done; ) { var o = r.value; s.viewer.inputHandler.blacklist.add(o) } } catch (e) { a.e(e) } finally { a.f() } }), this.viewer.addEventListener("global_touchstart", function(e) { s.update() }); var t = Potree.config.axis.x.color , n = Potree.config.axis.y.color , i = Potree.config.axis.z.color; this.activeHandle = null, this.scaleHandles = { "scale.x+": { name: "scale.x+", node: new Si, color: t, alignment: [1, 0, 0] }, "scale.x-": { name: "scale.x-", node: new Si, color: t, alignment: [-1, 0, 0] }, "scale.y+": { name: "scale.y+", node: new Si, color: n, alignment: [0, 1, 0] }, "scale.y-": { name: "scale.y-", node: new Si, color: n, alignment: [0, -1, 0] }, "scale.z+": { name: "scale.z+", node: new Si, color: i, alignment: [0, 0, 1] }, "scale.z-": { name: "scale.z-", node: new Si, color: i, alignment: [0, 0, -1] } }, this.focusHandles = { "focus.x+": { name: "focus.x+", node: new Si, color: t, alignment: [1, 0, 0] }, "focus.x-": { name: "focus.x-", node: new Si, color: t, alignment: [-1, 0, 0] }, "focus.y+": { name: "focus.y+", node: new Si, color: n, alignment: [0, 1, 0] }, "focus.y-": { name: "focus.y-", node: new Si, color: n, alignment: [0, -1, 0] }, "focus.z+": { name: "focus.z+", node: new Si, color: i, alignment: [0, 0, 1] }, "focus.z-": { name: "focus.z-", node: new Si, color: i, alignment: [0, 0, -1] } }, this.translationHandles = { "translation.x": { name: "translation.x", node: new Si, color: t, alignment: [1, 0, 0] }, "translation.y": { name: "translation.y", node: new Si, color: n, alignment: [0, 1, 0] }, "translation.z": { name: "translation.z", node: new Si, color: i, alignment: [0, 0, 1] } }, this.rotationHandles = { "rotation.x": { name: "rotation.x", node: new Si, color: t, alignment: [1, 0, 0] }, "rotation.y": { name: "rotation.y", node: new Si, color: n, alignment: [0, 1, 0] }, "rotation.z": { name: "rotation.z", node: new Si, color: i, alignment: [0, 0, 1] } }, this.handles = Object.assign({}, this.scaleHandles, {}, this.translationHandles, this.rotationHandles), this.pickVolumes = [], this.initializeScaleHandles(), this.initializeFocusHandles(), this.initializeTranslationHandles(), this.initializeRotationHandles(); i = new Sl; i.vertices.push(new Cn(-.5,-.5,.5)), i.vertices.push(new Cn(.5,-.5,.5)), i.vertices.push(new Cn(.5,-.5,.5)), i.vertices.push(new Cn(.5,-.5,-.5)), i.vertices.push(new Cn(.5,-.5,-.5)), i.vertices.push(new Cn(-.5,-.5,-.5)), i.vertices.push(new Cn(-.5,-.5,-.5)), i.vertices.push(new Cn(-.5,-.5,.5)), i.vertices.push(new Cn(-.5,.5,.5)), i.vertices.push(new Cn(.5,.5,.5)), i.vertices.push(new Cn(.5,.5,.5)), i.vertices.push(new Cn(.5,.5,-.5)), i.vertices.push(new Cn(.5,.5,-.5)), i.vertices.push(new Cn(-.5,.5,-.5)), i.vertices.push(new Cn(-.5,.5,-.5)), i.vertices.push(new Cn(-.5,.5,.5)), i.vertices.push(new Cn(-.5,-.5,.5)), i.vertices.push(new Cn(-.5,.5,.5)), i.vertices.push(new Cn(.5,-.5,.5)), i.vertices.push(new Cn(.5,.5,.5)), i.vertices.push(new Cn(.5,-.5,-.5)), i.vertices.push(new Cn(.5,.5,-.5)), i.vertices.push(new Cn(-.5,-.5,-.5)), i.vertices.push(new Cn(-.5,.5,-.5)), this.frame = new cl(i,new tl({ color: 16776960 })), this.scene.add(this.frame), e.setObjectLayers(this.scene, "transformationTool"), this.scene.traverse(function(e) { e.pickDontCheckDis = !0 }) } return h(r, [{ key: "setModeEnable", value: function(e, t) { var n = this[e + "Handles"]; if (n) { for (var i in n) n[i].node.visible = !!t; this.modesEnabled[e] = !!t } } }, { key: "initializeScaleHandles", value: function() { for (var l = this, u = new Su(1,32,32), c = new Su(1,16,16), d = 0, h = Object.keys(this.scaleHandles); d < h.length; d++) !function() { var e = h[d] , t = l.scaleHandles[e] , n = t.node; l.scene.add(n), (a = n.position).set.apply(a, Q(t.alignment)).multiplyScalar(.5); var i = new $i({ color: t.color, opacity: .6, transparent: !0 }) , r = new $i({ color: Yv, side: J, opacity: .6, transparent: !0 }) , a = new Xu({ opacity: .2, transparent: !0, visible: l.showPickVolumes }) , o = new Hr(u,i); o.scale.set(2, 2, 2), o.name = "".concat(e, ".handle"), n.add(o); t = new Hr(u,r); t.scale.set(1.1, 1.1, 1.1), t.name = "".concat(e, ".outline"), o.add(t); var s = new Hr(c,a); s.name = "".concat(e, ".pick_volume"), s.scale.set(2, 2, 2), o.add(s), s.handle = e, l.pickVolumes.push(s), n.setOpacity = function(e) { var t = { x: i.opacity } , e = new TWEEN.Tween(t).to({ x: e }, 100); e.onUpdate(function() { o.visible = 0 < t.x, s.visible = 0 < t.x, i.opacity = t.x, r.opacity = t.x, s.material.opacity = .5 * t.x }), e.start() } , s.addEventListener("drag", function(e) { return l.dragScaleHandle(e) }), s.addEventListener("drop", function(e) { return l.dropScaleHandle(e) }), s.addEventListener("mouseover", function(e) {}), s.addEventListener("click", function(e) {}), s.addEventListener("mouseleave", function(e) {}) }() } }, { key: "initializeFocusHandles", value: function() {} }, { key: "initializeTranslationHandles", value: function() { for (var l = this, u = new Cl(1,1,1), c = 0, d = Object.keys(this.translationHandles); c < d.length; c++) !function() { var e = d[c] , t = l.handles[e] , n = t.node; l.scene.add(n); var i = new $i({ color: t.color, opacity: .6, transparent: !0 }) , r = new $i({ color: Yv, side: J, opacity: .6, transparent: !0 }) , a = new Xu({ opacity: .2, transparent: !0, visible: l.showPickVolumes }) , o = new Hr(u,i); o.name = "".concat(e, ".handle"), o.scale.set(1, 1, 72), o.lookAt(B(Cn, Q(t.alignment))), o.renderOrder = 10, n.add(o), t.translateNode = o; t = new Hr(u,r); t.name = "".concat(e, ".outline"), t.scale.set(1.3, 1.3, 1.01), t.renderOrder = 0, o.add(t); var s = new Hr(u,a); s.name = "".concat(e, ".pick_volume"), s.scale.set(4, 4, 1.1), s.handle = e, o.add(s), l.pickVolumes.push(s), n.setOpacity = function(e) { var t = { x: i.opacity } , e = new TWEEN.Tween(t).to({ x: e }, 100); e.onUpdate(function() { o.visible = 0 < t.x, s.visible = 0 < t.x, i.opacity = t.x, r.opacity = t.x, a.opacity = .5 * t.x }), e.start() } , s.addEventListener("drag", function(e) { l.dragTranslationHandle(e) }), s.addEventListener("drop", function(e) { l.dropTranslationHandle(e) }) }() } }, { key: "initializeRotationHandles", value: function() { for (var l = this, u = new Lu(1,.0225,8,64,Math.PI / 2), c = new Lu(1,1.5 * .018,8,64,Math.PI / 2), d = new Lu(1,.06,6,4,Math.PI / 2), h = 0, p = Object.keys(this.rotationHandles); h < p.length; h++) !function() { var e = p[h] , t = l.handles[e] , n = t.node; l.scene.add(n); var i = new $i({ color: t.color, opacity: .6, transparent: !0 }) , r = new $i({ color: Yv, side: J, opacity: .6, transparent: !0 }) , a = new Xu({ opacity: .2, transparent: !0, visible: l.showPickVolumes }) , o = new Hr(u,i); o.name = "".concat(e, ".handle"), o.scale.set(30, 30, 30), o.lookAt(B(Cn, Q(t.alignment))), n.add(o), t.translateNode = o; t = new Hr(c,r); t.name = "".concat(e, ".outline"), t.scale.set(1, 1, 1), t.renderOrder = 0, o.add(t); var s = new Hr(d,a); s.name = "".concat(e, ".pick_volume"), s.scale.set(1, 1, 1), s.handle = e, o.add(s), l.pickVolumes.push(s), n.setOpacity = function(e) { var t = { x: i.opacity } , e = new TWEEN.Tween(t).to({ x: e }, 100); e.onUpdate(function() { o.visible = 0 < t.x, s.visible = 0 < t.x, i.opacity = t.x, r.opacity = t.x, a.opacity = .5 * t.x }), e.start() } , s.addEventListener("drag", function(e) { l.dragRotationHandle(e) }), s.addEventListener("drop", function(e) { l.dropRotationHandle(e) }) }() } }, { key: "dragRotationHandle", value: function(e) { var t = e.drag , n = this.activeHandle , i = this.viewer.scene.getActiveCamera(); if (n) { var r = B(Cn, Q(n.alignment)) , a = new Cn; a.copy(B(Mn, Q(r.toArray()).concat([0])).applyMatrix4(n.node.matrixWorld)), a.normalize(), t.intersectionStart ? n = t.handle : (t.intersectionStart = t.location, t.objectStart = t.object.getWorldPosition(new Cn), t.handle = n, o = (new ki).setFromNormalAndCoplanarPoint(a, t.intersectionStart), t.dragPlane = o, t.pivot = t.intersectionStart), this.dragging = !0; var e = this.viewer.inputHandler.pointer , r = this.viewer.renderer.domElement , o = Jf.mouseToRay(e, i, r.clientWidth, r.clientHeight).intersectPlane(t.dragPlane, new Cn); if (o) { var e = this.scene.getWorldPosition(new Cn) , i = o , r = t.pivot.clone().sub(e).normalize() , e = i.clone().sub(e).normalize() , s = Math.acos(r.dot(e)); if (s *= Math.sign(r.cross(e).dot(a)), !Number.isNaN(s)) { var l, u = B(Cn, Q(n.alignment)), c = ue(this.selection); try { for (c.s(); !(l = c.n()).done; ) { var d = l.value; d.rotateOnAxis(u, s), d.dispatchEvent({ type: "orientation_changed", object: d }) } } catch (e) { c.e(e) } finally { c.f() } t.pivot = o } } } } }, { key: "dropRotationHandle", value: function(e) { this.dragging = !1, this.setActiveHandle(null) } }, { key: "dragTranslationHandle", value: function(e) { var t = e.drag , n = this.activeHandle , i = this.viewer.scene.getActiveCamera(); !t.intersectionStart && n ? (t.intersectionStart = t.location, t.objectStart = t.object.getWorldPosition(new Cn), e = t.intersectionStart, r = B(Mn, Q(n.alignment).concat([0])).applyMatrix4(this.scene.matrixWorld), r = (new Cn).addVectors(e, r), r = new vh(e.clone(),r.clone()), r = (t.line = r).closestPointToPoint(i.position, !1, new Cn), r = (new Cn).subVectors(i.position, r), r = (new ki).setFromNormalAndCoplanarPoint(r, t.intersectionStart), t.dragPlane = r, t.pivot = t.intersectionStart) : n = t.handle, this.dragging = !0; var r = this.viewer.inputHandler.pointer , n = this.viewer.renderer.domElement , n = Jf.mouseToRay(r, i, n.clientWidth, n.clientHeight).intersectPlane(t.dragPlane, new Cn); if (n) { var a, n = t.line.closestPointToPoint(n, !1, new Cn), o = (new Cn).subVectors(n, t.pivot), s = ue(this.selection); try { for (s.s(); !(a = s.n()).done; ) { var l = a.value; l.position.add(o), l.dispatchEvent({ type: "position_changed", object: l }) } } catch (e) { s.e(e) } finally { s.f() } t.pivot = t.pivot.add(o) } } }, { key: "dropTranslationHandle", value: function(e) { this.dragging = !1, this.setActiveHandle(null) } }, { key: "dropScaleHandle", value: function(e) { this.dragging = !1, this.setActiveHandle(null) } }, { key: "dragScaleHandle", value: function(e) { var t = e.drag , n = this.activeHandle , e = this.viewer.scene.getActiveCamera(); t.intersectionStart ? n = t.handle : (t.intersectionStart = t.location, t.objectStart = t.object.getWorldPosition(new Cn), t.handle = n, i = t.intersectionStart, a = B(Mn, Q(n.alignment).concat([0])).applyMatrix4(this.scene.matrixWorld), r = (new Cn).addVectors(i, a), a = new vh(i.clone(),r.clone()), i = (t.line = a).closestPointToPoint(e.position, !1, new Cn), r = (new Cn).subVectors(e.position, i), a = (new ki).setFromNormalAndCoplanarPoint(r, t.intersectionStart), t.dragPlane = a, t.pivot = t.intersectionStart), this.dragging = !0; var i = this.viewer.inputHandler.pointer , r = this.viewer.renderer.domElement , a = Jf.mouseToRay(i, e, r.clientWidth, r.clientHeight).intersectPlane(t.dragPlane, new Cn); if (a) { i = t.line.closestPointToPoint(a, !1, new Cn), e = n.alignment.reduce(function(e, t) { return e + t }, 0), r = this.selection[0].matrixWorld.clone().invert(), a = i.clone().applyMatrix4(r), r = t.pivot.clone().applyMatrix4(r), a = (new Cn).subVectors(a, r).clone().normalize(); 0 === i.distanceTo(t.pivot) && a.set(0, 0, 0); var o, r = a.dot(B(Cn, Q(n.alignment))), a = (new Cn).subVectors(i, t.pivot), s = B(Cn, Q(n.alignment)).multiplyScalar(a.length() * e * r), l = a.clone().multiplyScalar(.5), u = ue(this.selection); try { for (u.s(); !(o = u.n()).done; ) { var c = o.value , d = s.clone().divide(c.boundingBox.getSize(new Cn)); c.scale.add(d), c.scale.x = Math.max(.1, c.scale.x), c.scale.y = Math.max(.1, c.scale.y), c.scale.z = Math.max(.1, c.scale.z), c.position.add(l), c.dispatchEvent({ type: "position_changed", object: c }), c.dispatchEvent({ type: "scale_changed", object: c }) } } catch (e) { u.e(e) } finally { u.f() } t.pivot.copy(i) } } }, { key: "setActiveHandle", value: function(e) { if (!this.dragging && this.activeHandle !== e) { if (null === (this.activeHandle = e)) for (var t = 0, n = Object.keys(this.handles); t < n.length; t++) { var i = n[t]; this.handles[i].node.setOpacity(0) } for (var r = 0, a = Object.keys(this.translationHandles); r < a.length; r++) { var o = a[r] , o = this.translationHandles[o]; this.activeHandle === o ? o.node.setOpacity(1) : o.node.setOpacity(.6) } for (var s = 0, l = Object.keys(this.rotationHandles); s < l.length; s++) { var u = l[s]; this.rotationHandles[u].node.setOpacity(.6) } for (var c = 0, d = Object.keys(this.scaleHandles); c < d.length; c++) { var h = d[c] , h = this.scaleHandles[h]; if (this.activeHandle === h) { h.node.setOpacity(1); for (var p = 0, f = Object.keys(this.translationHandles); p < f.length; p++) { var m = f[p]; this.translationHandles[m].node.setOpacity(.6) } } else h.node.setOpacity(.6) } e && e.node.setOpacity(1) } } }, { key: "update", value: function() { var t = this; if (1 === this.selection.length) { this.scene.visible = !0, this.scene.updateMatrix(), this.scene.updateMatrixWorld(); var e, n, i, r, a = this.selection[0], o = (a.matrixWorld, this.viewer.scene.getActiveCamera()), s = this.viewer.renderer.domElement, l = this.viewer.inputHandler.pointer, u = a.boundingBox.getCenter(new Cn).clone().applyMatrix4(a.matrixWorld); this.scene.scale.copy(a.boundingBox.getSize(new Cn).multiply(a.scale)), this.scene.position.copy(u), this.scene.rotation.copy(a.rotation), this.scene.updateMatrixWorld(), this.dragging || (m = this.scene.matrixWorld.clone().invert(), e = o.getWorldPosition(new Cn).applyMatrix4(m), n = this.rotationHandles["rotation.x"].node.rotation, i = this.rotationHandles["rotation.y"].node.rotation, r = this.rotationHandles["rotation.z"].node.rotation, n.order = "ZYX", i.order = "ZYX", a = !(u = 0 < e.z), m = Math.PI / 2, u ? 0 < e.x && 0 < e.y ? (n.x = m, i.y = 3 * m, r.z = 0 * m) : e.x < 0 && 0 < e.y ? (n.x = m, i.y = 2 * m, r.z = m) : e.x < 0 && e.y < 0 ? (n.x = 2 * m, i.y = 2 * m, r.z = 2 * m) : 0 < e.x && e.y < 0 && (n.x = 2 * m, i.y = 3 * m, r.z = 3 * m) : a && (0 < e.x && 0 < e.y ? (n.x = 0 * m, i.y = 0 * m, r.z = 0 * m) : e.x < 0 && 0 < e.y ? (n.x = 0 * m, i.y = m, r.z = m) : e.x < 0 && e.y < 0 ? (n.x = 3 * m, i.y = m, r.z = 2 * m) : 0 < e.x && e.y < 0 && (n.x = 3 * m, i.y = 0 * m, r.z = 3 * m))); for (var c = 0, d = Object.keys(this.handles); c < d.length; c++) { var h = d[c] , p = this.handles[h].node , f = p.getWorldPosition(new Cn).distanceTo(o.position) , h = Jf.projectedRadius(1, o, f, s.clientWidth, s.clientHeight) , f = p.parent.getWorldScale(new Cn) , h = 8 / h , h = new Cn(h,h,h).divide(f) , f = (new ni).makeRotationFromEuler(p.rotation).clone().invert(); h.applyMatrix4(f), h.x = Math.abs(h.x), h.y = Math.abs(h.y), h.z = Math.abs(h.z), p.scale.copy(h) } var m = Jf.mouseToRay(l, o, s.clientWidth, s.clientHeight) , l = new sh(m.origin,m.direction); l.layers.enableAll(); var m = this.pickVolumes.filter(function(e) { e = e.handle.split(".")[0]; return t.modesEnabled[e] }) , m = l.intersectObjects(m, !0); 0 < m.length ? (m = m[0].object.handle, console.log(m), this.setActiveHandle(this.handles[m])) : this.setActiveHandle(null); for (var v = 0, g = Object.keys(this.scaleHandles); v < g.length; v++) { var y = g[v] , y = this.handles[y]; y.node, y.alignment } } else this.scene.visible = !1 } }]), r }() , Qv = function() { y(o, hn); var a = w(o); function o(e) { var t; O(this, o), (t = a.call(this)).viewer = e, t.renderer = e.renderer, t.addEventListener("start_inserting_volume", function(e) { t.viewer.dispatchEvent({ type: "cancel_insertions" }) }), t.scene = new gs, 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 n, i = ue(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 Yp }).forEach(function(e) { return t.viewer.scene.removeVolume(e) }) }), e.addEventListener("update", t.update.bind(g(t))), e.addEventListener("render.pass.scene", function(e) { return t.render(e) }), e.addEventListener("scene_changed", t.onSceneChange.bind(g(t))), e.scene.addEventListener("volume_added", t.onAdd), e.scene.addEventListener("volume_removed", t.onRemove), t } return h(o, [{ key: "onSceneChange", value: function(e) { e.oldScene && (e.oldScene.removeEventListeners("volume_added", this.onAdd), e.oldScene.removeEventListeners("volume_removed", this.onRemove)), e.scene.addEventListener("volume_added", this.onAdd), e.scene.addEventListener("volume_removed", this.onRemove) } }, { key: "startInsertion", value: function() { var n = this , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {} , i = new (e.type || Zp); i.clip = e.clip || !1, i.name = e.name || "Volume", this.dispatchEvent({ type: "start_inserting_volume", volume: i }), this.viewer.scene.addVolume(i); function t(e) { i.removeEventListener("drag", a), i.removeEventListener("drop", t), r.callback() } var r = { callback: null } , a = function(e) { var t = n.viewer.scene.getActiveCamera() , e = e.intersect; e && (i.position.copy(e.location), t = i.getWorldPosition(new Cn).applyMatrix4(t.matrixWorldInverse), t = Math.abs(t.z / 5), i.scale.set(t, t, t)) }; return r.callback = function(e) { i.removeEventListener("drag", a), i.removeEventListener("drop", t), n.viewer.removeEventListener("cancel_insertions", r.callback) } , i.addEventListener("drag", a), i.addEventListener("drop", t), this.viewer.addEventListener("cancel_insertions", r.callback), this.viewer.inputHandler.startDragging(i), i } }, { key: "update", value: function() { if (this.viewer.scene) { this.viewer.scene.getActiveCamera(); var e, t = this.viewer.renderer.getSize(new yn), n = (t.width, t.height, ue(this.viewer.scene.volumes)); try { for (n.s(); !(e = n.n()).done; ) e.value } catch (e) { n.e(e) } finally { n.f() } } } }, { key: "render", value: function(e) { var t = this.viewer.renderer , n = t.getRenderTarget(); e.renderTarget && t.setRenderTarget(e.renderTarget), t.render(this.scene, this.viewer.scene.getActiveCamera()), t.setRenderTarget(n) } }]), o }() , Kv = function() { function e(i) { var r = this; O(this, e), this.viewer = i, this.visible = !1, this.dom = this.createElement(), i.addEventListener("update", function() { var e = i.scene.view.direction.clone(); e.z = 0, e.normalize(); var t = i.scene.getActiveCamera().getWorldPosition(new Cn) , n = t.clone().add(e) , e = i.getProjection() , e = Jf.computeAzimuth(t, n, e); r.dom.css("transform", "rotateZ(".concat(-e, "rad)")) }), this.dom.click(function() { i.setTopView() }), $(i.renderArea).append(this.dom), this.setVisible(this.visible) } return h(e, [{ key: "setVisible", value: function(e) { this.visible = e, this.dom.css("display", e ? "" : "none") } }, { key: "isVisible", value: function() { return this.visible } }, { key: "createElement", value: function() { return $('")) } }]), e }() , $v = function() { function t(e) { O(this, t), this.viewer = e, this.edlMaterial = null, this.rtEDLs = new Map, this.gl = e.renderer.getContext(), e.addEventListener("resize", this.resize.bind(this)), this.initEDL(e) } return h(t, [{ key: "initEDL", value: function(e) { null == this.edlMaterial && (this.edlMaterial = new _v, this.edlMaterial.depthTest = !0, this.edlMaterial.depthWrite = !0, this.edlMaterial.transparent = !0) } }, { key: "resize", value: function(e) { jp.EXT_DEPTH.isSupported() && (e = e.viewport, this.getRtEDL(e).setSize(e.resolution2.x, e.resolution2.y)) } }, { key: "clearTargets", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {} , t = this.viewer.renderer , n = t.getRenderTarget(); e.target && (t.setRenderTarget(e.target), t.clear()), jp.EXT_DEPTH.isSupported() && (e.rtEDL ? (t.setRenderTarget(e.rtEDL), t.clear()) : (e = this.getRtEDL(e.viewport)) && (t.setRenderTarget(e), t.clear(!0, !0, !0))), t.setRenderTarget(n) } }, { key: "getRtEDL", value: function(e) { e || (console.warn("getRtEDL没传viewport!!!! !!!!!!!!!!"), e = viewer.mainViewport); var t = this.rtEDLs.get(e); return t || jp.EXT_DEPTH.isSupported() && (t = new An(e.resolution2.x,e.resolution2.y,{ minFilter: Re, magFilter: Re, format: et, type: Xe, depthTexture: new El(void 0,void 0,We) }), this.rtEDLs.set(e, t)), t } }, { key: "renderShadowMap", value: function(e, t, n) { var i = this.viewer; if (0 < n.length && !n[0].disableShadowUpdates) { n = n[0]; this.shadowMap.setLight(n); var r, a = new Map, o = ue(i.scene.pointclouds); try { for (o.s(); !(r = o.n()).done; ) { var s = r.value; a.set(s, s.material.activeAttributeName), s.material.disableEvents(), s.material.activeAttributeName = "depth" } } catch (e) { o.e(e) } finally { o.f() } this.shadowMap.render(i.scene.scenePointCloud, t); var l, u = ue(e); try { for (u.s(); !(l = u.n()).done; ) { var c = l.value , d = a.get(c); c.material.activeAttributeName = d, c.material.enableEvents() } } catch (e) { u.e(e) } finally { u.f() } i.shadowTestCam.updateMatrixWorld(), i.shadowTestCam.matrixWorldInverse.copy(i.shadowTestCam.matrixWorld).invert(), i.shadowTestCam.updateProjectionMatrix() } } }, { key: "render", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {} , t = this.viewer , n = e.camera || t.scene.getActiveCamera() , i = e.viewport ? e.viewport.resolution2 : this.viewer.renderer.getSize(new yn) , r = []; t.renderer.setRenderTarget(e.target || null); var a = e.background || t.background , o = (null == e.backgroundOpacity ? t : e).backgroundOpacity; if ((0 != o && ("skybox" === a ? (t.skybox.camera.rotation.copy(t.scene.cameraP.rotation), t.skybox.camera.fov = t.scene.cameraP.fov, t.skybox.camera.aspect = t.scene.cameraP.aspect, t.skybox.parent.rotation.x = 0, t.skybox.parent.updateMatrixWorld(), t.skybox.camera.updateProjectionMatrix(), t.renderer.render(t.skybox.scene, t.skybox.camera)) : "gradient" === a ? (t.scene.cameraBG.layers.set(Potree.config.renderLayers.bg), t.renderer.render(t.scene.scene, t.scene.cameraBG)) : "overlayColor" === a && (t.scene.bg2.material.color.copy(e.backgroundColor), t.scene.bg2.material.opacity = e.backgroundOpacity, t.scene.cameraBG.layers.set(Potree.config.renderLayers.bg2), t.renderer.render(t.scene.scene, t.scene.cameraBG))), !e.magnifier) && (t.setCameraLayers(n, ["skybox"]), "showPanos" == Potree.settings.displayMode && t.images360.currentPano.pointcloud.hasDepthTex && jp.EXT_DEPTH.isSupported() && (u = !0, t.renderer.setRenderTarget(e.rtEDL || this.getRtEDL(e.viewport)), t.renderer.render(t.scene.scene, n), t.renderer.setRenderTarget(e.target || null)), t.renderer.render(t.scene.scene, n), u)) return; var s = t.scene.pointclouds.filter(function(e) { return t.getObjVisiByReason(e, "datasetSelection") }) , o = e.magnifier ? 0 < s.length : t.scene.pointclouds.some(function(e) { return e.visible }); s.forEach(function(e) { e.oldVisi = e.visible, e.visible = !0 }), t.setCameraLayers(n, ["pointcloud"]), n.layers.set(Potree.config.renderLayers.pointcloud); var l, u, c = ue(s); try { for (c.s(); !(l = c.n()).done; ) { var d = l.value , h = d.material , p = d.pcoGeometry.boundingBox.getSize(new Cn).x; h.fov = gn.degToRad(n.fov), h.resolution = i, h.spacing = d.pcoGeometry.spacing, h.near = n.near, h.far = n.far, h.uniforms.octreeSize.value = p, t.useEDL && "showPanos" != Potree.settings.displayMode ? h.useEDL = !0 : h.useEDL = !1 } } catch (e) { c.e(e) } finally { c.f() } jp.EXT_DEPTH.isSupported() && !e.dontRenderRtEDL && (t.renderer.setRenderTarget(e.rtEDL || this.getRtEDL(e.viewport)), 0 < s.length && t.pRenderer.render(t.scene.scenePointCloud, n, e.rtEDL || this.getRtEDL(e.viewport), { shadowMaps: 0 < r.length ? [this.shadowMap] : null, clipSpheres: t.scene.volumes.filter(function(e) { return e instanceof Qp }), transparent: !1 }), Potree.settings.intersectOnObjs && (n.layers.set(Potree.config.renderLayers.model), t.renderer.render(t.scene.scene, n))), t.dispatchEvent({ type: "render.pass.scene", viewer: t }), t.renderer.setRenderTarget(e.target || null), e.magnifier || s.forEach(function(e) { e.visible = e.oldVisi }), o && (t.useEDL ? ((a = this.edlMaterial.uniforms).resolution.value.copy(i), a.edlStrength.value = t.edlStrength, a.radius.value = t.edlRadius, a.useEDL.value = 1, u = n.projectionMatrix, (o = new Float32Array(16)).set(u.elements), a.uProj.value = o, a.uEDLColor.value = (e.rtEDL || this.getRtEDL(e.viewport)).texture, a.opacity.value = t.edlOpacity, Jf.screenPass.render(t.renderer, this.edlMaterial, e.target)) : t.pRenderer.render(t.scene.scenePointCloud, n, null, { shadowMaps: 0 < r.length ? [this.shadowMap] : null, clipSpheres: t.scene.volumes.filter(function(e) { return e instanceof Qp }) })), s.forEach(function(e) { e.visible = e.oldVisi }) } }]), t }() , eg = function() { function t(e) { O(this, t), this.viewer = e, this.depthMaterials = new Map, this.attributeMaterials = new Map, this.normalizationMaterial = null, this.rtDepth = null, this.rtAttribute = null, this.gl = e.renderer.getContext(), this.initialized = !1, e.addEventListener("resize", this.resize.bind(this)) } return h(t, [{ key: "init", value: function() { this.initialized || (this.normalizationMaterial = new Av, this.normalizationMaterial.depthTest = !0, this.normalizationMaterial.depthWrite = !0, this.normalizationMaterial.transparent = !0, this.normalizationEDLMaterial = new Mv, this.normalizationEDLMaterial.depthTest = !0, this.normalizationEDLMaterial.depthWrite = !0, this.normalizationEDLMaterial.transparent = !0, this.rtDepth = new An(1024,1024,{ minFilter: Re, magFilter: Re, format: et, type: Xe, depthTexture: new El(void 0,void 0,We) }), this.rtAttribute = new An(1024,1024,{ minFilter: Re, magFilter: Re, format: et, type: Xe, depthTexture: this.rtDepth.depthTexture }), this.initialized = !0) } }, { key: "resize", value: function(e) { this.rtDepth.setSize(e.canvasWidth, e.canvasHeight), this.rtAttribute.setSize(e.canvasWidth, e.canvasHeight) } }, { key: "clearTargets", value: function(e) { var t = this.viewer.renderer , n = t.getRenderTarget(); e.target && (t.setRenderTarget(e.target), t.clear()), t.setClearColor(0, 0), t.setRenderTarget(this.rtDepth), t.clear(!0, !0, !0), t.setRenderTarget(this.rtAttribute), t.clear(!0, !0, !0), t.setRenderTarget(n) } }, { key: "clear", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; this.init(); var t = this.viewer , n = t.renderer , t = t.background; "skybox" === t || "gradient" === t ? n.setClearColor(0, 0) : "black" === t ? n.setClearColor(0, 1) : "white" === t ? n.setClearColor(16777215, 1) : n.setClearColor(0, 0), e.target || n.clear(), this.clearTargets(e) } }, { key: "render", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; this.init(); var t = this.viewer , n = e.camera || t.scene.getActiveCamera() , i = e.width ? e : this.viewer.renderer.getSize(new yn) , r = i.width , a = i.height; t.renderer.setRenderTarget(e.target || null), t.dispatchEvent({ type: "render.pass.begin", viewer: t }); var o, i = t.scene.pointclouds.filter(function(e) { return e.visible }), s = new Map, l = ue(i); try { for (l.s(); !(o = l.n()).done; ) { var u, c, d = o.value; s.set(d, d.material), this.attributeMaterials.has(d) || (u = new Rm, this.attributeMaterials.set(d, u)), this.depthMaterials.has(d) || ((c = new Rm).setDefine("depth_pass", "#define hq_depth_pass"), c.setDefine("use_edl", "#define use_edl"), this.depthMaterials.set(d, c)) } } catch (e) { l.e(e) } finally { l.f() } var h, p = ue(i); try { for (p.s(); !(h = p.n()).done; ) { var f = h.value , m = f.pcoGeometry.boundingBox.getSize(new Cn).x , v = s.get(f) , g = this.depthMaterials.get(f); g.size = v.size, g.minSize = v.minSize, g.maxSize = v.maxSize, g.pointSizeType = v.pointSizeType, g.visibleNodesTexture = v.visibleNodesTexture, g.weighted = !1, g.screenWidth = r, g.shape = om.CIRCLE, g.screenHeight = a, g.uniforms.visibleNodes.value = v.visibleNodesTexture, g.uniforms.octreeSize.value = m, g.spacing = f.pcoGeometry.spacing, g.classification = v.classification, g.uniforms.classificationLUT.value.image.data = v.uniforms.classificationLUT.value.image.data, g.classificationTexture.needsUpdate = !0, g.uniforms.uFilterReturnNumberRange.value = v.uniforms.uFilterReturnNumberRange.value, g.uniforms.uFilterNumberOfReturnsRange.value = v.uniforms.uFilterNumberOfReturnsRange.value, g.uniforms.uFilterGPSTimeClipRange.value = v.uniforms.uFilterGPSTimeClipRange.value, g.uniforms.uFilterPointSourceIDClipRange.value = v.uniforms.uFilterPointSourceIDClipRange.value, g.clipTask = v.clipTask, g.clipMethod = v.clipMethod, g.setClipBoxes(v.clipBoxes), g.setClipPolygons(v.clipPolygons), f.material = g } } catch (e) { p.e(e) } finally { p.f() } t.pRenderer.render(t.scene.scenePointCloud, n, e.rtEDL || this.rtDepth, { clipSpheres: t.scene.volumes.filter(function(e) { return e instanceof Qp }) }); var y, w = ue(i); try { for (w.s(); !(y = w.n()).done; ) { var b = y.value , x = b.pcoGeometry.boundingBox.getSize(new Cn).x , E = s.get(b) , _ = this.attributeMaterials.get(b); _.size = E.size, _.minSize = E.minSize, _.maxSize = E.maxSize, _.pointSizeType = E.pointSizeType, _.activeAttributeName = E.activeAttributeName, _.visibleNodesTexture = E.visibleNodesTexture, _.weighted = !0, _.screenWidth = r, _.screenHeight = a, _.shape = om.CIRCLE, _.uniforms.visibleNodes.value = E.visibleNodesTexture, _.uniforms.octreeSize.value = x, _.spacing = b.pcoGeometry.spacing, _.classification = E.classification, _.uniforms.classificationLUT.value.image.data = E.uniforms.classificationLUT.value.image.data, _.classificationTexture.needsUpdate = !0, _.uniforms.uFilterReturnNumberRange.value = E.uniforms.uFilterReturnNumberRange.value, _.uniforms.uFilterNumberOfReturnsRange.value = E.uniforms.uFilterNumberOfReturnsRange.value, _.uniforms.uFilterGPSTimeClipRange.value = E.uniforms.uFilterGPSTimeClipRange.value, _.uniforms.uFilterPointSourceIDClipRange.value = E.uniforms.uFilterPointSourceIDClipRange.value, _.elevationGradientRepeat = E.elevationGradientRepeat, _.elevationRange = E.elevationRange, _.gradient = E.gradient, _.matcap = E.matcap, _.intensityRange = E.intensityRange, _.intensityGamma = E.intensityGamma, _.intensityContrast = E.intensityContrast, _.intensityBrightness = E.intensityBrightness, _.rgbGamma = E.rgbGamma, _.rgbContrast = E.rgbContrast, _.rgbBrightness = E.rgbBrightness, _.weightRGB = E.weightRGB, _.weightIntensity = E.weightIntensity, _.weightElevation = E.weightElevation, _.weightRGB = E.weightRGB, _.weightClassification = E.weightClassification, _.weightReturnNumber = E.weightReturnNumber, _.weightSourceID = E.weightSourceID, _.color = E.color, _.clipTask = E.clipTask, _.clipMethod = E.clipMethod, _.setClipBoxes(E.clipBoxes), _.setClipPolygons(E.clipPolygons), b.material = _ } } catch (e) { w.e(e) } finally { w.f() } i = this.gl; t.pRenderer.render(t.scene.scenePointCloud, n, this.rtAttribute, { clipSpheres: t.scene.volumes.filter(function(e) { return e instanceof Qp }), blendFunc: [i.SRC_ALPHA, i.ONE], depthWrite: !1 }); var M, A = ue(s); try { for (A.s(); !(M = A.n()).done; ) { var T = N(M.value, 2) , S = T[0] , C = T[1]; S.material = C } } catch (e) { A.e(e) } finally { A.f() } "skybox" === t.background ? (t.renderer.setClearColor(0, 0), t.renderer.clear(), t.skybox.camera.rotation.copy(t.scene.cameraP.rotation), t.skybox.camera.fov = t.scene.cameraP.fov, t.skybox.camera.aspect = t.scene.cameraP.aspect, t.skybox.parent.rotation.x = 0, t.skybox.parent.updateMatrixWorld(), t.skybox.camera.updateProjectionMatrix(), t.renderer.render(t.skybox.scene, t.skybox.camera)) : "gradient" === t.background ? (t.renderer.setClearColor(0, 0), t.renderer.clear(), t.renderer.render(t.scene.sceneBG, t.scene.cameraBG)) : ("black" === t.background ? t.renderer.setClearColor(0, 1) : "white" === t.background ? t.renderer.setClearColor(16777215, 1) : t.renderer.setClearColor(0, 0), t.renderer.clear()); i = this.useEDL ? this.normalizationEDLMaterial : this.normalizationMaterial; this.useEDL && (i.uniforms.edlStrength.value = t.edlStrength, i.uniforms.radius.value = t.edlRadius, i.uniforms.screenWidth.value = r, i.uniforms.screenHeight.value = a, i.uniforms.uEDLMap.value = (e.rtEDL || this.rtDepth).texture), i.uniforms.uWeightMap.value = this.rtAttribute.texture, i.uniforms.uDepthMap.value = this.rtAttribute.depthTexture, Jf.screenPass.render(t.renderer, i), t.renderer.render(t.scene.scene, n), t.dispatchEvent({ type: "render.pass.scene", viewer: t }), t.renderer.render(t.scene.sceneOverlay, n), t.renderer.clearDepth(), t.transformationTool.update(), e.target || (t.dispatchEvent({ type: "render.pass.perspective_overlay", viewer: t, camera: n }), t.renderer.render(t.overlay, n)), t.renderer.render(t.controls.sceneControls, n), t.renderer.render(t.clippingTool.sceneVolume, n), t.renderer.render(t.transformationTool.scene, n), t.renderer.setViewport(r - t.navigationCube.width, a - t.navigationCube.width, t.navigationCube.width, t.navigationCube.width), t.renderer.render(t.navigationCube, t.navigationCube.camera), t.renderer.setViewport(0, 0, r, a), t.dispatchEvent({ type: "render.pass.end", viewer: t }), t.renderer.setRenderTarget(null) } }]), t }() , tg = 0 , ng = function() { y(n, hn); var t = w(n); function n() { var e; return O(this, n), (e = t.call(this)).position = new Cn(0,0,0), e.yaw = 0, e._pitch = 0, e.radius = 1, e.maxPitch = Math.PI / 2, e.minPitch = -Math.PI / 2, e.sid = tg++, e.LookTransition = "LookTransition" + e.sid, e } return h(n, [{ key: "applyToCamera", value: function(e) { e.position.copy(this.position), e.rotation.copy(this.rotation), e.updateMatrix(), e.updateMatrixWorld() } }, { key: "rotation", get: function() { var e = new ci; return e.order = "ZXY", e.x = Math.PI / 2 + this.pitch, e.z = this.yaw, e }, set: function(e) { this.direction = new Cn(0,0,-1).applyEuler(e) } }, { key: "copy", value: function(e) { Fm.CopyClassObject(this, e) } }, { key: "clone", value: function() { return Fm.CloneClassObject(this) } }, { key: "pitch", get: function() { return this._pitch }, set: function(e) { this._pitch = Math.max(Math.min(e, this.maxPitch), this.minPitch) } }, { key: "direction", get: function() { var e = new Cn(0,1,0); return e.applyAxisAngle(new Cn(1,0,0), this.pitch), e.applyAxisAngle(new Cn(0,0,1), this.yaw), e }, set: function(e) { var t; 0 === e.x && 0 === e.y ? this.pitch = Math.PI / 2 * Math.sign(e.z) : (t = Math.atan2(e.y, e.x) - Math.PI / 2, e = Math.atan2(e.z, Math.sqrt(e.x * e.x + e.y * e.y)), this.yaw = t, this.pitch = e) } }, { key: "lookAt", value: function(e) { 1 === arguments.length ? t = (new Cn).subVectors(e, this.position) : 3 === arguments.length && (t = (new Cn).subVectors(B(Cn, Array.prototype.slice.call(arguments)), this.position)); var e = t.length() , t = t.normalize(); this.radius = e, this.direction = t } }, { key: "getPivot", value: function() { return (new Cn).addVectors(this.position, this.direction.multiplyScalar(this.radius)) } }, { key: "getSide", value: function() { var e = new Cn(1,0,0); return e.applyAxisAngle(new Cn(0,0,1), this.yaw), e } }, { key: "pan", value: function(e, t) { this.translate(e, 0, t) } }, { key: "translate", value: function(e, t, n) { var i = new Cn(0,1,0); i.applyAxisAngle(new Cn(1,0,0), this.pitch), i.applyAxisAngle(new Cn(0,0,1), this.yaw); var r = new Cn(1,0,0); r.applyAxisAngle(new Cn(0,0,1), this.yaw); var a = r.clone().cross(i) , n = r.multiplyScalar(e).add(i.multiplyScalar(t)).add(a.multiplyScalar(n)); this.fixZWhenPan && n.setZ(0), this.position = this.position.add(n), this.restrictPos() } }, { key: "translateWorld", value: function(e, t, n) { this.position.x += e, this.position.y += t, this.position.z += n, this.restrictPos() } }, { key: "restrictPos", value: function() { this.limitBound && this.position.clamp(this.limitBound.min, this.limitBound.max) } }, { key: "setCubeView", value: function(e) { switch (e) { case "front": this.yaw = 0, this.pitch = 0; break; case "back": this.yaw = Math.PI, this.pitch = 0; break; case "left": this.yaw = -Math.PI / 2, this.pitch = 0; break; case "right": this.yaw = Math.PI / 2, this.pitch = 0; break; case "top": this.yaw = 0, this.pitch = -Math.PI / 2; break; case "bottom": this.yaw = -Math.PI, this.pitch = Math.PI / 2 } } }, { key: "isFlying", value: function() { return 0 < gv.getById(this.LookTransition).length } }, { key: "cancelFlying", value: function() { gv.cancelById(this.LookTransition, !0) } }, { key: "setView", value: function() { var r = this , a = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; this.cancelFlying(); function e() { function e() { a.callback && a.callback(), r.dispatchEvent("flyingDone") } l ? r.lookAt(l) : o && (r.rotation = (new ci).setFromQuaternion(o)), a.duration ? setTimeout(e, 1) : e() } var o, t = (new Cn).copy(a.position), n = this.position.clone(), i = this.getPivot(), s = Up.getQuaFromPosAim(n, i), l = null; a.target ? (l = (new Cn).copy(a.target), o = Up.getQuaFromPosAim(t, l)) : a.quaternion && (o = a.quaternion.clone()), a.duration ? gv.start(fv(this.position, t, function(e, t) { var n, i = t; o && (n = (new Sn).copy(s), mv(n, o)(t), r.rotation = (new ci).setFromQuaternion(n)), r.restrictPos(), a.onUpdate && a.onUpdate(i) }), a.duration, e, 0, a.Easing ? pv[a.Easing] : pv.easeInOutSine, null, this.LookTransition, a.cancelFun) : (this.position.copy(t), this.restrictPos(), a.onUpdate && a.onUpdate(1), e()) } }, { key: "moveOrthoCamera", value: function(i, e, t, n) { var r, a = i.camera, o = a.zoom, s = e.endPosition, l = e.boundSize, u = e.endZoom, c = e.margin || { x: 0, y: 0 }; e.bound && (s = s || e.bound.getCenter(new Cn), r = (new ni).makeRotationFromEuler(this.rotation).invert(), l = e.bound.clone().applyMatrix4(r).getSize(new Cn)), l && 0 == l.x && 0 == l.y && l.set(1, 1), this.setView({ position: s, duration: t, callback: function() {}, onUpdate: function(e) { var t, n; (l || u) && (l && (t = l.x / l.y, u = a.aspect > t ? (n = l.y, (i.resolution.y - c.y) / n) : (n = l.x, (i.resolution.x - c.x) / n)), a.zoom = u * e + o * (1 - e), a.updateProjectionMatrix()) }, Easing: n }) } }, { key: "zoomOrthoCamera", value: function(n, i, e, t, r) { var a = this , o = n.zoom , s = new Cn(e.x,e.y,.5); gv.start(function(e) { var t = s.clone().unproject(n); n.zoom = i * e + o * (1 - e), n.updateProjectionMatrix(); e = s.clone().unproject(n), t = (new Cn).subVectors(e, t); n.position.sub(t), a.position.copy(n.position), r && r() }, t, null, 0, pv.easeInOutSine, null, "zoomInView") } }]), n }() , ig = function() { y(i, Si); var n = w(i); function i(e) { var t; return O(this, i), (t = n.call(this)).getArrow(), t.createArrows(), t } return h(i, [{ key: "getArrow", value: function() { var e = new Si , t = Sf.createLine([new Cn, new Cn(0,0,2)]) , n = new Hr(new Cl(.3,.3,4)); n.position.set(0, 0, 9); var i = new Hr(new kl(0,.6,2,12,1,!1)); i.position.set(0, 0, 12), i.rotation.set(Math.PI / 2, 0, 0), e.add(n), e.add(t), e.add(i), this.arrowGroup = e } }, { key: "createArrows", value: function() { var r = this; new $i({ color: "#00d7df", side: 2, transparent: !0, opacity: .8, depthWrite: !1 }); Object.keys(Potree.config.axis).forEach(function(e) { var t = Potree.config.axis[e].color , n = r.arrowGroup.clone(); n.children.forEach(function(e) { e.material = e.material.clone(), e.material.color.set(t) }); var i = r.createLabel(e, t); i.position.set(0, 0, 16), n.add(i), "y" == e ? n.rotation.x = -Math.PI / 2 : "x" == e && (n.rotation.y = Math.PI / 2), r.add(n) }) } }, { key: "createLabel", value: function(e, t) { var n = document.createElement("canvas") , i = n.getContext("2d"); n.width = 256, n.height = 256; i.fillStyle = t, i.font = "normal 120px 微软雅黑"; t = i.measureText(e).width; i.clearRect(0, 0, n.width, n.height), i.fillText(e, (n.width - t) / 2, (n.height + 120) / 2); n = new En(n); n.needsUpdate = !0, n.minFilter = Re, n.magFilter = Re; n = new Fs(new Es({ map: n })); return n.renderOrder = 1, n.scale.set(3, 3, 3), n } }]), i }() , rg = function() { y(n, hn); var t = w(n); function n() { var e; return O(this, n), (e = t.call(this)).annotations = new Kf, e.scene = new gs, e.scenePointCloud = new gs, e.cameraP = new $r(e.fov,1,Potree.config.view.near,Potree.config.view.near), e.cameraO = new ed(-1,1,1,-1,Potree.config.view.near,Potree.settings.cameraFar), e.cameraP.limitFar = !0, e.cameraVR = new $r, e.cameraBG = new Kr, e.cameraScreenSpace = new ed(-1,1,1,-1,.1,10), e.cameraMode = em.PERSPECTIVE, e.overrideCamera = null, e.pointclouds = [], e.measurements = [], e.profiles = [], e.volumes = [], e.polygonClipVolumes = [], e.cameraAnimations = [], e.orientedImages = [], e.images360 = [], e.geopackages = [], e.fpControls = null, e.orbitControls = null, e.earthControls = null, e.geoControls = null, e.deviceControls = null, e.inputHandler = null, e.view = new ng, e.directionalLight = null, e.initialize(), e.axisArrow = new ig, e.scene.add(e.axisArrow), Potree.settings.isDebug || (e.axisArrow.visible = !1), viewer.setObjectLayers(e.axisArrow, "bothMapAndScene"), e.tags = new Si, e.scene.add(e.tags), e } return h(n, [{ key: "estimateHeightAt", value: function(e) { var t, n = null, i = 1 / 0, r = ue(this.pointclouds); try { for (r.s(); !(t = r.n()).done; ) { var a = t.value; if (void 0 !== a.root.geometryNode) { var o = null , s = 1 / 0 , l = e.clone().sub(a.position); l.z = 0; for (var u = new ti(l,new Cn(0,0,1)), c = [a.root]; 0 < c.length; ) { var d = c.pop() , h = d.getBoundingBox(); if (u.intersectBox(h)) { var p = d.geometryNode.mean.z + a.position.z + d.geometryNode.boundingBox.min.z; d.geometryNode.spacing <= s && (o = p, s = d.geometryNode.spacing); for (var f = 0, m = Object.keys(d.children); f < m.length; f++) { var v = m[f]; d.children[v].geometryNode && c.push(d.children[v]) } } } (null === n || s < i) && (n = o, i = s) } } } catch (e) { r.e(e) } finally { r.f() } return n } }, { key: "getBoundingBox", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : this.pointclouds , t = new kn; this.scenePointCloud.updateMatrixWorld(!0), this.referenceFrame.updateMatrixWorld(!0); var n, i = ue(e); try { for (i.s(); !(n = i.n()).done; ) { var r = n.value; r.updateMatrixWorld(!0); var a = r.pcoGeometry.tightBoundingBox || r.boundingBox , o = Jf.computeTransformedBoundingBox(a, r.matrixWorld); t.union(o) } } catch (e) { i.e(e) } finally { i.f() } return t } }, { key: "addPointCloud", value: function(e) { this.pointclouds.push(e), this.scenePointCloud.add(e), this.dispatchEvent({ type: "pointcloud_added", pointcloud: e }) } }, { key: "removePointCloud", value: function(e) { var t = this.pointclouds.indexOf(e); -1 != t && (this.pointclouds.splice(t, 1), this.scenePointCloud.remove(e), e.panos.forEach(function(e) { e.dispose() })) } }, { key: "addVolume", value: function(e) { this.volumes.push(e), this.dispatchEvent({ type: "volume_added", scene: this, volume: e }) } }, { key: "addOrientedImages", value: function(e) { this.orientedImages.push(e), this.scene.add(e.node), this.dispatchEvent({ type: "oriented_images_added", scene: this, images: e }) } }, { key: "removeOrientedImages", value: function(e) { var t = this.orientedImages.indexOf(e); -1 < t && (this.orientedImages.splice(t, 1), this.dispatchEvent({ type: "oriented_images_removed", scene: this, images: e })) } }, { key: "add360Images", value: function(e) { this.images360.push(e), this.scene.add(e.node), this.dispatchEvent({ type: "360_images_added", scene: this, images: e }) } }, { key: "remove360Images", value: function(e) { var t = this.images360.indexOf(e); -1 < t && (this.images360.splice(t, 1), this.dispatchEvent({ type: "360_images_removed", scene: this, images: e })) } }, { key: "addGeopackage", value: function(e) { this.geopackages.push(e), this.scene.add(e.node), this.dispatchEvent({ type: "geopackage_added", scene: this, geopackage: e }) } }, { key: "removeGeopackage", value: function(e) { var t = this.geopackages.indexOf(e); -1 < t && (this.geopackages.splice(t, 1), this.dispatchEvent({ type: "geopackage_removed", scene: this, geopackage: e })) } }, { key: "removeVolume", value: function(e) { var t = this.volumes.indexOf(e); -1 < t && (this.volumes.splice(t, 1), this.dispatchEvent({ type: "volume_removed", scene: this, volume: e })) } }, { key: "addCameraAnimation", value: function(e) { this.cameraAnimations.push(e), this.dispatchEvent({ type: "camera_animation_added", scene: this, animation: e }) } }, { key: "removeCameraAnimation", value: function(e) { var t = this.cameraAnimations.indexOf(e); -1 < t && (this.cameraAnimations.splice(t, 1), this.dispatchEvent({ type: "camera_animation_removed", scene: this, animation: e })) } }, { key: "addPolygonClipVolume", value: function(e) { this.polygonClipVolumes.push(e), this.dispatchEvent({ type: "polygon_clip_volume_added", scene: this, volume: e }) } }, { key: "removePolygonClipVolume", value: function(e) { var t = this.polygonClipVolumes.indexOf(e); -1 < t && (this.polygonClipVolumes.splice(t, 1), this.dispatchEvent({ type: "polygon_clip_volume_removed", scene: this, volume: e })) } }, { key: "addMeasurement", value: function(e) { e.lengthUnit = this.lengthUnit, e.lengthUnitDisplay = this.lengthUnitDisplay, this.measurements.push(e), this.dispatchEvent({ type: "measurement_added", scene: this, measurement: e }) } }, { key: "removeMeasurement", value: function(e) { var t = this.measurements.indexOf(e); -1 < t && (this.measurements.splice(t, 1), this.dispatchEvent({ type: "measurement_removed", scene: this, measurement: e })) } }, { key: "addProfile", value: function(e) { this.profiles.push(e), this.dispatchEvent({ type: "profile_added", scene: this, profile: e }) } }, { key: "removeProfile", value: function(e) { var t = this.profiles.indexOf(e); -1 < t && (this.profiles.splice(t, 1), this.dispatchEvent({ type: "profile_removed", scene: this, profile: e })) } }, { key: "removeAllMeasurements", value: function() { for (; 0 < this.measurements.length; ) this.removeMeasurement(this.measurements[0]); for (; 0 < this.profiles.length; ) this.removeProfile(this.profiles[0]); for (; 0 < this.volumes.length; ) this.removeVolume(this.volumes[0]) } }, { key: "removeAllClipVolumes", value: function() { var e, t = ue(this.volumes.filter(function(e) { return !0 === e.clip })); try { for (t.s(); !(e = t.n()).done; ) { var n = e.value; this.removeVolume(n) } } catch (e) { t.e(e) } finally { t.f() } for (; 0 < this.polygonClipVolumes.length; ) this.removePolygonClipVolume(this.polygonClipVolumes[0]) } }, { key: "getActiveCamera", value: function() { return viewer.mainViewport.camera } }, { key: "initialize", value: function() { this.referenceFrame = new Si, this.referenceFrame.matrixAutoUpdate = !1, this.scenePointCloud.add(this.referenceFrame), window.axisYup || (this.cameraP.up.set(0, 0, 1), this.cameraO.up.set(0, 0, 1)), this.cameraP.position.set(1e3, 1e3, 1e3), this.cameraO.position.set(1e3, 1e3, 1e3), this.cameraScreenSpace.lookAt(new Cn(0,0,0), new Cn(0,0,-1), new Cn(0,1,0)), this.directionalLight = new nd(16777215,.5), this.directionalLight.position.set(10, 10, 10), this.directionalLight.lookAt(new Cn(0,0,0)), this.scenePointCloud.add(this.directionalLight); var e = new id(5592405); this.scenePointCloud.add(e); e = new id(16777215,1); viewer.setObjectLayers(e, "bothMapAndScene"), this.scene.add(e); e = new nd(16777215,1); e.position.set(10, 10, 10), e.lookAt(new Cn(0,0,0)), viewer.setObjectLayers(e, "bothMapAndScene"), this.scene.add(e); e = Jf.createBackgroundTexture(512, 512); e.minFilter = e.magFilter = Re, e.minFilter = e.magFilter = Oe; e = new Hr(new ua(2,2,1),new $i({ map: e })); e.material.depthTest = !1, e.material.depthWrite = !1, e.name = "bg", this.scene.add(e), e.layers.set(Potree.config.renderLayers.bg); e = new Hr(new ua(2,2,1),new $i({ transparent: !0 })); e.material.depthTest = !1, e.material.depthWrite = !1, e.name = "bg2", this.scene.add(e), e.layers.set(Potree.config.renderLayers.bg2), this.bg2 = e } }, { key: "addAnnotation", value: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; e instanceof Array ? t.position = (new Cn).fromArray(e) : null != e.x && (t.position = e); t = new Kf(t); return this.annotations.add(t), t } }, { key: "getAnnotations", value: function() { return this.annotations } }, { key: "removeAnnotation", value: function(e) { this.annotations.remove(e) } }]), n }(); proj4.defs([["UTM10N", "+proj=utm +zone=10 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"], ["EPSG:6339", "+proj=utm +zone=10 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6340", "+proj=utm +zone=11 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6341", "+proj=utm +zone=12 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6342", "+proj=utm +zone=13 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6343", "+proj=utm +zone=14 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6344", "+proj=utm +zone=15 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6345", "+proj=utm +zone=16 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6346", "+proj=utm +zone=17 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6347", "+proj=utm +zone=18 +ellps=GRS80 +units=m +no_defs"], ["EPSG:6348", "+proj=utm +zone=19 +ellps=GRS80 +units=m +no_defs"], ["EPSG:26910", "+proj=utm +zone=10 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26911", "+proj=utm +zone=11 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26912", "+proj=utm +zone=12 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26913", "+proj=utm +zone=13 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26914", "+proj=utm +zone=14 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26915", "+proj=utm +zone=15 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26916", "+proj=utm +zone=16 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26917", "+proj=utm +zone=17 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26918", "+proj=utm +zone=18 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "], ["EPSG:26919", "+proj=utm +zone=19 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs "]]); var ag = new _c; ag.crossOrigin = "anonymous"; var og = new Cn , sg = new Zi(0,1,2) , lg = new Zi(2,3,0) , ug = ((pd = new $i({ transparent: !0, depthWrite: !1, depthTest: !0, opacity: 1, side: Y })).color = new Yi(3355443), pd) , gu = new yn(0,0) , rh = new yn(0,1) , Ou = new yn(1,0) , Ch = new yn(1,1) , cg = [gu, Ou, Ch] , dg = [Ch, rh, gu] , hg = function() { y(r, hn); var i = w(r); function r(e, t) { var n; O(this, r), (n = i.call(this)).sceneGroup = new Si, n.sceneGroup.name = "MapLayer", n.loadingInProgress = 0, n.maps = [], n.frustum = new oa, n.frustumMatrix = new ni, n.tileColor = new Yi(16777215), n.viewport = t, n.changeViewer(e); e = new gg(g(n),n.tileColor); return n.addMap(e), n } return h(r, [{ key: "addMapEntity", value: function(e, t) { if (e && e[0]) { e = new yg(this,this.tileColor,e[0]); return e && (e.name += "_" + t, this.addMap(e), e.updateProjection(), e.updateObjectGroup(), (t in Potree.settings.floorplanEnables ? Potree.settings.floorplanEnables[t] : Potree.settings.floorplanEnable) ? this.needUpdate = !0 : e.setEnable(!1), this.dispatchEvent({ type: "floorplanLoaded", floorplan: e })), e } Potree.Log("平面图无数据", "red") } }, { key: "getFloorplan", value: function(t) { return this.maps.find(function(e) { return e.name == "floorplan_" + t }) } }, { key: "addMap", value: function(e) { this.maps.push(e), this.needUpdate = !0 } }, { key: "removeMap", value: function(e) { var t = this.maps.indexOf(e); 0 <= t && (e.removeFromSceneGroup(this.sceneGroup), this.maps.splice(t, 1)), this.needUpdate = !0, this.viewer.dispatchEvent({ type: "content_changed" }) } }, { key: "changeViewer", value: function(e) { this.viewer = e } }, { key: "initProjection", value: function() { this.maps.forEach(function(e) { e.updateProjection(), e.updateObjectGroup() }) } }, { key: "visibilityChanged", value: function() { if (!this.visible) for (var e = 0, t = this.maps; e < t.length; e++) t[e].removeFromSceneGroup(this.sceneGroup) } }, { key: "onAfterRenderViewport", value: function(e) {} }, { key: "update", value: function() { if (this.needUpdate = !1, !this.disabled && this.maps.find(function(e) { return !e.disabled }) && this.maps.find(function(e) { return e.objectGroup.visible })) { var e, t, n; for (this.updateTimer = void 0, (t = (e = this.viewport.camera).projectionMatrix.clone()).elements[0] /= 1.5, t.elements[5] /= 1.5, this.frustumMatrix.multiplyMatrices(t, e.matrixWorldInverse), this.frustum.setFromProjectionMatrix(this.frustumMatrix), this.frustum.planes[4].setComponents(0, 0, 0, 0), this.frustum.planes[5].setComponents(0, 0, 0, 0), i = !0, n = 0; n < this.maps.length; n++) var i = this.maps[n].update(this.frustum, this.sceneGroup) && i; return [2, i] } } }, { key: "getAttributions", value: function() { for (var e = {}, t = 0, n = this.maps; t < n.length; t++) n[t].fillAttributions(e); return e } }, { key: "updateProjection", value: function() { for (var e = 0, t = this.maps; e < t.length; e++) { var n = t[e]; n.clearProjection(), n.updateObjectGroup() } } }]), r }() , pg = function() { y(o, hn); var a = w(o); function o(e, t, n, i) { var r; return O(this, o), (r = a.call(this)).name = e, r.mapLayer = t, r.tileColor = n, r.bias = 0, r.zIndex = -1, r.objectGroup = new Si, r.objectGroup.name = e, r.objectGroupAdded = !1, r.baseTile = new fg(g(r),r.objectGroup,r.tileColor), r.isTileVisibleBox = new kn, r.isTileVisibleVec = new Cn, r.projection = i, r._zoomLevel = 0, r } return h(o, [{ key: "zoomLevel", get: function() { return this._zoomLevel }, set: function(e) { this._zoomLevel != e && (this._zoomLevel = e) } }, { key: "updateObjectGroup", value: function() { this.position && this.objectGroup.position.copy(this.position), this.quaternion && this.objectGroup.quaternion.copy(this.quaternion), this.objectGroup.updateMatrixWorld(!0) } }, { key: "updateProjection", value: function() { this.transformMapToLocal || proj4.defs("NAVVIS:TMERC") && ("EPSG:4550" == this.projection ? this.transformMapToLocal = { forward: function(e) { e = viewer.transform.lonlatTo4550.inverse(e); return viewer.transform.lonlatToLocal.forward(e) } } : this.transformMapToLocal = proj4(this.projection, "NAVVIS:TMERC")) } }, { key: "setEnable", value: function(e) { !this.disabled != e && (e && console.log("setEnable", !0), this.disabled = !e, viewer.updateVisible(this.objectGroup, "setEnable", e), e ? this.mapLayer.needUpdate = !0 : this.baseTile.remove(), this.mapLayer.viewer.dispatchEvent({ type: "content_changed" })) } }, { key: "update", value: function(e, t) { var n = this.disabled || !this.objectGroup.visible; if (("map" == this.name || !n) && (this.updateProjection(), this.transformMapToLocal)) { if (!this.isTileVisible(new Cn(0,0,0), this.mapSizeM, e)) return this.removeFromSceneGroup(t), !0; var i = this.mapLayer.viewport , r = new Cn(-.5 * this.mapSizeM,0,0); r.applyMatrix4(this.objectGroup.matrixWorld), r.project(i.camera); var a = new Cn(.5 * this.mapSizeM,0,0); a.applyMatrix4(this.objectGroup.matrixWorld), a.project(i.camera); var o = i.resolution.x , i = i.resolution.y; if (o <= 0 || i <= 0 || isNaN(r.x) || isNaN(a.x)) return !1; r.sub(a), r.x *= o / 2, r.y *= i / 2; r = this.tileSizePx / r.length(), r = Math.ceil(-Math.log(r) / Math.log(2) - this.bias), r = Math.max(r, 0); return r = Math.min(r, void 0 === this.maxDepth ? 1 / 0 : this.maxDepth), this.zoomLevel = r, n ? void 0 : (this.addToSceneGroup(t), this.baseTile.update(this, e, r, this.mapSizeM, 0, 0, "")) } } }, { key: "isTileVisible", value: function(e, t, n) { if (21e6 < t) return !0; t *= .5; return this.transformMapToLocal.forward(e), this.isTileVisibleBox.makeEmpty(), this.isTileVisibleVec.set(e.x - t, e.y - t, e.z).applyMatrix4(this.objectGroup.matrixWorld), this.isTileVisibleBox.expandByPoint(this.isTileVisibleVec), this.isTileVisibleVec.set(e.x - t, e.y + t, e.z).applyMatrix4(this.objectGroup.matrixWorld), this.isTileVisibleBox.expandByPoint(this.isTileVisibleVec), this.isTileVisibleVec.set(e.x + t, e.y - t, e.z).applyMatrix4(this.objectGroup.matrixWorld), this.isTileVisibleBox.expandByPoint(this.isTileVisibleVec), this.isTileVisibleVec.set(e.x + t, e.y + t, e.z).applyMatrix4(this.objectGroup.matrixWorld), this.isTileVisibleBox.expandByPoint(this.isTileVisibleVec), n.intersectsBox(this.isTileVisibleBox) } }, { key: "addToSceneGroup", value: function(e) { this.objectGroupAdded || (e.add(this.objectGroup), this.objectGroupAdded = !0) } }, { key: "removeFromSceneGroup", value: function(e) { this.baseTile.remove(), this.objectGroupAdded && (e.remove(this.objectGroup), this.objectGroupAdded = !1) } }]), o }() , fg = function() { function f(e, t, n) { O(this, f), this.map = e, this.objectGroup = t, this.tileColor = n, this.meshAdded = !1, this.textureLoaded = !1, this.children = [] } return h(f, [{ key: "update", value: function(e, t, n, i, r, a, o) { return !!this.doesNotContainTilesToBeDisplayed(e) || (0 === n ? this.updateTile(e, i, r, a) : this.updateSubTiles(e, t, n, i, r, a, o)) } }, { key: "doesNotContainTilesToBeDisplayed", value: function(e) { return e.tilePresenceMap && e.tilePresenceMap.empty } }, { key: "updateTile", value: function(e, t, n, i) { return this.mesh || this.createTileObject(e, t, n, i), this.meshAdded || (this.objectGroup.add(this.mesh), this.meshAdded = !0), this.textureLoaded && this.removeChildren(), this.textureLoaded } }, { key: "updateSubTiles", value: function(e, t, n, i, r, a, o) { for (var s = !0, l = [-.25 * i, .25 * i, -.25 * i, .25 * i], u = [.25 * i, .25 * i, -.25 * i, -.25 * i], c = 0; c < 4; ++c) { var d, h, p = o + c.toString(10); e.tilePresenceMap && !e.tilePresenceMap[p] || (og.set(d = r + l[c], h = a + u[c], 0), e.isTileVisible(og, .5 * i, t) ? (this.children[c] || (this.children[c] = new f(this.map,this.objectGroup,this.tileColor)), s = this.children[c].update(e, t, n - 1, .5 * i, d, h, p) && s) : this.children[c] && (this.children[c].remove(), delete this.children[c])) } return s && this.removeObject3D(), s } }, { key: "createTileObject", value: function(e, t, n, i) { var r = this; this.mesh = this.createMesh(e.transformMapToLocal, t, n, i), this.textureLoaded = !1; var a = e.mapSizeM / t , o = Math.log(a) / Math.log(2) , n = n / t + .5 * (a - 1) , a = -i / t + .5 * (a - 1) , a = e.getTileUrl(Math.round(o), Math.round(n), Math.round(a)); viewer.setObjectLayers(this.mesh, "map"), this.mesh.renderOrder = -(1e6 - o - 100 * (e.zIndex || 0)); function s() { r.map.mapLayer.loadingInProgress--, 0 == r.map.mapLayer.loadingInProgress && r.map.mapLayer.dispatchEvent("loadDone") } e = this.mesh.material; e.map = ag.load(a, function(e) { r.mesh ? (r.textureLoaded = !0, r.mesh.material.opacity = 1, r.map.mapLayer.viewer.dispatchEvent({ type: "content_changed" }), r.map.mapLayer.needUpdate = !0) : e.dispose(), s() }, void 0, function() { r.textureLoaded = !0, r.mesh && (r.mesh.material.dispose(), r.mesh.material = ug, r.map.mapLayer.viewer.dispatchEvent({ type: "content_changed" })), s() }), e.map.anisotropy = 0, e.map.generateMipmaps = !1, e.map.minFilter = Oe, e.map.magFilter = Oe, this.map.mapLayer.loadingInProgress++ } }, { key: "createMesh", value: function(e, t, n, i) { var r = new Sl; return og.set(n - t / 2, i - t / 2, 0), r.vertices.push((new Cn).copy(e.forward(og))), og.set(n + t / 2, i - t / 2, 0), r.vertices.push((new Cn).copy(e.forward(og))), og.set(n + t / 2, i + t / 2, 0), r.vertices.push((new Cn).copy(e.forward(og))), og.set(n - t / 2, i + t / 2, 0), r.vertices.push((new Cn).copy(e.forward(og))), r.faces.push(sg), r.faces.push(lg), r.faceVertexUvs[0].push(cg), r.faceVertexUvs[0].push(dg), new Hr(r,this.createMaterial()) } }, { key: "createMaterial", value: function() { var e = new $i({ transparent: !0, depthWrite: !1, depthTest: !0, opacity: 0, side: Y }); return e.color = this.tileColor || new Yi(16777215), e } }, { key: "remove", value: function() { this.removeObject3D(), this.removeChildren() } }, { key: "removeObject3D", value: function() { var e; this.mesh && (this.objectGroup.remove(this.mesh), this.textureLoaded && (e = this.mesh.material.map) && e.dispose(), this.mesh.material.dispose(), this.mesh.geometry.dispose(), this.mesh = void 0), this.meshAdded = !1, this.textureLoaded = !1 } }, { key: "removeChildren", value: function() { for (var e = 0, t = this.children; e < t.length; e++) { var n = t[e]; n && (n.removeObject3D(), n.removeChildren()) } this.children.length = 0 } }]), f }(); proj4.defs("EPSG:3857", "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"); var mg, vg, gg = function() { y(i, pg); var n = w(i); function i(e, t) { return O(this, i), (t = n.call(this, "map", e, t, "EPSG:3857")).baseUrl = "https://wprd04.is.autonavi.com/appmaptile?lang=zh_cn&style=7&x=${x}&y=${y}&z=${z}", t.attribution = "© PopSmart, © 高德地图", t.tileSizePx = 256, t.mapSizeM = 40075017, t.maxDepth = 19, t.bias = .5, t } return h(i, [{ key: "getTileUrl", value: function(e, t, n) { return this.baseUrl.replace(/\${z}/, e.toString(10)).replace(/\${x}/, t.toString(10)).replace(/\${y}/, n.toString(10)) } }, { key: "fillAttributions", value: function(e) { e[this.attribution] = { score: 50 } } }]), i }(), yg = function() { y(r, pg); var i = w(r); function r(e, t, n) { O(this, r); t = (e = i.call(this, "floorplan", e, t, "NAVVIS:TMERC")).tiledMapEntity = e.fillFromData(n), n = t.updateTime || t.createTime; return e.tileSizePx = t.tileSizePx, e.mapSizeM = t.mapSizeM, e.maxDepth = t.maxDepth, e.postStamp = n ? n.replace(/[^0-9]/gi, "") : (new Date).getTime(), e.zIndex = 0, e.tilePresenceMap = e.decodeBitStream(e.tiledMapEntity.quadtree), e } return h(r, [{ key: "fillFromData", value: function(e) { var t = {}; return t.id = e.id, t.globalLocation = Potree.Utils.VectorFactory.fromArray3(e.location), t.orientation = Potree.Utils.QuaternionFactory.fromArray(e.orientation), Potree.fileServer ? t.filePath = "".concat(Potree.settings.urls.prefix).concat(e.file_path) : t.filePath = "".concat(Potree.settings.urls.prefix, "/data/").concat(Potree.settings.number, "/").concat(e.file_path), t.fileName = "$DEPTH/$X/$Y.png", t.type = e.type, t.mapSizeM = e.map_size_m, t.tileSizePx = e.tile_size_px, t.maxDepth = e.max_depth, t.quadtree = e.quadtree, t.floorId = e.floor_id, t.bundleId = e.bundle_id, t } }, { key: "computeLocalCoordinates", value: function() { proj4.defs("NAVVIS:TMERC") && (this.tiledMapEntity.location = (new Cn).copy(viewer.transform.lonlatToLocal.forward(this.tiledMapEntity.globalLocation))) } }, { key: "updateProjection", value: function() { b(v(r.prototype), "updateProjection", this).call(this), this.position || this.computeLocalCoordinates() } }, { key: "position", get: function() { return this.tiledMapEntity.location } }, { key: "quaternion", get: function() { return this.tiledMapEntity.orientation } }, { key: "getTileUrl", value: function(e, t, n) { return (this.tiledMapEntity.filePath + "/" + this.tiledMapEntity.fileName).replace(/\$DEPTH/g, e.toString(10)).replace(/\$X/g, t.toString(10)).replace(/\$Y/g, n.toString(10)) + ("?t=" + this.postStamp) } }, { key: "fillAttributions", value: function(e) { e.NavVis = { score: 100 } } }, { key: "decodeBitStream", value: function(e) { if (!e) return { empty: !0 }; for (var t = {}, n = [t], i = 0; i < e.length; i++) { var r, a = n.shift(), o = parseInt(e.substr(i, 1), 16); 1 & o && (a[0] = r = {}, n.push(r)), 2 & o && (a[1] = r = {}, n.push(r)), 4 & o && (a[2] = r = {}, n.push(r)), 8 & o && (a[3] = r = {}, n.push(r)) } var s = { empty: !0 }; return this.computeHashes(s, t, ""), s } }, { key: "computeHashes", value: function(e, t, n) { for (var i = 0; i < 4; i++) t[i] && (e[n + i.toString(10)] = !0, e.empty = !1, this.computeHashes(e, t[i], n + i.toString(10))) } }]), r }(), wg = {}; wg.RADIANS_PER_DEGREE = Math.PI / 180, wg.DEGREES_PER_RADIAN = 180 / Math.PI, wg.Vector3 = function(e, t, n) { this.x = e || 0, this.y = t || 0, this.z = n || 0 } , wg.Matrix4 = function() { this.elements = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), 0 < arguments.length && console.error("MathLight.Matrix4: the constructor no longer reads arguments. use .set() instead.") } , wg.Matrix4.prototype = { identity: function() { return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this }, copy: function(e) { return this.elements.set(e.elements), this }, applyToVector3: function(e) { var t = e.x , n = e.y , i = e.z , r = this.elements; return e.x = r[0] * t + r[4] * n + r[8] * i + r[12], e.y = r[1] * t + r[5] * n + r[9] * i + r[13], e.z = r[2] * t + r[6] * n + r[10] * i + r[14], this }, getInverse: function(e, t) { var n = this.elements , i = e.elements , r = i[0] , a = i[1] , o = i[2] , s = i[3] , l = i[4] , u = i[5] , c = i[6] , d = i[7] , h = i[8] , p = i[9] , f = i[10] , m = i[11] , v = i[12] , g = i[13] , y = i[14] , w = i[15] , b = p * y * d - g * f * d + g * c * m - u * y * m - p * c * w + u * f * w , x = v * f * d - h * y * d - v * c * m + l * y * m + h * c * w - l * f * w , E = h * g * d - v * p * d + v * u * m - l * g * m - h * u * w + l * p * w , _ = v * p * c - h * g * c - v * u * f + l * g * f + h * u * y - l * p * y , e = r * b + a * x + o * E + s * _; if (0 == e) { i = "MathLight.Matrix4.getInverse(): can't invert matrix, determinant is 0"; if (t) throw new Error(i); return console.warn(i), this.identity() } e = 1 / e; return n[0] = b * e, n[1] = (g * f * s - p * y * s - g * o * m + a * y * m + p * o * w - a * f * w) * e, n[2] = (u * y * s - g * c * s + g * o * d - a * y * d - u * o * w + a * c * w) * e, n[3] = (p * c * s - u * f * s - p * o * d + a * f * d + u * o * m - a * c * m) * e, n[4] = x * e, n[5] = (h * y * s - v * f * s + v * o * m - r * y * m - h * o * w + r * f * w) * e, n[6] = (v * c * s - l * y * s - v * o * d + r * y * d + l * o * w - r * c * w) * e, n[7] = (l * f * s - h * c * s + h * o * d - r * f * d - l * o * m + r * c * m) * e, n[8] = E * e, n[9] = (v * p * s - h * g * s - v * a * m + r * g * m + h * a * w - r * p * w) * e, n[10] = (l * g * s - v * u * s + v * a * d - r * g * d - l * a * w + r * u * w) * e, n[11] = (h * u * s - l * p * s - h * a * d + r * p * d + l * a * m - r * u * m) * e, n[12] = _ * e, n[13] = (h * g * o - v * p * o + v * a * f - r * g * f - h * a * y + r * p * y) * e, n[14] = (v * u * o - l * g * o - v * a * c + r * g * c + l * a * y - r * u * y) * e, n[15] = (l * p * o - h * u * o + h * a * c - r * p * c - l * a * f + r * u * f) * e, this }, makeRotationFromQuaternion: function(e) { var t = this.elements , n = e.x , i = e.y , r = e.z , a = e.w , o = n + n , s = i + i , l = r + r , u = n * o , c = n * s , e = n * l , n = i * s , i = i * l , r = r * l , o = a * o , s = a * s , l = a * l; return t[0] = 1 - (n + r), t[4] = c - l, t[8] = e + s, t[1] = c + l, t[5] = 1 - (u + r), t[9] = i - o, t[2] = e - s, t[6] = i + o, t[10] = 1 - (u + n), t[3] = 0, t[7] = 0, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this } }, wg.Quaternion = function(e, t, n, i) { this._x = e || 0, this._y = t || 0, this._z = n || 0, this._w = void 0 !== i ? i : 1 } , wg.Quaternion.prototype = { get x() { return this._x }, set x(e) { this._x = e }, get y() { return this._y }, set y(e) { this._y = e }, get z() { return this._z }, set z(e) { this._z = e }, get w() { return this._w }, set w(e) { this._w = e }, copy: function(e) { this._x = e.x, this._y = e.y, this._z = e.z, this._w = e.w }, inverse: function() { return this.conjugate().normalize() }, conjugate: function() { return this._x *= -1, this._y *= -1, this._z *= -1, this }, length: function() { return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w) }, normalize: 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 }, setFromAxisAngle: function(e, t) { var n = t / 2 , t = Math.sin(n); return this._x = e.x * t, this._y = e.y * t, this._z = e.z * t, this._w = Math.cos(n), this }, setFromUnitVectors: function(e, t) { return void 0 === mg && (mg = new wg.Vector3), (vg = wg.dot(e, t) + 1) < 1e-6 ? (vg = 0, Math.abs(e.x) > Math.abs(e.z) ? wg.setVector(mg, -e.y, e.x, 0) : wg.setVector(mg, 0, -e.z, e.y)) : wg.cross(e, t, mg), this._x = mg.x, this._y = mg.y, this._z = mg.z, this._w = vg, this.normalize() }, multiply: function(e) { return this.multiplyQuaternions(this, e) }, premultiply: function(e) { return this.multiplyQuaternions(e, this) }, multiplyQuaternions: function(e, t) { var n = e._x , i = e._y , r = e._z , a = e._w , o = t._x , s = t._y , e = t._z , t = t._w; return this._x = n * t + a * o + i * e - r * s, this._y = i * t + a * s + r * o - n * e, this._z = r * t + a * e + n * s - i * o, this._w = a * t - n * o - i * s - r * e, this } }, wg.convertWorkshopVector = function(e) { return new wg.Vector3(-e.x,e.y,e.z) } , wg.convertWorkshopQuaternion = function(e) { return new wg.Quaternion(-e.x,e.y,e.z,-e.w).multiply(new wg.Quaternion(Math.sqrt(2) / 2,Math.sqrt(2) / 2,0,0)) } , wg.convertWorkshopOrthoZoom = function(e) { return -1 === e ? -1 : e * ($("#player").width() / $("#player").height()) } , wg.convertWorkshopPanoramaQuaternion = function(e) { return new wg.Quaternion(e.x,-e.y,-e.z,e.w).normalize().multiply((new wg.Quaternion).setFromAxisAngle(new wg.Vector3(0,1,0), 270 * wg.RADIANS_PER_DEGREE)) } , wg.normalize = function(e) { var t = e.x * e.x + e.y * e.y + e.z * e.z , t = Math.sqrt(t); e.x /= t, e.y /= t, e.z /= t } , wg.dot = function(e, t) { return e.x * t.x + e.y * t.y + e.z * t.z } , wg.cross = function(e, t, n) { var i = e.x , r = e.y , e = e.z; n.x = r * t.z - e * t.y, n.y = e * t.x - i * t.z, n.z = i * t.y - r * t.x } , wg.setVector = function(e, t, n, i) { e.x = t, e.y = n, e.z = i } , wg.copyVector = function(e, t) { t.x = e.x, t.y = e.y, t.z = e.z } , wg.addVector = function(e, t) { e.x += t.x, e.y += t.y, e.z += t.z } , wg.subVector = function(e, t) { e.x -= t.x, e.y -= t.y, e.z -= t.z } , wg.applyQuaternionToVector = function(e, t) { var n = t.x , i = t.y , r = t.z , a = e.x , o = e.y , s = e.z , l = e.w , u = l * n + o * r - s * i , c = l * i + s * n - a * r , e = l * r + a * i - o * n , r = -a * n - o * i - s * r; t.x = u * l + r * -a + c * -s - e * -o, t.y = c * l + r * -o + e * -a - u * -s, t.z = e * l + r * -s + u * -o - c * -a } , wg.angleBetweenVectors = function(e, t) { return Math.acos(wg.dot(e, t)) } ; var bg, xg, Eg, _g, Mg, Ag, Tg, Sg, Cg, Pg, Dg, kg, Bg, Lg, Rg = { clampVFOV: function(e, t, n, i) { return t < Rg.getHFOVFromVFOV(e, n, i) ? Rg.getVFOVFromHFOV(t, n, i) : e }, getHFOVForCamera: function(e, t) { return Rg.getHFOVByScreenPrecent(e.fov, e.aspect, t) }, getHFOVByScreenPrecent: function(e, t, n) { e = 2 * Math.atan(t * Math.tan(e * wg.RADIANS_PER_DEGREE / 2)); return n ? e : e * wg.DEGREES_PER_RADIAN } }, Fg = function() { y(o, hn); var a = w(o); function o(f, e) { var m; O(this, o), (m = a.call(this)).viewer = f, m.renderer = f.renderer, m.scene = f.scene, m.rotationSpeed = 200, m.moveSpeed = 10, m.setCurrentViewport({ hoverViewport: e, force: !0 }), m.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)], ALT: [18], Rotate_LEFT: ["L".charCodeAt(0)], Rotate_RIGHT: ["J".charCodeAt(0)], Rotate_UP: ["K".charCodeAt(0)], Rotate_DOWN: ["I".charCodeAt(0)] }, m.fadeFactor = 20, m.yawDelta = 0, m.pitchDelta = 0, m.translationDelta = new Cn(0,0,0), m.translationWorldDelta = new Cn(0,0,0), m.tweens = [], m.dollyStart = new yn, m.dollyEnd = new yn, m.viewer.addEventListener("camera_changed", function(e) { m.setFPCMoveSpeed(e.viewport) }); var t = function(e) { if (m.enabled) { var t = e.dragViewport; if (t) { var n, i, r = t.camera, a = e.isTouch ? 1 == e.touches.length ? e.dragViewport && "MainView" != e.dragViewport.name ? "pan" : "rotate" : 2 == e.touches.length || e.dragViewport && "MainView" != e.dragViewport.name ? "scale" : "pan" : e.buttons === rm.LEFT && "OrthographicCamera" != r.type ? "rotate" : "pan"; m.currentViewport.getMoveSpeed(); if (void 0 === e.drag.startHandled && (e.drag.startHandled = !0, m.dispatchEvent({ type: "start" })), a.includes("rotate")) { if (!m.pointerDragStart) return m.pointerDragStart = e.pointer.clone(); var o, s = m.scene.view; Potree.settings.rotAroundPoint && m.intersectStart && m.canMovePos(t) && !f.images360.isAtPano() && !m.viewer.inputHandler.pressedKeys[17] ? (o = r.position.distanceTo(m.intersectStart.location), m.yawDelta -= 2.5 * e.drag.pointerDelta.x, m.pitchDelta += 2.5 * e.drag.pointerDelta.y, m.update(), s.applyToCamera(r), o = f.inputHandler.getMouseDirection(m.intersectStart.pointer).direction.clone().multiplyScalar(o), o = (new Cn).addVectors(r.position, o), o = (new Cn).subVectors(o, m.intersectStart.location), m.translationWorldDelta.copy(o.negate()), m.update(), s.applyToCamera(r)) : (p = r.matrixWorld, r.matrixWorld = new ni, u = new Cn(m.pointerDragStart.x,m.pointerDragStart.y,-1).unproject(r), c = new Cn(e.pointer.x,e.pointer.y,-1).unproject(r), s = Math.sqrt(u.x * u.x + u.z * u.z), d = Math.sqrt(c.x * c.x + c.z * c.z), s = Math.atan2(u.y, s), d = Math.atan2(c.y, d), m.pitchDelta += s - d, u.y = 0, c.y = 0, d = Math.acos(u.dot(c) / u.length() / c.length()), isNaN(d) || (h = d, m.pointerDragStart.x > e.pointer.x && (h *= -1), m.yawDelta += h), m.pointerDragStart.copy(e.pointer), r.matrixWorld = p) } if (a.includes("pan")) { if (!m.canMovePos(t)) return; if ("OrthographicCamera" == r.type) { var l, u = Jf.getOrthoCameraMoveVec(e.drag.pointerDelta, r), c = window.viewer.modules.Alignment, d = window.viewer.modules.MergeEditor, h = c.handleState, p = e.buttons === rm.LEFT && t.alignment && h && t.alignment[h]; if ("pano" == Potree.settings.editType) { c = window.viewer.modules.PanoEditor; if (p && c.selectedPano && (c.selectedGroup && c.checkIfAllLinked({ group: c.selectedGroup }) ? (c.dispatchEvent("needToDisConnect"), console.warn("选中的漫游点连通了整个数据集,不允许移动")) : ("translate" == h && (e.drag.intersectStart.pointclouds && Fm.getMixedSet(c.selectedClouds, e.drag.intersectStart.pointclouds).length || c.selectedPano.hovered) || "rotate" == h) && (l = c.selectedClouds)), !l && e.buttons === rm.LEFT && t.rotateSide) return c.rotateSideCamera(-e.drag.pointerDelta.x) } else if ("merge" == Potree.settings.editType) { if (e.buttons === rm.LEFT && t.rotateSide) return d.rotateSideCamera(-e.drag.pointerDelta.x) } else l = p && e.drag.intersectStart.pointcloud && [e.drag.intersectStart.pointcloud]; l ? m.dispatchEvent({ type: "transformPointcloud", intersect: e.intersect.orthoIntersect, intersectStart: e.drag.intersectStart.orthoIntersect, moveVec: u, pointclouds: l, camera: r }) : m.translationWorldDelta.add(u.negate()) } else e.drag.intersectStart ? (null == e.drag.z && (n = e.drag.intersectStart.location.clone().project(r), e.drag.z = n.z, e.drag.projectionMatrixInverse = r.projectionMatrixInverse.clone(), i = new Cn(m.pointerDragStart.x,m.pointerDragStart.y,e.drag.z), e.drag.translateStartPos = i.clone().unproject(r)), n = r.projectionMatrixInverse, r.projectionMatrixInverse = e.drag.projectionMatrixInverse, i = new Cn(e.pointer.x,e.pointer.y,e.drag.z).clone().unproject(r).clone().sub(e.drag.translateStartPos), r.projectionMatrixInverse = n, m.translationWorldDelta.copy(i.negate())) : (i = t.lastIntersect ? t.lastIntersect.location || t.lastIntersect : f.bound.center, t = r.position.distanceTo(i), i = Rg.getHFOVForCamera(r, !0), i = t * Math.tan(i / 2), m.translationDelta.x -= e.drag.pointerDelta.x * i, m.translationDelta.z -= e.drag.pointerDelta.y * i); m.useAttenuation = !1 } a.includes("scale") && (m.dollyEnd.subVectors(e.touches[0].pointer, e.touches[1].pointer), a = m.dollyEnd.length() / m.dollyStart.length(), e = (new yn).addVectors(e.touches[0].pointer, e.touches[1].pointer).multiplyScalar(.5), v({ pointer: e, scale: a, camera: r }), m.dollyStart.copy(m.dollyEnd)) } } } , v = function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; if ("showPanos" != Potree.settings.displayMode || m.currentViewport != f.mainViewport) { var t = e.camera; if ("OrthographicCamera" == t.type) { if (null != e.delta) { if (0 == e.delta) return; e.delta < 0 ? r = .9 : 0 < e.delta && (r = 1.1) } else r = e.scale; var n = t.zoom * r , i = t.zoomLimit; i && (n = gn.clamp(n, i.min, i.max)); var r = new Cn(e.pointer.x,e.pointer.y,.5) , i = r.clone().unproject(t); t.zoom != n && (t.zoom = n, t.updateProjectionMatrix()); t = r.clone().unproject(t), i = (new Cn).subVectors(t, i); m.translationWorldDelta.add(i.negate()), m.useAttenuation = !1 } else { if (null != e.delta) { if (a = 15 * m.currentViewport.getMoveSpeed(), o = m.viewer.inputHandler.getMouseDirection().direction, 0 == e.delta) return; e.delta < 0 && (a *= -1) } else var i = 200 * m.currentViewport.getMoveSpeed() , a = (e.scale - 1) * i , o = m.viewer.inputHandler.getMouseDirection(e.pointer).direction; m.useAttenuation = !0; a = o.multiplyScalar(a); m.translationWorldDelta.copy(a) } } else m.dispatchEvent({ type: "dollyStopCauseUnable", delta: e.delta, scale: e.scale }) }; m.viewer.addEventListener("global_drag", t), m.viewer.addEventListener("global_drop", function(e) { m.enabled && m.dispatchEvent({ type: "end" }) }), m.viewer.addEventListener("global_mousewheel", function(e) { m.enabled && e.hoverViewport && (m.setCurrentViewport(e), e.camera = e.hoverViewport.camera, v(e)) }), m.viewer.addEventListener("global_dblclick", function(e) { m.enabled && Potree.settings.dblToFocusPoint && "showPointCloud" == Potree.settings.displayMode && m.zoomToLocation(e.mouse) }); function n(e) { m.dollyStart.subVectors(e.touches[0].pointer, e.touches[1].pointer) } function i(e) { m.pointerDragStart = e.pointer.clone(), m.intersectStart = e.intersect && e.intersect.location && { location: e.intersect.location, pointer: e.intersect.location.clone().project(e.dragViewport.camera) } } function r(e) { m.pointerDragStart = e.pointer.clone(), e.drag.z = void 0, t(e) } return m.viewer.addEventListener("global_mousedown", function(e) { m.enabled && (m.setCurrentViewport(e), i(e)) }), m.viewer.addEventListener("global_touchstart", function(e) { m.enabled && (2 == e.touches.length ? n(e) : 3 <= e.touches.length && r(e)) }), m.viewer.addEventListener("global_touchend", function(e) { m.enabled && (2 == e.touches.length ? n(e) : 1 == e.touches.length ? i(e) : 3 <= e.touches.length && r(e)) }), m } return h(o, [{ key: "canMovePos", value: function(e) { return e != viewer.mainViewport || "showPanos" != Potree.settings.displayMode && !viewer.images360.bumping && !viewer.images360.latestToPano } }, { key: "setEnable", value: function(e) { this.enabled = e } }, { key: "setFPCMoveSpeed", value: function(e) { var t; "OrthographicCamera" == e.camera.type ? (t = 1 / e.camera.zoom, e.setMoveSpeed(t)) : e == viewer.mainViewport && o.boundPlane && (e = o.boundPlane.distanceToPoint(viewer.mainViewport.view.position), e = Math.sqrt(e) / 10, e = Math.max(o.standardSpeed, e), e *= Potree.config.moveSpeedAdujust, viewer.setMoveSpeed(e)) } }, { key: "setCurrentViewport", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; (this.enabled || e.force) && (e.hoverViewport && this.currentViewport != e.hoverViewport && (this.currentViewport = e.hoverViewport, this.setFPCMoveSpeed(this.currentViewport)), "OrthographicCamera" == this.currentViewport.camera.type ? (this.lockElevationOri = !0, this.lockRotation = !0) : (this.lockElevationOri = !1, this.lockRotation = !1)) } }, { key: "setScene", value: function(e) { this.scene = e } }, { key: "stop", value: function() { this.yawDelta = 0, this.pitchDelta = 0, this.translationDelta.set(0, 0, 0) } }, { key: "zoomToLocation", value: function(e) { var t, n, i, r, a, o, s, l, u, c, d, h, p = this; this.enabled && (i = this.scene.getActiveCamera(), (t = this.viewer.inputHandler.intersect) && (o = 0, this.renderer.domElement, a = Jf.mouseToRay(this.viewer.inputHandler.pointer, i), n = (r = this.viewer.inputHandler.getMouseDirection()).origin, i = r.direction, (r = new sh).ray.set(n, i), a = t.pointcloud.nodesOnRay(t.pointcloud.visibleNodes, a), t.pointcloud.nodesOnRay(t.pointcloud.visibleNodes, r.ray), a = a[a.length - 1].getBoundingSphere(new qn).radius, o = Math.min(this.scene.view.radius, a), o = Math.max(.2, o), a = this.scene.view.direction.multiplyScalar(-1), a = (new Cn).addVectors(t.location, a.multiplyScalar(o)), o = TWEEN.Easing.Quartic.Out, s = { x: 0 }, (l = new TWEEN.Tween(s).to({ x: 1 }, 600)).easing(o), this.tweens.push(l), u = this.scene.view.position.clone(), c = a.clone(), d = this.scene.view.radius, h = a.distanceTo(t.location), l.onUpdate(function() { var e = s.x; p.scene.view.position.x = (1 - e) * u.x + e * c.x, p.scene.view.position.y = (1 - e) * u.y + e * c.y, p.scene.view.position.z = (1 - e) * u.z + e * c.z, p.scene.view.radius = (1 - e) * d + e * h, p.viewer.setMoveSpeed(p.scene.view.radius / 2.5) }), l.onComplete(function() { p.tweens = p.tweens.filter(function(e) { return e !== l }) }), l.start())) } }, { key: "update", value: function() { var e, t, n, i, r, a, o, s, l, u, c, d, h = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1; this.enabled && (e = this.currentViewport.view, [this.yawDelta, this.pitchDelta, this.translationDelta.length(), this.translationWorldDelta.length()].some(function(e) { return .001 < Math.abs(e) }) && 0 < this.tweens.length && (this.tweens.forEach(function(e) { return e.stop() }), this.tweens = []), t = this.viewer.inputHandler, c = this.keys.FORWARD.some(function(e) { return t.pressedKeys[e] }), d = this.keys.BACKWARD.some(function(e) { return t.pressedKeys[e] }), n = this.keys.LEFT.some(function(e) { return t.pressedKeys[e] }), i = this.keys.RIGHT.some(function(e) { return t.pressedKeys[e] }), r = this.keys.UP.some(function(e) { return t.pressedKeys[e] }), a = this.keys.DOWN.some(function(e) { return t.pressedKeys[e] }), o = this.keys.Rotate_LEFT.some(function(e) { return t.pressedKeys[e] }), s = this.keys.Rotate_RIGHT.some(function(e) { return t.pressedKeys[e] }), l = this.keys.Rotate_UP.some(function(e) { return t.pressedKeys[e] }), u = this.keys.Rotate_DOWN.some(function(e) { return t.pressedKeys[e] }), this.lockElevation = this.lockElevationOri || this.keys.ALT.some(function(e) { return t.pressedKeys[e] }), this.lockRotation || (o ? this.yawDelta -= .01 : s && (this.yawDelta += .01), l ? this.pitchDelta -= .01 : u && (this.pitchDelta += .01)), this.canMovePos(this.currentViewport) && !this.lockKey && (this.lockElevation ? ((u = e.direction).z = 0, u.normalize(), c && d ? this.translationWorldDelta.set(0, 0, 0) : c ? this.translationWorldDelta.copy(u.multiplyScalar(this.currentViewport.getMoveSpeed())) : d && this.translationWorldDelta.copy(u.multiplyScalar(-this.currentViewport.getMoveSpeed()))) : c && d ? this.translationDelta.y = 0 : c ? this.translationDelta.y = this.currentViewport.getMoveSpeed() : d && (this.translationDelta.y = -this.currentViewport.getMoveSpeed()), n && i ? this.translationDelta.x = 0 : n ? this.translationDelta.x = -this.currentViewport.getMoveSpeed() : i && (this.translationDelta.x = this.currentViewport.getMoveSpeed()), r && a ? this.translationWorldDelta.z = 0 : r ? this.translationWorldDelta.z = this.currentViewport.getMoveSpeed() : a && (this.translationWorldDelta.z = -this.currentViewport.getMoveSpeed()), (r || a || c || d) && (this.useAttenuation = !1)), c = e.yaw, d = e.pitch, c += this.yawDelta, d += this.pitchDelta, e.yaw = c, e.pitch = d, this.yawDelta = 0, this.pitchDelta = 0, this.translationWorldDelta.length(), e.translate(this.translationDelta.x, this.translationDelta.y, this.translationDelta.z), this.translationDelta.set(0, 0, 0), e.translateWorld(this.translationWorldDelta.x, this.translationWorldDelta.y, this.translationWorldDelta.z), this.useAttenuation ? (h = Math.max(0, 1 - this.fadeFactor * h), this.translationWorldDelta.multiplyScalar(h)) : this.translationWorldDelta.set(0, 0, 0)) } }]), o }(), Ig = function() { function i(e, t) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}; O(this, i), this.left = n.left, this.bottom = n.bottom, this.width = n.width, this.height = n.height, this.name = n.name, this.view = e, this.camera = t, this.active = !0, this.unableChangePos = !1, this.noPointcloud, this.resolution = new yn, this.resolution2 = new yn, this.offset = new yn, this.extraEnableLayers = n.extraEnableLayers || [], this.cameraLayers = n.cameraLayers, this.pixelRatio = n.pixelRatio } return h(i, [{ key: "clone", value: function() { return Fm.CloneClassObject(this) } }, { key: "getMoveSpeed", value: function() { return this.moveSpeed } }, { key: "setMoveSpeed", value: function(e) { this.moveSpeed = e } }, { key: "layersAdd", value: function(e) { this.extraEnableLayers.includes(e) || this.extraEnableLayers.push(e) } }, { key: "layersRemove", value: function(e) { e = this.extraEnableLayers.indexOf(e); -1 < e && this.extraEnableLayers.splice(e, 1) } }, { key: "cameraChanged", value: function() { var e = this , t = !0 , n = !0 , i = !0; return this.previousState && (t = !this.camera.projectionMatrix.equals(this.previousState.projectionMatrix), n = !this.camera.position.equals(this.previousState.position), i = !this.camera.quaternion.equals(this.previousState.quaternion)), e.previousState = { projectionMatrix: e.camera.projectionMatrix.clone(), position: e.camera.position.clone(), quaternion: e.camera.quaternion.clone() }, { projectionChanged: t, positionChanged: n, quaternionChanged: i, changed: t || n || i } } }, { key: "setResolution", value: function(e, t) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0 , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0; this.resolution.set(e, t), this.resolution2.copy(this.resolution).multiplyScalar(this.pixelRatio || window.devicePixelRatio), this.offset.set(n, i).multiply(new yn(this.left,this.bottom)).multiplyScalar(window.devicePixelRatio) } }]), i }(), Og = function() { y(r, hn); var i = w(r); function r(e, t) { var n; return O(this, r), (n = i.call(this)).viewer = e, n.renderer = e.renderer, n.domElement = n.renderer.domElement, n.enabled = !0, n.scene = t, n.interactiveScenes = [], n.interactiveObjects = new Set, n.inputListeners = [], n.blacklist = new Set, n.drag = null, n.mouse = new yn(0,0), n.pointer = new yn(0,0), n.mouseDownMouse = new yn(0,0), n.selection = [], n.hoveredElements = [], n.pressedKeys = {}, n.wheelDelta = 0, n.speed = 1, n.logMessages = !1, -1 === n.domElement.tabIndex && (n.domElement.tabIndex = 2222), n.lastPointerUpTime = 0, n.touches = [], n.hoverViewport = e.viewports[0], n.domElement.addEventListener("contextmenu", function(e) { e.preventDefault() }, !1), n.domElement.addEventListener("click", n.onMouseClick.bind(g(n)), !1), n.domElement.addEventListener("mousedown", n.onMouseDown.bind(g(n)), !1), window.addEventListener("mouseup", n.onMouseUp.bind(g(n)), !1), n.domElement.addEventListener("mousemove", n.onMouseMove.bind(g(n)), !1), n.domElement.addEventListener("mousewheel", n.onMouseWheel.bind(g(n)), !1), n.domElement.addEventListener("DOMMouseScroll", n.onMouseWheel.bind(g(n)), !1), n.domElement.addEventListener("keydown", n.onKeyDown.bind(g(n))), window.addEventListener("keyup", n.onKeyUp.bind(g(n))), window.addEventListener("blur", n.onKeyUp.bind(g(n))), n.domElement.addEventListener("touchstart", n.onTouchStart.bind(g(n))), n.domElement.addEventListener("touchend", n.onTouchEnd.bind(g(n))), n.domElement.addEventListener("touchmove", n.onTouchMove.bind(g(n))), n.addEventListener("isMeasuring", function(e) { n.isMeasuring = e.v }), n } return h(r, [{ key: "updateTouchesInfo", value: function(e) { var i, r, a = this, n = this.touches, o = Array.from(e.changedTouches), t = Array.from(e.touches); if (this.touches = t.map(function(t) { var e = n.find(function(e) { return e.touch.identifier == t.identifier }) , e = e && e.pointer; return { touch: t, pointer: e } }), 0 < e.touches.length) { var t = t.filter(function(t) { return !n.some(function(e) { return e.touch.identifier == t.identifier }) && !o.some(function(e) { return e.identifier == t.identifier }) }); return 0 < t.length && console.warn("has new", t.map(function(e) { return e.identifier })), t.concat(o).forEach(function(t) { var e, n = a.touches.find(function(e) { return e.touch.identifier == t.identifier }); n && (e = a.getPointerInViewport(t.pageX, t.pageY, a.dragViewport || i, new yn), n.pointer = e.pointer.clone(), i = e.viewport, r = e.camera) }), 1 < e.touches.length ? (t = Fm.average(e.touches, "pageX"), e = Fm.average(e.touches, "pageY"), e = this.getPointerInViewport(t, e, i, new yn), this.pointer.copy(e.pointer)) : this.pointer = this.touches[0].pointer.clone(), { viewport: i, camera: r } } } }, { key: "onTouchStart", value: function(e) { this.logMessages && console.log(this.constructor.name + ": onTouchStart"), e.preventDefault(), this.dealPointerDown(e, !0), this.viewer.dispatchEvent($.extend(this.getEventDesc(e, !0), { type: "global_" + e.type, changedTouches: e.changedTouches })) } }, { key: "onTouchMove", value: function(e) { this.logMessages && console.log(this.constructor.name + ": onTouchMove"), e.preventDefault(), this.dealPointerMove(e, !0), this.viewer.dispatchEvent($.extend(this.getEventDesc(e, !0), { type: "global_" + e.type, changedTouches: e.changedTouches })) } }, { key: "onTouchEnd", value: function(e) { this.logMessages && console.log(this.constructor.name + ": onTouchEnd"), e.preventDefault(), this.updateTouchesInfo(e), this.dealPointerUp(e, !0), this.viewer.dispatchEvent($.extend(this.getEventDesc(e, !0), { type: "global_" + e.type })) } }, { key: "onKeyDown", value: function(e) { this.logMessages && console.log(this.constructor.name + ": onKeyDown"), e.keyCode === ym.DELETE && 0 < this.selection.length && (this.dispatchEvent({ type: "delete", selection: this.selection }), this.deselectAll()), this.dispatchEvent({ type: "keydown", keyCode: e.keyCode, event: e }), this.pressedKeys[e.keyCode] = !0 } }, { key: "onKeyUp", value: function(e) { this.logMessages && console.log(this.constructor.name + ": onKeyUp"), null != e.keyCode ? delete this.pressedKeys[e.keyCode] : this.pressedKeys = {}, e.preventDefault() } }, { key: "onDoubleClick", value: function(e) { this.logMessages && console.log(this.constructor.name + ": onDoubleClick"); var t, n = !1, i = ue(this.hoveredElements); try { for (i.s(); !(t = i.n()).done; ) { var r = t.value; if (r._listeners && r._listeners.dblclick) { r.object.dispatchEvent({ type: "dblclick", mouse: this.mouse, object: r.object }), n = !0; break } } } catch (e) { i.e(e) } finally { i.f() } n || this.viewer.dispatchEvent({ type: "global_dblclick", mouse: this.mouse, object: null }), this.needSingleClick = !1, e.preventDefault() } }, { key: "onMouseClick", value: function(e) { this.logMessages && console.log(this.constructor.name + ": onMouseClick"), e.preventDefault() } }, { key: "dealPointerDown", value: function(e, t) { var n, i; if (e.preventDefault(), t ? ((n = this.updateTouchesInfo(e)).camera, i = n.viewport, this.drag && (this.drag.end = this.pointer.clone())) : ((n = this.getPointerInViewport(e.clientX, e.clientY)).camera, i = n.viewport), this.dragViewport = this.hoverViewport = i, !t && Potree.settings.intersectWhenHover || (this.hoveredElements = this.getHoveredElements(), this.intersect = this.getIntersect(i)), i) { if (!t || 1 == e.touches.length) { var r = !1 , a = function() { return r = !0 }; this.viewer.dispatchEvent($.extend(this.getEventDesc(e, t), { type: "global_mousedown" })); var o, s = ue(this.hoveredElements); try { for (s.s(); !(o = s.n()).done; ) if (o.value.object.dispatchEvent({ type: "mousedown", viewer: this.viewer, consume: a }), r) break } catch (e) { s.e(e) } finally { s.f() } } this.drag || ((e = (t || e.button == C.LEFT) && this.hoveredElements.find(function(e) { return e.object._listeners && e.object._listeners.drag && 0 < e.object._listeners.drag.length })) ? this.startDragging(e.object, { location: e.point }) : this.startDragging(null)), this.drag.intersectStart = this.intersect, this.mouseDownMouse = this.mouse.clone(), this.pointerDownTime = Date.now() } } }, { key: "onMouseDown", value: function(e) { this.logMessages && console.log(this.constructor.name + ": onMouseDown"), this.dealPointerDown(e) } }, { key: "getEventDesc", value: function(e, t) { var n = { viewer: this.viewer, mouse: this.mouse, pointer: this.pointer, drag: this.drag, isTouch: t, dragViewport: this.dragViewport, hoverViewport: this.hoverViewport, hoveredElement: this.hoveredElements[0], intersect: this.intersect }; return e && (n.isAtDomElement = e.target == this.domElement), t ? n.touches = this.touches : e && (n.button = e.button, n.buttons = e.buttons), n } }, { key: "dealPointerUp", value: function(e, t) { var n, i, r, a, o, s, l, u, c, d, h, p = this; this.drag && (this.drag.end.copy(this.pointer), t && 1 <= e.touches.length || (n = Date.now(), this.logMessages && console.log(this.constructor.name + ": onMouseUp"), e.preventDefault(), i = this.mouseDownMouse.distanceTo(this.mouse), r = n - this.pointerDownTime, a = 0 == this.drag.pointerDelta.length(), o = !1, s = function() { return o = !0 } , this.viewer.dispatchEvent($.extend(this.getEventDesc(e, t), { type: "global_mouseup", pressDistance: i, consume: s })), 0 < this.hoveredElements.length && ((l = this.hoveredElements.map(function(e) { return e.object }).find(function(e) { return e._listeners && e._listeners.mouseup })) && l.dispatchEvent({ type: "mouseup", viewer: this.viewer, consume: s })), this.drag && (this.drag.object ? (this.logMessages && console.log("".concat(this.constructor.name, ": drop ").concat(this.drag.object.name)), this.drag.object.dispatchEvent($.extend(this.getEventDesc(e, t), { type: "drop", pressDistance: i }))) : this.viewer.dispatchEvent($.extend(this.getEventDesc(e, t), { type: "global_drop", pressDistance: i })), i < Potree.config.clickMaxDragDis && r < Potree.config.clickMaxPressTime && (this.hoveredElements && (u = this.hoveredElements.find(function(e) { return e.object._listeners.click })) && (console.log("clickElement", u), this.logMessages && console.log("".concat(this.constructor.name, ": click ").concat(u.name)), u.object.dispatchEvent($.extend(this.getEventDesc(e, t), { type: "click", pressDistance: i }))), c = !1, d = this.getEventDesc(e, t), this.viewer.dispatchEvent($.extend(d, { type: "global_click", pressDistance: i, consume: function() { return c = !0 } })), this.needSingleClick = !0, c || setTimeout(function() { p.needSingleClick && p.viewer.dispatchEvent($.extend(d, { type: "global_single_click", pressDistance: i, clickElement: u })) }, Potree.config.doubleClickTime + 1), n - this.lastClickTime < Potree.config.doubleClickTime && this.onDoubleClick(e), this.lastClickTime = n), this.drag = null), this.dragViewport = null, o || this.fixSelection || (e.button === C.LEFT ? a && ((h = this.hoveredElements.find(function(e) { return e.object._listeners && e.object._listeners.select })) ? (h = h.object, this.isSelected(h) ? this.selection.filter(function(e) { return e !== h }).forEach(function(e) { return p.toggleSelection(e) }) : (this.deselectAll(), this.toggleSelection(h))) : this.deselectAll()) : e.button === C.RIGHT && a && this.deselectAll()))) } }, { key: "onMouseUp", value: function(e) { this.dealPointerUp(e) } }, { key: "getPointerInViewport", value: function(e, t, n, o) { var s, l, u = this, i = this.domElement.getBoundingClientRect(), c = e - i.left, d = t - i.top; o = o || this.pointer; function r(e) { var t = Math.ceil(u.domElement.clientWidth * e.left) , n = Math.ceil(u.domElement.clientHeight * e.bottom) , i = Math.ceil(u.domElement.clientWidth * e.width) , e = Math.ceil(u.domElement.clientHeight * e.height); return { left: t, bottom: n, width: i, height: e, top: u.domElement.clientHeight - n - e } } function a(e, t, n, i, r, a) { u.mouse.set(c - t, d - a), Jf.convertScreenPositionToNDC(o, u.mouse, i, r), s = e.camera, l = e } if (n) { t = r(n), i = t.left; t.bottom; a(n, i, 0, t.width, t.height, t.top) } else for (var h = this.viewer.viewports.length, p = 0; p < h; p++) { var f = this.viewer.viewports[p]; if (f.active) { var m = r(f) , v = m.left , g = (m.bottom, m.width) , y = m.height , m = m.top; if (v <= c && c <= v + g && m <= d && d <= m + y) { a(f, v, 0, g, y, m); break } } } return { camera: s, viewport: l, pointer: o } } }, { key: "ifBlockedByIntersect", value: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0 , n = 2 < arguments.length ? arguments[2] : void 0 , i = 3 < arguments.length ? arguments[3] : void 0 , r = 4 < arguments.length ? arguments[4] : void 0 , a = 5 < arguments.length ? arguments[5] : void 0 , r = this.getIntersect(this.hoverViewport, !0, r, null, n = i ? !0 : n, { point: e, cameraPos: i, pano: a }) , i = !n && a ? a.position : i || this.hoverViewport.view.position; if (r && r.distance + t <= e.distanceTo(i)) return r } }, { key: "getIntersect", value: function(e, t, n, i, r) { var a, o, s, l, u = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : {}, c = e.camera; return "showPanos" != Potree.settings.displayMode || !viewer.images360.currentPano.pointcloud.hasDepthTex || r || this.isMeasuring || e != viewer.mainViewport ? (u.point && (u.cameraPos && c.position.copy(u.cameraPos), c.lookAt(u.point), c.updateMatrixWorld(), u.pointer = this.pointer.clone(), u.mouse = this.mouse.clone(), this.pointer.set(0, 0), this.mouse.set(Math.round(e.resolution.x / 2), Math.round(e.resolution.y / 2))), l = e.noPointcloud || i ? null : Jf.getMousePointCloudIntersection(e, this.mouse, this.pointer, c, this.viewer, this.viewer.scene.pointclouds, { pickClipped: !0, isMeasuring: this.isMeasuring, pickWindowSize: n, cameraChanged: !!u.point }), u.point && (e.view.applyToCamera(c), this.pointer.copy(u.pointer), this.mouse.copy(u.mouse))) : (a = u.point ? (a = (u.pano || c).position, { dir: (new Cn).subVectors(u.point, a).normalize() }) : Jf.getIntersect(c, [viewer.images360.cube], this.pointer, s), l = viewer.images360.depthSampler.sample(a, u.pano, !!u.point)), Potree.settings.intersectOnObjs && !i && (u.point && (s = new sh, u = (new Cn).subVectors(u.point, c.position).normalize(), s.set(c.position, u)), (s = this.getHoveredElements(viewer.objs.children, !0, s))[0] && (o = { hoveredElement: s[0], location: s[0].point, normal: s[0].face.normal, distance: s[0].distance, object: s[0].object })), l = l && o ? l.distance < o.distance ? l : o : o || l, "OrthographicCamera" == e.camera.type && (e = new Cn(this.pointer.x,this.pointer.y,-1).unproject(e.camera), (l = l || {}).orthoIntersect = e.clone()), t || (l && viewer.showCoordType && (t = l.point.position.toArray(), "local" == viewer.showCoordType || (t = "lonlat" == viewer.showCoordType ? viewer.transform.lonlatToLocal.inverse(t) : (t = viewer.transform.lonlatToLocal.inverse(t), viewer.transform.lonlatTo4550.forward(t))), viewer.dispatchEvent({ type: "coordinateChange", pos: t })), (this.intersect = l) && (this.hoverViewport.lastIntersect = l)), l } }, { key: "onMouseMove", value: function(e) { return this.dealPointerMove(e) } }, { key: "dealPointerMove", value: function(e, t) { var n; if (n = t ? ((n = this.updateTouchesInfo(e)).camera, n.viewport) : ((a = this.getPointerInViewport(e.clientX, e.clientY, this.dragViewport)).camera, a.viewport), this.hoverViewport = n) { var i, r, a = this.viewer.viewports.some(function(e) { return e.view.isFlying() }) || viewer.scene.cameraAnimations.some(function(e) { return e.onUpdate }); if ((e.onlyGetIntersect || Potree.settings.intersectWhenHover && (!this.drag || this.drag.object || n.alignment)) && (i = this.drag && n.alignment || a, i = this.getIntersect(n, e.onlyGetIntersect, e.pickWindowSize, !!i, e.whichPointcloud)), e.onlyGetIntersect) return i; e.preventDefault(), this.drag && (this.drag.mouse = t ? 1 : e.buttons, this.drag.pointerDelta.subVectors(this.pointer, this.drag.end), this.drag.end.copy(this.pointer), !this.drag.object || e.buttons != rm.NONE && this.drag.notPressMouse ? (this.logMessages && console.log(this.constructor.name + ": drag: "), this.viewer.dispatchEvent($.extend(this.getEventDesc(e, t), { type: "global_drag", consume: function() {} }))) : (this.logMessages && console.log(this.constructor.name + ": drag: " + this.drag.object.name), this.drag.object.dispatchEvent($.extend(this.getEventDesc(e, t), { type: "drag" })))), t && 1 != e.touches.length || ((!this.drag || this.drag.notPressMouse || Potree.settings.intersectOnObjs && this.drag.object) && !a && (0 < (i = this.getHoveredElements()).length && (r = i.map(function(e) { return e.object.name }).join(", "), this.logMessages && console.log("".concat(this.constructor.name, ": onMouseMove; hovered: '").concat(r, "'"))), (a = i.map(function(e) { return e.object }).find(function(e) { return !0 })) !== (r = this.lastMouseoverElement) && (a && (this.logMessages && console.log("".concat(this.constructor.name, ": mouseover: ").concat(a.name)), a.dispatchEvent({ type: "mouseover", object: a })), r && (this.logMessages && console.log("".concat(this.constructor.name, ": mouseleave: ").concat(r.name)), r.dispatchEvent({ type: "mouseleave", object: r })), this.lastMouseoverElement = a), 0 < i.length && ((a = i.map(function(e) { return e.object }).find(function(e) { return e._listeners && e._listeners.mousemove })) && a.dispatchEvent({ type: "mousemove", object: a })), this.hoveredElements = i), this.viewer.dispatchEvent($.extend(this.getEventDesc(e, t), { type: "global_mousemove" }))) } } }, { key: "onMouseWheel", value: function(e) { var t, n; this.enabled && (this.logMessages && console.log(this.constructor.name + ": onMouseWheel"), e.preventDefault(), void (n = 0) !== e.wheelDelta ? n = e.wheelDelta : void 0 !== e.detail && (n = -e.detail), t = Math.sign(n), this.hoverViewport || (n = this.getPointerInViewport(e.clientX, e.clientY).viewport, this.hoverViewport = n), this.hoveredElement ? this.hoveredElement.object.dispatchEvent($.extend(this.getEventDesc(e, isTouch), { type: "mousewheel", delta: t, object: this.hoveredElement.object })) : this.viewer.dispatchEvent($.extend(this.getEventDesc(e), { type: "global_mousewheel", delta: t }))) } }, { key: "startDragging", value: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : null , n = e ? e.name : "no name"; if (this.logMessages && console.log("".concat(this.constructor.name, ": startDragging: '").concat(n, "'")), this.drag = { start: this.pointer.clone(), end: this.pointer.clone(), pointerDelta: new yn(0,0), object: e, hoverViewport: this.hoverViewport, dragViewport: this.hoverViewport }, t) for (var i = 0, r = Object.keys(t); i < r.length; i++) { var a = r[i]; this.drag[a] = t[a] } e && e.dispatchEvent($.extend(this.getEventDesc(), { type: "startDragging" })) } }, { key: "toggleSelection", value: function(e) { var t = this.selection , n = this.selection.indexOf(e); -1 === n ? (this.selection.push(e), e.dispatchEvent({ type: "select" })) : (this.selection.splice(n, 1), e.dispatchEvent({ type: "deselect" })), this.dispatchEvent({ type: "selection_changed", oldSelection: t, selection: this.selection }) } }, { key: "deselect", value: function(e) { var t = this.selection , n = this.selection.indexOf(e); 0 <= n && (this.selection.splice(n, 1), e.dispatchEvent({ type: "deselect" }), this.dispatchEvent({ type: "selection_changed", oldSelection: t, selection: this.selection })) } }, { key: "deselectAll", value: function() { var e, t = ue(this.selection); try { for (t.s(); !(e = t.n()).done; ) e.value.dispatchEvent({ type: "deselect" }) } catch (e) { t.e(e) } finally { t.f() } var n = this.selection; 0 < this.selection.length && (this.selection = [], this.dispatchEvent({ type: "selection_changed", oldSelection: n, selection: this.selection })) } }, { key: "isSelected", value: function(e) { return -1 !== this.selection.indexOf(e) } }, { key: "registerInteractiveObject", value: function(e) { this.interactiveObjects.add(e) } }, { key: "removeInteractiveObject", value: function(e) { this.interactiveObjects.delete(e) } }, { key: "registerInteractiveScene", value: function(e) { -1 === this.interactiveScenes.indexOf(e) && this.interactiveScenes.push(e) } }, { key: "unregisterInteractiveScene", value: function(e) { e = this.interactiveScenes.indexOf(e); -1 < e && this.interactiveScenes.splice(e, 1) } }, { key: "getHoveredElement", value: function() { var e = this.getHoveredElements(); return 0 < e.length ? e[0] : null } }, { key: "getHoveredElements", value: function(r, e, t) { var a = this; r || function() { var e = a.hoverViewport.interactiveScenes || a.interactiveScenes.concat(a.scene) , n = ["mouseup", "mousemove", "mouseover", "mouseleave", "drag", "drop", "click", "select", "deselect"]; r = []; var t, i = ue(e); try { for (i.s(); !(t = i.n()).done; ) t.value.traverseVisible(function(t) { t._listeners && t.visible && !a.blacklist.has(t) && 0 < n.filter(function(e) { return void 0 !== t._listeners[e] }).length && r.push(t) }) } catch (e) { i.e(e) } finally { i.f() } }(); var n, i = this.hoverViewport.camera; t || (n = Jf.mouseToRay(this.pointer, i), (t = new sh).ray.set(n.origin, n.direction), t.camera = i), "OrthographicCamera" == i.type ? t.params.Line.threshold = 20 / i.zoom : t.params.Line.threshold = .2, t.params.Line2 = { threshold: 20 }, viewer.setCameraLayers(t, ["sceneObjects", "mapObjects", "measure", "transformationTool", "model"], this.hoverViewport && this.hoverViewport.extraEnableLayers), viewer.dispatchEvent({ type: "raycaster", viewport: this.hoverViewport }); t = t.intersectObjects(r.filter(function(e) { return e.visible }), !0); t.slice(); return t = (t = (t = this.intersect && null != this.intersect.distance && !e ? t.filter(function(e) { var t = e.object.material; return (e.object.pickDontCheckDis || 0 == t.depthTest || 0 == t.depthWrite) && !t.useDepth || (t.useDepth ? e.distance < a.intersect.distance + t.uniforms.occlusionDistance.value : e.distance < a.intersect.distance) }) : t).map(function(e) { var t = e.object; do { if (r.includes(t)) { e.oriObject = e.object, e.object = t; break } } while (t = t.parent); return e })).sort(function(e, t) { return (t.object.pickOrder || 0) - (e.object.pickOrder || 0) }) } }, { key: "update", value: function(e) {} }, { key: "getMouseDirection", value: function(e) { e = e || this.pointer; var t = this.hoverViewport.camera , n = new Cn(e.x,e.y,-1).unproject(t); return { origin: n, direction: new Cn(e.x,e.y,1).unproject(t).clone().sub(n).normalize() } } }]), r }(), zg = function() { y(r, hn); var i = w(r); function r(e) { var t, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; return O(this, r), (t = i.call(this)).name = n.name, t.renderArea = e, t.oldResolution = new yn, t.screenSizeInfo = { W: 0, H: 0, pixelRatio: 1, windowWidth: 0, windowHeight: 0 }, t.initContext(n), t.addEventListener("content_changed", function() { t.needRender = !0 }), t } return h(r, [{ key: "initContext", value: function(e) { var t = this , n = (this.renderArea.clientWidth, this.renderArea.clientHeight, document.createElement("canvas")) , i = n.getContext("webgl", { alpha: !0, depth: !0, stencil: !1, antialias: !0, preserveDrawingBuffer: !0, powerPreference: "high-performance" }); this.renderer = new ps({ alpha: !0, premultipliedAlpha: !1, canvas: n, context: i }), this.renderer.sortObjects = !0, this.renderer.autoClear = e.autoClear || !1, e.clearColor && this.renderer.setClearColor(e.clearColor), this.renderArea.appendChild(this.renderer.domElement), this.renderer.domElement.tabIndex = "2222", this.renderer.domElement.style.position = "absolute", this.renderer.domElement.addEventListener("mousedown", function() { t.renderer.domElement.focus() }); i = this.renderer.getContext(); if (i.getExtension("EXT_frag_depth"), i.getExtension("WEBGL_depth_texture"), i.getExtension("WEBGL_color_buffer_float"), null == i.createVertexArray) { e = i.getExtension("OES_vertex_array_object"); if (!e) throw new Error("OES_vertex_array_object extension not supported"); i.createVertexArray = e.createVertexArrayOES.bind(e), i.bindVertexArray = e.bindVertexArrayOES.bind(e) } } }, { key: "updateScreenSize", value: function() { var e, t, n, i = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, r = !1; null != i.width && null != i.height ? (t = i.width, n = i.height, r = !0, e = 1) : (t = this.renderArea.clientWidth, n = this.renderArea.clientHeight, t === this.screenSizeInfo.W && n === this.screenSizeInfo.H && !i.forceUpdateSize && this.screenSizeInfo.pixelRatio == window.devicePixelRatio || (this.screenSizeInfo.W = t, this.screenSizeInfo.H = n, r = !0, this.screenSizeInfo.pixelRatio = window.devicePixelRatio, e = window.devicePixelRatio)), r && this.setSize(t, n, e) } }, { key: "setSize", value: function(r, a, e, t) { t || this.renderer.setSize(r, a, null, e), this.composer && this.composer.setSize(r, a), this.viewports && this.viewports.forEach(function(e, t) { var n, i; e.active && (n = r * e.width, 0 != (i = a * e.height) && (e.setResolution(Math.ceil(n), Math.ceil(i), r, a), e.camera.aspect = n / i, "OrthographicCamera" == e.camera.type && (e.camera.left = -n / 2, e.camera.right = n / 2, e.camera.bottom = -i / 2, e.camera.top = i / 2), e.camera.updateProjectionMatrix())) }), t || this.emitResizeMsg({ viewport: this.viewports[0], deviceRatio: e }) } }, { key: "emitResizeMsg", value: function(e) { e.viewport.resolution.equals(this.oldResolution) || (this.dispatchEvent($.extend(e, { type: "resize" })), this.oldResolution.copy(e.viewport.resolution)) } }, { key: "cameraChanged", value: function() { for (var e = !1, t = 0, n = this.viewports.length; t < n; t++) { var i = this.viewports[t].cameraChanged(); i.changed && (e = !0, this.dispatchEvent({ type: "camera_changed", camera: this.viewports[t].camera, viewport: this.viewports[t], changeInfo: i })) } return e } }, { key: "makeScreenshot", value: function(e, t, n) { var i = e.width , r = e.height , e = new An(i,r,{ format: et }); this.setSize(i, r, 1, !0), this.render({ target: e, viewports: t || this.viewports, screenshot: !0, width: i, height: r, resize: !0 }); n = Potree.Utils.renderTargetToDataUrl(e, i, r, this.renderer, n); return e.dispose(), { width: i, height: r, dataUrl: n } } }]), r }(), Ng = { uniforms: { opacity: { type: "f", value: 1 }, progress: { type: "f", value: 0 }, pano0Map: { type: "t", value: null }, pano1Map: { type: "t", value: null }, depthMap0: { type: "t", value: null }, depthMap1: { type: "t", value: null }, pano0Position: { type: "v3", value: new Cn }, pano0Matrix: { type: "m4", value: new ni }, pano1Position: { type: "v3", value: new Cn }, pano1Matrix: { type: "m4", value: new ni }, inverseProjectionMatrix: { value: new ni }, viewport: { value: new Mn }, cameraHeight0: { type: "f", value: 1 }, cameraHeight1: { type: "f", value: 1 } }, vertexShader: "precision highp float;\nprecision highp int;\n\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n\n\n uniform vec3 pano0Position;\n uniform mat4 pano0Matrix;\n \n uniform vec3 pano1Position;\n uniform mat4 pano1Matrix;\n //uniform mat4 pano1Matrix2;\n\n \n varying vec2 vUv; \n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n varying vec3 vWorldPosition12;\n \n vec3 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 \n \n void main() {\n \n vUv = uv;\n vec4 worldPosition = modelMatrix * vec4(position, 1.0);\n \n \n \n vec3 positionLocalToPanoCenter0 = worldPosition.xyz - pano0Position;\n vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz;\n vWorldPosition0.x *= -1.0;\n vWorldPosition0 = transformAxis(vWorldPosition0);\n \n vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;\n vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz;\n vWorldPosition1.x *= -1.0;\n vWorldPosition1 = transformAxis(vWorldPosition1);\n \n /* \n vec3 positionLocalToPanoCenter12 = worldPosition.xyz - pano1Position;\n vWorldPosition12 = (vec4(positionLocalToPanoCenter12, 1.0) * pano1Matrix2).xyz;\n vWorldPosition12.x *= -1.0;\n vWorldPosition12 = transformAxis(vWorldPosition12);\n */\n \n \n \n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n\n ", fragmentShader: "precision highp float;\nprecision highp int;\n\nuniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n\n \n #define PI 3.141592653 \n \n \n uniform float modelAlpha;\n uniform float opacity;\n uniform float progress;\n uniform int blackout;\n uniform vec3 pano0Position;\n uniform vec3 pano1Position;\n uniform float maxDistance;\n uniform float minDistance;\n uniform float minOpa;\n \n uniform float cameraHeight0;\n uniform float cameraHeight1;\n\n \n \n /* uniform sampler2D pano0Map;\n uniform sampler2D pano1Map; */ \n uniform samplerCube pano0Map;\n uniform samplerCube pano1Map;\n \n \n varying vec2 vUv; \n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n //varying vec3 vWorldPosition12;\n \n /* vec2 getSamplerCoord( vec3 direction ) \n {\n direction = normalize(direction);\n float tx=atan(direction.x,-direction.y)/(PI*2.0)+0.5;\n float ty=acos(direction.z)/PI;\n\n return vec2(tx,ty);\n } */\n\n vec2 getSamplerCoord2( vec3 direction ) \n { \n direction = normalize(direction);\n float tx=atan(direction.x,direction.z)/(PI*2.0)+0.5;\n float ty=acos(direction.y)/PI;\n\n return vec2(tx,ty); \n }\n \n #extension GL_EXT_frag_depth : enable\n #if defined(GL_EXT_frag_depth) && defined(hasDepthTex) \n uniform sampler2D depthMap0;\n uniform sampler2D depthMap1;\n uniform mat4 inverseProjectionMatrix;\n uniform mat4 projectionMatrix;\n uniform vec4 viewport; \n \n vec2 getDepth(vec3 dir, sampler2D depthMap, float height, vec4 eyePos){\n vec2 depthValue = vec2(0.0, 0.0);\n vec2 uv2 = getSamplerCoord2(/* vWorldPosition12 */dir.xyz); //暂时只用基于目标漫游点的方向\n uv2.x -= 0.25; //全景图和Cube的水平采样起始坐标相差90度,这里矫正 0.25 个采样偏移\n vec4 depth = texture2D(depthMap, uv2);\n //float distance = depth.r + 256. * (depth.g + 256. * depth.b);\n //distance *= 255. * .001; // distance is now in meters\n \n //更改\n float distance = (depth.g + depth.r / 256.) * 255.; //为什么要乘以255 \n \n if(distance == 0.0){//漫游点底部识别不到的区域,给一个地板高度 \n if(uv2.y > 0.75)distance = height / dir.y; \n else distance = 100000.0;//给个超级远的值\n } \n depthValue.x = distance;\n \n // return r[1] + r[0] / 256 \n distance += .1; // add a safety margin\n\n vec4 eyePos2 = vec4(normalize(eyePos.xyz) * distance, 1.);\n vec4 clipPos2 = projectionMatrix * eyePos2;\n vec4 ndcPos2 = clipPos2 * 1. / clipPos2.w;\n\n \n depthValue.y = 0.5 * ((gl_DepthRange.far - gl_DepthRange.near) * ndcPos2.z\n + gl_DepthRange.near + gl_DepthRange.far); \n return depthValue; \n }\n //注:未加载好的话,depth为0,导致第一次漫游过去的时候许多mesh会立刻被遮挡,所以要确保加载完\n #endif\n \n void main()\n {\n \n /* vec2 samplerCoord0 = getSamplerCoord(vWorldPosition0.xyz);\n vec2 samplerCoord1 = getSamplerCoord(vWorldPosition1.xyz); \n vec4 colorFromPano0=texture2D(pano0Map,samplerCoord0);\n vec4 colorFromPano1=texture2D(pano1Map,samplerCoord1); */\n \n vec4 colorFromPano0 = vec4(0.0,0.0,0.0,0.0);\n if(progress < 1.0){//通常是1\n colorFromPano0=textureCube(pano0Map,vWorldPosition0.xyz);\n }\n vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1.xyz);\n \n gl_FragColor=mix(colorFromPano0,colorFromPano1,progress);\n \n \n \n \n //深度图修改深度\n \n #if defined(GL_EXT_frag_depth) && defined(hasDepthTex) \n vec4 ndcPos;\n ndcPos.xy = ((2.0 * gl_FragCoord.xy) - (2.0 * viewport.xy)) / (viewport.zw) - 1.;\n ndcPos.z = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far) /\n (gl_DepthRange.far - gl_DepthRange.near);\n ndcPos.w = 1.0;\n\n vec4 clipPos = ndcPos / gl_FragCoord.w;\n vec4 eyePos = inverseProjectionMatrix * clipPos;\n vec2 depth0 = vec2(0.0,0.0); \n if(progress < 1.0){\n depth0 = getDepth(vWorldPosition0, depthMap0, cameraHeight0, eyePos);\n }\n vec2 depth1 = getDepth(vWorldPosition1, depthMap1, cameraHeight1, eyePos);\n \n /* if(progress < 1.0 && depth1.x == 0.0 && depth0.x > 0.0){\n gl_FragDepthEXT = depth0.y; \n }else{ */\n gl_FragDepthEXT = mix(depth0.y,depth1.y,progress);\n //}\n \n \n\n #endif\n\n \n }\n " }, Ug = function() { y(r, Gu); var i = w(r); function r() { O(this, r); function t(e) { var e = (t = e.viewport).offset || new Vector2 , t = t.resolution2; n.uniforms.viewport.value.set(e.x, e.y, t.x, t.y) } var n = i.call(this, { fragmentShader: Ng.fragmentShader, vertexShader: Ng.vertexShader, uniforms: Jr.clone(Ng.uniforms), side: Y, name: "ModelTextureMaterial", defines: {} }) , e = viewer.mainViewport; return t({ viewport: e }), viewer.addEventListener("resize", function(e) { t(e) }), viewer.addEventListener("camera_changed", function(e) { n.uniforms.inverseProjectionMatrix.value.copy(e.camera.projectionMatrixInverse) }), n } return h(r, [{ key: "setProjectedPanos", value: function(e, t, n) { null != n && (this.uniforms.progress.value = n), e && (this.uniforms.pano0Map.value = e.getSkyboxTexture(), this.uniforms.pano0Position.value.copy(e.position), this.uniforms.pano0Matrix.value.copy(e.panoMatrix), this.uniforms.cameraHeight0.value = e.floorPosition.distanceTo(e.position)), this.uniforms.pano1Map.value = t.getSkyboxTexture(), this.uniforms.pano1Position.value.copy(t.position), this.uniforms.pano1Matrix.value.copy(t.panoMatrix), this.uniforms.cameraHeight1.value = t.floorPosition.distanceTo(t.position), this.pano0 = e, this.pano1 = t, this.updateDepthTex(e), this.updateDepthTex(t), this.needsUpdate = !0 } }, { key: "updateDepthTex", value: function(e) { Potree.settings.useDepthTex && e && e.depthTex && (e == this.pano0 || e == this.pano1) && (this.uniforms.depthMap0.value = this.pano0 && this.pano0.depthTex, this.uniforms.depthMap1.value = this.pano1 && this.pano1.depthTex, this.updateDepthTexEnable()) } }, { key: "updateDepthTexEnable", value: function() { var e = this.pano0 && this.pano1 && this.pano0.pointcloud.hasDepthTex && this.pano1.pointcloud.hasDepthTex; Fm.addOrRemoveDefine(this, "hasDepthTex", e ? "add" : "remove") } }]), r }(), Gg = { TILE_SIZE: 512, FACES_PER_PANO: 6, LocationOnTile: { Center: 0, UpperLeft: 1, UpperRight: 2, LowerRight: 3, LowerLeft: 4 }, getTileVector: function(e, t, n, i, r, a, o, s) { var l = e / t , u = 2 * (t / e) , c = u / 2 , d = 2 * (i / l) - 1 + c , h = 2 * ((r = l - 1 - r) / l) - 1 + c; switch (a = a || Gg.LocationOnTile.Center) { case Gg.LocationOnTile.UpperLeft: d -= c, h += c, d += o * u; break; case Gg.LocationOnTile.UpperRight: d += c, h += c, h -= o * u; break; case Gg.LocationOnTile.LowerRight: d += c, h -= c, d -= o * u; break; case Gg.LocationOnTile.LowerLeft: d -= c, h -= c, h += o * u; break; case Gg.LocationOnTile.Center: } switch (n) { case um.GL_TEXTURE_CUBE_MAP_POSITIVE_X: wg.setVector(s, -1, h, -d); break; case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_X: wg.setVector(s, 1, h, d); break; case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Y: wg.setVector(s, -d, 1, -h); break; case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: wg.setVector(s, -d, -1, h); break; case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Z: wg.setVector(s, -d, h, 1); break; case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: wg.setVector(s, d, h, -1) } wg.normalize(s) }, getFaceForTile: function(e, t) { var n = Gg.TILE_SIZE; e < Gg.TILE_SIZE && (n = e); n = Math.floor(e / n); return Math.floor(t / (n * n)) }, getTileLocation: function(e, t, n) { var i = Gg.TILE_SIZE; e < Gg.TILE_SIZE && (i = e); var r = Gg.getFaceForTile(e, t) , i = Math.floor(e / i) , t = t - r * (i * i); return n.tileX = t % i, n.tileY = Math.floor(t / i), n.face = r, n.faceTileIndex = t, n }, getTileCountForSize: function(e) { if (e <= Gg.TILE_SIZE) return Gg.FACES_PER_PANO; e = Math.floor(e / Gg.TILE_SIZE); return e * e * Gg.FACES_PER_PANO } }; Gg.getRelativeDirection = (Bg = new wg.Matrix4, Lg = new wg.Quaternion, function(e, t) { Lg.copy(e), Lg.inverse(), Bg.makeRotationFromQuaternion(Lg), Bg.applyToVector3(t), wg.normalize(t) } ), Gg.matchingTilesInDirection = (Cg = new wg.Vector3, Pg = new wg.Vector3(0,0,-1), Dg = new wg.Quaternion, Sg = { face: -1, faceTileIndex: -1, tileX: -1, tileY: -1 }, kg = function(e, t, n) { for (var i = Gg.getTileCountForSize(e), r = 0, a = 0; a < i; a++) Gg.getTileLocation(e, a, Sg), t && !t(Sg) || (r++, n && n.push({ face: Sg.face, faceTileIndex: Sg.faceTileIndex, tileX: Sg.tileX, tileY: Sg.tileY })); return r } , function(e, t, n, i, r, a) { var o = t < Gg.TILE_SIZE ? t : Gg.TILE_SIZE; if (!i && !r) return kg(t, null, a); var s = !!r; if (r = r || i, r = Math.max(0, Math.min(r, 360)), i = Math.max(0, Math.min(i, 360)), wg.copyVector(n, Cg), Gg.getRelativeDirection(e.quaternion4dkk, Cg), s) { Dg.setFromUnitVectors(Cg, Pg); return kg(t, function(e) { return Gg.isTileWithinFrustum(t, o, e.face, e.tileX, e.tileY, Dg, i, r) }, a) } return kg(t, function(e) { return Gg.isTileWithinFOV(t, o, e.face, e.tileX, e.tileY, Cg, i) }, a) } ), Gg.isTileWithinFrustum = (Tg = new wg.Vector3, function(e, t, n, i, r, a, o, s) { for (var l, u, c = Math.tan(.5 * s * wg.RADIANS_PER_DEGREE), d = -c, h = Math.tan(.5 * o * wg.RADIANS_PER_DEGREE), p = -h, f = Gg.mapFaceToCubemapFace(n), m = 0, v = 0, g = 0, y = 0, w = 0, b = Gg.LocationOnTile.Center; b <= Gg.LocationOnTile.LowerLeft; b++) Gg.getTileVector(e, t, f, i, r, b, 0, Tg), wg.applyQuaternionToVector(a, Tg), -1e-5 <= Tg.z ? 0 : (u = -1 / Tg.z, l = Tg.x * u, c < (u = Tg.y * u) ? m++ : u < d && v++, h < l ? g++ : l < p && y++, w++); return v !== w && m !== w && g !== w && y !== w } ), Gg.isTileWithinFOV = (_g = new wg.Vector3, Mg = new wg.Vector3(0,1,0), Ag = new wg.Vector3(1,0,0), function(e, t, n, i, r, a, o) { var s = Gg.mapFaceToCubemapFace(n); if (wg.cross(a, Mg, Ag), Gg.getTileVector(e, t, s, i, r, Gg.LocationOnTile.Center, 0, _g), Gg.isWithinFOV(_g, a, o, null)) return !0; for (var l = o / 360, u = Math.floor(1 / l), c = 0, d = 0; d < u; d++) { for (var h = Gg.LocationOnTile.UpperLeft; h <= Gg.LocationOnTile.LowerLeft; h++) if (Gg.getTileVector(e, t, s, i, r, h, c, _g), Gg.isWithinFOV(_g, a, o, null)) return !0; c += l } return !1 } ), Gg.isWithinFOV = (xg = new wg.Vector3, Eg = new wg.Vector3, function(e, t, n, i) { wg.copyVector(e, Eg), i && (wg.copyVector(i, xg), wg.normalize(xg), e = wg.dot(xg, e), xg.x *= e, xg.y *= e, xg.z *= e, wg.subVector(Eg, xg)); n = n / 2 * wg.RADIANS_PER_DEGREE; return Math.cos(n) <= wg.dot(Eg, t) } ), Gg.mapFaceToCubemapFace = (bg = { 0: um.GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 1: um.GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 2: um.GL_TEXTURE_CUBE_MAP_POSITIVE_X, 3: um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 4: um.GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 5: um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y }, function(e) { return bg[e] } ); var Hg, Vg, jg, Wg, Xg = new _c, qg = { sizeInfo: { minSize: 200, maxSize: 250, nearBound: .8, farBound: 10 }, backgroundColor: { r: 255, g: 255, b: 255, a: .4 }, textColor: { r: 0, g: 0, b: 0, a: 1 }, borderRadius: 15, renderOrder: 10 }, Jg = new ua(.2,.2), Yg = (new Su(.1,8,8), new $i({ color: 16711680 }), new $i({}), (new Sn).setFromAxisAngle(new Cn(0,0,1), Math.PI / 2)), Zg = null, Qg = function() { y(a, hn); var r = w(a); function a(t, e) { var n, i; return O(this, a), (n = r.call(this)).id = t.id, n.images360 = e, n.visible = !0, n.enabled = !0, n.addEventListener("isVisible", function(e) { viewer.updateVisible(n.marker, "panoVisi", e.visible), Potree.settings.showPanoMesh && (n.mesh.visible = e.visible), ("screenshot" == e.reason || e.visible) && n.label && (n.label.visible = e.visible), viewer.updateVisible(n.label2, "panoVisi", e.visible) }), "pano" == Potree.settings.editType ? (n.uuid = t.uuid, n.index = t.index, n.pointcloud = viewer.scene.pointclouds.find(function(e) { return e.panoUuid == t.uuid }), n.pointcloud.panos.push(g(n)), n.sid = n.pointcloud.dataset_id + "|" + n.uuid, n.panosData = t, n.dataPosition = (new Cn).copy(t.pose.translation), n.dataQuaternion = (new Sn).copy(t.pose.rotation), n.dataRotation = (new ci).setFromQuaternion(n.dataQuaternion), n.originPosition = new Cn, n.quaternion = new Sn, n.visibles = t.visibles, n.originFloorPosition = n.originPosition.clone(), n.originFloorPosition.z -= 1.4) : (n.originPosition = (new Cn).fromArray(t.dataset_location), n.originFloorPosition = (new Cn).fromArray(t.dataset_floor_location), n.originID = parseInt(t.file_id), n.pointcloud = viewer.scene.pointclouds.find(function(e) { return e.dataset_id == t.dataset_id }) || viewer.scene.pointclouds[0], n.pointcloud.panos.push(g(n)), n.sid = n.pointcloud.dataset_id + "|" + n.originID, i = [(i = t.dataset_orientation)[1], i[2], i[3], i[0]], n.quaternion = (new Sn).fromArray(i), n.quaternion4dkk = Up.convertVisionQuaternion(n.quaternion), n.quaternion2 = n.quaternion.clone(), n.quaternion = (new Sn).multiplyQuaternions(n.quaternion, Yg), n.rotation4dkk = (new ci).setFromQuaternion(n.quaternion4dkk), n.file = "https://4dkk.4dage.com/images/images".concat(Potree.settings.number, "/pan/high/").concat(n.id, ".jpg")), n.rotation = (new ci).setFromQuaternion(n.quaternion), n.build(), n.transformByPointcloud(), n.minimumTiledPanoLoaded = !1, n.highestPartialTileRenderOpCompleted = 0, n.highestFullTileRenderOpCompleted = 0, n.shouldRedrawOnBaseLoaded = !1, n.resolutionPromise = {}, n.tiledPanoRenderTarget = null, n.zoomed = !1, e.panoRenderer.addEventListener(dm.TileRenderSuccess, n.onTileRendered.bind(g(n))), e.panoRenderer.addEventListener(dm.PanoRenderComplete, n.onPanoRendered.bind(g(n))), e.panoRenderer.addEventListener(dm.TileRenderFailure, n.onTileRenderFail.bind(g(n))), e.panoRenderer.addEventListener(dm.UploadAttemptedForAllTiles, n.onUploadAttemptedForAllTiles.bind(g(n))), n.addEventListener("hoverOn", function(e) { e.byMainView || n.hoverOn(e) }), n.addEventListener("hoverOff", function(e) { e.byMainView || n.hoverOff(e) }), n } return h(a, [{ key: "setEnable", value: function(e) { viewer.updateVisible(this, "isEnabled", e), this.enabled = e } }, { key: "loadDepthImg", value: function() { var e, t, n = this; !this.pointcloud.hasDepthTex || this.depthTex || this.depthTexLoading || (this.depthTexLoading = !0, e = ("SS-t-7DUfWAUZ3V" == Potree.settings.number ? "".concat(Potree.scriptPath, "/data/").concat(Potree.settings.number, "/depthMap/") : "https://laser-oss.4dkankan.com/".concat(Potree.settings.webSite, "/").concat(this.pointcloud.sceneCode, "/data/").concat(this.pointcloud.sceneCode, "/depthmap/")).concat(this.originID, ".png"), (t = Xg.load(e, function() { n.depthTex = t, n.images360.dispatchEvent({ type: "loadedDepthImg", pano: n, loaded: !0 }), n.depthTexLoading = !1 }, function(e) { console.error("loadDepthImg失败, 数据集sceneCode" + n.pointcloud.sceneCode, n.id), n.pointcloud.hasDepthTex = !1, n.images360.dispatchEvent({ type: "loadedDepthImg", pano: n }) })).wrapS = ke, t.flipY = !1, t.magFilter = Oe, t.minFilter = Oe) } }, { key: "build", value: function() { this.panoMatrix = (new ni).makeRotationFromQuaternion(this.quaternion), this.oriPanoMatrix = this.panoMatrix.clone(), this.quaternion2 && (this.oriPanoMatrix2 = (new ni).makeRotationFromQuaternion(this.quaternion2)); var t = new Hr(Jg,(Hg || ((Hg = { default: Xg.load(Potree.resourcePath + "/textures/marker.png"), ring: Xg.load(Potree.resourcePath + "/textures/marker2.png") }).default.anisotropy = 4, Hg.ring.anisotropy = 4), new Wp({ opacity: .7, side: Y, map: Hg.default, transparent: !0, clipDistance: 2, occlusionDistance: 1, useDepth: !!Potree.settings.useDepthTex }))); t.up.set(0, 0, 1), t.lookAt(t.up), t.scale.set(2, 2, 2), this.addEventListener("changeMarkerTex", function(e) { t.material.map = Hg[e.name] }), this.marker = t, "pano" == Potree.settings.editType && viewer.updateVisible(t, "panoEdit", !1, 4), this.images360.node.add(t), Potree.settings.isTest && this.createTextLabel(), this.createTextLabel2(), t.addEventListener("mouseover", this.hoverOn.bind(this)), t.addEventListener("mouseleave", this.hoverOff.bind(this)) } }, { key: "transformByPointcloud", value: function() { var e = this.originPosition.clone().applyMatrix4(this.pointcloud.transformMatrix) , t = this.originFloorPosition.clone().applyMatrix4(this.pointcloud.transformMatrix); this.setPosition(e, t), this.panoMatrix = (new ni).multiplyMatrices(this.pointcloud.rotateMatrix, this.oriPanoMatrix), this.oriPanoMatrix2 && (this.panoMatrix2 = (new ni).multiplyMatrices(this.pointcloud.rotateMatrix, this.oriPanoMatrix2), this.panoMatrix2Inverse = this.panoMatrix2.clone().invert()), this.dispatchEvent("rePos") } }, { key: "setPosition", value: function(e, t) { this.position = e, this.floorPosition = t, this.marker.position.copy(this.floorPosition), this.marker.position.z += .04, this.label && ("pano" == Potree.settings.editType ? this.label.position.copy(this.position) : this.label.position.copy(this.floorPosition), this.label.position.z += .14, this.label.update()), this.label2 && ("pano" == Potree.settings.editType ? this.label2.position.copy(this.position) : this.label2.position.copy(this.floorPosition), this.label2.position.copy(this.marker.position), this.label2.update()) } }, { key: "hoverOn", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; gv.start(vv(this.marker.material, "opacity", 1), 250), e.byMap || this.dispatchEvent({ type: "hoverOn", byMainView: !0 }), e.byImages360 || this.images360.dispatchEvent({ type: "markerHover", hovered: !0, pano: this }) } }, { key: "hoverOff", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; gv.start(vv(this.marker.material, "opacity", .5), 250), e.byMap || this.dispatchEvent({ type: "hoverOff", byMainView: !0 }), e.byImages360 || this.images360.dispatchEvent({ type: "markerHover", hovered: !1, pano: this }) } }, { key: "setZoomed", value: function(e) { this.zoomed = e, "showPanos" == Potree.settings.displayMode && this.updateSkyboxForZoomLevel(), viewer.dispatchEvent({ type: "panoSetZoom", zoomed: e }) } }, { key: "enter", value: function() { this.setZoomed(!1), viewer.dispatchEvent({ type: gm.Enter, oldPano: Zg, newPano: this }), Zg = this } }, { key: "exit", value: function() { this.clearWaitDeferreds(), this.minimumTiledPanoLoaded = !1, this.tiledPanoRenderTarget = null, this.setZoomed(!1), this.images360.panoRenderer.deactivateTiledPano(this), this.highestPartialTileRenderOpCompleted = 0, this.highestFullTileRenderOpCompleted = 0, viewer.dispatchEvent({ type: gm.Exit, pano: this }) } }, { key: "updateSkyboxForZoomLevel", value: function() { this.minimumTiledPanoLoaded && this.images360.updateProjectedPanos() } }, { key: "getSkyboxTexture", value: function() { return this.minimumTiledPanoLoaded ? this.zoomed && this.images360.qualityManager.maxRenderTargetSize > this.images360.qualityManager.maxNavPanoSize ? this.images360.panoRenderer.zoomRenderTarget.texture : (this.tiledPanoRenderTarget.texture.mapping = 300, this.tiledPanoRenderTarget.texture) : null } }, { key: "isLoaded", value: function(e) { return e && "string" == typeof e && console.error("Wrong panoSize given to Panorama.isLoaded(); a tiled pano uses PanoSizeClass"), !!this.minimumTiledPanoLoaded && (!e || this.highestFullTileRenderOpCompleted >= e) } }, { key: "getWaitDeferred", value: function(e) { var t = this.resolutionPromise[this.id]; t || (this.resolutionPromise[this.id] = t = {}); var n = t[e]; return n || (n = { deferred: $.Deferred(), active: !1 }, t[e] = n), n } }, { key: "clearWaitDeferreds", value: function() { var e, t, n = this.resolutionPromise[this.id]; for (e in n || (this.resolutionPromise[this.id] = n = {}), n) n.hasOwnProperty(e) && ((t = n[e]).active = !1, t.deferred = $.Deferred()) } }, { key: "resetWaitDeferred", value: function(e) { e = this.getWaitDeferred(e); e.active = !1, e.deferred = $.Deferred() } }, { key: "onTileRendered", value: function(e) { e.id === this.id && this.dispatchEvent({ type: gm.TileLoaded, size: e.panoSize, index: e.tileIndex, count: e.totalTiles }) } }, { key: "onPanoRendered", value: function(e) { e.id === this.id && (this.minimumTiledPanoLoaded = !0, this.updateSkyboxForZoomLevel(), e.panoSize > this.highestPartialTileRenderOpCompleted && (this.highestPartialTileRenderOpCompleted = e.panoSize), e.updateFullComplete && e.panoSize > this.highestFullTileRenderOpCompleted && (this.highestFullTileRenderOpCompleted = e.panoSize), viewer.ifAllLoaded(this), this.dispatchEvent({ type: gm.LoadComplete, size: e.panoSize, count: e.totalTiles })) } }, { key: "onTileRenderFail", value: function(e) { e.id === this.id && this.dispatchEvent({ type: gm.LoadFailed }) } }, { key: "onUploadAttemptedForAllTiles", value: function(e) { var t; e.id === this.id && (t = this.images360.qualityManager.getPanoSize(cm.BASE), e.panoSize === t && this.shouldRedrawOnBaseLoaded && (this.shouldRedrawOnBaseLoaded = !1, this.panoRenderer.resetRenderStatus(this.id, !0, !1), this.panoRenderer.renderPanoTiles(this.id, null, !0, !0))) } }, { key: "createTextLabel", value: function() { this.removeTextLabel(), this.label = new Jp(Object.assign({}, qg, { text: this.id })), this.images360.node.add(this.label), this.floorPosition && this.label.position.copy(this.floorPosition) } }, { key: "createTextLabel2", value: function() { this.label2 = new Jp(Object.assign({}, { backgroundColor: { r: 255, g: 255, b: 255, a: 0 }, textColor: { r: 255, g: 255, b: 255, a: 1 }, textBorderColor: { r: 30, g: 30, b: 30, a: 1 }, textBorderThick: 3, dontFixOrient: !0, renderOrder: 10, fontsize: 30 }, { text: parseInt(this.id) + 1 })), this.images360.node.add(this.label2), this.floorPosition && this.label2.position.copy(this.floorPosition); this.label2.scale.set(.4, .4, .4), viewer.updateVisible(this.label2, "notDisplay", !1) } }, { key: "removeTextLabel", value: function() { this.label && this.label.parent.remove(this.label) } }, { key: "dispose", value: function() { var e = viewer.images360.panos.indexOf(this); -1 != e && (this.marker.parent.remove(this.marker), this.removeTextLabel(), this.depthTex && this.depthTex.dispose(), viewer.images360.panos.splice(e, 1), this.dispatchEvent("dispose")) } }]), a }(); Qg.prototype.loadTiledPano = (Vg = {}, jg = {}, Wg = {}, function(t, n, i, r, a, o) { var s = this , l = n.datasetsLocal.find(function(e) { return e.datasetId == s.pointcloud.dataset_id }).direction; null != r || (r = !0), null != a || (a = !0); var u, c = this.getWaitDeferred(t), d = c.deferred, h = null, p = null; return i && ("number" == typeof i ? h = i : (h = i.hFov, p = i.vFov)), this.isLoaded(t) ? d.resolve(t) : (c.active || (c.active = !0, u = this.id + ":" + t, Vg[u] = Vg[u] || [], Wg[u] = null, i && (Gg.matchingTilesInDirection(this, t, l, h, p, i = []), Wg[u] = i, Vg[u].forEach(function(t) { var e = Wg[u].find(function(e) { return t.faceTileIndex == e.faceTileIndex && t.face == e.face }); e && (e.loaded = !0) }), Wg[u].some(function(e) { return !e.loaded }) || (d.resolve(t), this.resetWaitDeferred(t), Wg[u] = null)), jg[this.id] || (jg[this.id] = !0, this.addEventListener(gm.LoadComplete, function(e) { var t = this.getWaitDeferred(e.size).deferred; t && "pending" === t.state() && this.highestPartialTileRenderOpCompleted >= e.size && (t.resolve(e.size, e.count), this.resetWaitDeferred(e.size)) } .bind(this)), this.addEventListener(gm.LoadFailed, function(t) { var n = this.getWaitDeferred(e).deferred; n && "pending" === n.state() && this.highestPartialTileRenderOpCompleted >= t.t && (n.reject(t.t), this.resetWaitDeferred(t.t)) } .bind(this)), this.addEventListener(gm.TileLoaded, function(e) { var t = e.index , n = e.count , i = e.size , r = this.id + ":" + i; Vg[r] = Vg[r] || []; var e = Gg.getTileLocation(i, t, {}) , a = e.faceTileIndex , o = e.face; Vg[r].push({ faceTileIndex: a, face: o }); e = this.getWaitDeferred(i).deferred; e && "pending" === e.state() && (e.notify(i, t, n), Wg[r] && ((t = Wg[r].find(function(e) { return e.faceTileIndex == a && e.face == o })) && (t.loaded = !0), Wg[r].some(function(e) { return !e.loaded }) || (this.onPanoRendered(this.id, i, n, !0), e.resolve(i, n), this.resetWaitDeferred(i), Wg[r] = null))) } .bind(this)))), this.images360.tileDownloader.clearForceQueue(), this.images360.tileDownloader.forceQueueTilesForPano(this, t, l, h, p, o), this.tiledPanoRenderTarget = this.images360.panoRenderer.activateTiledPano(this, this.images360.qualityManager.getMaxNavPanoSize(), r), this.images360.panoRenderer.renderPanoTiles(this.id, n, a)), d.promise() } ); var Kg = function() { function i(e, t, n) { O(this, i), this.maxNavPanoSize = -1, this.maxZoomPanoSize = -1, this.devicePixelDensity = e, this.deviceScreenSize = t, this.clientBandwidth = n, this.panoSizeClassMap = {}, this.useHighResolutionPanos = !0, this.useUltraHighResolutionPanos = !1, this.modelHasUltraHighPanos = !1, (this.qualityManager = this).maxRenderTargetSize = A.isMobile() ? 2048 : 4096, this.init() } return h(i, [{ key: "init", value: function(e) { this.buildPanoSizeClassMap(this.devicePixelDensity, this.deviceScreenSize, this.clientBandwidth), this.ultraHighSize = this.getPanoSize(cm.ULTRAHIGH), this.highSize = this.getPanoSize(cm.HIGH), this.standardSize = this.getPanoSize(cm.STANDARD), this.baseSize = this.getPanoSize(cm.BASE), T.tiling.maxZoomPanoQuality && this.ultraHighSize <= T.tiling.maxZoomPanoQuality && (T.tiling.allowUltraHighResolution = !0), this.highQualityThreshold = A.valueFromHash("threshold2k", T.windowHeightHighQualityThreshold), this.updateMaximums() } }, { key: "updateFromModel", value: function(e) { this.updateUltraHighResolutionSettings(e) } }, { key: "updateUltraHighResolutionSettings", value: function(e) { T.tiling.allowUltraHighResolution && this.modelHasUltraHighPanos ? this.useUltraHighResolutionPanos = !0 : this.useUltraHighResolutionPanos = !1, this.updateMaximums() } }, { key: "enableUltraHighQualityMode", value: function() { this.modelHasUltraHighPanos = !0, this.updateUltraHighResolutionSettings(null) } }, { key: "ultraHighQualityModeEnabled", value: function() { return this.modelHasUltraHighPanos } }, { key: "onModelChanged", value: function(e) { this.updateFromModel(e.model), this.updateMaximums() } }, { key: "updateMaximums", value: function() { this.maxNavPanoSize = T.tiling.maxNavPanoQuality || this.detectMaxNavPanoSize(), this.maxZoomPanoSize = T.tiling.maxZoomPanoQuality || this.detectMaxZoomPanoSize(), this.maxZoomPanoSize < this.maxNavPanoSize && (this.maxNavPanoSize = this.maxZoomPanoSize) } }, { key: "buildPanoSizeClassMap", value: function() { this.panoSizeClassMap[cm.BASE] = 512, this.panoSizeClassMap[cm.STANDARD] = 1024, this.panoSizeClassMap[cm.HIGH] = 2048, this.panoSizeClassMap[cm.ULTRAHIGH] = 4096 } }, { key: "getPanoSize", value: function(e) { return this.panoSizeClassMap[e] } }, { key: "getMaxPossiblePanoSize", value: function() { return this.getPanoSize(cm.ULTRAHIGH) } }, { key: "getMaxPanoSize", value: function() { return this.maxZoomPanoSize } }, { key: "getMaxNavPanoSize", value: function() { return this.maxNavPanoSize } }, { key: "getMaxZoomPanoSize", value: function() { return this.maxZoomPanoSize } }, { key: "detectMaxNavPanoSizeClass", value: function() { return "1k" !== Potree.settings.navTileClass ? cm.HIGH : cm.STANDARD } }, { key: "detectMaxNavPanoSize", value: function() { var e = this.detectMaxNavPanoSizeClass(); return this.getPanoSize(e) } }, { key: "detectMaxZoomPanoSize", value: function() { return this.zoomLevelResolution ? "4k" == this.zoomLevelResolution && this.useUltraHighResolutionPanos ? this.getPanoSize(cm.ULTRAHIGH) : "1k" != this.zoomLevelResolution && this.useHighResolutionPanos ? this.getPanoSize(cm.HIGH) : this.getPanoSize(cm.STANDARD) : this.useHighResolutionPanos ? this.useUltraHighResolutionPanos ? this.getPanoSize(cm.ULTRAHIGH) : this.getPanoSize(cm.HIGH) : this.getPanoSize(cm.STANDARD) } }]), i }() , $g = Object.freeze({ None: 0, DirectionalFOV: 1 }) , e0 = (t0._panoSpaceDir = new Cn, t0._fovThreshold = -1, t0._fovThresholdNarrow = -1, t0); function t0(e, t) { var n = t0._panoSpaceDir , i = t0._fovThreshold , r = t0._fovThresholdNarrow , a = Math.max(Math.min(n.dot(e.direction), 1), -1) , n = Math.max(Math.min(n.dot(t.direction), 1), -1); return e._dot = a, t._dot = n, i <= a && n < i ? -1 : a < i && i <= n ? 1 : r <= a && n < r ? -1 : a < r && r <= n || e.panoSize > t.panoSize ? 1 : t.panoSize > e.panoSize ? -1 : -(a - n) } var n0, i0, r0, a0, o0, s0, l0, u0 = function() { function u(e, t, n, i, r) { O(this, u), this.qualityManager = e, this.maxNavQuality = this.qualityManager.getMaxNavPanoSize(), this.maxZoomQuality = this.qualityManager.getMaxZoomPanoSize(), this.baseSize = t, this.standardSize = n, this.highSize = i, this.ultraHighSize = r, this.priorityCriteria = new u.PriorityCriteria(null,new Cn(0,0,0),new Cn(0,0,-1),new Cn(0,0,-1)) } return h(u, [{ key: "updateCriteria", value: function(e, t, n, i) { this.priorityCriteria.pano = e, this.priorityCriteria.cameraPosition.copy(t), this.priorityCriteria.cameraDirs = n, this.priorityCriteria.upcomingPanos = i, this.maxNavQuality = this.qualityManager.getMaxNavPanoSize(), this.maxZoomQuality = this.qualityManager.getMaxZoomPanoSize() } }, { key: "canDownloadSize", value: function(e) { return this.maxNavQuality >= e || this.maxZoomQuality >= e && this.zoomingActive } }, { key: "populateScoredPanos", value: function(e, t, n, i, r) { (n = n || []).length = 0; var a = [ly.filters.inPanoDirection(e.position, i, u.DIRECTION_SCORE_STRICTNESS), ly.filters.not(e)] , i = [ly.scoreFunctions.distanceSquared(e), ly.scoreFunctions.direction(e.position, i)] , o = Fm.sortByScore(t, a, i); if (o) for (var s = 0; s < o.length && s < r; s++) { var l = o[s].item; n.push(l) } return n } }, { key: "queueTilesForPanos", value: function(e, t, n, i, r) { for (var a = 0, o = 0; o < t.length; o++) { var s = t[o]; if (a += 0 < this.queueTilesForPano(e, n, s, i) ? 1 : 0, r && r <= a) break } return a } }, { key: "canIncludeDescriptor", value: function(e) { return e.status !== vm.Downloading && e.status !== vm.Downloaded } }, { key: "canIncludePano", value: function(e, t) { return !e.isLoaded(t) } }, { key: "getFOVDotThreshold", value: function(e) { return Math.cos(gn.degToRad(e / 2)) } }, { key: "setZoomingActive", value: function(e) { e !== this.zoomingActive && (this.zoomingActive = e) } }]), u }(); u0.PriorityCriteria = function(e, t, n, i, r) { this.pano = e, this.cameraPosition = (new Cn).copy(t), this.cameraDirs = [], this.panoSpaceDir = (new Cn).copy(i), this.upcomingPanos = r, this.copy = function(e) { this.pano = e.pano, this.cameraPosition.copy(e.cameraPosition), this.cameraDirs = e.cameraDirs, this.panoSpaceDir.copy(e.panoSpaceDir), this.upcomingPanos = r } , this.zoomingActive = !1 } , u0.DIRECTIONAL_FOV = 180, u0.DIRECTIONAL_FOV_NARROW = 120, u0.MAX_SCORED_PANOS_TOCONSIDER = 6, u0.MAX_SCORED_PANOS_TOADD = 2, u0.MAX_UPCOMING_PANOS_TOADD = 3, u0.DIRECTION_SCORE_STRICTNESS = .75, u0.appendQueue = function(e, t) { if (e && t) for (var n = 0; n < t.length; n++) e.push(t[n]) } , u0.sortPanoTiles = function(e, t, n) { n.datasetsLocal && (n = n.datasetsLocal.find(function(e) { return e.datasetId == t.pointcloud.dataset_id }).direction), e0._panoSpaceDir.copy(n), Gg.getRelativeDirection(t.quaternion4dkk, e0._panoSpaceDir), e0._fovThresholdNarrow = Up.getFOVDotThreshold(u0.DIRECTIONAL_FOV_NARROW), e0._fovThreshold = Up.getFOVDotThreshold(u0.DIRECTIONAL_FOV), e.sort(e0) } , u0.insertSortedPanoTile = function(e, t, n, i) { i.datasetsLocal && (i = i.datasetsLocal.find(function(e) { return e.datasetId == n.pointcloud.dataset_id }).direction), e0._panoSpaceDir.copy(i), Gg.getRelativeDirection(n.quaternion4dkk, e0._panoSpaceDir), e0._fovThresholdNarrow = Up.getFOVDotThreshold(u0.DIRECTIONAL_FOV_NARROW), e0._fovThreshold = Up.getFOVDotThreshold(u0.DIRECTIONAL_FOV); for (var r = -1, a = 0; a < e.length; a++) if (e0(t, e[a]) <= 0) { r = a; break } if (-1 === r) e[e.length] = t; else { for (var o = e.length; r < o; o--) e[o] = e[o - 1]; e[r] = t } } , u0.prototype.filterDepthTex = function(e) { var t; Potree.settings.useDepthTex && this.priorityCriteria.pano && (t = this.priorityCriteria.cameraDirs.vectorForward, this.populateScoredPanos(this.priorityCriteria.pano, e, e = [], t, u0.MAX_SCORED_PANOS_TOCONSIDER), e.forEach(function(e) { return e.loadDepthImg() })) } , u0.prototype.filterAndPrioritize = (n0 = [], i0 = [], r0 = [], function(e, t, n) { var i = this.priorityCriteria.cameraDirs.vectorForward; this.populateScoredPanos(this.priorityCriteria.pano, t, i0, i, u0.MAX_SCORED_PANOS_TOCONSIDER), i0.forEach(function(e) { return e.loadDepthImg() }); var r = this.baseSize , a = this.standardSize , t = this.highSize , i = this.ultraHighSize; this.queueTilesForPano(e, n, this.priorityCriteria.pano, r), this.priorityCriteria.upcomingPanos && this.queueTilesForPanos(e, this.priorityCriteria.upcomingPanos, n, r, u0.MAX_UPCOMING_PANOS_TOADD), r0.length = 0, this.canDownloadSize(a) && this.queueTilesInDirectionForPano(r0, n, this.priorityCriteria.pano, a, this.priorityCriteria.cameraPosition, this.priorityCriteria.cameraDirs, u0.DIRECTIONAL_FOV_NARROW), u0.sortPanoTiles(r0, this.priorityCriteria.pano, this.priorityCriteria.cameraDirs), u0.appendQueue(e, r0), this.queueTilesForPanos(e, i0, n, r, u0.MAX_SCORED_PANOS_TOADD), r0.length = 0, this.canDownloadSize(t) && this.queueTilesInDirectionForPano(r0, n, this.priorityCriteria.pano, t, this.priorityCriteria.cameraPosition, this.priorityCriteria.cameraDirs, u0.DIRECTIONAL_FOV_NARROW), this.canDownloadSize(i) && this.queueTilesInDirectionForPano(r0, n, this.priorityCriteria.pano, i, this.priorityCriteria.cameraPosition, this.priorityCriteria.cameraDirs, u0.DIRECTIONAL_FOV_NARROW), u0.sortPanoTiles(r0, this.priorityCriteria.pano, this.priorityCriteria.cameraDirs), u0.appendQueue(e, r0), r0.length = 0, this.canDownloadSize(a) && this.queueTilesInDirectionForPano(r0, n, this.priorityCriteria.pano, a, this.priorityCriteria.cameraPosition, this.priorityCriteria.cameraDirs, u0.DIRECTIONAL_FOV), this.canDownloadSize(t) && this.queueTilesInDirectionForPano(r0, n, this.priorityCriteria.pano, t, this.priorityCriteria.cameraPosition, this.priorityCriteria.cameraDirs, u0.DIRECTIONAL_FOV), this.canDownloadSize(i) && this.queueTilesInDirectionForPano(r0, n, this.priorityCriteria.pano, i, this.priorityCriteria.cameraPosition, this.priorityCriteria.cameraDirs, u0.DIRECTIONAL_FOV), u0.sortPanoTiles(r0, this.priorityCriteria.pano, this.priorityCriteria.cameraDirs), u0.appendQueue(e, r0), this.queueTilesForPanos(e, n0, n, r) } ), u0.prototype.queueTilesInDirectionForPano = (a0 = { filter: $g.DirectionalFOV, direction: new Cn, fov: 60 }, o0 = new Cn, function(e, t, n, i, r, a, o) { a = a.datasetsLocal.find(function(e) { return e.datasetId == n.pointcloud.dataset_id }).direction; return o0.copy(a), Gg.getRelativeDirection(n.quaternion4dkk, o0), a0.direction.copy(o0), a0.fov = o, this.filterAndQueueTileDownloadDescriptors(e, t, n, i, a0) } ), u0.prototype.filterAndQueueTileDownloadDescriptors = (s0 = [], function(e, t, n, i, r) { i = t.getTileDownloadDescriptors(n, i); s0.length = 0, this.filterTileDownloadDescriptors(n, i, s0, r); for (var a = 0, o = 0; o < s0.length; o++) { var s = s0[o]; s && (e.push(s), a++) } return a } ), u0.prototype.filterTileDownloadDescriptors = (new Cn, function(e, t, n, i) { var r, a; if (i.filter === $g.DirectionalFOV) for (r = 0; r < t.length; r++) a = t[r], Gg.isTileWithinFOV(a.panoSize, a.tileSize, a.face, a.tileX, a.tileY, i.direction, i.fov) && n.push(a); else for (r = 0; r < t.length; r++) a = t[r], n.push(a); for (r = 0; r < n.length; r++) a = n[r], this.canIncludeDescriptor(a) || (n[r] = null) } ), u0.prototype.queueTilesForPano = (l0 = { filter: $g.None }, function(e, t, n, i) { return this.filterAndQueueTileDownloadDescriptors(e, t, n, i, l0) } ); function c0(e) { for (var t = e.split(","), e = t[0].match(/:(.*?);/)[1], n = atob(t[1]), i = n.length, r = new Uint8Array(i); i--; ) r[i] = n.charCodeAt(i); return new Blob([r],{ type: e }) } function d0() {} var h0 = [] , p0 = { NEXT: -999, SUCCESS: 0, EXCEPTION: -1, FAILURE_CODE_3001: 3001, FAILURE_CODE_3002: 3002, FAILURE_CODE_3003: 3003, FAILURE_CODE_3004: 3004, FAILURE_CODE_3005: 3005, FAILURE_CODE_3006: 3006, FAILURE_CODE_3007: 3007, FAILURE_CODE_3008: 3008, FAILURE_CODE_3009: 3009, FAILURE_CODE_3010: 3010, FAILURE_CODE_3011: 3011, FAILURE_CODE_3012: 3012, FAILURE_CODE_3013: 3013, FAILURE_CODE_3014: 3014, FAILURE_CODE_3015: 3015, FAILURE_CODE_3016: 3016, FAILURE_CODE_3017: 3017, FAILURE_CODE_3018: 3018, FAILURE_CODE_5010: 5010, FAILURE_CODE_5012: 5012, FAILURE_CODE_5014: 5014, FAILURE_CODE_5005: 5005 }; $.ajaxSetup({ headers: {}, beforeSend: function(e) { var t = ((t = A.urlHasValue("token", !0)) && localStorage.setItem("token", t), t || localStorage.getItem("token") || ""); t ? e.setRequestHeader("token", t) : -1 == this.url.indexOf("isLogin") || showLoginTips() }, error: function(e, t, n) { return -1 != this.url.indexOf("/scene.json") && 404 == e.status ? $alert({ content: i18n.t("tips.scene_notfound") }) : "POST" === this.type ? $alert({ content: i18n.t("tips.network_error") }) : void 0 }, success: function(e) {}, complete: function() { "POST" === this.type && f0.__loading && $waiting.hide(), f0.__loading = !0 } }); var f0 = { statusCode: p0, __loading: !0, __request: function(e, i, r, a, o, s) { return "function" != typeof o && (o = d0), "function" != typeof s && (s = d0), e.done(function(e) { var t, n; void 0 !== e.code ? (t = e.code, n = function(e) { e != p0.FAILURE_CODE_3001 && e != p0.FAILURE_CODE_3002 && e != p0.FAILURE_CODE_3003 && e != p0.FAILURE_CODE_3004 || -1 == r.indexOf("isLogin") && -1 == r.indexOf("openSceneBykey") && h0.push(function() { f0[i](r, a, o, s) }), s() } , t == p0.EXCEPTION ? $alert({ content: i18n.t("tips.exception") }) : t == p0.FAILURE_CODE_3002 || t == p0.FAILURE_CODE_3003 || t == p0.FAILURE_CODE_3004 ? (n(t), showLoginTips()) : t == p0.FAILURE_CODE_3001 ? (n(t), $alert({ content: i18n.t("tips.params_notfound") })) : t == p0.FAILURE_CODE_3017 ? (n(t), $alert({ content: i18n.t("tips.file_notfound") })) : t == p0.FAILURE_CODE_5005 ? (n(t), $alert({ content: i18n.t("tips.scene_notfound") })) : t == p0.FAILURE_CODE_5010 ? (n(t), $alert({ content: i18n.t("tips.camera_notfound") })) : t == p0.FAILURE_CODE_5012 ? (n(t), $alert({ content: i18n.t("tips.data_error") })) : t == p0.FAILURE_CODE_5014 ? (n(t), $alert({ content: i18n.t("tips.auth_deny") })) : p0.NEXT) === p0.NEXT && o(e, 0 == e.code) : o(e) }), e.fail(s), e.always(function() { return e = null }), e }, get: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {} , n = 2 < arguments.length ? arguments[2] : void 0 , i = 3 < arguments.length ? arguments[3] : void 0; return /\.json/.test(e) ? this.getJson(e, t, n, i) : this.__request($.get(e, t), "get", e, t, n, i) }, getText: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {} , n = 2 < arguments.length ? arguments[2] : void 0 , i = 3 < arguments.length ? arguments[3] : void 0; return this.__request($.ajax({ url: e, dataType: "text" }), "getText", e, t, n, i) }, getJson: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {} , n = 2 < arguments.length ? arguments[2] : void 0 , i = 3 < arguments.length ? arguments[3] : void 0; return this.__request($.getJSON(e, t), "get", e, t, n, i) }, getBlob: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {} , n = 2 < arguments.length ? arguments[2] : void 0 , i = 3 < arguments.length ? arguments[3] : void 0; return this.__request($.ajax({ url: e, dataType: "blob" }), "getBlob", e, t, n, i) }, getArraybuffer: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {} , n = 2 < arguments.length ? arguments[2] : void 0 , i = 3 < arguments.length ? arguments[3] : void 0; return this.__request($.ajax({ url: e, dataType: "arraybuffer" }), "getArraybuffer", e, t, n, i) }, post: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {} , n = 2 < arguments.length ? arguments[2] : void 0 , i = 3 < arguments.length ? arguments[3] : void 0; return -1 == e.indexOf("isLogin") && f0.__loading && $waiting.show(), this.__request($.post(e, t), "post", e, t, n, i) }, postJson: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {} , n = 2 < arguments.length ? arguments[2] : void 0 , i = 3 < arguments.length ? arguments[3] : void 0; return f0.__loading && $waiting.show(), this.__request($.ajax({ type: "POST", url: e, contentType: "application/json", data: JSON.stringify(t) }), "postJson", e, t, n, i) }, postForm: function(e, t, n, i, r) { return "function" == typeof r ? this.__request($.ajax({ type: "POST", url: e, processData: !1, contentType: !1, data: t, xhr: function() { var e; return (e = new XMLHttpRequest).upload.addEventListener("progress", function(e) { r(e.loaded / e.total * 100 + "%") }), e } }), "postForm", e, t, n, i) : (f0.__loading && $waiting.show(), this.__request($.ajax({ type: "POST", url: e, processData: !1, contentType: !1, data: t }), "postForm", e, t, n, i)) }, loadImage: function(e) { var t = this , n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 3 , i = $.Deferred() , r = new Image; return r.onerror = function() { 0 < n ? setTimeout(function() { console.warn("Retrying load image: " + e), t.loadImage(e, n - 1).done(i.resolve.bind(i)).progress(i.notify.bind(i)).fail(i.reject.bind(i)) }, 1e3) : i.reject("[".concat(e, "]加载失败")) } , r.onload = function() { i.resolve(r) } , r.crossOrigin = "anonymous", r.src = e, i }, uploadFile: function(e) { var t, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, i = 2 < arguments.length ? arguments[2] : void 0, r = 3 < arguments.length ? arguments[3] : void 0, a = 4 < arguments.length ? arguments[4] : void 0, o = new FormData; for (t in n) "file" == t ? o.append("file", n[t], n.filename || n[t].name) : "filename" != t && o.append(t, n[t]); return this.postForm(e, o, i, r, a) }, uploadBlobFile: function(e) { var t, n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, i = 2 < arguments.length ? arguments[2] : void 0, r = 3 < arguments.length ? arguments[3] : void 0, a = new FormData; for (t in n) "file" === t ? a.append("file", c0(n.file), n.filename) : "filename" != t && a.append(t, n[t]); return this.postForm(e, a, i, r) } }; window.downloaded = {}, window.startdownloads = []; var m0, v0, g0, y0, w0, b0 = function() { y(n, hn); var e = w(n); function n() { var t; return O(this, n), (t = e.call(this)).panos = null, t.retryMinimumTime = 1e4, t.panoLoadCallbacks = {}, t.downloadDescriptors = {}, t.priorityQueue = [], t.forceQueue = [], t.activeDownloads = [], t.tilePrioritizer = null, t.refreshInterval = null, t.processPriorityQueue = !1, t.concurrentDownloads = 6, t.downloadTestResults = {}, t.freeze = Object.freeze({ Testing: 1, Success: 2, Fail: 3 }), t.visible = !0, viewer.addEventListener("pageVisible", function(e) { viewer.updateVisible(g(t), "pageVisible", e.v), t.judgeStart() }), t } return h(n, [{ key: "setPanoData", value: function(e, t) { this.panos = e, this.imagePanos = t } }, { key: "start", value: function() { this.downloadCubeTex = !0, Potree.settings.useDepthTex ? this.refreshInterval || this.judgeStart() : (viewer.updateVisible(this, "pano", !0), this.judgeStart()) } }, { key: "stop", value: function() { this.downloadCubeTex = !1, Potree.settings.useDepthTex || (viewer.updateVisible(this, "pano", !1), this.judgeStart()) } }, { key: "judgeStart", value: function() { this.visible ? (this.started = !0, this.refreshUpdateInterval(0)) : (this.started = !1, window.clearTimeout(this.refreshInterval)) } }, { key: "refreshUpdateInterval", value: function(e) { e = e || 0, this.refreshInterval = window.setTimeout(function() { this.update() ? this.refreshUpdateInterval(n.ACTIVE_REFRESH_DELAY) : this.refreshUpdateInterval(n.IDLE_REFRESH_DELAY) } .bind(this), e) } }, { key: "update", value: function() { if (this.downloadCubeTex) { var e = 0 < this.forceQueue.length; return this.processQueueForDownloading(this.forceQueue), this.processPriorityQueue && (this.queuePrioritizedTilesForPanos(this.panos), 0 < this.priorityQueue.length && (e = !0), this.processQueueForDownloading(this.priorityQueue)), e } this.tilePrioritizer.filterDepthTex(this.panos) } }, { key: "queuePrioritizedTilesForPanos", value: function(e) { this.tilePrioritizer && (this.clearQueue(this.priorityQueue), this.tilePrioritizer.filterAndPrioritize(this.priorityQueue, e, this), this.clearFromQueue(this.priorityQueue, vm.None, !0), this.setStatusOrRemoveForAllDescriptors(this.priorityQueue, vm.Queued)) } }, { key: "clearQueue", value: function(e) { this.setStatusForAllDescriptors(e, vm.None), e.length = 0 } }, { key: "clearForceQueue", value: function() { this.clearQueue(this.forceQueue) } }, { key: "clearFromQueue", value: function(e, t, n) { for (var i = 0; i < e.length; i++) { var r = e[i]; r && (t === r.status && !n || t !== r.status && n) && (e[i] = null) } } }, { key: "setStatusForAllDescriptors", value: function(e, t) { for (var n = 0; n < e.length; n++) { var i = e[n]; i && (i.status = t) } } }, { key: "setStatusOrRemoveForAllDescriptors", value: function(e, t) { for (var n = 0; n < e.length; n++) { var i = e[n]; i && (i.status !== t ? i.status = t : e[n] = null) } } }, { key: "getTileDownloadDescriptors", value: function(e, t) { var n = this.getAllTileDownloadDescriptorsForPano(e) , i = n[t]; return i || (i = this.buildDownloadDescriptorArray(t), n[t] = i, this.initTileDownloadDescriptors(i, e, t)), i } }, { key: "getAllTileDownloadDescriptorsForPano", value: function(e) { var t = this.downloadDescriptors[e.id]; return t || (this.downloadDescriptors[e.id] = t = {}), t } }, { key: "processQueueForDownloading", value: function(e, t) { if (this.cleanupActiveDownloads(), this.activeDownloads.length < this.concurrentDownloads || t) for (var n = t ? e.length : this.concurrentDownloads - this.activeDownloads.length, i = 0; i < n && 0 < e.length; 0) { var r = e.shift(); if (r) { if (512 < r.panoSize && !this.isPanoDownloaded(r.pano, 512)) { e.push(r); break } this.startDownload(r), i++ } } } }, { key: "testDownload", value: function(t, e, n) { var i, r = this.downloadTestResults[t]; r ? r === this.freeze.Success ? n(!0) : r === this.freeze.Fail && n(!1) : (this.downloadTestResults[t] = this.freeze.Testing, i = this.panos[0], r = this.getTileUrl({ pano: i, panoSize: t, tileSize: e, tileIndex: 0 }), i = function(e) { this.downloadTestResults[t] = this.freeze.Success, n(!0) } .bind(this), e = function() { this.downloadTestResults[t] = this.freeze.Fail, n(!1) } .bind(this), this.loadImage(r, 0, i, e)) } }, { key: "startDownload", value: function(e) { startdownloads.push(e), e.status = vm.Downloading; var t = this.getTileUrl(e); t && (this.activeDownloads.push(e), this.loadImage(t, n.DOWNLOAD_RETRIES, this.downloadComplete.bind(this, e), this.downloadFailed.bind(this, e))) } }, { key: "downloadFailed", value: function(e, t) {} }, { key: "downloadComplete", value: function(e, t) { var n = this.getPanoLoadCallbacks(e.pano, e.panoSize); e.status = vm.Downloaded, n && n.onProgress && n.onProgress(e.pano, e.panoSize); var i = { panoId: e.pano.id, image: t, tileSize: e.tileSize, panoSize: e.panoSize, tileIndex: e.tileIndex, faceTileIndex: e.faceTileIndex, totalTiles: e.totalTiles, face: e.face, tileX: e.tileX, tileY: e.tileY, direction: e.direction }; downloaded[e.pano.id] || (downloaded[e.pano.id] = { 512: [], 1024: [], 2048: [] }), downloaded[e.pano.id][e.panoSize] || (downloaded[e.pano.id][e.panoSize] = []), downloaded[e.pano.id][e.panoSize].push(e), 512 != e.panoSize && downloaded[e.pano.id][512].length < 6 && console.warn("没下完"), e.image = t, this.dispatchEvent({ type: hm.TileDownloadSuccess, desc: i }), this.isPanoDownloaded(e.pano, e.panoSize) && (i = { panoId: e.pano.id, tileSize: e.tileSize, panoSize: e.panoSize }, this.dispatchEvent({ type: hm.PanoDownloadComplete, desc: i }), n && n.onLoad && n.onLoad(e.pano, e.panoSize)) } }, { key: "isPanoDownloaded", value: function(e, t) { var n = this.getTileDownloadDescriptors(e, t); if (n.length <= 0) return !1; for (var i = 0; i < n.length; i++) if (n[i].status !== vm.Downloaded) return !1; return !0 } }, { key: "setPanoLoadCallbacks", value: function(e, t, n, i, r) { t = e.id + ":" + this.qualityManager.getPanoSize(t); this.panoLoadCallbacks[t] = { onLoad: n, onFail: i, onProgress: r } } }, { key: "getPanoLoadCallbacks", value: function(e, t) { t = e.id + ":" + t; return this.panoLoadCallbacks[t] } }, { key: "buildDownloadDescriptorArray", value: function(e) { for (var t = Gg.getTileCountForSize(e), n = [], i = 0; i < t; i++) { var r = this.buildDownloadDescriptor(); n.push(r) } return n } }, { key: "buildDownloadDescriptor", value: function() { return { panoGroupId: null, pano: null, panoSize: -1, tileSize: -1, tileIndex: -1, totalTiles: -1, faceTileIndex: -1, status: vm.None, url: null, image: null, direction: new Cn, face: -1, cubeFace: -1, tileX: -1, tileY: -1 } } }, { key: "initTileDownloadDescriptors", value: function(e, t, n) { for (var i = 0; i < e.length; i++) { var r = e[i]; this.initTileDownloadDescriptor(r, t, n, i) } } }, { key: "initTileDownloadDescriptor", value: function(e, t, n, i) { var r = n >= Gg.TILE_SIZE ? Gg.TILE_SIZE : n; e.face = Gg.getFaceForTile(n, i), e.cubeFace = Gg.mapFaceToCubemapFace(e.face), e.pano = t, e.panoSize = n, e.tileSize = r, e.tileIndex = i, e.totalTiles = Gg.getTileCountForSize(n), e.status = vm.None, e.image = null, Gg.getTileLocation(e.panoSize, e.tileIndex, e), Gg.getTileVector(e.panoSize, e.tileSize, e.cubeFace, e.tileX, e.tileY, Gg.LocationOnTile.Center, 0, e.direction) } }, { key: "getTiles", value: function(e, t) { return (Potree.settings.isLocal2 ? "".concat(Potree.settings.urls.prefix3, "/scene_view_data/").concat(t, "/images/") : "".concat(Potree.settings.urls.prefix3, "/images/images").concat(t, "/")).concat(e) } }, { key: "loadImage", value: function(e, t, n, i) { f0.loadImage(e, t).then(function(e) { n(e) }).fail(i) } }]), n }(); function x0(e, t) { this.tree = e, this.parent = t, this.children = [], this.id = ++M0 } function E0(e) { e.root = function e(t, n, i) { if (i > t.levels) return null; var r = new x0(t,n); t.allNodes.push(r); for (var a = 0; a < _0; a++) r.children[a] = e(t, r, i + 1); return r }(e, null, 0) } b0.prototype.forceQueueTilesForPano = (m0 = [], v0 = [], function(e, t, n, i, r, a) { m0.length = 0; for (var o = this.getTileDownloadDescriptors(e, t), s = 0; s < o.length; s++) { var l = o[s]; l.status !== vm.None && l.status !== vm.Queued || m0.push(l) } if (n && 0 < m0.length) { u0.sortPanoTiles(m0, e, n), v0.length = 0, Gg.matchingTilesInDirection(e, t, n, i, r, v0); for (var u = 0, c = function(e) { return e.face === d.face && e.faceTileIndex === d.faceTileIndex }; u < m0.length; ) { var d = m0[u]; v0.findIndex(c) < 0 ? m0.splice(u, 1) : u++ } } for (var h = 0; h < m0.length; h++) this.forceQueue.push(m0[h]); this.setStatusForAllDescriptors(this.forceQueue, vm.ForceQueued), this.clearFromQueue(this.priorityQueue, vm.ForceQueued, !1), a && this.processQueueForDownloading(this.forceQueue, !0) } ), b0.prototype.cleanupActiveDownloads = (g0 = [], function() { for (var e = g0.length = 0; e < this.activeDownloads.length; e++) { var t = this.activeDownloads[e]; t.status !== vm.Downloaded && t.status !== vm.Failed && g0.push(t) } this.activeDownloads.length = 0, this.activeDownloads.push.apply(this.activeDownloads, g0) } ), b0.prototype.getTileUrl = (y0 = { 256: "256", 512: "512", 1024: "1k", 2048: "2k", 4096: "4k" }, w0 = { face: -1, faceTileIndex: -1, tileX: -1, tileY: -1 }, function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {} , t = e.pano.originID , n = e.panoSize , i = e.tileSize , r = e.tileIndex , a = e.pano.pointcloud.sceneCode; Gg.getTileLocation(n, r, w0); var o = Math.floor(n / i) , i = Math.floor(r / (o * o)) , r = "" , o = "" , o = Potree.settings.isLocal ? (r = this.getTiles(r = "tiles/" + t + "/" + y0[n] + "_face" + i + "_" + w0.tileX + "_" + w0.tileY + ".jpg", a), "?") : (r = "tiles/4k/" + t + "_skybox" + i + ".jpg?x-oss-process=", "512" == y0[n] ? r += "image/resize,h_512" : ("1k" == y0[n] || "2k" == y0[n] ? r += "image/resize,m_lfit,w_" + n + "/crop,w_512,h_512," : r = "tiles/4k/" + t + "_skybox" + i + ".jpg?x-oss-process=image/crop,w_512,h_512,", r += 0 == w0.tileX ? "x_0," : "x_" + (512 * w0.tileX - 1) + ",", r += 0 == w0.tileY ? "y_0" : "y_" + (512 * w0.tileY - 1)), r = this.getTiles(r, a), "&"); return r += o + "time=" + e.pano.pointcloud.timeStamp } ), b0.tilegen = !0, b0.IDLE_REFRESH_DELAY = 500, b0.ACTIVE_REFRESH_DELAY = 16, b0.DOWNLOAD_RETRIES = 4; var _0 = 4 , M0 = 0 , A0 = function() { function i(e, t) { O(this, i), this.levels = t, this.tileSize = e, this.root = null, this.allNodes = [], E0(this) } return h(i, [{ key: "getSubNode", value: function(e, t, n) { (!t || e < this.tileSize) && (t = 0), (!n || e < this.tileSize) && (n = 0), e < this.tileSize && (e = this.tileSize); e = i.getLevelCountForSize(this.tileSize, e); return function e(t, n, i, r, a) { if (!t) return null; if (0 === i) return t; if (!t.children || 0 === t.children.length) return null; var o = Math.pow(2, i) / 2 , s = r % o , l = a % o , a = Math.floor(a / o) , o = Math.floor(r / o); return e(t.children[2 * a + o], n + 1, i - 1, s, l) }(this.root, 0, e, t, n) } }, { key: "breadthFirst", value: function(e) { var t = !!(e = e || {}).nullLevelEnd , n = e.maxLevel , i = e.minLevel , r = e.callback , a = e.saveVisited , o = [] , s = {} , l = 0; for (o.push(this.root), o.push(s); 0 < o.length && !(n && n < l); ) { var u = o.shift(); if (u === s) (!i || i <= l) && (r && t && r(null), a && t && a.push(null)), 0 < o.length && o.push(s), l++, 0; else { if (u.children) for (var c = 0; c < u.children.length; c++) u.children[c] && o.push(u.children[c]); var d = this.getFaceIndexFromNode(u); (!i || i <= l) && (r && r(u, l, d), a && a.push(u)), 0 } } } }, { key: "getFaceIndexFromNode", value: function(e) { if (!e) return -1; for (var t = 1, n = e, i = 0, r = 0; ; ) { var a = n.parent; if (!a) break; for (var o = -1, s = 0; s < a.children.length; s++) a.children[s] === n && (o = s); i = o % 2 * t + i, r = Math.floor(o / 2) * t + r; t *= 2, n = a } return r * t + i } }, { key: "depthFirst", value: function(e, t, n) { !function e(t, n, i, r, a, o, s, l) { if (t) { var u = 2 * r + i; if ((s = s || A0.TraversalType.PreOrder) === A0.TraversalType.PreOrder && (a && a(t, n, u, i, r), o && o.push(t)), t.children && 0 !== t.children.length) { for (var c = 2 * r, d = 2 * i, h = 0; h < 2; h++) for (var p = 0; p < 2; p++) e(t.children[2 * p + h], n + 1, d + h, c + p, a, o, s, l); s === A0.TraversalType.PostOrder && (a && a(t, n, u, i, r), o && o.push(t)) } } }(this.root, 0, 0, 0, e, t, n, this.tileSize) } }]), i }(); A0.TraversalType = Object.freeze({ PreOrder: 0, PostOrder: 1 }), A0.getLevelCountForSize = function(e, t) { var n = 0; for (t < e && (t = e); !((t /= 2) < e); ) n++; return n } ; var T0, S0, C0, P0, D0, k0, B0, L0, R0, F0, I0, O0, z0, N0, U0, G0, H0, V0, j0, W0, X0, q0, J0 = !(A0.getSizeForLevel = function(e, t) { return Math.pow(2, t) * e } ), Y0 = T.tiling.uploadIntervalDelay, Z0 = T.tiling.initialIntervalDelay, Q0 = T.tiling.maxNonBaseUploadsPerFrame, K0 = T.tiling.maxBaseUploadsPerFrame, $0 = 0, ey = 1, ty = function() { y(a, hn); var r = w(a); function a(e, t, n) { var i; return O(this, a), (i = r.call(this)).tileDirectory = {}, i.activeRenderTargetDescriptors = {}, i.activePanos = [], i.panoLODDescriptors = {}, i.panoDescriptors = {}, i.tileTrees = {}, i.forceQueue = [], i.uploadQueues = {}, i.uploadInterval = null, i.uploadIntervalCancelled = !1, i.usingTileOverlay = !1, i.overlayTilesLoaded = !1, i.overlayTileBase = null, i.overlayTilesBasic = {}, i.overlayTilesEnhanced = {}, i.zoomRenderTarget = null, i.zoomPano = null, i.zoomingActive = !1, i.zoomPanoId = null, i.zoomPanoRenderingDisabled = !1, i.direction = [], i.maxBaseUploadsPerFrame = K0, i.maxNonBaseUploadsPerFrame = Q0, i.M = [], i.viewer = e, i.tileDownloader = t, i.qualityManager = n, i.initTime = performance.now(), i.bindEvents(), i } return h(a, [{ key: "getActivePanoTextures", value: function(e) { e = e || []; for (var t = 0; t < M.length; t++) { var n = M[t]; n.renderTarget && n.renderTarget.texture && e.push(n.renderTarget.texture) } } }, { key: "hasQueuedTiles", value: function() { var e = this.peekNextFromUploadQueue(); return null != e } }, { key: "getActiveRenderTargetDescriptor", value: function(e) { return this.activeRenderTargetDescriptors[e] } }, { key: "setActiveRenderTargetDescriptor", value: function(e, t) { this.activeRenderTargetDescriptors[e] = t } }, { key: "bindEvents", value: function() { this.tileDownloader.addEventListener(hm.TileDownloadSuccess, this.onTileDownloaded.bind(this)) } }, { key: "enableUltraHighQualityMode", value: function(t) { if ("2k" == T.tileClass || "1k" == T.tileClass) return this.enableHighQuality(t); var e; this.qualityManager.ultraHighQualityModeEnabled() || (e = this.qualityManager.getPanoSize(cm.ULTRAHIGH), this.tileDownloader.testDownload(e, Gg.TILE_SIZE, function(e) { e && (this.qualityManager.enableUltraHighQualityMode(), this.setupZoomRenderTarget(), t()) } .bind(this))) } }, { key: "activateTiledPano", value: function(e, t, n) { n && this.clearAllQueuedUploads(); for (var i = 0; i < Gg.FACES_PER_PANO; i++) this.initTileTree(e.id, i, this.qualityManager.getMaxPossiblePanoSize()); this.linkAllTilesAndNodes(e); var r = this.getActiveRenderTargetDescriptor(e.id) , t = t; return t > this.qualityManager.getMaxNavPanoSize() && (t = this.qualityManager.getMaxNavPanoSize()), r && t === r.size || (r && this.deactiveDescripor(r.renderTarget), (r = this.activeDescripor(t)) || (t = this.initTiledPano(t, !1), (r = this.initDescriptor(t.width)).renderTarget = t), r.pano = e, this.resetPanoDescriptor(e.id), this.resetPanoLODDescriptors(e.id), this.resetRenderStatus(e.id, !0, !0)), this.setActiveRenderTargetDescriptor(e.id, r), this.updateActivePanos(e, n ? 0 : 1), r.renderTarget } }, { key: "deactivateTiledPano", value: function(e) { var t = this.getActiveRenderTargetDescriptor(e.id); this.isRenderTargetDescriptorValid(t) && (this.deactiveDescripor(t.renderTarget), this.setActiveRenderTargetDescriptor(e.id, null)); e = this.getUploadQueueForPano(e.id); this.clearUploadQueue(e), this.updateActivePanos() } }, { key: "getActivePanoCount", value: function() { return this.activePanos.length } }, { key: "resetRenderStatus", value: function(e, r, a, t) { var n = null; t && (n = A0.getLevelCountForSize(Gg.TILE_SIZE, t) + 1); for (var i = function(e, t, n, i) { a && (t.tile.zoomUploaded = !1), r && (t.tile.uploaded = !1) }, o = 0; o < Gg.FACES_PER_PANO; o++) this.getTileTree(e, o).breadthFirst({ callback: i.bind(this, o), minLevel: n }) } }, { key: "copyBaseRenderStatusToZoomed", value: function(e) { for (var t = A0.getLevelCountForSize(Gg.TILE_SIZE, this.qualityManager.getMaxNavPanoSize()), n = function(e, t, n, i) { t.tile.zoomUploaded = t.tile.uploaded, t.zoomCovered = t.covered }, i = 0; i < Gg.FACES_PER_PANO; i++) this.getTileTree(e, i).breadthFirst({ callback: n.bind(this, i), maxLevel: t }) } }, { key: "isRenderTargetDescriptorValid", value: function(e) { return e && e.renderTarget } }, { key: "isPanoActive", value: function(e) { e = this.getActiveRenderTargetDescriptor(e); return this.isRenderTargetDescriptorValid(e) } }, { key: "isPanoZoomed", value: function(e) { return this.zoomingActive && this.zoomPanoId === e } }, { key: "initTileTree", value: function(e, t, n) { var i = this.tileTrees[e]; i || (this.tileTrees[e] = i = []); var e = i[t]; e || (n = A0.getLevelCountForSize(Gg.TILE_SIZE, n), e = new A0(Gg.TILE_SIZE,n), i[t] = e) } }, { key: "getTileTree", value: function(e, t) { e = this.tileTrees[e]; e || console.error("PanoRenderer.getTileTree() -> Tree array not yet initialized!"); t = e[t]; return t || console.error("PanoRenderer.getTileTree() -> Tree not yet initialized!"), t } }, { key: "initTiledPano", value: function(e, t) { var n = this.viewer.renderer , i = new na(e,{ stencilBuffer: !1 }) , e = new ta([]); e.image = [null, null, null, null, null, null], e.flipY = !0, e.format = et, t ? (e.generateMipmaps = !0, e.magFilter = Oe, e.minFilter = G) : (e.generateMipmaps = !1, e.magFilter = Oe, e.minFilter = Oe), n.setRenderTarget(i), n.setRenderTarget(null); e = n.properties.get(e); return e.__image__webglTextureCube = e.__webglTexture, i } }, { key: "getUploadQueueForPano", value: function(e) { var t = this.uploadQueues[e]; return t || (this.uploadQueues[e] = t = []), t } }, { key: "isTileUploaded", value: function(e) { return this.isPanoZoomed(e.panoId) ? e.zoomUploaded : e.uploaded } }, { key: "setUploaded", value: function(e, t) { this.isPanoZoomed(e.panoId) ? e.zoomUploaded = t : e.uploaded = t } }, { key: "queueTileUpload", value: function(e, t, n) { var i, r = this.getActiveRenderTargetDescriptor(e.panoId); !this.isRenderTargetDescriptorValid(r) || !e.downloaded || this.isTileUploaded(e) || e.uploadQueued && !n || e.panoSize > this.qualityManager.getMaxNavPanoSize() && !this.zoomingActive || (i = this.getUploadQueueForPano(e.panoId), n ? this.uploadTile(e, !1) : (this.shoulPushToFrontOfQueue(e) ? this.forceQueue.push(e) : t && this.direction ? u0.insertSortedPanoTile(i, e, r.pano, this.direction) : i.push(e), e.uploadQueued = !0, this.uploadInterval || this.uploadIntervalCancelled || this.refreshUploadInterval(0))) } }, { key: "shoulPushToFrontOfQueue", value: function(e) { return 0 === A0.getLevelCountForSize(Gg.TILE_SIZE, e.panoSize) } }, { key: "getTopUploadQueue", value: function() { for (var e, t, n = $0; n <= ey; n++) for (var i = 0; i < this.activePanos.length; i++) if (e = this.activePanos[i], 0 < (t = this.getUploadQueueForPano(e.id)).length) switch (n) { case $0: if (0 === t[0].level) return t; break; case ey: return t } return null } }, { key: "peekNextFromUploadQueue", value: function() { if (0 < this.forceQueue.length) return this.forceQueue[0]; var e = this.getTopUploadQueue(); return e && 0 < e.length ? e[0] : null } }, { key: "clearAllQueuedUploads", value: function() { this.clearAllUploadQueues(null, 0) } }, { key: "clearAllQueuedUploadsForPano", value: function(e) { this.clearAllUploadQueues(e, 0) } }, { key: "clearAllUploadQueues", value: function(e, t) { if (e) this.clearUploadQueue(this.getUploadQueueForPano(e), t), this.clearUploadQueue(this.forceQueue, t, e); else { for (var n = 0; n < this.activePanos.length; n++) { var i = this.activePanos[n]; this.clearUploadQueue(this.getUploadQueueForPano(i.id), t) } this.clearUploadQueue(this.forceQueue, t) } } }, { key: "clearUploadQueue", value: function(e, t, n) { null != t || (t = 0); for (var i = 0; i < e.length; ) { var r = e[i]; (!n || n === r.tile.panoId) && r.level >= t ? (r.uploadQueued = !1, e.splice(i, 1)) : i++ } } }, { key: "updateUploadQueue", value: function(e, t) { e = e || 1; for (var n = 0, i = 0; ; ) { this.forceQueue.slice(0); if (t <= i || e <= n) break; var r, a = this.getNextFromUploadQueue(); if (!a) break; 0 !== a.level ? n++ : i++, a.panoSize > this.qualityManager.getMaxNavPanoSize() && !this.zoomingActive || (r = this.getActiveRenderTargetDescriptor(a.panoId), this.isRenderTargetDescriptorValid(r) && this.uploadTile(a, a.forceUpload)) } } }, { key: "updateDirection", value: function(e) { if (e = e || this.direction) { this.direction = e; for (var t = 0; t < this.activePanos.length; t++) { var n = this.activePanos[t] , i = this.getUploadQueueForPano(n.id); u0.sortPanoTiles(i, n, this.direction) } } } }, { key: "anyUploaded", value: function(e) { if (!e) return !1; if (e.tile && this.isTileUploaded(e.tile)) return !0; if (e.children) for (var t = 0; t < e.children.length; t++) { var n = e.children[t]; if (this.anyUploaded(n)) return !0 } return !1 } }, { key: "setNodeCovered", value: function(e, t) { this.isPanoZoomed(e.tile.panoId) ? e.zoomCovered = t : e.covered = t } }, { key: "isNodeCovered", value: function(e) { return !!e && (this.isPanoZoomed(e.tile.panoId) ? e.zoomCovered : e.covered) } }, { key: "addCoverageForNode", value: function(e) { this.setNodeCovered(e, !0), e.parent && e.covered && (e = e.parent, this.nodeSubcovered(e) && this.addCoverageForNode(e, !0)) } }, { key: "calcFullCoverage", value: function(e) { var t = !1; if (e.children) for (var n = 0; n < e.children.length; n++) var i = e.children[n] , t = t || this.calcFullCoverage(i); e.covered = e.tile.uploaded || t } }, { key: "nodeSubcovered", value: function(e) { if (!e.children) return !1; for (var t = 0; t < e.children.length; t++) if (!e.children[t] || !this.isNodeCovered(e.children[t])) return !1; return !0 } }, { key: "resetPanoDescriptor", value: function(e) { this.getPanoDescriptor(e) } }, { key: "getPanoDescriptor", value: function(e) { var t = this.panoDescriptors[e]; return t || (this.panoDescriptors[e] = t = {}), t } }, { key: "resetPanoLODDescriptors", value: function(e) { var t, n, i = this.getPanoLODDescriptors(e); for (t in i) i.hasOwnProperty(t) && ((n = i[t]).uploadCount = 0, n.uploadAttempts = 0, n.uploaded = []) } }, { key: "getPanoLODDescriptor", value: function(e, t) { var n = this.getPanoLODDescriptors(e) , e = n[t]; return e || (n[t] = e = { uploadCount: 0, uploadAttempts: 0, uploaded: [] }), e } }, { key: "getPanoLODDescriptors", value: function(e) { var t = this.panoLODDescriptors[e]; return t || (this.panoLODDescriptors[e] = t = {}), t } }, { key: "onTileDownloaded", value: function(e) { var t = e.desc , e = A0.getLevelCountForSize(Gg.TILE_SIZE, t.panoSize) , e = this.getTileDirectoryEntry(t.panoId, t.face, e, t.faceTileIndex); e.downloaded = !0, e.image = t.image, e.panoSize = t.panoSize, e.tileX = t.tileX, e.tileY = t.tileY, e.totalTiles = t.totalTiles, e.tileIndex = t.tileIndex, e.faceTileIndex = t.faceTileIndex, e.face = t.face, e.cubeFace = Gg.mapFaceToCubemapFace(t.face), e.panoId = t.panoId, e.tileSize = t.tileSize, e.direction = (new Cn).copy(t.direction), e.node = null, e.level = A0.getLevelCountForSize(Gg.TILE_SIZE, e.panoSize), this.isPanoActive(e.panoId) && (t = this.getTileTree(e.panoId, e.face).getSubNode(e.panoSize, e.tileX, e.tileY), this.linkTileAndNode(e, t), this.queueTileUpload(e, !0)) } }, { key: "getTileDirectoryEntry", value: function(e, t, n, i) { var r = this.tileDirectory[e]; r || (this.tileDirectory[e] = r = {}); var a = 16384 * t + 1024 * n + i , o = r[a]; return o || (r[a] = o = { downloaded: !1, uploaded: !1, zoomUploaded: !1 }), o._key = e + ":" + t + ":" + n + ":" + i, o._tileKey = a, o } }, { key: "setZoomingActive", value: function(e, t, n) { this.zoomPanoRenderingDisabled || e === this.zoomingActive && this.zoomPanoId === t.id || (this.zoomingActive = e, this.zoomPanoId = t.id, this.zoomingActive && (this.zoomPanoId !== t.id || n) && this.updateZoomedPanoFromBase(t)) } }, { key: "updateZoomedPanoFromBase", value: function(e) { var t, n, i; this.zoomPanoRenderingDisabled || !this.zoomRenderTarget || (i = this.getActiveRenderTargetDescriptor(e.id)) && i.renderTarget && (t = Math.min(this.qualityManager.maxRenderTargetSize, this.qualityManager.getMaxZoomPanoSize()), n = i.renderTarget, i = i.size, this.copyCubeMap(n.texture, this.zoomRenderTarget, i, i, t, t), this.copyBaseRenderStatusToZoomed(e.id)) } }, { key: "add", value: function(e) { this.M.push(e) } }, { key: "initDescriptor", value: function(e) { var t = { renderTarget: null, inUse: !1, size: -1, pano: null }; return t.inUse = !0, t.size = e, this.add(t), t } }, { key: "activeDescripor", value: function(e) { for (var t = 0; t < this.M.length; t++) { var n = this.M[t]; if (!n.inUse && n.size === e) return n.inUse = !0, n } return null } }, { key: "deactiveDescripor", value: function(e) { for (var t = 0; t < this.M.length; t++) { var n = this.M[t]; if (n.renderTarget === e) return !(n.inUse = !1) } return !1 } }, { key: "enableHighQuality", value: function(e) { this.qualityManager.highQualityModeStarted || (this.setupZoomRenderTarget(), e(), this.qualityManager.highQualityModeStarted = !0) } }, { key: "linkTileAndNode", value: function(e, t) { (t.tile = e).node = t } }, { key: "linkAllTilesAndNodes", value: function(a) { for (var e = function(e, t, n, i, r) { r = this.getTileDirectoryEntry(a.id, t, i, r); this.linkTileAndNode(r, n) }, t = 0; t < Gg.FACES_PER_PANO; t++) { var n = this.getTileTree(a.id, t); n.breadthFirst({ callback: e.bind(this, n, t) }) } } }, { key: "initSizedTexture2D", value: function(e, t, n) { var i = this.viewer.renderer , r = i.getContext() , a = i.state , o = new En(null); o.flipY = !1, o.generateMipmaps = n = !0 !== n ? !1 : n; var s = i.paramThreeToGL(o.format) , l = i.paramThreeToGL(o.type) , u = i.properties.get(o) , c = r.createTexture(); a.bindTexture(r.TEXTURE_2D, c), r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL, o.flipY), r.texImage2D(r.TEXTURE_2D, 0, s, e, e, 0, s, l, null), o.wrapS = t, o.wrapT = t; t = i.paramThreeToGL(t); return r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, t), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, t), n ? (o.magFilter = Oe, o.minFilter = G, r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, r.LINEAR), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, r.LINEAR_MIPMAP_NEAREST), r.generateMipmap(r.TEXTURE_2D)) : (o.magFilter = Oe, o.minFilter = Oe, r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, r.LINEAR), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, r.LINEAR)), a.bindTexture(r.TEXTURE_2D, null), u.__webglTexture = c, o } }, { key: "deallocateCubeTexture", value: function(e) { var t = this.viewer.renderer , n = t.getContext() , e = t.properties.get(e); n.deleteTexture(e.__image__webglTextureCube) } }, { key: "uploadTexture2D", value: function(e, t, n, i, r, a) { var o = this.viewer.renderer , s = o.getContext() , l = o.state , u = o.properties.get(t); l.bindTexture(s.TEXTURE_2D, u.__webglTexture), s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL, t.flipY), s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL, t.premultiplyAlpha), s.pixelStorei(s.UNPACK_ALIGNMENT, t.unpackAlignment), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_S, o.paramThreeToGL(t.wrapS)), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_T, o.paramThreeToGL(t.wrapT)), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MAG_FILTER, o.paramThreeToGL(t.magFilter)), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MIN_FILTER, o.paramThreeToGL(t.minFilter)), s.texSubImage2D(s.TEXTURE_2D, 0, n, i, s.RGBA, s.UNSIGNED_BYTE, e), t.generateMipmaps && s.generateMipmap(s.TEXTURE_2D), l.bindTexture(s.TEXTURE_2D, null) } }, { key: "getCubeOrientationForCubeFace", value: function(e, t) { switch (e) { case um.GL_TEXTURE_CUBE_MAP_POSITIVE_X: t.set(0, -Math.PI / 2, 0); break; case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_X: t.set(0, Math.PI / 2, 0); break; case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Y: t.set(Math.PI / 2, Math.PI, 0); break; case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: t.set(-Math.PI / 2, Math.PI, 0); break; case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Z: t.set(0, -Math.PI, 0); break; case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: t.set(0, 0, 0) } } }]), a }(); function ny(e) { return (e = e.shift()).uploadQueued = !1, e } ty.prototype.setupZoomRenderTarget = (T0 = {}, function() { var e, t, n; "2k" == this.qualityManager.maxRenderTargetSize && "2k" == this.qualityManager.getMaxNavPanoSize() || (this.qualityManager.getMaxZoomPanoSize() >= this.qualityManager.getMaxNavPanoSize() ? this.zoomRenderTarget && this.zoomRenderTarget.width === this.qualityManager.getMaxZoomPanoSize() || (e = this.zoomRenderTarget, (n = this.qualityManager.getMaxZoomPanoSize()) > this.qualityManager.maxRenderTargetSize || (T0[n] ? this.zoomRenderTarget = T0[n] : (this.zoomRenderTarget = this.initTiledPano(n, !1), T0[n] = this.zoomRenderTarget), e && (t = e.width, n = this.zoomRenderTarget.width, this.copyCubeMap(e.texture, this.zoomRenderTarget, t, t, n, n), e.texture.dispose(), e.texture.loaded = !1, e.texture.version = 0, this.deallocateCubeTexture(e.texture), e.texture = null), this.zoomPanoRenderingDisabled = !1)) : this.zoomPanoRenderingDisabled = !0) } ), ty.prototype.updateActivePanos = (S0 = [], function(e, t) { for (var n = S0.length = 0; n < this.activePanos.length; n++) { e && S0.length === t && S0.push(e); var i = this.activePanos[n] , r = this.getActiveRenderTargetDescriptor(i.id); e && i.id === e.id || !this.isRenderTargetDescriptorValid(r) || S0.push(i) } e && t >= S0.length && S0.push(e), this.activePanos.length = 0, this.activePanos.push.apply(this.activePanos, S0) } ), ty.prototype.renderPanoTiles = (C0 = [], function(e, t, n, i) { this.zoomRenderTarget && this.zoomRenderTarget.width === this.qualityManager.getMaxZoomPanoSize() || this.zoomPanoRenderingDisabled || this.setupZoomRenderTarget(), t = t || this.direction || pm.FORWARD; var r = this.getActiveRenderTargetDescriptor(e); this.isRenderTargetDescriptorValid(r) || console.error("PanoRenderer.renderPanoTiles() -> Cannot render to a pano that is not activated."); for (var a = 0; a < Gg.FACES_PER_PANO; a++) { var o = this.getTileTree(e, a); C0.length = 0, o.breadthFirst({ saveVisited: C0 }); for (var s = 0; s < C0.length; s++) { var l = C0[s]; this.queueTileUpload(l.tile, !1, i || 0 === s && n) } } this.updateDirection(t) } ), ty.prototype.getNextFromUploadQueue = function() { if (0 < this.forceQueue.length) return ny(this.forceQueue); var e = this.getTopUploadQueue(); return e && 0 < e.length ? ny(e) : null } , ty.prototype.refreshUploadInterval = (P0 = null, function(e) { this.uploadIntervalCancelled || (P0 = P0 || function() { this.uploadIntervalCancelled || (this.overlayTilesLoaded || !this.usingTileOverlay ? (J0 = !0, this.updateUploadQueue(this.maxNonBaseUploadsPerFrame, this.maxBaseUploadsPerFrame), this.peekNextFromUploadQueue() ? this.refreshUploadInterval(Y0) : this.uploadInterval = null) : this.refreshUploadInterval(this.uploadIntervalDelay)) } .bind(this), null != e || (e = Y0), J0 || (e = Z0), this.uploadInterval = window.setTimeout(P0, e), this.uploadIntervalDelay = e) } ), ty.prototype.update = (D0 = performance.now(), k0 = 0, function() { this.uploadIntervalCancelled = !0, window.clearTimeout(this.uploadInterval), this.uploadInterval = null; var e = performance.now() - D0; !(Y0 < e || 0 === k0) || !this.overlayTilesLoaded && this.usingTileOverlay || (this.updateUploadQueue(this.maxNonBaseUploadsPerFrame, this.maxBaseUploadsPerFrame), D0 = performance.now()), k0++ } ), ty.prototype.uploadTile = (B0 = {}, L0 = T.tiling.overlayStyle, R0 = {}, function(e, t) { var n = this , i = e.panoId , r = e.image , a = e.tileSize , o = e.panoSize , s = e.tileIndex , l = e.totalTiles , u = e.tileX , c = e.tileY , d = !0 , h = !1 , p = !1 , f = (this.getPanoDescriptor(i), this.getPanoLODDescriptor(i, o)) , m = this.getActiveRenderTargetDescriptor(i) , v = m.renderTarget , g = m.size; this.isPanoZoomed(i) && this.zoomRenderTarget && (v = this.zoomRenderTarget, g = this.zoomRenderTarget.width); function y() { f.uploaded.includes(s) || (f.uploaded.push(s), f.uploadCount++), n.dispatchEvent({ type: dm.TileRenderSuccess, id: i, panoSize: o, tileIndex: s, totalTiles: l }), f.uploadCount === l && n.dispatchEvent({ type: dm.PanoRenderComplete, id: i, panoSize: o, totalTiles: l, updateFullComplete: !0 }), n.setUploaded(e, !0), n.addCoverageForNode(e.node) } var w, b; return this.isRenderTargetDescriptorValid(m) || (h = d = !1), t || (this.anyUploaded(e.node) && (p = h = !(d = !1)), this.isTileUploaded(e) && (p = !(h = d = !1))), d ? (t = a / o * g, d = u * a / o * g, g = c * a / o * g, B0[a] || (B0[a] = this.initSizedTexture2D(a, Be)), o > this.qualityManager.maxRenderTargetSize ? (b = this.initSizedTexture2D(a, Be), w = this.viewer.images360.isHighMapLoaded(e.cubeFace, u, c)) : b = B0[a], this.uploadTexture2D(r, b, 0, 0, a, a), o > this.qualityManager.maxRenderTargetSize ? w || this.viewer.images360.updateHighMap(b, e.cubeFace, u, c) : 1 === L0 || 2 === L0 ? (c = 1 === L0 ? this.overlayTilesBasic : this.overlayTilesEnhanced, this.renderToCubeMap(b, v, a, a, 0, 0, a, a, d, g, t, t, e.cubeFace), this.renderToCubeMap(c[o], v, a, a, 0, 0, a, a, d, g, t, t, e.cubeFace, K, !0, .5)) : this.renderToCubeMap(b, v, a, a, 0, 0, a, a, d, g, t, t, e.cubeFace), y()) : p ? y() : (R0[i + ":" + o + ":" + s] = !0, this.setUploaded(e, !1)), e.uploadAttempted || (f.uploadAttempts++, this.dispatchEvent({ type: dm.TileUploadAttempted, id: i, panoSize: o, tileIndex: s, totalTiles: l })), e.uploadAttempted = !0, f.uploadAttempts === l && this.dispatchEvent({ type: dm.UploadAttemptedForAllTiles, id: i, panoSize: o, totalTiles: l }), h } ), ty.prototype.renderToCubeMap = (F0 = !1, U0 = N0 = z0 = O0 = I0 = null, function(e, t, n, i, r, a, o, s, l, u, c, d, h, p, f, m) { var v = this.viewer.renderer; F0 || ((O0 = new ed(-.5,.5,.5,-.5,-200,200)).position.z = 150, (I0 = new gs).add(O0), z0 = new Qr({ uniforms: { tDiffuse: { type: "scene", value: null }, alpha: { type: "startYinTile", value: 1 } }, vertexShader: Hp["basicTextured.vs"], fragmentShader: Hp["basicTextured.fs"], depthWrite: !1, depthTest: !1, side: Y }), N0 = new ua(1,1), (U0 = new Hr(N0,z0)).position.z = 0, I0.add(U0), F0 = !0); var g = N0.getAttribute("uv"); g.setDynamic(!0), g.needsUpdate = !0; g = g.array, r /= n, a /= i, n = o / n, i = s / i; g[0] = r, g[1] = a + i, g[2] = r + n, g[3] = a + i, g[4] = r, g[5] = a, g[6] = r + n, g[7] = a; a = N0.getAttribute("position"); a.setDynamic(!0), a.needsUpdate = !0; a = a.array, l = l / t.width - .5, u = u / t.height - .5, c /= t.width, d /= t.height; a[0] = l, a[1] = u + d, a[3] = l + c, a[4] = u + d, a[6] = l, a[7] = u, a[9] = l + c, a[10] = u, v.properties.get(I0), z0.uniforms.tDiffuse.value = e, z0.blending = p || Z, z0.transparent = !!f, z0.uniforms.alpha.value = m = null == m ? 1 : m, z0.needUpdate = !0, t.viewport.set(0, 0, t.width, t.height); f = v.autoClear, m = v.getRenderTarget(); v.autoClear = !1, v.setRenderTarget(t, h), v.render(I0, O0), v.setRenderTarget(m), v.autoClear = f } ), ty.prototype.copyCubeMap = (H0 = !1, X0 = W0 = j0 = V0 = null, q0 = new ci, function(e, t, n, i, r, a, o, s, l) { if (!(r > this.qualityManager.maxRenderTargetSize)) { H0 || ((j0 = new ed(-1,1,1,-1,0,200)).position.set(0, 0, 0), (V0 = new gs).add(j0), W0 = new Qr({ uniforms: { tDiffuse: { type: "t", value: null }, alpha: { type: "f", value: 1 } }, vertexShader: Hp["copyCubeMap.vs"], fragmentShader: Hp["copyCubeMap.fs"], depthWrite: !1, depthTest: !1, side: Y }), G0 = new Cl(2,2,2), X0 = new Hr(G0,W0), V0.add(X0), H0 = !0); var u = this.viewer.renderer.autoClear , c = this.viewer.renderer.getRenderTarget(); this.viewer.renderer.autoClear = !1, W0.uniforms.tDiffuse.value = e, W0.blending = o || Z, W0.transparent = !!s, W0.uniforms.alpha.value = l = null == l ? 1 : l, W0.needUpdate = !0; for (var d = 0; d < 6; d++) this.getCubeOrientationForCubeFace(d, q0), X0.rotation.copy(q0), X0.matrixWorldNeedsUpdate = !0, X0.updateMatrixWorld(), t.viewport.set(0, 0, r, a), this.viewer.renderer.setRenderTarget(t, d), this.viewer.renderer.render(V0, j0); this.viewer.renderer.autoClear = u, this.viewer.renderer.setRenderTarget(c) } } ); var iy, ry, ay, oy = function() { function t() { O(this, t); var e = document.createElement("canvas"); this.canvas = e, this.context = e.getContext("2d") } return h(t, [{ key: "changeImg", value: function(e) { this.img != e && (this.canvas.width = e.width, this.canvas.height = e.height, this.context.drawImage(e, 0, 0), this.img = e) } }, { key: "getDepth", value: function(e, t) { e = Math.round(e * (this.canvas.width - 1)), t = Math.round(t * (this.canvas.height - 1)); if (!(e < 0 || t < 0 || e >= this.width || t >= this.height)) { t = this.context.getImageData(e, t, 1, 1).data; return t[1] + t[0] / 256 } } }, { key: "sample", value: function(e, t, n) { if (e) { var i = new THREE.Vector3; if ((t = t || viewer.images360.currentPano) != this.currentPano) { if (!t.depthTex) return; this.changeImg(t.depthTex.image), this.currentPano = t } var r, a = t.position, o = e.dir || (new THREE.Vector3).subVectors(e.point, a).normalize(), s = o.clone().applyMatrix4(t.panoMatrix2Inverse).normalize(), l = Up.getUVfromDir(s); if (u = this.getDepth(l.x, l.y)) return i.copy(o).multiplyScalar(u).add(a), n || (e = this.getNearbyPoint(a, l, -1, 0), s = this.getNearbyPoint(a, l, 1, 0), n = this.getNearbyPoint(a, l, 0, -1), r = this.getNearbyPoint(a, l, 0, 1), r = this.planeFit(o, i, e, s, n, r)), { location: i, normal: r, distance: u }; if (.75 < l.y) { var u = (t.floorPosition.z - a.z - .1) / o.z; return i.copy(o).multiplyScalar(u).add(a), { location: i, normal: new THREE.Vector3(0,0,1), distance: u } } return !1 } } }, { key: "getNearbyPoint", value: function(e, t, n, i) { t = t.clone(); t.x += n / (this.canvas.width - 1), t.x = this.clampUV(t.x), t.y += i / (this.canvas.height - 1), t.y = this.clampUV(t.y); i = Up.getDirFromUV(t); i.applyMatrix4(viewer.images360.currentPano.panoMatrix2); t = this.getDepth(t.x, t.y); return (new THREE.Vector3).copy(i).multiplyScalar(t).add(e) } }, { key: "clampUV", value: function(e) { return (e + 1) % 1 } }, { key: "planeFit", value: function(n, i, e, t, r, a) { var o = new THREE.Vector3 , s = new THREE.Plane; function l(e, t) { e && t && (s.setFromCoplanarPoints(i, e, t), o.addScaledVector(s.normal, n.dot(s.normal) < 0 ? 1 : -1)) } if (l(e, r), l(e, a), l(t, r), l(t, a), 0 !== o.x || 0 !== o.y || 0 !== o.z) return o.normalize(), o } }]), t }(), sy = ((new Sn).setFromAxisAngle(new Cn(0,0,1), Math.PI / 2), new sh, new _c, new $i({ side: J }), []), ly = function() { y(c, hn); var u = w(c); function c(a) { var o; O(this, c), (o = u.call(this)).viewer = a, o.selectingEnabled = !0, o.panos = [], o.neighbourMap = {}, o.node = new Si, o.node.name = "ImagesNode", o.cubePanos = [], o.cube = new Hr(new Wr(1,1,1,1),new Ug), a.updateVisible(o.cube, "showSkybox", !1), o.cube.layers.set(Potree.config.renderLayers.skybox), o.cube.name = "skyboxCube", a.scene.scene.add(o.cube), o._visible = !0, o.currentPano = null, o.mouseLastMoveTime = Date.now(), o.scrollZoomSpeed = .06, o.zoomLevel = 1, o.tileDownloader = new b0, o.qualityManager = new Kg, o.panoRenderer = new ty(a,o.tileDownloader,o.qualityManager), o.basePanoSize = o.qualityManager.getPanoSize(cm.BASE), o.standardPanoSize = o.qualityManager.getPanoSize(cm.STANDARD), o.highPanoSize = o.qualityManager.getPanoSize(cm.HIGH), o.ultraHighPanoSize = o.qualityManager.getPanoSize(cm.ULTRAHIGH), o.tileDownloader.processPriorityQueue = !1, o.tileDownloader.tilePrioritizer = new u0(o.qualityManager,o.basePanoSize,o.standardPanoSize,o.highPanoSize,o.ultraHighPanoSize), o.flying_ = !1, o.addHighMapCube(), a.addEventListener(gm.Enter, function(e) { o.setHighMap(e.newPano) }), a.addEventListener("panoSetZoom", function(e) { "showPanos" == Potree.settings.displayMode && (e.zoomed ? o.showHighMap() : o.hideHighMap()) }), o.depthSampler = new oy, o.addEventListener("loadedDepthImg", function(e) { e.loaded && o.updateDepthTex(e.pano) }); a.fpControls.addEventListener("dollyStopCauseUnable", function(e) { var t; Potree.settings.zoom.enabled && (null != e.scale ? o.zoomBy(e.scale, e.pointer) : (t = 0 < e.delta ? 1 + o.scrollZoomSpeed : 1 - o.scrollZoomSpeed, 0 != e.delta && o.zoomBy(t))) }); var n, e; a.addEventListener("global_click", function(e) { if (!(e.clickElement || Potree.settings.unableNavigate || o.flying || !e.isTouch && e.button != C.LEFT || e.drag && e.drag.object || "pano" == Potree.settings.editType && "mainView" != a.modules.PanoEditor.activeViewName || "merge" == Potree.settings.editType && !e.intersectPoint || a.inputHandler.hoveredElements[0] && a.inputHandler.hoveredElements[0].isModel && e.intersectPoint.distance > a.inputHandler.hoveredElements[0].distance)) { if ("pano" != Potree.settings.editType && "merge" != Potree.settings.editType) { if (e.hoverViewport == a.mapViewer.viewports[0]) return a.mapViewer.dispatchEvent(e); if (e.hoverViewport != a.mainViewport) return } Potree.settings.dblToFocusPoint || o.flyToPanoClosestToMouse() } }), a.addEventListener("global_mousemove", function(e) { !Potree.settings.unableNavigate && Potree.settings.ifShowMarker && e.hoverViewport == a.mainViewport && o.updateClosestPano(e.intersect/* Point */) }), o.addEventListener("markerHover", function(e) { o.updateClosestPano(e.pano, e.hovered) }), Potree.settings.isOfficial || (o.domRoot = a.renderer.domElement.parentElement, (e = $("")).css({ position: "absolute", right: "25%", bottom: "20px", zIndex: "10000", fontSize: "1em", color: "black", display: "none", background: "rgba(255,255,255,0.8)" }), e.on("click", function() { return o.unfocus() }), o.elUnfocus = e, o.domRoot.appendChild(e[0]), "merge" != Potree.settings.editType && ((n = $("")).css({ position: "absolute", right: "40%", bottom: "20px", zIndex: "10000", fontSize: "1em", color: "black", width: "100px", background: "rgba(255,255,255,0.8)" }), o.domRoot.appendChild(n[0]), n.on("click", function(e) { var t = a.getObjVisiByReason(a.scene.pointclouds[0], "force"); a.scene.pointclouds.forEach(function(e) { a.updateVisible(e, "force", !t) }), n.val(t ? "显示点云" : "隐藏点云") })), (e = $("")).css({ position: "absolute", right: "65%", bottom: "20px", zIndex: "10000", fontSize: "1em", color: "black", width: "100px", background: "rgba(255,255,255,0.8)" }), o.domRoot.appendChild(e[0]), e.on("click", function(e) { "showPointCloud" == Potree.settings.displayMode && 0 == o.panos.length || (Potree.settings.displayMode = "showPointCloud" == Potree.settings.displayMode ? "showPanos" : "showPointCloud") }), o.elDisplayModel = e); var s = "" , l = ""; Object.defineProperty(Potree.settings, "displayMode", { get: function() { return s }, set: function(t) { if (l = t, console.warn("Request setMode: " + t), t != s) { var n, e = Potree.config.displayMode[t], i = a.scene.getActiveCamera(); if ("showPanos" == t && a.mainViewport.view.isFlying()) a.mainViewport.view.addEventListener("flyingDone", function e() { l == t && (Potree.settings.displayMode = t), a.mainViewport.view.removeEventListener("flyingDone", e) }); else { if (o.isAtPano()) n = o.flying ? e.transition : e.atPano; else if (n = e.atPano, "showPanos" == t) { if (0 == o.panos.length) return; var r = function e() { o.removeEventListener("flyToPanoDone", e), l == t && (Potree.settings.displayMode = t) }; return o.flyToPano({ pano: o.findNearestPano() }), void o.addEventListener("flyToPanoDone", r) } if (n.showSkybox || n.showPoint && n.pointUsePanoTex ? o.tileDownloader.start() : o.tileDownloader.stop(), n.showSkybox || n.pointUsePanoTex) { r = function e() { setTimeout(function() { l == t && (Potree.settings.displayMode = t) }, 1), o.removeEventListener("loadedDepthImg", e) } ; if (!o.currentPano.depthTex && o.currentPano.pointcloud.hasDepthTex) return o.addEventListener("loadedDepthImg", r), o.currentPano.loadDepthImg(); if (o.checkAndWaitForPanoLoad(o.currentPano, o.basePanoSize, r)) return } a.scene.pointclouds.forEach(function(e) { a.updateVisible(e, "displayMode", n.showPoint, 2) }), n.pointUsePanoTex ? a.scene.pointclouds.forEach(function(e) { e.material.setProjectedPanos(o.currentPano, o.currentPano, 1) }) : a.scene.pointclouds.forEach(function(e) { e.material.stopProjectedPanos() }), a.updateVisible(o.cube, "showSkybox", n.showSkybox), o.cube.visible ? o.setProjectedPanos({ progress: 1, ifSkybox: !0, ifPointcloud: !1, easeInOutRatio: 0, pano0: o.currentPano, pano1: o.currentPano }) : (o.smoothZoomTo(1), o.resetHighMap(), o.hideHighMap()), "showPanos" == (s = t) ? (i.far = a.farWhenShowPano, Potree.settings.pointDensity = "panorama", Potree.config.displayMode.showPanos.transition.pointUsePanoTex && a.scene.pointclouds.forEach(function(e) { e.material.pointSizeType = "FIXED" }), o.updateCube(o.currentPano)) : (i.limitFar && (i.far = Potree.settings.cameraFar), Potree.settings.pointDensity = Potree.settings.UserPointDensity, Potree.config.displayMode.showPanos.transition.pointUsePanoTex && a.scene.pointclouds.forEach(function(e) { e.material.pointSizeType = Potree.config.material.pointSizeType })), i.updateProjectionMatrix(), o.elDisplayModel && o.elDisplayModel.val("showPointCloud" == t ? ">>全景" : ">>点云"), o.dispatchEvent({ type: "endChangeMode", mode: t }), console.log("setModeSuccess: " + t) } } } }), Potree.settings.displayMode = "showPointCloud"; var t = null; Object.defineProperty(g(o), "currentPano", { get: function() { return t }, set: function(e) { e != t && (t && t.exit(), e && e.enter(), t = e) } }); var i = !0; Object.defineProperty(Potree.settings, "ifShowMarker", { get: function() { return i }, set: function(t) { (t = !!t) != i && (o.panos.forEach(function(e) { a.updateVisible(e, "ifShowMarker", t, 1) }), i = t) } }), a.addEventListener("update", function() { o.update(a) }); var r = { FORWARD: ["W".charCodeAt(0), 38], BACKWARD: ["S".charCodeAt(0), 40], LEFT: ["A".charCodeAt(0), 37], RIGHT: ["D".charCodeAt(0), 39] }; return a.inputHandler.addEventListener("keydown", function(t) { if ("showPanos" == Potree.settings.displayMode) for (var e in r) if (r[e].some(function(e) { return e == t.keyCode })) { switch (e) { case "FORWARD": o.flyLocalDirection(pm.FORWARD.clone()); break; case "BACKWARD": o.flyLocalDirection(pm.BACK.clone()); break; case "LEFT": o.flyLocalDirection(pm.LEFT.clone()); break; case "RIGHT": o.flyLocalDirection(pm.RIGHT.clone()) } break } }), o } return h(c, [{ key: "updateDepthTex", value: function(e) { this.currentPano == e && e.depthTex && this.cube.material.updateDepthTex(e) } }, { key: "findNearestPano", value: function(t) { t = t ? (new Cn).copy(t) : this.position; var e = Fm.sortByScore(this.panos, [c.filters.isEnabled()], [function(e) { return -e.position.distanceTo(t) } ]); return e && e[0] && e[0].item } }, { key: "flyLocalDirection", value: function(e) { var t = this.getDirection(e) , n = 1 === e.y ? .4 : .75 , e = 1 === Math.abs(e.x); return this.flyDirection(t, n, e) } }, { key: "getDirection", value: function(e) { return e ? (e = e || (new Cn).copy(pm.FORWARD)).applyQuaternion(viewer.scene.getActiveCamera().quaternion) : viewer.scene.view.direction } }, { key: "position", get: function() { return this.viewer.scene.view.position.clone() } }, { key: "visible", get: function() { return this._visible }, set: function(e) { this._visible !== e && (this._visible = e, this.dispatchEvent({ type: "visibility_changed", panos: this })) } }, { key: "isAtPano", value: function() { return this.currentPano && viewer.scene.view.position.equals(this.currentPano.position) } }, { key: "updateProjectedPanos", value: function() { this.projectedPano0 && this.projectedPano1 && this.setProjectedPanos({ pano0: this.projectedPano0, pano1: this.projectedPano1 }) } }, { key: "setProjectedPanos", value: function() { var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; this.cube.material.setProjectedPanos(t.pano0, t.pano1, t.progress), t.ifPointcloud && viewer.scene.pointclouds.forEach(function(e) { e.material.setProjectedPanos(t.pano0, t.pano1, t.progress, t.easeInOutRatio) }), this.projectedPano0 = t.pano0, this.projectedPano1 = t.pano1 } }, { key: "cancelFlyToPano", value: function() { viewer.mainViewport.view.isFlying() || (this.nextPano = null, this.latestToPano = null) } }, { key: "flyToPano", value: function(n) { var i = this; if (n && (n = n instanceof Qg ? { pano: n } : n).pano.enabled) { var e = function(e, t) { e || t ? (n.callback && n.callback(e), i.cancelFlyToPano(), i.updateClosestPano(i.closestPano, !1)) : console.log("makeit fail"), i.dispatchEvent({ type: "flyToPanoDone", makeIt: e }), n.deferred && n.deferred.resolve(e) }; if (this.currentPano == n.pano && this.isAtPano() && !n.target && !n.quaternion) return this.dispatchEvent({ type: "flyToPano", toPano: n }), e(!0); if (this.latestToPano && this.latestToPano != n) return e(!1); var t = n.target , r = n.easeName || "easeInOutQuad" , a = Potree.config.displayMode[Potree.settings.displayMode] , o = a.atPano.showPoint , s = n.pano , l = Potree.config.transitionsTime , u = this.isAtPano() ? l.panoToPanoMax : l.flyIn , c = null == n.duration ? l.flyMinTime + Math.min(l.flytimeDistanceMultiplier * this.position.distanceTo(s.position), u) : n.duration; n.duration = c, this.nextPano = s, this.latestToPano = n; var d, u = function e() { i.latestToPano == n && (setTimeout(function() { i.latestToPano == n && i.flyToPano(n) }, 1), i.removeEventListener("loadedDepthImg", e)) }; if (!s.depthTex && s.pointcloud.hasDepthTex) return this.addEventListener("loadedDepthImg", u), s.loadDepthImg(); (a.atPano.showSkybox || a.atPano.pointUsePanoTex) && (this.updateCube(this.currentPano, n.pano), this.checkAndWaitForPanoLoad(s, n.basePanoSize || this.basePanoSize, u)) || (viewer.updateVisible(this.cube, "showSkybox", a.atPano.showSkybox), a.transition.showPoint && viewer.scene.pointclouds.forEach(function(e) { viewer.updateVisible(e, "displayMode", !0) }), (a.transition.showSkybox || a.transition.pointUsePanoTex) && this.setProjectedPanos({ progress: 0, ifSkybox: this.cube.visible, ifPointcloud: a.transition.pointUsePanoTex, easeInOutRatio: o ? .3 : 0, pano0: this.currentPano, pano1: s }), d = s.position.clone(), n.duration = c, n.easeName = r, this.beforeFlyToPano(n), u = function() { i.dispatchEvent({ type: "flyToPano", toPano: n }), viewer.scene.view.setView({ position: d, target: t, quaternion: n.quaternion, duration: c, callback: function() { a.atPano.pointUsePanoTex || viewer.scene.pointclouds.forEach(function(e) { e.material.stopProjectedPanos() }), i.currentPano = s, i.nextPano = null, "showPanos" == Potree.settings.displayMode && viewer.scene.pointclouds.forEach(function(e) { viewer.updateVisible(e, "displayMode", o) }), e(!0), i.updateDepthTex(i.currentPano) }, onUpdate: function(t) { i.cube.material.uniforms.progress.value = t, viewer.scene.pointclouds.forEach(function(e) { e.material.uniforms.progress.value = t }) }, cancelFun: function() { e(!1, !0) }, Easing: r }) } , "showPanos" == Potree.settings.displayMode ? setTimeout(u, 40) : u()) } } }, { key: "beforeFlyToPano", value: function(e) { this.currentPano != e.pano && ("showPanos" == Potree.settings.displayMode && this.resetHighMap(), this.smoothZoomTo(1, e.duration / 2)) } }, { key: "updateCube", value: function(e, t) { var n, i, r = this; if(Potree.settings.displayMode != 'showPanos')return//add if (!viewer.scene.pointclouds.some(function(e) { return !e.hasDepthTex })) return this.updateCube2(e, t); "showPanos" == Potree.settings.displayMode && (n = function(e, t) { t = t || e.getSize(new Cn); e = e.getCenter(new Cn); t.max(new Cn(1,1,1)), r.cube.scale.copy(t), r.cube.position.copy(e) } , !t || e.pointcloud == t.pointcloud ? n(e.pointcloud.bound) : (i = e.pointcloud.bound.clone().union(t.pointcloud.bound), function(e, t) { if (e.intersectsBox(t)) return 0; var n = e.getCenter(new Cn) , i = t.getCenter(new Cn) , r = n.distanceTo(i); return e.distanceToPoint(i) + t.distanceToPoint(n) - r }(e.pointcloud.bound, t.pointcloud.bound) < 100 ? n(i) : (e = i.getSize(new Cn), t = Math.max(e.x, e.y, e.z), e.set(t, t, t), n(i, e)))) } }, { key: "updateCube3", value: function(e, t) { var h, p, f, m, v, g, y, n, i, a, o, s, l, u, c, d, w, b, r, x = this; "showPanos" != Potree.settings.displayMode || e == t || this.cubePanos.includes(e) && this.cubePanos.includes(t) || (this.cubePanos = [e, t], this.cube.geometry.dispose(), t ? (h = 2 * (e.pointcloud.hasDepthTex && e.pointcloud.hasDepthTex ? A.isMobile() ? 3 : 6 : A.isMobile() ? 2 : 3), p = 0, f = function(e, t, n) { return e && e.pointcloud.hasDepthTex ? x.depthSampler.sample({ dir: t }, e, !0) : (n = n || e.position, viewer.inputHandler.getIntersect(viewer.inputHandler.hoverViewport, !0, null, null, !0, { point: n.clone().add(t), cameraPos: n })) } , m = function(e, t) { e = (new ni).makeRotationZ(e); return t.clone().applyMatrix4(e) } , v = function(i, r, a) { var e = [i.clone().setZ(Math.tan(gn.degToRad(30))).normalize(), i.clone().setZ(Math.tan(gn.degToRad(7))).normalize(), i.clone(), i.clone().setZ(-Math.tan(gn.degToRad(5))).normalize()] , t = e.length , e = e.map(function(e, t) { var n = f(r, e, a); return n && n.distance ? e.dot(i) * n.distance : 50 }); return e.sort(function(e, t) { return t - e }), e[Math.floor(t / 2 - .5)] } , r = function(i, e) { function r(e, t) { return (2 * h + 2) * (t = null == t ? p : t) + e + 2 } var t, a, o = i.floorPosition.z; null != i.ceilZ ? a = i.ceilZ : (d = (new ni).makeRotationX(gn.degToRad(40)), t = new Cn(0,0,1).applyMatrix4(d), c = (new ni).makeRotationZ(2 * Math.PI / 3), d = (new ni).makeRotationZ(2 * -Math.PI / 3), c = t.clone().applyMatrix4(c), d = t.clone().applyMatrix4(d), (c = [t, c, d].map(function(e) { e = f(i, e); return e ? e.location.z : i.position.z + 50 })).sort(function(e, t) { return t - e }), a = c[0], d = i.position.z + 1, a = Math.max(d, a), i.ceilZ = a), [a, o].forEach(function(e) { g.push(i.position.clone().setZ(e)) }); for (var n = Math.PI / (h - 1), s = [], l = 0; l < h; l++) s.push(m(Math.PI / 2 - l * n, e)); var u = []; s.forEach(function(t, e) { var n = v(t, i); 0 != e && e != h - 1 || u.push(n), t.multiplyScalar(n), [a, o].forEach(function(e) { g.push(i.position.clone().setZ(e).add(t)) }), 0 != e && (y.push([r(e = 2 * e), r(e - 1), r(e - 2)], [r(e), r(1 + e), r(e - 1)]), y.push([r(e), r(e - 2), r(-2)]), y.push([r(-1), r(e - 1), r(1 + e)])) }); var c = (p + 1) % 2 , d = 4 * h + 4; return y.push([r(0), r(1), d + 2 * p], [d + 2 * p, r(1), d + 2 * p + 1], [r(2 * h - 2), d + 2 * c + 1, r(2 * h - 1)], [r(2 * h - 2), d + 2 * c, d + 2 * c + 1]), y.push([r(0), d + 2 * c, r(2 * h - 2)], [r(0), d + 2 * p, d + 2 * c]), y.push([r(2 * h - 1), d + 2 * c + 1, r(1)], [d + 2 * c + 1, d + 2 * p + 1, r(1)]), p++, u } , g = [], y = [], n = (new Cn).subVectors(e.position, t.position).setZ(0).normalize(), i = r(e, n), r = r(t, n.negate()), c = (e.ceilZ + t.ceilZ) / 2, d = (e.floorPosition.z + t.floorPosition.z) / 2, i[0], r[1], i[1], r[0], w = [Math.min(i[0], r[1]), Math.min(i[1], r[0])], b = (new Cn).addVectors(e.position, t.position).multiplyScalar(.5), r = [m(-Math.PI / 2, n), m(Math.PI / 2, n)], e.pointcloud.hasDepthTex && e.pointcloud.hasDepthTex ? (a = [e, t], o = [n.negate(), n], s = [[-1, 1], [1, -1]], l = (new yn).subVectors(e.position, t.position).length(), u = [gn.degToRad(45), gn.degToRad(60)], r.forEach(function(t, i) { var e, r = []; a.forEach(function(n, e) { [m(s[i][e] * u[0], o[e]), m(s[i][e] * u[1], o[e])].forEach(function(e, t) { e = v(e, n); e * Math.cos(u[t]) < l && (t = e * Math.sin(u[t]), r.push(t)) }) }), r.length ? (r.sort(function(e, t) { return t - e }), e = r[0], console.log("disToSides", i, r)) : e = w[i], t.multiplyScalar(e), [c, d].forEach(function(e) { g.push(b.clone().setZ(e).add(t)) }) })) : r.forEach(function(t, e) { var n = v(t, null, b); t.multiplyScalar(Math.max(n, w[e])), [c, d].forEach(function(e) { g.push(b.clone().setZ(e).add(t)) }) }), r = Cf.createGeometry(g, y), this.cube.geometry = r, this.cube.scale.set(1, 1, 1), this.cube.position.set(0, 0, 0)) : (this.cube.geometry = new Wr(1,1,1,1), function(e, t) { t = t || e.getSize(new Cn); e = e.getCenter(new Cn); t.max(new Cn(1,1,1)), x.cube.scale.copy(t), x.cube.position.copy(e) }(e.pointcloud.bound))) } }, { key: "updateCube2", value: function(n, i) { var r = this; if (!("showPanos" != Potree.settings.displayMode || n == i || this.cubePanos.includes(n) && this.cubePanos.includes(i))) { this.cubePanos = [n, i]; var s, l, u, c, a, o, d, e = function(e, t) { t = t || e.getSize(new Cn); e = e.getCenter(new Cn); t.max(new Cn(1,1,1)), r.cube.geometry = new Wr(1,1,1,1), r.cube.scale.copy(t), r.cube.position.copy(e) }; //add---------- let getPanoBound = (pano)=>{//因漫游点可能在点云外部,如室外平地,所以需要union进漫游点 let panoBound = new THREE.Box3; panoBound.expandByPoint(pano.position); panoBound.expandByVector(new Cn(10,10,10));//give pano a margin return pano.pointcloud.bound.clone().union(panoBound) }; //------------- if (this.cube.geometry.dispose(), i) { if (n.pointcloud != i.pointcloud) if (100 < n.position.distanceTo(i.position)) { //var t = n.pointcloud.bound.clone().union(i.pointcloud.bound) var t = getPanoBound(n).union(getPanoBound(i)) , h = t.getSize(new Cn) , p = Math.max(h.x, h.y, h.z); return h.set(p, p, p), e(t, h) } var f = 2 * (n.pointcloud.hasDepthTex && n.pointcloud.hasDepthTex ? 6 : A.isMobile() ? 2 : 3) , m = function(e, t, n) { return e && e.pointcloud.hasDepthTex ? r.depthSampler.sample({ dir: t }, e, !0) : (n = n || e.position, viewer.inputHandler.getIntersect(viewer.inputHandler.hoverViewport, !0, null, null, !0, { point: n.clone().add(t), cameraPos: n })) } , v = function(e, t) { e = (new ni).makeRotationZ(e); return t.clone().applyMatrix4(e) } , g = function(i, r, a) { var e = [i.clone().setZ(Math.tan(gn.degToRad(30))).normalize(), i.clone().setZ(Math.tan(gn.degToRad(7))).normalize(), i.clone(), i.clone().setZ(-Math.tan(gn.degToRad(5))).normalize()] , t = e.length , e = e.map(function(e, t) { var n = m(r, e, a); return n && n.distance ? e.dot(i) * n.distance : 50 }); return e.sort(function(e, t) { return t - e }), e[Math.floor(t / 2 - .5)] } , y = [] , t = function(i, e) { var t, n, r, a, o = i.floorPosition.z; null != i.ceilZ ? r = i.ceilZ : (a = (new ni).makeRotationX(gn.degToRad(40)), t = new Cn(0,0,1).applyMatrix4(a), n = (new ni).makeRotationZ(2 * Math.PI / 3), a = (new ni).makeRotationZ(2 * -Math.PI / 3), n = t.clone().applyMatrix4(n), a = t.clone().applyMatrix4(a), (a = [t, n, a].map(function(e) { e = m(i, e); return e ? e.location.z : i.position.z + 50 })).sort(function(e, t) { return t - e }), r = a[0], a = i.position.z + 1, r = Math.max(a, r), i.ceilZ = r), [r, o].forEach(function(e) { w.push(i.position.clone().setZ(e)) }); for (var s = Math.PI / (f - 1), l = [], u = 0; u < f; u++) l.push(v(Math.PI / 2 - u * s, e)); l.forEach(function(t, e) { var n = g(t, i); t.multiplyScalar(n), [r, o].forEach(function(e) { w.push(i.position.clone().setZ(e).add(t)) }) }) } , w = [] , b = [] , h = (new Cn).subVectors(n.position, i.position).setZ(0).normalize(); t(n, h), t(i, h.clone().negate()), a = (n.ceilZ + i.ceilZ) / 2, o = (n.floorPosition.z + i.floorPosition.z) / 2, d = (new Cn).addVectors(n.position, i.position).multiplyScalar(.5), n.pointcloud.hasDepthTex && n.pointcloud.hasDepthTex ? (s = [n, i], l = [h.clone().negate(), h], u = (new yn).subVectors(n.position, i.position).length(), c = [gn.degToRad(40), gn.degToRad(70)], [[-1, 1], [1, -1]].forEach(function(t, e) { var a = [] , o = 0 == e ? n : i; s.forEach(function(r, e) { [v(t[e] * c[0], l[e]), v(t[e] * c[1], l[e])].forEach(function(e, t) { var n = g(e, r) , i = n * Math.cos(c[t]); i < u && (t = n * Math.sin(c[t]), r != o && (i = u - i), e.multiplyScalar(n), a.push({ disToSide: t, disToPano2d: i, pano: r, dir_: e })) }) }), y[e] = a.length, a.length && (a.sort(function(e, t) { return e.disToPano2d - t.disToPano2d }), a.forEach(function(t) { var e = t.disToPano2d / u , e = o == n ? 1 - e : e; [n.ceilZ * e + i.ceilZ * (1 - e), n.floorPosition.z * e + i.floorPosition.z * (1 - e)].forEach(function(e) { w.push(t.pano.position.clone().setZ(e).add(t.dir_)) }) })) })) : (y = [1, 1], [v(Math.PI / 2, h), v(-Math.PI / 2, h)].forEach(function(t, e) { var n = g(t, null, d); t.multiplyScalar(n), [a, o].forEach(function(e) { w.push(d.clone().setZ(e).add(t)) }) })), [a, o].forEach(function(e) { w.push(d.clone().setZ(e)) }), function() { for (var i = function(e, t, n) { return 2 + (2 * f + 2) * n + 2 * e + ("top" == t ? 0 : 1) }, e = function(e, t, n) { return 1 == n && (e += y[0]), i(e, t, 2) - 2 }, t = function(e, t) { return i(-1, e, t) }, n = w.length - 2, r = w.length - 1, a = 0; a < 2; a++) { for (var o = 1; o < f; o++) b.push([i(o, "top", a), i(o - 1, "btm", a), i(o - 1, "top", a)], [i(o, "top", a), i(o, "btm", a), i(o - 1, "btm", a)]), b.push([i(o, "top", a), i(o - 1, "top", a), t("top", a)]), b.push([i(o, "btm", a), i(o - 1, "btm", a), t("btm", a)]); for (var s = (a + 1) % 2, l = 0; l <= y[a]; l++) { var u = 0 == l ? i(0, "top", a) : e(l - 1, "top", a) , c = l == y[a] ? i(f - 1, "top", s) : e(l, "top", a) , d = 0 == l ? i(0, "btm", a) : e(l - 1, "btm", a) , h = l == y[a] ? i(f - 1, "btm", s) : e(l, "btm", a); b.push([u, d, h], [u, h, c]), b.push([u, n, c], [d, r, h]), 0 == a && (0 == l && b.push([u, i(f - 1, "top", a), n], [d, i(f - 1, "btm", a), r]), l == y[a] && b.push([c, i(0, "top", s), n], [h, i(0, "btm", s), r])) } } }(); h = Cf.createGeometry(w, b); this.cube.geometry = h, this.cube.scale.set(1, 1, 1), this.cube.position.set(0, 0, 0) } else e(getPanoBound(n))//e(n.pointcloud.bound) } } }, { key: "bump", value: function(e) { var t, n, i = this; this.bumping || this.latestToPano || (n = "showPanos" == Potree.settings.displayMode ? .3 : .2, t = this.position.clone(), n = (new Cn).addVectors(this.position, e.clone().multiplyScalar(n)), viewer.scene.view.setView({ position: n, duration: 150, callback: function() { viewer.scene.view.setView({ position: t, 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.intersectPoint), this.closestPano) { var e = this.closestPano; return this.flyToPano({ pano: e }) } e = this.viewer.inputHandler.getMouseDirection().direction; this.flyDirection(e) } }, { key: "flyDirection", value: function(e, t, n) { var i = $.Deferred() , n = this.closestPanoInDirection(e, t, n); return n ? this.flyToPano({ pano: n, callback: i.resolve.bind(i, !0) }) : (this.bump(e), i.resolve(!1)), i.promise() } }, { key: "closestPanoInDirection", value: function(e, t, n) { return this.rankedPanoInDirection(0, e, t, n) } }, { key: "rankedPanoInDirection", value: function(e, t, n, i) { var r = this , a = { pano: null, candidates: [] }; e = e || 0, n = void 0 !== n ? n : .75; var o, s, i = i ? "angle" : "direction", n = (viewer.modules.SiteModel.currentFloor, viewer.modules.SiteModel.inEntity, [c.filters.inPanoDirection(this.position, t, n), c.filters.not(this.currentPano), c.filters.isEnabled()]), t = [c.scoreFunctions.distanceSquared(this.position, 1, !0), c.scoreFunctions[i](this.position, t, !0), function(e) { return r.isNeighbour(r.currentPano, e) ? 200 : 0 } ]; return viewer.inputHandler.intersectPoint && this.currentPano && (o = this.currentPano.floorPosition, s = (new Cn).subVectors(viewer.inputHandler.intersectPoint.location, o).normalize(), t.push(function(e) { return 200 * e.floorPosition.clone().sub(o).normalize().dot(s) * 1 })), this.findRankedByScore(e, n, t, a), a.pano } }, { key: "findRankedByScore", value: function(e, t, n, i) { i && (i.candidates = null, i.pano = null), e = e || 0; n = Fm.sortByScore(this.panos, t, n); return !n || 0 === n.length || e >= n.length ? null : (i && (i.candidates = n, i.pano = n[e].item), n[e].item) } }, { key: "isNeighbour", value: function(e, t) { if (e && t) { var n = this.neighbourMap[e.id]; n || (this.neighbourMap[e.id] = n = {}); var i = this.neighbourMap[t.id]; i || (this.neighbourMap[t.id] = i = {}); var r, a, o, s, l, u = n[t.id]; return null == u && (u = !0, e.depthTex, e.depthTex || t.depthTex ? (s = e.depthTex ? e : t, a = e.depthTex ? t : e, o = (new Cn).subVectors(a.position, s.position).normalize(), (l = viewer.images360.depthSampler.sample({ dir: o }, s, !0)) && l.distance + .1 <= e.position.distanceTo(t.position) && (u = !1)) : (u = !viewer.inputHandler.ifBlockedByIntersect(t.position, .1, !0, e.position), console.log("使用点云判断"), u && (r = (new Cn).subVectors(t.position, e.position).normalize(), a = t.position.distanceTo(e.position), o = Rg.getHFOVForCamera(viewer.mainViewport.camera, !0), s = Math.cos(gn.degToRad(10)), l = Math.cos(gn.degToRad(80)), this.getDirection().dot(r) < gn.clamp(Math.cos(o / 2) * a / 10, l, s) && (u = void 0))), n[t.id] = u, i[e.id] = u), u } } }, { key: "updateClosestPano", value: function(e, t) { if (e instanceof Qg){ n = t ? e : null }else { if(this.isAtPano()){ return }else { if(this.flying)return; var filterFuncs = []; e = e && e.location; if(!e)return var e = "pano" != Potree.settings.editType ? [c.sortFunctions.floorDisSquaredToPoint(e)] : [c.sortFunctions.disSquaredToPoint(e)] , n = Fm.find(this.panos, [], e) } } /* if (this.isAtPano()) { if (!(e instanceof Qg)) return; n = t ? e : null } else { if (this.flying) return; if (!(e = e && e.location)) return; var e = "pano" != Potree.settings.editType ? [c.sortFunctions.floorDisSquaredToPoint(e)] : [c.sortFunctions.disSquaredToPoint(e)] , n = Fm.find(this.panos, [], e) } */ 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 ni).copy(e.rotateMatrix).invert() , t = n.clone().applyMatrix4(t); return { datasetId: e.dataset_id, direction: Up.convertVector.ZupToYup(t) } }), vectorForward: n } } }, { key: "update", value: function() { var e; this.viewer; this.tileDownloader.started && (e = this.getTileDirection(), this.updateTileDownloader(sy, 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 < e.length ? e : null), this.tileDownloader.processPriorityQueue = !0) } }, { key: "updatePanoRenderer", value: function(e) { var t = this.nextPano || this.currentPano; t && this.panoRenderer.hasQueuedTiles() && t && this.panoRenderer.updateDirection(e) } }, { key: "checkAndWaitForTiledPanoLoad", value: function(e, t, n, i, r, a, o, s) { e || console.error("Player.checkAndWaitForTiledPanoLoad() -> Cannot load texture for null pano."); var l = this.getTileDirection(); if (!e.isLoaded(t)) { a && viewer.waitForLoad(e, function() { return e.isLoaded(t) }); return e.loadTiledPano(t, l, null, o, s, null).done(function(e, t) { n && n(e, t) } .bind(this)).fail(function(e) { i && i(e) } .bind(this)).progress(function(e, t, n) { r && r(e, t, n) } .bind(this)), !0 } } }, { key: "fitPanoTowardPoint", value: function(t) { var i, r = t.point, a = t.target, e = t.require || [], n = t.rank || [], o = (t.force, t.getAll), s = t.bestDistance || 0, l = viewer.scene.getActiveCamera(); a && (i = (new Cn).subVectors(a, r).normalize()), t.boundSphere && (s = 1 < l.aspect ? t.boundSphere.radius / gn.degToRad(l.fov / 2) : (l = Rg.getHFOVForCamera(l, !0), t.boundSphere.radius / (l / 2))); var u = s * s; n.push(function(e) { var t = Math.abs(e.position.distanceToSquared(r) - u); if (a) { var n = e.position.distanceToSquared(a) , e = (new Cn).subVectors(a, e.position).normalize() , e = i.dot(e); return (-t - Math.pow(n, 1.5)) / (e + 2) } return -t }, function(e) { return e.depthTex && t.checkIntersect && viewer.inputHandler.ifBlockedByIntersect(a, .1, null, null, null, e) ? -1e4 : 0 }); n = Fm.sortByScore(this.panos, e, n); return o ? n : n && 0 < n.length && n[0].item } }, { key: "zoomBy", value: function(e, t) { this.zoomTo(this.zoomLevel * e, t) } }, { key: "zoomTo", value: function(e, t) { var n, i, r, a = Potree.settings.zoom; a.enabled && (e = gn.clamp(e, a.min, a.max)) != this.zoomLevel && (this.zoomLevel = e, n = viewer.scene.view, i = viewer.scene.view.direction, r = viewer.inputHandler.getMouseDirection(t).direction, viewer.setFOV(Potree.config.view.fov * (1 / this.zoomLevel)), a = viewer.inputHandler.getMouseDirection(t).direction, n.direction = r, e = n.pitch, t = n.yaw, n.direction = a, r = n.pitch, a = n.yaw, n.direction = i, viewer.scene.view.pitch -= r - e, viewer.scene.view.yaw -= a - t) } }, { key: "zoomFovTo", value: function(e) { e = this.baseFov / e; this.zoomTo(e) } }, { key: "smoothZoomTo", value: function(t) { var n = this , i = this.zoomLevel; i != t && gv.start(function(e) { n.zoomTo(i * (1 - e) + t * e, !0) }, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, null, null, 0, pv.easeInOutQuad) } }, { key: "updateZoomPano", value: function() { var e, t, n, i, r = this; this.panoRenderer.zoomPanoRenderingDisabled || "showPanos" != Potree.settings.displayMode || (e = this.currentPano) && (i = "2k" == Potree.settings.navTileClass && "4k" == Potree.settings.tileClass ? 1.7 : Potree.settings.zoom.activationThreshold, t = this.zoomLevel > i, i = !(this.flying && this.nextPano && this.nextPano !== this.currentPano), this.tileDownloader.tilePrioritizer.setZoomingActive(i = t && i), this.panoRenderer.setZoomingActive(i, e, !0), n = function(e, t) { r.panoRenderer.resetRenderStatus(e.id, !1, !0, r.qualityManager.getMaxNavPanoSize()), r.panoRenderer.clearAllQueuedUploadsForPano(e.id), r.panoRenderer.renderPanoTiles(e.id, null, !1, !1), e.setZoomed(t) } , i && (!e.zoomed || this.qualityManager.zoomLevelResolution && "4k" != this.qualityManager.zoomLevelResolution) ? (e.zoomed || n(e, !0), "1k" == Potree.settings.navTileClass && "1k" != Potree.settings.tileClass && this.zoomLevel < 2 ? this.panoRenderer.enableHighQuality(function() { "4k" != Potree.settings.tileClass && n(e, !0) } .bind(this)) : this.panoRenderer.enableUltraHighQualityMode(function() { this.qualityManager.useUltraHighResolutionPanos && (Potree.settings.zoom.max = Potree.config.ultraHighQualityMaxZoom), n(e, !0) } .bind(this))) : !t && e.zoomed && n(e, !1), i && "1k" == Potree.settings.navTileClass && "4k" == Potree.settings.tileClass && (i = function(e) { r.qualityManager.updateMaximums(), r.panoRenderer.setupZoomRenderTarget() } , this.qualityManager.zoomLevelResolution = 2 <= this.zoomLevel ? "4k" : 1.1 < this.zoomLevel ? "2k" : "1k", this.oldZoomLevel < 2 && 2 <= this.zoomLevel ? (i(), n(e, t)) : this.oldZoomLevel <= Potree.settings.zoom.activationThreshold && this.zoomLevel > Potree.settings.zoom.activationThreshold ? i() : 2 < this.oldZoomLevel && this.zoomLevel <= 2 ? (i(), n(e, t)) : this.oldZoomLevel > Potree.settings.zoom.activationThreshold && this.zoomLevel <= Potree.settings.zoom.activationThreshold && i(), this.oldZoomLevel = this.zoomLevel)) } }, { key: "addHighMapCube", value: function() { if ("4k" == Potree.settings.tileClass && 2048 == this.qualityManager.maxRenderTargetSize) { for (var e = new bu(1,1,1,1), t = new Si, n = 0; n < 6; n++) { for (var i = new Si, r = 0; r < 8; r++) for (var a = 0; a < 8; a++) { var o, s = new Hr(e,new $i({})); s.position.set(r - 3.5, a - 3.5, -4), s.material.opacity = .4, s.material.transparent = !0, Potree.settings.isTest && (o = Math.random(), s.material.color = (new Yi).setHSL(o, .5, .9)), s.visible = !1, i.add(s) } switch (n) { case um.GL_TEXTURE_CUBE_MAP_POSITIVE_X: i.rotation.set(0, Math.PI / 2, 0); break; case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_X: i.rotation.set(0, -Math.PI / 2, 0); break; case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Y: var l = (new Sn).setFromAxisAngle(new Cn(0,1,0), Math.PI) , u = (new Sn).setFromAxisAngle(new Cn(1,0,0), Math.PI / 2); i.quaternion.copy(l).multiply(u); break; case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: l = (new Sn).setFromAxisAngle(new Cn(0,1,0), Math.PI), u = (new Sn).setFromAxisAngle(new Cn(1,0,0), -Math.PI / 2); i.quaternion.copy(l).multiply(u); break; case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Z: i.rotation.set(0, Math.PI, 0); break; case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: i.rotation.set(0, 0, 0) } i.scale.set(1, -1, 1), t.add(i) } t.name = "highMapCube", this.highMapCube = t, viewer.scene.scene.add(t), this.highMapCube.visible = !1, viewer.setObjectLayers(this.highMapCube, "sceneObjects") } } }, { key: "isHighMapLoaded", value: function(e, t, n) { return !!this.highMapCube.children[e].children[8 * t + n].material.map } }, { key: "updateHighMap", value: function(e, t, n, i) { i = this.highMapCube.children[t].children[8 * n + i]; i.material.map = e, i.material.opacity = 1, i.material.transparent = !1, i.visible = !0, i.material.needsUpdate = !0 } }, { key: "resetHighMap", value: function() { this.highMapCube && (this.highMapCube.children.forEach(function(e) { return e.children.forEach(function(e) { var t; e.material.map && (e.material.map.dispose(), e.material.map.loaded = !1, e.material.map.version = 0, t = viewer.renderer.properties.get(e.material.map), viewer.renderer.getContext().deleteTexture(t.__webglTexture), e.material.map = null, e.material.needsUpdate = !0, e.visible = !1) }) }), this.highMapCube.visible = !1) } }, { key: "setHighMap", value: function(e) { this.highMapCube && (this.highMapCube.position.copy(e.position), this.highMapCube.quaternion.copy(Up.convertQuaternion.YupToZup(e.quaternion4dkk)), e = (new Sn).setFromRotationMatrix(e.pointcloud.rotateMatrix), this.highMapCube.quaternion.premultiply(e)) } }, { key: "showHighMap", value: function() { this.highMapCube && (this.highMapCube.visible = !0) } }, { key: "hideHighMap", value: function() { this.highMapCube && (this.highMapCube.visible = !1) } }, { key: "addPanoData", value: function(e, n) { var i = this; 0 == (e = e.data ? e.data : e).length && console.error(n + " 没有漫游点"), e.forEach(function(e) { e.id = i.panos.length; var t = new Qg(e,i); t.addEventListener("dispose", function(e) { i.closestPano == t && (i.closestPano = null) }), i.panos.push(t), "pano" == Potree.settings.editType && Potree.settings.datasetsPanos[n].panos.push(t) }) } }, { key: "loadDone", value: function() { viewer.setObjectLayers(this.node, "sceneObjects"), this.panos.forEach(function(e) { e.label && viewer.setObjectLayers(e.label, "bothMapAndScene") }), this.tileDownloader.setPanoData(this.panos, []); var e = new Cn(1,1,1); this.bound = Up.getBoundByPoints(this.panos.map(function(e) { return e.position }), e), viewer.scene.pointclouds.forEach(function(e) { return e.getPanosBound() }), viewer.scene.pointclouds.some(function(e) { return 0 == e.panos.length }) && (viewer.hasNoPanoDataset = !0) } }, { key: "getPano", value: function(t) { var n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : "id"; return this.panos.find(function(e) { return e[n] == t }) } }]), c }(); ly.prototype.checkAndWaitForPanoLoad = (iy = {}, ry = {}, ay = {}, function(n, e, t, i, r, a, o, s) { if (ay[n.id] = t, function() { for (var e in iy) if (iy.hasOwnProperty(e) && iy[e]) if (performance.now() - ry[e] < 5e3) return !0; return !1 }()) return !0; try { return null != a || (a = !0), iy[n.id] = this.checkAndWaitForTiledPanoLoad(n, e, function(e, t) { setTimeout(function() { iy[n.id] = !1, ay[n.id] && ay[n.id](e, t) }, 1) }, function(e) { setTimeout(function() { iy[n.id] = !1, i && i(e) }, 1) }, r, a, o, s), iy[n.id] && (ry[n.id] = performance.now()), iy[n.id] } catch (e) { throw iy[n.id] = !1, ry[n.id] = performance.now() - 5e3, e } } ), ly.filters = { inPanoDirection: function(n, i, r) { return function(e) { var t = e.floorPosition.clone().sub(n).normalize() , e = e.position.clone().sub(n).normalize(); return t.dot(i) > r || e.dot(i) > r } }, inFloorDirection: function(t, n, i) { return function(e) { return e.floorPosition.clone().sub(t).setZ(0).normalize().dot(n) > i } }, isNotBehindNormal: function(t, n) { var i = new Cn; return n = n.clone(), function(e) { return 0 < i.copy(e.position).sub(t).normalize().dot(n) } }, isCloseEnoughTo: function(t, n) { return function(e) { return t.distanceTo(e.floorPosition) < n } }, not: function(t) { return function(e) { return e !== t } }, isEnabled: function() { return function(e) { return e.enabled } }, isVisible: function() { return function(e) { return e.visible } } }, ly.scoreFunctions = { direction: function(t, n, e) { return function(e) { return 200 * e.position.clone().sub(t).normalize().dot(n) } }, distanceSquared: function(t, n, e) { return t.position && (t = t.position), function(e) { e = e.position.clone(); return -1 * t.distanceToSquared(e) * n } }, angle: function(t, n) { return function(e) { return e.position.clone().sub(t).normalize().angleTo(n) * Potree.config.navigation.angleFactor } } }, ly.sortFunctions = { floorDisSquaredToPoint: function(n) { return function(e, t) { return e.floorPosition.distanceToSquared(n) - t.floorPosition.distanceToSquared(n) } }, disSquaredToPoint: function(n) { return function(e, t) { return e.position.distanceToSquared(n) - t.position.distanceToSquared(n) } } }; var uy, cy = T.map.mapHeight + 100, dy = T.map.mapHeight + 105, hy = new _c, py = new ua(1,1), fy = function() { y(a, zg); var r = w(a); function a(e) { var t, n, i; return O(this, a), (t = r.call(this, e, { clearColor: Potree.config.mapBG, name: "mapViewer" })).visible = !0, t.initScene(), t.mapLayer = new hg(g(t),t.viewports[0]), t.scene.add(t.mapLayer.sceneGroup), t.mapLayer.sceneGroup.position.setZ(Potree.config.map.mapHeight), t.mapRatio = .5, t.splitDir = "leftRight", viewer.addEventListener("camera_changed", function(e) { e.viewport == viewer.mainViewport ? t.updateCursor() : t.updateWhenAtViewer() }), viewer.reticule.addEventListener("update", function(e) { t.attachedToViewer && (t.needRender = !0) }), viewer.scene.addEventListener("360_images_added", t.addPanos.bind(g(t))), viewer.addEventListener("loadPointCloudDone", t.initProjection.bind(g(t))), t.addEventListener("global_click", function(e) { !e.isTouch && e.button != C.LEFT || t.updateClosestPano(e.intersect) }), t.addEventListener("add", function(e) { t.scene.add(e.object), "route" == e.name && (e.object.position.z = dy), viewer.setObjectLayers(e.object, "mapObjects") }), Potree.settings.isOfficial || (e = viewer.renderer.domElement.parentElement, (n = $("")).css({ position: "absolute", right: "80%", bottom: "20px", zIndex: "10000", fontSize: "1em", color: "black", background: "rgba(255,255,255,0.8)" }), i = !1, n.on("click", function() { i = !i, t.attachToMainViewer(i, "measure"), n.val(i ? "map分离" : "map绑定") }), e.appendChild(n[0])), t } return h(a, [{ key: "waitLoadDone", value: function(t) { var n = this; 0 == this.mapLayer.loadingInProgress ? t() : this.mapLayer.addEventListener("loadDone", function e() { t(), n.mapLayer.removeEventListener("loadDone", e) }) } }, { key: "addListener", value: function(e) { var t = this; e.addEventListener("flyToPano", function(e) { e = e.toPano; e.dontMoveMap || t.moveTo(e.pano.position.clone().setZ(Potree.config.map.cameraHeight), void 0, e.duration, e.easeName) }) } }, { key: "initProjection", value: function() { this.started = !0, this.mapLayer.initProjection() } }, { key: "initScene", value: function() { var e = this.renderArea.clientWidth , t = this.renderArea.clientHeight; this.camera = new ed(-e / 2,e / 2,t / 2,-t / 2,.01,1e4), this.camera.zoom = e / 50, this.camera.up.set(0, 0, 1), this.view = new ng, this.view.position.set(0, 0, Potree.config.map.cameraHeight), this.view.lookAt(0, 0, 0), this.setViewLimit("standard"); e = new Ig(this.view,this.camera,{ left: 0, bottom: 0, width: 1, height: 1, name: "mapViewport" }); e.axis = ["x", "y"], e.axisSign = [1, 1], e.noPointcloud = !0, e.render = this.render.bind(this), this.viewports = [e], this.controls = new Fg(this,this.viewports[0]), this.controls.setEnable(!0), this.scene = new gs, this.inputHandler = new Og(this,this.scene), this.inputHandler.name = "mapInputHandler", this.inputHandler.registerInteractiveScene(this.scene), this.viewports[0].interactiveScenes = this.inputHandler.interactiveScenes; e = new Hr(py,new $i({ transparent: !0, opacity: .9, depthTest: !1, map: hy.load(Potree.resourcePath + "/textures/pic_location128.png") })); e.position.set(0, 0, 0), this.cursor = e, this.scene.add(e), viewer.setObjectLayers(this.scene, "mapObjects") } }, { key: "setViewLimit", value: function(e) { e = Potree.config.OrthoCameraLimit[e]; e ? (this.view.limitBound = (new kn).copy(e.posBound), this.camera.zoomLimit = $.extend({}, e.zoom)) : (this.view.limitBound = null, this.camera.zoomLimit = null) } }, { key: "updateCursor", value: function() { var e = Up.getScaleForConstantSize({ minSize: 80, maxSize: 200, nearBound: 5, farBound: 100, camera: this.camera, position: this.cursor.getWorldPosition(new Cn), resolution: this.viewports[0].resolution }); this.cursor.scale.set(e, e, e), this.cursor.position.copy(viewer.mainViewport.camera.position).setZ(0), this.cursor.rotation.z = viewer.mainViewport.view.yaw, this.needRender = !0 } }, { key: "addPanos", value: function(e) { var i = this , r = new Si; uy = { default: new $i({ transparent: !0, opacity: .5, map: hy.load(Potree.resourcePath + "/textures/map_marker.png") }), selected: new $i({ transparent: !0, opacity: 1, map: hy.load(Potree.resourcePath + "/textures/map_marker.png") }) }, e.images.panos.forEach(function(t) { t.mapMarker = new Hr(py,uy.default), t.mapMarker.position.copy(t.position).setZ(0), t.mapMarker.scale.set(1, 1, 1), t.mapMarker.name = "mapMarker", r.add(t.mapMarker); function e(e) { e.byMap || (t.mapMarker.material = uy.selected, e.byMainView || t.dispatchEvent({ type: "hoverOn", byMap: !0 }), i.needRender = !0) } function n(e) { e.byMap || (t.mapMarker.material = uy.default, e.byMainView || t.dispatchEvent({ type: "hoverOff", byMap: !0 }), i.needRender = !0) } t.mapMarker.addEventListener("mouseover", e), t.mapMarker.addEventListener("mouseleave", n), t.addEventListener("hoverOn", e), t.addEventListener("hoverOff", n); t.mapMarker.addEventListener("click", function(e) { viewer.images360.flyToPano(t) }), t.addEventListener("isVisible", function(e) { viewer.updateVisible(t.mapMarker, "panoVisible", e.visible), i.needRender = !0 }), t.addEventListener("rePos", function(e) { t.mapMarker.position.copy(t.position).setZ(0) }) }), this.scene.add(r), r.position.z = cy, this.panosGroup = r, viewer.setObjectLayers(r, "mapObjects"), this.initFitView() } }, { key: "updateClosestPano", value: function(t) { var e; viewer.images360.flying || (t = t && t.orthoIntersect) && (t = t.clone().setZ(0), e = [function(e) { return e.position.clone().setZ(0).distanceTo(t) < 20 } , ly.filters.isEnabled(), ly.filters.isVisible()], (e = Fm.find(viewer.images360.panos, e, [ly.sortFunctions.floorDisSquaredToPoint(t)])) && e != viewer.images360.currentPano && viewer.images360.flyToPano(e)) } }, { key: "fitPanosToViewport", value: function() { var e = viewer.images360.bound.size.clone().multiplyScalar(1.1); e.max(new Cn(4,4,4)); var t = viewer.images360.bound.center.clone(); this.moveTo(t, e, 0) } }, { key: "fitToPointcloud", value: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 400 , n = e.bound.getSize(new Cn); n.max(new Cn(4,4,4)); e = e.bound.getCenter(new Cn); this.moveTo(e, n, t) } }, { key: "initFitView", value: function() { this.camera.zoom = 14, this.moveTo(viewer.images360.position), this.camera.updateProjectionMatrix() } }, { key: "fitToDatasets", value: function(e) { var t = new kn; e.forEach(function(e) { return t.union(e.bound) }); var n = t.getCenter(new Cn) , e = t.getSize(new Cn); this.moveTo(n, e, 200) } }, { key: "moveTo", value: function(e, t) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0 , i = 3 < arguments.length ? arguments[3] : void 0; e = new Cn(e.x,e.y,Potree.config.map.cameraHeight), this.view.moveOrthoCamera(this.viewports[0], { endPosition: e, boundSize: t }, n, i) } }, { key: "updateWhenAtViewer", value: function(e) { this.attachedToViewer && (this.started && this.mapLayer.update(), this.updateCursor(), this.needRender = !0) } }, { key: "update", value: function(e, t) { (this.visible || this.attachedToViewer) && (this.attachedToViewer ? this.mapLayer.needUpdate && this.updateWhenAtViewer() : (this.updateScreenSize(), this.controls.update(e), this.view.applyToCamera(this.camera), e = this.cameraChanged(), this.started && (e || this.mapLayer.needUpdate) && this.mapLayer.update(), e && (this.dispatchEvent({ type: "camera_changed", camera: this.camera, viewport: this.viewports[0] }), this.needRender = !0, this.updateCursor()), this.render())) } }, { key: "attachToMainViewer", value: function(e, t) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : .5 , i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : {}; if (Potree.settings.isOfficial || (this.renderArea.style.display = e ? "none" : "block"), e) { if (this.enabledOld = this.enabled, this.enabled = !0, "dontSet" != n) { if (this.changeSplitScreenDir(i.dir, n), this.attachedToViewer) return void viewer.updateScreenSize({ forceUpdateSize: !0 }); viewer.viewports = [viewer.mainViewport, viewer.mapViewer.viewports[0]] } "measure" == t ? this.inputHandler.registerInteractiveScene(viewer.measuringTool.scene) : "split4Screens" == t && this.inputHandler.registerInteractiveScene(viewer.scene.scene) } else { if (!this.attachedToViewer) return; viewer.mainViewport.left = 0, viewer.mainViewport.bottom = 0, viewer.mainViewport.width = 1, viewer.mainViewport.height = 1, this.viewports[0].width = 1, this.viewports[0].bottom = 0, this.viewports[0].height = 1, this.viewports[0].left = 0, this.inputHandler.unregisterInteractiveScene(viewer.measuringTool.scene), this.inputHandler.unregisterInteractiveScene(viewer.scene.scene), viewer.viewports = [viewer.mainViewport], this.updateScreenSize({ forceUpdateSize: !0 }) } this.attachedToViewer = e, viewer.updateScreenSize({ forceUpdateSize: !0 }), i.moveToCurrentPos && (i = new yn(10,10), this.moveTo(viewer.images360.position.clone(), i, 1e3)), this.needRender = !0 } }, { key: "changeSplitScreenDir", value: function(e, t) { e && (this.splitDir = e), this.updateSplitSize(t) } }, { key: "updateSplitSize", value: function(e) { null != e && (this.mapRatio = e), "leftRight" == this.splitDir ? (viewer.mainViewport.left = this.mapRatio, viewer.mainViewport.width = 1 - this.mapRatio, this.viewports[0].width = this.mapRatio, viewer.mainViewport.bottom = this.viewports[0].bottom = 0, viewer.mainViewport.height = this.viewports[0].height = 1) : "upDown" == this.splitDir && (viewer.mainViewport.bottom = this.mapRatio, viewer.mainViewport.height = 1 - this.mapRatio, this.viewports[0].height = this.mapRatio, viewer.mainViewport.left = this.viewports[0].left = 0, viewer.mainViewport.width = this.viewports[0].width = 1), this.attachedToViewer && viewer.updateScreenSize({ forceUpdateSize: !0 }) } }, { key: "render", value: function() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; (this.visible || this.attachedToViewer) && (this.needRender || t.force) && (e = t.renderer || this.renderer, t.target && e.setRenderTarget(t.target), (t.clear ? t : e).clear(), this.attachedToViewer || viewer.dispatchEvent({ type: "render.begin", viewer: this, viewport: this.viewports[0], params: t }), viewer.setCameraLayers(this.camera, ["map", "mapObjects", "bothMapAndScene"]), this.mapGradientBG && (viewer.scene.cameraBG.layers.set(Potree.config.renderLayers.bg), e.render(viewer.scene.scene, viewer.scene.cameraBG)), e.render(this.scene, this.camera), e.render(viewer.scene.scene, this.camera), t.renderOverlay && t.renderOverlay($.extend({}, t, { isMap: !0 })), e.setRenderTarget(null), this.needRender = !1) } }]), a }(), my = function() { function e() { O(this, e) } return h(e, null, [{ key: "toString", value: function(e) { var t, n = "", i = Object.keys(e.data).filter(function(e) { return "normal" !== e }).sort(function(e, t) { return "position" === e ? -1 : "position" === t ? 1 : "rgba" === e ? -1 : "rgba" === t ? 1 : void 0 }), r = [], a = ue(i); try { for (a.s(); !(t = a.n()).done; ) { var o = t.value , s = e.data[o].length / e.numPoints; if ("position" === o) r = r.concat(["x", "y", "z"]); else if ("rgba" === o) r = r.concat(["r", "g", "b", "a"]); else if (1 < s) for (var l = 0; l < s; l++) r.push("".concat(o, "_").concat(l)); else r.push(o) } } catch (e) { a.e(e) } finally { a.f() } for (var n = r.join(", ") + "\n", u = 0; u < e.numPoints; u++) { var c, d = [], h = ue(i); try { for (h.s(); !(c = h.n()).done; ) { var p = c.value , f = e.data[p].length / e.numPoints , m = e.data[p].subarray(f * u, f * u + f).join(", "); d.push(m) } } catch (e) { h.e(e) } finally { h.f() } n += d.join(", ") + "\n" } return n } }]), e }(), vy = function() { function e() { O(this, e) } return h(e, null, [{ key: "toLAS", value: function(e) { function t(e, t, n) { for (var i = new Uint8Array(n), r = 0; r < e.length; r++) { var a = e.charCodeAt(r); i[t + r] = a } } var n = e.boundingBox , i = n.min.clone() , r = n.min.distanceTo(n.max) , a = new Cn(.001,.001,.001) , a = 1e6 < r ? new Cn(.01,.01,.01) : new Cn(.001,.001,.001) , o = new ArrayBuffer(227 + 28 * e.numPoints) , s = new DataView(o) , r = new Uint8Array(o); t("LASF", 0, o), r[24] = 1, r[25] = 2, t("Potree 1.7", 58, o), s.setUint16(94, 227, !0), s.setUint32(96, 227, !0), r[104] = 2, s.setUint16(105, 28, !0), s.setUint32(107, e.numPoints, !0), s.setFloat64(131, a.x, !0), s.setFloat64(139, a.y, !0), s.setFloat64(147, a.z, !0), s.setFloat64(155, i.x, !0), s.setFloat64(163, i.y, !0), s.setFloat64(171, i.z, !0), s.setFloat64(179, n.max.x, !0), s.setFloat64(187, n.min.x, !0), s.setFloat64(195, n.max.y, !0), s.setFloat64(203, n.min.y, !0), s.setFloat64(211, n.max.z, !0), s.setFloat64(219, n.min.z, !0); for (var l = 227, u = 0; u < e.numPoints; u++) { var c = e.data.position[3 * u + 0] , d = e.data.position[3 * u + 1] , h = e.data.position[3 * u + 2] , c = parseInt((c - i.x) / a.x) , d = parseInt((d - i.y) / a.y) , h = parseInt((h - i.z) / a.z); s.setUint32(l + 0, c, !0), s.setUint32(l + 4, d, !0), s.setUint32(l + 8, h, !0), e.data.intensity && s.setUint16(l + 12, e.data.intensity[u], !0); h = 0; e.data.returnNumber && (h += e.data.returnNumber[u]), e.data.numberOfReturns && (h += e.data.numberOfReturns[u] << 3), s.setUint8(l + 14, h), e.data.classification && s.setUint8(l + 15, e.data.classification[u]), e.data.pointSourceID && s.setUint16(l + 18, e.data.pointSourceID[u]), e.data.rgba && (h = e.data.rgba, s.setUint16(l + 20, 255 * h[4 * u + 0], !0), s.setUint16(l + 22, 255 * h[4 * u + 1], !0), s.setUint16(l + 24, 255 * h[4 * u + 2], !0)), l += 28 } return o } }]), e }(); function gy(e, t) { for (var n = 0, i = Object.keys(t.uniforms); n < i.length; n++) { var r = i[n]; t.uniforms[r].value = e.uniforms[r].value } t.gradientTexture = e.gradientTexture, t.visibleNodesTexture = e.visibleNodesTexture, t.classificationTexture = e.classificationTexture, t.matcapTexture = e.matcapTexture, t.activeAttributeName = e.activeAttributeName, t.ranges = e.ranges } var yy = function() { function n(e, t) { O(this, n), this.geometry = e, this.material = t, this.sceneNode = new gl(e,t), this.geometryNode = { estimatedSpacing: 1, geometry: e } } return h(n, [{ key: "getLevel", value: function() { return 0 } }]), n }() , wy = function() { y(i, xm); var n = w(i); function i(e) { var t; return O(this, i), (t = n.call(this)).trueOctree = e, t.pcoGeometry = e.pcoGeometry, t.points = [], t.visibleNodes = [], t.material = new Rm, gy(t.trueOctree.material, t.material), t.material.pointSizeType = am.FIXED, t.batchSize = 1e5, t.currentBatch = null, t } return h(i, [{ key: "getAttribute", value: function(e) { return this.trueOctree.getAttribute(e) } }, { key: "dispose", value: function() { var e, t = ue(this.visibleNodes); try { for (t.s(); !(e = t.n()).done; ) e.value.geometry.dispose() } catch (e) { t.e(e) } finally { t.f() } this.visibleNodes = [], this.currentBatch = null, this.points = [] } }, { key: "addPoints", value: function(e) { null === this.currentBatch && (this.currentBatch = this.createNewBatch(e)), this.points.push(e); for (var t = { start: this.currentBatch.geometry.drawRange.count, count: 0 }, n = new kn, i = new Cn, r = 0; r < e.numPoints; r++) { if (t.start + t.count >= this.batchSize) { for (var a = 0, o = Object.keys(this.currentBatch.geometry.attributes); a < o.length; a++) { var s = o[a] , s = this.currentBatch.geometry.attributes[s]; s.updateRange.offset = t.start, s.updateRange.count = t.count, s.needsUpdate = !0 } this.currentBatch.geometry.computeBoundingBox(), this.currentBatch.geometry.computeBoundingSphere(), this.currentBatch = this.createNewBatch(e), t = { start: 0, count: 0 } } i.set(e.data.position[3 * r + 0] + this.trueOctree.position.x, e.data.position[3 * r + 1] + this.trueOctree.position.y, e.data.position[3 * r + 2] + this.trueOctree.position.z); var l = e.data.mileage[r] , u = i.z; n.expandByPoint(new Cn(l,0,u)); for (var c = t.start + t.count, d = this.currentBatch.geometry, h = 0, p = Object.keys(e.data); h < p.length; h++) for (var f = p[h], m = e.data[f], v = d.attributes[f], g = v.itemSize, y = 0; y < g; y++) v.array[g * c + y] = m[g * r + y]; var w = d.attributes.position; w.array[3 * c + 0] = l, w.array[3 * c + 1] = 0, w.array[3 * c + 2] = u, t.count++, this.currentBatch.geometry.drawRange.count++ } for (var b = 0, x = Object.keys(this.currentBatch.geometry.attributes); b < x.length; b++) { var E = x[b] , E = this.currentBatch.geometry.attributes[E]; E.updateRange.offset = t.start, E.updateRange.count = t.count, E.needsUpdate = !0 } e.projectedBox = n, this.projectedBox = this.points.reduce(function(e, t) { return e.union(t.projectedBox) }, new kn) } }, { key: "createNewBatch", value: function(e) { for (var t = new Mr, n = 0, i = Object.keys(e.data); n < i.length; n++) { var r = i[n] , a = e.data[r] , o = a.length / e.numPoints , s = a.constructor , a = !1; this.trueOctree.root.sceneNode && this.trueOctree.root.sceneNode.geometry.attributes[r] && (a = this.trueOctree.root.sceneNode.geometry.attributes[r].normalized); a = new nr(new s(o * this.batchSize),o,a); a.potree = { range: [0, 1] }, t.setAttribute(r, a) } t.drawRange.start = 0, t.drawRange.count = 0; var l = new yy(t,this.material); return this.visibleNodes.push(l), l } }, { key: "computeVisibilityTextureData", value: function() { for (var e = new Uint8Array(4 * this.visibleNodes.length), t = new Map, n = 0; n < this.visibleNodes.length; n++) t[this.visibleNodes[n]] = n; return { data: e, offsets: t } } }]), i }() , by = function() { y(i, hn); var n = w(i); function i(e) { var t; O(this, i), (t = n.call(this)).viewer = e, t.elRoot = $("#profile_window"), t.renderArea = t.elRoot.find("#profileCanvasContainer"), t.svg = d3.select("svg#profileSVG"), t.mouseIsDown = !1, t.projectedBox = new kn, t.pointclouds = new Map, t.numPoints = 0, t.lastAddPointsTimestamp = void 0, t.mouse = new yn(0,0), t.scale = new Cn(1,1,1), t.autoFitEnabled = !0, t.autoFit = !1; e = "".concat(le.resourcePath, "/icons/arrow_cw.svg"); $("#potree_profile_rotate_cw").attr("src", e); e = "".concat(le.resourcePath, "/icons/arrow_ccw.svg"); $("#potree_profile_rotate_ccw").attr("src", e); e = "".concat(le.resourcePath, "/icons/arrow_up.svg"); $("#potree_profile_move_forward").attr("src", e); e = "".concat(le.resourcePath, "/icons/arrow_down.svg"); $("#potree_profile_move_backward").attr("src", e); e = "".concat(le.resourcePath, "/icons/file_csv_2d.svg"); $("#potree_download_csv_icon").attr("src", e); e = "".concat(le.resourcePath, "/icons/file_las_3d.svg"); $("#potree_download_las_icon").attr("src", e); e = "".concat(le.resourcePath, "/icons/close.svg"); return $("#closeProfileContainer").attr("src", e), t.initTHREE(), t.initSVG(), t.initListeners(), t.pRenderer = new Zm(t.renderer), t.elRoot.i18n(), t } return h(i, [{ key: "initListeners", value: function() { var g = this; $(window).resize(function() { g.enabled && g.render() }), this.renderArea.mousedown(function(e) { g.mouseIsDown = !0 }), this.renderArea.mouseup(function(e) { g.mouseIsDown = !1 }); function y() { var e = g.viewer.scene.getActiveCamera() , t = g.viewer.renderer.domElement , n = g.viewerPickSphere.position.distanceTo(e.position) , t = 10 / Jf.projectedRadius(1, e, n, t.clientWidth, t.clientHeight); g.viewerPickSphere.scale.set(t, t, t) } this.renderArea.mousemove(function(e) { if (0 !== g.pointclouds.size) { var t = g.renderArea[0].getBoundingClientRect() , n = e.clientX - t.left , t = e.clientY - t.top , n = new yn(n,t); if (g.mouseIsDown) { g.autoFit = !1, g.lastDrag = (new Date).getTime(); var i = [g.scaleX.invert(g.mouse.x), g.scaleY.invert(g.mouse.y)] , r = [g.scaleX.invert(n.x), g.scaleY.invert(n.y)]; g.camera.position.x -= r[0] - i[0], g.camera.position.z -= r[1] - i[1], g.render() } else if (0 < g.pointclouds.size) { var t = Math.abs(g.scaleX.invert(0) - g.scaleX.invert(40)) , r = g.scaleX.invert(n.x) , i = g.scaleY.invert(n.y) , a = g.selectPoint(r, i, t); if (a) { var o = a.point , s = new Float64Array([o.position[0] + a.pointcloud.position.x, o.position[1] + a.pointcloud.position.y, o.position[2] + a.pointcloud.position.z]); g.elRoot.find("#profileSelectionProperties").fadeIn(200), g.pickSphere.visible = !0, g.pickSphere.scale.set(.5 * t, .5 * t, .5 * t), g.pickSphere.position.set(o.mileage, 0, s[2]), (l = g.viewerPickSphere.position).set.apply(l, Q(s)), g.viewer.scene.scene.children.includes(g.viewerPickSphere) || (g.viewer.scene.scene.add(g.viewerPickSphere), g.viewer.hasEventListener("update", y) || g.viewer.addEventListener("update", y)); for (var l = g.elRoot.find("#profileSelectionProperties"), u = "", c = 0, d = Object.keys(o); c < d.length; c++) { var h, p = d[c], f = o[p], m = a.pointcloud.getAttribute(p), v = function(e) { return e }; m && 4 < m.type.size && function() { var e = m.initialRange , t = 1 / (e[1] - e[0]) , n = e[0]; v = function(e) { return e / t + n } }(), "position" === p ? (h = Q(s).map(function(e) { return Jf.addCommas(e.toFixed(3)) }), u += "\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\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\n\t\t\t\t\t\t\t\t\t\n\t\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\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t")) : "rgba" === p ? u += "\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t") : "normal" !== p && (u += "mileage" === p ? "\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\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\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t")) } l.html(u += "
x".concat(h[0], "
y").concat(h[1], "
z").concat(h[2], "
".concat(p, "").concat(f.join(", "), "
".concat(p, "").concat(f.toFixed(3), "
".concat(p, "").concat(v(f), "
"), g.selectedPoint = o } else { g.viewer.scene.scene.add(g.viewerPickSphere); l = g.viewer.scene.scene.children.indexOf(g.viewerPickSphere); 0 <= l && g.viewer.scene.scene.children.splice(l, 1), g.viewer.removeEventListener("update", y) } g.render() } g.mouse.copy(n) } }); function e(e) { g.autoFit = !1; var t = 0; void 0 !== e.wheelDelta ? t = e.wheelDelta : void 0 !== e.detail && (t = -e.detail), e = Math.sign(t), t = [g.scaleX.invert(g.mouse.x), g.scaleY.invert(g.mouse.y)], 0 < e ? g.scale.multiplyScalar(1.1) : g.scale.multiplyScalar(100 / 110), g.updateScales(), e = [g.scaleX.invert(g.mouse.x), g.scaleY.invert(g.mouse.y)], g.camera.position.x -= e[0] - t[0], g.camera.position.z -= e[1] - t[1], g.render(), g.updateScales() } $(this.renderArea)[0].addEventListener("mousewheel", e, !1), $(this.renderArea)[0].addEventListener("DOMMouseScroll", e, !1), $("#closeProfileContainer").click(function() { g.hide() }); function t() { var e, t = new Gm, n = ue(g.pointclouds); try { for (n.s(); !(e = n.n()).done; ) { var i, r = N(e.value, 2), a = r[0], o = ue(r[1].points); try { for (o.s(); !(i = o.n()).done; ) { for (var s = i.value, l = s.data.position, u = new Float32Array(l), c = 0; c < s.numPoints; c++) u[3 * c + 2] += a.position.z; s.data.position = u, t.add(s), s.data.position = l } } catch (e) { o.e(e) } finally { o.f() } } } catch (e) { n.e(e) } finally { n.f() } return t } $("#potree_download_csv_icon").click(function() { var e = t() , e = my.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 = vy.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 ph(new yn(e - n,t - n),new yn(e + n,t + n)), o = ue(this.pointclouds); try { for (o.s(); !(i = o.n()).done; ) { var s, l = N(i.value, 2), u = l[0], c = ue(l[1].points); try { for (c.s(); !(s = c.n()).done; ) { var d = s.value; if (new ph(new yn(d.projectedBox.min.x,d.projectedBox.min.z),new yn(d.projectedBox.max.x,d.projectedBox.max.z)).intersectsBox(a)) { d.numPoints; for (var h = 0; h < d.numPoints; h++) { var p, f = d.data.mileage[h] - e, m = d.data.position[3 * h + 2] - t + u.position.z, v = Math.sqrt(f * f + m * m), g = v < n && v < r.distance, y = !0; d.data.classification && (!(p = u.material.classification[d.data.classification[h]]) || p.visible && 0 !== p.color.w || (y = !1)), g && y && (r = { distance: v, pointcloud: u, points: d, index: h }) } } else d.numPoints } } catch (e) { c.e(e) } finally { c.f() } } } catch (e) { o.e(e) } finally { o.f() } if (r.distance < 1 / 0) { for (var w = r.points, b = {}, x = 0, E = Object.keys(w.data); x < E.length; x++) { var _ = E[x] , M = w.data[_] , A = M.length / w.numPoints , A = M.subarray(A * r.index, A * r.index + A); 1 === A.length ? b[_] = A[0] : b[_] = A } return r.point = b, r } return null } }, { key: "initTHREE", value: function() { this.renderer = new ps({ alpha: !0, premultipliedAlpha: !1 }), this.renderer.setClearColor(0, 0), this.renderer.setSize(10, 10), this.renderer.autoClear = !1, this.renderArea.append($(this.renderer.domElement)), this.renderer.domElement.tabIndex = "2222", $(this.renderer.domElement).css("width", "100%"), $(this.renderer.domElement).css("height", "100%"); var e = this.renderer.getContext(); if (null == e.createVertexArray) { var t = e.getExtension("OES_vertex_array_object"); if (!t) throw new Error("OES_vertex_array_object extension not supported"); e.createVertexArray = t.createVertexArrayOES.bind(t), e.bindVertexArray = t.bindVertexArrayOES.bind(t) } this.camera = new ed(-1e3,1e3,1e3,-1e3,-1e3,1e3), window.axisYup || (this.camera.up.set(0, 0, 1), this.camera.rotation.order = "ZXY", this.camera.rotation.x = Math.PI / 2), this.scene = new gs, this.profileScene = new gs; e = new Su(1,16,16), t = new Xu; this.pickSphere = new Hr(e,t), this.scene.add(this.pickSphere), this.viewerPickSphere = new Hr(e,t) } }, { key: "initSVG", value: function() { var e = this.renderArea[0].clientWidth , t = this.renderArea[0].clientHeight , n = this.renderArea[0].offsetLeft; this.svg.selectAll("*").remove(), this.scaleX = d3.scale.linear().domain([this.camera.left + this.camera.position.x, this.camera.right + this.camera.position.x]).range([0, e]), this.scaleY = d3.scale.linear().domain([this.camera.bottom + this.camera.position.z, this.camera.top + this.camera.position.z]).range([t, 0]), this.xAxis = d3.svg.axis().scale(this.scaleX).orient("bottom").innerTickSize(-t).outerTickSize(1).tickPadding(10).ticks(e / 50), this.yAxis = d3.svg.axis().scale(this.scaleY).orient("left").innerTickSize(-e).outerTickSize(1).tickPadding(10).ticks(t / 20), this.elXAxis = this.svg.append("g").attr("class", "x axis").attr("transform", "translate(".concat(n, ", ").concat(t, ")")).call(this.xAxis), this.elYAxis = this.svg.append("g").attr("class", "y axis").attr("transform", "translate(".concat(n, ", 0)")).call(this.yAxis) } }, { key: "addPoints", value: function(e, t) { var n = this; if (0 !== t.numPoints) { var i, r, a = this.pointclouds.get(e); a || (a = new wy(e), this.pointclouds.set(e, a), this.profileScene.add(a), (i = function() { n.render() } )(), e.material.addEventListener("material_property_changed", i), this.addEventListener("on_reset_once", function() { e.material.removeEventListener("material_property_changed", i) })), a.addPoints(t), this.projectedBox.union(a.projectedBox), this.autoFit && this.autoFitEnabled && (r = this.renderArea[0].clientWidth, t = this.renderArea[0].clientHeight, r = r / (a = this.projectedBox.getSize(new Cn)).x, a = t / a.z, r = Math.min(r, a), a = this.projectedBox.getCenter(new Cn), this.scale.set(r, r, 1), this.camera.position.copy(a)), this.render(); var o, s = 0, l = ue(this.pointclouds.entries()); try { for (l.s(); !(o = l.n()).done; ) { var u = N(o.value, 2); u[0]; s += u[1].points.reduce(function(e, t) { return e + t.numPoints }, 0) } } catch (e) { l.e(e) } finally { l.f() } $("#profile_num_points").html(Jf.addCommas(s)) } } }, { key: "reset", value: function() { this.lastReset = (new Date).getTime(), this.dispatchEvent({ type: "on_reset_once" }), this.removeEventListeners("on_reset_once"), this.autoFit = !0, this.projectedBox = new kn; var e, t = ue(this.pointclouds); try { for (t.s(); !(e = t.n()).done; ) { var n = N(e.value, 2); n[0]; n[1].dispose() } } catch (e) { t.e(e) } finally { t.f() } this.pointclouds.clear(), this.mouseIsDown = !1, this.mouse.set(0, 0), this.autoFitEnabled && this.scale.set(1, 1, 1), this.pickSphere.visible = !1, this.elRoot.find("#profileSelectionProperties").hide(), this.render() } }, { key: "show", value: function() { this.elRoot.fadeIn(), this.enabled = !0 } }, { key: "hide", value: function() { this.elRoot.fadeOut(), this.enabled = !1 } }, { key: "updateScales", value: function() { var e = this.renderArea[0].clientWidth , t = this.renderArea[0].clientHeight , n = -e / 2 / this.scale.x , i = +e / 2 / this.scale.x , r = +t / 2 / this.scale.y , a = -t / 2 / this.scale.y; this.camera.left = n, this.camera.right = i, this.camera.top = r, this.camera.bottom = a, this.camera.updateProjectionMatrix(), this.scaleX.domain([this.camera.left + this.camera.position.x, this.camera.right + this.camera.position.x]).range([0, e]), this.scaleY.domain([this.camera.bottom + this.camera.position.z, this.camera.top + this.camera.position.z]).range([t, 0]); a = this.renderArea[0].offsetLeft; this.xAxis.scale(this.scaleX).orient("bottom").innerTickSize(-t).outerTickSize(1).tickPadding(10).ticks(e / 50), this.yAxis.scale(this.scaleY).orient("left").innerTickSize(-e).outerTickSize(1).tickPadding(10).ticks(t / 20), this.elXAxis.attr("transform", "translate(".concat(a, ", ").concat(t, ")")).call(this.xAxis), this.elYAxis.attr("transform", "translate(".concat(a, ", 0)")).call(this.yAxis) } }, { key: "requestScaleUpdate", value: function() { void 0 === this.lastReset || void 0 === this.lastScaleUpdate || 100 < (new Date).getTime() - this.lastReset && 100 < (new Date).getTime() - this.lastScaleUpdate ? (this.updateScales(), this.lastScaleUpdate = (new Date).getTime(), this.scaleUpdatePending = !1) : this.scaleUpdatePending || (setTimeout(this.requestScaleUpdate.bind(this), 100), this.scaleUpdatePending = !0) } }, { key: "render", value: function() { var e = this.renderArea[0].clientWidth , t = this.renderArea[0].clientHeight , n = this.renderer , i = this.pRenderer , r = this.camera , a = this.profileScene , o = this.scene , s = this.scaleX , l = this.pickSphere; n.setSize(e, t), n.setClearColor(0, 0), n.clear(!0, !0, !1); var u, c = ue(this.pointclouds.keys()); try { for (c.s(); !(u = c.n()).done; ) { var d = u.value , h = d.material , p = this.pointclouds.get(d).material; gy(h, p), p.size = 2 } } catch (e) { c.e(e) } finally { c.f() } i.render(a, r, null); s = Math.abs(s.invert(0) - s.invert(5)); 0 === s ? l.visible = !1 : (l.scale.set(s, s, s), l.visible = !0), n.render(o, r), this.requestScaleUpdate() } }]), i }() , xy = function() { function n(e) { var l = this; O(this, n), this.viewer = e, this.profileWindow = e.profileWindow, this.profile = null, this.numPoints = 0, this.threshold = 6e4, this.rotateAmount = 10, this.scheduledRecomputeTime = null, this.enabled = !0, this.requests = [], this._recompute = function() { l.recompute() } , this.viewer.addEventListener("scene_changed", function(e) { e.oldScene.removeEventListener("pointcloud_added", l._recompute), e.scene.addEventListener("pointcloud_added", l._recompute) }), this.viewer.scene.addEventListener("pointcloud_added", this._recompute), $("#potree_profile_rotate_amount").val(parseInt(this.rotateAmount)), $("#potree_profile_rotate_amount").on("input", function(e) { var t = $("#potree_profile_rotate_amount").val(); isNaN(t) ? $("#potree_profile_rotate_amount").css("background-color", "#ff9999") : (t = parseFloat(t), l.rotateAmount = t, $("#potree_profile_rotate_amount").css("background-color", "")) }); function t(e) { var t = l.profile , n = t.points , i = n[0] , r = n[n.length - 1] , i = i.clone().add(r).multiplyScalar(.5) , r = (new ni).makeTranslation(-i.x, -i.y, -i.z) , e = (new ni).makeRotationZ(e) , a = (new ni).makeTranslation(i.x, i.y, i.z).multiply(e).multiply(r) , o = n.map(function(e) { return e.clone().applyMatrix4(a) }); l.profileWindow.autoFitEnabled = !1; for (var s = 0; s < n.length; s++) t.setPosition(s, o[s]) } $("#potree_profile_rotate_cw").click(function() { var e = gn.degToRad(l.rotateAmount); t(-e) }), $("#potree_profile_rotate_ccw").click(function() { var e = gn.degToRad(l.rotateAmount); t(e) }), $("#potree_profile_move_forward").click(function() { var e = l.profile , t = e.points , n = t[0] , n = t[t.length - 1].clone().sub(n).normalize() , i = new Cn(0,0,1).cross(n).clone().multiplyScalar(e.width / 2); l.profileWindow.autoFitEnabled = !1; for (var r = 0; r < t.length; r++) e.setPosition(r, t[r].clone().add(i)) }), $("#potree_profile_move_backward").click(function() { var e = l.profile , t = e.points , n = t[0] , n = t[t.length - 1].clone().sub(n).normalize() , i = new Cn(0,0,1).cross(n).clone().multiplyScalar(-e.width / 2); l.profileWindow.autoFitEnabled = !1; for (var r = 0; r < t.length; r++) e.setPosition(r, t[r].clone().add(i)) }) } return h(n, [{ key: "setProfile", value: function(e) { null !== this.profile && this.profile !== e && (this.profile.removeEventListener("marker_moved", this._recompute), this.profile.removeEventListener("marker_added", this._recompute), this.profile.removeEventListener("marker_removed", this._recompute), this.profile.removeEventListener("width_changed", this._recompute)), this.profile = e, this.profile.addEventListener("marker_moved", this._recompute), this.profile.addEventListener("marker_added", this._recompute), this.profile.addEventListener("marker_removed", this._recompute), this.profile.addEventListener("width_changed", this._recompute), this.recompute() } }, { key: "reset", value: function() { if (this.profileWindow.reset(), this.numPoints = 0, this.profile) { var e, t = ue(this.requests); try { for (t.s(); !(e = t.n()).done; ) e.value.cancel() } catch (e) { t.e(e) } finally { t.f() } } } }, { key: "progressHandler", value: function(e, t) { var n, i = ue(t.segments); try { for (i.s(); !(n = i.n()).done; ) { var r = n.value; this.profileWindow.addPoints(e, r.points), this.numPoints += r.points.numPoints } } catch (e) { i.e(e) } finally { i.f() } } }, { key: "cancel", value: function() { var e, t = ue(this.requests); try { for (t.s(); !(e = t.n()).done; ) e.value.cancel() } catch (e) { t.e(e) } finally { t.f() } this.requests = [] } }, { key: "finishLevelThenCancel", value: function() { var e, t = ue(this.requests); try { for (t.s(); !(e = t.n()).done; ) e.value.finishLevelThenCancel() } catch (e) { t.e(e) } finally { t.f() } this.requests = [] } }, { key: "recompute", value: function() { var n = this; if (this.profile && !(null !== this.scheduledRecomputeTime && this.scheduledRecomputeTime > (new Date).getTime())) { this.scheduledRecomputeTime = (new Date).getTime() + 100, this.scheduledRecomputeTime = null, this.reset(); var i, t = ue(this.viewer.scene.pointclouds.filter(function(e) { return e.visible })); try { for (t.s(); !(i = t.n()).done; ) !function() { var t = i.value , e = t.getPointsInProfile(n.profile, null, { onProgress: function(e) { n.enabled && (n.progressHandler(t, e.points), n.numPoints > n.threshold && n.finishLevelThenCancel()) }, onFinish: function(e) { n.enabled }, onCancel: function() { n.enabled } }); n.requests.push(e) }() } catch (e) { t.e(e) } finally { t.f() } } } }]), n }() , Ey = function() { function o() { O(this, o) } return h(o, null, [{ key: "measurementToFeatures", value: function(e) { var t, n = e.points.map(function(e) { return e.position.toArray() }), i = []; return 1 === n.length ? (t = { type: "Feature", geometry: { type: "Point", coordinates: n[0] }, properties: { name: e.name } }, i.push(t)) : 1 < n.length && !e.closed ? (t = { type: "Feature", geometry: { type: "LineString", coordinates: n }, properties: { name: e.name } }, i.push(t)) : 1 < n.length && e.closed && (n = { type: "Feature", geometry: { type: "Polygon", coordinates: [[].concat(Q(n), [n[0]])] }, properties: { name: e.name } }, i.push(n)), e.showDistances && e.edgeLabels.forEach(function(e) { e = { type: "Feature", geometry: { type: "Point", coordinates: e.position.toArray() }, properties: { distance: e.text } }; i.push(e) }), e.showArea && (e = { type: "Feature", geometry: { type: "Point", coordinates: e.areaLabel.position.toArray() }, properties: { area: e.areaLabel.text } }, i.push(e)), i } }, { key: "toString", value: function(e) { var t, n = [], i = ue(e = (e = !(e instanceof Array) ? [e] : e).filter(function(e) { return e instanceof Wf })); try { for (i.s(); !(t = i.n()).done; ) var r = t.value , a = o.measurementToFeatures(r) , n = n.concat(a) } catch (e) { i.e(e) } finally { i.f() } return JSON.stringify({ type: "FeatureCollection", features: n }, null, "\t") } }]), o }() , _y = function() { function d() { O(this, d) } return h(d, null, [{ key: "measurementPointSection", value: function(e) { e = e.points[0].position; return e ? "0\nCIRCLE\n8\nlayer_point\n10\n".concat(e.x, "\n20\n").concat(e.y, "\n30\n").concat(e.z, "\n40\n1.0\n") : "" } }, { key: "measurementPolylineSection", value: function(e) { var t = 8; e.closed && (t += 1); var n, i = "0\nPOLYLINE\n8\nlayer_polyline\n62\n1\n66\n1\n10\n0.0\n20\n0.0\n30\n0.0\n70\n".concat(t, "\n"), r = 0, a = 0, o = 0, s = ue(e.points); try { for (s.s(); !(n = s.n()).done; ) { var l = (l = n.value).position , r = Math.max(r, l.x) , a = Math.max(a, l.y) , o = Math.max(o, l.z); i += "0\nVERTEX\n8\n0\n10\n".concat(l.x, "\n20\n").concat(l.y, "\n30\n").concat(l.z, "\n70\n32\n") } } catch (e) { s.e(e) } finally { s.f() } return i += "0\nSEQEND\n" } }, { key: "measurementSection", value: function(e) { return 0 === e.points.length ? "" : 1 === e.points.length ? d.measurementPointSection(e) : 2 <= e.points.length ? d.measurementPolylineSection(e) : void 0 } }, { key: "toString", value: function(e) { var t, n = (e = (e = !(e instanceof Array) ? [e] : e).filter(function(e) { return e instanceof Wf })).filter(function(e) { return e instanceof Wf }).map(function(e) { return e.points }).reduce(function(e, t) { return e.concat(t) }).map(function(e) { return e.position }), i = new Cn(1 / 0,1 / 0,1 / 0), r = new Cn(-1 / 0,-1 / 0,-1 / 0), a = ue(n); try { for (a.s(); !(t = a.n()).done; ) { var o = t.value; i.min(o), r.max(o) } } catch (e) { a.e(e) } finally { a.f() } var s, n = "999\nDXF created from potree\n0\nSECTION\n2\nHEADER\n9\n$ACADVER\n1\nAC1006\n9\n$INSBASE\n10\n0.0\n20\n0.0\n30\n0.0\n9\n$EXTMIN\n10\n".concat(i.x, "\n20\n").concat(i.y, "\n30\n").concat(i.z, "\n9\n$EXTMAX\n10\n").concat(r.x, "\n20\n").concat(r.y, "\n30\n").concat(r.z, "\n0\nENDSEC\n"), l = "0\nSECTION\n2\nENTITIES\n", u = ue(e); try { for (u.s(); !(s = u.n()).done; ) { var c = s.value; l += d.measurementSection(c) } } catch (e) { u.e(e) } finally { u.f() } return n + (l += "0\nENDSEC\n") + "0\nEOF" } }]), d }() , My = function() { function r(e, t, n) { var i = this; O(this, r), this.viewer = e, this.measurement = t, this.propertiesPanel = n, this._update = function() { i.update() } } return h(r, [{ key: "createCoordinatesTable", value: function(e) { var r, a = this, o = $('\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\t\n\t\t\t\t\n\t\t\t
xyz
\n\t\t'), s = Potree.resourcePath + "/icons/copy.svg", t = ue(e); try { for (t.s(); !(r = t.n()).done; ) !function() { var t = r.value , e = Jf.addCommas(t.x.toFixed(3)) , n = Jf.addCommas(t.y.toFixed(3)) , i = Jf.addCommas(t.z.toFixed(3)) , i = $("\n\t\t\t\t\n\t\t\t\t\t".concat(e, "\n\t\t\t\t\t").concat(n, "\n\t\t\t\t\t").concat(i, '\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t')); a.elCopy = i.find("img[name=copy]"), a.elCopy.click(function() { var e = t.toArray().map(function(e) { return e.toFixed(3) }).join(", "); Jf.clipboardCopy(e), a.viewer.postMessage("Copied value to clipboard:
'".concat(e, "'"), { duration: 3e3 }) }), o.append(i) }() } catch (e) { t.e(e) } finally { t.f() } return o } }, { key: "createAttributesTable", value: function() { var e = $('
'); this.measurement.points[0]; return e } }, { key: "update", value: function() {} }]), r }() , Ay = function() { y(i, My); var n = w(i); function i(e, r, t) { O(this, i); var a = n.call(this, e, r, t) , t = Potree.resourcePath + "/icons/remove.svg"; return a.elContent = $('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')), a.elRemove = a.elContent.find("img[name=remove]"), a.elRemove.click(function() { a.viewer.scene.removeMeasurement(r) }), a.elMakeProfile = a.elContent.find("input[name=make_profile]"), a.elMakeProfile.click(function() { var e = new Kp; e.name = r.name, e.width = r.getTotalDistance() / 50; var t, n = ue(r.points); try { for (n.s(); !(t = n.n()).done; ) { var i = t.value; e.addMarker(i.position.clone()) } } catch (e) { n.e(e) } finally { n.f() } a.viewer.scene.addProfile(e) }), a.propertiesPanel.addVolatileListener(r, "marker_added", a._update), a.propertiesPanel.addVolatileListener(r, "marker_removed", a._update), a.propertiesPanel.addVolatileListener(r, "marker_moved", a._update), a.update(), a } return h(i, [{ key: "update", value: function() { var e = this.elContent.find(".coordinates_table_container"); e.empty(), e.append(this.createCoordinatesTable(this.measurement.points)); for (var t = this.measurement.points, n = [], i = 0; i < t.length - 1; i++) { var r = t[i].distanceTo(t[i + 1]); n.push(r.toFixed(3)) } var e = this.measurement.getTotalDistance().toFixed(3) , a = this.elContent.find("#distances_table"); a.empty(); for (var o = 0; o < n.length; o++) { var s = n[o] , s = $("\n\t\t\t\t\n\t\t\t\t\t".concat(0 === o ? "Distances: " : "", '\n\t\t\t\t\t').concat(s, "\n\t\t\t\t")); a.append(s) } e = $('\n\t\t\t\n\t\t\t\tTotal: '.concat(e, "\n\t\t\t")); a.append(e) } }]), i }() , Ty = function() { y(a, My); var r = w(a); function a(e, t, n) { O(this, a); var i = r.call(this, e, t, n) , n = Potree.resourcePath + "/icons/remove.svg"; return i.elContent = $('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')), i.elRemove = i.elContent.find("img[name=remove]"), i.elRemove.click(function() { i.viewer.scene.removeMeasurement(t) }), i.propertiesPanel.addVolatileListener(t, "marker_added", i._update), i.propertiesPanel.addVolatileListener(t, "marker_removed", i._update), i.propertiesPanel.addVolatileListener(t, "marker_moved", i._update), i.update(), i } return h(a, [{ key: "update", value: function() { var e = this.elContent.find(".coordinates_table_container"); e.empty(), e.append(this.createCoordinatesTable(this.measurement.points)); e = this.elContent.find(".attributes_table_container"); e.empty(), e.append(this.createAttributesTable()) } }]), a }() , Sy = function() { y(a, My); var r = w(a); function a(e, t, n) { O(this, a); var i = r.call(this, e, t, n) , n = Potree.resourcePath + "/icons/remove.svg"; return i.elContent = $('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\tArea: \n\t\t\t\t\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')), i.elRemove = i.elContent.find("img[name=remove]"), i.elRemove.click(function() { i.viewer.scene.removeMeasurement(t) }), i.propertiesPanel.addVolatileListener(t, "marker_added", i._update), i.propertiesPanel.addVolatileListener(t, "marker_removed", i._update), i.propertiesPanel.addVolatileListener(t, "marker_moved", i._update), i.update(), i } return h(a, [{ key: "update", value: function() { var e = this.elContent.find(".coordinates_table_container"); e.empty(), e.append(this.createCoordinatesTable(this.measurement.points)), this.elContent.find("#measurement_area").html(this.measurement.area.value.toFixed(3)) } }]), a }() , Cy = function() { y(a, My); var r = w(a); function a(e, t, n) { O(this, a); var i = r.call(this, e, t, n) , n = Potree.resourcePath + "/icons/remove.svg"; return i.elContent = $('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
αβγ
\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')), i.elRemove = i.elContent.find("img[name=remove]"), i.elRemove.click(function() { i.viewer.scene.removeMeasurement(t) }), i.propertiesPanel.addVolatileListener(t, "marker_added", i._update), i.propertiesPanel.addVolatileListener(t, "marker_removed", i._update), i.propertiesPanel.addVolatileListener(t, "marker_moved", i._update), i.update(), i } return h(a, [{ key: "update", value: function() { var e = this.elContent.find(".coordinates_table_container"); e.empty(), e.append(this.createCoordinatesTable(this.measurement.points.map(function(e) { return e.position }))); for (var t = [], n = 0; n < this.measurement.points.length; n++) t.push(this.measurement.getAngle(n) * (180 / Math.PI)); var t = t.map(function(e) { return e.toFixed(1) + "°" }) , i = this.elContent.find("#angle_cell_alpha") , r = this.elContent.find("#angle_cell_betta") , e = this.elContent.find("#angle_cell_gamma"); i.html(t[0]), r.html(t[1]), e.html(t[2]) } }]), a }() , Py = function() { y(a, My); var r = w(a); function a(e, t, n) { O(this, a); var i = r.call(this, e, t, n) , n = Potree.resourcePath + "/icons/remove.svg"; return i.elContent = $('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')), i.elRemove = i.elContent.find("img[name=remove]"), i.elRemove.click(function() { i.viewer.scene.removeMeasurement(t) }), i.propertiesPanel.addVolatileListener(t, "marker_added", i._update), i.propertiesPanel.addVolatileListener(t, "marker_removed", i._update), i.propertiesPanel.addVolatileListener(t, "marker_moved", i._update), i.update(), i } return h(a, [{ key: "update", value: function() { var e = this.elContent.find(".coordinates_table_container"); e.empty(), e.append(this.createCoordinatesTable(this.measurement.points.map(function(e) { return e.position }))); var t, n, i, r, a = this.elContent.find("#infos_table"); 3 === this.measurement.points.length ? (t = this.measurement.points[0].position, i = this.measurement.points[1].position, r = this.measurement.points[2].position, e = (n = Potree.Utils.computeCircleCenter(t, i, r)).distanceTo(t), i = 2 * Math.PI * e, t = "".concat((r = function(e) { return Potree.Utils.addCommas(e.toFixed(3)) } )(n.x), " ").concat(r(n.y), " ").concat(r(n.z)), n = r(e), e = r(i), r = 'style="width: 100%; padding: 5px;"', a.html("\n\t\t\t\n\t\t\t\tCenter: \n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t').concat(t, "\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\tRadius: \n\t\t\t\t").concat(n, "\n\t\t\t\n\t\t\t\n\t\t\t\tCircumference: \n\t\t\t\t").concat(e, "\n\t\t\t\n\t\t"))) : a.empty() } }]), a }() , Dy = function() { y(a, My); var r = w(a); function a(e, t, n) { O(this, a); var i = r.call(this, e, t, n) , n = Potree.resourcePath + "/icons/remove.svg"; return i.elContent = $('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\tHeight:
\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')), i.elRemove = i.elContent.find("img[name=remove]"), i.elRemove.click(function() { i.viewer.scene.removeMeasurement(t) }), i.propertiesPanel.addVolatileListener(t, "marker_added", i._update), i.propertiesPanel.addVolatileListener(t, "marker_removed", i._update), i.propertiesPanel.addVolatileListener(t, "marker_moved", i._update), i.update(), i } return h(a, [{ key: "update", value: function() { var e = this.elContent.find(".coordinates_table_container"); e.empty(), e.append(this.createCoordinatesTable(this.measurement.points.map(function(e) { return e.position }))); var t = this.measurement.points.slice().sort(function(e, t) { return e.position.z - t.position.z }) , e = t[0].position.clone() , t = t[t.length - 1].position.clone() , e = e.z , e = (e = t.z - e).toFixed(3); this.elHeightLabel = this.elContent.find("#height_label"), this.elHeightLabel.html("Height: ".concat(e)) } }]), a }() , ky = function() { y(l, My); var e, s = w(l); function l(e, t, n) { O(this, l); var i = s.call(this, e, t, n) , r = Potree.resourcePath + "/icons/copy.svg" , a = Potree.resourcePath + "/icons/remove.svg" , o = new Map([[Zp, "length"], [Qp, "rx"]]).get(t.constructor) , e = new Map([[Zp, "width"], [Qp, "ry"]]).get(t.constructor) , n = new Map([[Zp, "height"], [Qp, "rz"]]).get(t.constructor); return i.elContent = $('\n\t\t\t
\n\t\t\t\t\n\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
αβγ
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
').concat(o, "").concat(e, "").concat(n, '
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\n\t\t\t\t
\n\t\t\t\tVolume: \n\t\t\t\t\n\n\t\t\t\t\x3c!--\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t
  • --\x3e\n\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t
  • \n\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t
  • \n\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
  • \n\t\t\t\t
    \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t
    \n\t\t')), i.elDownloadButton = i.elContent.find("input[name=download_volume]"), i.propertiesPanel.viewer.server ? i.elDownloadButton.click(function() { return i.download() }) : i.elDownloadButton.hide(), i.elCopyRotation = i.elContent.find("img[name=copyRotation]"), i.elCopyRotation.click(function() { var e = i.measurement.rotation.toArray().slice(0, 3).map(function(e) { return e.toFixed(3) }).join(", "); Jf.clipboardCopy(e), i.viewer.postMessage("Copied value to clipboard:
    '".concat(e, "'"), { duration: 3e3 }) }), i.elCopyScale = i.elContent.find("img[name=copyScale]"), i.elCopyScale.click(function() { var e = i.measurement.scale.toArray().map(function(e) { return e.toFixed(3) }).join(", "); Jf.clipboardCopy(e), i.viewer.postMessage("Copied value to clipboard:
    '".concat(e, "'"), { duration: 3e3 }) }), i.elRemove = i.elContent.find("img[name=remove]"), i.elRemove.click(function() { i.viewer.scene.removeVolume(t) }), i.elContent.find("#volume_reset_orientation").click(function() { t.rotation.set(0, 0, 0) }), i.elContent.find("#volume_make_uniform").click(function() { var e = (t.scale.x + t.scale.y + t.scale.z) / 3; t.scale.set(e, e, e) }), i.elCheckClip = i.elContent.find("#volume_clip"), i.elCheckClip.click(function(e) { i.measurement.clip = e.target.checked }), i.elCheckShow = i.elContent.find("#volume_show"), i.elCheckShow.click(function(e) { i.measurement.visible = e.target.checked }), i.propertiesPanel.addVolatileListener(t, "position_changed", i._update), i.propertiesPanel.addVolatileListener(t, "orientation_changed", i._update), i.propertiesPanel.addVolatileListener(t, "scale_changed", i._update), i.propertiesPanel.addVolatileListener(t, "clip_changed", i._update), i.update(), i } return h(l, [{ key: "download", value: (e = r(regeneratorRuntime.mark(function e() { var t, n, i, r, a, o, s, l, u, c, d, h, p, f, m, v, g, y, w, b, x, E, _, M, A, T, S, C, P, D, k, B, L, R; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: for (u = this.measurement, w = [], v = u.matrixWorld, t = new Cn(.5,0,0).applyMatrix4(v), n = new Cn(-.5,0,0).applyMatrix4(v), i = new Cn(0,.5,0).applyMatrix4(v), r = new Cn(0,-.5,0).applyMatrix4(v), m = new Cn(0,0,.5).applyMatrix4(v), f = new Cn(0,0,-.5).applyMatrix4(v), a = (new Cn).subVectors(n, t).normalize(), o = a.clone().multiplyScalar(-1), s = (new Cn).subVectors(r, i).normalize(), l = s.clone().multiplyScalar(-1), u = (new Cn).subVectors(f, m).normalize(), v = u.clone().multiplyScalar(-1), m = [(new ki).setFromNormalAndCoplanarPoint(a, t), (new ki).setFromNormalAndCoplanarPoint(o, n), (new ki).setFromNormalAndCoplanarPoint(s, i), (new ki).setFromNormalAndCoplanarPoint(l, r), (new ki).setFromNormalAndCoplanarPoint(u, m), (new ki).setFromNormalAndCoplanarPoint(v, f)], c = [], d = 0, h = m; d < h.length; d++) p = [(p = h[d]).normal.toArray(), p.constant].join(","), p = "[".concat(p, "]"), c.push(p); v = "[" + c.join(",") + "]", w.push(v), f = w.join(","), m = [], v = ue(this.viewer.scene.pointclouds), e.prev = 23, v.s(); case 25: if ((y = v.n()).done) { e.next = 39; break } if ((g = y.value).visible) { e.next = 29; break } return e.abrupt("continue", 37); case 29: w = g.pcoGeometry.offset.clone(), y = (y = new ni).makeTranslation.apply(y, Q(w.multiplyScalar(-1).toArray())), w = g.matrixWorld, w = (new ni).multiplyMatrices(w, y), y = "".concat(window.location.pathname, "/../").concat(g.pcoGeometry.url), w = { path: y, transform: w.elements }, w = JSON.stringify(w), m.push(w); case 37: e.next = 25; break; case 39: e.next = 44; break; case 41: e.prev = 41, e.t0 = e.catch(23), v.e(e.t0); case 44: return e.prev = 44, v.f(), e.finish(44); case 47: return M = m.join(","), b = this.elContent.find("div[name=download_message]"), x = function(e) { b.html('
    ERROR: '.concat(e, "
    ")) } , E = function(e) { b.html("".concat(e)) } , _ = null, M = "".concat(viewer.server, "/create_regions_filter?pointclouds=[").concat(M, "]®ions=[").concat(f, "]"), E("estimating results ..."), e.next = 56, fetch(M); case 56: return M = e.sent, e.next = 59, M.json(); case 59: if ((A = e.sent).handle) { e.next = 65; break } return x(A.message), e.abrupt("return"); case 65: _ = A.handle; case 66: T = "".concat(viewer.server, "/check_regions_filter?handle=").concat(_), S = function(n) { return new Promise(function(e, t) { setTimeout(function() { e() }, n) } ) } , C = function(e) { var t = e.progress , e = e.estimate , e = t["processed points"] / e.points , e = parseInt(100 * e); E("progress: ".concat(e, "%")) } , P = function(e) { var t = "downloads ready:
    "; t += "
      "; for (var n = 0; n < e.pointclouds.length; n++) { var i = "".concat(viewer.server, "/download_regions_filter_result?handle=").concat(_, "&index=").concat(n); t += '
    • result_').concat(n, ".las
    • \n") } var r = "".concat(viewer.server, "/download_regions_filter_report?handle=").concat(_); t += '
    • report.json
    • \n'), E(t += "
    ") } , D = function(e) { e = "Unexpected Response.
    status: ".concat(e.status, "
    message: ").concat(e.message); E(e) } , k = function(e) { e = "ERROR: ".concat(e.message); throw x(e), new Error(e) } , B = Date.now(); case 73: return e.next = 76, fetch(T); case 76: return R = e.sent, e.next = 79, R.json(); case 79: if ("ERROR" !== (L = e.sent).status) { e.next = 84; break } k(L), e.next = 94; break; case 84: if ("FILTERING" !== L.status) { e.next = 88; break } C(L), e.next = 94; break; case 88: if ("FINISHED" === L.status) return P(L), e.abrupt("break", 100); e.next = 93; break; case 93: D(L); case 94: return R = (Date.now() - B) / 1e3, R = R < 10 ? 100 : 1e3, e.next = 98, S(R); case 98: e.next = 73; break; case 100: case "end": return e.stop() } }, e, this, [[23, 41, 44, 47]]) })), function() { return e.apply(this, arguments) } ) }, { key: "update", value: function() { var e = this.elContent.find(".coordinates_table_container"); e.empty(), e.append(this.createCoordinatesTable([this.measurement.position])); var t = this.measurement.rotation.toVector3(); t = (t = (t = t.toArray()).map(function(e) { return 180 * e / Math.PI })).map(function(e) { return e.toFixed(1) + "°" }); var n = this.elContent.find("#angle_cell_alpha") , i = this.elContent.find("#angle_cell_betta") , e = this.elContent.find("#angle_cell_gamma"); n.html(t[0]), i.html(t[1]), e.html(t[2]); n = (n = this.measurement.scale.toArray()).map(function(e) { return Jf.addCommas(e.toFixed(2)) }), i = this.elContent.find("#cell_length"), e = this.elContent.find("#cell_width"), t = this.elContent.find("#cell_height"); i.html(n[0]), e.html(n[1]), t.html(n[2]); t = this.elContent.find("#measurement_volume"), n = this.measurement.getVolume(); t.html(Jf.addCommas(n.toFixed(2))), this.elCheckClip.prop("checked", this.measurement.clip), this.elCheckShow.prop("checked", this.measurement.visible) } }]), l }() , By = function() { y(o, My); var e, a = w(o); function o(e, i, t) { O(this, o); var n = a.call(this, e, i, t) , t = Potree.resourcePath + "/icons/remove.svg"; n.elContent = $('\n\t\t\t
    \n\t\t\t\t\n\t\t\t\t
    \n\t\t\t\t\n\t\t\t\t\tWidth: \n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t
    \n\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t
  • \n\n\t\t\t\t
    \n\n\t\t\t\t\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
    \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t
    \n\t\t')), n.elRemove = n.elContent.find("img[name=remove]"), n.elRemove.click(function() { n.viewer.scene.removeProfile(i) }), n.elDownloadButton = n.elContent.find("input[name=download_profile]"), n.propertiesPanel.viewer.server ? n.elDownloadButton.click(function() { return n.download() }) : n.elDownloadButton.hide(); var r = n.elContent.find("#sldProfileWidth"); r.spinner({ min: 0, max: 1e7, step: .01, numberFormat: "n", start: function() {}, spin: function(e, t) { var n = r.spinner("value"); i.setWidth(n) }, change: function(e, t) { var n = r.spinner("value"); i.setWidth(n) }, stop: function(e, t) { var n = r.spinner("value"); i.setWidth(n) }, incremental: function(e) { var t = r.spinner("value") , n = r.spinner("option", "step"); return Math.max(1, parseInt(.05 * t / n)) } }), r.spinner("value", i.getWidth()), r.spinner("widget").css("width", "100%"); return n.propertiesPanel.addVolatileListener(i, "width_changed", function(e) { r.spinner("value") !== i.getWidth() && r.spinner("value", i.getWidth()) }), n.elContent.find("#show_2d_profile").click(function() { n.propertiesPanel.viewer.profileWindow.show(), n.propertiesPanel.viewer.profileWindowController.setProfile(i) }), n.propertiesPanel.addVolatileListener(i, "marker_added", n._update), n.propertiesPanel.addVolatileListener(i, "marker_removed", n._update), n.propertiesPanel.addVolatileListener(i, "marker_moved", n._update), n.update(), n } return h(o, [{ key: "update", value: function() { var e = this.elContent.find(".coordinates_table_container"); e.empty(), e.append(this.createCoordinatesTable(this.measurement.points)) } }, { key: "download", value: (e = r(regeneratorRuntime.mark(function e() { var t, n, i, r, a, o, s, l, u, c, d, h, p, f, m, v, g, y, w, b, x, E, _, M, A, T, S, C, P, D, k, B, L, R, F, I, O, z, N, U, G, H, V; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: A = this.measurement, t = [], C = A.getSegments(), n = A.width, i = ue(C); try { for (i.s(); !(r = i.n()).done; ) { for (a = r.value, o = a.start.clone().multiply(new Cn(1,1,0)), s = a.end.clone().multiply(new Cn(1,1,0)), l = (new Cn).addVectors(o, s).multiplyScalar(.5), u = (new Cn).subVectors(s, o).normalize(), c = (new Cn).subVectors(o, s).normalize(), d = new Cn(0,0,1), h = (new Cn).crossVectors(u, d), p = (new Cn).crossVectors(c, d), console.log(p), f = h.clone().multiplyScalar(.5 * n).add(l), m = p.clone().multiplyScalar(.5 * n).add(l), v = [(new ki).setFromNormalAndCoplanarPoint(u, o), (new ki).setFromNormalAndCoplanarPoint(c, s), (new ki).setFromNormalAndCoplanarPoint(p, f), (new ki).setFromNormalAndCoplanarPoint(h, m)], g = [], y = 0, w = v; y < w.length; y++) x = [(b = w[y]).normal.toArray(), b.constant].join(","), x = "[".concat(x, "]"), g.push(x); E = "[" + g.join(",") + "]", t.push(E) } } catch (e) { i.e(e) } finally { i.f() } _ = t.join(","), M = [], A = ue(this.viewer.scene.pointclouds), e.prev = 9, A.s(); case 11: if ((S = A.n()).done) { e.next = 25; break } if ((T = S.value).visible) { e.next = 15; break } return e.abrupt("continue", 23); case 15: C = T.pcoGeometry.offset.clone(), S = (S = new ni).makeTranslation.apply(S, Q(C.multiplyScalar(-1).toArray())), C = T.matrixWorld, C = (new ni).multiplyMatrices(C, S), S = "".concat(window.location.pathname, "/../").concat(T.pcoGeometry.url), C = { path: S, transform: C.elements }, C = JSON.stringify(C), M.push(C); case 23: e.next = 11; break; case 25: e.next = 30; break; case 27: e.prev = 27, e.t0 = e.catch(9), A.e(e.t0); case 30: return e.prev = 30, A.f(), e.finish(30); case 33: return L = M.join(","), P = this.elContent.find("div[name=download_message]"), D = function(e) { P.html('
    ERROR: '.concat(e, "
    ")) } , k = function(e) { P.html("".concat(e)) } , B = null, L = "".concat(viewer.server, "/create_regions_filter?pointclouds=[").concat(L, "]®ions=[").concat(_, "]"), k("estimating results ..."), e.next = 42, fetch(L); case 42: return L = e.sent, e.next = 45, L.json(); case 45: if ((R = e.sent).handle) { e.next = 51; break } return D(R.message), e.abrupt("return"); case 51: B = R.handle; case 52: F = "".concat(viewer.server, "/check_regions_filter?handle=").concat(B), I = function(n) { return new Promise(function(e, t) { setTimeout(function() { e() }, n) } ) } , O = function(e) { var t = e.progress , e = e.estimate , e = t["processed points"] / e.points , e = parseInt(100 * e); k("progress: ".concat(e, "%")) } , z = function(e) { var t = "downloads ready:
    "; t += "
      "; for (var n = 0; n < e.pointclouds.length; n++) { var i = "".concat(viewer.server, "/download_regions_filter_result?handle=").concat(B, "&index=").concat(n); t += '
    • result_').concat(n, ".las
    • \n") } var r = "".concat(viewer.server, "/download_regions_filter_report?handle=").concat(B); t += '
    • report.json
    • \n'), k(t += "
    ") } , N = function(e) { e = "Unexpected Response.
    status: ".concat(e.status, "
    message: ").concat(e.message); k(e) } , U = function(e) { e = "ERROR: ".concat(e.message); throw D(e), new Error(e) } , G = Date.now(); case 59: return e.next = 62, fetch(F); case 62: return V = e.sent, e.next = 65, V.json(); case 65: if ("ERROR" !== (H = e.sent).status) { e.next = 70; break } U(H), e.next = 80; break; case 70: if ("FILTERING" !== H.status) { e.next = 74; break } O(H), e.next = 80; break; case 74: if ("FINISHED" === H.status) return z(H), e.abrupt("break", 86); e.next = 79; break; case 79: N(H); case 80: return V = (Date.now() - G) / 1e3, V = V < 10 ? 100 : 1e3, e.next = 84, I(V); case 84: e.next = 59; break; case 86: case "end": return e.stop() } }, e, this, [[9, 27, 30, 33]]) })), function() { return e.apply(this, arguments) } ) }]), o }() , Ly = function() { function i(e, t) { var n = this; O(this, i), this.viewer = e, this.propertiesPanel = t, this._update = function() { n.update() } ; t = Potree.resourcePath + "/icons/copy.svg"; this.elContent = $('\n\t\t
    \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
    position
    \n\t\t\t\t\t\t\n\t\t\t\t\t
    target
    \n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t
    \n\t\t')), this.elCopyPosition = this.elContent.find("img[name=copyPosition]"), this.elCopyPosition.click(function() { var e = n.viewer.scene.getActiveCamera().position.toArray().map(function(e) { return e.toFixed(3) }).join(", "); Jf.clipboardCopy(e), n.viewer.postMessage("Copied value to clipboard:
    '".concat(e, "'"), { duration: 3e3 }) }), this.elCopyTarget = this.elContent.find("img[name=copyTarget]"), this.elCopyTarget.click(function() { var e = n.viewer.scene.view.getPivot().toArray().map(function(e) { return e.toFixed(3) }).join(", "); Jf.clipboardCopy(e), n.viewer.postMessage("Copied value to clipboard:
    '".concat(e, "'"), { duration: 3e3 }) }), this.propertiesPanel.addVolatileListener(e, "camera_changed", this._update), this.update() } return h(i, [{ key: "update", value: function() { var e = this.viewer.scene.getActiveCamera() , t = this.viewer.scene.view , e = e.position.toArray().map(function(e) { return Jf.addCommas(e.toFixed(3)) }); this.elContent.find("#camera_position_x").html(e[0]), this.elContent.find("#camera_position_y").html(e[1]), this.elContent.find("#camera_position_z").html(e[2]); t = t.getPivot().toArray().map(function(e) { return Jf.addCommas(e.toFixed(3)) }); this.elContent.find("#camera_target_x").html(t[0]), this.elContent.find("#camera_target_y").html(t[1]), this.elContent.find("#camera_target_z").html(t[2]) } }]), i }() , Ry = function() { function r(e, t, n) { var i = this; O(this, r), this.viewer = e, this.propertiesPanel = t, this.annotation = n, this._update = function() { i.update() } ; t = "".concat(Potree.resourcePath, "/icons/copy.svg"); this.elContent = $('\n\t\t
    \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\n\t\t\t
    position
    \n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\n\t\t\t
    \n\n\t\t\t\t
    Title
    \n\t\t\t\t
    \n\t\t\t\t\tAnnotation Title\n\t\t\t\t
    \n\n\t\t\t\t
    Description
    \n\t\t\t\t
    \n\t\t\t\t\tA longer description of this annotation. \n\t\t\t\t\t\tCan be multiple lines long. TODO: the user should be able\n\t\t\t\t\t\tto modify title and description. \n\t\t\t\t
    \n\n\t\t\t
    \n\n\t\t
    \n\t\t')), this.elCopyPosition = this.elContent.find("img[name=copyPosition]"), this.elCopyPosition.click(function() { var e = i.annotation.position.toArray().map(function(e) { return e.toFixed(3) }).join(", "); Jf.clipboardCopy(e), i.viewer.postMessage("Copied value to clipboard:
    '".concat(e, "'"), { duration: 3e3 }) }), this.elTitle = this.elContent.find("#annotation_title").html(n.title), this.elDescription = this.elContent.find("#annotation_description").html(n.description), this.elTitle[0].addEventListener("input", function() { var e = i.elTitle.html(); n.title = e }, !1), this.elDescription[0].addEventListener("input", function() { var e = i.elDescription.html(); n.description = e }, !1), this.update() } return h(r, [{ key: "update", value: function() { var e = this.annotation , t = this.elContent , n = this.elTitle , i = this.elDescription , r = e.position.toArray().map(function(e) { return Jf.addCommas(e.toFixed(3)) }); t.find("#annotation_position_x").html(r[0]), t.find("#annotation_position_y").html(r[1]), t.find("#annotation_position_z").html(r[2]), n.html(e.title), i.html(e.description) } }]), r }() , Fy = function() { function n(l, e, u) { O(this, n), this.viewer = l, this.propertiesPanel = e, this.animation = u, this.elContent = $('\n\t\t\t
    \n\t\t\t\t\n\n\t\t\t\t\n\n\t\t\t\t\t\n\t\t\t\t\t\tDuration: \n\t\t\t\t\t\t\n\t\t\t\t\t\n\n\t\t\t\t\tTime:
    \n\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t
    \n\t\t'), this.elContent.find("input[name=play]").click(function() { u.play() }), this.elContent.find("#sldTime").slider({ value: 0, min: 0, max: 1, step: .001, slide: function(e, t) { u.set(t.value), u.updateFrustum() } }); var i = this.elContent.find("input[name=spnDuration]"); i.spinner({ min: 0, max: 300, step: .01, numberFormat: "n", start: function() {}, spin: function(e, t) { var n = i.spinner("value"); u.setDuration(n) }, change: function(e, t) { var n = i.spinner("value"); u.setDuration(n) }, stop: function(e, t) { var n = i.spinner("value"); u.setDuration(n) }, incremental: function(e) { var t = i.spinner("value") , n = i.spinner("option", "step"); return Math.max(1, parseInt(.05 * t / n)) } }), i.spinner("value", u.getDuration()), i.spinner("widget").css("width", "100%"); function t() { function o(e) { var t = $('\n\t\t\t\t\t
    \n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t'); t.find("input[name=add]").click(function() { u.createControlPoint(e), u.changeCallback() }), c.append(t) } c.empty(); var s = 0; o(s), u.posCurve.points.forEach(function(e) { var t, n, i, r, a; t = s, n = $('\n\t\t\t\t\t
    \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tkeyframe\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t')), i = n.find("img[name=assign]"), r = n.find("img[name=move]"), a = n.find("img[name=delete]"), i.click(function() { u.posCurve.points[t].copy(l.scene.view.position), u.targetCurve.points[t].copy(l.scene.view.getPivot()), u.changeCallback() }), r.click(function() { l.scene.view.position.copy(u.posCurve.points[t]), l.scene.view.lookAt(u.targetCurve.points[t]) }), a.click(function() { u.removeControlPoint(t), u.changeCallback() }), c.append(n), o(++s) }) } var c = this.elContent.find("#animation_keyframes"); t(), u.addEventListener("controlpoint_added", t), u.addEventListener("controlpoint_removed", t) } return h(n, [{ key: "update", value: function() {} }]), n }() , Iy = function() { function n(e, t) { O(this, n), this.container = e, this.viewer = t, this.object = null, this.cleanupTasks = [], this.scene = null } return h(n, [{ key: "setScene", value: function(e) { this.scene = e } }, { key: "set", value: function(e) { if (this.object !== e) { this.object = e; var t, n = ue(this.cleanupTasks); try { for (n.s(); !(t = n.n()).done; ) (0, t.value)() } catch (e) { n.e(e) } finally { n.f() } this.cleanupTasks = [], this.container.empty(), e instanceof xm ? this.setPointCloud(e) : e instanceof Wf || e instanceof Kp || e instanceof Yp ? this.setMeasurement(e) : e instanceof Kr ? this.setCamera(e) : e instanceof Kf ? this.setAnnotation(e) : e instanceof bv && this.setCameraAnimation(e) } } }, { key: "addVolatileListener", value: function(e, t, n) { e.addEventListener(t, n), this.cleanupTasks.push(function() { e.removeEventListener(t, n) }) } }, { key: "setPointCloud", value: function(f) { var t = this , m = f.material , v = $('\n\t\t\t
    \n\t\t\t\t
      \n\n\t\t\t\t
    • \n\t\t\t\t
      \n\t\t\t\t
    • \n\t\t\t\t
    • \n\t\t\t\t
      \n\t\t\t\t
    • \n\n\t\t\t\t\x3c!-- SIZE TYPE --\x3e\n\t\t\t\t
    • \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
    • \n\n\t\t\t\t\x3c!-- SHAPE --\x3e\n\t\t\t\t
    • \n\t\t\t\t\t
      \n\t\t\t\t\t\n\t\t\t\t
    • \n\n\t\t\t\t
    • \n\t\t\t\t\n\t\t\t\t
    • \n\t\t\t\t\n\t\t\t\t\x3c!-- OPACITY --\x3e\n\t\t\t\t
    • :
    • \n\n\t\t\t\t
      \n\t\t\t\t\tAttribute\n\t\t\t\t
      \n\n\t\t\t\t
    • \n\t\t\t\t\t\n\t\t\t\t
    • \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tAttribute Weights\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • RGB:
      \t
    • \n\t\t\t\t\t
    • Intensity:
      \t
    • \n\t\t\t\t\t
    • Elevation:
      \t
    • \n\t\t\t\t\t
    • Classification:
      \t
    • \n\t\t\t\t\t
    • Return Number:
      \t
    • \n\t\t\t\t\t
    • Source ID:
      \t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tRGB\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • Gamma:
      \t
    • \n\t\t\t\t\t
    • Brightness:
      \t
    • \n\t\t\t\t\t
    • Contrast:
      \t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tExtra Attribute\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • :
    • \n\n\t\t\t\t\t
    • Gamma:
    • \n\t\t\t\t\t
    • Brightness:
    • \n\t\t\t\t\t
    • Contrast:
    • \n\t\t\t\t
      \n\t\t\t\t\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tMATCAP\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • \n\t\t\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tColor\n\t\t\t\t\t
      \n\n\t\t\t\t\t\n\t\t\t\t
      \n\n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tElevation\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • :
      \t
    • \n\n\t\t\t\t\t
    • \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
    • \n\n\t\t\t\t\t
    • \n\t\t\t\t\t\tGradient Scheme:\n\t\t\t\t\t\t
      \n\t\t\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tTransition\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • transition:
      \t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tIntensity\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • Range:
      \t
    • \n\t\t\t\t\t
    • Gamma:
      \t
    • \n\t\t\t\t\t
    • Brightness:
      \t
    • \n\t\t\t\t\t
    • Contrast:
      \t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tGPS Time\n\t\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tIndices\n\t\t\t\t\t
      \n\t\t\t\t
      \n\n\n\t\t\t\t
    \n\t\t\t
    \n\t\t'); v.i18n(), this.container.append(v); var n = v.find("#sldPointSize") , i = v.find("#lblPointSize"); n.slider({ value: m.size, min: 0, max: 3, step: .01, slide: function(e, t) { m.size = t.value } }); function e(e) { i.html(m.size.toFixed(2)), n.slider({ value: m.size }) } this.addVolatileListener(m, "point_size_changed", e), e(); var r = v.find("#sldMinPointSize") , a = v.find("#lblMinPointSize"); r.slider({ value: m.size, min: 0, max: 3, step: .01, slide: function(e, t) { m.minSize = t.value } }); function o(e) { a.html(m.minSize.toFixed(2)), r.slider({ value: m.minSize }) } this.addVolatileListener(m, "point_size_changed", o), o(); var s = Object.keys(am)[m.pointSizeType] , l = v.find("#optPointSizing"); l.selectmenu(), l.val(s).selectmenu("refresh"), l.selectmenu({ change: function(e, t) { m.pointSizeType = am[t.item.value] } }); var u = v.find("#optShape"); u.selectmenu({ change: function(e, t) { t = t.item.value; m.shape = om[t] } }); function c() { var e = Object.keys(om)[m.shape]; u.selectmenu().val(e).selectmenu("refresh") } this.addVolatileListener(m, "point_shape_changed", c), c(); var d = v.find("#set_backface_culling"); d.click(function() { m.backfaceCulling = d.prop("checked") }); function h() { var e = m.backfaceCulling; d.prop("checked", e) } this.addVolatileListener(m, "backface_changed", h), h(); s = $("#materials_backface_container"); s.css("display", "none"); l = f.pcoGeometry.pointAttributes; !!l.hasNormals && l.hasNormals() && s.css("display", "block"); var p = v.find("#sldOpacity") , g = v.find("#lblOpacity"); p.slider({ value: m.opacity, min: 0, max: 1, step: .001, slide: function(e, t) { m.opacity = t.value } }); function y(e) { g.html(m.opacity.toFixed(2)), p.slider({ value: m.opacity }) } this.addVolatileListener(m, "opacity_changed", y), y(); l = f.pcoGeometry.pointAttributes.attributes; (s = []).push.apply(s, Q(l.map(function(e) { return e.name }))); l = s.indexOf("intensity"); 0 <= l && s.splice(l + 1, 0, "intensity gradient"), s.push("elevation", "color", "matcap", "indices", "level of detail", "composite"); var w, b = ["POSITION_CARTESIAN", "position"], s = s.filter(function(e) { return !b.includes(e) }), x = v.find("#optMaterial"), E = ue(s); try { for (E.s(); !(w = E.n()).done; ) { var _ = w.value , M = $("")); x.append(M) } } catch (e) { E.e(e) } finally { E.f() } function A(e, t) { var n = x.selectmenu().val(); m.activeAttributeName = n; var i = f.getAttribute(n); !!(i = "intensity gradient" === n ? f.getAttribute("intensity") : i) && ["intensity", "intensity gradient"].includes(i.name) ? (f.material.intensityRange[0] === 1 / 0 && (f.material.intensityRange = i.range), l = (s = N(i.range, 2))[0], u = s[1], v.find("#sldIntensityRange").slider({ range: !0, min: l, max: u, step: .01, values: [l, u], slide: function(e, t) { var n = t.values[0] , t = t.values[1]; m.intensityRange = [n, t] } })) : i && (d = (c = N(i.range, 2))[0], h = c[1], p = (p = m.getRange(i.name)) || Q(i.range), "number" == typeof d && "number" == typeof h && v.find("#sldExtraRange").slider({ range: !0, min: d, max: h, step: .01, values: p, slide: function(e, t) { var n = N(t.values, 2) , t = n[0] , n = n[1]; m.setRange(i.name, [t, n]) } })); var r = $("#materials\\.composite_weight_container") , a = $("#materials\\.elevation_container") , o = $("#materials\\.rgb_container") , s = $("#materials\\.extra_container") , l = $("#materials\\.color_container") , u = $("#materials\\.intensity_container") , c = $("#materials\\.index_container") , d = $("#materials\\.transition_container") , h = $("#materials\\.gpstime_container") , p = $("#materials\\.matcap_container"); c.css("display", "none"), u.css("display", "none"), a.css("display", "none"), o.css("display", "none"), s.css("display", "none"), l.css("display", "none"), r.css("display", "none"), d.css("display", "none"), p.css("display", "none"), h.css("display", "none"), "composite" === n ? (r.css("display", "block"), a.css("display", "block"), o.css("display", "block"), u.css("display", "block")) : "elevation" === n ? a.css("display", "block") : "RGB and Elevation" === n ? (o.css("display", "block"), a.css("display", "block")) : "rgba" === n ? o.css("display", "block") : "color" === n ? l.css("display", "block") : "intensity" === n || "intensity gradient" === n ? u.css("display", "block") : "indices" === n ? c.css("display", "block") : "matcap" === n ? p.css("display", "block") : "classification" === n || ("gps-time" === n ? h.css("display", "block") : "number of returns" === n || "return number" === n || ["source id", "point source id"].includes(n) || s.css("display", "block")) } x.selectmenu({ change: A }); function T() { x.val(m.activeAttributeName).selectmenu("refresh") } this.addVolatileListener(m, "point_color_type_changed", T), this.addVolatileListener(m, "active_attribute_changed", T), T(), A(); var S, l = Object.keys(Potree.Gradients).map(function(e) { return { name: e, values: km[e] } }), C = v.find("#elevation_gradient_scheme_selection"), P = ue(l); try { for (P.s(); !(S = P.n()).done; ) !function() { var e = S.value , t = $('\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t') , n = Potree.Utils.createSvgGradient(e.values); n.setAttributeNS(null, "class", "button-icon"), t.append($(n)), t.click(function() { m.gradient = km[e.name] }), C.append(t) }() } catch (e) { P.e(e) } finally { P.f() } for (var s = [{ name: "Normals", icon: "".concat(Potree.resourcePath, "/icons/matcap/check_normal+y.jpg") }, { name: "Basic 1", icon: "".concat(Potree.resourcePath, "/icons/matcap/basic_1.jpg") }, { name: "Basic 2", icon: "".concat(Potree.resourcePath, "/icons/matcap/basic_2.jpg") }, { name: "Basic Dark", icon: "".concat(Potree.resourcePath, "/icons/matcap/basic_dark.jpg") }, { name: "Basic Side", icon: "".concat(Potree.resourcePath, "/icons/matcap/basic_side.jpg") }, { name: "Ceramic Dark", icon: "".concat(Potree.resourcePath, "/icons/matcap/ceramic_dark.jpg") }, { name: "Ceramic Lightbulb", icon: "".concat(Potree.resourcePath, "/icons/matcap/ceramic_lightbulb.jpg") }, { name: "Clay Brown", icon: "".concat(Potree.resourcePath, "/icons/matcap/clay_brown.jpg") }, { name: "Clay Muddy", icon: "".concat(Potree.resourcePath, "/icons/matcap/clay_muddy.jpg") }, { name: "Clay Studio", icon: "".concat(Potree.resourcePath, "/icons/matcap/clay_studio.jpg") }, { name: "Resin", icon: "".concat(Potree.resourcePath, "/icons/matcap/resin.jpg") }, { name: "Skin", icon: "".concat(Potree.resourcePath, "/icons/matcap/skin.jpg") }, { name: "Jade", icon: "".concat(Potree.resourcePath, "/icons/matcap/jade.jpg") }, { name: "Metal_ Anisotropic", icon: "".concat(Potree.resourcePath, "/icons/matcap/metal_anisotropic.jpg") }, { name: "Metal Carpaint", icon: "".concat(Potree.resourcePath, "/icons/matcap/metal_carpaint.jpg") }, { name: "Metal Lead", icon: "".concat(Potree.resourcePath, "/icons/matcap/metal_lead.jpg") }, { name: "Metal Shiny", icon: "".concat(Potree.resourcePath, "/icons/matcap/metal_shiny.jpg") }, { name: "Pearl", icon: "".concat(Potree.resourcePath, "/icons/matcap/pearl.jpg") }, { name: "Toon", icon: "".concat(Potree.resourcePath, "/icons/matcap/toon.jpg") }, { name: "Check Rim Light", icon: "".concat(Potree.resourcePath, "/icons/matcap/check_rim_light.jpg") }, { name: "Check Rim Dark", icon: "".concat(Potree.resourcePath, "/icons/matcap/check_rim_dark.jpg") }, { name: "Contours 1", icon: "".concat(Potree.resourcePath, "/icons/matcap/contours_1.jpg") }, { name: "Contours 2", icon: "".concat(Potree.resourcePath, "/icons/matcap/contours_2.jpg") }, { name: "Contours 3", icon: "".concat(Potree.resourcePath, "/icons/matcap/contours_3.jpg") }, { name: "Reflection Check Horizontal", icon: "".concat(Potree.resourcePath, "/icons/matcap/reflection_check_horizontal.jpg") }, { name: "Reflection Check Vertical", icon: "".concat(Potree.resourcePath, "/icons/matcap/reflection_check_vertical.jpg") }], D = v.find("#matcap_scheme_selection"), k = 0, B = s; k < B.length; k++) !function() { var e = B[k] , t = $('\n\t\t\t\t\t\t\n\t\t\t\t')); t.click(function() { m.matcap = e.icon.substring(e.icon.lastIndexOf("/")) }), D.append(t) }(); v.find("#sldRGBGamma").slider({ value: m.rgbGamma, min: 0, max: 4, step: .01, slide: function(e, t) { m.rgbGamma = t.value } }), v.find("#sldRGBContrast").slider({ value: m.rgbContrast, min: -1, max: 1, step: .01, slide: function(e, t) { m.rgbContrast = t.value } }), v.find("#sldRGBBrightness").slider({ value: m.rgbBrightness, min: -1, max: 1, step: .01, slide: function(e, t) { m.rgbBrightness = t.value } }), v.find("#sldExtraGamma").slider({ value: m.extraGamma, min: 0, max: 4, step: .01, slide: function(e, t) { m.extraGamma = t.value } }), v.find("#sldExtraBrightness").slider({ value: m.extraBrightness, min: -1, max: 1, step: .01, slide: function(e, t) { m.extraBrightness = t.value } }), v.find("#sldExtraContrast").slider({ value: m.extraContrast, min: -1, max: 1, step: .01, slide: function(e, t) { m.extraContrast = t.value } }), v.find("#sldHeightRange").slider({ range: !0, min: 0, max: 1e3, step: .01, values: [0, 1e3], slide: function(e, t) { m.heightMin = t.values[0], m.heightMax = t.values[1] } }), v.find("#sldIntensityGamma").slider({ value: m.intensityGamma, min: 0, max: 4, step: .01, slide: function(e, t) { m.intensityGamma = t.value } }), v.find("#sldIntensityContrast").slider({ value: m.intensityContrast, min: -1, max: 1, step: .01, slide: function(e, t) { m.intensityContrast = t.value } }), v.find("#sldIntensityBrightness").slider({ value: m.intensityBrightness, min: -1, max: 1, step: .01, slide: function(e, t) { m.intensityBrightness = t.value } }), v.find("#sldWeightRGB").slider({ value: m.weightRGB, min: 0, max: 1, step: .01, slide: function(e, t) { m.weightRGB = t.value } }), v.find("#sldWeightIntensity").slider({ value: m.weightIntensity, min: 0, max: 1, step: .01, slide: function(e, t) { m.weightIntensity = t.value } }), v.find("#sldWeightElevation").slider({ value: m.weightElevation, min: 0, max: 1, step: .01, slide: function(e, t) { m.weightElevation = t.value } }), v.find("#sldWeightClassification").slider({ value: m.weightClassification, min: 0, max: 1, step: .01, slide: function(e, t) { m.weightClassification = t.value } }), v.find("#sldWeightReturnNumber").slider({ value: m.weightReturnNumber, min: 0, max: 1, step: .01, slide: function(e, t) { m.weightReturnNumber = t.value } }), v.find("#sldWeightSourceID").slider({ value: m.weightSourceID, min: 0, max: 1, step: .01, slide: function(e, t) { m.weightSourceID = t.value } }), v.find("#materials\\.color\\.picker").spectrum({ flat: !0, showInput: !0, preferredFormat: "rgb", cancelText: "", chooseText: "Apply", color: "#".concat(m.color.getHexString()), move: function(e) { e = e.toRgb(), e = (new Yi).setRGB(e.r / 255, e.g / 255, e.b / 255); m.color = e }, change: function(e) { e = e.toRgb(), e = (new Yi).setRGB(e.r / 255, e.g / 255, e.b / 255); m.color = e } }), this.addVolatileListener(m, "color_changed", function() { v.find("#materials\\.color\\.picker").spectrum("set", "#".concat(m.color.getHexString())) }); function L() { var e, t, n, i = f.getAttribute("position"); n = i ? (t = (t = i.range[0][2]) - .2 * (i = (e = i.range[1][2]) - t), e + .2 * i) : (n = [f.pcoGeometry.tightBoundingBox, f.getBoundingBoxWorld()].find(function(e) { return void 0 !== e }), f.updateMatrixWorld(!0), r = (n = Jf.computeTransformedBoundingBox(n, f.matrixWorld)).max.z - n.min.z, t = n.min.z - .2 * r, n.max.z + .2 * r); var r = m.elevationRange; v.find("#lblHeightRange").html("".concat(r[0].toFixed(2), " to ").concat(r[1].toFixed(2))), v.find("#sldHeightRange").slider({ min: t, max: n, values: r }) } function R() { var e = m.activeAttributeName , t = f.getAttribute(e); null == t || "number" == typeof (e = null == (e = m.getRange(e)) ? t.range : e)[0] && "number" == typeof e[1] && (e ? (e = "".concat(e[0].toFixed(2), " to ").concat(e[1].toFixed(2)), v.find("#lblExtraRange").html(e)) : v.find("could not deduce range")) } var F = function() { var e = m.intensityRange; v.find("#lblIntensityRange").html("".concat(parseInt(e[0]), " to ").concat(parseInt(e[1]))) }; L(), v.find("#sldHeightRange").slider("option", "min"), v.find("#sldHeightRange").slider("option", "max"); l = v.find("#gradient_repeat_option"); l.selectgroup({ title: "Gradient" }), l.find("input").click(function(e) { t.viewer.setElevationGradientRepeat(im[e.target.value]) }); s = Object.keys(im).filter(function(e) { return im[e] === t.viewer.elevationGradientRepeat }); l.find("input[value=".concat(s, "]")).trigger("click"); function I() { var e = m.intensityGamma , t = m.intensityContrast , n = m.intensityBrightness; F(), v.find("#lblIntensityGamma").html(e.toFixed(2)), v.find("#lblIntensityContrast").html(t.toFixed(2)), v.find("#lblIntensityBrightness").html(n.toFixed(2)), v.find("#sldIntensityGamma").slider({ value: e }), v.find("#sldIntensityContrast").slider({ value: t }), v.find("#sldIntensityBrightness").slider({ value: n }) } function O() { var e = m.rgbGamma , t = m.rgbContrast , n = m.rgbBrightness; v.find("#lblRGBGamma").html(e.toFixed(2)), v.find("#lblRGBContrast").html(t.toFixed(2)), v.find("#lblRGBBrightness").html(n.toFixed(2)), v.find("#sldRGBGamma").slider({ value: e }), v.find("#sldRGBContrast").slider({ value: t }), v.find("#sldRGBBrightness").slider({ value: n }) } this.addVolatileListener(m, "material_property_changed", R), this.addVolatileListener(m, "material_property_changed", L), this.addVolatileListener(m, "material_property_changed", I), this.addVolatileListener(m, "material_property_changed", O), R(), L(), I(), O() } }, { key: "setMeasurement", value: function(e) { var t, n = { DISTANCE: { panel: Ay }, AREA: { panel: Sy }, POINT: { panel: Ty }, ANGLE: { panel: Cy }, HEIGHT: { panel: Dy }, PROFILE: { panel: By }, VOLUME: { panel: ky }, CIRCLE: { panel: Py }, OTHER: { panel: Ty } }, e = new ((t = e)instanceof Wf ? !t.showDistances || t.showArea || t.showAngles ? t.showDistances && t.showArea && !t.showAngles ? n.AREA : 1 === t.maxMarkers ? n.POINT : t.showDistances || t.showArea || !t.showAngles ? t.showHeight ? n.HEIGHT : t.showCircle ? n.CIRCLE : n.OTHER : n.ANGLE : n.DISTANCE : t instanceof Kp ? n.PROFILE : t instanceof Yp ? n.VOLUME : void 0).panel(this.viewer,e,this); this.container.append(e.elContent) } }, { key: "setCamera", value: function(e) { var t = new Ly(this.viewer,this); this.container.append(t.elContent) } }, { key: "setAnnotation", value: function(e) { e = new Ry(this.viewer,this,e); this.container.append(e.elContent) } }, { key: "setCameraAnimation", value: function(e) { e = new Fy(this.viewer,this,e); this.container.append(e.elContent) } }]), n }(); function Oy(e) { return function(e) { for (var t = (e = (e += "").split("."))[0], e = 1 < e.length ? "." + e[1] : "", n = /(\d+)(\d{3})/; n.test(t); ) t = t.replace(n, "$1,$2"); return t + e }(e.toFixed(3)) } var zy = function() { function i() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; O(this, i), this.element = document.createElement("div"), this.labels = [], this.sliders = [], this.range = null != e.range ? e.range : [0, 1], this.slide = null != e.slide ? e.slide : null, this.step = null != e.step ? e.step : 1e-4; for (var t = null != e.levels ? e.levels : 1, n = 0; n < t; n++) this.addLevel() } return h(i, [{ key: "setRange", value: function(e) { this.range = Q(e); var t = this.sliders[0]; $(t).slider({ min: e[0], max: e[1] }); for (var n = 1; n < this.sliders.length; n++) { var i = this.sliders[n - 1] , r = this.sliders[n] , i = Q($(i).slider("option", "values")); $(r).slider({ min: i[0], max: i[1] }) } this.updateLabels() } }, { key: "setValues", value: function(e) { var t, n = ue(this.sliders); try { for (n.s(); !(t = n.n()).done; ) { var i = t.value; $(i).slider({ values: Q(e) }) } } catch (e) { n.e(e) } finally { n.f() } this.updateLabels() } }, { key: "addLevel", value: function() { var e, o = this, t = document.createElement("li"), n = document.createTextNode("Range: "), i = document.createElement("span"), r = document.createElement("div"), s = this.sliders.length, a = 0, l = 0; l = 0 === this.sliders.length ? (a = (e = N(this.range, 2))[0], e[1]) : (e = this.sliders[this.sliders.length - 1], a = (e = N($(e).slider("option", "values"), 2))[0], e[1]), $(r).slider({ range: !0, min: a, max: l, step: this.step, values: [a, l], slide: function(e, t) { for (var n, i = o.sliders.length, r = s + 1; r < i; r++) { var a = o.sliders[r]; $(a).slider({ range: !0, min: t.values[0], max: t.values[1], values: Q(t.values) }) } o.slide && (n = Q(t.values), o.slide({ target: o, range: o.range, values: n })), o.updateLabels() } }), t.append(n, i, r), this.sliders.push(r), this.labels.push(i), this.element.append(t), this.updateLabels() } }, { key: "removeLevel", value: function() {} }, { key: "updateSliders", value: function() {} }, { key: "updateLabels", value: function() { for (var e = this.sliders.length, t = 0; t < e; t++) { var n = this.sliders[t] , i = this.labels[t] , r = N($(n).slider("option", "values"), 2) , n = r[0] , r = r[1] , n = Oy(n) , r = Oy(r) , r = "".concat(n, " to ").concat(r); i.innerHTML = r } } }]), i }() , Ny = function() { y(i, hn); var e = w(i); function i(t) { var n; O(this, i), (n = e.call(this)).viewer = t, n.renderer = t.renderer, n.originalCam = t.scene.getActiveCamera(), n.shearCam = t.scene.getActiveCamera().clone(), n.shearCam.rotation.set(n.originalCam.rotation.toArray()), n.shearCam.updateProjectionMatrix(), n.shearCam.updateProjectionMatrix = function() { return n.shearCam.projectionMatrix } , n.image = null, n.fadeFactor = 20, n.fovDelta = 0, n.fovMin = .1, n.fovMax = 120, n.shear = [0, 0], n.elUp = $(''), n.elRight = $(''), n.elDown = $(''), n.elLeft = $(''), n.elExit = $(''), n.elExit.click(function() { n.release() }), n.elUp.click(function() { var e = t.getFOV() , e = Math.tan(gn.degToRad(e / 2)); n.shear[1] += .1 * e }), n.elRight.click(function() { var e = t.getFOV() , e = Math.tan(gn.degToRad(e / 2)); n.shear[0] += .1 * e }), n.elDown.click(function() { var e = t.getFOV() , e = Math.tan(gn.degToRad(e / 2)); n.shear[1] -= .1 * e }), n.elLeft.click(function() { var e = t.getFOV() , e = Math.tan(gn.degToRad(e / 2)); n.shear[0] -= .1 * e }), n.scene = null, n.sceneControls = new gs; return n.addEventListener("mousewheel", function(e) { n.fovDelta += -e.delta }), n } return h(i, [{ key: "hasSomethingCaptured", value: function() { return null !== this.image } }, { key: "capture", value: function(e) { this.hasSomethingCaptured() || (this.image = e, this.originalFOV = this.viewer.getFOV(), this.originalControls = this.viewer.getControls(), this.viewer.setControls(this), this.viewer.scene.overrideCamera = this.shearCam, e = this.viewer.renderer.domElement, e = $(e.parentElement), this.shear = [0, 0], e.append(this.elUp), e.append(this.elRight), e.append(this.elDown), e.append(this.elLeft), e.append(this.elExit)) } }, { key: "release", value: function() { this.image = null, this.viewer.scene.overrideCamera = null, this.elUp.detach(), this.elRight.detach(), this.elDown.detach(), this.elLeft.detach(), this.elExit.detach(), this.viewer.setFOV(this.originalFOV), this.viewer.setControls(this.originalControls) } }, { key: "setScene", value: function(e) { this.scene = e } }, { key: "update", value: function(e) { var t = this.viewer.getFOV() , n = t * (1 + +this.fovDelta / 10) , n = Math.max(this.fovMin, n) , i = (n = Math.min(this.fovMax, n)) / t , r = this.viewer.inputHandler.mouse , a = this.viewer.renderer.getSize(new yn) , t = [r.x / a.x, (a.y - r.y) / a.y] , r = a.x / a.y , a = 2 * Math.tan(gn.degToRad(n / 2)) , r = r * a , r = [this.shear[0] - .5 * r, this.shear[0] + .5 * r] , a = [this.shear[1] - .5 * a, this.shear[1] + .5 * a] , i = 1 - i , t = [(1 - i) * this.shear[0] + i * ((1 - t[0]) * r[0] + t[0] * r[1]), (1 - i) * this.shear[1] + i * ((1 - t[1]) * a[0] + t[1] * a[1])]; this.shear = t, this.viewer.setFOV(n); a = this.originalCam, t = this.shearCam; a.fov = n, a.updateMatrixWorld(), a.updateProjectionMatrix(), t.copy(a), (n = t.rotation).set.apply(n, Q(a.rotation.toArray())), t.updateMatrixWorld(), t.projectionMatrix.copy(a.projectionMatrix); n = N(this.shear, 2), a = n[0], n = n[1], a = (new ni).set(1, 0, a, 0, 0, 1, n, 0, 0, 0, 1, 0, 0, 0, 0, 1), n = t.projectionMatrix; n.multiply(a), t.projectionMatrixInverse.copy(n).invert(); t.projectionMatrix.elements.reduce(function(e, t) { return e + t }, 0); this.fovDelta *= 0 } }]), i }(); var Uy = new bu(1,1) , Gy = new Sl; Gy.vertices.push(new Cn(-.5,-.5,0), new Cn(.5,-.5,0), new Cn(.5,.5,0), new Cn(-.5,.5,0), new Cn(-.5,-.5,0)); var Hy, Vy, jy, Wy, Xy, qy, Jy, Yy, Zy, Qy, Ky, $y, ew, tw, nw = function() { function n(e) { O(this, n), this.id = e, this.fov = 1, this.position = new Cn, this.rotation = new Cn, this.width = 0, this.height = 0, this.fov = 1; var e = ((t = new Qr({ uniforms: { tColor: { value: new En }, uNear: { value: 0 }, uOpacity: { value: 1 } }, vertexShader: "\n\tuniform float uNear;\n\tvarying vec2 vUV;\n\tvarying vec4 vDebug;\n\t\n\tvoid main(){\n\t\tvDebug = vec4(0.0, 1.0, 0.0, 1.0);\n\t\tvec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0);\n\t\t// make sure that this mesh is at least in front of the near plane\n\t\tmodelViewPosition.xyz += normalize(modelViewPosition.xyz) * uNear;\n\t\tgl_Position = projectionMatrix * modelViewPosition;\n\t\tvUV = uv;\n\t}\n\t", fragmentShader: "\n\tuniform sampler2D tColor;\n\tuniform float uOpacity;\n\tvarying vec2 vUV;\n\tvarying vec4 vDebug;\n\tvoid main(){\n\t\tvec4 color = texture2D(tColor, vUV);\n\t\tgl_FragColor = color;\n\t\tgl_FragColor.a = uOpacity;\n\t}\n\t", side: Y })).side = Y, t) , t = new tl({ color: 65280 }); this.mesh = new Hr(Uy,e), this.line = new sl(Gy,t), this.texture = null, this.mesh.orientedImage = this } return h(n, [{ key: "set", value: function(e, t, n, i) { var r = t.map(gn.degToRad); (t = this.position).set.apply(t, Q(e)), (t = this.mesh.position).set.apply(t, Q(e)), (e = this.rotation).set.apply(e, Q(r)), (e = this.mesh.rotation).set.apply(e, Q(r)); n = N(n, 2); this.width = n[0], this.height = n[1], this.mesh.scale.set(this.width / this.height, 1, 1), this.fov = i, this.updateTransform() } }, { key: "updateTransform", value: function() { var e = this.mesh , t = this.line , n = this.fov; e.updateMatrixWorld(); var i = e.getWorldDirection() , n = gn.degToRad(n / 2) , n = -.5 / Math.tan(n) , n = i.clone().multiplyScalar(n); e.position.add(n), t.position.copy(e.position), t.scale.copy(e.scale), t.rotation.copy(e.rotation) } }]), n }(), iw = function() { y(n, hn); var t = w(n); function n() { var e; return O(this, n), (e = t.call(this)).node = null, e.cameraParams = null, e.imageParams = null, e.images = null, e._visible = !0, e } return h(n, [{ key: "visible", get: function() { return this._visible }, set: function(e) { if (this._visible !== e) { var t, n = ue(this.images); try { for (n.s(); !(t = n.n()).done; ) { var i = t.value; i.mesh.visible = e, i.line.visible = e } } catch (e) { n.e(e) } finally { n.f() } this._visible = e, this.dispatchEvent({ type: "visibility_changed", images: this }) } } }]), n }(), pd = function() { function k() { O(this, k) } var i, t, n; return h(k, null, [{ key: "loadCameraParams", value: (n = r(regeneratorRuntime.mark(function e(t) { var n, i, r, a; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return e.next = 2, fetch(t); case 2: return n = e.sent, e.next = 5, n.text(); case 5: return r = e.sent, i = new DOMParser, a = i.parseFromString(r, "application/xml"), n = parseInt(a.getElementsByTagName("width")[0].textContent), i = parseInt(a.getElementsByTagName("height")[0].textContent), r = parseFloat(a.getElementsByTagName("f")[0].textContent), a = i / 2 / r, a = 2 * gn.radToDeg(Math.atan(a)), a = { path: t, width: n, height: i, f: r, fov: a }, e.abrupt("return", a); case 15: case "end": return e.stop() } }, e) })), function(e) { return n.apply(this, arguments) } ) }, { key: "loadImageParams", value: (t = r(regeneratorRuntime.mark(function e(t) { var n, i, r, a, o, s, l; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return e.next = 2, fetch(t); case 2: if ((n = e.sent).ok) { e.next = 6; break } return console.error("failed to load ".concat(t)), e.abrupt("return"); case 6: return e.next = 8, n.text(); case 8: l = e.sent, i = l.split(/\r?\n/), r = [], a = 1; case 12: if (!(a < i.length)) { e.next = 24; break } if ((o = i[a]).startsWith("#")) return e.abrupt("continue", 21); e.next = 16; break; case 16: if ((s = o.split(/\s+/)).length < 6) return e.abrupt("continue", 21); e.next = 19; break; case 19: l = { id: s[0], x: Number.parseFloat(s[1]), y: Number.parseFloat(s[2]), z: Number.parseFloat(s[3]), omega: Number.parseFloat(s[4]), phi: Number.parseFloat(s[5]), kappa: Number.parseFloat(s[6]) }, r.push(l); case 21: a++, e.next = 12; break; case 24: return e.abrupt("return", r); case 25: case "end": return e.stop() } }, e) })), function(e) { return t.apply(this, arguments) } ) }, { key: "load", value: (i = r(regeneratorRuntime.mark(function e(t, a, u) { var n, o, i, s, l, r, c, d, h, p, f, m, v, g, y, w, b, x, E, _, M, A, T, S, C, P, D; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return n = performance.now(), e.next = 3, Promise.all([k.loadCameraParams(t), k.loadImageParams(a)]); case 3: D = e.sent, C = N(D, 2), o = C[0], i = C[1], s = new Ny(u), l = new sh, D = performance.now(), console.log(D - n), r = o.width, c = o.height, d = [], (h = new Si).name = "oriented_images", p = ue(i); try { for (p.s(); !(f = p.n()).done; ) m = f.value, v = m.x, g = m.y, y = m.z, w = m.omega, b = m.phi, x = m.kappa, E = new nw(m.id), _ = [v, g, y], M = [w, b, x], A = [r, c], E.set(_, M, A, o.fov), h.add(E.mesh), h.add(E.line), d.push(E) } catch (e) { p.e(e) } finally { p.f() } return S = T = null, C = function(e) { performance.now(); T && T.line.material.color.setRGB(0, 1, 0), e.preventDefault(); var t = u.renderer.domElement.getBoundingClientRect() , n = [e.clientX, e.clientY] , i = [(n[0] - t.left) / t.width, (n[1] - t.top) / t.height] , e = B(yn, i) , n = u.scene.getActiveCamera() , t = new Cn(2 * e.x - 1,-2 * e.y + 1) , i = d.map(function(e) { return e.mesh }); l.setFromCamera(t, n); e = l.intersectObjects(i), t = !1; T = 0 < e.length ? ((r = e[0].object.orientedImage).line.material.color.setRGB(1, 0, 0), t = T !== r, r) : null; var r, n = null === S && null !== T; null === S || null !== T && !t || (u.scene.removePolygonClipVolume(S), S = null), (n || t) && (i = T, (r = new $r(e = o.fov,o.width / o.height,1,1e6)).rotation.order = u.scene.getActiveCamera().rotation.order, r.rotation.copy(i.mesh.rotation), t = (n = i.mesh).getWorldDirection(), i = n.position, n = gn.degToRad(e / 2), e = .5 / Math.tan(n), n = i.clone().add(t.clone().multiplyScalar(e)), t = i.clone().sub(n), (new Cn).addVectors(n, t.clone().multiplyScalar(u.getMoveSpeed())), r.position.copy(n), e = new Potree.PolygonClipVolume(r), i = new Hr, t = new Hr, n = new Hr, r = new Hr, i.position.set(-1, -1, 0), t.position.set(1, -1, 0), n.position.set(1, 1, 0), r.position.set(-1, 1, 0), e.markers.push(i, t, n, r), e.initialized = !0, u.scene.addPolygonClipVolume(e), S = e); performance.now() } , P = function(e) { console.log("move to image " + e.id); var t, n = e.mesh, i = e.position.clone(), r = n.position.clone(); u.scene.view.setView(i, r, 500, function() { s.capture(e) }), null === e.texture && (t = e, r = "".concat(Potree.resourcePath, "/images/loading.jpg"), (new _c).load(r, function(e) { null === t.texture && (t.texture = e, t.mesh.material.uniforms.tColor.value = e, n.material.needsUpdate = !0) }), r = "".concat(a, "/../").concat(t.id), (new _c).load(r, function(e) { t.texture = e, t.mesh.material.uniforms.tColor.value = e, n.material.needsUpdate = !0 })) } , D = function(e) { s.hasSomethingCaptured() || T && P(T) } , u.renderer.domElement.addEventListener("mousemove", C, !1), u.renderer.domElement.addEventListener("mousedown", D, !1), u.addEventListener("update", function() { var e, t = ue(d); try { for (t.s(); !(e = t.n()).done; ) { var n = e.value , i = (n.mesh.matrixWorld, n.width / n.height) , r = u.scene.getActiveCamera() , a = n.mesh.getWorldPosition(new Cn) , o = r.position.distanceTo(a) , s = gn.degToRad(1) , l = o * Math.tan(s) , l = Math.max(l, 1); n.mesh.scale.set(l * i, l, 1), n.line.scale.set(l * i, l, 1), n.mesh.material.uniforms.uNear.value = r.near } } catch (e) { t.e(e) } finally { t.f() } }), (D = new iw).node = h, D.cameraParamsPath = t, D.imageParamsPath = a, D.cameraParams = o, D.imageParams = i, D.images = d, Potree.debug.moveToImage = P, e.abrupt("return", D); case 34: case "end": return e.stop() } }, e) })), function(e, t, n) { return i.apply(this, arguments) } ) }]), k }(), rw = { Space_Separator: /[\u1680\u2000-\u200A\u202F\u205F\u3000]/, ID_Start: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/, ID_Continue: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ }, aw = { isSpaceSeparator: function(e) { return "string" == typeof e && rw.Space_Separator.test(e) }, isIdStartChar: function(e) { return "string" == typeof e && ("a" <= e && e <= "z" || "A" <= e && e <= "Z" || "$" === e || "_" === e || rw.ID_Start.test(e)) }, isIdContinueChar: function(e) { return "string" == typeof e && ("a" <= e && e <= "z" || "A" <= e && e <= "Z" || "0" <= e && e <= "9" || "$" === e || "_" === e || "‌" === e || "‍" === e || rw.ID_Continue.test(e)) }, isDigit: function(e) { return "string" == typeof e && /[0-9]/.test(e) }, isHexDigit: function(e) { return "string" == typeof e && /[0-9A-Fa-f]/.test(e) } }; function ow() { if (Hy[Wy]) return String.fromCodePoint(Hy.codePointAt(Wy)) } function sw() { var e = ow(); return "\n" === e ? (Xy++, qy = 0) : e ? qy += e.length : qy++, e && (Wy += e.length), e } var lw = { default: function() { switch (tw) { case "\t": case "\v": case "\f": case " ": case " ": case "\ufeff": case "\n": case "\r": case "\u2028": case "\u2029": return void sw(); case "/": return sw(), void (Qy = "comment"); case void 0: return sw(), uw("eof") } if (!aw.isSpaceSeparator(tw)) return lw[Vy](); sw() }, comment: function() { switch (tw) { case "*": return sw(), void (Qy = "multiLineComment"); case "/": return sw(), void (Qy = "singleLineComment") } throw mw(sw()) }, multiLineComment: function() { switch (tw) { case "*": return sw(), void (Qy = "multiLineCommentAsterisk"); case void 0: throw mw(sw()) } sw() }, multiLineCommentAsterisk: function() { switch (tw) { case "*": return void sw(); case "/": return sw(), void (Qy = "default"); case void 0: throw mw(sw()) } sw(), Qy = "multiLineComment" }, singleLineComment: function() { switch (tw) { case "\n": case "\r": case "\u2028": case "\u2029": return sw(), void (Qy = "default"); case void 0: return sw(), uw("eof") } sw() }, value: function() { switch (tw) { case "{": case "[": return uw("punctuator", sw()); case "n": return sw(), cw("ull"), uw("null", null); case "t": return sw(), cw("rue"), uw("boolean", !0); case "f": return sw(), cw("alse"), uw("boolean", !1); case "-": case "+": return "-" === sw() && (ew = -1), void (Qy = "sign"); case ".": return Ky = sw(), void (Qy = "decimalPointLeading"); case "0": return Ky = sw(), void (Qy = "zero"); case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": return Ky = sw(), void (Qy = "decimalInteger"); case "I": return sw(), cw("nfinity"), uw("numeric", 1 / 0); case "N": return sw(), cw("aN"), uw("numeric", NaN); case '"': case "'": return $y = '"' === sw(), Ky = "", void (Qy = "string") } throw mw(sw()) }, identifierNameStartEscape: function() { if ("u" !== tw) throw mw(sw()); sw(); var e = dw(); switch (e) { case "$": case "_": break; default: if (!aw.isIdStartChar(e)) throw gw() } Ky += e, Qy = "identifierName" }, identifierName: function() { switch (tw) { case "$": case "_": case "‌": case "‍": return void (Ky += sw()); case "\\": return sw(), void (Qy = "identifierNameEscape") } if (!aw.isIdContinueChar(tw)) return uw("identifier", Ky); Ky += sw() }, identifierNameEscape: function() { if ("u" !== tw) throw mw(sw()); sw(); var e = dw(); switch (e) { case "$": case "_": case "‌": case "‍": break; default: if (!aw.isIdContinueChar(e)) throw gw() } Ky += e, Qy = "identifierName" }, sign: function() { switch (tw) { case ".": return Ky = sw(), void (Qy = "decimalPointLeading"); case "0": return Ky = sw(), void (Qy = "zero"); case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": return Ky = sw(), void (Qy = "decimalInteger"); case "I": return sw(), cw("nfinity"), uw("numeric", ew * (1 / 0)); case "N": return sw(), cw("aN"), uw("numeric", NaN) } throw mw(sw()) }, zero: function() { switch (tw) { case ".": return Ky += sw(), void (Qy = "decimalPoint"); case "e": case "E": return Ky += sw(), void (Qy = "decimalExponent"); case "x": case "X": return Ky += sw(), void (Qy = "hexadecimal") } return uw("numeric", 0 * ew) }, decimalInteger: function() { switch (tw) { case ".": return Ky += sw(), void (Qy = "decimalPoint"); case "e": case "E": return Ky += sw(), void (Qy = "decimalExponent") } if (!aw.isDigit(tw)) return uw("numeric", ew * Number(Ky)); Ky += sw() }, decimalPointLeading: function() { if (aw.isDigit(tw)) return Ky += sw(), void (Qy = "decimalFraction"); throw mw(sw()) }, decimalPoint: function() { switch (tw) { case "e": case "E": return Ky += sw(), void (Qy = "decimalExponent") } return aw.isDigit(tw) ? (Ky += sw(), void (Qy = "decimalFraction")) : uw("numeric", ew * Number(Ky)) }, decimalFraction: function() { switch (tw) { case "e": case "E": return Ky += sw(), void (Qy = "decimalExponent") } if (!aw.isDigit(tw)) return uw("numeric", ew * Number(Ky)); Ky += sw() }, decimalExponent: function() { switch (tw) { case "+": case "-": return Ky += sw(), void (Qy = "decimalExponentSign") } if (aw.isDigit(tw)) return Ky += sw(), void (Qy = "decimalExponentInteger"); throw mw(sw()) }, decimalExponentSign: function() { if (aw.isDigit(tw)) return Ky += sw(), void (Qy = "decimalExponentInteger"); throw mw(sw()) }, decimalExponentInteger: function() { if (!aw.isDigit(tw)) return uw("numeric", ew * Number(Ky)); Ky += sw() }, hexadecimal: function() { if (aw.isHexDigit(tw)) return Ky += sw(), void (Qy = "hexadecimalInteger"); throw mw(sw()) }, hexadecimalInteger: function() { if (!aw.isHexDigit(tw)) return uw("numeric", ew * Number(Ky)); Ky += sw() }, string: function() { switch (tw) { case "\\": return sw(), void (Ky += function() { switch (ow()) { case "b": return sw(), "\b"; case "f": return sw(), "\f"; case "n": return sw(), "\n"; case "r": return sw(), "\r"; case "t": return sw(), "\t"; case "v": return sw(), "\v"; case "0": if (sw(), aw.isDigit(ow())) throw mw(sw()); return "\0"; case "x": return sw(), function() { var e = "" , t = ow(); if (!aw.isHexDigit(t)) throw mw(sw()); if (e += sw(), t = ow(), aw.isHexDigit(t)) return e += sw(), String.fromCodePoint(parseInt(e, 16)); throw mw(sw()) }(); case "u": return sw(), dw(); case "\n": case "\u2028": case "\u2029": return sw(), ""; case "\r": return sw(), "\n" === ow() && sw(), ""; case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": case void 0: throw mw(sw()) } return sw() }()); case '"': return $y ? (sw(), uw("string", Ky)) : void (Ky += sw()); case "'": return $y ? void (Ky += sw()) : (sw(), uw("string", Ky)); case "\n": case "\r": throw mw(sw()); case "\u2028": case "\u2029": e = tw, console.warn("JSON5: '".concat(yw(e), "' in strings is not valid ECMAScript; consider escaping")); break; case void 0: throw mw(sw()) } var e; Ky += sw() }, start: function() { switch (tw) { case "{": case "[": return uw("punctuator", sw()) } Qy = "value" }, beforePropertyName: function() { switch (tw) { case "$": case "_": return Ky = sw(), void (Qy = "identifierName"); case "\\": return sw(), void (Qy = "identifierNameStartEscape"); case "}": return uw("punctuator", sw()); case '"': case "'": return $y = '"' === sw(), void (Qy = "string") } if (aw.isIdStartChar(tw)) return Ky += sw(), void (Qy = "identifierName"); throw mw(sw()) }, afterPropertyName: function() { if (":" === tw) return uw("punctuator", sw()); throw mw(sw()) }, beforePropertyValue: function() { Qy = "value" }, afterPropertyValue: function() { switch (tw) { case ",": case "}": return uw("punctuator", sw()) } throw mw(sw()) }, beforeArrayValue: function() { if ("]" === tw) return uw("punctuator", sw()); Qy = "value" }, afterArrayValue: function() { switch (tw) { case ",": case "]": return uw("punctuator", sw()) } throw mw(sw()) }, end: function() { throw mw(sw()) } }; function uw(e, t) { return { type: e, value: t, line: Xy, column: qy } } function cw(e) { var t, n = ue(e); try { for (n.s(); !(t = n.n()).done; ) { var i = t.value; if (ow() !== i) throw mw(sw()); sw() } } catch (e) { n.e(e) } finally { n.f() } } function dw() { for (var e = "", t = 4; 0 < t--; ) { var n = ow(); if (!aw.isHexDigit(n)) throw mw(sw()); e += sw() } return String.fromCodePoint(parseInt(e, 16)) } var hw = { start: function() { if ("eof" === Jy.type) throw vw(); pw() }, beforePropertyName: function() { switch (Jy.type) { case "identifier": case "string": return Yy = Jy.value, void (Vy = "afterPropertyName"); case "punctuator": return void fw(); case "eof": throw vw() } }, afterPropertyName: function() { if ("eof" === Jy.type) throw vw(); Vy = "beforePropertyValue" }, beforePropertyValue: function() { if ("eof" === Jy.type) throw vw(); pw() }, beforeArrayValue: function() { if ("eof" === Jy.type) throw vw(); ("punctuator" !== Jy.type || "]" !== Jy.value ? pw : fw)() }, afterPropertyValue: function() { if ("eof" === Jy.type) throw vw(); switch (Jy.value) { case ",": return void (Vy = "beforePropertyName"); case "}": fw() } }, afterArrayValue: function() { if ("eof" === Jy.type) throw vw(); switch (Jy.value) { case ",": return void (Vy = "beforeArrayValue"); case "]": fw() } }, end: function() {} }; function pw() { var e, t; switch (Jy.type) { case "punctuator": switch (Jy.value) { case "{": e = {}; break; case "[": e = [] } break; case "null": case "boolean": case "numeric": case "string": e = Jy.value } void 0 === Zy ? Zy = e : (t = jy[jy.length - 1], Array.isArray(t) ? t.push(e) : t[Yy] = e), Vy = null !== e && "object" === X(e) ? (jy.push(e), Array.isArray(e) ? "beforeArrayValue" : "beforePropertyName") : null == (t = jy[jy.length - 1]) ? "end" : Array.isArray(t) ? "afterArrayValue" : "afterPropertyValue" } function fw() { jy.pop(); var e = jy[jy.length - 1]; Vy = null == e ? "end" : Array.isArray(e) ? "afterArrayValue" : "afterPropertyValue" } function mw(e) { return ww((void 0 === e ? "JSON5: invalid end of input at " : "JSON5: invalid character '".concat(yw(e), "' at ")).concat(Xy, ":").concat(qy)) } function vw() { return ww("JSON5: invalid end of input at ".concat(Xy, ":").concat(qy)) } function gw() { return qy -= 5, ww("JSON5: invalid identifier character at ".concat(Xy, ":").concat(qy)) } function yw(e) { var t = { "'": "\\'", '"': '\\"', "\\": "\\\\", "\b": "\\b", "\f": "\\f", "\n": "\\n", "\r": "\\r", "\t": "\\t", "\v": "\\v", "\0": "\\0", "\u2028": "\\u2028", "\u2029": "\\u2029" }; if (t[e]) return t[e]; if (e < " ") { t = e.charCodeAt(0).toString(16); return "\\x" + ("00" + t).substring(t.length) } return e } function ww(e) { e = new SyntaxError(e); return e.lineNumber = Xy, e.columnNumber = qy, e } var bw, xw = { parse: function(e, t) { for (Hy = String(e), Vy = "start", jy = [], Xy = 1, Zy = Yy = Jy = void (qy = Wy = 0); Jy = function() { for (Qy = "default", Ky = "", $y = !1, ew = 1; ; ) { tw = ow(); var e = lw[Qy](); if (e) return e } }(), hw[Vy](), "eof" !== Jy.type; ) ; return "function" == typeof t ? function e(t, n, i) { var r = t[n]; if (null != r && "object" === X(r)) for (var a in r) { var o = e(r, a, i); void 0 === o ? delete r[a] : r[a] = o } return i.call(t, n, r) }({ "": Zy }, "", t) : Zy }, stringify: function(e, t, n) { var i, l, c = [], d = "", h = ""; if (null == t || "object" !== X(t) || Array.isArray(t) || (n = t.space, l = t.quote, t = t.replacer), "function" == typeof t) i = t; else if (Array.isArray(t)) { var r, p = [], a = ue(t); try { for (a.s(); !(r = a.n()).done; ) { var o = r.value , s = void 0; "string" == typeof o ? s = o : ("number" == typeof o || o instanceof String || o instanceof Number) && (s = String(o)), void 0 !== s && p.indexOf(s) < 0 && p.push(s) } } catch (e) { a.e(e) } finally { a.f() } } return n instanceof Number ? n = Number(n) : n instanceof String && (n = String(n)), "number" == typeof n ? 0 < n && (n = Math.min(10, Math.floor(n)), h = " ".substr(0, n)) : "string" == typeof n && (h = n.substr(0, 10)), f("", { "": e }); function f(e, t) { var n = t[e]; switch (null != n && ("function" == typeof n.toJSON5 ? n = n.toJSON5(e) : "function" == typeof n.toJSON && (n = n.toJSON(e))), (n = i ? i.call(t, e, n) : n)instanceof Number ? n = Number(n) : n instanceof String ? n = String(n) : n instanceof Boolean && (n = n.valueOf()), n) { case null: return "null"; case !0: return "true"; case !1: return "false" } return "string" == typeof n ? m(n) : "number" == typeof n ? String(n) : "object" === X(n) ? (Array.isArray(n) ? function(e) { if (0 <= c.indexOf(e)) throw TypeError("Converting circular structure to JSON5"); c.push(e); var t = d; d += h; for (var n = [], i = 0; i < e.length; i++) { var r = f(String(i), e); n.push(void 0 !== r ? r : "null") } { var a; a = 0 === n.length ? "[]" : "" === h ? "[" + n.join(",") + "]" : (a = ",\n" + d, a = n.join(a), "[\n" + d + a + ",\n" + t + "]") } return c.pop(), d = t, a } : function(e) { if (0 <= c.indexOf(e)) throw TypeError("Converting circular structure to JSON5"); c.push(e); var t = d; d += h; var n, i, r = p || Object.keys(e), a = [], o = ue(r); try { for (o.s(); !(n = o.n()).done; ) { var s, l = n.value, u = f(l, e); void 0 !== u && (s = function(e) { if (0 === e.length) return m(e); var t = String.fromCodePoint(e.codePointAt(0)); if (!aw.isIdStartChar(t)) return m(e); for (var n = t.length; n < e.length; n++) if (!aw.isIdContinueChar(String.fromCodePoint(e.codePointAt(n)))) return m(e); return e }(l) + ":", "" !== h && (s += " "), s += u, a.push(s)) } } catch (e) { o.e(e) } finally { o.f() } i = 0 === a.length ? "{}" : "" === h ? "{" + (i = a.join(",")) + "}" : (r = ",\n" + d, i = a.join(r), "{\n" + d + i + ",\n" + t + "}"); return c.pop(), d = t, i } )(n) : void 0 } function m(e) { for (var n = { "'": .1, '"': .2 }, t = { "'": "\\'", '"': '\\"', "\\": "\\\\", "\b": "\\b", "\f": "\\f", "\n": "\\n", "\r": "\\r", "\t": "\\t", "\v": "\\v", "\0": "\\0", "\u2028": "\\u2028", "\u2029": "\\u2029" }, i = "", r = 0; r < e.length; r++) { var a, o = e[r]; switch (o) { case "'": case '"': n[o]++, i += o; continue; case "\0": if (aw.isDigit(e[r + 1])) { i += "\\x00"; continue } } t[o] ? i += t[o] : i += o < " " ? "\\x" + ("00" + (a = o.charCodeAt(0).toString(16))).substring(a.length) : o } var s = l || Object.keys(n).reduce(function(e, t) { return n[e] < n[t] ? e : t }); return s + (i = i.replace(new RegExp(s,"g"), t[s])) + s } } }, Ew = function() { function t(e) { O(this, t), this.viewer = e, this.measuringTool = e.measuringTool, this.profileTool = e.profileTool, this.volumeTool = e.volumeTool, this.dom = $("#sidebar_root") } return h(t, [{ key: "createToolIcon", value: function(e, t, n) { t = $('\n\t\t\t\n\t\t')); return t.click(n), t } }, { key: "init", value: function() { "merge" == Potree.settings.editType ? (this.initMergeBar(), this.initToolbar(), this.initScene(), this.initNavigation()) : (this.initAccordion(), this.initAppearance(), this.initToolbar(), this.initScene(), this.initNavigation(), this.initFilters(), this.initClippingTool(), this.initSettings(), "pano" != Potree.settings.editType ? (this.initAlignment(), this.initClipModel(), this.initSiteModel(), this.initParitcle()) : this.initPanosEdit()), $("#potree_version_number").html(Potree.version.major + "." + Potree.version.minor + Potree.version.suffix) } }, { key: "initAlignment", value: function() { function e(n, i) { return function() { var e = $('#alignment li[name="selectPointCloud"] input:checked'); Array.from(e).forEach(function(t) { var e = viewer.scene.pointclouds.find(function(e) { return e.name == t.name }); n(e, i) }) } } var t = viewer.modules.Alignment , n = $("#alignment") , i = n.find('[name="transform"] button'); i.eq(0).on("click", e(t.rotate, 10)), i.eq(1).on("click", e(t.rotate, 1)), i.eq(2).on("click", e(t.rotate, .1)), i.eq(3).on("click", e(t.rotate, -10)), i.eq(4).on("click", e(t.rotate, -1)), i.eq(5).on("click", e(t.rotate, -.1)), i.eq(6).on("click", e(t.translate, new Cn(-1,0,0))), i.eq(7).on("click", e(t.translate, new Cn(1,0,0))), i.eq(8).on("click", e(t.translate, new Cn(0,-1,0))), i.eq(9).on("click", e(t.translate, new Cn(0,1,0))), i.eq(10).on("click", e(t.translate, new Cn(0,0,-1))), i.eq(11).on("click", e(t.translate, new Cn(0,0,1))), n.find("#startAlignment").on("click", function() { t.enter() }), n.find("#exitAlignment").on("click", function() { t.save(), t.leave() }), n.find("#rotTool").on("click", function() { t.switchHandle("rotate") }), n.find("#moveTool").on("click", function() { t.switchHandle("translate") }) } }, { key: "initMergeBar", value: function() { var e = $("#mergeModel") , t = (e.find("button"), viewer.modules.MergeEditor) , r = !1; e.find('ul[name="model"] li button').on("click", function(e) { if (r) return console.log("还在加载", r); var t, n = $(e.target), i = n.parent().attr("name"); if ("select" == n.attr("name")) return Potree.selectModel(i); "添加" == n.text() ? (t = Date.now(), Potree.addModel(i, function() { r = !1, n.text("删除"); var e = Date.now(); console.log("加载完毕", i, "用时", (e - t) / 1e3, "s") }), r = i) : (Potree.removeModel(i), n.text("添加")) }), e.find('li button[name="splitScreen"]').on("click", function(e) { e = $(e.target); "分屏" == e.text() ? (e.text("恢复"), t.enterSplit()) : (e.text("分屏"), t.leaveSplit()) }); e.find('li button[name="tag"]').on("click", function(e) { $(e.target); viewer.tagTool.startInsertion() }) } }, { key: "addAlignmentButton", value: function(e) { var t = $('#alignment li[name="selectPointCloud"]>div') , e = $(' \n \n ")); t.append(e) } }, { key: "initClipModel", value: function() { var e = viewer.modules.Clip , t = $("#clipModel").find("button"); t.eq(0).on("click", e.enter.bind(e)), t.eq(1).on("click", e.download.bind(e)), t.eq(2).on("click", e.leave.bind(e)) } }, { key: "initSiteModel", value: function() { var e = viewer.modules.SiteModel , t = $("#siteModel"); t.find('button[name="start"] ').on("click", e.enter.bind(e)), t.find('button[name="exit"] ').on("click", e.leave.bind(e)), t.find('button[name="building"] ').on("click", e.startInsertion.bind(e, "building")), t.find('button[name="floor"] ').on("click", function() { e.addFloor(e.buildings[0], "top") }), t.find('button[name="room"] ').on("click", function() { e.startInsertion("room", e.buildings[0].buildChildren[0]) }), t.find('button[name="digHole"] ').on("click", function() { e.selected && e.startInsertion("hole", e.selected) }), t.find('button[name="selectBuilding"] ').on("click", function() { e.selectEntity(e.buildings[0]) }), t.find('button[name="selectFloor"] ').on("click", function() { e.selectEntity(e.buildings[0].buildChildren[0]) }), t.find('button[name="selectRoom"] ').on("click", function() { e.selectEntity(e.buildings[0].buildChildren[0].buildChildren[0]) }), t.find('button[name="removeFirstBuilding"] ').on("click", function() { e.removeEntity(e.buildings[0]) }), t.find('button[name="removeFirstFloor"] ').on("click", function() { e.removeEntity(e.buildings[0].buildChildren[0]) }), t.find('button[name="removeFirstRoom"] ').on("click", function() { e.removeEntity(e.buildings[0].buildChildren[0].buildChildren[0]) }), t.find('button[name="removeFirstHole"] ').on("click", function() { e.selected.removeHole(e.selected.holes[0]) }), t.find('button[name="removeFirstMarker"] ').on("click", function() { e.selected.removeMarker(0) }) } }, { key: "initParitcle", value: function() { var e = viewer.modules.ParticleEditor , t = $("#particle"); t.find('button[name="addFire"] ').on("click", function() { e.startInsertion("fire+smoke") }), t.find('button[name="addExplode"] ').on("click", function() { e.startInsertion("explode") }) } }, { key: "initPanosEdit", value: function() { var e = viewer.modules.PanoEditor , t = viewer.modules.Alignment , n = $("#panos"); n.find('button[name="save"] ').on("click", function() { console.log("saveData", e.exportSavingData()) }), n.find('button[name="translate"] ').on("click", function() { t.switchHandle("translate") }), n.find('button[name="rotate"] ').on("click", function() { t.switchHandle("rotate") }), n.find('button[name="topView"] ').on("click", function() { e.switchView("top") }), n.find('button[name="sideView"] ').on("click", function() { e.switchView("right") }), n.find('button[name="3DView"] ').on("click", function() { e.switchView("mainView") }), n.find('button[name="addLink"] ').on("click", function() { e.setLinkOperateState("addLink", !0) }), n.find('button[name="removeLink"] ').on("click", function() { e.setLinkOperateState("removeLink", !0) }), n.find('button[name="getCloser"] ').on("click", function() { e.setZoomInState(!0) }) } }, { key: "initToolbar", value: function() { var n = this , e = $("#tools"); e.append(this.createToolIcon(Potree.resourcePath + "/icons/angle.png", "[title]tt.angle_measurement", function() { $("#menu_measurements").next().slideDown(); var t = n.measuringTool.startInsertion({ showDistances: !1, showAngles: !0, showArea: !1, closed: !0, maxMarkers: 3, minMarkers: 3, measureType: "Angle" }) , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/point.svg", "[title]tt.point_measurement", function() { $("#menu_measurements").next().slideDown(); var t = n.measuringTool.startInsertion({ showDistances: !1, showAngles: !1, showCoordinates: !0, showEdges: !1, showArea: !1, closed: !0, maxMarkers: 1, minMarkers: 1, measureType: "Point" }) , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/distance.svg", "[title]tt.distance_measurement", function() { $("#menu_measurements").next().slideDown(); var t = n.measuringTool.startInsertion({ showDistances: !0, showArea: !1, closed: !1, minMarkers: 2, maxMarkers: 2, measureType: "Distance" }) , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/height.svg", "[title]tt.height_measurement", function() { $("#menu_measurements").next().slideDown(); var t = n.measuringTool.startInsertion({ showDistances: !0, showHeight: !0, showArea: !1, closed: !1, maxMarkers: 2, minMarkers: 2, measureType: "Ver Distance" }) , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/circle.svg", "[title]tt.circle_measurement", function() { $("#menu_measurements").next().slideDown(); var t = n.measuringTool.startInsertion({ showDistances: !1, showHeight: !1, showArea: !1, showCircle: !0, showEdges: !1, closed: !1, maxMarkers: 3, minMarkers: 3, measureType: "Circle" }) , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/azimuth.svg", "Azimuth", function() { $("#menu_measurements").next().slideDown(); var t = n.measuringTool.startInsertion({ showDistances: !1, showHeight: !1, showArea: !1, showCircle: !1, showEdges: !1, showAzimuth: !0, closed: !1, maxMarkers: 2, minMarkers: 2, measureType: "Azimuth" }) , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/area.svg", "[title]tt.area_measurement", function() { $("#menu_measurements").next().slideDown(); var t = n.measuringTool.startInsertion({ showDistances: !0, showArea: !0, closed: !0, minMarkers: 3, measureType: "Area" }) , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/area.svg", "[title]tt.Hor Area", function() { $("#menu_measurements").next().slideDown(); var t = n.measuringTool.startInsertion({ showDistances: !0, showArea: !0, closed: !0, minMarkers: 3, measureType: "Hor Area" }) , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/area.svg", "[title]tt.Ver Area", function() { $("#menu_measurements").next().slideDown(); var t = n.measuringTool.startInsertion({ showDistances: !0, showArea: !0, closed: !0, minMarkers: 3, measureType: "Ver Area" }) , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/area.svg", "[title]tt.area_freedom_rect", function() { $("#menu_measurements").next().slideDown(); var t = n.measuringTool.startInsertion({ showDistances: !0, showArea: !0, closed: !0, minMarkers: 4, maxMarkers: 4, isRect: !0, measureType: "Rect Area" }) , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/area.svg", "[title]tt.area_horizontal_rect", function() { $("#menu_measurements").next().slideDown(); var t = n.measuringTool.startInsertion({ showDistances: !0, showArea: !0, closed: !0, minMarkers: 4, maxMarkers: 4, isRect: !0, faceDirection: "horizontal", measureType: "Hor Rect Area" }) , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/area.svg", "[title]tt.area_vertical_rect", function() { $("#menu_measurements").next().slideDown(); var t = n.measuringTool.startInsertion({ showDistances: !0, showArea: !0, closed: !0, minMarkers: 4, maxMarkers: 4, isRect: !0, faceDirection: "vertical", measureType: "Ver Rect Area" }) , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/volume.svg", "[title]tt.volume_measurement", function() { var t = n.volumeTool.startInsertion() , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/sphere_distances.svg", "[title]tt.volume_measurement", function() { var t = n.volumeTool.startInsertion({ type: Qp }) , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/profile.svg", "[title]tt.height_profile", function() { $("#menu_measurements").next().slideDown(); var t = n.profileTool.startInsertion() , e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/annotation.svg", "[title]tt.annotation", function() { $("#menu_measurements").next().slideDown(); var t = n.viewer.annotationTool.startInsertion() , e = $("#jstree_scene").jstree().get_json("annotations").children.find(function(e) { return e.data.uuid === t.uuid }); $.jstree.reference(e.id).deselect_all(), $.jstree.reference(e.id).select_node(e.id) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/reset_tools.svg", "[title]tt.remove_all_measurement", function() { n.viewer.scene.removeAllMeasurements() })); var t = $("#measurement_options_show"); t.selectgroup({ title: "Show/Hide labels" }), t.find("input").click(function(e) { e = "SHOW" === e.target.value; n.measuringTool.showLabels = e }); e = this.measuringTool.showLabels ? "SHOW" : "HIDE"; t.find("input[value=".concat(e, "]")).trigger("click") } }, { key: "initScene", value: function() { var u = this , e = $("#menu_scene") , t = e.next().find("#scene_objects") , n = e.next().find("#scene_object_properties") , i = e.next().find("#scene_export") , r = "".concat(Potree.resourcePath, "/icons/file_geojson.svg") , a = "".concat(Potree.resourcePath, "/icons/file_dxf.svg") , e = "".concat(Potree.resourcePath, "/icons/file_potree.svg"); i.append('\n\t\t\t\tExport:
    \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t')); var o = i.find("img[name=geojson_export_button]").parent(); o.click(function(e) { var t = u.viewer.scene , t = [].concat(Q(t.measurements), Q(t.profiles), Q(t.volumes)); 0 < t.length ? (t = Ey.toString(t), t = window.URL.createObjectURL(new Blob([t],{ type: "data:application/octet-stream" })), o.attr("href", t)) : (u.viewer.postError("nothing to export"), e.preventDefault()) }); var s = i.find("img[name=dxf_export_button]").parent(); s.click(function(e) { var t = u.viewer.scene , t = [].concat(Q(t.measurements), Q(t.profiles), Q(t.volumes)); 0 < t.length ? (t = _y.toString(t), t = window.URL.createObjectURL(new Blob([t],{ type: "data:application/octet-stream" })), s.attr("href", t)) : (u.viewer.postError("no measurements to export"), e.preventDefault()) }); var l = i.find("img[name=potree_export_button]").parent(); l.click(function(e) { var t = Potree.saveProject(u.viewer) , t = xw.stringify(t, null, "\t") , t = window.URL.createObjectURL(new Blob([t],{ type: "data:application/octet-stream" })); l.attr("href", t) }); var c = new Iy(n,this.viewer); c.setScene(this.viewer.scene), localStorage.removeItem("jstree"); var d = $('
    '); t.append(d), d.jstree({ plugins: ["checkbox", "state"], core: { dblclick_toggle: !1, state: { checked: !0 }, check_callback: !0, expand_selected_onload: !0 }, checkbox: { keep_selected_style: !0, three_state: !1, whole_node: !1, tie_selection: !1 } }); var h = function(e, t, n, i) { n = d.jstree("create_node", e, { text: t, icon: n, data: i }, "last", !1, !1); return i.visible ? d.jstree("check_node", n) : d.jstree("uncheck_node", n), n } , p = d.jstree("create_node", "#", { text: "Point Clouds", id: "pointclouds" }, "last", !1, !1) , f = d.jstree("create_node", "#", { text: "Measurements", id: "measurements" }, "last", !1, !1) , n = d.jstree("create_node", "#", { text: "Annotations", id: "annotations" }, "last", !1, !1) , m = d.jstree("create_node", "#", { text: "Other", id: "other" }, "last", !1, !1) , t = d.jstree("create_node", "#", { text: "Vectors", id: "vectors" }, "last", !1, !1) , v = d.jstree("create_node", "#", { text: " Images", id: "images" }, "last", !1, !1); d.jstree("check_node", p), d.jstree("check_node", f), d.jstree("check_node", n), d.jstree("check_node", m), d.jstree("check_node", t), d.jstree("check_node", v), d.on("create_node.jstree", function(e, t) { d.jstree("open_all") }), d.on("select_node.jstree", function(e, t) { t = t.node.data; c.set(t), u.viewer.inputHandler.deselectAll(), t instanceof Yp && u.viewer.inputHandler.toggleSelection(t), $(u.viewer.renderer.domElement).focus() }), d.on("deselect_node.jstree", function(e, t) { c.set(null) }), d.on("delete_node.jstree", function(e, t) { c.set(null) }), d.on("dblclick", ".jstree-anchor", function(e) { var t, n, i, r, a, o, s, l = $.jstree.reference(e.target).get_node(e.target).data; e.target.classList.contains("jstree-checkbox") || (l instanceof xm ? (e = u.viewer.getBoundingBox([l]), (t = new Si).boundingBox = e, u.viewer.zoomTo(t, 1, 500)) : l instanceof Wf ? (n = l.points.map(function(e) { return e.position }), 0 == (t = (new kn).setFromPoints(n)).getSize(new Cn).length() && (t.min = t.max.clone(), t.expandByVector(new Cn(1,1,1))), (n = new Si).boundingBox = t, u.viewer.zoomTo(n, 2, 500)) : l instanceof Kp ? (n = l.points, 0 < (n = (new kn).setFromPoints(n)).getSize(new Cn).length() && ((i = new Si).boundingBox = n, u.viewer.zoomTo(i, 1, 500))) : l instanceof Yp ? 0 < (i = l.boundingBox.clone().applyMatrix4(l.matrixWorld)).getSize(new Cn).length() && ((r = new Si).boundingBox = i, u.viewer.zoomTo(r, 1, 500)) : l instanceof Kf ? l.moveHere(u.viewer.scene.getActiveCamera()) : l instanceof qf ? (r = l.camera.getWorldDirection(new Cn), l.camera instanceof ed ? (r.multiplyScalar(l.camera.right), a = (new Cn).addVectors(l.camera.position, r), u.viewer.setCameraMode(em.ORTHOGRAPHIC)) : l.camera instanceof $r && (r.multiplyScalar(u.viewer.scene.view.radius), a = (new Cn).addVectors(l.camera.position, r), u.viewer.setCameraMode(em.PERSPECTIVE)), u.viewer.scene.view.position.copy(l.camera.position), u.viewer.scene.view.lookAt(a)) : "SpotLight" === l.type ? (o = 0 < l.distance ? l.distance / 4 : 5e3, s = l.position, s = (new Cn).addVectors(s, l.getWorldDirection(new Cn).multiplyScalar(o)), u.viewer.scene.view.position.copy(l.position), u.viewer.scene.view.lookAt(s)) : l instanceof Si ? 0 < (o = (new kn).setFromObject(l)).getSize(new Cn).length() && ((s = new Si).boundingBox = o, u.viewer.zoomTo(s, 1, 500)) : l instanceof nw || l instanceof ly || Geopackage) }), d.on("uncheck_node.jstree", function(e, t) { t = t.node.data; t && (t.visible = !1) }), d.on("check_node.jstree", function(e, t) { t = t.node.data; t && (t.visible = !0) }); function g(e) { var t = e.pointcloud , e = "".concat(Potree.resourcePath, "/icons/cloud.svg") , n = h(p, t.name, e, t); t.addEventListener("visibility_changed", function() { t.visible ? d.jstree("check_node", n) : d.jstree("uncheck_node", n) }) } function y(e) { var t = e.measurement , e = Jf.getMeasurementIcon(t); h(f, t.name, e, t) } function w(e) { var t = e.volume , e = Jf.getMeasurementIcon(t) , n = h(f, t.name, e, t); t.addEventListener("visibility_changed", function() { t.visible ? d.jstree("check_node", n) : d.jstree("uncheck_node", n) }) } function b(e) { var t = e.profile , e = Jf.getMeasurementIcon(t); h(f, t.name, e, t) } function x(e) { var t = e.animation , e = "".concat(Potree.resourcePath, "/icons/camera_animation.svg"); h(m, "animation", e, t) } function E(e) { var t = e.images , e = "".concat(Potree.resourcePath, "/icons/picture.svg") , n = h(v, "images", e, t); t.addEventListener("visibility_changed", function() { t.visible ? d.jstree("check_node", n) : d.jstree("uncheck_node", n) }) } function _(e) { var t = e.images , e = "".concat(Potree.resourcePath, "/icons/picture.svg") , n = h(v, "360° images", e, t); t.addEventListener("visibility_changed", function() { t.visible ? d.jstree("check_node", n) : d.jstree("uncheck_node", n) }) } function M(e) { var t, e = e.geopackage, n = "".concat(Potree.resourcePath, "/icons/triangle.svg"), i = $("#jstree_scene"), r = ue(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() } } this.viewer.scene.addEventListener("pointcloud_added", g), this.viewer.scene.addEventListener("measurement_added", y), this.viewer.scene.addEventListener("profile_added", b), this.viewer.scene.addEventListener("volume_added", w), this.viewer.scene.addEventListener("camera_animation_added", x), this.viewer.scene.addEventListener("oriented_images_added", E), this.viewer.scene.addEventListener("360_images_added", _), this.viewer.scene.addEventListener("geopackage_added", M), this.viewer.scene.addEventListener("polygon_clip_volume_added", w), this.viewer.scene.annotations.addEventListener("annotation_added", function(e) { var n = e.annotation , t = "".concat(Potree.resourcePath, "/icons/annotation.svg") , e = u.annotationMapping.get(n.parent) , t = h(e, n.title, t, n); u.annotationMapping.set(n, t), n.addEventListener("annotation_changed", function(e) { var t = $("#jstree_scene").jstree().get_json("annotations").children.find(function(e) { return e.data.uuid === n.uuid }); $.jstree.reference(t.id).rename_node(t.id, n.title) }) }); function A(t) { var e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.measurement.uuid }); d.jstree("delete_node", e.id) } this.viewer.scene.addEventListener("measurement_removed", A), this.viewer.scene.addEventListener("volume_removed", function(t) { var e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.volume.uuid }); d.jstree("delete_node", e.id) }), this.viewer.scene.addEventListener("polygon_clip_volume_removed", function(t) { var e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.volume.uuid }); d.jstree("delete_node", e.id) }), this.viewer.scene.addEventListener("profile_removed", function(t) { var e = $("#jstree_scene").jstree().get_json("measurements").children.find(function(e) { return e.data.uuid === t.profile.uuid }); d.jstree("delete_node", e.id) }); var T = "".concat(Potree.resourcePath, "/icons/annotation.svg"); this.annotationMapping = new Map, this.annotationMapping.set(this.viewer.scene.annotations, n), this.viewer.scene.annotations.traverseDescendants(function(e) { var t = u.annotationMapping.get(e.parent) , t = h(t, e.title, T, e); u.annotationMapping.set(e, t) }); var S, n = this.viewer.scene, C = ue(n.pointclouds); try { for (C.s(); !(S = C.n()).done; ) { var P = S.value; g({ pointcloud: P }) } } catch (e) { C.e(e) } finally { C.f() } var D, k = ue(n.measurements); try { for (k.s(); !(D = k.n()).done; ) { var B = D.value; y({ measurement: B }) } } catch (e) { k.e(e) } finally { k.f() } for (var L = 0, R = [].concat(Q(n.volumes), Q(n.polygonClipVolumes)); L < R.length; L++) { var F = R[L]; w({ volume: F }) } var I, O = ue(n.cameraAnimations); try { for (O.s(); !(I = O.n()).done; ) x({ animation: I.value }) } catch (e) { O.e(e) } finally { O.f() } var z, N = ue(n.orientedImages); try { for (N.s(); !(z = N.n()).done; ) E({ images: z.value }) } catch (e) { N.e(e) } finally { N.f() } var U, G = ue(n.images360); try { for (G.s(); !(U = G.n()).done; ) _({ images: U.value }) } catch (e) { G.e(e) } finally { G.f() } var H, V = ue(n.geopackages); try { for (V.s(); !(H = V.n()).done; ) M({ geopackage: H.value }) } catch (e) { V.e(e) } finally { V.f() } var j, W = ue(n.profiles); try { for (W.s(); !(j = W.n()).done; ) { var X = j.value; b({ profile: X }) } } catch (e) { W.e(e) } finally { W.f() } h(m, "Camera", null, new Kr), this.viewer.addEventListener("scene_changed", function(e) { c.setScene(e.scene), e.oldScene.removeEventListener("pointcloud_added", g), e.oldScene.removeEventListener("measurement_added", y), e.oldScene.removeEventListener("profile_added", b), e.oldScene.removeEventListener("volume_added", w), e.oldScene.removeEventListener("polygon_clip_volume_added", w), e.oldScene.removeEventListener("measurement_removed", A), e.scene.addEventListener("pointcloud_added", g), e.scene.addEventListener("measurement_added", y), e.scene.addEventListener("profile_added", b), e.scene.addEventListener("volume_added", w), e.scene.addEventListener("polygon_clip_volume_added", w), e.scene.addEventListener("measurement_removed", A) }) } }, { key: "initClippingTool", value: function() { var n = this; this.viewer.addEventListener("cliptask_changed", function(e) { console.log("TODO") }), this.viewer.addEventListener("clipmethod_changed", function(e) { console.log("TODO") }); var e = $("#cliptask_options"); e.selectgroup({ title: "Clip Task" }), e.find("input").click(function(e) { n.viewer.setClipTask(tm[e.target.value]) }); var t = Object.keys(tm).filter(function(e) { return tm[e] === n.viewer.clipTask }); e.find("input[value=".concat(t, "]")).trigger("click"); e = $("#clipmethod_options"); e.selectgroup({ title: "Clip Method" }), e.find("input").click(function(e) { n.viewer.setClipMethod(nm[e.target.value]) }); t = Object.keys(nm).filter(function(e) { return nm[e] === n.viewer.clipMethod }); e.find("input[value=".concat(t, "]")).trigger("click"); t = $("#clipping_tools"); t.append(this.createToolIcon(Potree.resourcePath + "/icons/clip_volume.svg", "[title]tt.clip_volume", function() { var t = n.volumeTool.startInsertion({ clip: !0 }) , 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) })), t.append(this.createToolIcon(Potree.resourcePath + "/icons/clip-polygon.svg", "[title]tt.clip_polygon", function() { var t = n.viewer.clippingTool.startInsertion({ type: "polygon" }) , 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) })); var i = new Jv(this.viewer); t.append(this.createToolIcon(Potree.resourcePath + "/icons/clip-screen.svg", "[title]tt.screen_clip_box", function() { var t, e; n.viewer.scene.getActiveCamera()instanceof ed ? (t = i.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)) : n.viewer.postMessage("Switch to Orthographic Camera Mode before using the Screen-Box-Select tool.", { duration: 2e3 }) })), t.append(this.createToolIcon(Potree.resourcePath + "/icons/remove.svg", "[title]tt.remove_all_clipping_volumes", function() { n.viewer.scene.removeAllClipVolumes() })) } }, { key: "initFilters", value: function() { this.initClassificationList(), this.initReturnFilters(), this.initGPSTimeFilters(), this.initPointSourceIDFilters() } }, { key: "initReturnFilters", value: function() { var i = this , e = $("#return_filter_panel") , r = e.find("#sldReturnNumber") , a = e.find("#lblReturnNumber"); r.slider({ range: !0, min: 0, max: 7, step: 1, values: [0, 7], slide: function(e, t) { i.viewer.setFilterReturnNumberRange(t.values[0], t.values[1]) } }); function t(e) { var t = (n = N(i.viewer.filterReturnNumberRange, 2))[0] , n = n[1]; a[0].innerHTML = "".concat(t, " to ").concat(n), r.slider({ values: [t, n] }) } this.viewer.addEventListener("filter_return_number_range_changed", t), t(); var o = e.find("#sldNumberOfReturns") , s = e.find("#lblNumberOfReturns"); o.slider({ range: !0, min: 0, max: 7, step: 1, values: [0, 7], slide: function(e, t) { i.viewer.setFilterNumberOfReturnsRange(t.values[0], t.values[1]) } }); function n(e) { var t = (n = N(i.viewer.filterNumberOfReturnsRange, 2))[0] , n = n[1]; s[0].innerHTML = "".concat(t, " to ").concat(n), o.slider({ values: [t, n] }) } this.viewer.addEventListener("filter_number_of_returns_range_changed", n), n() } }, { key: "initGPSTimeFilters", value: function() { var i = this , e = $("#gpstime_filter_panel") , r = new zy({ levels: 4, slide: function(e) { var t; (t = i.viewer).setFilterGPSTimeRange.apply(t, Q(e.values)) } }) , a = !1; this.viewer.addEventListener("update", function(e) { var t = i.viewer.getGpsTimeExtent() , n = t[0] !== 1 / 0; !a && n && function() { $("#gpstime_multilevel_range_container")[0].prepend(r.element); var e = i.viewer.getGpsTimeExtent(); r.setRange(e), r.setValues(e), a = !0 }(), r.setRange(t) }); var n = e.find("#txtGpsTime") , e = e.find("#btnFindGpsTime") , o = null; n.on("input", function(e) { var t = n.val(); isNaN(t) ? (o = null, n.css("background-color", "#ff9999")) : (t = parseFloat(t), o = t, n.css("background-color", "")) }), e.click(function() { null !== o && viewer.moveToGpsTimeVicinity(o) }) } }, { key: "initPointSourceIDFilters", value: function() { var n = this , i = $("#pointsourceid_filter_panel") , r = new zy({ levels: 4, range: [0, 65535], precision: 1, slide: function(e) { e = e.values; n.viewer.setFilterPointSourceIDRange(e[0], e[1]) } }) , a = !1; this.viewer.addEventListener("update", function(e) { var t = n.viewer.filterPointSourceIDRange; a || (i[0].prepend(r.element), a = !0, r.setValues(t)) }) } }, { key: "initClassificationList", value: function() { function e() { for (var e in n(), c.viewer.classifications) t(e, c.viewer.classifications[e].name); i() } var c = this , d = $("#classificationList") , t = function(t, e) { var n = c.viewer.classifications[t] , i = "colorPickerClassification_" + t , r = n.visible ? "checked" : "" , r = $('\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t
  • \n\t\t\t')) , e = r.find("input") , i = r.find("#".concat(i)); e.click(function(e) { c.viewer.setClassificationVisibility(t, e.target.checked) }); e = n.color.map(function(e) { return 255 * e }).join(", "), e = "rgb(".concat(e, ")"); i.spectrum({ color: e, showInput: !0, preferredFormat: "rgb", cancelText: "", chooseText: "Apply", move: function(e) { e = e.toRgb(), e = [e.r / 255, e.g / 255, e.b / 255, 1]; n.color = e }, change: function(e) { e = e.toRgb(), e = [e.r / 255, e.g / 255, e.b / 255, 1]; n.color = e } }), d.append(r) } , n = function() { var e = $('\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t
  • \n\t\t\t'); e.find("input").click(function(e) { c.viewer.toggleAllClassificationsVisibility() }), d.append(e) } , i = function() { var e = $('\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t
  • \n\t\t\t'); e.find("input").click(function() { for (var e = c.viewer.classifications, t = 0, n = Object.keys(e); t < n.length; t++) { var i = n[t] , r = e[i]; c.viewer.setClassificationVisibility(i, !r.visible) } }), d.append(e) }; e(), this.viewer.addEventListener("classifications_changed", function() { d.empty(), e() }), this.viewer.addEventListener("classification_visibility_changed", function() { for (var e = 0, t = Object.keys(c.viewer.classifications); e < t.length; e++) { var n = t[e] , i = c.viewer.classifications[n]; d.find("#chkClassification_".concat(n)).prop("checked", i.visible) } for (var r = 0, a = 0, o = 0, s = Object.keys(c.viewer.classifications); o < s.length; o++) { var l = s[o]; c.viewer.classifications[l].visible && r++, a++ } var u = r === a; d.find("#toggleClassificationFilters").prop("checked", u) }) } }, { key: "initAccordion", value: function() { var r = this; $(".accordion > h3").each(function() { var e = $(this) , t = $(this).next(); t.hide(), e.click(function() { t.slideToggle() }) }); for (var a = [["EN", "en"], ["FR", "fr"], ["DE", "de"], ["JP", "jp"], ["ES", "es"], ["SE", "se"], ["ZH", "zh"]], o = $("#potree_languages"), e = 0; e < a.length; e++) !function(e) { var t = N(a[e], 2) , n = t[0] , i = t[1] , n = $("".concat(n, "")); n.click(function() { return r.viewer.setLanguage(i) }), 0 === e && n.css("margin-left", "30px"), o.append(n), e < a.length - 1 && o.append($(document.createTextNode(" - "))) }(e) } }, { key: "initAppearance", value: function() { var n = this , t = this.dom.find("#sldPointBudget"); t.slider({ value: this.viewer.getPointBudget(), min: 1e5, max: 1e7, step: 1e3, slide: function(e, t) { n.viewer.setPointBudget(t.value) } }), this.dom.find("#sldFOV").slider({ value: this.viewer.getFOV(), min: 20, max: 100, step: 1, slide: function(e, t) { n.viewer.setFOV(t.value) } }), $("#sldEDLRadius").slider({ value: this.viewer.getEDLRadius(), min: 1, max: 4, step: .01, slide: function(e, t) { n.viewer.setEDLRadius(t.value) } }), $("#sldEDLStrength").slider({ value: this.viewer.getEDLStrength(), min: 0, max: 5, step: .01, slide: function(e, t) { n.viewer.setEDLStrength(t.value) } }), $("#sldEDLOpacity").slider({ value: this.viewer.getEDLOpacity(), min: 0, max: 1, step: .01, slide: function(e, t) { n.viewer.setEDLOpacity(t.value) } }), this.viewer.addEventListener("point_budget_changed", function(e) { $("#lblPointBudget")[0].innerHTML = Jf.addCommas(n.viewer.getPointBudget()), t.slider({ value: n.viewer.getPointBudget() }) }), this.viewer.addEventListener("fov_changed", function(e) { $("#lblFOV")[0].innerHTML = parseInt(n.viewer.getFOV()), $("#sldFOV").slider({ value: n.viewer.getFOV() }) }), this.viewer.addEventListener("use_edl_changed", function(e) { $("#chkEDLEnabled")[0].checked = n.viewer.getEDLEnabled() }), this.viewer.addEventListener("edl_radius_changed", function(e) { $("#lblEDLRadius")[0].innerHTML = n.viewer.getEDLRadius().toFixed(1), $("#sldEDLRadius").slider({ value: n.viewer.getEDLRadius() }) }), this.viewer.addEventListener("edl_strength_changed", function(e) { $("#lblEDLStrength")[0].innerHTML = n.viewer.getEDLStrength().toFixed(1), $("#sldEDLStrength").slider({ value: n.viewer.getEDLStrength() }) }), this.viewer.addEventListener("background_changed", function(e) { $("input[name=background][value='" + n.viewer.getBackground() + "']").prop("checked", !0) }), $("#lblPointBudget")[0].innerHTML = Jf.addCommas(this.viewer.getPointBudget()), $("#lblFOV")[0].innerHTML = parseInt(this.viewer.getFOV()), $("#lblEDLRadius")[0].innerHTML = this.viewer.getEDLRadius().toFixed(1), $("#lblEDLStrength")[0].innerHTML = this.viewer.getEDLStrength().toFixed(1), $("#chkEDLEnabled")[0].checked = this.viewer.getEDLEnabled(); var e = $("#background_options"); e.selectgroup(), e.find("input").click(function(e) { n.viewer.setBackground(e.target.value) }); e = this.viewer.getBackground(); try { $("input[name=background_options][value=".concat(e, "]")).trigger("click") } catch (e) {} $("#chkEDLEnabled").click(function() { n.viewer.setEDLEnabled($("#chkEDLEnabled").prop("checked")) }) } }, { key: "initNavigation", value: function() { var n = this , e = $("#navigation") , t = $("#sldMoveSpeed") , i = $("#lblMoveSpeed"); e.append(this.createToolIcon(Potree.resourcePath + "/icons/earth_controls_1.png", "[title]tt.earth_control", function() { n.viewer.setControls(n.viewer.earthControls) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/fps_controls.svg", "[title]tt.flight_control", function() { n.viewer.setControls(n.viewer.fpControls), n.viewer.fpControls.lockElevation = !1 })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/helicopter_controls.svg", "[title]tt.heli_control", function() { n.viewer.setControls(n.viewer.fpControls), n.viewer.fpControls.lockElevation = !0 })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/orbit_controls.svg", "[title]tt.orbit_control", function() { n.viewer.setControls(n.viewer.orbitControls) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/focus.svg", "[title]tt.focus_control", function() { n.viewer.fitToScreen() })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/navigation_cube.svg", "[title]tt.navigation_cube_control", function() { n.viewer.toggleNavigationCube() })), e.append(this.createToolIcon(Potree.resourcePath + "/images/compas.svg", "[title]tt.compass", function() { var e = !n.viewer.compass.isVisible(); n.viewer.compass.setVisible(e) })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/camera_animation.svg", "[title]tt.camera_animation", function() { var e = bv.defaultFromView(n.viewer); viewer.scene.addCameraAnimation(e) })), e.append("
    "), e.append(this.createToolIcon(Potree.resourcePath + "/icons/left.svg", "[title]tt.left_view_control", function() { n.viewer.setLeftView() })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/right.svg", "[title]tt.right_view_control", function() { n.viewer.setRightView() })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/front.svg", "[title]tt.front_view_control", function() { n.viewer.setFrontView() })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/back.svg", "[title]tt.back_view_control", function() { n.viewer.setBackView() })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/top.svg", "[title]tt.top_view_control", function() { n.viewer.setTopView() })), e.append(this.createToolIcon(Potree.resourcePath + "/icons/bottom.svg", "[title]tt.bottom_view_control", function() { n.viewer.setBottomView() })); var r = $('\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t'); e.append(r), r.selectgroup({ title: "Camera Projection" }), r.find("input").click(function(e) { n.viewer.setCameraMode(em[e.target.value]) }); e = Object.keys(em).filter(function(e) { return em[e] === n.viewer.scene.cameraMode }); r.find("input[value=".concat(e, "]")).trigger("click"); function a(e) { return Math.pow((e - o.x) / o.y, .25) } var o = new yn(1,1e4); t.slider({ value: a(this.viewer.getMoveSpeed()), min: 0, max: 1, step: .01, slide: function(e, t) { n.viewer.setMoveSpeed((t = t.value, Math.pow(t, 4) * o.y + o.x)) } }), this.viewer.addEventListener("move_speed_changed", function(e) { i.html(n.viewer.getMoveSpeed().toFixed(1)), t.slider({ value: a(n.viewer.getMoveSpeed()) }) }), i.html(this.viewer.getMoveSpeed().toFixed(1)) } }, { key: "initSettings", value: function() { var n = this; $("#sldMinNodeSize").slider({ value: this.viewer.getMinNodeSize(), min: 0, max: 1e3, step: .01, slide: function(e, t) { n.viewer.setMinNodeSize(t.value) } }), this.viewer.addEventListener("minnodesize_changed", function(e) { $("#lblMinNodeSize").html(parseInt(n.viewer.getMinNodeSize())), $("#sldMinNodeSize").slider({ value: n.viewer.getMinNodeSize() }) }), $("#lblMinNodeSize").html(parseInt(this.viewer.getMinNodeSize())); var e = $("#splat_quality_options"); e.selectgroup({ title: "Splat Quality" }), e.find("input").click(function(e) { "standard" === e.target.value ? n.viewer.useHQ = !1 : "hq" === e.target.value && (n.viewer.useHQ = !0) }); var t = this.viewer.useHQ ? "hq" : "standard"; e.find("input[value=".concat(t, "]")).trigger("click"), $("#show_bounding_box").click(function() { n.viewer.setShowBoundingBox($("#show_bounding_box").prop("checked")) }), $("#set_freeze").click(function() { n.viewer.setFreeze($("#set_freeze").prop("checked")) }) } }]), t }(), _w = function() { y(i, hn); var n = w(i); function i(e) { var t; return O(this, i), (t = n.call(this)).viewer = e, t.renderer = e.renderer, t.sg = new Su(.1), t.sm = new Xu, t.s = new Hr(t.sg,t.sm), t } return h(i, [{ key: "startInsertion", value: function() { var n = this , t = this.viewer.renderer.domElement , i = new Kf({ position: [589748.27, 231444.54, 753.675], title: "Annotation Title", description: "Annotation Description", radius: 1, cameraPosition: [589748.27, 231444.54, 753.675] }); this.dispatchEvent({ type: "start_inserting_annotation", annotation: i }); var r = this.viewer.scene.annotations; r.add(i); function a(e) { e.button === C.LEFT ? o.finish() : e.button === C.RIGHT && o.cancel() } var o = { cancel: null, finish: null }; o.cancel = function(e) { r.remove(i), t.removeEventListener("mouseup", a, !0) } , o.finish = function(e) { t.removeEventListener("mouseup", a, !0) } , t.addEventListener("mouseup", a, !0); function s(e) { viewer.scene.scene.remove(n.s), n.s.removeEventListener("drag", l), n.s.removeEventListener("drop", s) } var l = function(e) { var t = e.viewer.scene.getActiveCamera() , e = e.viewer.inputHandler.intersectPoint; e && (n.s.position.copy(e.location), i.position.copy(e.location), i.cameraTarget.copy(e.location), i.cameraPosition.copy(t.position)) }; return this.s.addEventListener("drag", l), this.s.addEventListener("drop", s), this.viewer.scene.scene.add(this.s), this.viewer.inputHandler.startDragging(this.s), i } }, { key: "update", value: function() {} }, { key: "render", value: function() {} }]), i }(), Mw = 15, Aw = new bu(1,1), Tw = new _c, Sw = new tl({ color: "#ffffff" }), Cw = function() { y(i, Si); var n = w(i); function i(e) { var t; return O(this, i), (t = n.call(this)).lineLength = null != e.lineLength ? e.lineLength : .6, t.position.copy(e.position), t.normal = null != e.normal ? e.normal : new Cn(0,0,-1), t.root = e.root, t.build(), t } return h(i, [{ key: "build", value: function() { bw = bw || new $i({ transparent: !0, map: Tw.load(Potree.resourcePath + "/textures/spot_default.png") }); var e = this.normal.clone().multiplyScalar(this.lineLength); this.line = Sf.createLine([new Cn(0,0,0), e], { mat: Sw }); var t = new Si; this.spot = new Hr(Aw,bw), this.spot.scale.set(.4, .4, .4), this.titleLabel = new Jp({ root: t, text: "1", sizeInfo: { width2d: 200 }, textColor: { r: 255, g: 255, b: 255, a: 1 }, backgroundColor: { r: 0, g: 0, b: 0, a: .8 }, borderRadius: 6, fontsize: 13, fontWeight: "", renderOrder: Mw, pickOrder: Mw }), this.spot.renderOrder = Mw, this.titleLabel.position.set(0, .4, 0), this.titleLabel.sprite.material.depthTest = this.titleLabel.sprite.material.depthWrite = !0, t.position.copy(e), t.add(this.spot), t.add(this.titleLabel), this.add(t), this.add(this.line), viewer.scene.tags.add(this) } }, { key: "updateMatrixWorld", value: function(e) { this.updateMatrix(), this.matrixWorld.multiplyMatrices(this.root.matrixWorld, this.matrix); for (var t = this.children, n = 0, i = t.length; n < i; n++) t[n].updateMatrixWorld(e) } }, { key: "updateWorldMatrix", value: function(e, t) { if (!0 === e && null !== this.root && this.root.updateWorldMatrix(!0, !1), this.matrixAutoUpdate && this.updateMatrix(), this.matrixWorld.multiplyMatrices(this.root.matrixWorld, this.matrix), !0 === t) for (var n = this.children, i = 0, r = n.length; i < r; i++) n[i].updateWorldMatrix(!1, !0) } }]), i }(), Pw = function() { y(i, hn); var n = w(i); function i(e) { var t; return O(this, i), (t = n.call(this)).viewer = e, t.viewer.addEventListener("start_inserting_tag", function(e) { t.viewer.dispatchEvent({ type: "cancel_insertions" }) }), t } return h(i, [{ key: "startInsertion", value: function() { var e = this , n = $.Deferred(); this.viewer.dispatchEvent({ type: "start_inserting_tag" }); var i = function() { e.viewer.removeEventListener("global_click", t) } , t = function(e) { var t = e.intersect && e.intersect.location; if (t) { t = Potree.Utils.datasetPosTransform({ toDataset: !0, pointcloud: e.intersect.pointcloud, object: e.intersect.object, position: t }), t = new Cw({ title: "1", position: t, normal: e.intersect.normal, root: e.intersect.pointcloud || e.intersect.object }); return i(), e.consume && e.consume(), n.resolve(t), { stopContinue: !0 } } }; return this.viewer.addEventListener("global_click", t, 10), n.promise() } }]), i }(), Dw = function() { y(r, Si); var i = w(r); function r(n) { var a; O(this, r), (a = i.call(this)).viewer = n; function e(e) { var t = new $i({ depthTest: !0, depthWrite: !0, side: Y }); return (new _c).load(le.resourcePath + "/textures/navigation/" + e, function(e) { e.anisotropy = n.renderer.capabilities.getMaxAnisotropy(), t.map = e, t.needsUpdate = !0 }), t } var t = new bu(1,1); a.front = new Hr(t,e("F.png")), a.front.position.y = -.5, a.front.rotation.x = Math.PI / 2, a.front.updateMatrixWorld(), a.front.name = "F", a.add(a.front), a.back = new Hr(t,e("B.png")), a.back.position.y = .5, a.back.rotation.x = Math.PI / 2, a.back.updateMatrixWorld(), a.back.name = "B", a.add(a.back), a.left = new Hr(t,e("L.png")), a.left.position.x = -.5, a.left.rotation.y = Math.PI / 2, a.left.updateMatrixWorld(), a.left.name = "L", a.add(a.left), a.right = new Hr(t,e("R.png")), a.right.position.x = .5, a.right.rotation.y = Math.PI / 2, a.right.updateMatrixWorld(), a.right.name = "R", a.add(a.right), a.bottom = new Hr(t,e("D.png")), a.bottom.position.z = -.5, a.bottom.updateMatrixWorld(), a.bottom.name = "D", a.add(a.bottom), a.top = new Hr(t,e("U.png")), a.top.position.z = .5, a.top.updateMatrixWorld(), a.top.name = "U", a.add(a.top), a.width = 150, a.camera = new ed(-1,1,1,-1,-1,1), a.camera.position.copy(new Cn(0,0,0)), a.camera.lookAt(new Cn(0,1,0)), a.camera.updateMatrixWorld(), a.camera.rotation.order = "ZXY"; return a.viewer.renderer.domElement.addEventListener("mousedown", function(e) { if (a.visible) { a.pickedFace = null; var t = new yn; if (t.x = e.clientX - (window.innerWidth - a.width), t.y = e.clientY, !(t.x < 0 || t.y > a.width)) { t.x = t.x / a.width * 2 - 1, t.y = 2 * -(t.y / a.width) + 1; e = new sh; e.setFromCamera(t, a.camera), e.ray.origin.sub(a.camera.getWorldDirection(new Cn)); for (var n = e.intersectObjects(a.children), i = 1e3, r = 0; r < n.length; r++) n[r].distance < i && (a.pickedFace = n[r].object.name, i = n[r].distance); a.pickedFace && a.viewer.setView(a.pickedFace) } } }, !1), a } return h(r, [{ key: "update", value: function(e) { this.camera.rotation.copy(e), this.camera.updateMatrixWorld() } }]), r }(), kw = 2, Bw = function() { y(i, hn); var n = w(i); function i(e) { var a; O(this, i), (a = n.call(this)).viewer = e, a.renderer = e.renderer, a.scene = null, a.sceneControls = new gs, a.rotationSpeed = 3, a.fadeFactor = 100, a.yawDelta = 0, a.pitchDelta = 0, a.panDelta = new yn(0,0), a.radiusDelta = 0, a.doubleClockZoomEnabled = !0, a.tweens = [], a.dollyStart = new yn, a.dollyEnd = new yn; function t(e) { var t, n; !a.enabled || (t = e.dragViewport) && "OrthographicCamera" != t.camera.type && null === e.drag.object && (n = e.isTouch ? 1 == e.touches.length ? "rotate" : "scale-pan" : e.buttons === rm.LEFT ? "rotate" : "pan", void 0 === e.drag.startHandled && (e.drag.startHandled = !0, a.dispatchEvent({ type: "start" })), (t = e.drag.pointerDelta.clone()).y *= -1, "rotate" == n ? (a.yawDelta += t.x * a.rotationSpeed, a.pitchDelta += t.y * a.rotationSpeed) : "pan" == n ? (a.panDelta.x += t.x, a.panDelta.y += t.y) : "scale-pan" == n && (a.dollyEnd.subVectors(e.touches[0].pointer, e.touches[1].pointer), n = a.dollyEnd.length() / a.dollyStart.length(), a.dollyStart.copy(a.dollyEnd), a.radiusDelta = (1 - n) * a.scene.view.radius, n = (new yn).addVectors(e.touches[0].pointer, e.touches[1].pointer).multiplyScalar(.5), (e = (new yn).subVectors(n, a.lastScalePointer)).y *= -1, a.panDelta.add(e), a.lastScalePointer = n.clone()), a.stopTweens()) } var 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 ? (i = e, t = (r = o).touches[0].pageX - r.touches[1].pageX, n = r.touches[0].pageY - r.touches[1].pageY, r = Math.sqrt(t * t + n * n), t = i.touches[0].pageX - i.touches[1].pageX, n = i.touches[0].pageY - i.touches[1].pageY, i = Math.sqrt(t * t + n * n), t = a.scene.view.radius + a.radiusDelta, a.radiusDelta = t / (i / r) - t, a.stopTweens()) : 3 === e.touches.length && 3 === o.touches.length && (i = ((n = o).touches[0].pageX + n.touches[1].pageX + n.touches[2].pageX) / 3, r = (n.touches[0].pageY + n.touches[1].pageY + n.touches[2].pageY) / 3, t = (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 = (t - i) / a.renderer.domElement.clientWidth, r = (n - r) / a.renderer.domElement.clientHeight, a.panDelta.x += i, a.panDelta.y += r, a.stopTweens()), o = e) }), a.viewer.addEventListener("global_drag", t), a.viewer.addEventListener("global_drop", function(e) { a.enabled && a.dispatchEvent({ type: "end" }) }), a.viewer.addEventListener("global_mousewheel", function(e) { var t; a.enabled && ((t = a.scene.view.radius + a.radiusDelta) < .1 && 0 < e.delta || (a.radiusDelta += -e.delta * t * .1, a.stopTweens())) }), a.viewer.addEventListener("global_dblclick", function(e) { a.enabled && a.doubleClockZoomEnabled && a.zoomToLocation(e.mouse) }), a.viewer.addEventListener("global_touchmove", function(e) { 1 < e.touches.length && t(e) }); return a.viewer.addEventListener("global_touchstart", function(e) { a.enabled && 2 == e.touches.length && (e = e, a.dollyStart.subVectors(e.touches[0].pointer, e.touches[1].pointer), a.lastScalePointer = (new yn).addVectors(e.touches[0].pointer, e.touches[1].pointer).multiplyScalar(.5)) }), a } return h(i, [{ key: "setScene", value: function(e) { this.scene = e } }, { key: "setEnable", value: function(e) { this.enabled = e } }, { key: "stop", value: function() { this.yawDelta = 0, this.pitchDelta = 0, this.radiusDelta = 0, this.panDelta.set(0, 0) } }, { key: "zoomToLocation", value: function(e) { var t, n = (i = viewer.inputHandler.intersect).object || i.pointcloud, i = i && i.location; i && n && (t = this.scene.view.position.distanceTo(i), n = n.boundingBox.clone().applyMatrix4(n.matrixWorld).getSize(new Cn).length(), n = gn.clamp(t, .1, Math.max(.1 * n, 3)), kw = n, viewer.focusOnObject({ position: i }, "point", null, { distance: n })) } }, { key: "stopTweens", value: function() { this.tweens.forEach(function(e) { return e.stop() }), this.tweens = [] } }, { key: "update", value: function(e) { var t, n, i, r; this.enabled && (r = this.scene.view, t = Math.min(1, this.fadeFactor * e), n = r.yaw, i = r.pitch, e = r.getPivot(), n -= t * this.yawDelta, i -= t * this.pitchDelta, r.yaw = n, r.pitch = i, i = this.scene.view.direction.multiplyScalar(-r.radius), e = (new Cn).addVectors(e, i), r.position.copy(e), i = this.scene.getActiveCamera(), e = 2 * r.radius * Math.tan(gn.degToRad(i.fov / 2)), i = -this.panDelta.x * e, e = this.panDelta.y * e, r.pan(i, e), i = r.radius + +this.radiusDelta, e = r.direction.multiplyScalar(-i), e = (new Cn).addVectors(r.getPivot(), e), this.constantlyForward && i < kw && (i = kw), r.radius = i, r.position.copy(e), r = r.radius, this.viewer.setMoveSpeed(r), this.stop()) } }]), i }(), Lw = function() { y(i, hn); var n = w(i); function i(e) { var u; O(this, i), (u = n.call(this, e)).viewer = e, u.renderer = e.renderer, u.scene = null, u.sceneControls = new gs, u.rotationSpeed = 10, u.fadeFactor = 20, u.wheelDelta = 0, u.zoomDelta = new Cn, u.camStart = null, u.tweens = []; var t = new Su(1,16,16) , e = new Xu; u.pivotIndicator = new Hr(t,e), u.pivotIndicator.visible = !1, u.sceneControls.add(u.pivotIndicator); return u.addEventListener("drag", function(e) { var t, n, i, r, a, o, s, l; null === e.drag.object && u.pivot && (void 0 === e.drag.startHandled && (e.drag.startHandled = !0, u.dispatchEvent({ type: "start" })), t = u.camStart, i = u.scene.getActiveCamera(), n = u.viewer.scene.view, o = e.drag.end, r = u.viewer.renderer.domElement, e.drag.Buttons === o.LEFT ? (i = Jf.ButtonsToRay(u.viewer.inputHandler.pointer, i, r.clientWidth, r.clientHeight), r = (new ki).setFromNormalAndCoplanarPoint(new Cn(0,0,1), u.pivot), 0 < (r = i.distanceToPlane(r)) && (l = (new Cn).addVectors(t.position, i.direction.clone().multiplyScalar(r)), a = (new Cn).subVectors(l, u.pivot), s = t.position.clone().sub(a), n.position.copy(s), l = s.distanceTo(u.pivot), n.radius = l, a = n.radius / 2.5, u.viewer.setMoveSpeed(a))) : e.drag.Buttons === o.RIGHT && (s = e.drag.ButtonsDelta.x / u.renderer.domElement.clientWidth, l = e.drag.ButtonsDelta.y / u.renderer.domElement.clientHeight, a = -s * u.rotationSpeed * .5, o = -l * u.rotationSpeed * .2, e = n.pitch, (s = n.clone()).pitch = s.pitch + o, o = s.pitch - e, l = (new Cn).subVectors(n.position, u.pivot), s = (new Cn).subVectors(n.getPivot(), u.pivot), e = n.getSide(), l.applyAxisAngle(e, o), s.applyAxisAngle(e, o), l.applyAxisAngle(new Cn(0,0,1), a), s.applyAxisAngle(new Cn(0,0,1), a), l = (new Cn).addVectors(u.pivot, l), n.position.copy(l), n.yaw += a, n.pitch += o)) }), u.addEventListener("drop", function(e) { u.dispatchEvent({ type: "end" }) }), u.addEventListener("Buttonswheel", function(e) { u.wheelDelta += e.delta }), u.addEventListener("Buttonsdown", function(e) { e = Jf.getButtonsPointCloudIntersection(e.Buttons, u.scene.getActiveCamera(), u.viewer, u.scene.pointclouds, { pickClipped: !1 }); e && (u.pivot = e.location, u.camStart = u.scene.getActiveCamera().clone(), u.pivotIndicator.visible = !0, u.pivotIndicator.position.copy(e.location)) }), u.addEventListener("Buttonsup", function(e) { u.camStart = null, u.pivot = null, u.pivotIndicator.visible = !1 }), u.addEventListener("dblclick", function(e) { u.zoomToLocation(e.Buttons) }), u } return h(i, [{ key: "setScene", value: function(e) { this.scene = e } }, { key: "stop", value: function() { this.wheelDelta = 0, this.zoomDelta.set(0, 0, 0) } }, { key: "zoomToLocation", value: function(e) { var t, n, i, r, a, o, s, l = this, u = this.scene.getActiveCamera(), c = Jf.getButtonsPointCloudIntersection(e, u, this.viewer, this.scene.pointclouds); null !== c && (t = 0, e = this.renderer.domElement, e = Jf.ButtonsToRay(this.viewer.inputHandler.pointer, u, e.clientWidth, e.clientHeight), e = (e = c.pointcloud.nodesOnRay(c.pointcloud.visibleNodes, e))[e.length - 1].getBoundingSphere(new qn).radius, t = Math.min(this.scene.view.radius, e), t = Math.max(.2, t), e = this.scene.view.direction.multiplyScalar(-1), e = (new Cn).addVectors(c.location, e.multiplyScalar(t)), t = TWEEN.Easing.Quartic.Out, n = { x: 0 }, (i = new TWEEN.Tween(n).to({ x: 1 }, 600)).easing(t), this.tweens.push(i), r = this.scene.view.position.clone(), a = e.clone(), o = this.scene.view.radius, s = e.distanceTo(c.location), i.onUpdate(function() { var e = n.x; l.scene.view.position.x = (1 - e) * r.x + e * a.x, l.scene.view.position.y = (1 - e) * r.y + e * a.y, l.scene.view.position.z = (1 - e) * r.z + e * a.z, l.scene.view.radius = (1 - e) * o + e * s, l.viewer.setMoveSpeed(l.scene.view.radius / 2.5) }), i.onComplete(function() { l.tweens = l.tweens.filter(function(e) { return e !== i }) }), i.start()) } }, { key: "update", value: function(e) { var t, n, i, r, a, o = this.scene.view, s = Math.pow(.5, this.fadeFactor * e), l = 1 - s, u = this.scene.getActiveCamera(); 0 === this.wheelDelta || (i = Jf.getButtonsPointCloudIntersection(this.viewer.inputHandler.Buttons, this.scene.getActiveCamera(), this.viewer, this.scene.pointclouds)) && (t = (new Cn).addVectors(o.position, this.zoomDelta), n = .2 * i.location.distanceTo(t) * this.wheelDelta, (e = (new Cn).subVectors(i.location, o.position)).normalize(), t.add(e.multiplyScalar(n)), this.zoomDelta.subVectors(t, o.position), i = t.distanceTo(i.location), o.radius = i, i = o.radius / 2.5, this.viewer.setMoveSpeed(i)), 0 !== this.zoomDelta.length() && (r = this.zoomDelta.clone().multiplyScalar(l), a = (new Cn).addVectors(o.position, r), o.position.copy(a)), this.pivotIndicator.visible && (r = this.pivotIndicator.position.distanceTo(o.position), a = this.renderer.domElement.clientwidth, o = this.renderer.domElement.clientHeight, o = 10 / Jf.projectedRadius(1, u, r, a, o), this.pivotIndicator.scale.set(o, o, o)), this.zoomDelta.multiplyScalar(s), this.wheelDelta = 0 } }]), i }(), Rw = function() { y(r, hn); var i = w(r); function r(e) { var t; O(this, r), (t = i.call(this)).viewer = e, t.renderer = e.renderer, t.scene = null, t.sceneControls = new gs, t.screenOrientation = window.orientation || 0; function n(e) { t.deviceOrientation = e } return "ondeviceorientationabsolute"in window ? window.addEventListener("deviceorientationabsolute", n) : "ondeviceorientation"in window ? window.addEventListener("deviceorientation", n) : console.warn("No device orientation found."), window.addEventListener("orientationchange", function(e) { t.screenOrientation = window.orientation || 0 }), t } return h(r, [{ key: "setScene", value: function(e) { this.scene = e } }, { key: "update", value: function(e) { var t, n, i, r, a, o, s, l; void 0 !== this.deviceOrientation && (a = this.deviceOrientation.alpha ? gn.degToRad(this.deviceOrientation.alpha) : 0, o = this.deviceOrientation.beta ? gn.degToRad(this.deviceOrientation.beta) : 0, s = this.deviceOrientation.gamma ? gn.degToRad(this.deviceOrientation.gamma) : 0, l = this.screenOrientation ? gn.degToRad(this.screenOrientation) : 0, t = a, n = o, i = s, r = l, a = new Sn, o = new Cn(0,0,1), s = new ci, l = new Sn, s.set(n, i, t, "ZXY"), a.setFromEuler(s), a.multiply(l.setFromAxisAngle(o, -r)), viewer.scene.cameraP.quaternion.set(a.x, a.y, a.z, a.w)) } }]), r }(), Fw = new WeakMap, Iw = function() { y(n, mc); var t = w(n); function n(e) { return O(this, n), (e = t.call(this, e)).decoderPath = "", e.decoderConfig = {}, e.decoderBinary = null, e.decoderPending = null, e.workerLimit = 4, e.workerPool = [], e.workerNextTaskID = 1, e.workerSourceURL = "", e.defaultAttributeIDs = { position: "POSITION", normal: "NORMAL", color: "COLOR", uv: "TEX_COORD" }, e.defaultAttributeTypes = { position: "Float32Array", normal: "Float32Array", color: "Float32Array", uv: "Float32Array" }, e } return h(n, [{ key: "setDecoderPath", value: function(e) { return this.decoderPath = e, this } }, { key: "setDecoderConfig", value: function(e) { return this.decoderConfig = e, this } }, { key: "setWorkerLimit", value: function(e) { return this.workerLimit = e, this } }, { key: "load", value: function(e, n, t, i) { var r = this , a = new gc(this.manager); a.setPath(this.path), a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(e) { var t = { attributeIDs: r.defaultAttributeIDs, attributeTypes: r.defaultAttributeTypes, useUniqueIDs: !1 }; r.decodeGeometry(e, t).then(n).catch(i) }, t, i) } }, { key: "decodeDracoFile", value: function(e, t, n, i) { n = { attributeIDs: n || this.defaultAttributeIDs, attributeTypes: i || this.defaultAttributeTypes, useUniqueIDs: !!n }; this.decodeGeometry(e, n).then(t) } }, { key: "decodeGeometry", value: function(n, i) { var e, t = this; for (e in i.attributeTypes) { var r = i.attributeTypes[e]; void 0 !== r.BYTES_PER_ELEMENT && (i.attributeTypes[e] = r.name) } var a, o = JSON.stringify(i); if (Fw.has(n)) { var s = Fw.get(n); if (s.key === o) return s.promise; if (0 === n.byteLength) throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.") } var l = this.workerNextTaskID++ , s = n.byteLength , s = this._getWorker(l, s).then(function(e) { return a = e, new Promise(function(e, t) { a._callbacks[l] = { resolve: e, reject: t }, a.postMessage({ type: "decode", id: l, taskConfig: i, buffer: n }, [n]) } ) }).then(function(e) { return t._createGeometry(e.geometry) }); return s.catch(function() { return !0 }).then(function() { a && l && t._releaseTask(a, l) }), Fw.set(n, { key: o, promise: s }), s } }, { key: "_createGeometry", value: function(e) { var t = new Mr; e.index && t.setIndex(new nr(e.index.array,1)); for (var n = 0; n < e.attributes.length; n++) { var i = e.attributes[n] , r = i.name , a = i.array , i = i.itemSize; t.setAttribute(r, new nr(a,i)) } return t } }, { key: "_loadLibrary", value: function(n, e) { var i = new gc(this.manager); return i.setPath(this.decoderPath), i.setResponseType(e), i.setWithCredentials(this.withCredentials), new Promise(function(e, t) { i.load(n, e, void 0, t) } ) } }, { key: "preload", value: function() { return this._initDecoder(), this } }, { key: "_initDecoder", value: function() { var n = this; if (this.decoderPending) return this.decoderPending; var i = "object" !== ("undefined" == typeof WebAssembly ? "undefined" : X(WebAssembly)) || "js" === this.decoderConfig.type , e = []; return i ? e.push(this._loadLibrary("draco_decoder.js", "text")) : (e.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), e.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(e).then(function(e) { var t = e[0]; i || (n.decoderConfig.wasmBinary = e[1]); e = function() { var n, t; function l(e, t, n, i) { var r, a, o = i.attributeIDs, s = i.attributeTypes, l = t.GetEncodedGeometryType(n); if (l === e.TRIANGULAR_MESH) r = new e.Mesh, a = t.DecodeBufferToMesh(n, r); else { if (l !== e.POINT_CLOUD) throw new Error("THREE.DRACOLoader: Unexpected geometry type."); r = new e.PointCloud, a = t.DecodeBufferToPointCloud(n, r) } if (!a.ok() || 0 === r.ptr) throw new Error("THREE.DRACOLoader: Decoding failed: " + a.error_msg()); var u, c = { index: null, attributes: [] }; for (u in o) { var d = self[s[u]] , h = void 0 , p = void 0; if (i.useUniqueIDs) p = o[u], h = t.GetAttributeByUniqueId(r, p); else { if (-1 === (p = t.GetAttributeId(r, e[o[u]]))) continue; h = t.GetAttribute(r, p) } c.attributes.push(function(e, t, n, i, r, a) { var o = a.num_components() , s = n.num_points() * o , l = s * r.BYTES_PER_ELEMENT , u = function(e, t) { switch (t) { case Float32Array: return e.DT_FLOAT32; case Int8Array: return e.DT_INT8; case Int16Array: return e.DT_INT16; case Int32Array: return e.DT_INT32; case Uint8Array: return e.DT_UINT8; case Uint16Array: return e.DT_UINT16; case Uint32Array: return e.DT_UINT32 } }(e, r) , c = e._malloc(l); t.GetAttributeDataArrayForAllPoints(n, a, u, l, c); s = new r(e.HEAPF32.buffer,c,s).slice(); return e._free(c), { name: i, array: s, itemSize: o } }(e, t, r, u, d, h)) } return l === e.TRIANGULAR_MESH && (c.index = function(e, t, n) { var i = 3 * n.num_faces() , r = 4 * i , a = e._malloc(r); t.GetTrianglesUInt32Array(n, r, a); i = new Uint32Array(e.HEAPF32.buffer,a,i).slice(); return e._free(a), { array: i, itemSize: 1 } }(e, t, r)), e.destroy(r), c } onmessage = function(e) { var a = e.data; switch (a.type) { case "init": n = a.decoderConfig, t = new Promise(function(t) { n.onModuleLoaded = function(e) { t({ draco: e }) } , DracoDecoderModule(n) } ); break; case "decode": var o = a.buffer , s = a.taskConfig; t.then(function(e) { var t = e.draco , n = new t.Decoder , e = new t.DecoderBuffer; e.Init(new Int8Array(o), o.byteLength); try { var i = l(t, n, e, s) , r = i.attributes.map(function(e) { return e.array.buffer }); i.index && r.push(i.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: i }, r) } catch (e) { console.error(e), self.postMessage({ type: "error", id: a.id, error: e.message }) } finally { t.destroy(e), t.destroy(n) } }) } } } .toString(), e = ["/* draco decoder */", t, "", "/* worker */", e.substring(e.indexOf("{") + 1, e.lastIndexOf("}"))].join("\n"); n.workerSourceURL = URL.createObjectURL(new Blob([e])) }), this.decoderPending } }, { key: "_getWorker", value: function(t, i) { var r = this; return this._initDecoder().then(function() { var n; r.workerPool.length < r.workerLimit ? ((n = new Worker(r.workerSourceURL))._callbacks = {}, n._taskCosts = {}, n._taskLoad = 0, n.postMessage({ type: "init", decoderConfig: r.decoderConfig }), n.onmessage = function(e) { var t = e.data; switch (t.type) { case "decode": n._callbacks[t.id].resolve(t); break; case "error": n._callbacks[t.id].reject(t); break; default: console.error('THREE.DRACOLoader: Unexpected message, "' + t.type + '"') } } , r.workerPool.push(n)) : r.workerPool.sort(function(e, t) { return e._taskLoad > t._taskLoad ? -1 : 1 }); var e = r.workerPool[r.workerPool.length - 1]; return e._taskCosts[t] = i, e._taskLoad += i, e }) } }, { key: "_releaseTask", value: function(e, t) { e._taskLoad -= e._taskCosts[t], delete e._callbacks[t], delete e._taskCosts[t] } }, { key: "debug", value: function() { console.log("Task load: ", this.workerPool.map(function(e) { return e._taskLoad })) } }, { key: "dispose", value: function() { for (var e = 0; e < this.workerPool.length; ++e) this.workerPool[e].terminate(); return this.workerPool.length = 0, this } }]), n }(); var Ow = function() { function t() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 4; O(this, t), this.pool = e, this.queue = [], this.workers = [], this.workersResolve = [], this.workerStatus = 0 } return h(t, [{ key: "_initWorker", value: function(e) { var t; this.workers[e] || ((t = this.workerCreator()).addEventListener("message", this._onMessage.bind(this, e)), this.workers[e] = t) } }, { key: "_getIdleWorker", value: function() { for (var e = 0; e < this.pool; e++) if (!(this.workerStatus & 1 << e)) return e; return -1 } }, { key: "_onMessage", value: function(e, t) { var n, i = this.workersResolve[e]; i && i(t), this.queue.length ? (i = (n = this.queue.shift()).resolve, t = n.msg, n = n.transfer, this.workersResolve[e] = i, this.workers[e].postMessage(t, n)) : this.workerStatus ^= 1 << e } }, { key: "setWorkerCreator", value: function(e) { this.workerCreator = e } }, { key: "setWorkerLimit", value: function(e) { this.pool = e } }, { key: "postMessage", value: function(n, i) { var r = this; return new Promise(function(e) { var t = r._getIdleWorker(); -1 !== t ? (r._initWorker(t), r.workerStatus |= 1 << t, r.workersResolve[t] = e, r.workers[t].postMessage(n, i)) : r.queue.push({ resolve: e, msg: n, transfer: i }) } ) } }, { key: "dispose", value: function() { this.workers.forEach(function(e) { return e.terminate() }), this.workersResolve.length = 0, this.workers.length = 0, this.queue.length = 0, this.workerStatus = 0 } }]), t }() , zw = h(function e() { O(this, e), this.vkFormat = 0, this.typeSize = 1, this.pixelWidth = 0, this.pixelHeight = 0, this.pixelDepth = 0, this.layerCount = 0, this.faceCount = 1, this.supercompressionScheme = 0, this.levels = [], this.dataFormatDescriptor = [{ vendorId: 0, descriptorType: 0, descriptorBlockSize: 0, versionNumber: 2, colorModel: 0, colorPrimaries: 1, transferFunction: 2, flags: 0, texelBlockDimension: [0, 0, 0, 0], bytesPlane: [0, 0, 0, 0, 0, 0, 0, 0], samples: [] }], this.keyValue = {}, this.globalData = null }) , Nw = function() { function r(e, t, n, i) { O(this, r), this._dataView = new DataView(e.buffer,e.byteOffset + t,n), this._littleEndian = i, this._offset = 0 } return h(r, [{ key: "_nextUint8", value: function() { var e = this._dataView.getUint8(this._offset); return this._offset += 1, e } }, { key: "_nextUint16", value: function() { var e = this._dataView.getUint16(this._offset, this._littleEndian); return this._offset += 2, e } }, { key: "_nextUint32", value: function() { var e = this._dataView.getUint32(this._offset, this._littleEndian); return this._offset += 4, e } }, { key: "_nextUint64", value: function() { var e = this._dataView.getUint32(this._offset, this._littleEndian) + Math.pow(2, 32) * this._dataView.getUint32(this._offset + 4, this._littleEndian); return this._offset += 8, e } }, { key: "_nextInt32", value: function() { var e = this._dataView.getInt32(this._offset, this._littleEndian); return this._offset += 4, e } }, { key: "_skip", value: function(e) { return this._offset += e, this } }, { key: "_scan", value: function(e) { for (var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, n = this._offset, i = 0; this._dataView.getUint8(this._offset) !== t && i < e; ) i++, this._offset++; return i < e && this._offset++, new Uint8Array(this._dataView.buffer,this._dataView.byteOffset + n,i) } }]), r }() , Uw = (new Uint8Array([0]), [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10]); function Gw(e) { return "undefined" != typeof TextDecoder ? (new TextDecoder).decode(e) : Buffer.from(e).toString("utf8") } var Hw = function(e) { if ((A = new Uint8Array(e.buffer,e.byteOffset,Uw.length))[0] !== Uw[0] || A[1] !== Uw[1] || A[2] !== Uw[2] || A[3] !== Uw[3] || A[4] !== Uw[4] || A[5] !== Uw[5] || A[6] !== Uw[6] || A[7] !== Uw[7] || A[8] !== Uw[8] || A[9] !== Uw[9] || A[10] !== Uw[10] || A[11] !== Uw[11]) throw new Error("Missing KTX 2.0 identifier."); var t = new zw , n = 17 * Uint32Array.BYTES_PER_ELEMENT , i = new Nw(e,Uw.length,n,!0); t.vkFormat = i._nextUint32(), t.typeSize = i._nextUint32(), t.pixelWidth = i._nextUint32(), t.pixelHeight = i._nextUint32(), t.pixelDepth = i._nextUint32(), t.layerCount = i._nextUint32(), t.faceCount = i._nextUint32(); var r = i._nextUint32(); t.supercompressionScheme = i._nextUint32(); for (var a = i._nextUint32(), o = i._nextUint32(), s = i._nextUint32(), l = i._nextUint32(), u = i._nextUint64(), c = i._nextUint64(), d = new Nw(e,Uw.length + n,3 * r * 8,!0), h = 0; h < r; h++) t.levels.push({ levelData: new Uint8Array(e.buffer,e.byteOffset + d._nextUint64(),d._nextUint64()), uncompressedByteLength: d._nextUint64() }); for (var p = new Nw(e,a,o,!0), f = { vendorId: p._skip(4)._nextUint16(), descriptorType: p._nextUint16(), versionNumber: p._nextUint16(), descriptorBlockSize: p._nextUint16(), colorModel: p._nextUint8(), colorPrimaries: p._nextUint8(), transferFunction: p._nextUint8(), flags: p._nextUint8(), texelBlockDimension: [p._nextUint8(), p._nextUint8(), p._nextUint8(), p._nextUint8()], bytesPlane: [p._nextUint8(), p._nextUint8(), p._nextUint8(), p._nextUint8(), p._nextUint8(), p._nextUint8(), p._nextUint8(), p._nextUint8()], samples: [] }, m = (f.descriptorBlockSize / 4 - 6) / 4, v = 0; v < m; v++) { var g = { bitOffset: p._nextUint16(), bitLength: p._nextUint8(), channelType: p._nextUint8(), samplePosition: [p._nextUint8(), p._nextUint8(), p._nextUint8(), p._nextUint8()], sampleLower: -1 / 0, sampleUpper: 1 / 0 }; 64 & g.channelType ? (g.sampleLower = p._nextInt32(), g.sampleUpper = p._nextInt32()) : (g.sampleLower = p._nextUint32(), g.sampleUpper = p._nextUint32()), f.samples[v] = g } t.dataFormatDescriptor.length = 0, t.dataFormatDescriptor.push(f); for (var y = new Nw(e,s,l,!0); y._offset < l; ) { var w = y._nextUint32() , b = y._scan(w) , x = Gw(b) , b = y._scan(w - b.byteLength); t.keyValue[x] = x.match(/^ktx/i) ? Gw(b) : b, y._offset % 4 && y._skip(4 - y._offset % 4) } if (c <= 0) return t; for (var E = new Nw(e,u,c,!0), _ = E._nextUint16(), M = E._nextUint16(), A = E._nextUint32(), i = E._nextUint32(), n = E._nextUint32(), a = E._nextUint32(), T = [], S = 0; S < r; S++) T.push({ imageFlags: E._nextUint32(), rgbSliceByteOffset: E._nextUint32(), rgbSliceByteLength: E._nextUint32(), alphaSliceByteOffset: E._nextUint32(), alphaSliceByteLength: E._nextUint32() }); return o = u + E._offset, u = (c = (s = o + A) + i) + n, A = new Uint8Array(e.buffer,e.byteOffset + o,A), i = new Uint8Array(e.buffer,e.byteOffset + s,i), n = new Uint8Array(e.buffer,e.byteOffset + c,n), a = new Uint8Array(e.buffer,e.byteOffset + u,a), t.globalData = { endpointCount: _, selectorCount: M, imageDescs: T, endpointsData: A, selectorsData: i, tablesData: n, extendedData: a }, t } , Vw = new WeakMap , jw = 0 , Ww = function() { y(r, mc); var t = w(r); function r(e) { return O(this, r), (e = t.call(this, e)).transcoderPath = "", e.transcoderBinary = null, e.transcoderPending = null, e.workerPool = new Ow, e.workerSourceURL = "", e.workerConfig = null, "undefined" != typeof MSC_TRANSCODER && console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.'), e } return h(r, [{ key: "setTranscoderPath", value: function(e) { return this.transcoderPath = e, this } }, { key: "setWorkerLimit", value: function(e) { return this.workerPool.setWorkerLimit(e), this } }, { key: "detectSupport", value: function(e) { return this.workerConfig = { astcSupported: e.extensions.has("WEBGL_compressed_texture_astc"), etc1Supported: e.extensions.has("WEBGL_compressed_texture_etc1"), etc2Supported: e.extensions.has("WEBGL_compressed_texture_etc"), dxtSupported: e.extensions.has("WEBGL_compressed_texture_s3tc"), bptcSupported: e.extensions.has("EXT_texture_compression_bptc"), pvrtcSupported: e.extensions.has("WEBGL_compressed_texture_pvrtc") || e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc") }, e.capabilities.isWebGL2 && (this.workerConfig.etc1Supported = !1), this } }, { key: "init", value: function() { var e, t, i = this; return this.transcoderPending || ((t = new gc(this.manager)).setPath(this.transcoderPath), t.setWithCredentials(this.withCredentials), e = t.loadAsync("basis_transcoder.js"), (t = new gc(this.manager)).setPath(this.transcoderPath), t.setResponseType("arraybuffer"), t.setWithCredentials(this.withCredentials), t = t.loadAsync("basis_transcoder.wasm"), this.transcoderPending = Promise.all([e, t]).then(function(e) { var t = N(e, 2) , n = t[0] , e = t[1] , t = r.BasisWorker.toString() , t = ["/* constants */", "let _EngineFormat = " + JSON.stringify(r.EngineFormat), "let _TranscoderFormat = " + JSON.stringify(r.TranscoderFormat), "let _BasisFormat = " + JSON.stringify(r.BasisFormat), "/* basis_transcoder.js */", n, "/* worker */", t.substring(t.indexOf("{") + 1, t.lastIndexOf("}"))].join("\n"); i.workerSourceURL = URL.createObjectURL(new Blob([t])), i.transcoderBinary = e, i.workerPool.setWorkerCreator(function() { var e = new Worker(i.workerSourceURL) , t = i.transcoderBinary.slice(0); return e.postMessage({ type: "init", config: i.workerConfig, transcoderBinary: t }, [t]), e }) }), 0 < jw && console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."), jw++), this.transcoderPending } }, { key: "load", value: function(e, t, n, i) { var r = this; if (null === this.workerConfig) throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`."); var a = new gc(this.manager); a.setResponseType("arraybuffer"), a.setWithCredentials(this.withCredentials), a.load(e, function(e) { return Vw.has(e) ? Vw.get(e).promise.then(t).catch(i) : void r._createTexture(e).then(function(e) { return t ? t(e) : null }).catch(i) }, n, i) } }, { key: "_createTextureFrom", value: function(e) { var t = e.mipmaps , n = e.width , i = e.height , r = e.format , a = e.type , o = e.error , s = e.dfdTransferFn , e = e.dfdFlags; if ("error" === a) return Promise.reject(o); r = new bl(t,n,i,r,Ue); return r.minFilter = 1 === t.length ? Oe : Ne, r.magFilter = Oe, r.generateMipmaps = !1, r.needsUpdate = !0, r.encoding = 2 === s ? an : rn, r.premultiplyAlpha = !!(1 & e), r } }, { key: "_createTexture", value: function(e) { var t = this , n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {} , i = Hw(new Uint8Array(e)); if (0 !== i.vkFormat) return function(e) { var t = e.vkFormat , n = e.pixelWidth , i = e.pixelHeight , r = e.pixelDepth; if (void 0 === Xw[t]) throw new Error("THREE.KTX2Loader: Unsupported vkFormat."); var e = e.levels[0].levelData; e = qw[t] === Xe ? new Float32Array(e.buffer,e.byteOffset,e.byteLength / Float32Array.BYTES_PER_ELEMENT) : qw[t] === qe ? new Uint16Array(e.buffer,e.byteOffset,e.byteLength / Uint16Array.BYTES_PER_ELEMENT) : e; r = 0 === r ? new ia(e,n,i) : new Data3DTexture(e,n,i,r); return r.type = qw[t], r.format = Xw[t], r.encoding = Jw[t] || rn, r.needsUpdate = !0, Promise.resolve(r) }(i); var r = n , n = this.init().then(function() { return t.workerPool.postMessage({ type: "transcode", buffer: e, taskConfig: r }, [e]) }).then(function(e) { return t._createTextureFrom(e.data) }); return Vw.set(e, { promise: n }), n } }, { key: "dispose", value: function() { return this.workerPool.dispose(), this.workerSourceURL && URL.revokeObjectURL(this.workerSourceURL), jw--, this } }]), r }(); Ww.BasisFormat = { ETC1S: 0, UASTC_4x4: 1 }, Ww.TranscoderFormat = { ETC1: 0, ETC2: 1, BC1: 2, BC3: 3, BC4: 4, BC5: 5, BC7_M6_OPAQUE_ONLY: 6, BC7_M5: 7, PVRTC1_4_RGB: 8, PVRTC1_4_RGBA: 9, ASTC_4x4: 10, ATC_RGB: 11, ATC_RGBA_INTERPOLATED_ALPHA: 12, RGBA32: 13, RGB565: 14, BGR565: 15, RGBA4444: 16 }, Ww.EngineFormat = { RGBAFormat: et, RGBA_ASTC_4x4_Format: _t, RGBA_BPTC_Format: Ot, RGBA_ETC2_EAC_Format: Et, RGBA_PVRTC_4BPPV1_Format: yt, RGBA_S3TC_DXT5_Format: mt, RGB_ETC1_Format: bt, RGB_ETC2_Format: xt, RGB_PVRTC_4BPPV1_Format: vt, RGB_S3TC_DXT1_Format: ht }, Ww.BasisWorker = function() { var m, n, v, g = _EngineFormat, y = _TranscoderFormat, w = _BasisFormat; self.addEventListener("message", function(e) { var t, c = e.data; switch (c.type) { case "init": m = c.config, t = c.transcoderBinary, n = new Promise(function(e) { v = { wasmBinary: t, onRuntimeInitialized: e }, BASIS(v) } ).then(function() { v.initializeBasis(), void 0 === v.KTX2File && console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.") }); break; case "transcode": n.then(function() { try { for (var e = function(e) { var t = new v.KTX2File(new Uint8Array(e)); function n() { t.close(), t.delete() } if (!t.isValid()) throw n(), new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file"); var i = t.isUASTC() ? w.UASTC_4x4 : w.ETC1S , r = t.getWidth() , a = t.getHeight() , o = t.getLevels() , s = t.getHasAlpha() , l = t.getDFDTransferFunc() , e = t.getDFDFlags() , i = function(e, t, n, i) { for (var r, a, o = e === w.ETC1S ? b : x, s = 0; s < o.length; s++) { var l = o[s]; if (m[l.if] && (l.basisFormat.includes(e) && !(i && l.transcoderFormat.length < 2) && (!l.needsPowerOfTwo || E(t) && E(n)))) return r = l.transcoderFormat[i ? 1 : 0], a = l.engineFormat[i ? 1 : 0], { transcoderFormat: r, engineFormat: a } } return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."), r = y.RGBA32, a = g.RGBAFormat, { transcoderFormat: r, engineFormat: a } }(i, r, a, s) , u = i.transcoderFormat , i = i.engineFormat; if (!r || !a || !o) throw n(), new Error("THREE.KTX2Loader:\tInvalid texture"); if (!t.startTranscoding()) throw n(), new Error("THREE.KTX2Loader: .startTranscoding failed"); for (var c = [], d = 0; d < o; d++) { var h = t.getImageLevelInfo(d, 0, 0) , p = h.origWidth , f = h.origHeight , h = new Uint8Array(t.getImageTranscodedSizeInBytes(d, 0, 0, u)); if (!t.transcodeImage(h, d, 0, 0, u, 0, -1, -1)) throw n(), new Error("THREE.KTX2Loader: .transcodeImage failed."); c.push({ data: h, width: p, height: f }) } return n(), { width: r, height: a, hasAlpha: s, mipmaps: c, format: i, dfdTransferFn: l, dfdFlags: e } }(c.buffer), t = e.width, n = e.height, i = e.hasAlpha, r = e.mipmaps, a = e.format, o = e.dfdTransferFn, s = e.dfdFlags, l = [], u = 0; u < r.length; ++u) l.push(r[u].data.buffer); self.postMessage({ type: "transcode", id: c.id, width: t, height: n, hasAlpha: i, mipmaps: r, format: a, dfdTransferFn: o, dfdFlags: s }, l) } catch (e) { console.error(e), self.postMessage({ type: "error", id: c.id, error: e.message }) } }) } }); var e = [{ if: "astcSupported", basisFormat: [w.UASTC_4x4], transcoderFormat: [y.ASTC_4x4, y.ASTC_4x4], engineFormat: [g.RGBA_ASTC_4x4_Format, g.RGBA_ASTC_4x4_Format], priorityETC1S: 1 / 0, priorityUASTC: 1, needsPowerOfTwo: !1 }, { if: "bptcSupported", basisFormat: [w.ETC1S, w.UASTC_4x4], transcoderFormat: [y.BC7_M5, y.BC7_M5], engineFormat: [g.RGBA_BPTC_Format, g.RGBA_BPTC_Format], priorityETC1S: 3, priorityUASTC: 2, needsPowerOfTwo: !1 }, { if: "dxtSupported", basisFormat: [w.ETC1S, w.UASTC_4x4], transcoderFormat: [y.BC1, y.BC3], engineFormat: [g.RGB_S3TC_DXT1_Format, g.RGBA_S3TC_DXT5_Format], priorityETC1S: 4, priorityUASTC: 5, needsPowerOfTwo: !1 }, { if: "etc2Supported", basisFormat: [w.ETC1S, w.UASTC_4x4], transcoderFormat: [y.ETC1, y.ETC2], engineFormat: [g.RGB_ETC2_Format, g.RGBA_ETC2_EAC_Format], priorityETC1S: 1, priorityUASTC: 3, needsPowerOfTwo: !1 }, { if: "etc1Supported", basisFormat: [w.ETC1S, w.UASTC_4x4], transcoderFormat: [y.ETC1], engineFormat: [g.RGB_ETC1_Format], priorityETC1S: 2, priorityUASTC: 4, needsPowerOfTwo: !1 }, { if: "pvrtcSupported", basisFormat: [w.ETC1S, w.UASTC_4x4], transcoderFormat: [y.PVRTC1_4_RGB, y.PVRTC1_4_RGBA], engineFormat: [g.RGB_PVRTC_4BPPV1_Format, g.RGBA_PVRTC_4BPPV1_Format], priorityETC1S: 5, priorityUASTC: 6, needsPowerOfTwo: !0 }] , b = e.sort(function(e, t) { return e.priorityETC1S - t.priorityETC1S }) , x = e.sort(function(e, t) { return e.priorityUASTC - t.priorityUASTC }); function E(e) { return e <= 2 || 0 == (e & e - 1) && 0 !== e } } ; var Xw = (H(Ou = {}, 109, et), H(Ou, 97, et), H(Ou, 37, et), H(Ou, 43, et), H(Ou, 103, lt), H(Ou, 83, lt), H(Ou, 16, lt), H(Ou, 22, lt), H(Ou, 100, ot), H(Ou, 76, ot), H(Ou, 15, ot), H(Ou, 9, ot), Ou) , qw = (H(Ch = {}, 109, Xe), H(Ch, 97, qe), H(Ch, 37, Ue), H(Ch, 43, Ue), H(Ch, 103, Xe), H(Ch, 83, qe), H(Ch, 16, Ue), H(Ch, 22, Ue), H(Ch, 100, Xe), H(Ch, 76, qe), H(Ch, 15, Ue), H(Ch, 9, Ue), Ch) , Jw = (H(rh = {}, 43, an), H(rh, 22, an), H(rh, 15, an), rh); function Yw(e) { wc.call(this, e) } var Zw = function() { var e = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 3, 2, 0, 0, 5, 3, 1, 0, 1, 12, 1, 0, 10, 22, 2, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11, 7, 0, 65, 0, 253, 15, 26, 11]) , a = new Uint8Array([32, 0, 65, 253, 3, 1, 2, 34, 4, 106, 6, 5, 11, 8, 7, 20, 13, 33, 12, 16, 128, 9, 116, 64, 19, 113, 127, 15, 10, 21, 22, 14, 255, 66, 24, 54, 136, 107, 18, 23, 192, 26, 114, 118, 132, 17, 77, 101, 130, 144, 27, 87, 131, 44, 45, 74, 156, 154, 70, 167]); if ("object" !== ("undefined" == typeof WebAssembly ? "undefined" : X(WebAssembly))) return { supported: !1 }; var d, t = "B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB"; WebAssembly.validate(e) && (t = "B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB", console.log("Warning: meshopt_decoder is using experimental SIMD support")); t = WebAssembly.instantiate(function(e) { for (var t = new Uint8Array(e.length), n = 0; n < e.length; ++n) { var i = e.charCodeAt(n); t[n] = 96 < i ? i - 71 : 64 < i ? i - 65 : 47 < i ? i + 4 : 46 < i ? 63 : 62 } for (var r = 0, n = 0; n < e.length; ++n) t[r++] = t[n] < 60 ? a[t[n]] : 64 * (t[n] - 60) + t[++n]; return t.buffer.slice(0, r) }(t), {}).then(function(e) { (d = e.instance).exports.__wasm_call_ctors() }); function o(e, t, n, i, r, a) { var o = d.exports.sbrk , s = n + 3 & -4 , l = o(s * i) , u = o(r.length) , c = new Uint8Array(d.exports.memory.buffer); c.set(r, u); r = e(l, n, i, u, r.length); if (0 == r && a && a(l, s, i), t.set(c.subarray(l, l + n * i)), o(l - o(0)), 0 != r) throw new Error("Malformed buffer data: " + r) } var s = { 0: "", 1: "meshopt_decodeFilterOct", 2: "meshopt_decodeFilterQuat", 3: "meshopt_decodeFilterExp", NONE: "", OCTAHEDRAL: "meshopt_decodeFilterOct", QUATERNION: "meshopt_decodeFilterQuat", EXPONENTIAL: "meshopt_decodeFilterExp" } , l = { 0: "meshopt_decodeVertexBuffer", 1: "meshopt_decodeIndexBuffer", 2: "meshopt_decodeIndexSequence", ATTRIBUTES: "meshopt_decodeVertexBuffer", TRIANGLES: "meshopt_decodeIndexBuffer", INDICES: "meshopt_decodeIndexSequence" }; return { ready: t, supported: !0, decodeVertexBuffer: function(e, t, n, i, r) { o(d.exports.meshopt_decodeVertexBuffer, e, t, n, i, d.exports[s[r]]) }, decodeIndexBuffer: function(e, t, n, i) { o(d.exports.meshopt_decodeIndexBuffer, e, t, n, i) }, decodeIndexSequence: function(e, t, n, i) { o(d.exports.meshopt_decodeIndexSequence, e, t, n, i) }, decodeGltfBuffer: function(e, t, n, i, r, a) { o(d.exports[l[r]], e, t, n, i, d.exports[s[a]]) } } }(); Yw.prototype = Object.assign(Object.create(wc.prototype), { constructor: Yw, parse: function(e, t) { var n = { mipmaps: [], width: 0, height: 0, format: null, mipmapCount: 1 }; function i(e) { return e.charCodeAt(0) + (e.charCodeAt(1) << 8) + (e.charCodeAt(2) << 16) + (e.charCodeAt(3) << 24) } var r, a = i("DXT1"), o = i("DXT3"), s = i("DXT5"), l = i("ETC1"), u = new Int32Array(e,0,31); if (542327876 !== u[0]) return console.error("THREE.DDSLoader.parse: Invalid magic number in DDS header."), n; if (4 & !u[20]) return console.error("THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code."), n; var c = u[21] , d = !1; switch (c) { case a: r = 8, n.format = ht; break; case o: r = 16, n.format = ft; break; case s: r = 16, n.format = mt; break; case l: r = 8, n.format = bt; break; default: if (!(32 === u[22] && 16711680 & u[23] && 65280 & u[24] && 255 & u[25] && 4278190080 & u[26])) return console.error("THREE.DDSLoader.parse: Unsupported FourCC code ", String.fromCharCode(255 & c, c >> 8 & 255, c >> 16 & 255, c >> 24 & 255)), n; d = !0, r = 64, n.format = et } n.mipmapCount = 1, 131072 & u[2] && !1 !== t && (n.mipmapCount = Math.max(1, u[7])); t = u[28]; if (n.isCubemap = !!(512 & t), n.isCubemap && (!(1024 & t) || !(2048 & t) || !(4096 & t) || !(8192 & t) || !(16384 & t) || !(32768 & t))) return console.error("THREE.DDSLoader.parse: Incomplete cubemap faces"), n; n.width = u[4], n.height = u[3]; for (var h = u[1] + 4, p = n.isCubemap ? 6 : 1, f = 0; f < p; f++) for (var m, v, g = n.width, y = n.height, w = 0; w < n.mipmapCount; w++) d ? m = (v = function(e, t, n, i) { for (var r = n * i * 4, a = new Uint8Array(e,t,r), o = new Uint8Array(r), s = 0, l = 0, u = 0; u < i; u++) for (var c = 0; c < n; c++) { var d = a[l] , h = a[++l] , p = a[++l] , f = a[++l]; l++, o[s] = p, o[++s] = h, o[++s] = d, o[++s] = f, s++ } return o }(e, h, g, y)).length : (m = Math.max(4, g) / 4 * Math.max(4, y) / 4 * r, v = new Uint8Array(e,h,m)), n.mipmaps.push({ data: v, width: g, height: y }), h += m, g = Math.max(g >> 1, 1), y = Math.max(y >> 1, 1); return n } }); var Qw = function() { function e(e, t, n) { mc.call(this, e), this.dracoLoader = new Iw, this.ktx2Loader = new Ww, this.meshoptDecoder = Zw, this.ddsLoader = new Yw, this.dracoLoader.setDecoderPath(n + "three.js/loaders/draco/"), this.ktx2Loader.setTranscoderPath(n + "three.js/loaders/ktx/").detectSupport(t), this.pluginCallbacks = [], this.register(function(e) { return new r(e) }), this.register(function(e) { return new o(e) }), this.register(function(e) { return new s(e) }), this.register(function(e) { return new a(e) }), this.register(function(e) { return new i(e) }), this.register(function(e) { return new l(e) }) } function n() { var n = {}; return { get: function(e) { return n[e] }, add: function(e, t) { n[e] = t }, remove: function(e) { delete n[e] }, removeAll: function() { n = {} } } } e.prototype = Object.assign(Object.create(mc.prototype), { constructor: e, load: function(n, i, e, t) { var r = this , a = "" !== this.resourcePath ? this.resourcePath : "" !== this.path ? this.path : ld.extractUrlBase(n); this.manager.itemStart(n); function o(e) { t ? t(e) : console.error(e), r.manager.itemError(n), r.manager.itemEnd(n) } var s = new gc(this.manager); s.setPath(this.path), s.setResponseType("arraybuffer"), s.setRequestHeader(this.requestHeader), s.setWithCredentials(this.withCredentials), s.load(n, function(e, t) { console.log("数据加载成功", n.split("/").pop(), " ,total: " + t); !function() { try { r.parse(e, a, function(e) { i(e, t), r.manager.itemEnd(n) }, o) } catch (e) { o(e) } }() }, e, o) }, setDRACOLoader: function(e) { return this.dracoLoader = e, this }, setDDSLoader: function(e) { return this.ddsLoader = e, this }, setKTX2Loader: function(e) { return this.ktx2Loader = e, this }, setMeshoptDecoder: function(e) { return this.meshoptDecoder = e, this }, register: function(e) { return -1 === this.pluginCallbacks.indexOf(e) && this.pluginCallbacks.push(e), this }, unregister: function(e) { return -1 !== this.pluginCallbacks.indexOf(e) && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this }, parse: function(e, t, n, i) { var r, a = {}, o = {}; if ("string" == typeof e) r = e; else if (ld.decodeText(new Uint8Array(e,0,4)) === v) { try { a[p.KHR_BINARY_GLTF] = new g(e) } catch (e) { return void (i && i(e)) } r = a[p.KHR_BINARY_GLTF].content } else r = ld.decodeText(new Uint8Array(e)); var s = JSON.parse(r); if (void 0 === s.asset || s.asset.version[0] < 2) i && i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")); else { var l = new V(s,{ path: t || this.resourcePath || "", crossOrigin: this.crossOrigin, manager: this.manager, ktx2Loader: this.ktx2Loader, meshoptDecoder: this.meshoptDecoder }); l.unlitMat = this.unlitMat, l.fileLoader.setRequestHeader(this.requestHeader); for (var u = 0; u < this.pluginCallbacks.length; u++) { var c = this.pluginCallbacks[u](l); a[(o[c.name] = c).name] = !0 } if (s.extensionsUsed) for (u = 0; u < s.extensionsUsed.length; ++u) { var d = s.extensionsUsed[u] , h = s.extensionsRequired || []; switch (d) { case p.KHR_MATERIALS_UNLIT: a[d] = new m; break; case p.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: a[d] = new b; break; case p.KHR_DRACO_MESH_COMPRESSION: a[d] = new y(s,this.dracoLoader); break; case p.MSFT_TEXTURE_DDS: a[d] = new f(this.ddsLoader); break; case p.KHR_TEXTURE_TRANSFORM: a[d] = new w; break; case p.KHR_MESH_QUANTIZATION: a[d] = new x; break; default: 0 <= h.indexOf(d) && void 0 === o[d] && console.warn('THREE.GLTFLoader: Unknown extension "' + d + '".') } } l.setExtensions(a), l.setPlugins(o), l.parse(n, i) } } }); var p = { KHR_BINARY_GLTF: "KHR_binary_glTF", KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression", KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual", KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat", KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: "KHR_materials_pbrSpecularGlossiness", KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission", KHR_MATERIALS_UNLIT: "KHR_materials_unlit", KHR_TEXTURE_BASISU: "KHR_texture_basisu", KHR_TEXTURE_TRANSFORM: "KHR_texture_transform", KHR_MESH_QUANTIZATION: "KHR_mesh_quantization", EXT_TEXTURE_WEBP: "EXT_texture_webp", EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression", MSFT_TEXTURE_DDS: "MSFT_texture_dds" }; function f(e) { if (!e) throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader"); this.name = p.MSFT_TEXTURE_DDS, this.ddsLoader = e } function i(e) { this.parser = e, this.name = p.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} } } function m() { this.name = p.KHR_MATERIALS_UNLIT } function r(e) { this.parser = e, this.name = p.KHR_MATERIALS_CLEARCOAT } function a(e) { this.parser = e, this.name = p.KHR_MATERIALS_TRANSMISSION } function o(e) { this.parser = e, this.name = p.KHR_TEXTURE_BASISU } function s(e) { this.parser = e, this.name = p.EXT_TEXTURE_WEBP, this.isSupported = null } function l(e) { this.name = p.EXT_MESHOPT_COMPRESSION, this.parser = e } i.prototype._markDefs = function() { for (var e = this.parser, t = this.parser.json.nodes || [], n = 0, i = t.length; n < i; n++) { var r = t[n]; r.extensions && r.extensions[this.name] && void 0 !== r.extensions[this.name].light && e._addNodeRef(this.cache, r.extensions[this.name].light) } } , i.prototype._loadLight = function(e) { var t = this.parser , n = "light:" + e , i = t.cache.get(n); if (i) return i; var r, a = t.json, o = ((a.extensions && a.extensions[this.name] || {}).lights || [])[e], s = new Yi(16777215); void 0 !== o.color && s.fromArray(o.color); var l = void 0 !== o.range ? o.range : 0; switch (o.type) { case "directional": (r = new nd(s)).target.position.set(0, 0, -1), r.add(r.target); break; case "point": (r = new $c(s)).distance = l; break; case "spot": (r = new Qc(s)).distance = l, o.spot = o.spot || {}, o.spot.innerConeAngle = void 0 !== o.spot.innerConeAngle ? o.spot.innerConeAngle : 0, o.spot.outerConeAngle = void 0 !== o.spot.outerConeAngle ? o.spot.outerConeAngle : Math.PI / 4, r.angle = o.spot.outerConeAngle, r.penumbra = 1 - o.spot.innerConeAngle / o.spot.outerConeAngle, r.target.position.set(0, 0, -1), r.add(r.target); break; default: throw new Error("THREE.GLTFLoader: Unexpected light type: " + o.type) } return r.position.set(0, 0, 0), r.decay = 2, void 0 !== o.intensity && (r.intensity = o.intensity), r.name = t.createUniqueName(o.name || "light_" + e), i = Promise.resolve(r), t.cache.add(n, i), i } , i.prototype.createNodeAttachment = function(e) { var t = this , n = this.parser , e = n.json.nodes[e] , i = (e.extensions && e.extensions[this.name] || {}).light; return void 0 === i ? null : this._loadLight(i).then(function(e) { return n._getNodeRef(t.cache, i, e) }) } , m.prototype.getMaterialType = function() { return $i } , m.prototype.extendParams = function(e, t, n) { var i = []; e.color = new Yi(1,1,1), e.opacity = 1; var r = t.pbrMetallicRoughness; return r && (Array.isArray(r.baseColorFactor) && (t = r.baseColorFactor, e.color.fromArray(t), e.opacity = t[3]), void 0 !== r.baseColorTexture && i.push(n.assignTexture(e, "map", r.baseColorTexture))), Promise.all(i) } , r.prototype.getMaterialType = function(e) { e = this.parser.json.materials[e]; return e.extensions && e.extensions[this.name] ? Vu : null } , r.prototype.extendMaterialParams = function(e, t) { var n = this.parser , i = n.json.materials[e]; if (!i.extensions || !i.extensions[this.name]) return Promise.resolve(); var e = [] , i = i.extensions[this.name]; return void 0 !== i.clearcoatFactor && (t.clearcoat = i.clearcoatFactor), void 0 !== i.clearcoatTexture && e.push(n.assignTexture(t, "clearcoatMap", i.clearcoatTexture)), void 0 !== i.clearcoatRoughnessFactor && (t.clearcoatRoughness = i.clearcoatRoughnessFactor), void 0 !== i.clearcoatRoughnessTexture && e.push(n.assignTexture(t, "clearcoatRoughnessMap", i.clearcoatRoughnessTexture)), void 0 !== i.clearcoatNormalTexture && (e.push(n.assignTexture(t, "clearcoatNormalMap", i.clearcoatNormalTexture)), void 0 !== i.clearcoatNormalTexture.scale && (i = i.clearcoatNormalTexture.scale, t.clearcoatNormalScale = new yn(i,i))), Promise.all(e) } , a.prototype.getMaterialType = function(e) { e = this.parser.json.materials[e]; return e.extensions && e.extensions[this.name] ? Vu : null } , a.prototype.extendMaterialParams = function(e, t) { var n = this.parser , i = n.json.materials[e]; if (!i.extensions || !i.extensions[this.name]) return Promise.resolve(); e = [], i = i.extensions[this.name]; return void 0 !== i.transmissionFactor && (t.transmission = i.transmissionFactor), void 0 !== i.transmissionTexture && e.push(n.assignTexture(t, "transmissionMap", i.transmissionTexture)), Promise.all(e) } , o.prototype.loadTexture = function(e) { var t = this.parser , n = t.json , i = n.textures[e]; if (!i.extensions || !i.extensions[this.name]) return null; var r = i.extensions[this.name] , i = n.images[r.source] , r = t.options.ktx2Loader; if (r) return t.loadTextureImage(e, i, r); if (n.extensionsRequired && 0 <= n.extensionsRequired.indexOf(this.name)) throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures"); return null } , s.prototype.loadTexture = function(t) { var n = this.name , i = this.parser , r = i.json , e = r.textures[t]; if (!e.extensions || !e.extensions[n]) return null; var e = e.extensions[n] , a = r.images[e.source] , o = a.uri ? i.options.manager.getHandler(a.uri) : i.textureLoader; return this.detectSupport().then(function(e) { if (e) return i.loadTextureImage(t, a, o); if (r.extensionsRequired && 0 <= r.extensionsRequired.indexOf(n)) throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported."); return i.loadTexture(t) }) } , s.prototype.detectSupport = function() { return this.isSupported || (this.isSupported = new Promise(function(e) { var t = new Image; t.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", t.onload = t.onerror = function() { e(1 === t.height) } } )), this.isSupported } , l.prototype.loadBufferView = function(e) { var t = this.parser.json , e = t.bufferViews[e]; if (e.extensions && e.extensions[this.name]) { var o = e.extensions[this.name] , e = this.parser.getDependency("buffer", o.buffer) , s = this.parser.options.meshoptDecoder; if (s && s.supported) return Promise.all([e, s.ready]).then(function(e) { var t = o.byteOffset || 0 , n = o.byteLength || 0 , i = o.count , r = o.byteStride , a = new ArrayBuffer(i * r) , n = new Uint8Array(e[0],t,n); return s.decodeGltfBuffer(new Uint8Array(a), i, r, n, o.mode, o.filter), a }); if (t.extensionsRequired && 0 <= t.extensionsRequired.indexOf(this.name)) throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files"); return null } return null } ; var v = "glTF" , u = 12 , c = { JSON: 1313821514, BIN: 5130562 }; function g(e) { this.name = p.KHR_BINARY_GLTF, this.content = null, this.body = null; var t = new DataView(e,0,u); if (this.header = { magic: ld.decodeText(new Uint8Array(e.slice(0, 4))), version: t.getUint32(4, !0), length: t.getUint32(8, !0) }, this.header.magic !== v) throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header."); if (this.header.version < 2) throw new Error("THREE.GLTFLoader: Legacy binary file detected."); for (var n = new DataView(e,u), i = 0; i < n.byteLength; ) { var r = n.getUint32(i, !0); i += 4; var a, o = n.getUint32(i, !0); i += 4, o === c.JSON ? (a = new Uint8Array(e,u + i,r), this.content = ld.decodeText(a)) : o === c.BIN && (this.body = e.slice(o = u + i, o + r)), i += r } if (null === this.content) throw new Error("THREE.GLTFLoader: JSON content not found.") } function y(e, t) { if (!t) throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided."); this.name = p.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload() } function w() { this.name = p.KHR_TEXTURE_TRANSFORM } function d(e) { Hu.call(this), this.isGLTFSpecularGlossinessMaterial = !0; var n = ["#ifdef USE_SPECULARMAP", "\tuniform sampler2D specularMap;", "#endif"].join("\n") , i = ["#ifdef USE_GLOSSINESSMAP", "\tuniform sampler2D glossinessMap;", "#endif"].join("\n") , r = ["vec3 specularFactor = specular;", "#ifdef USE_SPECULARMAP", "\tvec4 texelSpecular = texture2D( specularMap, vUv );", "\ttexelSpecular = sRGBToLinear( texelSpecular );", "\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture", "\tspecularFactor *= texelSpecular.rgb;", "#endif"].join("\n") , a = ["float glossinessFactor = glossiness;", "#ifdef USE_GLOSSINESSMAP", "\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );", "\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture", "\tglossinessFactor *= texelGlossiness.a;", "#endif"].join("\n") , o = ["PhysicalMaterial material;", "material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );", "vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );", "float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );", "material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.", "material.specularRoughness += geometryRoughness;", "material.specularRoughness = min( material.specularRoughness, 1.0 );", "material.specularColor = specularFactor;"].join("\n") , s = { specular: { value: (new Yi).setHex(16777215) }, glossiness: { value: 1 }, specularMap: { value: null }, glossinessMap: { value: null } }; this._extraUniforms = s, this.onBeforeCompile = function(e) { for (var t in s) e.uniforms[t] = s[t]; e.fragmentShader = e.fragmentShader.replace("uniform float roughness;", "uniform vec3 specular;").replace("uniform float metalness;", "uniform float glossiness;").replace("#include ", n).replace("#include ", i).replace("#include ", r).replace("#include ", a).replace("#include ", o) } , Object.defineProperties(this, { specular: { get: function() { return s.specular.value }, set: function(e) { s.specular.value = e } }, specularMap: { get: function() { return s.specularMap.value }, set: function(e) { (s.specularMap.value = e) ? this.defines.USE_SPECULARMAP = "" : delete this.defines.USE_SPECULARMAP } }, glossiness: { get: function() { return s.glossiness.value }, set: function(e) { s.glossiness.value = e } }, glossinessMap: { get: function() { return s.glossinessMap.value }, set: function(e) { (s.glossinessMap.value = e) ? (this.defines.USE_GLOSSINESSMAP = "", this.defines.USE_UV = "") : (delete this.defines.USE_GLOSSINESSMAP, delete this.defines.USE_UV) } } }), delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this.setValues(e) } function b() { return { name: p.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS, specularGlossinessParams: ["color", "map", "lightMap", "lightMapIntensity", "aoMap", "aoMapIntensity", "emissive", "emissiveIntensity", "emissiveMap", "bumpMap", "bumpScale", "normalMap", "normalMapType", "displacementMap", "displacementScale", "displacementBias", "specularMap", "specular", "glossinessMap", "glossiness", "alphaMap", "envMap", "envMapIntensity", "refractionRatio"], getMaterialType: function() { return d }, extendParams: function(e, t, n) { var i = t.extensions[this.name]; e.color = new Yi(1,1,1), e.opacity = 1; var r = []; return Array.isArray(i.diffuseFactor) && (t = i.diffuseFactor, e.color.fromArray(t), e.opacity = t[3]), void 0 !== i.diffuseTexture && r.push(n.assignTexture(e, "map", i.diffuseTexture)), e.emissive = new Yi(0,0,0), e.glossiness = void 0 !== i.glossinessFactor ? i.glossinessFactor : 1, e.specular = new Yi(1,1,1), Array.isArray(i.specularFactor) && e.specular.fromArray(i.specularFactor), void 0 !== i.specularGlossinessTexture && (i = i.specularGlossinessTexture, r.push(n.assignTexture(e, "glossinessMap", i)), r.push(n.assignTexture(e, "specularMap", i))), Promise.all(r) }, createMaterial: function(e) { var t = new d(e); return t.fog = !0, t.color = e.color, t.map = void 0 === e.map ? null : e.map, t.lightMap = null, t.lightMapIntensity = 1, t.aoMap = void 0 === e.aoMap ? null : e.aoMap, t.aoMapIntensity = 1, t.emissive = e.emissive, t.emissiveIntensity = 1, t.emissiveMap = void 0 === e.emissiveMap ? null : e.emissiveMap, t.bumpMap = void 0 === e.bumpMap ? null : e.bumpMap, t.bumpScale = 1, t.normalMap = void 0 === e.normalMap ? null : e.normalMap, t.normalMapType = sn, e.normalScale && (t.normalScale = e.normalScale), t.displacementMap = null, t.displacementScale = 1, t.displacementBias = 0, t.specularMap = void 0 === e.specularMap ? null : e.specularMap, t.specular = e.specular, t.glossinessMap = void 0 === e.glossinessMap ? null : e.glossinessMap, t.glossiness = e.glossiness, t.alphaMap = null, t.envMap = void 0 === e.envMap ? null : e.envMap, t.envMapIntensity = 1, t.refractionRatio = .98, t } } } function x() { this.name = p.KHR_MESH_QUANTIZATION } function T(e, t, n, i) { Ku.call(this, e, t, n, i) } y.prototype.decodePrimitive = function(e, t) { var n, i = this.json, r = this.dracoLoader, a = e.extensions[this.name].bufferView, o = e.extensions[this.name].attributes, s = {}, l = {}, u = {}; for (n in o) { var c = L[n] || n.toLowerCase(); s[c] = o[n] } for (n in e.attributes) { var d, h, c = L[n] || n.toLowerCase(); void 0 !== o[n] && (d = i.accessors[e.attributes[n]], h = D[d.componentType], u[c] = h, l[c] = !0 === d.normalized) } return t.getDependency("bufferView", a).then(function(e) { return new Promise(function(i) { r.decodeDracoFile(e, function(e) { for (var t in e.attributes) { var n = e.attributes[t] , t = l[t]; void 0 !== t && (n.normalized = t) } i(e) }, s, u) } ) }) } , w.prototype.extendTexture = function(e, t) { return e = e.clone(), void 0 !== t.offset && e.offset.fromArray(t.offset), void 0 !== t.rotation && (e.rotation = t.rotation), void 0 !== t.scale && e.repeat.fromArray(t.scale), void 0 !== t.texCoord && console.warn('THREE.GLTFLoader: Custom UV sets in "' + this.name + '" extension not yet supported.'), e.needsUpdate = !0, e } , ((d.prototype = Object.create(Hu.prototype)).constructor = d).prototype.copy = function(e) { return Hu.prototype.copy.call(this, e), this.specularMap = e.specularMap, this.specular.copy(e.specular), this.glossinessMap = e.glossinessMap, this.glossiness = e.glossiness, delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this } , ((T.prototype = Object.create(Ku.prototype)).constructor = T).prototype.beforeStart_ = T.prototype.copySampleValue_ = function(e) { for (var t = this.resultBuffer, n = this.sampleValues, i = this.valueSize, r = e * i * 3 + i, a = 0; a !== i; a++) t[a] = n[r + a]; return t } , T.prototype.afterEnd_ = T.prototype.copySampleValue_, T.prototype.interpolate_ = function(e, t, n, i) { for (var r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = 2 * o, l = 3 * o, u = i - t, i = (n - t) / u, n = i * i, t = n * i, c = e * l, d = c - l, h = -2 * t + 3 * n, p = t - n, f = 1 - h, m = p - n + i, v = 0; v !== o; v++) { var g = a[d + v + o] , y = a[d + v + s] * u , w = a[c + v + o] , b = a[c + v] * u; r[v] = f * g + m * y + h * w + p * b } return r } ; var E = 0 , _ = 1 , M = 2 , A = 3 , S = 4 , C = 5 , P = 6 , D = { 5120: Int8Array, 5121: Uint8Array, 5122: Int16Array, 5123: Uint16Array, 5125: Uint32Array, 5126: Float32Array } , h = { 9728: Re, 9729: Oe, 9984: Fe, 9985: ze, 9986: Ie, 9987: Ne } , k = { 33071: Be, 33648: Le, 10497: ke } , B = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4, MAT2: 4, MAT3: 9, MAT4: 16 } , L = { POSITION: "position", NORMAL: "normal", TANGENT: "tangent", TEXCOORD_0: "uv", TEXCOORD_1: "uv2", COLOR_0: "color", WEIGHTS_0: "skinWeight", JOINTS_0: "skinIndex" } , R = { scale: "scale", translation: "position", rotation: "quaternion", weights: "morphTargetInfluences" } , F = { CUBICSPLINE: void 0, LINEAR: $t, STEP: Kt } , I = "OPAQUE" , O = "MASK" , z = "BLEND"; function N(e, t) { return "string" != typeof e || "" === e ? "" : (/^https?:\/\//i.test(t) && /^\//.test(e) && (t = t.replace(/(^https?:\/\/[^\/]+).*/i, "$1")), /^(https?:)?\/\//i.test(e) || /^data:.*,.*$/i.test(e) || /^blob:.*$/i.test(e) ? e : t + e) } function U(e, t, n) { for (var i in n.extensions) void 0 === e[i] && (t.userData.gltfExtensions = t.userData.gltfExtensions || {}, t.userData.gltfExtensions[i] = n.extensions[i]) } function G(e, t) { void 0 !== t.extras && ("object" === X(t.extras) ? Object.assign(e.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras)) } function H(e) { for (var t = "", n = Object.keys(e).sort(), i = 0, r = n.length; i < r; i++) t += n[i] + ":" + e[n[i]] + ";"; return t } function V(e, t) { this.json = e || {}, this.extensions = {}, this.plugins = {}, this.options = t || {}, this.cache = new n, this.associations = new Map, this.primitiveCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.nodeNamesUsed = {}, this.textureLoader = new _c(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.fileLoader = new gc(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), "use-credentials" === this.options.crossOrigin && this.fileLoader.setWithCredentials(!0) } function j(n, e, i) { var t, r, a = e.attributes, o = []; for (t in a) { var s = L[t] || t.toLowerCase(); s in n.attributes || o.push(function(e, t) { return i.getDependency("accessor", e).then(function(e) { n.setAttribute(t, e) }) }(a[t], s)) } return void 0 === e.indices || n.index || (r = i.getDependency("accessor", e.indices).then(function(e) { n.setIndex(e) }), o.push(r)), G(n, e), function(e, t, n) { var i = t.attributes , r = new kn; if (void 0 !== i.POSITION) { var a = (h = n.json.accessors[i.POSITION]).min , o = h.max; if (void 0 !== a && void 0 !== o) { r.set(new Cn(a[0],a[1],a[2]), new Cn(o[0],o[1],o[2])); var s = t.targets; if (void 0 !== s) { for (var l = new Cn, u = new Cn, c = 0, d = s.length; c < d; c++) { var h, p = s[c]; void 0 !== p.POSITION && (a = (h = n.json.accessors[p.POSITION]).min, o = h.max, void 0 !== a && void 0 !== o ? (u.setX(Math.max(Math.abs(a[0]), Math.abs(o[0]))), u.setY(Math.max(Math.abs(a[1]), Math.abs(o[1]))), u.setZ(Math.max(Math.abs(a[2]), Math.abs(o[2]))), l.max(u)) : console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")) } r.expandByVector(l) } e.boundingBox = r; t = new qn; r.getCenter(t.center), t.radius = r.min.distanceTo(r.max) / 2, e.boundingSphere = t } else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.") } }(n, e, i), Promise.all(o).then(function() { return void 0 !== e.targets ? function(n, e, t) { for (var i = !1, r = !1, a = 0, o = e.length; a < o; a++) if (void 0 !== (c = e[a]).POSITION && (i = !0), void 0 !== c.NORMAL && (r = !0), i && r) break; if (!i && !r) return Promise.resolve(n); for (var s = [], l = [], a = 0, o = e.length; a < o; a++) { var u, c = e[a]; i && (u = void 0 !== c.POSITION ? t.getDependency("accessor", c.POSITION) : n.attributes.position, s.push(u)), r && (u = void 0 !== c.NORMAL ? t.getDependency("accessor", c.NORMAL) : n.attributes.normal, l.push(u)) } return Promise.all([Promise.all(s), Promise.all(l)]).then(function(e) { var t = e[0] , e = e[1]; return i && (n.morphAttributes.position = t), r && (n.morphAttributes.normal = e), n.morphTargetsRelative = !0, n }) }(n, e.targets, i) : n }) } function W(e, t) { var n = e.getIndex(); if (null === n) { var i = [] , r = e.getAttribute("position"); if (void 0 === r) return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), e; for (var a = 0; a < r.count; a++) i.push(a); e.setIndex(i), n = e.getIndex() } var o = n.count - 2 , s = []; if (2 === t) for (a = 1; a <= o; a++) s.push(n.getX(0)), s.push(n.getX(a)), s.push(n.getX(a + 1)); else for (a = 0; a < o; a++) a % 2 == 0 ? (s.push(n.getX(a)), s.push(n.getX(a + 1)), s.push(n.getX(a + 2))) : (s.push(n.getX(a + 2)), s.push(n.getX(a + 1)), s.push(n.getX(a))); s.length / 3 != o && console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles."); e = e.clone(); return e.setIndex(s), e } return V.prototype.setExtensions = function(e) { this.extensions = e } , V.prototype.setPlugins = function(e) { this.plugins = e } , V.prototype.parse = function(t, e) { var n = this , i = this.json , r = this.extensions; this.cache.removeAll(), this._invokeAll(function(e) { return e._markDefs && e._markDefs() }), Promise.all([this.getDependencies("scene"), this.getDependencies("animation"), this.getDependencies("camera")]).then(function(e) { e = { scene: e[0][i.scene || 0], scenes: e[0], animations: e[1], cameras: e[2], asset: i.asset, parser: n, userData: {} }; U(r, e, i), G(e, i), t(e) }).catch(e) } , V.prototype._markDefs = function() { for (var e = this.json.nodes || [], t = this.json.skins || [], n = this.json.meshes || [], i = 0, r = t.length; i < r; i++) for (var a = t[i].joints, o = 0, s = a.length; o < s; o++) e[a[o]].isBone = !0; for (var l = 0, u = e.length; l < u; l++) { var c = e[l]; void 0 !== c.mesh && (this._addNodeRef(this.meshCache, c.mesh), void 0 !== c.skin && (n[c.mesh].isSkinnedMesh = !0)), void 0 !== c.camera && this._addNodeRef(this.cameraCache, c.camera) } } , V.prototype._addNodeRef = function(e, t) { void 0 !== t && (void 0 === e.refs[t] && (e.refs[t] = e.uses[t] = 0), e.refs[t]++) } , V.prototype._getNodeRef = function(e, t, n) { if (e.refs[t] <= 1) return n; n = n.clone(); return n.name += "_instance_" + e.uses[t]++, n } , V.prototype._invokeOne = function(e) { var t = Object.values(this.plugins); t.push(this); for (var n = 0; n < t.length; n++) { var i = e(t[n]); if (i) return i } } , V.prototype._invokeAll = function(e) { var t = Object.values(this.plugins); t.unshift(this); for (var n = [], i = 0; i < t.length; i++) { var r = e(t[i]); r && n.push(r) } return n } , V.prototype.getDependency = function(e, t) { var n = e + ":" + t , i = this.cache.get(n); if (!i) { switch (e) { case "scene": i = this.loadScene(t); break; case "node": i = this.loadNode(t); break; case "mesh": i = this._invokeOne(function(e) { return e.loadMesh && e.loadMesh(t) }); break; case "accessor": i = this.loadAccessor(t); break; case "bufferView": i = this._invokeOne(function(e) { return e.loadBufferView && e.loadBufferView(t) }); break; case "buffer": i = this.loadBuffer(t); break; case "material": i = this._invokeOne(function(e) { return e.loadMaterial && e.loadMaterial(t) }); break; case "texture": i = this._invokeOne(function(e) { return e.loadTexture && e.loadTexture(t) }); break; case "skin": i = this.loadSkin(t); break; case "animation": i = this.loadAnimation(t); break; case "camera": i = this.loadCamera(t); break; default: throw new Error("Unknown type: " + e) } this.cache.add(n, i) } return i } , V.prototype.getDependencies = function(n) { var i, e, t = this.cache.get(n); return t || (e = (i = this).json[n + ("mesh" === n ? "es" : "s")] || [], t = Promise.all(e.map(function(e, t) { return i.getDependency(n, t) })), this.cache.add(n, t)), t } , V.prototype.loadBuffer = function(e) { var n = this.json.buffers[e] , i = this.fileLoader; if (n.type && "arraybuffer" !== n.type) throw new Error("THREE.GLTFLoader: " + n.type + " buffer type is not supported."); if (void 0 === n.uri && 0 === e) return Promise.resolve(this.extensions[p.KHR_BINARY_GLTF].body); var r = this.options; return new Promise(function(e, t) { i.load(N(n.uri, r.path), e, void 0, function() { t(new Error('THREE.GLTFLoader: Failed to load buffer "' + n.uri + '".')) }) } ) } , V.prototype.loadBufferView = function(e) { var i = this.json.bufferViews[e]; return this.getDependency("buffer", i.buffer).then(function(e) { var t = i.byteLength || 0 , n = i.byteOffset || 0; return e.slice(n, n + t) }) } , V.prototype.loadAccessor = function(e) { var g = this , y = this.json , w = this.json.accessors[e]; if (void 0 === w.bufferView && void 0 === w.sparse) return Promise.resolve(null); e = []; return void 0 !== w.bufferView ? e.push(this.getDependency("bufferView", w.bufferView)) : e.push(null), void 0 !== w.sparse && (e.push(this.getDependency("bufferView", w.sparse.indices.bufferView)), e.push(this.getDependency("bufferView", w.sparse.values.bufferView))), Promise.all(e).then(function(e) { var t, n, i, r = e[0], a = B[w.type], o = D[w.componentType], s = o.BYTES_PER_ELEMENT, l = w.byteOffset || 0, u = void 0 !== w.bufferView ? y.bufferViews[w.bufferView].byteStride : void 0, c = !0 === w.normalized, d = u && u !== s * a ? (t = Math.floor(l / u), n = "InterleavedBuffer:" + w.bufferView + ":" + w.componentType + ":" + t + ":" + w.count, (i = g.cache.get(n)) || (i = new ys(new o(r,t * u,w.count * u / s),u / s), g.cache.add(n, i)), new xs(i,a,l % u / s,c)) : new nr(null === r ? new o(w.count * a) : new o(r,l,w.count * a),a,c); if (void 0 !== w.sparse) { var s = D[w.sparse.indices.componentType] , l = w.sparse.indices.byteOffset || 0 , c = w.sparse.values.byteOffset || 0 , h = new s(e[1],l,w.sparse.count * B.SCALAR) , p = new o(e[2],c,w.sparse.count * a); null !== r && (d = new nr(d.array.slice(),d.itemSize,d.normalized)); for (var f = 0, m = h.length; f < m; f++) { var v = h[f]; if (d.setX(v, p[f * a]), 2 <= a && d.setY(v, p[f * a + 1]), 3 <= a && d.setZ(v, p[f * a + 2]), 4 <= a && d.setW(v, p[f * a + 3]), 5 <= a) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.") } } return d }) } , V.prototype.loadTexture = function(e) { var t = this.json , n = this.options , i = t.textures[e] , r = i.extensions || {} , i = r[p.MSFT_TEXTURE_DDS] ? t.images[r[p.MSFT_TEXTURE_DDS].source] : t.images[i.source] , a = (a = i.uri ? n.manager.getHandler(i.uri) : a) || (r[p.MSFT_TEXTURE_DDS] ? this.extensions[p.MSFT_TEXTURE_DDS].ddsLoader : this.textureLoader); return this.loadTextureImage(e, i, a) } , V.prototype.loadTextureImage = function(n, i, e) { var r = this , a = this.json , o = (this.options, a.textures[n]) , s = self.URL || self.webkitURL , l = i.uri , u = !1 , c = !0; return "image/jpeg" === i.mimeType && (c = !1), void 0 !== i.bufferView && (l = r.getDependency("bufferView", i.bufferView).then(function(e) { var t; "image/png" === i.mimeType && (t = new DataView(e,25,1).getUint8(0, !1), c = 6 === t || 4 === t || 3 === t), u = !0; e = new Blob([e],{ type: i.mimeType }); return l = s.createObjectURL(e) })), Promise.resolve(l).then(function(n) { return new Promise(function(t, e) { r.textureLoader.load(n, function(e) { e.minFilter = THREE.LinearMipmapLinearFilter, t(e) }) } ) }).then(function(e) { !0 === u && s.revokeObjectURL(l), e.flipY = !1, o.name && (e.name = o.name), c || (e.format = $e); var t = (a.samplers || {})[o.sampler] || {}; return e.magFilter = h[t.magFilter] || Oe, e.minFilter = h[t.minFilter] || Ne, e.wrapS = k[t.wrapS] || ke, e.wrapT = k[t.wrapT] || ke, r.associations.set(e, { type: "textures", index: n }), e }) } , V.prototype.assignTexture = function(i, r, a) { var o = this; return this.getDependency("texture", a.index).then(function(e) { var t, n; void 0 === a.texCoord || 0 == a.texCoord || "aoMap" === r && 1 == a.texCoord || console.warn("THREE.GLTFLoader: Custom UV set " + a.texCoord + " for texture " + r + " not yet supported."), !o.extensions[p.KHR_TEXTURE_TRANSFORM] || (t = void 0 !== a.extensions ? a.extensions[p.KHR_TEXTURE_TRANSFORM] : void 0) && (n = o.associations.get(e), e = o.extensions[p.KHR_TEXTURE_TRANSFORM].extendTexture(e, t), o.associations.set(e, n)), i[r] = e }) } , V.prototype.assignFinalMaterial = function(e) { var t, n, i, r = e.geometry, a = e.material, o = void 0 !== r.attributes.tangent, s = void 0 !== r.attributes.color, l = void 0 === r.attributes.normal, u = !0 === e.isSkinnedMesh, c = 0 < Object.keys(r.morphAttributes).length, d = c && void 0 !== r.morphAttributes.normal; e.isPoints ? (n = "PointsMaterial:" + a.uuid, (t = this.cache.get(n)) || (t = new hl, Ki.prototype.copy.call(t, a), t.color.copy(a.color), t.map = a.map, t.sizeAttenuation = !1, this.cache.add(n, t)), a = t) : e.isLine && (n = "LineBasicMaterial:" + a.uuid, (i = this.cache.get(n)) || (i = new tl, Ki.prototype.copy.call(i, a), i.color.copy(a.color), this.cache.add(n, i)), a = i), (o || s || l || u || c) && (n = "ClonedMaterial:" + a.uuid + ":", a.isGLTFSpecularGlossinessMaterial && (n += "specular-glossiness:"), u && (n += "skinning:"), o && (n += "vertex-tangents:"), s && (n += "vertex-colors:"), l && (n += "flat-shading:"), c && (n += "morph-targets:"), d && (n += "morph-normals:"), (i = this.cache.get(n)) || (i = a.clone(), u && (i.skinning = !0), o && (i.vertexTangents = !0), s && (i.vertexColors = !0), l && (i.flatShading = !0), c && (i.morphTargets = !0), d && (i.morphNormals = !0), this.cache.add(n, i), this.associations.set(i, this.associations.get(a))), a = i), a.aoMap && void 0 === r.attributes.uv2 && void 0 !== r.attributes.uv && r.setAttribute("uv2", r.attributes.uv), a.normalScale && !o && (a.normalScale.y = -a.normalScale.y), a.clearcoatNormalScale && !o && (a.clearcoatNormalScale.y = -a.clearcoatNormalScale.y), e.material = a } , V.prototype.getMaterialType = function() { return this.unlitMat ? $i : Hu } , V.prototype.loadMaterial = function(t) { var n, e, i = this, r = this.json, a = this.extensions, o = r.materials[t], s = {}, l = o.extensions || {}, u = []; l[p.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS] ? (r = a[p.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS], n = r.getMaterialType(), u.push(r.extendParams(s, o, i))) : l[p.KHR_MATERIALS_UNLIT] ? (e = a[p.KHR_MATERIALS_UNLIT], n = e.getMaterialType(), u.push(e.extendParams(s, o, i))) : (c = o.pbrMetallicRoughness || {}, s.color = new Yi(1,1,1), s.opacity = 1, Array.isArray(c.baseColorFactor) && (e = c.baseColorFactor, s.color.fromArray(e), s.opacity = e[3]), void 0 !== c.baseColorTexture && u.push(i.assignTexture(s, "map", c.baseColorTexture)), s.metalness = void 0 !== c.metallicFactor ? c.metallicFactor : 1, s.roughness = void 0 !== c.roughnessFactor ? c.roughnessFactor : 1, void 0 !== c.metallicRoughnessTexture && (u.push(i.assignTexture(s, "metalnessMap", c.metallicRoughnessTexture)), u.push(i.assignTexture(s, "roughnessMap", c.metallicRoughnessTexture))), n = this._invokeOne(function(e) { return e.getMaterialType && e.getMaterialType(t) }), u.push(Promise.all(this._invokeAll(function(e) { return e.extendMaterialParams && e.extendMaterialParams(t, s) })))), !0 === o.doubleSided && (s.side = Y); var c = o.alphaMode || I; return c === z ? (s.transparent = !0, s.depthWrite = !1) : (s.transparent = !1, c === O && (s.alphaTest = void 0 !== o.alphaCutoff ? o.alphaCutoff : .5)), void 0 !== o.normalTexture && n !== $i && (u.push(i.assignTexture(s, "normalMap", o.normalTexture)), s.normalScale = new yn(1,1), void 0 !== o.normalTexture.scale && s.normalScale.set(o.normalTexture.scale, o.normalTexture.scale)), void 0 !== o.occlusionTexture && n !== $i && (u.push(i.assignTexture(s, "aoMap", o.occlusionTexture)), void 0 !== o.occlusionTexture.strength && (s.aoMapIntensity = o.occlusionTexture.strength)), void 0 !== o.emissiveFactor && n !== $i && (s.emissive = (new Yi).fromArray(o.emissiveFactor)), void 0 !== o.emissiveTexture && n !== $i && u.push(i.assignTexture(s, "emissiveMap", o.emissiveTexture)), Promise.all(u).then(function() { var e = n === d ? a[p.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s) : new n(s); return o.name && (e.name = o.name), e.map && (e.map.encoding = an), e.emissiveMap && (e.emissiveMap.encoding = an), G(e, o), i.associations.set(e, { type: "materials", index: t }), o.extensions && U(a, e, o), e }) } , V.prototype.createUniqueName = function(e) { for (var t = eh.sanitizeNodeName(e || ""), n = t, i = 1; this.nodeNamesUsed[n]; ++i) n = t + "_" + i; return this.nodeNamesUsed[n] = !0, n } , V.prototype.loadGeometries = function(e) { var n = this , i = this.extensions , t = this.primitiveCache; for (var r = [], a = 0, o = e.length; a < o; a++) { var s = e[a] , l = (l = void 0, u = (l = (u = s).extensions && u.extensions[p.KHR_DRACO_MESH_COMPRESSION]) ? "draco:" + l.bufferView + ":" + l.indices + ":" + H(l.attributes) : u.indices + ":" + H(u.attributes) + ":" + u.mode) , u = t[l]; u ? r.push(u.promise) : (u = s.extensions && s.extensions[p.KHR_DRACO_MESH_COMPRESSION] ? function(t) { return i[p.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t, n).then(function(e) { return j(e, t, n) }) }(s) : j(new Mr, s, n), t[l] = { primitive: s, promise: u }, r.push(u)) } return Promise.all(r) } , V.prototype.loadMesh = function(d) { for (var h = this, e = this.json, p = this.extensions, f = e.meshes[d], m = f.primitives, t = [], n = 0, i = m.length; n < i; n++) { var r = void 0 === m[n].material ? (void 0 === (r = this.cache).DefaultMaterial && (r.DefaultMaterial = new Hu({ color: 16777215, emissive: 0, metalness: 1, roughness: 1, transparent: !1, depthTest: !0, side: q })), r.DefaultMaterial) : this.getDependency("material", m[n].material); t.push(r) } return t.push(h.loadGeometries(m)), Promise.all(t).then(function(e) { for (var t = e.slice(0, e.length - 1), n = e[e.length - 1], i = [], r = 0, a = n.length; r < a; r++) { var o, s = n[r], l = m[r], u = t[r]; if (l.mode === S || l.mode === C || l.mode === P || void 0 === l.mode) !0 !== (o = new (!0 === f.isSkinnedMesh ? Ws : Hr)(s,u)).isSkinnedMesh || o.geometry.attributes.skinWeight.normalized || o.normalizeSkinWeights(), l.mode === C ? o.geometry = W(o.geometry, 1) : l.mode === P && (o.geometry = W(o.geometry, 2)); else if (l.mode === _) o = new cl(s,u); else if (l.mode === A) o = new sl(s,u); else if (l.mode === M) o = new dl(s,u); else { if (l.mode !== E) throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + l.mode); o = new gl(s,u) } 0 < Object.keys(o.geometry.morphAttributes).length && function(e, t) { if (e.updateMorphTargets(), void 0 !== t.weights) for (var n = 0, i = t.weights.length; n < i; n++) e.morphTargetInfluences[n] = t.weights[n]; if (t.extras && Array.isArray(t.extras.targetNames)) { var r = t.extras.targetNames; if (e.morphTargetInfluences.length === r.length) { e.morphTargetDictionary = {}; for (n = 0, i = r.length; n < i; n++) e.morphTargetDictionary[r[n]] = n } else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.") } }(o, f), o.name = h.createUniqueName(f.name || "mesh_" + d), G(o, f), l.extensions && U(p, o, l), h.assignFinalMaterial(o), i.push(o) } if (1 === i.length) return i[0]; for (var c = new us, r = 0, a = i.length; r < a; r++) c.add(i[r]); return c }) } , V.prototype.loadCamera = function(e) { var t, n = this.json.cameras[e], e = n[n.type]; if (e) return "perspective" === n.type ? t = new $r(gn.radToDeg(e.yfov),e.aspectRatio || 1,e.znear || 1,e.zfar || 2e6) : "orthographic" === n.type && (t = new ed(-e.xmag,e.xmag,e.ymag,-e.ymag,e.znear,e.zfar)), n.name && (t.name = this.createUniqueName(n.name)), G(t, n), Promise.resolve(t); console.warn("THREE.GLTFLoader: Missing camera parameters.") } , V.prototype.loadSkin = function(e) { var e = this.json.skins[e] , t = { joints: e.joints }; return void 0 === e.inverseBindMatrices ? Promise.resolve(t) : this.getDependency("accessor", e.inverseBindMatrices).then(function(e) { return t.inverseBindMatrices = e, t }) } , V.prototype.loadAnimation = function(M) { for (var A = this.json.animations[M], e = [], t = [], n = [], i = [], r = [], a = 0, o = A.channels.length; a < o; a++) { var s = A.channels[a] , l = A.samplers[s.sampler] , u = s.target , c = void 0 !== u.node ? u.node : u.id , d = void 0 !== A.parameters ? A.parameters[l.input] : l.input , s = void 0 !== A.parameters ? A.parameters[l.output] : l.output; e.push(this.getDependency("node", c)), t.push(this.getDependency("accessor", d)), n.push(this.getDependency("accessor", s)), i.push(l), r.push(u) } return Promise.all([Promise.all(e), Promise.all(t), Promise.all(n), Promise.all(i), Promise.all(r)]).then(function(e) { for (var t = e[0], n = e[1], i = e[2], r = e[3], a = e[4], o = [], s = 0, l = t.length; s < l; s++) { var u, c = t[s], d = n[s], h = i[s], p = r[s], f = a[s]; if (void 0 !== c) { switch (c.updateMatrix(), c.matrixAutoUpdate = !0, R[f.path]) { case R.weights: u = ac; break; case R.rotation: u = sc; break; default: u = uc } var m = c.name || c.uuid , v = void 0 !== p.interpolation ? F[p.interpolation] : $t , g = []; R[f.path] === R.weights ? c.traverse(function(e) { !0 === e.isMesh && e.morphTargetInfluences && g.push(e.name || e.uuid) }) : g.push(m); var y, w = h.array; if (h.normalized) { if (w.constructor === Int8Array) y = 1 / 127; else if (w.constructor === Uint8Array) y = 1 / 255; else if (w.constructor == Int16Array) y = 1 / 32767; else { if (w.constructor !== Uint16Array) throw new Error("THREE.GLTFLoader: Unsupported output accessor component type."); y = 1 / 65535 } for (var b = new Float32Array(w.length), x = 0, E = w.length; x < E; x++) b[x] = w[x] * y; w = b } for (x = 0, E = g.length; x < E; x++) { var _ = new u(g[x] + "." + R[f.path],d.array,w,v); "CUBICSPLINE" === p.interpolation && (_.createInterpolant = function(e) { return new T(this.times,this.values,this.getValueSize() / 3,e) } , _.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0), o.push(_) } } } return new cc(A.name || "animation_" + M,void 0,o) }) } , V.prototype.loadNode = function(a) { var t, e = this.json, o = this.extensions, s = this, l = e.nodes[a], u = l.name ? s.createUniqueName(l.name) : ""; return t = [], void 0 !== l.mesh && t.push(s.getDependency("mesh", l.mesh).then(function(e) { e = s._getNodeRef(s.meshCache, l.mesh, e); return void 0 !== l.weights && e.traverse(function(e) { if (e.isMesh) for (var t = 0, n = l.weights.length; t < n; t++) e.morphTargetInfluences[t] = l.weights[t] }), e })), void 0 !== l.camera && t.push(s.getDependency("camera", l.camera).then(function(e) { return s._getNodeRef(s.cameraCache, l.camera, e) })), s._invokeAll(function(e) { return e.createNodeAttachment && e.createNodeAttachment(a) }).forEach(function(e) { t.push(e) }), Promise.all(t).then(function(e) { var t, n = !0 === l.isBone ? new Xs : 1 < e.length ? new us : 1 === e.length ? e[0] : new Si; if (n !== e[0]) for (var i = 0, r = e.length; i < r; i++) n.add(e[i]); return l.name && (n.userData.name = l.name, n.name = u), G(n, l), l.extensions && U(o, n, l), void 0 !== l.matrix ? ((t = new ni).fromArray(l.matrix), n.applyMatrix4(t)) : (void 0 !== l.translation && n.position.fromArray(l.translation), void 0 !== l.rotation && n.quaternion.fromArray(l.rotation), void 0 !== l.scale && n.scale.fromArray(l.scale)), s.associations.set(n, { type: "nodes", index: a }), n }) } , V.prototype.loadScene = function(e) { var t = this.json , n = this.extensions , e = this.json.scenes[e] , i = new us; e.name && (i.name = this.createUniqueName(e.name)), G(i, e), e.extensions && U(n, i, e); for (var r = e.nodes || [], a = [], o = 0, s = r.length; o < s; o++) a.push(function o(e, s, l, u) { var c = l.nodes[e]; return u.getDependency("node", e).then(function(e) { return void 0 === c.skin ? e : u.getDependency("skin", c.skin).then(function(e) { for (var t = [], n = 0, i = (s = e).joints.length; n < i; n++) t.push(u.getDependency("node", s.joints[n])); return Promise.all(t) }).then(function(o) { return e.traverse(function(e) { if (e.isMesh) { for (var t = [], n = [], i = 0, r = o.length; i < r; i++) { var a = o[i]; a ? (t.push(a), a = new ni, void 0 !== s.inverseBindMatrices && a.fromArray(s.inverseBindMatrices.array, 16 * i), n.push(a)) : console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', s.joints[i]) } e.bind(new Ys(t,n), e.matrixWorld) } }), e }); var s }).then(function(e) { s.add(e); var t = []; if (c.children) for (var n = c.children, i = 0, r = n.length; i < r; i++) { var a = n[i]; t.push(o(a, e, l, u)) } return Promise.all(t) }) }(r[o], i, t, this)); return Promise.all(a).then(function() { return i }) } , e }() , Kw = { Handedness: Object.freeze({ NONE: "none", LEFT: "left", RIGHT: "right" }), ComponentState: Object.freeze({ DEFAULT: "default", TOUCHED: "touched", PRESSED: "pressed" }), ComponentProperty: Object.freeze({ BUTTON: "button", X_AXIS: "xAxis", Y_AXIS: "yAxis", STATE: "state" }), ComponentType: Object.freeze({ TRIGGER: "trigger", SQUEEZE: "squeeze", TOUCHPAD: "touchpad", THUMBSTICK: "thumbstick", BUTTON: "button" }), ButtonTouchThreshold: .05, AxisTouchThreshold: .1, VisualResponseProperty: Object.freeze({ TRANSFORM: "transform", VISIBILITY: "visibility" }) }; function $w() { return e1.apply(this, arguments) } function e1() { return (e1 = r(regeneratorRuntime.mark(function e(t) { var n; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return e.next = 2, fetch(t); case 2: if ((n = e.sent).ok) { e.next = 7; break } throw new Error(n.statusText); case 7: return e.abrupt("return", n.json()); case 8: case "end": return e.stop() } }, e) }))).apply(this, arguments) } function t1() { return (t1 = r(regeneratorRuntime.mark(function e(t) { var n; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: if (t) { e.next = 2; break } throw new Error("No basePath supplied"); case 2: return e.next = 5, $w("".concat(t, "/").concat("profilesList.json")); case 5: return n = e.sent, e.abrupt("return", n); case 7: case "end": return e.stop() } }, e) }))).apply(this, arguments) } function n1() { return (n1 = r(regeneratorRuntime.mark(function e(t, n) { var i, r, a, o, s, l, u, c, d = arguments; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: if (i = 2 < d.length && void 0 !== d[2] ? d[2] : null, r = !(3 < d.length && void 0 !== d[3]) || d[3], t) { e.next = 4; break } throw new Error("No xrInputSource supplied"); case 4: if (n) { e.next = 6; break } throw new Error("No basePath supplied"); case 6: return e.next = 8, function() { return t1.apply(this, arguments) }(n); case 8: if (a = e.sent, t.profiles.some(function(e) { var t = a[e]; return !!(o = t ? { profileId: e, profilePath: "".concat(n, "/").concat(t.path), deprecated: !!t.deprecated } : o) }), o) { e.next = 17; break } if (i) { e.next = 13; break } throw new Error("No matching profile name found"); case 13: if (s = a[i]) { e.next = 16; break } throw new Error('No matching profile name found and default profile "'.concat(i, '" missing.')); case 16: o = { profileId: i, profilePath: "".concat(n, "/").concat(s.path), deprecated: !!s.deprecated }; case 17: return e.next = 19, $w(o.profilePath); case 19: if (l = e.sent, !r) { e.next = 25; break } if (c = "any" === t.handedness ? l.layouts[Object.keys(l.layouts)[0]] : l.layouts[t.handedness]) { e.next = 24; break } throw new Error("No matching handedness, ".concat(t.handedness, ", in profile ").concat(o.profileId)); case 24: c.assetPath && (u = o.profilePath.replace("profile.json", c.assetPath)); case 25: return e.abrupt("return", { profile: l, assetPath: u }); case 26: case "end": return e.stop() } }, e) }))).apply(this, arguments) } var i1 = { xAxis: 0, yAxis: 0, button: 0, state: Kw.ComponentState.DEFAULT }; var r1 = function() { function t(e) { O(this, t), this.componentProperty = e.componentProperty, this.states = e.states, this.valueNodeName = e.valueNodeName, this.valueNodeProperty = e.valueNodeProperty, this.valueNodeProperty === Kw.VisualResponseProperty.TRANSFORM && (this.minNodeName = e.minNodeName, this.maxNodeName = e.maxNodeName), this.value = 0, this.updateFromComponent(i1) } return h(t, [{ key: "updateFromComponent", value: function(e) { var t = e.xAxis , n = e.yAxis , i = e.button , r = e.state , n = function(e, t) { var n = 0 < arguments.length && void 0 !== e ? e : 0 , i = 1 < arguments.length && void 0 !== t ? t : 0 , e = n , t = i; return 1 < Math.sqrt(n * n + i * i) && (n = Math.atan2(i, n), e = Math.cos(n), t = Math.sin(n)), { normalizedXAxis: .5 * e + .5, normalizedYAxis: .5 * t + .5 } }(t, n) , a = n.normalizedXAxis , o = n.normalizedYAxis; switch (this.componentProperty) { case Kw.ComponentProperty.X_AXIS: this.value = this.states.includes(r) ? a : .5; break; case Kw.ComponentProperty.Y_AXIS: this.value = this.states.includes(r) ? o : .5; break; case Kw.ComponentProperty.BUTTON: this.value = this.states.includes(r) ? i : 0; break; case Kw.ComponentProperty.STATE: this.valueNodeProperty === Kw.VisualResponseProperty.VISIBILITY ? this.value = this.states.includes(r) : this.value = this.states.includes(r) ? 1 : 0; break; default: throw new Error("Unexpected visualResponse componentProperty ".concat(this.componentProperty)) } } }]), t }() , a1 = function() { function t(e, n) { var i = this; if (O(this, t), !(e && n && n.visualResponses && n.gamepadIndices && 0 !== Object.keys(n.gamepadIndices).length)) throw new Error("Invalid arguments supplied"); this.id = e, this.type = n.type, this.rootNodeName = n.rootNodeName, this.touchPointNodeName = n.touchPointNodeName, this.visualResponses = {}, Object.keys(n.visualResponses).forEach(function(e) { var t = new r1(n.visualResponses[e]); i.visualResponses[e] = t }), this.gamepadIndices = Object.assign({}, n.gamepadIndices), this.values = { state: Kw.ComponentState.DEFAULT, button: void 0 !== this.gamepadIndices.button ? 0 : void 0, xAxis: void 0 !== this.gamepadIndices.xAxis ? 0 : void 0, yAxis: void 0 !== this.gamepadIndices.yAxis ? 0 : void 0 } } return h(t, [{ key: "data", get: function() { return function(t) { for (var e = 1; e < arguments.length; e++) { var n = null != arguments[e] ? arguments[e] : {}; e % 2 ? i(Object(n), !0).forEach(function(e) { H(t, e, n[e]) }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : i(Object(n)).forEach(function(e) { Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e)) }) } return t }({ id: this.id }, this.values) } }, { key: "updateFromGamepad", value: function(e) { var t, n = this; this.values.state = Kw.ComponentState.DEFAULT, void 0 !== this.gamepadIndices.button && e.buttons.length > this.gamepadIndices.button && (t = e.buttons[this.gamepadIndices.button], this.values.button = t.value, this.values.button = this.values.button < 0 ? 0 : this.values.button, this.values.button = 1 < this.values.button ? 1 : this.values.button, t.pressed || 1 === this.values.button ? this.values.state = Kw.ComponentState.PRESSED : (t.touched || this.values.button > Kw.ButtonTouchThreshold) && (this.values.state = Kw.ComponentState.TOUCHED)), void 0 !== this.gamepadIndices.xAxis && e.axes.length > this.gamepadIndices.xAxis && (this.values.xAxis = e.axes[this.gamepadIndices.xAxis], this.values.xAxis = this.values.xAxis < -1 ? -1 : this.values.xAxis, this.values.xAxis = 1 < this.values.xAxis ? 1 : this.values.xAxis, this.values.state === Kw.ComponentState.DEFAULT && Math.abs(this.values.xAxis) > Kw.AxisTouchThreshold && (this.values.state = Kw.ComponentState.TOUCHED)), void 0 !== this.gamepadIndices.yAxis && e.axes.length > this.gamepadIndices.yAxis && (this.values.yAxis = e.axes[this.gamepadIndices.yAxis], this.values.yAxis = this.values.yAxis < -1 ? -1 : this.values.yAxis, this.values.yAxis = 1 < this.values.yAxis ? 1 : this.values.yAxis, this.values.state === Kw.ComponentState.DEFAULT && Math.abs(this.values.yAxis) > Kw.AxisTouchThreshold && (this.values.state = Kw.ComponentState.TOUCHED)), Object.values(this.visualResponses).forEach(function(e) { e.updateFromComponent(n.values) }) } }]), t }() , o1 = function() { function r(e, t, n) { var i = this; if (O(this, r), !e) throw new Error("No xrInputSource supplied"); if (!t) throw new Error("No profile supplied"); this.xrInputSource = e, this.assetUrl = n, this.id = t.profileId, this.layoutDescription = t.layouts[e.handedness], this.components = {}, Object.keys(this.layoutDescription.components).forEach(function(e) { var t = i.layoutDescription.components[e]; i.components[e] = new a1(e,t) }), this.updateFromGamepad() } return h(r, [{ key: "gripSpace", get: function() { return this.xrInputSource.gripSpace } }, { key: "targetRaySpace", get: function() { return this.xrInputSource.targetRaySpace } }, { key: "data", get: function() { var t = []; return Object.values(this.components).forEach(function(e) { t.push(e.data) }), t } }, { key: "updateFromGamepad", value: function() { var t = this; Object.values(this.components).forEach(function(e) { e.updateFromGamepad(t.xrInputSource.gamepad) }) } }]), r }(); function s1() { Si.call(this), this.motionController = null, this.envMap = null } function l1(t, e) { var n, r; n = t.motionController, r = e, Object.values(n.components).forEach(function(e) { var t = e.type , n = e.touchPointNodeName , i = e.visualResponses; t === Kw.ComponentType.TOUCHPAD && (e.touchPointNode = r.getObjectByName(n), e.touchPointNode ? (n = new Hr(new Tu(.001),new $i({ color: 255 })), e.touchPointNode.add(n)) : console.warn("Could not find touch dot, ".concat(e.touchPointNodeName, ", in touchpad component ").concat(e.id))), Object.values(i).forEach(function(e) { var t = e.valueNodeName , n = e.minNodeName , i = e.maxNodeName; if (e.valueNodeProperty === Kw.VisualResponseProperty.TRANSFORM) { if (e.minNode = r.getObjectByName(n), e.maxNode = r.getObjectByName(i), !e.minNode) return void console.warn("Could not find ".concat(n, " in the model")); if (!e.maxNode) return void console.warn("Could not find ".concat(i, " in the model")) } e.valueNode = r.getObjectByName(t), e.valueNode || console.warn("Could not find ".concat(t, " in the model")) }) }), t.envMap && e.traverse(function(e) { e.isMesh && (e.material.envMap = t.envMap, e.material.needsUpdate = !0) }), t.add(e) } s1.prototype = Object.assign(Object.create(Si.prototype), { constructor: s1, setEnvironmentMap: function(e) { var t = this; return this.envMap == e || (this.envMap = e, this.traverse(function(e) { e.isMesh && (e.material.envMap = t.envMap, e.material.needsUpdate = !0) })), this }, updateMatrixWorld: function(e) { Si.prototype.updateMatrixWorld.call(this, e), this.motionController && (this.motionController.updateFromGamepad(), Object.values(this.motionController.components).forEach(function(e) { Object.values(e.visualResponses).forEach(function(e) { var t = e.valueNode , n = e.minNode , i = e.maxNode , r = e.value , e = e.valueNodeProperty; t && (e === Kw.VisualResponseProperty.VISIBILITY ? t.visible = r : e === Kw.VisualResponseProperty.TRANSFORM && (Sn.slerp(n.quaternion, i.quaternion, t.quaternion, r), t.position.lerpVectors(n.position, i.position, r))) }) })) } }); var u1 = (c1.prototype = { constructor: c1, createControllerModel: function(e) { var i = this , r = new s1 , a = null; return e.addEventListener("connected", function(e) { var n = e.data; "tracked-pointer" === n.targetRayMode && n.gamepad && !function() { return n1.apply(this, arguments) }(n, i.path, "generic-trigger").then(function(e) { var t = e.profile , e = e.assetPath; r.motionController = new o1(n,t,e); e = i._assetCache[r.motionController.assetUrl]; if (e) a = e.scene.clone(), l1(r, a); else { if (!i.gltfLoader) throw new Error("GLTFLoader not set."); i.gltfLoader.setPath(""), i.gltfLoader.load(r.motionController.assetUrl, function(e) { i._assetCache[r.motionController.assetUrl] = e, a = e.scene.clone(), l1(r, a) }, null, function() { throw new Error("Asset ".concat(r.motionController.assetUrl, " missing or malformed.")) }) } }).catch(function(e) { console.warn(e) }) }), e.addEventListener("disconnected", function() { r.motionController = null, r.remove(a), a = null }), r } }, c1); function c1() { this.gltfLoader = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : null, this.path = "https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles", this._assetCache = {}, this.gltfLoader || (this.gltfLoader = new Qw) } var d1 = new $r; function h1(e, t) { t = t.clone(); t.updateMatrix(), t.updateMatrixWorld(); e = e.clone().applyMatrix4(t.matrix); return e.z -= .8 * t.scale.x, e } function p1(e, t) { if (!t || !t.inputSource || !t.inputSource.gamepad) return null; var n = t.inputSource.gamepad.axes , i = 0; 2 === n.length ? i = n[1] : 4 === n.length && (i = n[3]); var r, i = Math.sign(i) * Math.pow(2 * i, 2), a = 0, o = ue(viewer.scene.pointclouds); try { for (o.s(); !(r = o.n()).done; ) var s = r.value , l = s.boundingBox.min.distanceTo(s.boundingBox.max) , a = Math.max(a, l) } catch (e) { o.e(e) } finally { o.f() } var u = Math.pow(a, .5) / 2 , c = e.node.scale.x , n = viewer.getMoveSpeed() , i = u * i * Math.pow(n, .5) / c , n = (new Sn).setFromEuler(t.rotation) , c = new Cn(0,0,-1); c.applyQuaternion(n); c = c.clone().multiplyScalar(i), i = e.toScene(t.position); return c = e.toScene(t.position.clone().add(c)).clone().sub(i) } var f1, m1 = function() { function t(e) { O(this, t), this.moveFactor = 1, this.dbgLabel = null } return h(t, [{ key: "start", value: function(e) { this.dbgLabel } }, { key: "end", value: function() {} }, { key: "update", value: function(e, t) { var n = e.cPrimary , i = e.cSecondary , r = p1(e, n) , a = p1(e, i) , r = r || new Cn , a = a || new Cn , i = r.clone().add(a); i.multiplyScalar(-t * this.moveFactor), e.node.position.add(i); r = e.node.scale.x, a = e.viewer.renderer.xr.getCamera(d1), t = a.getWorldPosition(new Cn), i = a.getWorldDirection(new Cn), t.clone().add(i.multiplyScalar(r)), a = h1(t, e.node), i = h1(t.clone().add(i), e.node).sub(a); i.normalize().multiplyScalar(r); i = a.clone().add(i); e.viewer.scene.view.setView(a, i), Potree.debug.message && (this.dbgLabel.visible = !0, this.dbgLabel.setText(Potree.debug.message), this.dbgLabel.scale.set(.1, .1, .1), this.dbgLabel.position.copy(n.position)) } }]), t }(), v1 = function() { function e() { O(this, e), this.controller = null, this.startPos = null, this.debugLine = null } return h(e, [{ key: "start", value: function(e) { this.controller = e.triggered.values().next().value, this.startPos = e.node.position.clone() } }, { key: "end", value: function(e) {} }, { key: "update", value: function(e, t) { var n = this.controller.start.position , i = this.controller.position , n = e.toScene(n) , n = (i = e.toScene(i)).clone().sub(n); n.set(-n.x, -n.y, -n.z); n = (new Cn).addVectors(this.startPos, n); e.node.position.copy(n) } }]), e }(), g1 = function() { function e() { O(this, e), this.line = null, this.startState = null } return h(e, [{ key: "start", value: function(e) { this.line || (this.line = Potree.Utils.debugLine(e.viewer.sceneVR, new Cn(0,0,0), new Cn(0,0,0), 16776960), this.dbgLabel = new Potree.TextSprite("abc"), this.dbgLabel.scale.set(.1, .1, .1), e.viewer.sceneVR.add(this.dbgLabel)), this.line.node.visible = !0, this.startState = e.node.clone() } }, { key: "end", value: function(e) { this.line.node.visible = !1, this.dbgLabel.visible = !1 } }, { key: "update", value: function(e, t) { var n = e.cPrimary.start.position.clone() , i = e.cSecondary.start.position.clone() , r = n.clone().add(i).multiplyScalar(.5) , a = i.clone().sub(n) , o = e.cPrimary.position.clone() , s = e.cSecondary.position.clone() , l = o.clone().add(s).multiplyScalar(.5) , u = s.clone().sub(o) , c = a.length() , i = u.length() , n = new yn(a.x,a.z).angle() , a = new yn(u.x,u.z).angle() - n , u = i / c , n = this.startState.clone(); n.updateMatrix(), n.matrixAutoUpdate = !1; c = (i = new ni).makeTranslation.apply(i, Q(h1(r, this.startState).multiplyScalar(-1).toArray())), i = (i = new ni).makeTranslation.apply(i, Q(h1(r, this.startState).toArray())), a = (new ni).makeRotationZ(a), u = (new ni).makeScale(1 / u, 1 / u, 1 / u); n.applyMatrix4(c), n.applyMatrix4(a), n.applyMatrix4(u), n.applyMatrix4(i); u = h1(r, this.startState), i = h1(l, n), r = u.clone().sub(i), i = (u = new ni).makeTranslation.apply(u, Q(r.toArray())); n.applyMatrix4(i), n.matrix.decompose(n.position, n.quaternion, n.scale), e.node.position.copy(n.position), e.node.quaternion.copy(n.quaternion), e.node.scale.copy(n.scale), e.node.updateMatrix(); u = e.node.scale.x, r = e.viewer.renderer.xr.getCamera(d1), i = r.getWorldPosition(new Cn), n = r.getWorldDirection(new Cn), i.clone().add(n.multiplyScalar(u)), r = h1(i, this.startState), n = h1(i.clone().add(n), this.startState).sub(r); n.normalize().multiplyScalar(u); n = r.clone().add(n); e.viewer.scene.view.setView(r, n), e.viewer.setMoveSpeed(u), this.line.set(o, s); e = e.node.scale.x; this.dbgLabel.visible = !0, this.dbgLabel.position.copy(l), this.dbgLabel.setText("scale: 1 : ".concat(e.toFixed(2))), this.dbgLabel.scale.set(.05, .05, .05) } }]), e }(), gu = function() { y(c, hn); var u = w(c); function c(e) { var t; O(this, c), ((t = u.call(this, e)).viewer = e).addEventListener("vr_start", t.onStart.bind(g(t))), e.addEventListener("vr_end", t.onEnd.bind(g(t))), t.node = new Si, t.node.up.set(0, 0, 1), t.triggered = new Set; var n = e.renderer.xr , i = new $c(16777215,5,0,1); i.position.set(0, 2, 0), t.viewer.sceneVR.add(i), t.menu = null; var r = new u1 , a = new Su(1,32,32) , o = new Xu , s = n.getController(0) , e = n.getControllerGrip(0); e.name = "grip(0)", e.add(r.createControllerModel(e)), t.viewer.sceneVR.add(e); i = new Hr(a,o); i.scale.set(.005, .005, .005), s.add(i), s.visible = !0, t.viewer.sceneVR.add(s); e = new Mf; e.setPositions([0, 0, -.15, 0, 0, .05]); i = new lf({ color: 16711680, lineWidth: 2, resolution: new yn(1e3,1e3) }), i = new Af(e,i); s.add(i), s.addEventListener("connected", function(e) { e = e.data; s.inputSource = e }), s.addEventListener("selectstart", function() { t.onTriggerStart(s) }), s.addEventListener("selectend", function() { t.onTriggerEnd(s) }), t.cPrimary = s; var l = n.getController(1) , n = n.getControllerGrip(1) , r = r.createControllerModel(n); n.add(r), t.viewer.sceneVR.add(n); a = new Hr(a,o); a.scale.set(.005, .005, .005), l.add(a), l.visible = !0, t.viewer.sceneVR.add(l); o = new Mf; o.setPositions([0, 0, -.15, 0, 0, .05]); a = new lf({ color: 16711680, lineWidth: 2, resolution: new yn(1e3,1e3) }), a = new Af(o,a); return l.add(a), l.addEventListener("connected", function(e) { e = e.data; l.inputSource = e, t.initMenu(l) }), l.addEventListener("selectstart", function() { t.onTriggerStart(l) }), l.addEventListener("selectend", function() { t.onTriggerEnd(l) }), t.cSecondary = l, t.mode_fly = new m1, t.mode_translate = new v1, t.mode_rotScale = new g1, t.setMode(t.mode_fly), t } return h(c, [{ key: "createSlider", value: function(e, t, n) { var i = new Su(1,8,8) , r = new Bl(1,1,1,8) , a = new $i({ color: 16711680 }) , o = new $i({ color: 16729156 }) , s = new Xu , l = new Si , u = new Potree.TextSprite("".concat(e, ": 0")) , e = new Hr(i,a) , a = new Hr(i,a) , s = new Hr(i,s) , o = new Hr(r,o); return u.scale.set(.2, .2, .2), u.position.set(0, .35, 0), e.scale.set(.02, .02, .02), e.position.set(0, .25, 0), a.scale.set(.02, .02, .02), a.position.set(0, -.25, 0), s.scale.set(.02, .02, .02), s.position.set(0, 0, 0), o.scale.set(.005, .5, .005), l.add(u), l.add(e), l.add(a), l.add(s), l.add(o), l } }, { key: "createInfo", value: function() { var e = (new _c).load("".concat(Potree.resourcePath, "/images/vr_controller_help.jpg")); return new Hr(new ua(1,1,1,1),new $i({ map: e })) } }, { key: "initMenu", value: function(e) { var t; this.menu || (t = new Si, this.menu = t, window.vrMenu = t) } }, { key: "toScene", value: function(e) { var t = this.getCamera().matrixWorld; return e.clone().applyMatrix4(t) } }, { key: "toVR", value: function(e) { var t = this.getCamera().matrixWorld.clone(); return t.invert(), e.clone().applyMatrix4(t) } }, { key: "setMode", value: function(e) { if (this.mode !== e) { this.mode && this.mode.end(this); for (var t = 0, n = [this.cPrimary, this.cSecondary]; t < n.length; t++) { var i = n[t] , r = { position: i.position.clone(), rotation: i.rotation.clone() }; i.start = r } this.mode = e, this.mode.start(this) } } }, { key: "onTriggerStart", value: function(e) { this.triggered.add(e), 0 === this.triggered.size ? this.setMode(this.mode_fly) : 1 === this.triggered.size ? this.setMode(this.mode_translate) : 2 === this.triggered.size && this.setMode(this.mode_rotScale) } }, { key: "onTriggerEnd", value: function(e) { this.triggered.delete(e), 0 === this.triggered.size ? this.setMode(this.mode_fly) : 1 === this.triggered.size ? this.setMode(this.mode_translate) : 2 === this.triggered.size && this.setMode(this.mode_rotScale) } }, { key: "onStart", value: function() { var e = this.viewer.scene.view.position.clone() , t = this.viewer.scene.view.direction; t.multiplyScalar(-1); var n = e.clone().add(t); n.z = e.z; t = this.viewer.getMoveSpeed(); this.node.position.copy(e), this.node.lookAt(n), this.node.scale.set(t, t, t), this.node.updateMatrix(), this.node.updateMatrixWorld() } }, { key: "onEnd", value: function() {} }, { key: "setScene", value: function(e) { this.scene = e } }, { key: "getCamera", value: function() { this.viewer.scene.getActiveCamera(); var e = new $r , t = this.viewer.getMoveSpeed(); return e.near = .1, e.far = 1e3, e.up.set(0, 0, 1), e.lookAt(new Cn(0,-1,0)), e.updateMatrix(), e.updateMatrixWorld(), e.position.copy(this.node.position), e.rotation.copy(this.node.rotation), e.scale.set(t, t, t), e.updateMatrix(), e.updateMatrixWorld(), e.matrixAutoUpdate = !1, e.parent = e } }, { key: "update", value: function(e) { this.mode.update(this, e) } }]), c }(), y1 = { 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" }, { movePointcloud: "move" }, { polygon_isIntersectSelf: "not-allowed" }, { polygon_AtWrongPlace: "not-allowed" }, { markerMove: "grab" }, { mapClipMove: "move" }, { mapClipRotate: "url({Potree.resourcePath}/images/rotate-cursor.png),auto" }, { rotatePointcloud: "url({Potree.resourcePath}/images/rotate-cursor.png),auto" }, { siteModelFloorDrag: "row-resize" }, { addSth: "cell" }], list: [], currentCursorIndex: null, init: function(e, t) { var n = this; this.priorityEvent.forEach(function(e) { for (var t in e) e[t] = Fm.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 < e && (this.list.splice(e, 1), this.judge()) }, judge: function() { var e, i, r = this, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; t.addItem ? ((e = this.priorityEvent.indexOf(t.addItem)) < this.currentCursorIndex || null == this.currentCursorIndex) && (this.domElements.forEach(function(e) { return e.style.cursor = t.addItem[t.name] }), this.currentCursorIndex = e) : (i = { index: 1 / 0, cursor: null }, this.list.forEach(function(t) { var e = r.priorityEvent.find(function(e) { return e[t] }) , n = r.priorityEvent.indexOf(e); n < i.index && (i.index = n, i.cursor = e[t]) }), this.currentCursorIndex = i.index, this.domElements.forEach(function(e) { return e.style.cursor = i.cursor || "" })) } }, w1 = new _c, b1 = new Yi(T.clip.color), x1 = { width2d: 30 }, E1 = function() { y(o, Df); var r = w(o); function o(e, t) { O(this, o); var n, i, t = { points: _1(e = e.clone().setZ(0), t, 0), closed: !0, isRect: !0, dimension: "2d" }; (i = r.call(this, "mapClipBox", t)).angle = 0, i.createRotateBar(), i.edgeMarkers = [], i.initData(t), i.areaPlane.addEventListener("mouseover", function() { viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "mapClipMove" }) }), i.areaPlane.addEventListener("mouseleave", function() { viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "mapClipMove" }) }); return i.areaPlane.addEventListener("drag", function(e) { var t = e.intersect.orthoIntersect; n && (e = (new Cn).subVectors(t, n).setZ(0), i.center.add(e), i.updatePoints(), i.dispatchEvent({ type: "repos" })), n = t.clone() }), i.areaPlane.addEventListener("drop", function(e) { n = null }), viewer.setObjectLayers(g(i), "mapObjects"), i } return h(o, [{ key: "getScale", value: function() { return new Cn(this.points[0].distanceTo(this.points[1]),this.points[1].distanceTo(this.points[2]),1) } }, { key: "addMarker", value: function() { var t = this , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {} , n = new qp({ mat: this.getMarkerMaterial("default"), sizeInfo: x1, dontFixOrient: !0, viewports: viewer.mapViewer.viewports, name: "mapClipBox_marker" }); n.renderOrder = 3; var i = Sf.createLine([new Cn, new Cn], { color: b1 }) , r = new qp({ mat: this.getMarkerMaterial("default"), sizeInfo: x1, dontFixOrient: !0, viewports: viewer.mapViewer.viewports, name: "mapClipBox_edgePoint" }); r.addEventListener("mouseover", function(e) { t.setMarkerSelected(e.object, !0, "single"), viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "markerMove" }) }), r.addEventListener("mouseleave", function(e) { t.setMarkerSelected(e.object, !1, "single"), viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "markerMove" }) }); var a = { lastPos: null }; r.addEventListener("drag", this.dragEdge.bind(this, a)), r.addEventListener("drop", this.dropEdge.bind(this, a)), this.edgeMarkers.push(r), this.add(r), n.dispatchEvent("addHoverEvent"), b(v(o.prototype), "addMarker", this).call(this, { point: e.point, marker: n, edge: i }) } }, { key: "dragEdge", value: function(e, t) { var n, i = "mapViewport" == t.dragViewport.name, r = t.intersect.orthoIntersect; r && e.lastPos && (-1 !== (n = this.edgeMarkers.indexOf(t.drag.object)) && (t = Up.getNormal2d({ p1: this.points[n], p2: this.points[(n + 1) % 4] }), t = (new Cn).subVectors(r, e.lastPos).setZ(0).projectOnVector(t).setZ(0), t = (new Cn).addVectors(this.points[n], t), this.dragChange(t, n, i))), e.lastPos = r.clone() } }, { key: "dropEdge", value: function(e, t) { e.lastPos = null, this.setMarkerSelected(t.drag.object, !1, "single") } }, { key: "createAreaPlane", value: function() { var e = new $i({ color: b1, side: Y, opacity: .3, transparent: !0, depthTest: !1 }); return b(v(o.prototype), "createAreaPlane", this).call(this, e) } }, { key: "getMarkerMaterial", value: function(e) { return f1 || (f1 = { default: new $i({ transparent: !0, color: b1, opacity: .8, map: w1.load(Potree.resourcePath + "/textures/whiteCircle.png") }), select: new $i({ transparent: !0, color: b1, opacity: 1, map: w1.load(Potree.resourcePath + "/textures/whiteCircle.png") }) }, o.markerMats = f1), f1[e] } }, { key: "setMarkerSelected", value: function(e, t, n) { e.material = "hover" == t ? this.getMarkerMaterial("select") : this.getMarkerMaterial("default"), viewer.mapViewer.dispatchEvent("content_changed") } }, { key: "createRotateBar", value: function() { var i = this , e = .7 , t = new Si , n = new qp({ mat: new $i({ side: Y, opacity: e, transparent: !0, depthTest: !1, map: w1.load(Potree.resourcePath + "/textures/rotation_circle.png") }), root: t, sizeInfo: x1, dontFixOrient: !0, viewports: viewer.mapViewer.viewports, name: "mapClipRotateBar" }); n.position.set(0, 2.5, 0), n.scale.set(2, 2, 2), n.addEventListener("mouseover", function() { n.material.opacity = 1, viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "mapClipRotate" }), viewer.mapViewer.dispatchEvent("content_changed") }); function r() { n.material.opacity = e, viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "mapClipRotate" }), viewer.mapViewer.dispatchEvent("content_changed") } var a; n.addEventListener("mouseleave", r), this.addEventListener("dispose", r), n.addEventListener("drag", function(e) { var t, n = e.intersect.orthoIntersect; a && (t = (new Cn).subVectors(a, i.center).setZ(0), e = (new Cn).subVectors(n, i.center).setZ(0), e = Up.getAngle(t, e, "z"), i.angle += e, i.rotateBar.rotation.z = i.angle, i.updatePoints(), i.dispatchEvent({ type: "rotate", angle: i.angle })), a = n.clone() }), n.addEventListener("drop", function() { a = null, viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "mapClipRotate" }) }); var o = Sf.createLine([new Cn, new Cn(0,1.5,0)], { color: b1 }); t.add(n), t.add(o), this.add(t), this.rotateBar = t, this.rotateBar.bar = n } }, { key: "updatePoints", value: function(e) { this.points = _1(this.center, e || this.getScale(), this.angle), this.getPoint2dInfo(this.points), this.update({ ifUpdateMarkers: !0 }) } }, { key: "update", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; b(v(o.prototype), "update", this).call(this, e); e = (new Cn).addVectors(this.points[0], this.points[1]).multiplyScalar(.5); this.rotateBar.position.copy(e), this.rotateBar.bar.update(); for (var t = 0; t < 4; t++) { var n = this.points[t] , i = this.points[(t + 1) % 4] , i = (new Cn).addVectors(n, i).multiplyScalar(.5); this.updateMarker(this.edgeMarkers[t], i) } } }, { key: "dispose", value: function() { b(v(o.prototype), "dispose", this).call(this), this.dispatchEvent("dispose") } }]), o }(); function _1(t, e, n) { var n = 2 < arguments.length && void 0 !== n ? n : 0 , e = [new Cn(-e.x / 2,+e.y / 2,0), new Cn(+e.x / 2,+e.y / 2,0), new Cn(+e.x / 2,-e.y / 2,0), new Cn(-e.x / 2,-e.y / 2,0)] , i = (new ni).makeRotationAxis(new Cn(0,0,1), n); return e.forEach(function(e) { e.applyMatrix4(i), e.add(t) }), e } var M1 = { bus: new hn, selectedDatasets: [], changeCallback: function(t) { var n = this; Potree.settings.isOfficial && Fm.intervalTool.isWaiting("clipSelectedDatasets", function() { var e = n.getIntersectPointcloud(); if (t || Fm.getDifferenceSet(e, n.selectedDatasets).length) return n.selectedDatasets = e, n.bus.dispatchEvent({ type: "updateSelectedDatasets", selectedDatasets: e.map(function(e) { return e.dataset_id }) }), !(t = !1) }, 300) }, enter: function() { var n = this; this.previousView = { position: viewer.images360.position, target: viewer.scene.view.getPivot(), displayMode: Potree.settings.displayMode, ifShowMarker: Potree.settings.ifShowMarker }; var e = this.getPointcloud().bound , t = e.getSize(new Cn) , i = this.getTarget(e.getCenter(new Cn)) , e = new Cn(6,6,t.z) , t = viewer.scene.view.direction.clone().setZ(0).multiplyScalar(-6) , r = (new Cn).addVectors(i, t); Potree.settings.displayMode = "showPointCloud", viewer.setView({ position: r, target: i, duration: 300, callback: function() {} }), viewer.setControls(viewer.orbitControls), viewer.setLimitFar(!1), this.box = new Zp({ clip: !0 }), this.box.name = "ClipBox", this.box.position.copy(i), this.box.scale.copy(e), this.box.addEventListener("position_changed", function(e) { n.mapBox.center.setX(n.box.position.x), n.mapBox.center.setY(n.box.position.y), n.mapBox.updatePoints(), n.changeCallback() }), this.box.addEventListener("scale_changed", function(e) { var t = n.box.scale; n.mapBox.updatePoints(t), n.changeCallback() }), this.box.addEventListener("orientation_changed", function(e) { n.mapBox.angle = n.box.rotation.z, n.mapBox.rotateBar.rotation.z = n.mapBox.angle, n.mapBox.updatePoints(), n.changeCallback() }), viewer.scene.addVolume(this.box); function a() { n.box.rotation.x = 0, n.box.rotation.y = 0 } this.mapBox = new E1(i,e), viewer.mapViewer.scene.add(this.mapBox), this.mapBox.addEventListener("repos", function(e) { n.box.position.setX(n.mapBox.center.x), n.box.position.setY(n.mapBox.center.y), a(), n.changeCallback() }), this.mapBox.addEventListener("dragChange", function(e) { var t = n.mapBox.getScale(); n.box.scale.setX(t.x), n.box.scale.setY(t.y), n.box.position.setX(n.mapBox.center.x), n.box.position.setY(n.mapBox.center.y), a(), n.changeCallback() }), this.mapBox.addEventListener("rotate", function(e) { n.box.rotation.z = n.mapBox.angle, a(), n.changeCallback() }), viewer.setClipTask(tm.SHOW_INSIDE), Potree.settings.unableNavigate = !0, Potree.settings.ifShowMarker = !1, viewer.updateVisible(viewer.measuringTool.scene, "clipModel", !1), viewer.inputHandler.toggleSelection(this.box), viewer.inputHandler.fixSelection = !0, viewer.transformationTool.frame.material.color.set(Potree.config.clip.color), viewer.setPointStandardMat(!0), this.events = { flyToPos: function(e) { e.position; var t = n.box.position; r = e.position; viewer.scene.view.setView({ position: r, duration: 1e3, target: t }) } }, this.bus.addEventListener("flyToPos", this.events.flyToPos), this.editing = !0, setTimeout(function() { n.changeCallback(!0) }, 1) }, leave: function() { viewer.inputHandler.fixSelection = !1, viewer.scene.removeVolume(this.box), this.mapBox.dispose(), viewer.setControls(viewer.fpControls), Potree.settings.unableNavigate = !1, Potree.settings.ifShowMarker = this.previousView.ifShowMarker, viewer.updateVisible(viewer.measuringTool.scene, "clipModel", !0), viewer.setView(this.previousView), viewer.setLimitFar(!0), viewer.setPointStandardMat(!1), this.bus.removeEventListener("flyToPos", this.events.flyToPos), this.events = null, this.editing = !1 }, getPointcloud: function() { var e = viewer.scene.pointclouds.filter(function(e) { return 0 < e.panos.length }); return 0 == e.length && (e = viewer.scene.pointclouds), Fm.sortByScore(e, [], [function(e) { var t = e.bound.getCenter(new Cn); return e.bound.getSize(new Cn).length() / 2 / viewer.images360.position.distanceTo(t) } ])[0].item }, getTarget: function(e) { var t = new Cn , n = viewer.images360.position , n = Fm.find(viewer.images360.panos, [], [ly.sortFunctions.floorDisSquaredToPoint(n)]); return n ? (t.copy(n.position), t.setZ(e.z)) : t.copy(e), t }, download: function() { var t = this; return 0 == this.getIntersectPointcloud().length ? null : { transformation_matrix: viewer.scene.pointclouds.filter(function(e) { return viewer.getObjVisiByReason(e, "datasetSelection") }).map(function(e) { return { id: e.dataset_id, matrix: t.getTransformationMatrix(e).elements, modelMatrix: (new ni).copy(e.transformMatrix).transpose().elements } }), aabb: "b-0.5 -0.5 -0.5 0.5 0.5 0.5" } }, downloadNoCrop: function() { var e = { transformation_matrix: viewer.scene.pointclouds.filter(function(e) { return viewer.getObjVisiByReason(e, "datasetSelection") }).map(function(e) { return { id: e.dataset_id, matrix: (new ni).elements, modelMatrix: (new ni).copy(e.transformMatrix).transpose().elements } }), aabb: "b-12742000 -12742000 -12742000 12742000 12742000 12742000" }; return console.log(e), e }, getTransformationMatrix: function(e) { var t = (new ni).getInverse(this.box.matrixWorld); return (new ni).multiplyMatrices(t, e.transformMatrix).transpose() }, getIntersectPointcloud: function() { var t = new kn(new Cn(-.5,-.5,-.5),new Cn(.5,.5,.5)).applyMatrix4(this.box.matrixWorld) , n = (new ni).copy(this.box.matrixWorld).invert() , i = [new Cn(t.min.x,t.min.y,0), new Cn(t.max.x,t.min.y,0), new Cn(t.max.x,t.max.y,0), new Cn(t.min.x,t.max.y,0)]; return viewer.scene.pointclouds.filter(function(e) { if (!e.bound.intersectsBox(t)) return !1; e = e.getUnrotBoundPoint("all"); if (1 < Up.getPolygonsMixedRings([e.slice(0, 4), i], !0).length) return !1; e = Potree.Utils.isInsideBox(e, n); return e || console.log("没能经过isInsideBox测试"), e }) } } , A1 = function() { y(t, hn); var e = w(t); function t() { return O(this, t), e.call(this) } return h(t, [{ key: "splitStart", value: function(i) { var r = this , a = [] , o = [viewer.mainViewport]; viewer.mapViewer && o.push(viewer.mapViewer.viewports[0]); for (var e = i.length, t = 0; t < e; t++) !function(e) { var t = i[e] , n = void 0 , e = o.find(function(e) { return e.name == (t.name2 || t.name) }); e && ((n = e).left = t.left, n.bottom = t.bottom, n.width = t.width, n.height = t.height), n || (e = new ng, t.limitBound && (e.limitBound = t.limitBound), t.direction && (e.direction = t.direction), n = new Ig(e,r.getOrthoCamera(),t), t.viewContainsPoints && (n.viewContainsPoints = t.viewContainsPoints)), "OrthographicCamera" == n.camera.type && (n.targetPlane = new ki, n.shiftTarget = new Cn), n.fitMargin = t.margin, a.push(n) }(t); return viewer.viewports = a, viewer.updateScreenSize({ forceUpdateSize: !0 }), a.forEach(function(e) { "MainView" != e.name && r.viewportFitBound(e, viewer.bound.boundingBox, viewer.bound.center, 0, e.fitMargin) }), a } }, { key: "unSplit", value: function() { this.unfocusViewport(), viewer.viewports = [viewer.mainViewport], viewer.mainViewport.width = 1, viewer.mainViewport.height = 1, viewer.mainViewport.left = 0, viewer.mainViewport.bottom = 0, viewer.updateScreenSize({ forceUpdateSize: !0 }) } }, { key: "viewportFitBound", value: function(e, t, n) { var i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0 , r = 4 < arguments.length ? arguments[4] : void 0 , a = e.view , o = { bound: t } , s = this.getViewBound(e) , t = s.boundSize , s = s.boundCenter; e.targetPlane.setFromNormalAndCoplanarPoint(a.direction.clone(), s), e.targetPlane.projectPoint(n, e.shiftTarget), o.endPosition = this.getPosOutOfModel(e, t), o.margin = r || { x: 30, y: 30 }, a.moveOrthoCamera(e, o, i) } }, { key: "getViewBound", value: function(e) { var t, n = viewer.bound, i = n.boundSize, n = n.center; return e.viewContainsPoints && (t = viewer.bound.boundingBox.clone(), e.viewContainsPoints.forEach(function(e) { t.expandByPoint(e) }), i = t.getSize(new Cn), n = t.getCenter(new Cn)), { boundSize: i, boundCenter: n } } }, { key: "getPosOutOfModel", value: function(e, t) { t = (t = t || this.getViewBound(e).boundSize).length(); return e.shiftTarget.clone().sub(e.view.direction.clone().multiplyScalar(t + 10)) } }, { key: "updateCameraOutOfModel", value: function() { var r = this; viewer.viewports.forEach(function(e, t) { var n, i; e != viewer.mainViewport && (i = (n = r.getViewBound(e)).boundSize, n = n.boundCenter, e.targetPlane.setFromNormalAndCoplanarPoint(e.view.direction.clone(), n), e.targetPlane.projectPoint(e.view.position, e.shiftTarget), i = r.getPosOutOfModel(e, i), e.view.position.copy(i)) }) } }, { key: "rotateSideCamera", value: function(e, t) { var n = this.getViewBound(e) , i = n.boundSize , r = n.boundCenter , n = this.focusCenter || r; e.targetPlane.setFromNormalAndCoplanarPoint(e.view.direction, n), e.targetPlane.projectPoint(e.view.position, e.shiftTarget); r = (new Cn).subVectors(n, e.shiftTarget), t = (new ni).makeRotationAxis(new Cn(0,0,1), t); e.view.direction = e.view.direction.applyMatrix4(t), r.applyMatrix4(t), e.shiftTarget.subVectors(n, r), e.view.position = this.getPosOutOfModel(e, i) } }, { key: "getOrthoCamera", value: function() { return new ed(-100,100,100,100,.01,1e4) } }, { key: "focusOnViewport", value: function(n) { var i = this; viewer.viewports.forEach(function(e, t) { e.name == n ? (i.focusInfo = { name: n, left: e.left, bottom: e.bottom, height: e.height, width: e.width }, e.left = 0, e.bottom = 0, e.height = 1, e.width = 1) : e.active = !1 }), viewer.updateScreenSize({ forceUpdateSize: !0 }) } }, { key: "unfocusViewport", value: function() { var n = this; this.focusInfo && (viewer.viewports.forEach(function(e, t) { n.focusInfo.name == e.name && (e.left = n.focusInfo.left, e.bottom = n.focusInfo.bottom, e.height = n.focusInfo.height, e.width = n.focusInfo.width), e.active = !0 }), viewer.updateScreenSize({ forceUpdateSize: !0 }), this.focusInfo = null) } }]), t }() , T1 = [{ left: .5, bottom: .5, width: .5, height: .5, name: "MainView", active: !0 }, { left: 0, bottom: .5, width: .5, height: .5, name: "top", name2: "mapViewport", axis: ["x", "y"], direction: new Cn(0,0,-1), active: !0 }, { left: .5, bottom: 0, width: .5, height: .5, name: "right", axis: ["y", "z"], direction: new Cn(1,0,0), active: !0 }, { left: 0, bottom: 0, width: .5, height: .5, name: "back", axis: ["x", "z"], direction: new Cn(0,-1,0), active: !0 }] , S1 = new A1; S1.split = function() { viewer.scene.getActiveCamera(); var e = viewer.bound; e.boundSize, e.center; viewer.setLimitFar(!1), viewer.mapViewer.attachToMainViewer(!0, "split4Screens", "dontSet"); e = this.splitStart(T1); viewer.mapViewer.viewports[0].noPointcloud = !1, this.statesBefore = { pointDensity: Potree.settings.pointDensity, displayMode: Potree.settings.displayMode, position: viewer.images360.position, target: viewer.scene.view.getPivot() }, viewer.setPointStandardMat(!0, null, !0); var n = { opacity: new Map }; new Map; viewer.scene.pointclouds.forEach(function(e) { n.opacity.set(e, e.temp.pointOpacity), n.colorType = e.material.activeAttributeName }); function t() { var t = this; viewer.scene.pointclouds.forEach(function(e) { "MainView" == t.name ? (e.material.activeAttributeName = n.colorType, e.material.useFilterByNormal = !1, e.changePointOpacity(n.opacity.get(e)), Potree.settings.pointDensity = "fourViewportsMain") : (e.material.activeAttributeName = "color", e.material.useFilterByNormal = !0, Potree.settings.pointDensity = "fourViewports", e.changePointOpacity(.6)) }) } e.forEach(function(e) { e.beforeRender = t }), this.enableMap(!1), this.enableFloorplan(!1), viewer.mapViewer.setViewLimit("expand"), Potree.settings.displayMode = "showPointCloud" } , S1.recover = function() { this.unSplit(), viewer.setView({ position: this.statesBefore.position, target: this.statesBefore.target, duration: 300, callback: function() {} }), viewer.mainViewport.beforeRender = null, viewer.setLimitFar(!0); var e = viewer.mapViewer.viewports[0]; viewer.mapViewer.attachToMainViewer(!1), e.noPointcloud = !0, this.enableMap(Potree.settings.mapEnable), this.enableFloorplan(Potree.settings.floorplanEnable), this.floorplanListener && (viewer.mapViewer.mapLayer.removeEventListener("floorplanLoaded", this.floorplanListener), this.floorplanListener = null), Potree.settings.pointDensity = this.statesBefore.pointDensity, Potree.settings.isOfficial || (Potree.settings.displayMode = this.statesBefore.displayMode), viewer.scene.pointclouds.forEach(function(e) { e.material.useFilterByNormal = !1 }), viewer.setPointStandardMat(!1), viewer.mapViewer.setViewLimit("standard") } , S1.updateMapViewerBG = function() { var e = viewer.mapViewer.viewports[0]; this.floorplanEnabled || this.mapEnabled ? (e.background = "overlayColor", e.backgroundColor = new Yi(0,0,0), e.backgroundOpacity = .5) : (e.background = null, e.backgroundColor = null, e.backgroundOpacity = null) } , S1.setFloorplanDisplay = function(e) { e.floorplan.setEnable(1 < arguments.length && void 0 !== arguments[1] && arguments[1]) } , S1.enableMap = function(e) { viewer.mapViewer.mapLayer.maps.find(function(e) { return "map" == e.name }).setEnable(!!e), this.mapEnabled = e, this.updateMapViewerBG() } , S1.enableFloorplan = function(t) { var n = this , e = viewer.mapViewer.mapLayer.maps.filter(function(e) { return e.name.includes("floorplan") }); this.floorplanListener && viewer.mapViewer.mapLayer.removeEventListener("floorplanLoaded", this.floorplanListener), this.floorplanListener = function(e) { n.setFloorplanDisplay(e, t) } , viewer.mapViewer.mapLayer.addEventListener("floorplanLoaded", this.floorplanListener), t ? e.forEach(function(e) { return n.setFloorplanDisplay({ floorplan: e }, !0) }) : e.forEach(function(e) { return n.setFloorplanDisplay({ floorplan: e }, !1) }), t && 0 == e.length && Potree.loadMapEntity("all", !0), this.floorplanEnabled = t, this.updateMapViewerBG() } , S1.focusOnPointCloud = function(e) { e.bound.getSize(new Cn); var t = e.bound.getCenter(new Cn) , n = e.panosBound && e.panosBound.center; this.focusOnObject(e.bound, t, n), viewer.flyToDataset({ pointcloud: e, dontMoveMap: !0, duration: 0 }) } , S1.focusOnObject = function(t, n, e) { var i = this; viewer.viewports.forEach(function(e) { "MainView" == e.name || i.viewportFitBound(e, t, n) }) } ; var Ou = function() { y(i, hn); var n = w(i); function i(e) { var t; return O(this, i), (t = n.call(this)).list = [], t.callback = e.callback, t } return h(i, [{ key: "undo", value: function() { var e = this.list.pop(); e && this.callback && this.callback(e) } }, { key: "redo", value: function() {} }, { key: "writeIn", value: function(e) { this.list.push(e) } }, { key: "clear", value: function() { this.list.length = 0 } }]), i }() , C1 = { SplitScreen: S1, handleState: null, bus: new hn, prepareRecord: !0, writeToHistory: function(e) { this.prepareRecord && (this.prepareRecord = !1, this.history.writeIn(e)) }, applyTemp: function(t) { var e = viewer.scene.pointclouds.find(function(e) { return e.dataset_id + e.name == t.sid }); e.orientationUser = t.orientationUser, e.translateUser = t.translateUser, this.setMatrix(e) }, getTemp: function(e) { return (e = e || viewer.scene.pointclouds).map(function(e) { return { sid: e.dataset_id + e.name, orientationUser: e.orientationUser, translateUser: e.translateUser.clone() } }) }, init: function() { var a, o = this; viewer.fpControls.addEventListener("transformPointcloud", function(t) { if (t.pointclouds[0].dataset_id == Potree.settings.originDatasetId) return o.bus.dispatchEvent("forbitMoveOriginDataset"); if (o.writeToHistory(o.getTemp(t.pointclouds)), "translate" == o.handleState) t.pointclouds.forEach(function(e) { return C1.translate(e, t.moveVec) }); else if ("rotate" == o.handleState) if ("pano" == Potree.settings.editType) { var n, i = t.intersectStart; if (!t.intersect.equals(i)) { if (!a) return a = { orientationUser: t.pointclouds[0].orientationUser, pointclouds: t.pointclouds }, void o.bus.dispatchEvent({ type: "rotateStart", startPoint: i }); a.vecStart ? (r = (new Cn).subVectors(t.intersect, i).setZ(0), r = Up.getAngle(a.vecStart, r, "z"), n = a.orientationUser + r - a.pointclouds[0].orientationUser, a.pointclouds.forEach(function(e) { C1.rotateAround(i, e, null, n) })) : 30 < (e = (new Cn).subVectors(t.intersect, i).setZ(0)).length() * t.camera.zoom && (a.vecStart = e), o.bus.dispatchEvent({ type: "rotate", endPoint: t.intersect }) } } else { var e, r = t.pointclouds[0].translateUser; t.intersect.equals(r) || (a ? (e = (new Cn).subVectors(t.intersect, r).setZ(0), e = Up.getAngle(a.vecStart, e, "z"), e = a.orientationUser + e - a.pointcloud.orientationUser, C1.rotate(a.pointcloud, null, e)) : a = { orientationUser: t.pointclouds[0].orientationUser, vecStart: (new Cn).subVectors(t.intersectStart, r).setZ(0), pointcloud: t.pointclouds[0] }) } }), viewer.fpControls.addEventListener("end", function(e) { a = null, o.prepareRecord = !0 }), viewer.inputHandler.addEventListener("keydown", function(e) { 90 == e.keyCode && e.event.ctrlKey && o.history.undo() }); function e(e) { var t; !e.drag && o.editing && (t = C1.handleState, e.hoverViewport.alignment && t && e.hoverViewport.alignment[t] ? "translate" == t ? e.intersect && e.intersect.location ? viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "movePointcloud" }) : viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "movePointcloud" }) : "rotate" == t && (e.intersect && e.intersect.location ? viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "rotatePointcloud" }) : viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "rotatePointcloud" })) : (viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "movePointcloud" }), viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "rotatePointcloud" }))) } viewer.addEventListener("global_mousemove", e), viewer.addEventListener("global_drop", e), viewer.addEventListener("updateModelBound", function(e) { o.editing && o.SplitScreen.updateCameraOutOfModel() }) }, setMatrix: function(e) { var t = e.position , n = e.translateUser , i = e.orientationUser , t = (new ni).setPosition(t) , i = (new ni).makeRotationAxis(new Cn(0,0,1), i) , n = (new ni).setPosition(n) , n = (new ni).multiplyMatrices(n, i); e.transformMatrix = n.clone(), e.transformInvMatrix.copy(n).invert(), e.rotateMatrix = i, e.rotateInvMatrix.copy(i).invert(), e.panos.forEach(function(e) { return e.transformByPointcloud() }), n = (new ni).multiplyMatrices(n, t), e.matrix = n, e.updateMatrixWorld(!0), this.editing && C1.changeCallBack && C1.changeCallBack(), e.spriteNodeRoot && e.spriteNodeRoot.matrixWorld.copy(e.matrixWorld), viewer.updateModelBound(), e.getPanosBound() }, rotateAround: function(e, t, n, i) { var i = null != i ? i : gn.degToRad(n) , r = (new Cn).subVectors(t.translateUser, e) , e = (new ni).makeRotationAxis(new Cn(0,0,1), i) , e = r.clone().applyMatrix4(e) , r = (new Cn).subVectors(e, r); this.rotate(t, n, i), this.translate(t, r) }, rotate: function(e, t, n) { n = null != n ? n : gn.degToRad(t); e.orientationUser += n, C1.setMatrix(e) }, translate: function(e, t) { e.translateUser.add(t), C1.setMatrix(e) }, enter: function() { this.originData = this.getTemp(), this.SplitScreen.split({ alignment: !0 }), viewer.images360.panos.forEach(function(e) { viewer.updateVisible(e.mapMarker, "split4Screens", !1) }), viewer.viewports.find(function(e) { return "mapViewport" == e.name }).alignment = { rotate: !0, translate: !0 }, viewer.viewports.find(function(e) { return "right" == e.name }).alignment = { translate: !0 }, viewer.viewports.find(function(e) { return "back" == e.name }).alignment = { translate: !0 }, this.editing = !0, viewer.updateFpVisiDatasets() }, leave: function() { var t = this; this.switchHandle(null), this.originData.forEach(function(e) { t.applyTemp(e) }), this.SplitScreen.recover(), viewer.images360.panos.forEach(function(e) { viewer.updateVisible(e.mapMarker, "split4Screens", !0) }), this.editing = !1, this.history.clear(), viewer.updateFpVisiDatasets(), viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "movePointcloud" }), viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "rotatePointcloud" }) }, switchHandle: function(e) { this.handleState = e, viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "movePointcloud" }), viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "rotatePointcloud" }), this.bus.dispatchEvent({ type: "switchHandle", state: e }) }, save: function() { function e() { t.originData = t.getTemp(), viewer.scene.measurements.forEach(function(e) { return e.transformByPointcloud() }), viewer.images360.updateCube(viewer.bound) } var t = this , n = viewer.scene.pointclouds.map(function(e) { var t = viewer.transform.lonlatToLocal.inverse(e.translateUser.clone()); return { id: e.dataset_id, orientation: e.orientationUser, location: [t.x, t.y, t.z] } }); return Potree.settings.isOfficial || e(), { data: n, callback: e } } }; C1.history = new Ou({ callback: function(e) { e.forEach(function(e) { C1.applyTemp(e) }) } }); function P1(e) { var t; return R1 || ((t = F1.load(Potree.resourcePath + "/textures/gridmap.png")).wrapS = t.wrapT = ke, R1 = { dataset: new Hu({ color: 812922, side: Y, opacity: .2, transparent: !0, depthTest: !1, wireframe: !0 }), building: new Hu({ color: 812922, metalness: .2, roughness: .8, side: Y, opacity: .1, transparent: !0, depthTest: !0 }), buildingSelect: new Hu({ color: 36582, metalness: 0, roughness: 1, side: Y, opacity: .1, transparent: !0, depthTest: !0 }), floor: new Hu({ color: 11708469, metalness: .1, roughness: 1, side: Y, opacity: .05, transparent: !0, depthTest: !0 }), floorSelect: new Wp({ map: t, color: 16707151, side: Y, opacity: 1, transparent: !0, useDepth: !0, clipDistance: 1, occlusionDistance: 1, maxClipFactor: .4, backColor: "#efe" }), room: new Hu({ color: "#ff44ee", metalness: 0, roughness: 1, side: Y, opacity: .08, transparent: !0, depthTest: !1 }), roomSelect: new Wp({ map: t, color: "#ff44ee", side: Y, opacity: 1, transparent: !0, useDepth: !0, clipDistance: 1, occlusionDistance: .5, maxClipFactor: .6, backColor: "#ff88dd" }) }), R1[e] } function D1(e, t, s) { var n = this; void 0 === t && (console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'), t = document), Si.call(this), this.visible = !1, this.domElement = t; var i = new k1(s); this.add(i); var l = new B1; this.add(l); var r = this; this.options = s, G("camera", e), G("object", void 0), G("enabled", !0), G("axis", null), G("mode", "translate"), G("translationSnap", null), G("rotationSnap", null), G("scaleSnap", null), G("space", "world"), G("size", 1), G("dragging", !1), G("showX", !0), G("showY", !0), G("showZ", !0); var u = { type: "change" } , a = { type: "mouseDown" } , o = { type: "mouseUp", mode: r.mode } , c = { type: "objectChange" } , d = new sh , h = new Cn , p = new Cn , f = new Sn , m = { X: new Cn(1,0,0), Y: new Cn(0,1,0), Z: new Cn(0,0,1) } , v = new Cn , g = new Cn , y = new Cn , w = new Cn , b = new Cn , x = new Cn , E = 0 , _ = new Cn , M = new Sn , A = new Cn , T = new Cn , S = new Sn , C = new Sn , P = new Cn , D = new Cn , k = new Sn , B = new Cn , L = new Cn , R = new Sn , F = new Sn , I = new Cn , O = new Cn , z = new Cn , N = new Sn , U = new Cn; function G(t, e) { var n = e; Object.defineProperty(r, t, { get: function() { return void 0 !== n ? n : e }, set: function(e) { n !== e && (n = e, l[t] = e, i[t] = e, r.dispatchEvent({ type: t + "-changed", value: e }), r.dispatchEvent(u)) } }), r[t] = e, l[t] = e, i[t] = e } function H(e) { r.enabled && r.pointerHover() } function V(e) { r.enabled && (r.pointerHover(), r.pointerDown()) } function j(e) { r.enabled && this.dragging && r.pointerMove() } function W(e) { r.enabled && r.pointerUp() } G("worldPosition", L), G("worldPositionStart", D), G("worldQuaternion", R), G("worldQuaternionStart", k), G("cameraPosition", _), G("cameraQuaternion", M), G("pointStart", v), G("pointEnd", g), G("rotationAxis", w), G("rotationAngle", E), G("eye", O), t.addEventListener("mousedown", V, !1), t.addEventListener("touchstart", V, !1), t.addEventListener("mousemove", H, !1), t.addEventListener("touchmove", H, !1), t.addEventListener("touchmove", j, !1), document.addEventListener("mouseup", W, !1), t.addEventListener("touchend", W, !1), t.addEventListener("touchcancel", W, !1), t.addEventListener("touchleave", W, !1), viewer.addEventListener("global_drag", function(e) { if (n.dragging) return n.pointerMove(), { stopContinue: !0 } }, 10), this.dispose = function() { t.removeEventListener("mousedown", V), t.removeEventListener("touchstart", V), t.removeEventListener("mousemove", H), t.removeEventListener("mousemove", j), t.removeEventListener("touchmove", H), t.removeEventListener("touchmove", j), document.removeEventListener("mouseup", W), t.removeEventListener("touchend", W), t.removeEventListener("touchcancel", W), t.removeEventListener("touchleave", W), this.traverse(function(e) { e.geometry && e.geometry.dispose(), e.material && e.material.dispose() }) } , this.attach = function(e) { return this.object = e, this.visible = !0, this } , this.detach = function() { return this.object = void 0, this.visible = !1, this.axis = null, this } , this.updateMatrixWorld = function() { void 0 !== this.object && (this.object.updateMatrixWorld(), this.object.parent.matrixWorld.decompose(T, S, P), this.object.matrixWorld.decompose(L, R, I), this.object.boundingBox && this.object.boundingBox.getCenter(L).applyMatrix4(this.object.matrixWorld), C.copy(S).invert(), F.copy(R).invert()), this.camera.updateMatrixWorld(), this.camera.matrixWorld.decompose(_, M, A), O.copy(_).sub(L).normalize(), Si.prototype.updateMatrixWorld.call(this) } , this.pointerHover = function() { var e, t; viewer.inputHandler.pointer; void 0 !== this.object && (this.dragging || (e = (t = viewer.inputHandler.getMouseDirection()).origin, t = t.direction, d.set(e, t), t = d.intersectObjects(i.picker[this.mode].children, !0)[0] || !1, this.axis = t ? t.object.name : null)) } , this.pointerDown = function() { var e, t; viewer.inputHandler.pointer; void 0 !== this.object && !0 !== this.dragging && null !== this.axis && (e = (t = viewer.inputHandler.getMouseDirection()).origin, t = t.direction, d.set(e, t), (e = d.intersectObjects([l], !0)[0] || !1) && (t = this.space, "scale" === this.mode ? t = "local" : "E" !== this.axis && "XYZE" !== this.axis && "XYZ" !== this.axis || (t = "world"), "local" === t && "rotate" === this.mode && (t = this.rotationSnap, "X" === this.axis && t && (this.object.rotation.x = Math.round(this.object.rotation.x / t) * t), "Y" === this.axis && t && (this.object.rotation.y = Math.round(this.object.rotation.y / t) * t), "Z" === this.axis && t && (this.object.rotation.z = Math.round(this.object.rotation.z / t) * t)), this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), z.copy(this.object.position), N.copy(this.object.quaternion), U.copy(this.object.scale), this.object.matrixWorld.decompose(D, k, B), this.object.boundingBox && this.object.boundingBox.getCenter(D).applyMatrix4(this.object.matrixWorld), v.copy(e.point).sub(D)), this.dragging = !0, a.mode = this.mode, this.dispatchEvent(a)) } , this.pointerMove = function() { var e, t, n = viewer.inputHandler.pointer, i = this.axis, r = this.mode, a = this.object, o = this.space; "scale" === r ? o = "local" : "E" !== i && "XYZE" !== i && "XYZ" !== i || (o = "world"), void 0 === a || null === i || !1 === this.dragging || void 0 !== n.button && 0 !== n.button || (n = (e = viewer.inputHandler.getMouseDirection()).origin, e = e.direction, d.set(n, e), !1 !== (e = d.intersectObjects([l], !0)[0] || !1) && (g.copy(e.point).sub(D), "translate" === r ? (y.copy(g).sub(v), "local" === o && "XYZ" !== i && y.applyQuaternion(F), -1 === i.indexOf("X") && (y.x = 0), -1 === i.indexOf("Y") && (y.y = 0), -1 === i.indexOf("Z") && (y.z = 0), ("local" === o && "XYZ" !== i ? y.applyQuaternion(N) : y.applyQuaternion(C)).divide(P), a.position.copy(y).add(z), this.translationSnap && ("local" === o && (a.position.applyQuaternion(f.copy(N).invert()), -1 !== i.search("X") && (a.position.x = Math.round(a.position.x / this.translationSnap) * this.translationSnap), -1 !== i.search("Y") && (a.position.y = Math.round(a.position.y / this.translationSnap) * this.translationSnap), -1 !== i.search("Z") && (a.position.z = Math.round(a.position.z / this.translationSnap) * this.translationSnap), a.position.applyQuaternion(N)), "world" === o && (a.parent && a.position.add(h.setFromMatrixPosition(a.parent.matrixWorld)), -1 !== i.search("X") && (a.position.x = Math.round(a.position.x / this.translationSnap) * this.translationSnap), -1 !== i.search("Y") && (a.position.y = Math.round(a.position.y / this.translationSnap) * this.translationSnap), -1 !== i.search("Z") && (a.position.z = Math.round(a.position.z / this.translationSnap) * this.translationSnap), a.parent && a.position.sub(h.setFromMatrixPosition(a.parent.matrixWorld)))), a.dispatchEvent({ type: "position_changed" })) : "scale" === r ? (-1 !== i.search("XYZ") ? (t = g.length() / v.length(), g.dot(v) < 0 && (t *= -1), s.NoScaleZ ? p.set(t, t, 1) : p.set(t, t, t)) : -1 !== i.search("XY") ? (t = g.length() / v.length(), g.dot(v) < 0 && (t *= -1), p.set(t, t, 1)) : (h.copy(v), p.copy(g), h.applyQuaternion(F), p.applyQuaternion(F), p.divide(h), -1 === i.search("X") && (p.x = 1), -1 === i.search("Y") && (p.y = 1), -1 === i.search("Z") && (p.z = 1)), a.scale.copy(U).multiply(p), this.scaleSnap && (-1 !== i.search("X") && (a.scale.x = Math.round(a.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), -1 !== i.search("Y") && (a.scale.y = Math.round(a.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), -1 !== i.search("Z") && (a.scale.z = Math.round(a.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap)), a.dispatchEvent({ type: "scale_changed" })) : "rotate" === r && (y.copy(g).sub(v), r = 2 / L.distanceTo(h.setFromMatrixPosition(this.camera.matrixWorld)), "E" === i ? (w.copy(O), E = g.angleTo(v), b.copy(v).normalize(), x.copy(g).normalize(), E *= x.cross(b).dot(O) < 0 ? 1 : -1) : "XYZE" === i ? (w.copy(y).cross(O).normalize(), E = y.dot(h.copy(w).cross(this.eye)) * r) : "X" !== i && "Y" !== i && "Z" !== i || (w.copy(m[i]), h.copy(m[i]), "local" === o && h.applyQuaternion(R), E = y.dot(h.cross(O).normalize()) * r), this.rotationSnap && (E = Math.round(E / this.rotationSnap) * this.rotationSnap), this.rotationAngle = E, "local" === o && "E" !== i && "XYZE" !== i ? (a.quaternion.copy(N), a.quaternion.multiply(f.setFromAxisAngle(w, E)).normalize()) : (w.applyQuaternion(C), a.quaternion.copy(f.setFromAxisAngle(w, E)), a.quaternion.multiply(N).normalize()), a.dispatchEvent({ type: "rotation_changed" })), this.dispatchEvent(u), this.dispatchEvent(c))) } , this.pointerUp = function(e) { this.dragging && null !== this.axis && (o.mode = this.mode, this.dispatchEvent(o)), this.dragging = !1 } , this.onPointerDown = V, this.onPointerMove = j, this.onPointerUp = W, this.getMode = function() { return r.mode } , this.setMode = function(e) { r.mode = e } , this.setTranslationSnap = function(e) { r.translationSnap = e } , this.setRotationSnap = function(e) { r.rotationSnap = e } , this.setScaleSnap = function(e) { r.scaleSnap = e } , this.setSize = function(e) { r.size = e } , this.setSpace = function(e) { r.space = e } , this.update = function() { console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.") } } function k1(s) { Si.call(this); var e = new $i({ depthTest: !(this.type = "TransformControlsGizmo"), depthWrite: !1, transparent: !0, side: Y, fog: !1 }) , t = new tl({ depthTest: !1, depthWrite: !1, transparent: !0, fog: !1 }); (x = e.clone()).opacity = .15, (E = e.clone()).opacity = .33; var n = e.clone(); n.color.set(16711680); var i = e.clone(); i.color.set(65280); var r = e.clone(); r.color.set(255), (b = e.clone()).opacity = .35, b.color.set(53501); var a = b.clone(); a.color.set(16776960), (f = b.clone()).color.set(65535), (g = b.clone()).color.set(16711935), e.clone().color.set(16776960); var o = t.clone(); o.color.set(16711680); var l = t.clone(); l.color.set(65280); var u = t.clone(); u.color.set(255), (m = t.clone()).color.set(65535), (v = t.clone()).color.set(16711935); var c = t.clone(); c.color.set(16776960), (w = t.clone()).color.set(7895160), (y = c.clone()).opacity = .25; var d = new kl(0,.05,.2,12,1,!1) , e = new Wr(.125,.125,.125); function h(e, t) { for (var n = new Mr, i = [], r = 0; r <= 64 * t; ++r) i.push(0, Math.cos(r / 32 * Math.PI) * e, Math.sin(r / 32 * Math.PI) * e); return n.setAttribute("position", new nr(new Float32Array(i),3)), n } function p(e) { var t, n = new Si; for (t in e) for (var i = e[t].length; i--; ) { var r = e[t][i][0].clone() , a = e[t][i][1] , o = e[t][i][2] , s = e[t][i][3] , l = e[t][i][4]; r.name = t, r.tag = l, a && r.position.set(a[0], a[1], a[2]), o && r.rotation.set(o[0], o[1], o[2]), s && r.scale.set(s[0], s[1], s[2]), r.updateMatrix(); s = r.geometry.clone(); s.applyMatrix4(r.matrix), r.geometry = s, r.renderOrder = 1 / 0, r.position.set(0, 0, 0), r.rotation.set(0, 0, 0), r.scale.set(1, 1, 1), n.add(r) } return n } (t = new Mr).setAttribute("position", new nr(new Float32Array([0, 0, 0, 1, 0, 0]),3)); var f = { X: [[new Hr(d,n), [1, 0, 0], [0, 0, -Math.PI / 2], null, "fwd"], [new sl(t,o)]], Y: [[new Hr(d,i), [0, 1, 0], null, null, "fwd"], [new sl(t,l), null, [0, 0, Math.PI / 2]]], Z: [[new Hr(d,r), [0, 0, 1], [Math.PI / 2, 0, 0], null, "fwd"], [new sl(t,u), null, [0, -Math.PI / 2, 0]]], XY: [[new Hr(new ua(.295,.295),a.clone()), [.15, .15, 0]], [new sl(t,c), [.18, .3, 0], null, [.125, 1, 1]], [new sl(t,c), [.3, .18, 0], [0, 0, Math.PI / 2], [.125, 1, 1]]], YZ: [[new Hr(new ua(.295,.295),f.clone()), [0, .15, .15], [0, Math.PI / 2, 0]], [new sl(t,m), [0, .18, .3], [0, 0, Math.PI / 2], [.125, 1, 1]], [new sl(t,m), [0, .3, .18], [0, -Math.PI / 2, 0], [.125, 1, 1]]], XZ: [[new Hr(new ua(.295,.295),g.clone()), [.15, 0, .15], [-Math.PI / 2, 0, 0]], [new sl(t,v), [.18, 0, .3], null, [.125, 1, 1]], [new sl(t,v), [.3, 0, .18], [0, -Math.PI / 2, 0], [.125, 1, 1]]] } , m = { X: [[new Hr(new kl(.2,0,1,4,1,!1),x), [.6, 0, 0], [0, 0, -Math.PI / 2]]], Y: [[new Hr(new kl(.2,0,1,4,1,!1),x), [0, .6, 0]]], Z: [[new Hr(new kl(.2,0,1,4,1,!1),x), [0, 0, .6], [Math.PI / 2, 0, 0]]], XY: [[new Hr(new ua(.4,.4),x), [.2, .2, 0]]], YZ: [[new Hr(new ua(.4,.4),x), [0, .2, .2], [0, Math.PI / 2, 0]]], XZ: [[new Hr(new ua(.4,.4),x), [.2, 0, .2], [-Math.PI / 2, 0, 0]]] } , v = { START: [[new Hr(new vu(.01,2),E), null, null, null, "helper"]], END: [[new Hr(new vu(.01,2),E), null, null, null, "helper"]], DELTA: [[new sl(((g = new Mr).setAttribute("position", new nr(new Float32Array([0, 0, 0, 1, 1, 1]),3)), g),E), null, null, null, "helper"]], X: [[new sl(t,E.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]], Y: [[new sl(t,E.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]], Z: [[new sl(t,E.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]] } , g = { X: [[new sl(h(1, .5),o)], [new Hr(new vu(.04,0),n), [0, 0, .99], null, [1, 3, 1]]], Y: [[new sl(h(1, .5),l), null, [0, 0, -Math.PI / 2]], [new Hr(new vu(.04,0),i), [0, 0, .99], null, [3, 1, 1]]], Z: [[new sl(h(1, .5),u), null, [0, Math.PI / 2, 0]], [new Hr(new vu(.04,0),r), [.99, 0, 0], null, [1, 3, 1]]], E: [[new sl(h(1.25, 1),y), null, [0, Math.PI / 2, 0]], [new Hr(new kl(.03,0,.15,4,1,!1),y), [1.17, 0, 0], [0, 0, -Math.PI / 2], [1, 1, .001]], [new Hr(new kl(.03,0,.15,4,1,!1),y), [-1.17, 0, 0], [0, 0, Math.PI / 2], [1, 1, .001]], [new Hr(new kl(.03,0,.15,4,1,!1),y), [0, -1.17, 0], [Math.PI, 0, 0], [1, 1, .001]], [new Hr(new kl(.03,0,.15,4,1,!1),y), [0, 1.17, 0], [0, 0, 0], [1, 1, .001]]], XYZE: [[new sl(h(1, 1),w), null, [0, Math.PI / 2, 0]]] } , y = { AXIS: [[new sl(t,E.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]] } , w = { X: [[new Hr(new Bu(1,.1,4,24),x), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]], Y: [[new Hr(new Bu(1,.1,4,24),x), [0, 0, 0], [Math.PI / 2, 0, 0]]], Z: [[new Hr(new Bu(1,.1,4,24),x), [0, 0, 0], [0, 0, -Math.PI / 2]]], E: [[new Hr(new Bu(1.25,.1,2,24),x)]], XYZE: [[new Hr(new Tu(.7,10,8),x)]] } , b = { X: [[new Hr(e,n), [.8, 0, 0], [0, 0, -Math.PI / 2]], [new sl(t,o), null, null, [.8, 1, 1]]], Y: [[new Hr(e,i), [0, .8, 0]], [new sl(t,l), null, [0, 0, Math.PI / 2], [.8, 1, 1]]], Z: [[new Hr(e,r), [0, 0, .8], [Math.PI / 2, 0, 0]], [new sl(t,u), null, [0, -Math.PI / 2, 0], [.8, 1, 1]]], XY: [[new Hr(e,a), [.85, .85, 0], null, [2, 2, .2]], [new sl(t,c), [.855, .98, 0], null, [.125, 1, 1]], [new sl(t,c), [.98, .855, 0], [0, 0, Math.PI / 2], [.125, 1, 1]]], XYZY: [[new Hr(new Wr(.125,.125,.125),b.clone()), [0, 1.1, 0]]] } , x = { X: [[new Hr(new kl(.2,0,.8,4,1,!1),x), [.5, 0, 0], [0, 0, -Math.PI / 2]]], Y: [[new Hr(new kl(.2,0,.8,4,1,!1),x), [0, .5, 0]]], Z: [[new Hr(new kl(.2,0,.8,4,1,!1),x), [0, 0, .5], [Math.PI / 2, 0, 0]]], XY: [[new Hr(e,x), [.85, .85, 0], null, [3, 3, .2]]], XYZY: [[new Hr(new Wr(.2,.2,.2),x), [0, 1.1, 0]]] } , E = { X: [[new sl(t,E.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]], Y: [[new sl(t,E.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]], Z: [[new sl(t,E.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]] } , _ = new Cn(0,0,0) , M = new ci , A = new Cn(0,1,0) , T = new Cn(0,0,0) , S = new ni , C = new Sn , P = new Sn , D = new Sn , k = new Cn(1,0,0) , B = new Cn(0,1,0) , L = new Cn(0,0,1); this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = p(f)), this.add(this.gizmo.rotate = p(g)), this.add(this.gizmo.scale = p(b)), this.add(this.picker.translate = p(m)), this.add(this.picker.rotate = p(w)), this.add(this.picker.scale = p(x)), this.add(this.helper.translate = p(v)), this.add(this.helper.rotate = p(y)), this.add(this.helper.scale = p(E)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1, this.updateMatrixWorld = function() { var e = this.space , t = "local" === (e = "scale" === this.mode ? "local" : e) ? this.worldQuaternion : D; this.gizmo.translate.visible = "translate" === this.mode, this.gizmo.rotate.visible = "rotate" === this.mode, this.gizmo.scale.visible = "scale" === this.mode, this.helper.translate.visible = "translate" === this.mode, this.helper.rotate.visible = "rotate" === this.mode, this.helper.scale.visible = "scale" === this.mode; var n = []; n = (n = (n = n.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children); for (var i = 0; i < n.length; i++) { var r = n[i] , a = !0; r.rotation.set(0, 0, 0), r.position.copy(this.worldPosition); var o = this.worldPosition.distanceTo(this.cameraPosition); r.scale.set(1, 1, 1).multiplyScalar(o * this.size / 7), "helper" !== r.tag ? (r.quaternion.copy(t), "translate" === this.mode || "scale" === this.mode ? (s.dontHideWhenFaceCamera || ("X" !== r.name && "XYZX" !== r.name || .99 < Math.abs(A.copy(k).applyQuaternion(t).dot(this.eye)) && (r.scale.set(1e-10, 1e-10, 1e-10), a = !1), "Y" !== r.name && "XYZY" !== r.name || .99 < Math.abs(A.copy(B).applyQuaternion(t).dot(this.eye)) && (r.scale.set(1e-10, 1e-10, 1e-10), a = !1), "Z" !== r.name && "XYZZ" !== r.name || .99 < Math.abs(A.copy(L).applyQuaternion(t).dot(this.eye)) && (r.scale.set(1e-10, 1e-10, 1e-10), a = !1), "XY" === r.name && Math.abs(A.copy(L).applyQuaternion(t).dot(this.eye)) < .2 && (r.scale.set(1e-10, 1e-10, 1e-10), a = !1), "YZ" === r.name && Math.abs(A.copy(k).applyQuaternion(t).dot(this.eye)) < .2 && (r.scale.set(1e-10, 1e-10, 1e-10), a = !1), "XZ" === r.name && Math.abs(A.copy(B).applyQuaternion(t).dot(this.eye)) < .2 && (r.scale.set(1e-10, 1e-10, 1e-10), a = !1)), -1 !== r.name.search("X") && A.copy(k).applyQuaternion(t).dot(this.eye) < 0 && (r.scale.x *= -1), -1 !== r.name.search("Y") && A.copy(B).applyQuaternion(t).dot(this.eye) < 0 && (r.scale.y *= -1), -1 !== r.name.search("Z") && A.copy(L).applyQuaternion(t).dot(this.eye) < 0 && (r.scale.z *= -1)) : "rotate" === this.mode && (P.copy(t), A.copy(this.eye).applyQuaternion(C.copy(t).invert()), -1 !== r.name.search("E") && r.quaternion.setFromRotationMatrix(S.lookAt(this.eye, T, B)), "X" === r.name && (C.setFromAxisAngle(k, Math.atan2(-A.y, A.z)), C.multiplyQuaternions(P, C), r.quaternion.copy(C)), "Y" === r.name && (C.setFromAxisAngle(B, Math.atan2(A.x, A.z)), C.multiplyQuaternions(P, C), r.quaternion.copy(C)), "Z" === r.name && (C.setFromAxisAngle(L, Math.atan2(A.y, A.x)), C.multiplyQuaternions(P, C), r.quaternion.copy(C))), a = (a = (a = (a = a && (-1 === r.name.indexOf("X") || this.showX)) && (-1 === r.name.indexOf("Y") || this.showY)) && (-1 === r.name.indexOf("Z") || this.showZ)) && (-1 === r.name.indexOf("E") || this.showX && this.showY && this.showZ), viewer.updateVisible(r, "hidden", !!a), r.material._opacity = r.material._opacity || r.material.opacity, r.material._color = r.material._color || r.material.color.clone(), r.material.color.copy(r.material._color), r.material.opacity = r.material._opacity, this.enabled ? this.axis && (r.name === this.axis || this.axis.split("").some(function(e) { return r.name === e }) ? r.material.opacity = 1 : r.material.opacity *= .25, r.material.color.lerp(new Yi(1,1,1), .5)) : (r.material.opacity *= .5, r.material.color.lerp(new Yi(1,1,1), .5))) : (a = !1, "AXIS" === r.name ? (r.position.copy(this.worldPositionStart), a = !!this.axis, "X" === this.axis && (C.setFromEuler(M.set(0, 0, 0)), r.quaternion.copy(t).multiply(C), .9 < Math.abs(A.copy(k).applyQuaternion(t).dot(this.eye)) && (a = !1)), "Y" === this.axis && (C.setFromEuler(M.set(0, 0, Math.PI / 2)), r.quaternion.copy(t).multiply(C), .9 < Math.abs(A.copy(B).applyQuaternion(t).dot(this.eye)) && (a = !1)), "Z" === this.axis && (C.setFromEuler(M.set(0, Math.PI / 2, 0)), r.quaternion.copy(t).multiply(C), .9 < Math.abs(A.copy(L).applyQuaternion(t).dot(this.eye)) && (a = !1)), "XYZE" === this.axis && (C.setFromEuler(M.set(0, Math.PI / 2, 0)), A.copy(this.rotationAxis), r.quaternion.setFromRotationMatrix(S.lookAt(T, A, B)), r.quaternion.multiply(C), a = this.dragging), "E" === this.axis && (a = !1)) : "START" === r.name ? (r.position.copy(this.worldPositionStart), a = this.dragging) : "END" === r.name ? (r.position.copy(this.worldPosition), a = this.dragging) : "DELTA" === r.name ? (r.position.copy(this.worldPositionStart), r.quaternion.copy(this.worldQuaternionStart), _.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), _.applyQuaternion(this.worldQuaternionStart.clone().invert()), r.scale.copy(_), a = this.dragging) : (r.quaternion.copy(t), this.dragging ? r.position.copy(this.worldPositionStart) : r.position.copy(this.worldPosition), this.axis && (a = -1 !== this.axis.search(r.name))), viewer.updateVisible(r, "hidden", !!a)) } Si.prototype.updateMatrixWorld.call(this) } } function B1(e) { Hr.call(this, new ua(1e5,1e5,2,2), new $i({ color: "#ff0000", visible: !1, wireframe: !1, side: Y, transparent: !0, opacity: .2 })), this.type = "TransformControlsPlane"; var t = new Cn(1,0,0) , n = new Cn(0,1,0) , i = new Cn(0,0,1) , r = new Cn , a = new Cn , o = new Cn , s = new ni , l = new Sn; this.updateMatrixWorld = function() { var e = this.space; switch (this.position.copy(this.worldPosition), "scale" === this.mode && (e = "local"), t.set(1, 0, 0).applyQuaternion("local" === e ? this.worldQuaternion : l), n.set(0, 1, 0).applyQuaternion("local" === e ? this.worldQuaternion : l), i.set(0, 0, 1).applyQuaternion("local" === e ? this.worldQuaternion : l), o.copy(n), this.mode) { case "translate": case "scale": switch (this.axis) { case "X": o.copy(this.eye).cross(t), a.copy(t).cross(o); break; case "Y": o.copy(this.eye).cross(n), a.copy(n).cross(o); break; case "Z": o.copy(this.eye).cross(i), a.copy(i).cross(o); break; case "XY": a.copy(i); break; case "YZ": a.copy(t); break; case "XZ": o.copy(i), a.copy(n); break; default: a.set(0, 0, 0) } break; default: a.set(0, 0, 0) } 0 === a.length() ? this.quaternion.copy(this.cameraQuaternion) : (s.lookAt(r.set(0, 0, 0), a, o), this.quaternion.setFromRotationMatrix(s)), Si.prototype.updateMatrixWorld.call(this) } } var L1, R1, F1 = new _c, I1 = { width2d: 35 }, O1 = new Yi("#FFF"), z1 = function() { y(a, Df); var t = w(a); function a(e) { var n; return O(this, a), e.dimension = "3d", (n = t.call(this, "siteModel_" + e.buildType, e)).midMarkers = [], n.buildChildren = [], n.holes = [], n.parentHoles = [], n.mats = {}, n.panos = n.panos || [], n.center, "floor" == n.buildType && (n.points = e.points = n.buildParent.points, n.buildParent.holes.forEach(function(e) { var t = new a({ buildType: "hole", buildParent: g(n), originHole: e, ifDraw: n.ifDraw || Potree.settings.drawEntityData }); n.parentHoles.push(t), n.add(t), t.points = e.points })), "room" != n.buildType && "hole" != n.buildType || (n.restrictArea = n.buildParent), n.ifDraw && ("hole" != n.buildType && (n.box = n.createBox(), n.add(n.box)), n.lineMesh = Sf.createLine([], { color: O1 }), n.lineMesh.name = "buildingLines", n.lineMesh.visible = !1, n.add(n.lineMesh), viewer.setObjectLayers(n.lineMesh, "bothMapAndScene"), n.addEventListener("dragChange", function(e) { n.updateTwoMidMarker(e.index) })), n.initData(e), n } return h(a, [{ key: "initData", value: function(e) { e.ifDraw ? b(v(a.prototype), "initData", this).call(this, e) : e.points && (this.points = e.points) } }, { key: "intersectPointcloudVolume", value: function(e) { var t = this.getBound() , n = e.bound; if (!t.intersectsBox(n)) return 0; var i = this.getRealZ() , r = i.zMin , a = i.zMax , o = Math.min(r, n.min.z) , t = Math.max(a, n.max.z) , i = a - r + (n.max.z - n.min.z) - (t - o) , a = e.getUnrotBoundPoint() , s = 0 , r = this.getArea() , n = Math.abs(Up.getArea(a)); Up.getPolygonsMixedRings([this.points, a]).forEach(function(e) { s += e.area }); var t = 0 , o = this.holes.concat(this.parentHoles) , e = 0 , l = 0; return 0 < o.length && (e = this.getHolesArea(), a = [].concat([a]), Up.getPolygonsMixedRings(a).forEach(function(e) { l += e.area }), t = e + n - l), (r + n - s - t) * i } }, { key: "addHole", value: function() { var n = this , i = new a({ buildType: "hole", zMin: this.zMin, zMax: this.zMax, points: 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], buildParent: this, ifDraw: this.ifDraw || Potree.settings.drawEntityData }); return this.holes.push(i), "building" == this.buildType && this.buildChildren.forEach(function(e) { var t = new a({ buildType: "hole", zMin: n.zMin, zMax: n.zMax, buildParent: e, originHole: i, ifDraw: n.ifDraw || Potree.settings.drawEntityData }); e.parentHoles.push(t), e.add(t), t.points = i.points }), this.add(i), this.update(), i } }, { key: "removeHole", value: function(e) { var i = this; e.dispose(), "building" == this.buildType && this.buildChildren.forEach(function(e) { var t = e.parentHoles.find(function(e) { return e.originHole == i }) , n = e.parentHoles.indexOf(t); -1 < n && e.parentHoles.splice(n, 1), t.dispose() }); var t = this.holes.indexOf(e); -1 < t && this.holes.splice(t, 1), this.remove(e), this.update() } }, { key: "createBox", value: function() { var e = new Sl; this.mats.boxDefault = P1(this.buildType), this.mats.boxSelected = P1(this.buildType + "Select"); e = new Hr(e,this.mats.boxDefault); return e.name = "buildingBox", "floor" == this.buildType ? viewer.setObjectLayers(e, "siteModelMapUnvisi") : viewer.setObjectLayers(e, "bothMapAndScene"), e } }, { key: "addMarker", value: function() { var n = this , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; if ("floor" != this.buildType) { var i = new qp({ mat: this.getMarkerMaterial("default"), renderOrder: 3, sizeInfo: I1, dontFixOrient: !0, name: "building_marker" }); return viewer.setObjectLayers(i, "siteModeOnlyMapVisi"), e.marker = i, b(v(a.prototype), "addMarker", this).call(this, e), this.selected || viewer.updateVisible(i, "select", !1), i.addEventListener("addHoverEvent", function e(t) { i.addEventListener("click", function(e) { n.dispatchEvent({ type: "clickMarker", marker: i }) }), i.addEventListener("clickSelect", function(e) { n.setMarkerSelected(i, e.state ? "select" : "unselect") }), i.removeEventListener("addHoverEvent", e) }), this.isNew || i.dispatchEvent("addHoverEvent"), i } } }, { key: "removeMarker", value: function(e) { var t = this; b(v(a.prototype), "removeMarker", this).call(this, e), this.isNew || (this.midMarkers.forEach(function(e) { return t.remove(e) }), this.midMarkers = [], this.addMidMarkers()), this.update(), 2 == this.points.length && this.box && (this.box.geometry = new Sl) } }, { key: "addMidMarker", value: function(e, t) { var i = this; if ("floor" != this.buildType) { var r = new qp({ mat: this.getMarkerMaterial("midPrepare"), sizeInfo: I1, dontFixOrient: !0, name: "building_midMarker" }); this.midMarkers = [].concat(Q(this.midMarkers.slice(0, e)), [r], Q(this.midMarkers.slice(e, this.midMarkers.length))), r.renderOrder = 3, viewer.setObjectLayers(r, "siteModeOnlyMapVisi"); return r.addEventListener("drag", function(e) { var t = i.midMarkers.indexOf(r) , n = i.addMarker({ index: t + 1, point: r.position.clone() }); i.addMidMarker(t + 1, new Cn), i.updateTwoMidMarker(t + 1), i.setMarkerSelected(r, "unhover"), viewer.inputHandler.startDragging(n, {}) }), r.addEventListener("mouseover", function(e) { i.setMarkerSelected(e.object, "hover", "single"), viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "markerMove" }) }), r.addEventListener("mouseleave", function(e) { i.setMarkerSelected(e.object, "unhover", "single"), viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "markerMove" }) }), this.add(r), this.updateMarker(r, t), this.selected || viewer.updateVisible(r, "select", !1), r } } }, { key: "addMidMarkers", value: function() { var i = this , r = this.points.length; this.points.forEach(function(e, t) { var n = i.points[(t + 1) % r] , n = (new Cn).addVectors(e, n).multiplyScalar(.5); i.addMidMarker(t, n) }) } }, { key: "updateTwoMidMarker", value: function(e) { var t, n, i, r; this.midMarkers.length && (r = this.points.length, n = this.points[(e - 1 + r) % r], t = this.points[(e + 1) % r], i = this.points[e], n = (new Cn).addVectors(n, i).multiplyScalar(.5), i = (new Cn).addVectors(t, i).multiplyScalar(.5), r = this.midMarkers[(e - 1 + r) % r], e = this.midMarkers[e], this.updateMarker(r, n), this.updateMarker(e, i)) } }, { key: "dispose", value: function() { b(v(a.prototype), "dispose", this).call(this), this.box && this.box.geometry.dispose(), this.lineMesh && this.lineMesh.geometry.dispose(), this.holes.forEach(function(e) { return e.dispose() }), this.parentHoles.forEach(function(e) { return e.dispose() }), this.dispatchEvent("dispose") } }, { key: "updateBox", value: function() { var e, t; this.box && (this.box.geometry.dispose(), e = "room" == this.buildType ? .11 : "floor" == this.buildType ? .082 : .2, 3 <= this.points.length && (t = this.holes.concat(this.parentHoles).filter(function(e) { return 2 < e.points.length }).map(function(e) { return e.points }), this.box.geometry = Cf.getExtrudeGeo(this.points, t, { depth: this.zMax - this.zMin - e, UVGenerator: new N1 }), "building" == this.buildType ? this.box.position.z = this.zMin - e / 2 : this.box.position.z = this.zMin + e / 2)) } }, { key: "update", value: function() { var n = this , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; b(v(a.prototype), "update", this).call(this, "floor" != this.buildType && e.ifUpdateMarkers); var i = this.points.length; this.originHole && (this.points = this.originHole.points), "hole" == this.buildType && (this.zMin = this.buildParent.zMin, this.zMax = this.buildParent.zMax), e.dontUpdateBox || ("hole" == this.buildType ? ("building" == this.buildParent.buildType && this.buildParent.buildChildren.forEach(function(e) { e = e.parentHoles.find(function(e) { return e.originHole == n }); e && e.update() }), this.buildParent) : this).updateBox(); var r = []; this.points.forEach(function(e, t) { r.push(e.clone().setZ(n.zMin), e.clone().setZ(n.zMax)); t = n.points[(t + 1) % i]; t && (r.push(e.clone().setZ(n.zMax), t.clone().setZ(n.zMax)), r.push(e.clone().setZ(n.zMin), t.clone().setZ(n.zMin))) }), Sf.moveLine(this.lineMesh, r), e.dontUpdateChildren || ("building" == this.buildType && this.buildChildren.forEach(function(e) { e.points = n.points, e.update() }), this.holes.concat(this.parentHoles).forEach(function(e) { e.update({ dontUpdateBox: !0 }) })) } }, { key: "getHolesArea", value: function() { var e, t = this.holes.concat(this.parentHoles), n = 0; return 2 <= t.length ? (e = t.map(function(e) { return e.points }), (e = Up.getPolygonsMixedRings(e, !0)).forEach(function(e) { n += e.area }), e = e.map(function(e) { return e.points })) : (e = t.map(function(e) { return e.points })).forEach(function(e) { return n += Math.abs(Up.getArea(e)) }), n } }, { key: "getArea", value: function(e) { return Math.abs(Up.getArea(this.points)) - (e ? this.getHolesArea() : 0) } }, { key: "getVolume", value: function(e) { var t = this.getRealZ() , n = t.zMin , n = t.zMax - n; return isNaN(n) && (n = 0), this.getArea(e) * n } }, { key: "getRealZ", value: function() { if ("building" == this.buildType) var e = this.buildChildren[this.buildChildren.length - 1] , t = this.buildChildren[0] , t = t ? t.zMin : 0 , e = e ? e.zMax : 0; else { if ("hole" == this.buildType) return this.buildParent.getRealZ(); t = this.zMin, e = this.zMax } return { zMin: t, zMax: e } } }, { key: "getBound", value: function() { var t = new kn , e = this.getRealZ() , n = e.zMin , i = e.zMax; return ("floor" == this.buildType ? this.buildParent : this).points.forEach(function(e) { t.expandByPoint(e.clone().setZ(n)), t.expandByPoint(e.clone().setZ(i)) }), t } }, { key: "getMarkerMaterial", value: function(e) { return (L1 = L1 || { default: new $i({ transparent: !0, color: O1, opacity: .8, map: F1.load(Potree.resourcePath + "/textures/whiteCircle.png"), depthTest: !1 }), midPrepare: new $i({ transparent: !0, color: O1, opacity: .4, map: F1.load(Potree.resourcePath + "/textures/whiteCircle.png"), depthTest: !1 }), hover: new $i({ transparent: !0, color: O1, opacity: 1, map: F1.load(Potree.resourcePath + "/textures/whiteCircle.png"), depthTest: !1 }), select: new $i({ transparent: !0, color: new Yi("#00C8AF"), opacity: 1, map: F1.load(Potree.resourcePath + "/textures/whiteCircle.png"), depthTest: !1 }) })[e] } }, { key: "setMarkerSelected", value: function(e, t, n) { "select" == t ? (e.selected = !0, e.material = this.getMarkerMaterial("select")) : "unselect" == t ? (e.selected = !1, e.material = this.getMarkerMaterial("default")) : e.selected || ("hover" == t ? e.material = this.getMarkerMaterial("hover") : "unhover" == t && (e.name.includes("mid") ? e.material = this.getMarkerMaterial("midPrepare") : e.material = this.getMarkerMaterial("default"))) } }, { key: "select", value: function() { this.selected || (this.box && (this.box.material = this.mats.boxSelected), "building" == this.buildType || "floor" == this.buildType ? (this.buildChildren.forEach(function(e) { e.lineMesh.visible = !0 }), "floor" == this.buildType && (viewer.setObjectLayers(this.box, "bothMapAndScene"), viewer.setObjectLayers(this.buildParent.box, "siteModelMapUnvisi"))) : "room" == this.buildType && (viewer.setObjectLayers(this.buildParent.box, "bothMapAndScene"), viewer.setObjectLayers(this.buildParent.buildParent.box, "siteModelMapUnvisi")), this.lineMesh.visible = !0, this.markers && this.markers.forEach(function(e) { return viewer.updateVisible(e, "select", !0) }), this.midMarkers && this.midMarkers.forEach(function(e) { return e.visible = !0 }), this.holes.concat(this.parentHoles).forEach(function(e) { return e.select() }), this.selected = !0, this.dispatchEvent({ type: "select" })) } }, { key: "unselect", value: function() { this.selected && (this.box && (this.box.material = this.mats.boxDefault), "building" == this.buildType || "floor" == this.buildType ? (this.buildChildren.forEach(function(e) { e.lineMesh.visible = !1 }), "floor" == this.buildType && (viewer.setObjectLayers(this.box, "siteModelMapUnvisi"), viewer.setObjectLayers(this.buildParent.box, "bothMapAndScene"))) : "room" == this.buildType && (viewer.setObjectLayers(this.buildParent.box, "siteModelMapUnvisi"), viewer.setObjectLayers(this.buildParent.buildParent.box, "bothMapAndScene")), this.lineMesh.visible = !1, this.markers && this.markers.forEach(function(e) { return viewer.updateVisible(e, "select", !1) }), this.midMarkers && this.midMarkers.forEach(function(e) { return e.visible = !1 }), this.holes.concat(this.parentHoles).forEach(function(e) { return e.unselect() }), this.selected = !1, this.dispatchEvent({ type: "unselect" })) } }, { key: "ifContainsPoint", value: function(e) { var t = this , n = this.getRealZ() , i = n.zMin , n = n.zMax; if (!(e.z < i || e.z > n)) { n = this.holes.concat(this.parentHoles).filter(function(e) { return e != t && 2 < e.points.length }).map(function(e) { return e.points }); return !!Up.isPointInArea(this.points, n, e) } } }]), a }(), N1 = function() { function e() { O(this, e), this.a = new Cn, this.b = new Cn, this.c = new Cn, this.d = new Cn } return h(e, [{ key: "generateTopUV", value: function(e, t, n, i, r) { return [new yn(t[3 * n],t[3 * n + 1]), new yn(t[3 * i],t[3 * i + 1]), new yn(t[3 * r],t[3 * r + 1])] } }, { key: "generateSideWallUV", value: function(e, t, n, i, r, a) { this.a.set(t[3 * n], t[3 * n + 1], t[3 * n + 2]), this.b.set(t[3 * i], t[3 * i + 1], t[3 * i + 2]), this.c.set(t[3 * r], t[3 * r + 1], t[3 * r + 2]), this.d.set(t[3 * a], t[3 * a + 1], t[3 * a + 2]); r = this.a.x !== this.b.x, t = r ? this.b : this.d, a = this.a.distanceTo(t), t = t.distanceTo(this.c); return [new yn(this.a.x,0), r ? new yn(this.a.x + a,0) : new yn(this.a.x,t), new yn(this.a.x + a,t), r ? new yn(this.a.x,t) : new yn(this.a.x + a,0)] } }]), e }(), U1 = { zMin: -T.map.cameraHeight, zMax: T.map.cameraHeight }, G1 = { bus: new hn, entities: [], buildings: [], meshGroup: new Si, inEntity: null, lastPos: new Cn(1 / 0,1 / 0,1 / 0), init: function() { var n = this; viewer.scene.scene.add(this.meshGroup), this.meshGroup.name = "siteModel", this.SplitScreen = S1, "pano" != Potree.settings.editType && (this.createHeightPull(), Potree.settings.isTest && viewer.addEventListener("allLoaded", function() { viewer.scene.pointclouds.forEach(function(e) { var t = e.getUnrotBoundPoint() , e = new z1({ name: "数据集tightBound_" + e.dataset_id, points: t, buildType: "dataset", zMax: e.bound.max.z, zMin: e.bound.min.z, ifDraw: !0 }); n.meshGroup.add(e) }) }), Potree.settings.isOfficial && viewer.addEventListener("camera_changed", function(e) { e.changeInfo.positionChanged && n.updateEntityAt() }), viewer.inputHandler.addEventListener("keydown", function(e) { var t; e.keyCode != ym.BACKSPACE && e.keyCode != ym.DELETE || n.selectedMarker && (e = (t = n.selectedMarker.parent).markers.indexOf(n.selectedMarker), t.removeMarker(e), t.points.length < 2 && n.startInsertion("resume", t)) })) }, updateEntityAt: function(n) { function e() { var e = viewer.mainViewport.view.position; i.lastPos.copy(e); var t = "showPanos" == Potree.settings.displayMode ? viewer.images360.currentPano : e , e = i.pointInWhichEntity(t, "room"); return !n && i.inEntity == e || (i.inEntity, i.inEntity = e, i.bus.dispatchEvent({ type: "buildingChange", entity: e }), t = i.currentFloor, e = e ? "floor" == e.buildType ? e : "room" == e.buildType ? e.buildParent : null : null, !n && e == t || (i.currentFloor = e, i.bus.dispatchEvent({ type: "FloorChange", currentFloor: e }))), !(n = !1) } var i = this; n ? e() : Fm.intervalTool.isWaiting("sitemodelCameraInterval", e, 500) }, enter: function() { Potree.Log("sitemodel enter"), this.clear(), this.editing = !0, viewer.updateFpVisiDatasets(); var e = viewer.mapViewer.viewports[0]; this.SplitScreen.split({ siteModel: !0 }), viewer.viewports.forEach(function(e) { "mapViewport" != e.name && e.layersAdd("siteModelMapUnvisi"), "right" != e.name && "back" != e.name || e.layersAdd("siteModeSideVisi") }), viewer.images360.panos.forEach(function(e) { viewer.setObjectLayers(e.marker, "siteModelMapUnvisi") }), e.layersAdd("siteModeOnlyMapVisi") }, leave: function() { Potree.Log("sitemodel leave"); var e = viewer.mapViewer.viewports[0]; this.SplitScreen.recover(), viewer.viewports.forEach(function(e) { "mapViewport" != e.name && e.layersRemove("siteModelMapUnvisi"), "right" != e.name && "back" != e.name || e.layersRemove("siteModeSideVisi") }), viewer.images360.panos.forEach(function(e) { viewer.setObjectLayers(e.marker, "sceneObjects") }), e.layersRemove("siteModeOnlyMapVisi"), this.clear(), this.editing = !1, this.updateEntityAt(!0), viewer.updateFpVisiDatasets() }, addFloor: function(e, t, n, i) { var r, a; 0 == e.buildChildren.length ? r = (a = e.zMin) + Potree.config.siteModel.floorHeightDefault : "bottom" == t ? a = (r = e.buildChildren[0].zMin) - Potree.config.siteModel.floorHeightDefault : r = (a = e.buildChildren[e.buildChildren.length - 1].zMax) + Potree.config.siteModel.floorHeightDefault; i = new z1({ buildType: "floor", zMin: a, zMax: r, buildParent: e, sid: n, name: i, ifDraw: !0 }); return i.update(), this.addEntity(i, e), this.selected == e && (e.unselect(), e.select()), i }, startInsertion: function(t, e, n, i, r, a) { var o, s, l, u, c, d = this, h = viewer.mapViewer.viewports[0]; "resume" == t && (l = !0, t = (u = e).buildType, u.reDraw(0), u.isNew = !0), l || ("hole" == t || "room" == t ? (o = e.zMin, s = e.zMax) : "building" == t && (e = null, o = viewer.bound.boundingBox.min.z, s = viewer.bound.boundingBox.min.z), "hole" == t ? ((u = e.addHole()).isNew = !0, this.selectEntity(e), u.select(), console.log("挖洞 ", u.uuid)) : ((u = new z1({ buildType: t, zMin: o, zMax: s, buildParent: e, sid: n, name: i, ifDraw: !0 })).isNew = !0, this.selectEntity(u)), this.addEntity(u, e)); var p = function() { viewer.removeEventListener("cancel_insertions", m), u.removeEventListener("unselect", m), clearTimeout(c), u.editStateChange(!1), r && r(u) } , f = function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; return e.remove ? (p(), d.removeEntity(u)) : !e.remain && !e.finish && !e.remove && u.markers.length <= 3 ? (u.reDraw(1), viewer.updateVisible(u.markers[0], "unMove", !1), u.addEventListener("dragChange", function e() { viewer.updateVisible(u.markers[0], "unMove", !0), u.removeEventListener("dragChange", e) }), void u.continueDrag(u.markers[0], e)) : (p(), e.remain || !e.remove && 3 < u.markers.length ? (u.removeMarker(u.points.length - 1), u.markers.forEach(function(e) { e.dispatchEvent("addHoverEvent") }), "room" == t && d.fitPullBox(), u.isNew = !1, u.addMidMarkers()) : d.removeEntity(u), u) } , m = function e(t) { u.removeEventListener("unselect", e), viewer.inputHandler.drag ? (viewer.inputHandler.drag.object.dispatchEvent({ type: "drop", drag: viewer.inputHandler.drag, viewer: viewer, pressDistance: 0, button: C.RIGHT }), viewer.inputHandler.drag = null) : f({ remain: !0 }), viewer.inputHandler.drag = null }; viewer.dispatchEvent("cancel_insertions"), viewer.addEventListener("cancel_insertions", m), u.addEventListener("unselect", m); var v = u.addMarker({ point: new Cn(0,0,0) }); return viewer.updateVisible(v, "unMove", !1), u.addEventListener("dragChange", function e() { viewer.updateVisible(v, "unMove", !0), u.removeEventListener("dragChange", e) }), v.isDragging = !0, viewer.inputHandler.startDragging(v, { dragViewport: h, endDragFun: function(e) { var t; e.button == C.LEFT ? (t = u.addMarker({ point: u.points[u.points.length - 1].clone() }), u.continueDrag(t, e)) : e.button === C.RIGHT && (e.pressDistance < Potree.config.clickMaxDragDis ? f(e) : u.continueDrag(null, e)) }, notPressMouse: !0 }), u }, getPreDealData: function(e, t, n, i, r, a) { var o = this , s = viewer.bound.boundingBox; return "building" == r && i ? (console.log("空间模型未编辑过, 初始化了一个"), e = [new Cn(s.min.x,s.min.y,0), new Cn(s.max.x,s.min.y,0), new Cn(s.max.x,s.max.y,0), new Cn(s.min.x,s.max.y,0)], t = s.min.z, n = s.max.z) : (e = e.map(function(e) { return o.transform(e, "fromDataset") }), "floor" == r && i && (t = s.min.z, n = s.max.z)), { points: e, zMax: n, zMin: t } }, resetFromData: function(t) { var n = this , e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : [] , i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : [] , r = 3 < arguments.length ? arguments[3] : void 0 , a = 4 < arguments.length ? arguments[4] : void 0; return e = n.getPreDealData(e, r, a, n.autoBuild, t.buildType, t.buildParent), r = e.points, a = e.zMax, e = e.zMin, "floor" != t.buildType && (t.points = r), "room" == t.buildType ? (t.zMin = e, t.zMax = a) : "floor" == t.buildType && (e = t.zMin + (a - e), G1.changeZ(t, "zMax", e)), t.holes.forEach(function(e) { t.removeHole(e) }), i.forEach(function(e) { e = e.map(function(e) { return n.transform(e, "fromDataset") }); t.addHole(e).addMidMarkers() }), t.update(), t }, createFromData: function(o, s, l, u) { var c = this , e = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : [] , d = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : [] , t = 6 < arguments.length ? arguments[6] : void 0 , n = 7 < arguments.length ? arguments[7] : void 0 , h = 8 < arguments.length ? arguments[8] : void 0 , p = 9 < arguments.length ? arguments[9] : void 0 , f = 10 < arguments.length ? arguments[10] : void 0; return function(e, t, n) { if ("building" == o || "floor" == o || "room" == o) { var i = c.getPreDealData(e, t, n, h, o, s) , e = i.points , n = i.zMax , t = i.zMin , r = []; p && p.forEach(function(e) { e = viewer.images360.getPano(e, "sid"); e && r.push(e) }), f = null != f ? viewer.images360.getPano(f, "sid") : null, c.editing || "floor" != o || f || (r = s.panos, f = s.flagPano); var n = { buildType: o, points: e, name: u, sid: l, zMin: t, zMax: n, buildParent: s, ifDraw: c.editing || Potree.settings.drawEntityData, panos: r, flagPano: f, autoBuild: h } , a = new z1(n); return G1.addEntity(a, s), c.editing && ("building" != o && "room" != o || a.addMidMarkers()), d.forEach(function(e) { e = e.map(function(e) { return c.transform(e, "fromDataset") }), e = a.addHole(e); c.editing && e.addMidMarkers() }), a } }(e, t, n) }, transform: function(e, t) { if ("pano" == Potree.settings.editType) return (new Cn).copy(e).setZ(0); if ("toDataset" == t) { t = Potree.Utils.datasetPosTransform({ toDataset: !0, position: e.clone(), datasetId: Potree.settings.originDatasetId }); return (new yn).copy(t) } e = (new Cn).copy(e).setZ(0); return Potree.Utils.datasetPosTransform({ fromDataset: !0, position: e, datasetId: Potree.settings.originDatasetId }) }, addEntity: function(t, e) { var n = this; this.meshGroup.add(t), this.entities.push(t), ("building" == t.buildType ? this.buildings : e.buildChildren).push(t), "room" == t.buildType ? t.addEventListener("marker_dropped", function() { n.fitPullBox() }) : "floor" == t.buildType && (this.updateBuildingZ(e), e.dispatchEvent({ type: "addFloor" })), t.addEventListener("clickMarker", function(e) { n.selectedMarker == e.marker ? (n.selectedMarker.dispatchEvent({ type: "clickSelect", state: !1 }), n.selectedMarker = null) : (n.selectedMarker && n.selectedMarker.dispatchEvent({ type: "clickSelect", state: !1 }), n.selectedMarker = e.marker, n.selectedMarker.dispatchEvent({ type: "clickSelect", state: !0 })) }), t.addEventListener("removeMarker", function(e) { n.selectedMarker == e.marker && (n.selectedMarker = null) }); function i(e) { n.selectedMarker && t.markers.includes(n.selectedMarker) && (n.selectedMarker.dispatchEvent({ type: "clickSelect", state: !1 }), n.selectedMarker = null) } t.addEventListener("dispose", i), t.addEventListener("unselect", i) }, removeEntity: function(e) { var t, n = this; this.entities.includes(e) && (console.log("删除实体:", e.buildType, e.sid), this.selected == e && (this.height_pull_box.visible = !1, this.selectEntity(null)), "building" == e.buildType ? -1 < (t = this.buildings.indexOf(e)) && this.buildings.splice(t, 1) : -1 < (t = e.buildParent.buildChildren.indexOf(e)) && e.buildParent.buildChildren.splice(t, 1), -1 < (t = this.entities.indexOf(e)) && this.entities.splice(t, 1), e.dispose(), e.buildChildren.slice().forEach(function(e) { return n.removeEntity(e) })) }, updateBuildingZ: function(e) { e.buildChildren = e.buildChildren.sort(function(e, t) { return e.zMin - t.zMin }), e.zMin = e.zMax = e.buildChildren[0].zMin, this.editing && e.update({ dontUpdateChildren: !0 }), e.dispatchEvent("updateBuildingZ") }, selectEntity: function(e) { if (!1 === (!(1 < arguments.length && void 0 !== arguments[1]) || arguments[1])) return e.unselect(), void (this.selected == e && (this.selected = null)); this.selected == e || e && "hole" == e.buildType || (this.selected && this.selected.unselect(), this.height_pull_box.visible = !1, e && e.select(), !(this.selected = e) || "floor" != e.buildType && "room" != e.buildType || (this.height_pull_box.visible = !0, this.fitPullBox()), e && !e.isNew && ("building" == e.buildType || "room" == e.buildType) && e.points.length < 2 && this.startInsertion("resume", e)) }, fitPullBox: function() { var e, t; !this.selected || "floor" != this.selected.buildType && "room" != this.selected.buildType || ((t = new kn).expandByObject(this.selected.box), e = t.getCenter(new Cn), t = t.getSize(new Cn), this.height_pull_box.scale.copy(t), this.height_pull_box.position.copy(e)) }, changeZ: function(e, t, n) { var i, r, a, o; "floor" == e.buildType ? (o = e.buildParent.buildChildren.indexOf(e), "zMax" == t ? (a = e.buildParent.buildChildren[o + 1], e.zMax = Math.min(U1.zMax, n), r = e.zMin + .5, e.zMax < r ? e.zMax = r : a && (i = a.zMax - .5, e.zMax > i && (e.zMax = i)), a && (a.zMin = e.zMax, a.update(), a.dispatchEvent({ type: "changeHeight" }))) : (a = e.buildParent.buildChildren[o - 1], e.zMin = Math.max(U1.zMin, n), i = e.zMax - .5, e.zMin > i ? e.zMin = i : a && (r = a.zMin + .5, e.zMin < r && (e.zMin = r)), a && (a.zMax = e.zMin, a.update(), a.dispatchEvent({ type: "changeHeight" })), 0 == o && this.updateBuildingZ(e.buildParent))) : "room" == e.buildType && (o = e.buildParent.zMax - e.buildParent.zMin, "zMax" == t ? (r = e.zMin + .5, i = e.zMin + o, e.zMax = gn.clamp(n, r, i)) : (r = e.zMax - o, i = e.zMax - .5, e.zMin = gn.clamp(n, r, i))), e.update(), e.dispatchEvent({ type: "changeHeight" }), this.fitPullBox() }, createHeightPull: function() { var i = this , e = new Wr(1,1,.25) , t = new $i({ color: "#F00", opacity: 0, transparent: !0, depthTest: !1, side: 2 }) , r = new Hr(e,t) , t = new Hr(e,t); r.name = "height_pull_box_up", t.name = "height_pull_box_down", this.height_pull_box = new Si, this.height_pull_box.name = "height_pull_box", this.height_pull_box.add(r), this.height_pull_box.add(t), this.height_pull_box.visible = !1, this.meshGroup.add(this.height_pull_box), r.position.set(0, 0, .5), t.position.set(0, 0, -.5), viewer.setObjectLayers(this.height_pull_box, "siteModeSideVisi"); function n(e) { viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "siteModelFloorDrag" }) } function a(e) { viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "siteModelFloorDrag" }) } function o(e) { var t, n = e.intersect.orthoIntersect; null != u ? (t = n.z - u, "floor" != i.selected.buildType && "room" != i.selected.buildType || (e.target == r ? (null == l && (l = i.selected.zMax), i.changeZ(i.selected, "zMax", l + t)) : (null == l && (l = i.selected.zMin), i.changeZ(i.selected, "zMin", l + t)))) : u = n.z } function s(e) { l = u = null } var l, u; r.addEventListener("mousemove", n), t.addEventListener("mousemove", n), r.addEventListener("mouseleave", a), t.addEventListener("mouseleave", a), r.addEventListener("drag", o), t.addEventListener("drag", o), r.addEventListener("drop", s), t.addEventListener("drop", s) }, pointInWhichEntity: function(o, e, t) { function s(e, t) { var n = o instanceof Cn ? e.ifContainsPoint(o) : e.panos.includes(o); if (n) { if ((!l || u[l.buildType] < u[e.buildType]) && (l = e), e.buildType == t) return e; for (var i = 0, r = e.buildChildren.length; i < r; i++) { var a = s(e.buildChildren[i]); if (a) return a } } } var l, u = { building: 0, floor: 1, room: 2 }, n = Fm.sortByScore(this.buildings, [function(e) { return s(e, "building") } ], [function(e) { var t = e.getBound() , e = t.getCenter(new Cn) , e = (o instanceof Cn ? o : o.position).distanceTo(e); return t.getSize(new Cn).length() / 2 / e } ]), i = n && n[0] && 1 < n[0].score && n[0].item; return "building" != e && i ? (n = s(i, e)) || l : i }, findPanos: function() { this.entities.forEach(function(t) { t.panos = [], t.flagPano = null, viewer.images360.panos.forEach(function(e) { t.ifContainsPoint(e.position) && t.panos.push(e) }) }), this.entities.forEach(function(e) { var t, n = e.panos; 0 != n.length && (t = e.getBound().getCenter(new Cn), t = [ly.scoreFunctions.distanceSquared({ position: t })], (t = Fm.sortByScore(n, [], t)) && t.length ? e.flagPano = t[0].item : console.error("no flagPano??")) }) }, findEntityForDataset: function() { var r = this; viewer.scene.pointclouds.forEach(function(e) { for (var t = e.getVolume(), n = r.buildings; ; ) { var i = function(r, e, a) { var o = []; return e.forEach(function(e) { var t = e.intersectPointcloudVolume(r) , n = e.panos.filter(function(e) { return r.panos.includes(e) }).length , i = t / a; 0 < r.panos.length && (i += n / r.panos.length), o.push({ entity: e, volume: t, panoCount: n, score: i }) }), o.sort(function(e, t) { return t.score - e.score }), o }(e, n, t); if (0 == i.length || i[0].volume / t < 1e-4 && i[0].volume < 3) { if (i[0] && "room" == i[0].entity.buildType) { e.belongToEntity = i[0].entity; break } e.belongToEntity = null; break } if (0 == (n = i[0].entity.buildChildren).length) { e.belongToEntity = i[0].entity; break } } }) }, clear: function() { this.selectEntity(null); for (var e = this.entities.length, t = 0; t < e; t++) this.entities[t].dispose(); this.entities = [], this.buildings = [], this.inEntity = null }, gotoEntity: function(t, e) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1e3 , i = this.entities.find(function(e) { return e.sid == t }); if (!i) return console.error("没找到entity "); if ("showPanos" == Potree.settings.displayMode) { if (e && i.panos.length) { if (i.panos.includes(viewer.images360.currentPano)) return "posNoChange"; var r = viewer.scene.getActiveCamera().position , r = [ly.scoreFunctions.distanceSquared({ position: r })] , r = Fm.sortByScore(i.panos, [], r)[0].item } else { if (!i.flagPano) return console.log("没有flagPano"); r = i.flagPano } if (r == viewer.images360.currentPano) return "posNoChange"; viewer.images360.flyToPano(r) } else { if (e && i.ifContainsPoint(viewer.images360.position)) return "posNoChange"; e = i.getBound(), i = e.getCenter(new Cn); if (viewer.modules.Clip && viewer.modules.Clip.editing) viewer.modules.Clip.bus.dispatchEvent({ type: "flyToPos", position: i }); else { if (Up.closeTo(i, viewer.images360.position)) return "posNoChange"; e = e.getSize(new Cn); viewer.scene.view.setView({ position: i, duration: n }), viewer.mapViewer.moveTo(i, e, n) } } return !0 }, focusEntity: function(t) { var e = this.entities.find(function(e) { return e.sid == t }).getBound() , n = e.getCenter(new Cn); this.SplitScreen.focusOnObject(e, n), this.gotoEntity(t, !1, 0) }, removeIlligalArchi: function() { var t = this , n = []; this.entities.forEach(function(e) { e.points.length < 3 && n.push(e) }), n.forEach(function(e) { return t.removeEntity(e) }) } }, H1 = function() { y(l, Hr); var s = w(l); function l(e, t, n, i) { var r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : .2 , a = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 1; O(this, l), n = n || new Yi("white"), e = e || 10, t = t || 100, i = i || 8e3; var o = new ua(2,2,1,1) , i = new Qr({ side: Y, uniforms: { uSize1: { value: e }, uSize2: { value: t }, opacity1: { value: r }, opacity2: { value: a }, uColor: { value: n }, uDistance: { value: i } }, transparent: !0, vertexShader: "\n \n varying vec3 worldPosition;\n \n uniform float uDistance;\n \n void main() {\n \n vec3 pos = position.xyz * uDistance;\n pos.xy += cameraPosition.xy;\n \n worldPosition = pos;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n \n }\n ", fragmentShader: "\n \n varying vec3 worldPosition;\n \n uniform float uSize1;\n uniform float uSize2;\n uniform float opacity1;\n uniform float opacity2;\n uniform vec3 uColor;\n uniform float uDistance;\n \n \n \n float getGrid(float size) {\n \n vec2 r = worldPosition.xy / size;\n \n \n vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);\n float line = min(grid.x, grid.y);\n \n \n return 1.0 - min(line, 1.0);\n }\n //为何侧面看不到线,因为mesh的正侧面都看不到?\n\n void main() {\n \n \n float d = 1.0 - min(distance(cameraPosition.xy, worldPosition.xy) / uDistance, 1.0);\n \n float g1 = getGrid(uSize1);\n float g2 = getGrid(uSize2);\n \n \n gl_FragColor = vec4(uColor.rgb, mix(g2, g1, g1) * pow(d, 3.0));\n //gl_FragColor.a = mix(0.5 * gl_FragColor.a, gl_FragColor.a, g2);\n gl_FragColor.a = mix(opacity1 * gl_FragColor.a, opacity2 * gl_FragColor.a, g2);\n \n \n if ( gl_FragColor.a <= 0.0 ) discard;\n \n \n }\n \n ", extensions: { derivatives: !0 } }); return (i = s.call(this, o, i)).frustumCulled = !1, i } return h(l) }(); D1.prototype = Object.assign(Object.create(Si.prototype), { constructor: D1, isTransformControls: !0 }), k1.prototype = Object.assign(Object.create(Si.prototype), { constructor: k1, isTransformControlsGizmo: !0 }), B1.prototype = Object.assign(Object.create(Hr.prototype), { constructor: B1, isTransformControlsPlane: !0 }), (new _c).crossOrigin = "anonymous"; var V1 = [{ left: 0, bottom: 0, width: .5, height: 1, name: "top", axis: ["x", "y"], direction: new Cn(0,0,-1), active: !0, limitBound: new kn(new Cn(-1 / 0,-1 / 0,1),new Cn(1 / 0,1 / 0,5e3)), margin: { x: 50, y: 150 } }, { left: .5, bottom: 0, width: .5, height: 1, name: "right", axis: ["y", "z"], direction: new Cn(1,0,0), active: !0, viewContainsPoints: [new Cn(0,0,0)], margin: { x: 300, y: 250 } }] , j1 = { bus: new hn, SplitScreen: new A1, init: function() { var n = this , e = this.ground = new H1(1,1e4,new Yi("#fff"),1e4,.2,.3); viewer.scene.scene.add(e); var t = Sf.createLine([new Cn(-1e4,0,0), new Cn(1e4,0,0)], { color: "#666", dontAlwaysSeen: !0 }) , i = Sf.createLine([new Cn(0,-1e4,0), new Cn(0,1e4,0)], { mat: t.material }); e.renderOrder = t.renderOrder + 1, e.add(t), e.add(i), e.material.polygonOffset = !0, e.material.polygonOffsetFactor = 10, e.material.polygonOffsetUnits = 10, t.material.polygonOffset = !0, t.material.polygonOffsetFactor = 20, t.material.polygonOffsetUnits = 10, this.transformControls = new D1(viewer.mainViewport.camera,viewer.renderArea,{ dontHideWhenFaceCamera: !0 }), this.transformControls.setSize(1.5), viewer.scene.scene.add(this.transformControls), viewer.setControls(viewer.orbitControls), viewer.orbitControls.constantlyForward = !0, viewer.addEventListener("global_single_click", function(e) { viewer.scene.cameraAnimations.some(function(e) { return e.onUpdate }) || e.drag && e.drag.notPressMouse || viewer.mainViewport.view.isFlying() || n.split || (e.intersect ? (e = e.intersect.object || e.intersect.pointcloud, n.getAllObjects().includes(e) ? n.selectModel(e) : n.selectModel(null)) : n.selectModel(null)) }), viewer.inputHandler.addEventListener("keydown", function(e) { "h" == e.event.key.toLowerCase() && (n.fadeOutlineAuto = !n.fadeOutlineAuto, n.showModelOutline(n.selected, !!n.selected)) }), viewer.ssaaRenderPass.enabled = !1, viewer.outlinePass.enabled = !0, viewer.mainViewport.camera.near = .05, viewer.addEventListener("updateModelBound", function(e) { n.split && n.SplitScreen.updateCameraOutOfModel() }); function r(e) { if (n.split && "top" == e.dragViewport.name && n.selected && n.transformState && ("global_mousedown" == e.type && (e.intersect.object || e.intersect.pointcloud) == n.selected && (a = {}), "global_drag" == e.type && a)) { if ("translate" == n.transformState) { var t = Potree.Utils.getOrthoCameraMoveVec(e.drag.pointerDelta, e.dragViewport.camera); n.selected.position.add(t), n.selected.dispatchEvent("position_changed") } else if ("rotate" == n.transformState) { t = (new Cn).subVectors(e.intersect.orthoIntersect || e.intersect.location, n.selected.boundCenter).setZ(0); if (null == a.lastVec) return void (a.lastVec = t); e = Up.getAngle(a.lastVec, t, "z"); a.lastVec = t; e = (new Sn).setFromAxisAngle(new Cn(0,0,1), e); n.selected.quaternion.premultiply(e), n.selected.dispatchEvent("rotation_changed") } return { stopContinue: !0 } } } var a; viewer.addEventListener("global_mousedown", r), viewer.addEventListener("global_drag", r, 10), viewer.addEventListener("global_mousemove", function(e) { n.split && "top" == e.hoverViewport.name && n.transformState && !e.drag && ((e.intersect.object || e.intersect.pointcloud) == n.selected ? "translate" == n.transformState ? viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "movePointcloud" }) : viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "rotatePointcloud" }) : n.clearTranCursor()) }), viewer.addEventListener("global_drop", function(e) { a = null, n.clearTranCursor() }) }, clearTranCursor: function() { viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "movePointcloud" }), viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "rotatePointcloud" }) }, enterSplit: function() { this.split = !0, this.selected ? this.SplitScreen.focusCenter = this.selected.boundCenter : this.SplitScreen.focusCenter = null, this.SplitScreen.splitStart(V1), viewer.setControls(viewer.fpControls), viewer.viewports.find(function(e) { return "right" == e.name }).rotateSide = !0, viewer.viewports.find(function(e) { return "top" == e.name }).alignment = !0 }, leaveSplit: function() { this.split = !1, this.SplitScreen.unSplit(), viewer.setControls(viewer.orbitControls) }, rotateSideCamera: function(e) { this.SplitScreen.rotateSideCamera(viewer.viewports.find(function(e) { return "right" == e.name }), e) }, setTransformState: function(e) { this.transformState = e, this.clearTranCursor() }, getAllObjects: function() { return viewer.objs.children.concat(viewer.scene.pointclouds) }, getModel: function(t) { return this.getAllObjects().find(function(e) { return e.dataset_id == t }) }, removeModel: function(e) { this.selected == e && this.selectModel(null), e.traverse(function(e) { e.geometry && e.geometry.dispose(), e.material && e.material.dispose() }), viewer.objs.remove(e) }, selectModel: function(e) { var t = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1] , n = 2 < arguments.length ? arguments[2] : void 0 , i = 3 < arguments.length ? arguments[3] : void 0; if (e || (e = this.selected, t = !1), t) { if (this.selected) { if (this.selected == e) return; this.selectModel(this.selected, !1, n, i) } this.selected = e, j1.focusOn(e, 500, !!n), this.showModelOutline(e), e.isPointcloud ? viewer.outlinePass.edgeStrength = 4 : viewer.outlinePass.edgeStrength = 100 } else this.showModelOutline(e, !1), this.selected = null, this.transformControls.detach(); !i && e && e.dispatchEvent({ type: "changeSelect", selected: t }) }, showModelOutline: function(e, t) { if (this.fadeOutlineAuto) { if (!1 === t) return viewer.outlinePass.selectedObjects = [], void clearTimeout(this.timer); viewer.outlinePass.selectedObjects = [e], this.timer && clearTimeout(this.timer), this.timer = setTimeout(function() { viewer.outlinePass.selectedObjects = [] }, 1e3) } else viewer.outlinePass.selectedObjects = !1 === t ? [] : [e] }, focusOn: function(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 400 , n = !(2 < arguments.length && void 0 !== arguments[2]) || arguments[2] , i = 3 < arguments.length ? arguments[3] : void 0; e instanceof Array || (e = [e]); var r = new kn; e.forEach(function(e) { r.union(e.boundingBox.clone().applyMatrix4(e.matrixWorld)) }), n ? viewer.focusOnObject({ boundingBox: r }, "boundingBox", t, { dontLookUp: i }) : (i = viewer.inputHandler.intersect ? viewer.inputHandler.intersect.location : r.getCenter(new Cn)) && viewer.focusOnObject({ position: i }, "point", t, { dontChangePos: !0 }) }, setModelBtmHeight: function(e, t) { null == t ? t = e.btmHeight : e.btmHeight = t, e.updateMatrixWorld(); var n = e.boundingBox.clone().applyMatrix4(e.matrixWorld) , i = n.getSize(new Cn) , n = n.getCenter(new Cn) , i = t + i.z / 2; e.position.z += i - n.z }, computeBtmHeight: function(e) { e.updateMatrixWorld(); var t = e.boundingBox.clone().applyMatrix4(e.matrixWorld) , n = t.getSize(new Cn) , t = t.getCenter(new Cn); e.btmHeight = t.z - n.z / 2 }, maintainBoundXY: function(e) { e.updateMatrixWorld(); var t = e.boundCenter.clone(); this.getBoundCenter(e); var n = e.boundCenter.clone() , n = (new yn).subVectors(t, n); e.position.x += n.x, e.position.y += n.y, e.boundCenter.copy(t) }, moveBoundCenterTo: function(e, t) { t = (new Cn).subVectors(t, e.boundCenter); e.position.add(t) }, getBoundCenter: function(e) { e.boundCenter || (e.boundCenter = new Cn), e.boundingBox.getCenter(e.boundCenter).applyMatrix4(e.matrixWorld) }, modelTransformCallback: function(r) { r.updateMatrixWorld(), r.matrixWorld.equals(r.lastMatrixWorld) || (viewer.scene.measurements.forEach(function(n) { var i; n.points_datasets.forEach(function(e, t) { e == r.dataset_id && (i = !0, n.points[t] = Potree.Utils.datasetPosTransform({ fromDataset: !0, datasetId: e, position: n.dataset_points[t].clone() }), n.updateMarker(n.markers[t], n.points[t])) }), i && (n.getPoint2dInfo(n.points), n.update()) }), r.lastMatrixWorld = r.matrixWorld.clone()) } } , W1 = new _c , X1 = new Dl(1.45,100) , q1 = new Tu(.018,10,10) , J1 = Math.round(2 <= window.devicePixelRatio ? (1398784 <= window.screen.width * window.screen.height ? window.devicePixelRatio / 1.2 : window.devicePixelRatio / 1.5) * (200 / 1.43) : 200 / 1.43); console.log("width2dPX", J1); function Y1(e) { return (eb = eb || { "fire+smoke": Sf.createFatLineMat($.extend(kb, { color: Db["fire+smoke"], lineWidth: 2 })), smoke: Sf.createFatLineMat($.extend(kb, { color: Db.smoke, lineWidth: 2 })), explode: Sf.createFatLineMat($.extend(kb, { color: Db.explode, lineWidth: 2 })) })[e] } function Z1(e) { var t; return tb || (t = new _c, tb = { "fire+smoke": new Wp($.extend(kb, { map: t.load(Potree.resourcePath + "/textures/icon-fire.png"), color: Db["fire+smoke"] })), smoke: new Wp($.extend(kb, { map: t.load(Potree.resourcePath + "/textures/icon-smoke.png"), color: Db.smoke })), explode: new Wp($.extend(kb, { map: t.load(Potree.resourcePath + "/textures/icon-explode.png"), color: Db.explode })) }), tb[e] } var Q1, K1, $1, eb, tb, nb, ib, rb, ab = function() { y(l, Si); var s = w(l); function l(t) { var n; O(this, l), (n = s.call(this)).width = n.height = J1, n.camera = new $r(50,1,.01,1e4), n.camera.up = new Cn(0,0,1), n.viewport = new Ig(null,n.camera,{ left: 0, bottom: 0, width: 1, height: 1, name: "magnifier", cameraLayers: ["magnifierContent"], pixelRatio: 1 }), n.viewport.setResolution(n.width, n.height, 0, 0); var e, i, r, a = new Map; n.viewport.beforeRender = function() { t.scene.pointclouds.forEach(function(e) { a.set(e, e.temp.pointOpacity) }), e = Potree.settings.pointDensity, Potree.settings.pointDensity = "magnifier", t.scene.pointclouds.forEach(function(e) { i = e.material.pointSizeType, e.material.pointSizeType = Potree.config.material.pointSizeType, r = e.material.activeAttributeName, e.material.activeAttributeName = "rgba", e.changePointOpacity(1) }) } , n.viewport.afterRender = function() { Potree.settings.pointDensity = e, t.scene.pointclouds.forEach(function(e) { e.material.pointSizeType = i, e.material.activeAttributeName = r, e.changePointOpacity(a.get(e)) }) } , n.renderTarget = new An(n.width,n.height,{ minFilter: Oe, magFilter: Oe, format: et }), n.rtEDL = new An(n.width,n.height,{ minFilter: Re, magFilter: Re, format: et, type: Xe, depthTexture: new El(void 0,void 0,We) }), n.mesh = new Hr(X1,new $i({ side: Y, map: n.renderTarget.texture, transparent: !0, depthTest: !1 })), n.overlayMesh = new Hr(X1,new $i({ side: Y, map: W1.load(Potree.resourcePath + "/textures/crosshair.png"), transparent: !0, depthTest: !1 })), n.targetPoint = new Si, n.targetPoint.add(new Hr(q1,new $i({ color: "#ff0000", transparent: !0, opacity: .5 }))), n.targetPoint.add(new Hr(q1,new $i({ color: "#ff0000", transparent: !0, opacity: .2, depthTest: !1 }))), n.targetPoint.name = "magnifierPointTarget", t.scene.scene.add(n.targetPoint), t.setObjectLayers(n.targetPoint, "magnifierContent"), n.add(n.mesh), n.add(n.overlayMesh), n.position.set(-1e3, -1e3, -1e5), n.mesh.renderOrder = 10, n.overlayMesh.renderOrder = 11, n.aimPos, t.setObjectLayers(g(n), "magnifier"), t.addEventListener("camera_changed", function(e) { e.viewport == t.mainViewport && n.update() }), n.mesh.layers.set(Potree.config.renderLayers.magnifier), n.overlayMesh.layers.set(Potree.config.renderLayers.magnifier), n.dontRender = !1, t.addEventListener("global_drag", function(e) { n.dontRender = !0 }), t.addEventListener("global_drop", function(e) { n.dontRender = !1 }), t.addEventListener("global_mouseup", function(e) { n.dontRender = !1 }); function o(e) { e.hoverViewport == t.mainViewport ? (t.updateVisible(g(n), "atViewport", !0), n.update(e.intersect && e.intersect.location)) : t.updateVisible(g(n), "atViewport", !1) } return t.addEventListener("global_mousemove", o), t.addEventListener("global_touchstart", o), n.addEventListener("setEnable", function(e) { t.updateVisible(g(n), "enable", e.value) }), Potree.settings.isOfficial ? t.updateVisible(g(n), "enable", !1) : (t.updateVisible(g(n), "measure", !1), t.addEventListener("measureMovePoint", function() { t.updateVisible(g(n), "measure", !0) }), t.addEventListener("endMeasureMove", function() { t.updateVisible(g(n), "measure", !1) })), t.scene.view.addEventListener("flyingDone", function() { var e; n.visible && (e = t.inputHandler.getIntersect(t.mainViewport, t.mainViewport.camera, !0, 100), n.update(e && e.location)) }), n } return h(l, [{ key: "update", value: function(e) { var t, n, i, r, a, o = this.dontRender || !(e instanceof Cn) || "showPanos" == Potree.settings.displayMode && viewer.images360.flying; (e = e instanceof Cn ? e : this.aimPos) && this.visible && (a = (n = (t = viewer.scene.getActiveCamera()).position).distanceTo(e), i = (new Cn).subVectors(n, e).normalize(), r = 1 < a ? 1 : a / 2, this.camera.position.copy(e).add(i.multiplyScalar(r)), this.camera.lookAt(e), this.camera.fov = t.fov / 2, this.camera.updateProjectionMatrix(), r = (r = Potree.Utils.getPos2d(e, t, viewer.renderArea, viewer.mainViewport).vector).clone().setY(r.y + (.4 < r.y ? -.4 : .4)), r = new Cn(r.x,r.y,.8).unproject(t).clone().sub(n).normalize().multiplyScalar(10), a = 1 < a ? 1 : +a, this.position.copy(n.clone().add(r)), this.quaternion.copy(t.quaternion), this.targetPoint.position.copy(e), this.targetPoint.scale.set(a, a, a), this.aimPos = e, e = Up.getScaleForConstantSize({ width2d: J1, camera: viewer.scene.getActiveCamera(), position: this.getWorldPosition(new Cn), resolution: viewer.mainViewport.resolution2 }), this.scale.set(e, e, e), o || (this.waitRender = !0)) } }, { key: "render", value: function() { this.waitRender && (viewer.render({ target: this.renderTarget, viewports: [this.viewport], camera: this.camera, magnifier: !0, rtEDL: this.rtEDL }), this.waitRender = !1) } }]), l }(), ob = new _c, sb = function() { y(r, Hr); var i = w(r); function r(e) { O(this, r); var t, n = ob.load(Potree.resourcePath + "/textures/whiteCircle.png"); return (t = i.call(this, new ua(.11,.11,1,1), new $i({ side: Y, map: n, transparent: !0, depthTest: !1, opacity: .7 }))).name = "reticule", t.defaultTex = n, t.crosshairTex = ob.load(Potree.resourcePath + "/textures/reticule_cross_hair.png"), t.forbitTex = ob.load(Potree.resourcePath + "/textures/pic-forbid.png"), t.renderOrder = 100, t.layers.set(Potree.config.renderLayers.marker), t.direction = new Cn, t.mouseLastMoveTime = Date.now(), t.hoverViewport, t.matrixMap = new Map, t.matrixAutoUpdate = !1, t.hide(0), Potree.settings.intersectWhenHover && e.addEventListener("global_mousemove", t.move.bind(g(t))), e.addEventListener("global_mousedown", t.move.bind(g(t))), t.state = {}, e.addEventListener("measureMovePoint", function() { t.state.cross = !0, t.judgeTex() }), e.addEventListener("endMeasureMove", function() { t.state.cross = !1, t.judgeTex() }), e.addEventListener("reticule_forbit", function(e) { t.state.forbit != e.v && console.log("change forbit ", e.v), t.state.forbit = e.v, t.judgeTex() }), e.setObjectLayers(g(t), "sceneObjects"), t } return h(r, [{ key: "judgeTex", value: function() { this.state.forbit ? this.material.map = this.forbitTex : this.state.cross ? this.material.map = this.crosshairTex : this.material.map = this.defaultTex, viewer.mapViewer && viewer.mapViewer.dispatchEvent({ type: "content_changed" }) } }, { key: "move", value: function(e) { "global_mousemove" == e.type && (e.isTouch || e.buttons != rm.NONE) && "crosshair" != this.state || (this.mouseLastMoveTime = Date.now(), this.updatePosition(e.intersect, e.hoverViewport)) } }, { key: "hide", value: function() { var e = this , t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 500; this.hidden || (this.hidden = !0, gv.start(vv(this.material, "opacity", 0), t), this.dispatchEvent({ type: "update", visible: !1 }), setTimeout(function() { e.dispatchEvent({ type: "update", visible: !1 }) }, t)) } }, { key: "show", value: function() { var e = this , t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 300; viewer.getObjVisiByReason(this, "force") && (this.hidden = !1, this.material.opacity <= 0 && (gv.start(vv(this.material, "opacity", .7), t), this.dispatchEvent({ type: "update", visible: !0 }), setTimeout(function() { e.dispatchEvent({ type: "update", visible: !1 }) }, t))) } }, { key: "updateVisible", value: function() { 1500 < Date.now() - this.mouseLastMoveTime && !this.hidden && this.hide() } }, { key: "updateScale", value: function(e) { var t, n = e.camera; "OrthographicCamera" == n.type ? (t = this.state.cross ? { width2d: 500 } : { minSize: 100, maxSize: 400, nearBound: 100, farBound: 700 }, t = Up.getScaleForConstantSize($.extend(t, { position: this.position, camera: n, resolution: e.resolution }))) : (t = 1 + .1 * (n = n.position.distanceTo(this.position)), n < 1 && (t -= 1 - n)), this.scale.set(t, t, t) } }, { key: "updateAtViewports", value: function(e) { var t; "magnifier" != e.name && (this.hoverViewport && "mapViewport" == this.hoverViewport.name && e != this.hoverViewport ? viewer.updateVisible(this, "hoverMap", !1) : (viewer.updateVisible(this, "hoverMap", !0), (t = this.matrixMap.get(e)) ? this.matrix.copy(t) : (this.updateScale(e), this.updateMatrix(), this.matrixMap.set(e, this.matrix.clone())))) } }, { key: "updatePosition", value: function(e, t) { var n, i, r; viewer.getObjVisiByReason(this, "force") && e && (n = !e.location, i = e.location || e.orthoIntersect.clone(), this.show(n ? 0 : 300), n ? (r = new Cn(0,0,1), i.setZ(0), this.direction = r.clone()) : (r = e.normal) && (this.direction = this.direction.multiplyScalar(.8), this.direction.add(r.clone().multiplyScalar(.2))), this.position.copy(i), this.updateMatrix(), this.lookAt(this.position.clone().add(this.direction)), this.hoverViewport = t, this.updateScale(t), this.updateMatrix(), this.matrixMap.clear(), this.matrixMap.set(t, this.matrix.clone()), this.dispatchEvent({ type: "update" })) } }]), r }(), lb = ["", "⅛", "¼", "⅜", "½", "⅝", "¾", "⅞"], ub = function() { function r(e, t, n, i) { O(this, r), this.name = e, this.symbol = t, this.base = n, this.factor = i } return h(r, [{ key: "toBase", value: function(e) { return e * this.factor } }, { key: "fromBase", value: function(e) { return e / this.factor } }]), r }(), cb = { MILLIMETER: ["Millimeter", "mm"], CENTIMETER: ["Centimeter", "cm"], METER: ["Meter", "m"], KILOMETER: ["Kilometer", "km"], INCH: ["Inch", "in"], FOOT: ["Foot", "ft"], MILE: ["Mile", "mi"], SQUAREMETER: ["SquareMeter", "m²"], SQUAREFOOT: ["SquareFoot", "ft²"], CUBICMETER: ["CubicMeter", "m³"], CUBICFOOT: ["CubicFoot", "ft³"], BYTE: ["Byte", "B"], KILOBYTE: ["Kilobyte", "kB"], MEGABYTE: ["Megabyte", "MB"], GIGABYTE: ["Gigabyte", "GB"], TERABYTE: ["Terabyte", "TB"], PETABYTE: ["Petabyte", "PB"], init: function() { var e, t, n = new ub(cb.METER[0],cb.METER[1],void 0,1), i = new ub(cb.SQUAREMETER[0],cb.SQUAREMETER[1],void 0,1), r = new ub(cb.CUBICMETER[0],cb.CUBICMETER[1],void 0,1), a = new ub(cb.BYTE[0],cb.BYTE[1],void 0,1); cb.DISTANCE = ((t = {}).metric = ((e = {})[cb.MILLIMETER[0]] = new ub(cb.MILLIMETER[0],cb.MILLIMETER[1],n,.001), e[cb.CENTIMETER[0]] = new ub(cb.CENTIMETER[0],cb.CENTIMETER[1],n,.01), e[cb.METER[0]] = n, e[cb.KILOMETER[0]] = new ub(cb.KILOMETER[0],cb.KILOMETER[1],n,1e3), e), t.imperial = ((e = {})[cb.INCH[0]] = new ub(cb.INCH[0],cb.INCH[1],n,.0254), e[cb.FOOT[0]] = new ub(cb.FOOT[0],cb.FOOT[1],n,.3048), e[cb.MILE[0]] = new ub(cb.MILE[0],cb.MILE[1],n,1609.344), e), t), cb.AREA = ((e = {}).metric = ((t = {})[cb.SQUAREMETER[0]] = i, t), e.imperial = ((t = {})[cb.SQUAREFOOT[0]] = new ub(cb.SQUAREFOOT[0],cb.SQUAREFOOT[1],i,.092903), t), e), cb.VOLUME = ((t = {}).metric = ((e = {})[cb.CUBICMETER[0]] = r, e), t.imperial = ((e = {})[cb.CUBICFOOT[0]] = new ub(cb.CUBICFOOT[0],cb.CUBICFOOT[1],r,.0283168), e), t); (t = {})[cb.BYTE[0]] = a, t[cb.KILOBYTE[0]] = new ub(cb.KILOBYTE[0],cb.KILOBYTE[1],a,1e3), t[cb.MEGABYTE[0]] = new ub(cb.MEGABYTE[0],cb.MEGABYTE[1],a,1e6), t[cb.GIGABYTE[0]] = new ub(cb.GIGABYTE[0],cb.GIGABYTE[1],a,1e9), t[cb.TERABYTE[0]] = new ub(cb.TERABYTE[0],cb.TERABYTE[1],a,1e12), t[cb.PETABYTE[0]] = new ub(cb.PETABYTE[0],cb.PETABYTE[1],a,1e15), a = t; cb.DATA = ((t = {}).metric = a, t.imperial = a, t) }, getUnitsOfMeasurementByDomain: function(e) { return this[e.toUpperCase()] }, getUnitsOfMeasurementByDomainAndSystem: function(e, t) { e = this.getUnitsOfMeasurementByDomain(e); if (e.hasOwnProperty(t.toLowerCase())) return e[t.toLowerCase()]; console.error(n + " measurement system is not supported.") }, getDefaultUnitByDomainAndSystem: function(e, t) { switch (e.toUpperCase()) { case "DISTANCE": switch (t.toLowerCase()) { case "metric": return this.DISTANCE.metric[this.METER[0]]; case "imperial": return this.DISTANCE.imperial[this.FOOT[0]]; default: console.error(t + " measurement system is not supported.") } case "AREA": switch (t.toLowerCase()) { case "metric": return this.AREA.metric[this.SQUAREMETER[0]]; case "imperial": return this.AREA.imperial[this.SQUAREFOOT[0]]; default: console.error(t + " measurement system is not supported.") } case "VOLUME": switch (t.toLowerCase()) { case "metric": return this.VOLUME.metric[this.CUBICMETER[0]]; case "imperial": return this.VOLUME.imperial[this.CUBICFOOT[0]]; default: console.error(t + " measurement system is not supported.") } case "DATA": switch (t.toLowerCase()) { case "metric": return this.DATA.metric[this.BYTE[0]]; case "imperial": return this.DATA.imperial[this.BYTE[0]]; default: console.error(t + " measurement system is not supported.") } default: console.error(e + " measurement domain is not supported.") } } }, db = h(function e() { O(this, e), this.LOCAL_STORAGE_KEY = "iv_unit_key", cb.init(), this.unitSystems = ["metric", "imperial"], this.defaultSystem = "metric" }), hb = function() { function e() { O(this, e), this.UnitService = new db } return h(e, [{ key: "scopedConvert", value: function(e, t) { return this.convert(e, t, 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 2, 3 < arguments.length ? arguments[3] : void 0, 4 < arguments.length ? arguments[4] : void 0) } }, { key: "convert", value: function(e, t) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 2 , i = 3 < arguments.length ? arguments[3] : void 0 , r = 4 < arguments.length ? arguments[4] : void 0 , a = 5 < arguments.length && void 0 !== arguments[5] && arguments[5]; if (!e) return ""; r = this.getMostRelevantMeasurement(t, i || this.UnitService.currentSystem, e, r); return this.getFormattedMeasurementString(r[0], r[1], n, a) } }, { key: "convertBack", value: function(e, t) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 2 , i = 3 < arguments.length ? arguments[3] : void 0 , r = 4 < arguments.length ? arguments[4] : void 0; if (!e) return ""; var a = cb.getDefaultUnitByDomainAndSystem(t, "metric") , r = this.getMostRelevantMeasurement2(t, i, e, r); return this.getFormattedMeasurementString(r[0], a, n) } }, { key: "getFormattedMeasurementString", value: function(e, t, n, i) { t = i && t.name === cb.FOOT[0] ? this.formatImperialDistance(12 * e) : i && t.name === cb.INCH[0] ? this.formatImperialDistance(e) : e.toLocaleString(void 0, { minimumFractionDigits: n, maximumFractionDigits: n }) + " " + t.symbol; return t } }, { key: "formatImperialDistance", value: function(e) { var t = Math.round(8 * e) , n = Math.floor(t / 8) , e = Math.floor(n / 12) , n = n - 12 * e , t = lb[t % 8] , n = 0 == n && "" !== t ? "" : n; return "" !== n && "" !== t && (t = " " + t), 0 !== e ? e + "' " + n + t + '"' : "" + n + t + '"' } }, { key: "getMostRelevantMeasurement", value: function(e, t, n) { var i, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0, a = [], o = cb.getUnitsOfMeasurementByDomainAndSystem(e, t); for (i in o) a.push(o[i]); t = a.filter(function(e) { return e.factor >= r }).reduce(function(e, t) { return t.fromBase(n) < e.fromBase(n) && 1 <= t.fromBase(n) ? t : e }); return t ? [t.fromBase(n), t] : void 0 } }, { key: "getMostRelevantMeasurement2", value: function(e, t, n) { var i, r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0, a = [], o = cb.getUnitsOfMeasurementByDomainAndSystem(e, t); for (i in o) a.push(o[i]); t = a.filter(function(e) { return e.factor >= r }).reduce(function(e, t) { return t.toBase(n) < e.toBase(n) && 1 <= t.toBase(n) ? t : e }); return t ? [t.toBase(n), t] : void 0 } }]), e }(), pb = new _c, fb = new ua(1,1), mb = { nearBound: 2, scale: .5, restricMeshScale: !0 }, vb = function() { y(n, hn); var t = w(n); function n() { var e; return O(this, n), (e = t.call(this)).route = [], e.curve = [], e.scenePoints = [], e.sceneMeshGroup = new Si, e.mapMeshGroup = new Si, e.generateDeferred, viewer.addEventListener("loadPointCloudDone", e.init.bind(g(e))), e.lastResult, e.datasetIds = [], e } return h(n, [{ key: "init", value: function() { var n, e, i = this; this.inited || (viewer.mapViewer.addEventListener("camera_changed", function(e) { var t; i.routeStart && i.routeEnd && (t = e.viewport.camera, Fm.intervalTool.isWaiting("routeCameraInterval", function() { if (t.zoom != n) return i.updateMapArrows(!0), n = t.zoom, !0 }, A.isMobile() ? 500 : 200)) }), viewer.addEventListener("camera_changed", function(e) { i.routeStart && i.routeEnd && e.changeInfo.positionChanged && Fm.intervalTool.isWaiting("routeCameraInterval", function() { return i.updateArrowDisplay(), !0 }, 1e3) }), (e = { shadowMat: new $i({ transparent: !0, depthTest: !1, map: pb.load(Potree.resourcePath + "/textures/pano_instruction_bottomMarker.png") }), sphereMat: new $i({ transparent: !0, depthTest: !1, map: pb.load(Potree.resourcePath + "/textures/whiteCircle.png") }), hatMats: { start: new $i({ transparent: !0, depthTest: !1, map: pb.load(Potree.resourcePath + "/textures/pano_instruction_start_route.png") }), end: new $i({ transparent: !0, depthTest: !1, map: pb.load(Potree.resourcePath + "/textures/pano_instruction_target_reached.png") }) } }).shadowMat.map.anisotropy = 4, this.poleStart = this.createPole(e, "start"), this.poleEnd = this.createPole(e, "end"), this.sceneMeshGroup.add(this.poleStart), this.sceneMeshGroup.add(this.poleEnd), (e = pb.load(Potree.resourcePath + "/textures/routePoint_panorama.png")).anisotropy = 4, this.arrow = new Hr(fb,new $i({ transparent: !0, depthTest: !1, map: e })), this.arrow.scale.set(.5, .5, .5), viewer.setObjectLayers(this.arrow, "sceneObjects"), this.arrows = new Si, this.sceneMeshGroup.add(this.arrows), viewer.setObjectLayers(this.sceneMeshGroup, "sceneObjects"), viewer.scene.scene.add(this.sceneMeshGroup), this.sceneMeshGroup.visible = !1, e = pb.load(Potree.resourcePath + "/textures/routePoint_map_fsna.png"), this.mapArrowMats = { default: new $i({ transparent: !0, depthTest: !1, map: e }), fade: new $i({ transparent: !0, depthTest: !1, map: e, opacity: .4 }) }, this.mapArrow = new Hr(fb,this.mapArrowMats.default), this.mapArrow.scale.set(.5, .5, .5), this.mapArrows = new Si, this.mapArrows.name = "mapArrows", this.mapMeshGroup.add(this.mapArrows), this.mapMeshGroup.name = "mapRouteLayer", this.mapMeshGroup.visible = !1, viewer.mapViewer.dispatchEvent({ type: "add", object: this.mapMeshGroup, name: "route" }), this.mapArrow.layers.mask = this.mapArrows.layers.mask, viewer.modules.SiteModel.bus.addEventListener("FloorChange", function() { i.routeStart && i.routeEnd && i.updateOpacityAtMap() }), this.inited = !0) } }, { key: "updateOpacityAtMap", value: function() { var n = this , i = viewer.modules.SiteModel.currentFloor; this.mapArrows.children.forEach(function(e, t) { t = n.mapPoints[t].clone(); t.z += .3; t = i && i.ifContainsPoint(t); e.material = t ? n.mapArrowMats.default : n.mapArrowMats.fade }), viewer.mapViewer.dispatchEvent("content_changed") } }, { key: "createPole", value: function(e, t) { var n = mb.scale , i = new Si; i.name = "pole_" + t; var r = new Hr(fb,e.shadowMat); r.scale.set(n, n, n); i.add(r); for (var a = 0; a < 6; a++) { var o = new qp({ mat: e.sphereMat }); o.position.set(0, 0, 1.5 / 7 * (a + 1)), o.scale.set(.04, .04, .04), o.visible = !1, i.add(o) } t = new qp({ mat: e.hatMats[t], sizeInfo: mb }); return o.visible = !1, t.position.set(0, 0, 1.5), t.scale.copy(r.scale), i.add(t), i } }, { key: "addTestArrow", value: function() {} }, { key: "addArrow", value: function(e) { var t = this.arrow.clone(); t.position.copy(e), this.arrows.add(t) } }, { key: "addMapArrow", value: function(e) { var t = this.mapArrow.clone(); t.position.copy(e).setZ(0), this.mapArrows.add(t) } }, { key: "setArrowDir", value: function(e, t) { var n = e[t] , t = e[t + 1] , t = t ? t.position : this.endPolePos , t = (new Cn).subVectors(n.position, t).setZ(0) , t = Math.atan2(t.y, t.x) + Math.PI / 2; n.rotation.z = t } }, { key: "setRouteStart", value: function(e, t, n) { this.routeStart && e && this.routeStart.equals(e) || (this.routeStart = e && (new Cn).copy(e), t && this.routeStart && (this.routeStart.setZ(this.getZAtMap()), this.bus && this.bus.emit("reposStartMarker", this.routeStart)), console.log("setRouteStart", this.routeStart && this.routeStart.toArray()), this.datasetIds[0] = n, this.generateRoute()) } }, { key: "setStartPole", value: function(e) { this.startPolePos = e, this.bus && this.bus.emit("reposStartMarker", e) } }, { key: "setRouteEnd", value: function(e, t, n) { this.routeEnd && e && this.routeEnd.equals(e) || (this.routeEnd = e && (new Cn).copy(e), t && this.routeEnd && (this.routeEnd.setZ(this.getZAtMap()), this.bus && this.bus.emit("reposEndMarker", this.routeEnd)), console.log("setRouteEnd", this.routeEnd && this.routeEnd.toArray()), this.datasetIds[1] = n, this.generateRoute()) } }, { key: "getZAtMap", value: function() { var e = Fm.sortByScore(viewer.images360.panos, [], [function(e) { return -Math.abs(e.position.z - viewer.images360.position.z) } ]) , e = e && e[0] && e[0].item; return e ? e.floorPosition.z : viewer.bound.boundingBox.min.z + 1 } }, { key: "setEndPole", value: function(e) { this.endPolePos = e, this.bus && this.bus.emit("reposEndMarker", e) } }, { key: "getSourceProjectionIndex", value: function(e) { e = e.findIndex(function(e) { return e.instruction && "source_projection_to_navgraph" === e.instruction.type }); return e < 0 ? 0 : e } }, { key: "getDestinationProjectionIndex", value: function(e) { var t = e.findIndex(function(e) { return e.instruction && "destination_projection_to_navgraph" === e.instruction.type }); return t < 0 ? e.length - 1 : t } }, { key: "generateRoute", value: function() { var a = this; if (this.routeStart && this.routeEnd) { var i = function() { a.routeLength = a.route.reduce(function(e, t, n, i) { return 0 == n ? 0 : e + t.distanceTo(i[n - 1]) }, 0); var e = Math.max(2, Math.round(+a.routeLength)) , t = new Bc(a.route); t.curveType = "chordal"; var n = (a.curve = t).getSpacedPoints(e); n.splice(0, 1), n.pop(), a.scenePoints = n, a.updateMapArrows(), a.displayRoute(); var i = new yn(1,1) , r = new ph; a.route.forEach(function(e) { r.expandByPoint(e) }); t = r.getSize(new yn), e = new yn(115,40), n = viewer.mapViewer.viewports[0].resolution2, n = n.x * n.y; 32e4 < n && e.multiplyScalar(n / 32e4); e = t.clone().divide(viewer.mapViewer.viewports[0].resolution2).multiply(e); t.add(e); e = r.getCenter(new yn); t.x = Math.max(t.x, i.x), t.y = Math.max(t.y, i.y); viewer.mapViewer.moveTo(e, t, 1e3), a.bus.emit("gotResult", { dis: a.routeLength }) }; if (Potree.fileServer) { var t = function(e) { if (!e.data) return console.log("没有数据"), t = e && 4002 == e.code ? e : a.routeStart.distanceTo(a.routeEnd) < 1 ? { code: 500, msg: "距离太短,无法规划路线" } : { code: 500, msg: "超出数据集范围,无法规划路线" }, a.clearRoute(), a.setStartPole(a.routeStart), a.setEndPole(a.routeEnd), a.displayRoute(), void (a.bus && a.bus.emit("gotResult", t)); e = e.data, a.clearRoute(); var t, n = e.length; n < 2 ? (console.log("路径点数为" + n + ",直接取起点和终点连线"), a.route = [a.routeStart, a.routeEnd]) : (t = a.getSourceProjectionIndex(e), n = a.getDestinationProjectionIndex(e), e.slice(t, n + 1).forEach(function(e, t) { e = viewer.transform.lonlatToLocal.forward(e.location.slice(0)), e = (new Cn).fromArray(e); a.route.push(e) }), console.log(a.route)), a.setStartPole(a.route[0]), a.setEndPole(a.route[a.route.length - 1]), i() }; if (this.lastResult && (this.lastResult.data || 4002 != this.lastResult.data.code)) { var e = Fm.CloneObject(this.lastResult.data); if (this.lastResult.routeStart.equals(this.routeStart) && this.lastResult.routeEnd.equals(this.routeEnd) ? l = !0 : this.lastResult.routeStart.equals(this.routeEnd) && this.lastResult.routeEnd.equals(this.routeStart) && (l = !0, e.data && (e.data = this.lastResult.data.data.slice(0).reverse())), l) return console.log("直接用上次的结果"), setTimeout(function() { t(e) }, 1) } var n, r = this.routeStart.clone(), o = this.routeEnd.clone(), s = viewer.transform.lonlatToLocal.inverse(r), l = viewer.transform.lonlatToLocal.inverse(o), u = { source_longitude: s.x, source_latitude: s.y, source_z: r.z, destination_longitude: l.x, destination_latitude: l.y, destination_z: o.z }, c = "/laser/route/".concat(Potree.settings.number, "/getRoute/").concat(Potree.settings.originDatasetId, "?"); for (n in u) c += n + "=" + u[n] + "&"; Potree.fileServer.get(c).then(function(e) { console.log(e.data), a.routeStart && a.routeEnd && (a.lastResult = { routeStart: a.routeStart.clone(), routeEnd: a.routeEnd.clone(), data: e }, t(e)) }) } else this.clearRoute(), this.route = [this.routeStart, this.routeEnd], i() } } }, { key: "updateMapArrows", value: function(e) { var t, n; 0 != this.route.length && (n = viewer.mapViewer.camera.zoom, (t = Math.max(2, Math.round(this.routeLength * n / 25))) != this.mapPoints.length + 1 && ((t = this.curve.getSpacedPoints(t)).splice(0, 1), t.pop(), this.mapPoints = t, this.mapArrow.scale.set(.6 * (n = 25 / n), .6 * n, .6 * n), e && (this.clearRoute({ resetMap: !0 }), this.displayRoute({ resetMap: !0 })), this.updateOpacityAtMap())) } }, { key: "updateArrowDisplay", value: function() { var n; 0 != this.scenePoints.length && (n = viewer.scene.getActiveCamera().position, this.arrows.children.forEach(function(e, t) { e.position.distanceTo(n) < 10 ? e.visible = !0 : e.visible = !1 })) } }, { key: "displayRoute", value: function() { var n = this; (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).resetMap || (this.poleStart.position.copy(this.startPolePos || this.routeStart), this.poleEnd.position.copy(this.endPolePos || this.routeEnd), this.scenePoints.forEach(function(e) { return n.addArrow(e) }), this.arrows.children.forEach(function(e, t) { return n.setArrowDir(n.arrows.children, t) })), this.sceneMeshGroup.traverse(function(e) { return e.visible = !0 }), this.mapMeshGroup.visible = !0, this.mapPoints.forEach(function(e) { return n.addMapArrow(e) }), this.mapArrows.children.forEach(function(e, t) { return n.setArrowDir(n.mapArrows.children, t) }), viewer.mapViewer.dispatchEvent({ type: "content_changed" }), this.updateArrowDisplay() } }, { key: "clearRoute", value: function() { var t = this; (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).resetMap || (this.routeLength = 0, this.route = [], this.scenePoints = [], this.mapPoints = [], this.arrows.children.slice(0).forEach(function(e) { t.arrows.remove(e) })), this.mapArrows.children.slice(0).forEach(function(e) { t.mapArrows.remove(e) }), this.sceneMeshGroup.traverse(function(e) { return e.visible = !1 }), this.mapMeshGroup.visible = !1, viewer.mapViewer.dispatchEvent({ type: "content_changed" }) } }, { key: "clear", value: function() { console.log("导航clear"), this.routeStart = null, this.routeEnd = null, this.clearRoute() } }]), n }(), gb = (new Wr(1,1,1,1), new $i({ wireframe: !0, color: "#ffffff" }), function() { y(o, gl); var a = w(o); function o(e) { var t, n; for (n in O(this, o), t = a.call(this), e) t[n] = e[n]; t.strength = t.strength || 1, t.radius = e.radius || 1, t.height = e.height || 5, t.computeParams(), t.geometry = t.createGeometry(t.radius, t.height, t.particleCount), null == t.color && (t.color = 16724480), t.createMaterial(), t.velocity = new Cn, t.acceleration = new Cn, t.angle = 0, t.angleVelocity = 0, t.angleAcceleration = 0, t.size = 16, t.opacity = 1, t.age = 0, t.alive = 0, t.sizeTween = null, t.colorTween = null, t.opacityTween = null, t.setSize({ viewport: viewer.mainViewport }), t.setFov(viewer.fov); function i(e) { "MainView" == e.viewport.name && t.setSize(e) } function r(e) { t.setFov(e.fov) } return viewer.addEventListener("resize", i), viewer.addEventListener("fov_changed", r), t.addEventListener("dispose", function() { viewer.removeEventListener("resize", i), viewer.removeEventListener("fov_changed", r) }), t } return h(o, [{ key: "computeParams", value: function() { var e = (this.curve ? this.curve.wholeLength : 0) + 2 * this.radius; this.size = .3 + 2.7 * gn.smoothstep(this.radius, .3, 10), this.particleCount = Math.ceil(e * Math.sqrt(this.strength * this.height) * this.radius / (this.size * this.size) * 25) } }, { key: "getPointsForBound", value: function() { return this.boundPoints } }, { key: "getBound", value: function(e) { var n = this; this.boundPoints = []; var i = new kn , t = .13 * this.size + .3; e.forEach(function(e) { var t = e.clone(); t.z += n.height, i.expandByPoint(e), i.expandByPoint(t), n.boundPoints.push(e, t) }); e = this.radius + t; i.expandByVector(new Cn(e,e,t)), this.boundingBox = i } }, { key: "createGeometry", value: function(e, t, n) { var i, r, a = new Mr; 1 < this.positions.length ? (i = Math.ceil(this.curve.wholeLength / .2) + 1, i = (r = this.curve.getSpacedPoints(i)).length, this.getBound(r)) : this.getBound(this.positions); for (var o = new Float32Array(3 * n), s = new Float32Array(n), l = new Float32Array(n), u = new Float32Array(n), c = 0; c < n; c++) { var d, h, p = (new Cn).copy(1 < this.positions.length ? r[Math.floor(c / n * i)] : this.positions[0]); u[c] = p.z, 0 === c ? (o[3 * c + 0] = p.x, o[3 * c + 1] = p.y, o[3 * c + 2] = p.z) : (d = Math.sqrt(Math.random()) * e, h = 2 * Math.random() * Math.PI, o[3 * c + 0] = p.x + Math.cos(h) * d, o[3 * c + 1] = p.y + Math.sin(h) * d, o[3 * c + 2] = p.z + (e - d) / e * t / 2 + t / 2, l[c] = .25 * (4 * Math.random() | 0), s[c] = Math.random()) } return a.setAttribute("centerHeight", new nr(u,1)), a.setAttribute("position", new nr(o,3)), a.setAttribute("randam", new nr(s,1)), a.setAttribute("sprite", new nr(l,1)), a } }, { key: "updateGeometry", value: function() { this.computeParams(), this.geometry.dispose(), this.geometry = this.createGeometry(this.radius, this.height, this.particleCount), this.material.uniforms.size.value = this.size } }, { key: "createMaterial", value: function() { var e = new Qr({ uniforms: { color: { type: "c", value: new Yi(this.color) }, size: { type: "f", value: this.size }, u_sampler: { type: "t", value: Q1 = Q1 || (new _c).load(Potree.resourcePath + "/textures/fire.png") }, time: { type: "f", value: 0 }, heightOfNearPlane: { type: "f", value: 0 }, height: { type: "f", value: this.height } }, vertexShader: "\n attribute float randam;\n attribute float sprite;\n attribute float centerHeight; //add\n \n //uniform float fireHeight; //add \n uniform float time;\n uniform float size;\n uniform float heightOfNearPlane;\n \n \n \n \n //varying float heightRatio;\n varying float vSprite;\n varying float vOpacity; \n float PI = 3.14;\n\n float quadraticIn( float t ) \n { \n float tt = t * t;\n return tt * tt; \n //变化曲线 越来越快\n } \n \n void main() {\n float progress = fract( time + ( 2.0 * randam - 1.0 ) );\n float progressNeg = 1.0 - progress;\n float ease = quadraticIn( progress );\n float influence = sin( PI * ease );\n //vec3 newPosition = position * vec3( 1.0, 1.0 , ease);\n vec3 newPosition = position;\n newPosition.z = (newPosition.z - centerHeight) * ease + centerHeight;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4( newPosition, 1.0 );\n gl_PointSize = ( heightOfNearPlane * size ) / gl_Position.w;\n vOpacity = min( influence * 4.0, 1.0 ) * progressNeg;\n vSprite = sprite;\n \n //heightRatio = (newPosition.z - centerHeight) / fireHeight ;\n \n }\n", fragmentShader: "\n uniform vec3 color;\n uniform sampler2D u_sampler;\n\n varying float vSprite;\n varying float vOpacity;\n //varying float heightRatio;\n\n void main() \n {\n \n \n vec2 texCoord = vec2(gl_PointCoord.x * 0.25 + vSprite, gl_PointCoord.y);\n \n gl_FragColor = vec4( texture2D( u_sampler, texCoord ).xyz * color * vOpacity, 1.0 );\n \n \n }\n", blending: ee, depthTest: !0, depthWrite: !1, transparent: !0 }); this.material = e, this.setPerspective(this.fov, this.screenHeight) } }, { key: "setSize", value: function(e) { e = e.viewport; this.screenHeight = e.resolution.y, this.setPerspective(this.fov, this.screenHeight) } }, { key: "setFov", value: function(e) { this.fov = e, this.setPerspective(this.fov, this.screenHeight) } }, { key: "setPerspective", value: function(e, t) { e = Math.abs(t / (2 * Math.tan(gn.degToRad(.5 * e)))); this.material.uniforms.heightOfNearPlane.value = e } }, { key: "update", value: function(e) { viewer.getObjVisiByReason(this, "force") && (Potree.Utils.isInsideFrustum(this.boundingBox, viewer.scene.getActiveCamera()) ? (viewer.updateVisible(this, "isInsideFrustum", !0), this.material.uniforms.time.value = (this.material.uniforms.time.value + (e *= 1)) % 1) : viewer.updateVisible(this, "isInsideFrustum", !1)) } }, { key: "dispose", value: function() { this.geometry.dispose(), this.material.dispose(), this.dispatchEvent("dispose") } }]), o }()), yb = function() { function n(e, t) { O(this, n), this.times = e || [], this.values = t || [] } return h(n, [{ key: "lerp", value: function(e) { if (0 != this.times.length) { for (var t = 0, n = this.times.length; t < n && e > this.times[t]; ) t++; if (0 == t) return this.values[0]; if (t == n) return this.values[n - 1]; var i = (e - this.times[t - 1]) / (this.times[t] - this.times[t - 1]); return this.values[0]instanceof Cn ? this.values[t - 1].clone().lerp(this.values[t], i) : this.values[t - 1] + i * (this.values[t] - this.values[t - 1]) } } }, { key: "clone", value: function() { return Fm.CloneClassObject(this) } }]), n }(), wb = function() { function t() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; O(this, t), this.position = new Cn, this.velocity = new Cn, this.angle = 0, this.angleVelocity = 0, this.angleAcceleration = 0, this.size = 16, this.color = new Yi, this.opacity = 1, this.age = 0, this.alive = 0, this.lastChangeVage = 0, this.sizeTween = e.sizeTween || new yb([0, 1],[32, 128]), this.opacityTween = e.opacityTween || new yb([.8, 2],[.5, 0]), this.colorTween = e.colorTween || new yb([.4, 1],[new Cn(0,0,.2), new Cn(0,0,.5)]) } return h(t, [{ key: "update", value: function(e) { this.position.add(this.velocity.clone().multiplyScalar(e)), this.velocity.multiplyScalar(1 + this.acceleration * e), this.angle += .01745329251 * this.angleVelocity * e, this.angleVelocity += .01745329251 * this.angleAcceleration * e, this.age += e, 0 < this.sizeTween.times.length && (this.size = this.sizeTween.lerp(this.age / this.deathAge)), 0 < this.colorTween.times.length && (e = this.colorTween.lerp(this.age / this.deathAge), this.color = (new Yi).setHSL(e.x, e.y, e.z)), 0 < this.opacityTween.times.length && (this.opacity = this.opacityTween.lerp(this.age / this.deathAge)) } }]), t }(), bb = "\n attribute vec3 customColor;\n attribute float customOpacity;\n attribute float customSize;\n attribute float customAngle;\n attribute float customVisible; \n uniform float heightOfNearPlane;\n \n \n varying vec4 vColor;\n varying float vAngle;\n void main()\n {\n if ( customVisible > 0.5 ) \t\t\t\t\n vColor = vec4( customColor, customOpacity ); \n else\t\t\t\t\t\t\t\n vColor = vec4(0.0, 0.0, 0.0, 0.0);\t\t\n \n vAngle = customAngle;\n\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n //gl_PointSize = customSize * ( 300.0 / length( mvPosition.xyz ) ); \n gl_Position = projectionMatrix * mvPosition;\n gl_PointSize = ( heightOfNearPlane * customSize ) / gl_Position.w;\n \n \n }\n", xb = (Object.freeze({ CUBE: 1, SPHERE: 2 }), new Wr(1,1,1,1), new $i({ wireframe: !0, color: "#ffffff" }), { positions: [], positionStyle: "sphere", positionBase: new Cn(0,0,0), positionSpread: new Cn(1,1,0), radius: 1, velocityStyle: "cube", velocityBase: new Cn(0,0,.5), velocitySpread: new Cn(1,1,.3), accelerationBase: .3, accelerationSpread: .6, speedBase: .1, speedSpread: .5, angleBase: 0, angleSpread: 360, angleVelocityBase: 1, angleVelocitySpread: 30, angleAccelerationBase: 1, angleAccelerationSpread: 5, sizeBase: 0, sizeSpread: 0, sizeTween: [[0, .3, 1], [.3, 1.4, 6]], colorBase: new Cn(0,1,.5), colorSpread: new Cn(0,0,0), colorTween: new yb([.2, 1],[new Cn(0,0,.4), new Cn(0,0,.1)]), opacityBase: .1, opacitySpread: .2, opacityTween: [[0, .1, .9, 1], [.1, .4, .03, 0]], strength: 1, particleDeathAge: 3, height: 3 }), Eb = (new Hr(new Tu(.03,5,5),new $i({ color: "white", depthTest: !1 })), function() { y(s, gl); var o = w(s); function s() { var t, e, n = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; for (e in O(this, s), (t = o.call(this)).blendStyle = K, t.emitterAge = 0, n = $.extend({}, xb, n)) { var i = n[e]; i instanceof Array && i[0]instanceof Array ? t[e] = B(yb, Q(i)) : t[e] = i instanceof Cn || i instanceof Yi ? i.clone() : i } t.defaultSizeTween = t.sizeTween.clone(), t.defaultOpacityTween = t.opacityTween.clone(), t.geometry = new Mr, t.computeParams(), t.createMaterial(), t.createGeometry(), t.dynamic = !0, t.sortParticles = !0, t.frustumCulled = !1, n.position && t.position.copy(n.position), t.setSize({ viewport: viewer.mainViewport }), t.setFov(viewer.fov); function r(e) { "MainView" == e.viewport.name && t.setSize(e) } function a(e) { t.setFov(e.fov) } return viewer.addEventListener("resize", r), viewer.addEventListener("fov_changed", a), t.addEventListener("dispose", function() { viewer.removeEventListener("resize", r), viewer.removeEventListener("fov_changed", a) }), t } return h(s, [{ key: "computeParams", value: function() { var e = (this.curve ? this.curve.wholeLength : 0) + 2 * this.radius; "cube" == this.positionStyle && this.positionSpread.set(this.radius, this.radius, 0), this.velocityBase.set(0, 0, (this.height - .5 * this.accelerationBase * this.particleDeathAge * this.particleDeathAge) / this.particleDeathAge), this.velocityBase.z = Math.max(0, this.velocityBase.z), this.particleCount = Math.ceil(e * Math.sqrt(this.strength * this.height * this.radius)), this.particleCount = Math.max(5, this.particleCount); var t = +gn.smoothstep(this.strength, .01, 1) + 1; this.sizeTween.values = this.defaultSizeTween.values.map(function(e) { return e * t }); var n = 1 + .5 * gn.smoothstep(this.strength, .01, 1); this.opacityTween.values = this.defaultOpacityTween.values.map(function(e) { return e * n }) } }, { key: "reStart", value: function() { this.emitterAge = 0, this.createGeometry() } }, { key: "updateGeometry", value: function() { this.computeParams(), this.reStart() } }, { key: "createParticle", value: function(e) { var t, n, i, r = new wb({ sizeTween: this.sizeTween, opacityTween: this.opacityTween, colorTween: this.colorTween }); r.deathAge = this.particleDeathAge, r.center = e, "cube" == this.positionStyle && (r.position = this.randomVector3(this.positionBase, this.positionSpread)), "sphere" == this.positionStyle && (t = 2 * Math.random() - 1, i = 2 * Math.PI * Math.random(), n = Math.sqrt(1 - t * t), i = new Cn(n * Math.cos(i),t,.2 * Math.abs(n * Math.sin(i))), r.position = (new Cn).addVectors(this.positionBase, i.multiplyScalar(this.radius))), r.position.add(e), "cube" == this.velocityStyle && (r.velocity = this.randomVector3(this.velocityBase, this.velocitySpread)), "sphere" == this.velocityStyle && (e = new Cn(0,0,1), a = this.randomValue(this.speedBase, this.speedSpread), r.velocity = e.normalize().multiplyScalar(a)), r.acceleration = this.randomValue(this.accelerationBase, this.accelerationSpread), r.angle = this.randomValue(this.angleBase, this.angleSpread), r.angleVelocity = this.randomValue(this.angleVelocityBase, this.angleVelocitySpread), r.angleAcceleration = this.randomValue(this.angleAccelerationBase, this.angleAccelerationSpread), r.size = this.randomValue(this.sizeBase, this.sizeSpread); var a = this.randomVector3(this.colorBase, this.colorSpread); return r.color = (new Yi).setHSL(a.x, a.y, a.z), r.opacity = this.randomValue(this.opacityBase, this.opacitySpread), r.age = 0, r.alive = 0, r } }, { key: "getPointsForBound", value: function() { return this.boundPoints } }, { key: "getBound", value: function(e) { var n = this; this.boundPoints = []; var i = new kn , t = .11 * this.sizeTween.values.slice().sort(function(e, t) { return t - e })[0] , r = .5 + t; e.forEach(function(e) { var t = e.clone(); t.z += n.height, i.expandByPoint(e), i.expandByPoint(t), n.boundPoints.push(e, t) }); e = this.radius + r; i.expandByVector(new Cn(e,e,0)), i.min.z -= t, i.max.z += r, this.boundingBox = i } }, { key: "createGeometry", value: function() { this.particleArray = []; var e, i, r, t, n = [], a = [], o = [], s = [], l = [], u = []; 1 < this.positions.length ? (e = Math.ceil(this.curve.wholeLength / .6) + 1, e = (i = this.curve.getSpacedPoints(e)).length, r = i.slice(), t = function(e) { var t = Math.random() , n = Math.floor(r.length * t) , t = r[n]; return 1 == r.length ? r = i.slice() : r.splice(n, 1), t } , this.getBound(i)) : this.getBound(this.positions); for (var c = 0; c < this.particleCount; c++) { var d = (new Cn).copy(1 < this.positions.length ? t(c) : this.positions[0]); this.particleArray[c] = this.createParticle(d), n[3 * c] = this.particleArray[c].position.x, n[3 * c + 1] = this.particleArray[c].position.y, n[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 } this.geometry.setAttribute("position", new nr(new Float32Array(n),3)), this.geometry.setAttribute("customColor", new nr(new Float32Array(a),3)), this.geometry.setAttribute("customVisible", new nr(new Float32Array(o),1)), this.geometry.setAttribute("customOpacity", new nr(new Float32Array(s),1)), this.geometry.setAttribute("customSize", new nr(new Float32Array(l),1)), this.geometry.setAttribute("customAngle", new nr(new Float32Array(u),1)) } }, { key: "createMaterial", value: function() { var e; this.material = new Qr((H(e = { uniforms: { u_sampler: { type: "t", value: K1 = K1 || (new _c).load(Potree.resourcePath + "/textures/smokeparticle.png") }, heightOfNearPlane: { type: "f", value: 0 } }, vertexShader: bb }, "vertexShader", bb), H(e, "fragmentShader", "\n uniform sampler2D u_sampler;\n varying vec4 vColor;\t\n varying float vAngle; \n void main()\n {\n gl_FragColor = vColor;\n \n float c = cos(vAngle);\n float s = sin(vAngle);\n vec2 rotatedUV = vec2(c * (gl_PointCoord.x - 0.5) + s * (gl_PointCoord.y - 0.5) + 0.5, c * (gl_PointCoord.y - 0.5) - s * (gl_PointCoord.x - 0.5) + 0.5); \n vec4 rotatedTexture = texture2D( u_sampler, rotatedUV );\n gl_FragColor = gl_FragColor * rotatedTexture; \n }\n"), H(e, "transparent", !0), H(e, "alphaTest", .5), H(e, "blending", this.blendStyle), H(e, "depthTest", this.blendStyle != K), e)), this.setPerspective(this.fov, this.screenHeight) } }, { key: "update", value: function(e) { if (viewer.getObjVisiByReason(this, "force")) if (Potree.Utils.isInsideFrustum(this.boundingBox, viewer.scene.getActiveCamera())) { viewer.updateVisible(this, "isInsideFrustum", !0), 1 < e && console.log("update dt>1", e); for (var t, n = [], i = [], r = [], a = [], o = [], s = [], l = [], u = [], c = 0; c < this.particleCount; c++) this.particleArray[c].alive && ("cube" == this.velocityStyle && (t = Math.random(), this.particleArray[c].age - this.particleArray[c].lastChangeVage > this.particleDeathAge * t && (this.particleArray[c].velocity = this.randomVector3(this.velocityBase, this.velocitySpread), this.particleArray[c].lastChangeVage = this.particleArray[c].age)), this.particleArray[c].update(e), this.particleArray[c].age > this.particleDeathAge && (this.particleArray[c].alive = 0, n.push(c), i.push((this.particleArray[c].age - this.particleDeathAge) % this.particleDeathAge)), r[3 * c] = this.particleArray[c].position.x, r[3 * c + 1] = this.particleArray[c].position.y, r[3 * c + 2] = this.particleArray[c].position.z, a[3 * c] = this.particleArray[c].color.r, a[3 * c + 1] = this.particleArray[c].color.g, a[3 * c + 2] = this.particleArray[c].color.b, o[c] = this.particleArray[c].alive, s[c] = this.particleArray[c].opacity, l[c] = this.particleArray[c].size, u[c] = this.particleArray[c].angle); if (this.geometry.setAttribute("position", new nr(new Float32Array(r),3)), this.geometry.setAttribute("customColor", new nr(new Float32Array(a),3)), this.geometry.setAttribute("customVisible", new nr(new Float32Array(o),1)), this.geometry.setAttribute("customOpacity", new nr(new Float32Array(s),1)), this.geometry.setAttribute("customSize", new nr(new Float32Array(l),1)), this.geometry.setAttribute("customAngle", new nr(new Float32Array(u),1)), this.geometry.attributes.customColor.needsUpdate = !0, this.geometry.attributes.customVisible.needsUpdate = !0, this.geometry.attributes.customOpacity.needsUpdate = !0, this.geometry.attributes.customSize.needsUpdate = !0, this.geometry.attributes.customAngle.needsUpdate = !0, this.emitterAge < this.particleDeathAge) { var d = this.particleCount / this.particleDeathAge , h = Math.round(d * (this.emitterAge + 0)) , p = Math.round(d * (this.emitterAge + e)); p > this.particleCount && (p = this.particleCount); for (c = h; c < p; c++) this.particleArray[c].alive = 1 } for (var f = 0; f < n.length; f++) { c = n[f]; this.particleArray[c] = this.createParticle(this.particleArray[c].center), this.particleArray[c].alive = 1, this.particleArray[c].age = i[f], 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 } this.geometry.setAttribute("position", new nr(new Float32Array(r),3)), this.geometry.attributes.position.needsUpdate = !0, this.emitterAge += e } else viewer.updateVisible(this, "isInsideFrustum", !1) } }, { key: "randomValue", value: function(e, t) { var n = Math.random(); return e * n + t * (1 - n) } }, { key: "randomVector3", value: function(e, t) { var n = new Cn(Math.random() - .5,Math.random() - .5,Math.random() - .5); return (new Cn).addVectors(e, (new Cn).multiplyVectors(t, n)) } }, { key: "setSize", value: function(e) { e = e.viewport; this.screenHeight = e.resolution.y, this.setPerspective(this.fov, this.screenHeight) } }, { key: "setFov", value: function(e) { this.fov = e, this.setPerspective(this.fov, this.screenHeight) } }, { key: "setPerspective", value: function(e, t) { e = Math.abs(t / (2 * Math.tan(gn.degToRad(.5 * e)))); this.material.uniforms.heightOfNearPlane.value = e } }, { key: "dispose", value: function() { this.geometry.dispose(), this.material.dispose(), this.dispatchEvent("dispose") } }]), s }()), _b = Math.PI / 180, Mb = function() { function e() { O(this, e), this.position = new Cn, this.velocity = new Cn, this.angle = 0, this.angleVelocity = 0, this.angleAcceleration = 0, this.size = 16, this.color = new Yi, this.opacity = 1, this.rebornCount = 0, this.age = 0, this.alive = 0, this.deadAge = 0, this.sizeTween = null, this.colorTween = null, this.opacityTween = null } return h(e, [{ key: "update", value: function(e) { this.position.add(this.velocity.clone().multiplyScalar(e)), this.velocity.multiplyScalar(1 + this.acceleration * e), this.angle += this.angleVelocity * _b * e, this.angleVelocity += this.angleAcceleration * _b * e, this.age += e, 0 < this.sizeTween.times.length && (this.size = this.sizeTween.lerp(this.age / this.deathAge)), 0 < this.colorTween.times.length && (e = this.colorTween.lerp(this.age / this.deathAge), this.color = (new Yi).setHSL(e.x, e.y, e.z)), 0 < this.opacityTween.times.length && (this.opacity = this.opacityTween.lerp(this.age / this.deathAge)) } }]), e }(), Ab = new (function() { function e() { O(this, e) } return h(e, [{ key: "randomValue", value: function(e, t) { var n = Math.random(); return e * n + t * (1 - n) } }, { key: "randomVector3", value: function(e, t) { var n = new Cn(Math.random() - .5,Math.random() - .5,Math.random() - .5); return (new Cn).addVectors(e, (new Cn).multiplyVectors(t, n)) } }]), e }()), Tb = 1, Sb = 2, Cb = (new Tu(1,10,4), new $i({ wireframe: !0, color: "#ffffff" }), { position: new Cn(0,0,1), positionShape: Sb, positionRange: new Cn(1,1,1), radius: 1.3, velocityShape: Sb, velocity: new Cn(0,0,2), velocityRange: new Cn(0,0,3), speed: .4, speedRange: 1, size: .4, sizeRange: 2, sizeTween: [[0, .04, .2, 1], [.1, 1, 6, 8]], color: new Cn(1,1,1), colorRange: new Cn(0,0,0), colorTween: new yb, opacity: 1, opacityRange: 0, opacityTween: new yb([0, .06, .3, .8, 1],[0, 1, .3, .05, 0]), blendMode: ee, acceleration: .5, accelerationRange: 0, angle: 0, angleRange: 0, angleVelocity: 0, angleVelocityRange: 0, angleAcceleration: 0, angleAccelerationRange: 0, strength: 1, particleDeathAge: .7, recycleTimes: 3, particleSpaceTime: 3 }), Pb = function() { y(a, gl); var r = w(a); function a(e) { var t; O(this, a), (t = r.call(this)).age = 0, t.alive = !0, t.loop = !0, t.blendMode = K, t.setParameters(e), t.createParticles(), t.frustumCulled = !1, t.setSize({ viewport: viewer.mainViewport }), t.setFov(viewer.fov); function n(e) { "MainView" == e.viewport.name && t.setSize(e) } function i(e) { t.setFov(e.fov) } return viewer.addEventListener("resize", n), viewer.addEventListener("fov_changed", i), t.addEventListener("dispose", function() { viewer.removeEventListener("resize", n), viewer.removeEventListener("fov_changed", i) }), t } return h(a, [{ key: "computeParams", value: function() { this.curve && this.position.copy(this.curve.points[0]); var t = .8 + 9.2 * gn.smoothstep(this.radius * this.strength, .2, 20); this.sizeTween.values = this.defaultSizeTween.values.map(function(e) { return e * t }), this.particleCount = Math.ceil(this.strength * this.radius * 5), this.speed = Cb.speed * this.radius, this.speedRange = Cb.speedRange * this.radius, console.log(this.particleCount), this.boundPoints = [], this.boundPoints.push(this.position.clone()); var e = this.sizeTween.values.slice().sort(function(e, t) { return t - e })[0] , n = this.radius + (.35 * e + .5) , e = new qn(this.position,n); this.boundingSphere = e, this.boundingBox = (new kn).setFromCenterAndSize(this.position, new Cn(2 * n,2 * n,2 * n)) } }, { key: "getPointsForBound", value: function() { return this.boundPoints } }, { key: "reStart", value: function() { this.age = 0, this.createParticles() } }, { key: "setParameters", value: function(e) { for (var t in e = $.extend({}, Cb, e)) { var n = e[t]; "position" == t ? this.position.copy(n) : n instanceof Array && n[0]instanceof Array ? this[t] = B(yb, Q(n)) : this[t] = n instanceof Cn || n instanceof Yi ? n.clone() : n } this.defaultSizeTween = this.sizeTween.clone(), this.particles = [], this.age = 0, this.alive = !0, this.geometry = new Mr, this.computeParams(), this.material = new Qr({ uniforms: { u_sampler: { value: this.texture || ($1 = $1 || (new _c).load(Potree.resourcePath + "/textures/explode.png")) }, heightOfNearPlane: { type: "f", value: 0 } }, vertexShader: "\n attribute vec3 color;\n attribute float size;\n attribute float angle;\n attribute float opacity;\n attribute float visible;\n varying vec4 vColor;\n varying float vAngle;\n uniform float heightOfNearPlane;\n \n void main() {\n if(visible > 0.5) {\n vColor = vec4(color, opacity);\n } else {\n vColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n vAngle = angle;\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n \n gl_PointSize = ( heightOfNearPlane * size ) / gl_Position.w;\n }\n", fragmentShader: "\n uniform sampler2D u_sampler;\n varying vec4 vColor;\n varying float vAngle;\n void main() {\n gl_FragColor = vColor;\n float u = cos(vAngle);\n float v = sin(vAngle);\n vec2 uv = vec2(\n u * (gl_PointCoord.x - 0.5) + v * (gl_PointCoord.y - 0.5) + 0.5, \n u * (gl_PointCoord.y - 0.5) - v * (gl_PointCoord.x - 0.5) + 0.5\n );\n vec4 texture = texture2D(u_sampler, uv);\n gl_FragColor = gl_FragColor * texture;\n }\n", transparent: !0, alphaTest: .5, depthTest: this.blendMode == K, blending: this.blendMode }) } }, { key: "createParticles", value: function() { this.particles = []; for (var e = this.particleCount, t = new Float32Array(3 * e), n = new Float32Array(3 * e), i = new Float32Array(e), r = new Float32Array(e), a = new Float32Array(e), o = new Float32Array(e), s = 0; s < e; s++) { var l = this.createParticle(); this.particles[s] = l } this.geometry.setAttribute("position", new nr(t,3)), this.geometry.setAttribute("color", new nr(n,3)), this.geometry.setAttribute("angle", new nr(r,1)), this.geometry.setAttribute("size", new nr(i,1)), this.geometry.setAttribute("visible", new nr(o,1)), this.geometry.setAttribute("opacity", new nr(a,1)) } }, { key: "createParticle", value: function() { var e, t, n, i = new Mb; i.sizeTween = this.sizeTween, i.colorTween = this.colorTween, i.opacityTween = this.opacityTween, i.deathAge = this.particleDeathAge, this.positionShape == Tb && (i.position = Ab.randomVector3(new Cn, this.positionRange)), this.positionShape == Sb && (e = 2 * Math.random() - 1, n = 2 * Math.PI * Math.random(), t = Math.sqrt(1 - e * e), n = new Cn(t * Math.cos(n),e,t * Math.sin(n)), i.position = n.multiplyScalar(this.radius)), this.velocityShape == Tb && (i.velocity = Ab.randomVector3(this.velocity, this.velocityRange)), this.velocityShape == Sb && (n = (new Cn).addVectors(i.position, new Cn(0,0,2 * this.radius)), r = Ab.randomValue(this.speed, this.speedRange), i.velocity = n.normalize().multiplyScalar(r)), i.acceleration = Ab.randomValue(this.acceleration, this.accelerationRange), i.angle = Ab.randomValue(this.angle, this.angleRange), i.angleVelocity = Ab.randomValue(this.angleVelocity, this.angleVelocityRange), i.angleAcceleration = Ab.randomValue(this.angleAcceleration, this.angleAccelerationRange), i.size = Ab.randomValue(this.size, this.sizeRange); var r = Ab.randomVector3(this.color, this.colorRange); return i.color = (new Yi).setHSL(r.x, r.y, r.z), i.opacity = Ab.randomValue(this.opacity, this.opacityRange), i } }, { key: "update", value: function(e) { if (viewer.getObjVisiByReason(this, "force")) { if (0 < this.delayStartTime) return this.delayStartTime -= e; if (Potree.Utils.isInsideFrustum(this.boundingSphere, viewer.scene.getActiveCamera())) { viewer.updateVisible(this, "isInsideFrustum", !0), 1 < e && console.log("update dt>1", 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; h < this.particleCount; h++) { var p, f = this.particles[h]; f.alive ? (f.update(e), f.age > t && (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.age < t) { var m = Math.round(this.particleCount * (this.age + 0) / t) , v = Math.round(this.particleCount * (this.age + e) / t); v > this.particleCount && (v = this.particleCount); for (var g = m; g < v; g++) this.particles[g].alive = 1 } for (var y = 0; y < i.length; y++) { var w = i[y]; this.particles[w] = this.createParticle(), this.particles[w].alive = 1, this.particles[w].age = r[y], this.particles[w].rebornCount = a[y] } this.geometry.attributes.position.needsUpdate = !0, this.age += e, this.age > this.deathAge && !this.loop && (this.alive = !1) } } else viewer.updateVisible(this, "isInsideFrustum", !1) } } }, { key: "setSize", value: function(e) { e = e.viewport; this.screenHeight = e.resolution.y, this.setPerspective(this.fov, this.screenHeight) } }, { key: "setFov", value: function(e) { this.fov = e, this.setPerspective(this.fov, this.screenHeight) } }, { key: "setPerspective", value: function(e, t) { e = Math.abs(t / (2 * Math.tan(gn.degToRad(.5 * e)))); this.material.uniforms.heightOfNearPlane.value = e } }, { key: "updateGeometry", value: function() { this.computeParams(), this.reStart() } }, { key: "dispose", value: function() { this.geometry.dispose(), this.material.dispose(), this.dispatchEvent("dispose") } }]), a }(), Db = { "fire+smoke": 16777215, smoke: 16777215, explode: 16777215 }, kb = { clipDistance: 100, occlusionDistance: 60, maxClipFactor: .5, backColor: "#777", useDepth: !0, transparent: !0 }, Bb = { bus: new Dh, particleGroup: new Si, curveGroup: new Si, init: function() { this.particleGroup.name = "particles", viewer.scene.scene.add(this.particleGroup), this.curveGroup.name = "particles-curves", viewer.scene.scene.add(this.curveGroup) }, addParticle: function() { var e, t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; return "fire" == t.type ? e = new gb(t) : "smoke" == t.type ? e = new Eb(t) : "explode" == t.type && (e = new Pb(t)), this.particleGroup.add(e), e }, removeParticle: function(e) { e.dispose(), this.particleGroup.remove(e), e.curve.dispose() }, update: function(t) { this.particleGroup.children.forEach(function(e) { return e.update(t) }) }, startInsertion: function() { var t = this , n = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "fire" , i = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {} , r = $.Deferred() , a = [] , o = function(e) { e && r.resolve(a), viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "addSth" }), viewer.removeEventListener("global_click", u), t.bus.removeEventListener("cancel_insertions", l) } , s = new hv([],Y1(n),Db[n],n + "_curve",{ handleMat: Z1(n) }); this.curveGroup.add(s), i.curve = s, i.type = n; var l = function() { console.log("cancel_insertions", s.uuid), s.dispose(), o(!1) }; this.bus.dispatchEvent("cancel_insertions"), this.bus.addEventListener("cancel_insertions", l); var u = function(e) { if (e.button !== C.RIGHT) { e = e.intersect && (e.intersect.orthoIntersect || e.intersect.location); if (e) return s.addPoint(e, null, !0), "explode" == n && (a = t.createFromData(i), o(!0)), { stopContinue: !0 } } else 1 <= s.points.length && (a = t.createFromData(i), o(!0)) }; return viewer.addEventListener("global_click", u, 10), viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "addSth" }), r.promise() }, createFromData: function(e) { var t, n, i = e.type, r = [], a = e.curve; return a || (a = new hv(e.points,Y1(i),Db[i],i + "_curve",{ handleMat: Z1(i) }), this.curveGroup.add(a)), i.includes("fire") || i.includes("smoke") ? (i.includes("fire") && (t = this.addParticle({ type: "fire", positions: a.points, curve: a, radius: e.radius, height: e.height, strength: e.strength }), r.push(t)), i.includes("smoke") && (t = this.addParticle({ type: "smoke", positions: a.points, curve: a, positionStyle: "sphere", strength: e.smokeStrength, radius: e.smokeRadius, height: e.smokeHeight }), r.push(t))) : "explode" == i && (e = this.addParticle({ type: "explode", position: a.points[0], strength: e.strength, radius: e.radius, particleSpaceTime: e.particleSpaceTime, curve: a, delayStartTime: e.delayStartTime }), r.push(e)), a.addEventListener("dragCurvePoint", function() { n = !0, Fm.intervalTool.isWaiting("particlePointChange", function() { if (n) return r.forEach(function(e) { return e.updateGeometry() }), n = !1, a.dispatchEvent("sendUpdatePoints"), !0 }, 400) }), r } }, Lb = { createAnimation: function(e) { var t = new bv(viewer); if (e) { t.name = e.name, t.duration = e.duration, t.useDurSlice = e.useDurSlice; var n, i = ue(e.points); try { for (i.s(); !(n = i.n()).done; ) { var r = n.value , a = (new Cn).copy(r.position) , o = (new Cn).copy(r.target) , s = r.time; t.createControlPoint(null, { position: a, target: o, duration: s }) } } catch (e) { i.e(e) } finally { i.f() } } return t.changeCallback(), viewer.scene.addCameraAnimation(t), t }, removeAnimation: function(e) { e.dispatchEvent("dispose"), viewer.scene.removeCameraAnimation(e) } }, Rb = new _c; Rb.crossOrigin = "anonymous"; var Fb, Ib, Ob, zb, Nb, Ub, Gb, Hb, Vb, jb = {}, Wb = {}, Xb = 3, qb = 2, Jb = 1, Yb = "#c60", Zb = "#17c", Qb = 1.3, Kb = 2, $b = [{ name: "top", axis: ["x", "y"], direction: new Cn(0,0,-1), openCount: 0 }, { name: "right", axis: ["y", "z"], direction: new Cn(1,0,0), openCount: 0 }], ex = new (function() { y(n, hn); var t = w(n); function n() { var e; return O(this, n), (e = t.call(this)).panoGroup = [], e.viewports = {}, e.panoLink = {}, e.panoMeshs = new Si, e.lineMeshes = new Si, e.views = {}, e.cameras = {}, e.orthoCamera = new ed(-100,100,100,100,.01,1e4), e.selectedPano, e.selectedGroup, e.operation, e.visiblePanos = [], e } return h(n, [{ key: "init", value: function() { var i = this; jb.default = Sf.createFatLineMat({ color: "#eeeeee", lineWidth: 2, depthTest: !1 }), jb.hovered = Sf.createFatLineMat({ color: "#00c8af", lineWidth: 2, depthTest: !1 }), jb.selected = Sf.createFatLineMat({ color: "#00c8af", lineWidth: 3, depthTest: !1 }), this.initViews(), viewer.addEventListener("allLoaded", function() { var t; nb = viewer.images360, ib = viewer.modules.Alignment, rb = viewer.modules.SiteModel, i.panoMeshs.name = "panoMeshs", viewer.scene.scene.add(i.panoMeshs), i.lineMeshes.name = "lineMeshes", viewer.scene.scene.add(i.lineMeshes), i.initPanoLink(), i.addPanoMesh(), viewer.scene.pointclouds.forEach(function(e) { e.material.color = Zb }), i.switchView("top"), rb.bus.addEventListener("initDataDone", function() { var e = rb.entities.find(function(e) { return "floor" == e.buildType && e.panos.length }); e || (e = "all", console.log("没有一层有漫游点?!")), i.gotoFloor(e) }), ib.bus.addEventListener("switchHandle", i.updateCursor.bind(i)), viewer.addEventListener("global_click", function(e) { e.button === C.RIGHT ? (console.log("right click", e), i.setLinkOperateState("addLink", !1), i.setLinkOperateState("removeLink", !1)) : i.clickToZoomInEnabled && (i.zoomIn(e.intersect.orthoIntersect, e.pointer), i.setZoomInState(!1)) }), i.rotGuideLine = Sf.createLine([], { color: "#aaffee" }), i.rotGuideLine.visible = !1, i.rotGuideLine.name = "rotGuideLine", i.rotGuideLine.renderOrder = Jb, viewer.scene.scene.add(i.rotGuideLine), ib.bus.addEventListener("rotateStart", function(e) { t = e.startPoint }), ib.bus.addEventListener("rotate", function(e) { Sf.updateLine(i.rotGuideLine, [t, e.endPoint]), i.rotGuideLine.visible = !0 }), viewer.fpControls.addEventListener("end", function(e) { t = null, i.rotGuideLine.visible = !1 }), i.linkGuideLine = Sf.createLine([], { color: "#aaa", deshed: !0, dashSize: .1, gapSize: .1 }), i.linkGuideLine.visible = !1, i.linkGuideLine.name = "linkGuideLine", viewer.scene.scene.add(i.linkGuideLine), i.linkGuideLine.renderOrder = Jb; function n(e) { if ("addLink" != i.operation || "top" != i.activeViewName || !i.selectedPano) return i.linkGuideLine.visible = !1; Sf.updateLine(i.linkGuideLine, [i.selectedPano.position, e.intersect.orthoIntersect.clone().setZ(i.selectedPano.position.z)]), i.linkGuideLine.visible = !0 } viewer.addEventListener("global_mousemove", function(e) { n(e) }), i.addEventListener("updateLinkGuideLine", n) }) } }, { key: "initViews", value: function() { this.splitScreenTool = new A1, this.targetPlane = viewer.mainViewport.targetPlane = new ki, this.shiftTarget = viewer.mainViewport.shiftTarget = new Cn; for (var e = 0; e < 2; e++) { var t = $b[e] , n = new ng; this.views[t.name] = n, this.cameras[t.name] = this.orthoCamera, n.direction = t.direction } this.views.mainView = viewer.mainViewport.view, this.cameras.mainView = viewer.mainViewport.camera } }, { key: "switchView", value: function(t) { var n = this , i = this.views[t] , e = this.cameras[t] , r = $b.find(function(e) { return e.name == t }) , a = viewer.bound , o = a.boundSize , s = a.center; this.lastViewName = this.activeViewName, this.activeViewName = t; var l, u = this.views[this.lastViewName], a = this.cameras[this.lastViewName]; viewer.mainViewport.view = i, viewer.mainViewport.camera = e, a && (u.zoom = a.zoom), this.targetPlane.setFromNormalAndCoplanarPoint(i.direction.clone(), s), this.targetPlane.projectPoint(i.position, this.shiftTarget), i.position.copy(this.splitScreenTool.getPosOutOfModel(viewer.mainViewport)), i.zoom && (e.zoom = i.zoom), viewer.updateScreenSize({ forceUpdateSize: !0 }), this.updateCursor(), "mainView" == t ? (viewer.mainViewport.alignment = null, viewer.scene.pointclouds.forEach(function(e) { e.material.activeAttributeName = "rgba", e.material.useFilterByNormal = !1, e.changePointOpacity(1, !0) }), viewer.updateVisible(viewer.reticule, "force", !0), u && (i.copy(u), l = i.direction, u = nb.panos.filter(function(e) { return e.circle.visible }), u = Fm.sortByScore(u, [], [function(e) { return -(new Cn).subVectors(e.position, i.position).dot(l) } ], !0), console.log("最近", u), u && u[0] && (e = a.top / a.zoom / Math.tan(gn.degToRad(e.fov / 2)), i.position.add(l.clone().multiplyScalar(-u[0].score - e)), this.lastDisToPano = e)), viewer.fpControls.lockKey = !1) : (0 == r.openCount && this.viewportFitBound(t, o, s), r.openCount++, viewer.scene.pointclouds.forEach(function(e) { e.material.activeAttributeName = "color", e.material.useFilterByNormal = !0, n.selectedPano && n.selectedClouds.includes(e) ? e.changePointOpacity(Kb, !0) : e.changePointOpacity(Qb, !0) }), viewer.updateVisible(viewer.reticule, "force", !1), "top" == t && (viewer.mainViewport.alignment = { rotate: !0, translate: !0 }), "right" == t ? (viewer.mainViewport.alignment = { translate: !0, rotateSide: !0 }, viewer.mainViewport.rotateSide = !0) : viewer.mainViewport.rotateSide = !1, viewer.fpControls.lockKey = !0), this.setZoomInState(!1) } }, { key: "viewportFitBound", value: function() { var e = this; if (0 == viewer.mainViewport.resolution.x || 0 == viewer.mainViewport.resolution.y) return setTimeout(function() { e.viewportFitBound() }, 10); this.gotoFloor(this.currentFloor, !0, 0, null, !0) } }, { key: "rotateSideCamera", value: function(e) { this.splitScreenTool.rotateSideCamera(viewer.mainViewport, e) } }, { key: "zoomIn", value: function(e, t) { var n = viewer.mainViewport.camera; 700 <= n.zoom || viewer.mainViewport.view.zoomOrthoCamera(n, 700, t, 300) } }, { key: "moveFit", value: function(e, t, n) { this.splitScreenTool.viewportFitBound(viewer.mainViewport, t.bound, e, n, { x: 200, y: 230 }) } }, { key: "setZoomInState", value: function(e, t) { if (e && "mainView" == this.activeViewName) return console.log("3D不可放大"); this.clickToZoomInEnabled = !!e, e ? viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "zoomInCloud" }) : viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "zoomInCloud" }), e || t || this.dispatchEvent({ type: "operationCancel", operation: "zoomIn" }) } }, { key: "gotoFloor", value: function(e, t) { var n, i, r, a = this, o = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 600, s = 3 < arguments.length ? arguments[3] : void 0, l = 4 < arguments.length ? arguments[4] : void 0; this.currentFloor == (e = e || "all") && !t || (n = ("all" == e ? viewer.images360 : e).panos, viewer.images360.panos.forEach(function(e) { var t = n.includes(e); a.switchPanoVisible(e, t) }), this.updateLinesVisible(), this.selectedPano && "all" != e && !e.panos.includes(this.selectedPano) && this.selectedPano.circle.dispatchEvent("click"), this.selectedLine && this.selectedLine.dispatchEvent("click"), "all" == e ? (i = viewer.images360.bound.bounding, r = viewer.images360.bound.center) : (r = (i = this.getPanosBound(e)).getCenter(new Cn), 0 == e.panos.length && console.log(e.name, "floor无漫游点")), "mainView" != this.activeViewName ? l && this.moveFit(r, { bound: i }, o) : "mainView" == this.activeViewName && "all" != e && viewer.scene.view.setView({ position: r, duration: o }), this.currentFloor = e, s || this.dispatchEvent({ type: "changeFloor", floor: e })) } }, { key: "getPanosBound", value: function(e) { var t; return e.panosBound || (0 == e.panos.length ? e.panosBound = viewer.images360.bound.bounding.clone() : (t = new Cn(5,5,5), t = Up.getBoundByPoints(e.panos.map(function(e) { return e.position }), t), e.panosBound = t.bounding)), e.panosBound } }, { key: "switchPanoVisible", value: function(e, t, n) { var i; e.circle.visible = t, viewer.updateVisible(e, "panoEditor", t), viewer.updateVisible(e.pointcloud, "panoEditor", t), t ? this.visiblePanos.includes(e) || this.visiblePanos.push(e) : -1 < (i = this.visiblePanos.indexOf(e)) && this.visiblePanos.splice(i, 1), n && this.updateLinesVisible(), n || this.dispatchEvent({ type: "switchPanoVisible", pano: e, v: t }) } }, { key: "updateLinesVisible", value: function() { var i = this; this.lineMeshes.children.forEach(function(e) { var t = e.name.split("-") , n = nb.getPano(t[0]) , t = nb.getPano(t[1]); e.visible = i.visiblePanos.includes(n) || i.visiblePanos.includes(t) }) } }, { key: "updateCursor", value: function() { var e = "mainView" != this.activeViewName && this.selectedPano ? ib.handleState : null; "rotate" == e ? (viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "rotatePointcloud" }), viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "movePointcloud" })) : ("translate" == e ? viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "movePointcloud" }) : viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "movePointcloud" }), viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "rotatePointcloud" })) } }, { key: "setLinkOperateState", value: function(e, t, n) { var i; t && e == this.operation || !t && e != this.operation || (i = this.operation, this.operation = t ? e : null, "removeLink" == this.operation && (this.selectedLine && this.selectedLine.dispatchEvent("click"), this.selectedPano && this.selectedPano.circle.dispatchEvent("click")), "addLink" != this.operation && (this.linkGuideLine.visible = !1), t || n || this.dispatchEvent({ type: "operationCancel", operation: i }), "addLink" == this.operation ? viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "connectPano" }) : viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "connectPano" }), "removeLink" == this.operation ? viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "disconnectPano" }) : viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "disconnectPano" })) } }, { key: "initPanoLink", value: function() { var n = this; nb.panos.forEach(function(e) { n.panoLink[e.id] = {} }), nb.panos.forEach(function(t) { t.visibles.forEach(function(e) { n.linkChange(t, nb.getPano(e, "index"), "add") }) }), console.log("panoLink", this.panoLink) } }, { key: "groupChange", value: function(n, i, e) { var r = this; "add" == e ? Fm.pushToGroupAuto([n, i], this.panoGroup) : (e = this.panoGroup.find(function(e) { return e.includes(n) && (e.includes(i) || !i) })) ? (this.panoGroup.splice(this.panoGroup.indexOf(e), 1), e.forEach(function(e) { if (e != n && e != i) for (var t in r.panoLink[e.id]) r.panoLink[e.id][t] && (t = nb.getPano(t), Fm.pushToGroupAuto([e, t], r.panoGroup)) })) : i ? console.log("这两个pano原本就不在一个组", n.id, i.id) : console.log("pano0不在任何组", n) } }, { key: "linkChange", value: function(t, e, n) { var i = this , r = []; if ("add" == n) { if (!e) return console.error("不支持add时pano1为空"); this.panoLink[t.id][e.id] = this.panoLink[t.id][e.id] || {}, this.panoLink[e.id][t.id] = this.panoLink[e.id][t.id] || {} } else if (e) this.panoLink[t.id][e.id] = !1, this.panoLink[e.id][t.id] = !1; else { for (var a in this.panoLink[t.id]) this.panoLink[t.id][a] && (this.panoLink[a][t.id] = !1, r.push(a)); this.panoLink[t.id] = {} } e ? this.lineChange(t, e, n) : r.forEach(function(e) { i.lineChange(t, nb.getPano(e), n) }), this.groupChange(t, e, n), this.selectPano(this.selectedPano, !1, !0) } }, { key: "lineChange", value: function(t, n, e) { var i, r = this; "add" == e ? this.panoLink[t.id][n.id].line || ((i = Sf.createFatLine([t.position, n.position], { material: jb.default })).name = "".concat(t.id, "-").concat(n.id), i.renderOrder = i.pickOrder = Jb, this.lineMeshes.add(i), (this.panoLink[t.id][n.id].line = this.panoLink[n.id][t.id].line = i).addEventListener("mouseover", function() { r.clickToZoomInEnabled || "mainView" != r.activeViewName && (r.selectedLine != i && (i.material = jb.hovered), viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "hoverLine" })) }), i.addEventListener("mouseleave", function() { r.clickToZoomInEnabled || (r.selectedLine != i && (i.material = jb.default), viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "hoverLine" })) }), i.addEventListener("click", function(e) { if (!r.clickToZoomInEnabled && "mainView" != r.activeViewName) return "removeLink" == r.operation ? (r.selectedLine == i && r.selectLine(null), r.linkChange(t, n, "remove")) : void r.selectLine(i) })) : (e = this.lineMeshes.children.find(function(e) { return e.name == "".concat(t.id, "-").concat(n.id) || e.name == "".concat(n.id, "-").concat(t.id) })) && (this.lineMeshes.remove(e), e.geometry.dispose()) } }, { key: "selectLine", value: function(e) { this.selectedLine != e && (this.selectedLine && (this.selectedLine.material = jb.default), e && (e.material = jb.selected), this.selectedLine = e) } }, { key: "addPanoMesh", value: function() { var i = this , e = Rb.load(Potree.resourcePath + "/textures/correct_n.png"); Wb.default = new $i({ map: e, color: 16777215, transparent: !0, depthTest: !1, depthWrite: !1 }), Wb.hovered = new $i({ map: e, color: 16776960, transparent: !0, depthTest: !1, depthWrite: !1 }), Wb.selected = new $i({ map: Rb.load(Potree.resourcePath + "/textures/correct_s.png"), color: 16777215, transparent: !0, depthTest: !1, depthWrite: !1 }); function n(e) { for (var t in e.position.copy(e.pano.position), i.panoLink[e.pano.id]) { var n = i.panoLink[e.pano.id][t]; n && Sf.updateLine(n.line, [e.pano.position, nb.getPano(t).position]) } e.update() } nb.panos.forEach(function(e) { var t = new qp({ mat: Wb.default, sizeInfo: { minSize: 50, maxSize: 120, nearBound: 2, farBound: 10 }, renderOrder: qb, pickOrder: qb }); t.name = "panoCircle", t.sid = e.id, (t.pano = e).circle = t, i.panoMeshs.add(t), n(t), e.addEventListener("rePos", n.bind(i, t)); t.addEventListener("drag", function() { "mainView" != i.activeViewName && (i.selectPano(t.pano), viewer.inputHandler.drag.object = null) }), t.addEventListener("mouseover", function() { i.hoverPano(e, !0) }), t.addEventListener("mouseleave", function() { i.hoverPano(e, !1) }), t.addEventListener("click", function() { if (!i.clickToZoomInEnabled) { if ("removeLink" == i.operation && i.linkChange(e, null, "remove"), i.selectedPano == t.pano) return i.selectPano(null); "addLink" == i.operation && i.selectedPano ? i.linkChange(i.selectedPano, t.pano, "add") : i.selectPano(t.pano) } }) }) } }, { key: "hoverPano", value: function(e, t) { this.clickToZoomInEnabled || (e && t ? this.hoveredPano != e && (this.hoveredPano && this.hoverPano(this.hoveredPano, !1), (this.hoveredPano = e).hovered = !0, ib.handleState && this.selectedPano && this.selectedPano == e || ("addLink" == this.operation && this.selectedPano && this.selectedPano != e || viewer.dispatchEvent({ type: "CursorChange", action: "add", name: "hoverPano" }), this.selectedPano != e && (e.circle.material = Wb.hovered))) : e && !t ? this.hoveredPano == e && (e.hovered = !1, viewer.dispatchEvent({ type: "CursorChange", action: "remove", name: "hoverPano" }), this.selectedPano != e && (e.circle.material = Wb.default), this.hoveredPano = null) : this.hoveredPano && this.hoverPano(this.hoveredPano, !1)) } }, { key: "selectPano", value: function(t, e, n) { var i; this.selectedPano == t && !n || (i = this.selectedPano, this.selectedPano && (this.selectedPano.circle.material = Wb.default, this.selectedPano.circle.renderOrder = qb, "mainView" != this.activeViewName && this.selectedClouds.forEach(function(e) { e.changePointOpacity(Qb, !0), e.material.color = Zb })), this.selectedPano = t || null, this.updateSelectGroup(), t && (this.selectedPano.circle.material = Wb.selected, this.selectedPano.circle.renderOrder = this.selectedPano.circle.pickOrder = Xb, "mainView" != this.activeViewName && this.selectedClouds.forEach(function(e) { e.changePointOpacity(Kb, !0), e.material.color = Yb }), n = rb.entities.find(function(e) { return "floor" == e.buildType && e.panos.includes(t) }) || "all", this.gotoFloor(n, !1, 600)), this.updateCursor(), e ? this.selectedPano && ("mainView" == this.activeViewName ? (e = this.lastDisToPano || 5, i && (e = viewer.mainViewport.camera.position.distanceTo(i.position)), viewer.focusOnObject({ position: this.selectedPano.position }, "point", null, { distance: e })) : this.moveFit(this.selectedPano.position, {}, 500)) : this.dispatchEvent({ type: "panoSelect", pano: t })) } }, { key: "updateSelectGroup", value: function() { var t = this; this.selectedGroup = this.panoGroup.find(function(e) { return e.includes(t.selectedPano) }), this.selectedClouds = this.selectedPano ? (this.selectedGroup || [this.selectedPano]).map(function(e) { return e.pointcloud }) : [] } }, { key: "checkIfCanSave", value: function() { for (var e in Potree.settings.datasetsPanos) if (!this.checkIfAllLinked({ datasetId: e })) return void console.log("没有全部连通,不能保存。其中一个:", e); return !0 } }, { key: "checkIfAllLinked", value: function(e) { var t; if (e.group) { var n = e.group , i = e.group[0]; if (!i) return; t = i.pointcloud.dataset_id } else if (e.datasetId && (t = e.datasetId, !(n = this.panoGroup.find(function(e) { return e[0].pointcloud.dataset_id == t })))) return; return Potree.settings.datasetsPanos[t].panos.length == n.length } }, { key: "exportSavingData", value: function() { var e, i = this, t = {}; const rotQua = (new Sn()).setFromAxisAngle(new Cn(0,0,1), Math.PI) //add for (e in Potree.settings.datasetsPanos) { var n = Potree.settings.datasetsPanos[e].panos.map(function(e) { var t, n = []; for (t in i.panoLink[e.id]) i.panoLink[e.id][t] && n.push(viewer.images360.getPano(t).index); return Object.assign({}, e.panosData, { uuid: e.uuid, pose: { translation: r(e.position.clone()), rotation: r((new Sn).setFromRotationMatrix(e.panoMatrix).premultiply(rotQua)) }, visibles: n }) }); t[e] = { sweepLocations: n } } function r(e) { e = Up.toPrecision(e, 6); return e instanceof Sn ? { x: e.x, y: e.y, z: e.z, w: e.w } : e instanceof Cn ? { x: e.x, y: e.y, z: e.z } : void 0 } return console.log(t), t } }]), n }()), tx = (Fb = /^[og]\s*(.+)?/, Ib = /^mtllib /, Ob = /^usemtl /, zb = /^usemap /, Nb = new Cn, Ub = new Cn, Gb = new Cn, Hb = new Cn, Vb = new Cn, ix.prototype = Object.assign(Object.create(mc.prototype), { constructor: ix, load: function(n, i, e, r) { var a = this , t = new gc(this.manager); t.setPath(this.path), t.setRequestHeader(this.requestHeader), t.setWithCredentials(this.withCredentials), t.load(n, function(e, t) { try { i(a.parse(e), t) } catch (e) { r ? r(e) : console.error(e), a.manager.itemError(n) } }, e, r) }, setMaterials: function(e) { return this.materials = e, this }, parse: function(e) { for (var t, n, i, r = new nx, a = (e = -1 !== (e = -1 !== e.indexOf("\r\n") ? e.replace(/\r\n/g, "\n") : e).indexOf("\\\n") ? e.replace(/\\\n/g, "") : e).split("\n"), o = "", s = [], l = "function" == typeof "".trimLeft, u = 0, c = a.length; u < c; u++) if (o = a[u], 0 !== (o = l ? o.trimLeft() : o.trim()).length && "#" !== (t = o.charAt(0))) if ("v" === t) { var d = o.split(/\s+/); switch (d[0]) { case "v": r.vertices.push(parseFloat(d[1]), parseFloat(d[2]), parseFloat(d[3])), 7 <= d.length ? r.colors.push(parseFloat(d[4]), parseFloat(d[5]), parseFloat(d[6])) : r.colors.push(void 0, void 0, void 0); break; case "vn": r.normals.push(parseFloat(d[1]), parseFloat(d[2]), parseFloat(d[3])); break; case "vt": r.uvs.push(parseFloat(d[1]), parseFloat(d[2])) } } else if ("f" === t) { for (var h = o.substr(1).trim().split(/\s+/), p = [], f = 0, m = h.length; f < m; f++) { var v = h[f]; 0 < v.length && (v = v.split("/"), p.push(v)) } for (var g = p[0], f = 1, m = p.length - 1; f < m; f++) { var y = p[f] , w = p[f + 1]; r.addFace(g[0], y[0], w[0], g[1], y[1], w[1], g[2], y[2], w[2]) } } else if ("l" === t) { var b = o.substring(1).trim().split(" ") , x = [] , E = []; if (-1 === o.indexOf("/")) x = b; else for (var _ = 0, M = b.length; _ < M; _++) { var A = b[_].split("/"); "" !== A[0] && x.push(A[0]), "" !== A[1] && E.push(A[1]) } r.addLineGeometry(x, E) } else "p" === t ? (n = o.substr(1).trim().split(" "), r.addPointGeometry(n)) : null !== (s = Fb.exec(o)) ? (i = (" " + s[0].substr(1).trim()).substr(1), r.startObject(i)) : Ob.test(o) ? r.object.startMaterial(o.substring(7).trim(), r.materialLibraries) : Ib.test(o) ? r.materialLibraries.push(o.substring(7).trim()) : zb.test(o) ? console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.') : "s" === t ? (1 < (s = o.split(" ")).length ? (i = s[1].trim().toLowerCase(), r.object.smooth = "0" !== i && "off" !== i) : r.object.smooth = !0, (U = r.object.currentMaterial()) && (U.smooth = r.object.smooth)) : "\0" !== o && console.warn('THREE.OBJLoader: Unexpected line: "' + o + '"'); r.finalize(); var T = new us; T.materialLibraries = [].concat(r.materialLibraries); var e = !(1 === r.objects.length && 0 === r.objects[0].geometry.vertices.length); if (!0 == e) for (u = 0, c = r.objects.length; u < c; u++) { var S, C = r.objects[u], P = C.geometry, D = C.materials, k = "Line" === P.type, B = "Points" === P.type, L = !1; if (0 !== P.vertices.length) { (S = new Mr).setAttribute("position", new dr(P.vertices,3)), 0 < P.normals.length && S.setAttribute("normal", new dr(P.normals,3)), 0 < P.colors.length && (L = !0, S.setAttribute("color", new dr(P.colors,3))), !0 === P.hasUVIndices && S.setAttribute("uv", new dr(P.uvs,2)); for (var R, F = [], I = 0, O = D.length; I < O; I++) { var z, N = (G = D[I]).name + "_" + G.smooth + "_" + L, U = r.materials[N]; null !== this.materials && (U = this.materials.create(G.name), !k || !U || U instanceof tl ? !B || !U || U instanceof hl || (z = new hl({ size: 10, sizeAttenuation: !1 }), Ki.prototype.copy.call(z, U), z.color.copy(U.color), z.map = U.map, U = z) : (z = new tl, Ki.prototype.copy.call(z, U), z.color.copy(U.color), U = z)), void 0 === U && ((U = k ? new tl : B ? new hl({ size: 1, sizeAttenuation: !1 }) : new ju).name = G.name, U.flatShading = !G.smooth, U.vertexColors = L, r.materials[N] = U), F.push(U) } if (1 < F.length) { for (I = 0, O = D.length; I < O; I++) { var G = D[I]; S.addGroup(G.groupStart, G.groupCount, I) } R = new (k ? cl : B ? gl : Hr)(S,F) } else R = new (k ? cl : B ? gl : Hr)(S,F[0]); R.name = C.name, T.add(R) } } else 0 < r.vertices.length && (U = new hl({ size: 1, sizeAttenuation: !1 }), (S = new Mr).setAttribute("position", new dr(r.vertices,3)), 0 < r.colors.length && void 0 !== r.colors[0] && (S.setAttribute("color", new dr(r.colors,3)), U.vertexColors = !0), e = new gl(S,U), T.add(e)); return T } }), ix); function nx() { var e = { objects: [], object: {}, vertices: [], normals: [], colors: [], uvs: [], materials: {}, materialLibraries: [], startObject: function(e, t) { if (this.object && !1 === this.object.fromDeclaration) return this.object.name = e, void (this.object.fromDeclaration = !1 !== t); var n = this.object && "function" == typeof this.object.currentMaterial ? this.object.currentMaterial() : void 0; this.object && "function" == typeof this.object._finalize && this.object._finalize(!0), this.object = { name: e || "", fromDeclaration: !1 !== t, geometry: { vertices: [], normals: [], colors: [], uvs: [], hasUVIndices: !1 }, materials: [], smooth: !0, startMaterial: function(e, t) { var n = this._finalize(!1); n && (n.inherited || n.groupCount <= 0) && this.materials.splice(n.index, 1); n = { index: this.materials.length, name: e || "", mtllib: Array.isArray(t) && 0 < t.length ? t[t.length - 1] : "", smooth: (void 0 !== n ? n : this).smooth, groupStart: void 0 !== n ? n.groupEnd : 0, groupEnd: -1, groupCount: -1, inherited: !1, clone: function(e) { e = { index: "number" == typeof e ? e : this.index, name: this.name, mtllib: this.mtllib, smooth: this.smooth, groupStart: 0, groupEnd: -1, groupCount: -1, inherited: !1 }; return e.clone = this.clone.bind(e), e } }; return this.materials.push(n), n }, currentMaterial: function() { if (0 < this.materials.length) return this.materials[this.materials.length - 1] }, _finalize: function(e) { var t = this.currentMaterial(); if (t && -1 === t.groupEnd && (t.groupEnd = this.geometry.vertices.length / 3, t.groupCount = t.groupEnd - t.groupStart, t.inherited = !1), e && 1 < this.materials.length) for (var n = this.materials.length - 1; 0 <= n; n--) this.materials[n].groupCount <= 0 && this.materials.splice(n, 1); return e && 0 === this.materials.length && this.materials.push({ name: "", smooth: this.smooth }), t } }, n && n.name && "function" == typeof n.clone && ((n = n.clone(0)).inherited = !0, this.object.materials.push(n)), this.objects.push(this.object) }, finalize: function() { this.object && "function" == typeof this.object._finalize && this.object._finalize(!0) }, parseVertexIndex: function(e, t) { e = parseInt(e, 10); return 3 * (0 <= e ? e - 1 : e + t / 3) }, parseNormalIndex: function(e, t) { e = parseInt(e, 10); return 3 * (0 <= e ? e - 1 : e + t / 3) }, parseUVIndex: function(e, t) { e = parseInt(e, 10); return 2 * (0 <= e ? e - 1 : e + t / 2) }, addVertex: function(e, t, n) { var i = this.vertices , r = this.object.geometry.vertices; r.push(i[e + 0], i[e + 1], i[e + 2]), r.push(i[t + 0], i[t + 1], i[t + 2]), r.push(i[n + 0], i[n + 1], i[n + 2]) }, addVertexPoint: function(e) { var t = this.vertices; this.object.geometry.vertices.push(t[e + 0], t[e + 1], t[e + 2]) }, addVertexLine: function(e) { var t = this.vertices; this.object.geometry.vertices.push(t[e + 0], t[e + 1], t[e + 2]) }, addNormal: function(e, t, n) { var i = this.normals , r = this.object.geometry.normals; r.push(i[e + 0], i[e + 1], i[e + 2]), r.push(i[t + 0], i[t + 1], i[t + 2]), r.push(i[n + 0], i[n + 1], i[n + 2]) }, addFaceNormal: function(e, t, n) { var i = this.vertices , r = this.object.geometry.normals; Nb.fromArray(i, e), Ub.fromArray(i, t), Gb.fromArray(i, n), Vb.subVectors(Gb, Ub), Hb.subVectors(Nb, Ub), Vb.cross(Hb), Vb.normalize(), r.push(Vb.x, Vb.y, Vb.z), r.push(Vb.x, Vb.y, Vb.z), r.push(Vb.x, Vb.y, Vb.z) }, addColor: function(e, t, n) { var i = this.colors , r = this.object.geometry.colors; void 0 !== i[e] && r.push(i[e + 0], i[e + 1], i[e + 2]), void 0 !== i[t] && r.push(i[t + 0], i[t + 1], i[t + 2]), void 0 !== i[n] && r.push(i[n + 0], i[n + 1], i[n + 2]) }, addUV: function(e, t, n) { var i = this.uvs , r = this.object.geometry.uvs; r.push(i[e + 0], i[e + 1]), r.push(i[t + 0], i[t + 1]), r.push(i[n + 0], i[n + 1]) }, addDefaultUV: function() { var e = this.object.geometry.uvs; e.push(0, 0), e.push(0, 0), e.push(0, 0) }, addUVLine: function(e) { var t = this.uvs; this.object.geometry.uvs.push(t[e + 0], t[e + 1]) }, addFace: function(e, t, n, i, r, a, o, s, l) { var u, c = this.vertices.length, e = this.parseVertexIndex(e, c), t = this.parseVertexIndex(t, c), c = this.parseVertexIndex(n, c); this.addVertex(e, t, c), this.addColor(e, t, c), void 0 !== o && "" !== o ? (u = this.normals.length, e = this.parseNormalIndex(o, u), t = this.parseNormalIndex(s, u), c = this.parseNormalIndex(l, u), this.addNormal(e, t, c)) : this.addFaceNormal(e, t, c), void 0 !== i && "" !== i ? (u = this.uvs.length, e = this.parseUVIndex(i, u), t = this.parseUVIndex(r, u), c = this.parseUVIndex(a, u), this.addUV(e, t, c), this.object.geometry.hasUVIndices = !0) : this.addDefaultUV() }, addPointGeometry: function(e) { this.object.geometry.type = "Points"; for (var t = this.vertices.length, n = 0, i = e.length; n < i; n++) { var r = this.parseVertexIndex(e[n], t); this.addVertexPoint(r), this.addColor(r) } }, addLineGeometry: function(e, t) { this.object.geometry.type = "Line"; for (var n = this.vertices.length, i = this.uvs.length, r = 0, a = e.length; r < a; r++) this.addVertexLine(this.parseVertexIndex(e[r], n)); for (var o = 0, a = t.length; o < a; o++) this.addUVLine(this.parseUVIndex(t[o], i)) } }; return e.startObject("", !1), e } function ix(e) { mc.call(this, e), this.materials = null } function rx(e) { mc.call(this, e) } rx.prototype = Object.assign(Object.create(mc.prototype), { constructor: rx, load: function(t, n, e, i) { var r = this , a = "" === this.path ? ld.extractUrlBase(t) : this.path , o = new gc(this.manager); o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(t, function(e) { try { n(r.parse(e, a)) } catch (e) { i ? i(e) : console.error(e), r.manager.itemError(t) } }, e, i) }, setMaterialOptions: function(e) { return this.materialOptions = e, this }, parse: function(e, t) { for (var n = e.split("\n"), i = {}, r = /\s+/, a = {}, o = 0; o < n.length; o++) { var s, l, u = (u = n[o]).trim(); 0 !== u.length && "#" !== u.charAt(0) && (s = (s = 0 <= (l = u.indexOf(" ")) ? u.substring(0, l) : u).toLowerCase(), u = (u = 0 <= l ? u.substring(l + 1) : "").trim(), "newmtl" === s ? a[u] = i = { name: u } : "ka" === s || "kd" === s || "ks" === s || "ke" === s ? (l = u.split(r, 3), i[s] = [parseFloat(l[0]), parseFloat(l[1]), parseFloat(l[2])]) : i[s] = u) } t = new rx.MaterialCreator(this.resourcePath || t,this.materialOptions); return t.setCrossOrigin(this.crossOrigin), t.setManager(this.manager), t.setMaterials(a), t } }), (rx.MaterialCreator = function(e, t) { this.baseUrl = e || "", this.options = t, this.materialsInfo = {}, this.materials = {}, this.materialsArray = [], this.nameLookup = {}, this.side = this.options && this.options.side ? this.options.side : q, this.wrap = this.options && this.options.wrap ? this.options.wrap : ke } ).prototype = { constructor: rx.MaterialCreator, crossOrigin: "anonymous", setCrossOrigin: function(e) { return this.crossOrigin = e, this }, setManager: function(e) { this.manager = e }, setMaterials: function(e) { this.materialsInfo = this.convert(e), this.materials = {}, this.materialsArray = [], this.nameLookup = {} }, convert: function(e) { if (!this.options) return e; var t, n = {}; for (t in e) { var i, r = e[t], a = {}; for (i in n[t] = a, r) { var o = !0 , s = r[i] , l = i.toLowerCase(); switch (l) { case "kd": case "ka": case "ks": this.options && this.options.normalizeRGB && (s = [s[0] / 255, s[1] / 255, s[2] / 255]), this.options && this.options.ignoreZeroRGBs && 0 === s[0] && 0 === s[1] && 0 === s[2] && (o = !1) } o && (a[l] = s) } } return n }, preload: function() { for (var e in this.materialsInfo) this.create(e) }, getIndex: function(e) { return this.nameLookup[e] }, getAsArray: function() { var e, t = 0; for (e in this.materialsInfo) this.materialsArray[t] = this.create(e), this.nameLookup[e] = t, t++; return this.materialsArray }, create: function(e) { return void 0 === this.materials[e] && this.createMaterial_(e), this.materials[e] }, createMaterial_: function(e) { var t, r = this, n = this.materialsInfo[e], a = { name: e, side: this.side }; function i(e, t) { var n, i; a[e] || (n = r.getTextureParams(t, a), (t = r.loadTexture((i = r.baseUrl, "string" != typeof (t = n.url) || "" === t ? "" : /^https?:\/\//i.test(t) ? t : i + t))).repeat.copy(n.scale), t.offset.copy(n.offset), t.wrapS = r.wrap, t.wrapT = r.wrap, a[e] = t) } for (t in n) { var o, s = n[t]; if ("" !== s) switch (t.toLowerCase()) { case "kd": a.color = (new Yi).fromArray(s); break; case "ks": break; case "ke": a.emissive = (new Yi).fromArray(s); break; case "map_kd": i("map", s); break; case "map_ks": i("specularMap", s); break; case "map_ke": i("emissiveMap", s); break; case "norm": i("normalMap", s); break; case "map_bump": case "bump": i("bumpMap", s); break; case "map_d": i("alphaMap", s), a.transparent = !0; break; case "ns": break; case "d": (o = parseFloat(s)) < 1 && (a.opacity = o, a.transparent = !0); break; case "tr": o = parseFloat(s), 0 < (o = this.options && this.options.invertTrProperty ? 1 - o : o) && (a.opacity = 1 - o, a.transparent = !0) } } return this.materials[e] = new Hu(a), this.materials[e] }, getTextureParams: function(e, t) { var n = { scale: new yn(1,1), offset: new yn(0,0) } , i = e.split(/\s+/) , e = i.indexOf("-bm"); return 0 <= e && (t.bumpScale = parseFloat(i[e + 1]), i.splice(e, 2)), 0 <= (e = i.indexOf("-s")) && (n.scale.set(parseFloat(i[e + 1]), parseFloat(i[e + 2])), i.splice(e, 4)), 0 <= (e = i.indexOf("-o")) && (n.offset.set(parseFloat(i[e + 1]), parseFloat(i[e + 2])), i.splice(e, 4)), n.url = i.join(" ").trim(), n }, loadTexture: function(e, t, n, i, r) { var a = void 0 !== this.manager ? this.manager : fc , o = a.getHandler(e); return (o = null === o ? new _c(a) : o).setCrossOrigin && o.setCrossOrigin(this.crossOrigin), r = o.load(e, n, i, r), void 0 !== t && (r.mapping = t), r } }; function ax() { this.enabled = !0, this.needsSwap = !0, this.clear = !1, this.renderToScreen = !1 } Object.assign(ax.prototype, { setSize: function(e, t) {}, render: function(e, t, n, i, r) { console.error("THREE.Pass: .render() must be implemented in derived pass.") } }); function ox(e, t) { ax.call(this), this.textureID = void 0 !== t ? t : "tDiffuse", e instanceof Qr ? (this.uniforms = e.uniforms, this.material = e) : e && (this.uniforms = Jr.clone(e.uniforms), this.material = new Qr({ defines: Object.assign({}, e.defines), uniforms: this.uniforms, vertexShader: e.vertexShader, fragmentShader: e.fragmentShader, transparent: !0 })), this.camera = new ed(-1,1,1,-1,0,1), this.scene = new gs, this.quad = new Hr(new ua(2,2),null), this.quad.frustumCulled = !1, this.scene.add(this.quad) } ox.prototype = Object.assign(Object.create(ax.prototype), { constructor: ox, render: function(e, t, n, i, r, a, o) { var s = n.getRenderTarget(); this.uniforms[this.textureID] && (this.uniforms[this.textureID].value = r.texture), this.quad.material = this.material, this.renderToScreen ? n.render(this.scene, this.camera) : (n.setRenderTarget(i), this.clear && n.clear(), n.render(this.scene, this.camera), n.setRenderTarget(s)) } }); function sx(e, t) { ax.call(this), this.sampleLevel = 4, this.unbiased = !0, this.clearColor = void 0 !== e ? e : 0, this.clearAlpha = void 0 !== t ? t : 0, this.renderUniforms = { bgTex: { value: null }, outlineTex: { value: null }, opacity: { value: 1 } }, this.renderMat = new Qr({ uniforms: this.renderUniforms, vertexShader: lx.vertexShader, fragmentShader: " \n uniform sampler2D bgTex; \n uniform sampler2D outlineTex; \n uniform float opacity;\n varying vec2 vUv;\n void main() {\n vec4 color1 = texture2D( bgTex, vUv );\n vec4 color2 = texture2D( outlineTex, vUv ); \n gl_FragColor = opacity * mix(color1, color2, color2.a) ;\n \n \n } \n ", premultipliedAlpha: !0, blending: ee, depthTest: !1, depthWrite: !1, transparent: !0 }), this.renderMat2 = new Qr({ uniforms: Jr.clone(lx.uniforms), vertexShader: lx.vertexShader, fragmentShader: "uniform float opacity; \n uniform sampler2D tDiffuse; \n varying vec2 vUv;\n\n void main() {\n \n vec4 texel = texture2D( tDiffuse, vUv ); \n \n if(texel.r == 0.0 && texel.g == 0.0 && texel.b == 0.0){\n discard;\n }else{\n gl_FragColor = opacity * texel;\n }\n } \n ", depthTest: !1, depthWrite: !1, transparent: !0 }), this.camera2 = new ed(-1,1,1,-1,0,1), this.scene2 = new gs, this.quad2 = new Hr(new ua(2,2),this.renderMat), this.quad2.frustumCulled = !1, this.scene2.add(this.quad2), this.copyPass = new ox(lx), this.copyPass.renderToScreen = !0 } var lx = { uniforms: { tDiffuse: { value: null }, opacity: { value: 1 } }, vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"), fragmentShader: ["uniform float opacity;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "void main() {", "vec4 texel = texture2D( tDiffuse, vUv );", "gl_FragColor = opacity * texel;", "}"].join("\n") }; sx.prototype = Object.assign(Object.create(ax.prototype), { constructor: sx, dispose: function() { this.sampleRenderTarget && (this.sampleRenderTarget.dispose(), this.sampleRenderTarget = null) }, setSize: function(e, t) { this.sampleRenderTarget && this.sampleRenderTarget.setSize(e, t), this.childPass && this.childPass.setSize(e, t) }, addPass: function(e) { this.childPass = e }, render: function(e, t, n, i, r, a, o, s) { this.useCopy && (e = this.copyPass.scene, t = this.copyPass.camera), this.sampleRenderTarget || (this.sampleRenderTarget = new An(a.width,a.height,{ minFilter: Oe, magFilter: Oe, format: et }), this.sampleRenderTarget.texture.name = "SSAARenderPass.sample"); var l = sx.JitterVectors[Math.max(0, Math.min(this.sampleLevel, 5))] , u = i.autoClear; i.autoClear = !1; var c = i.getClearColor(new Yi).getHex() , d = i.getClearAlpha(); i.setClearColor(this.clearColor, this.clearAlpha); var h, p, f = 1 / l.length, m = i.getRenderTarget(); p = m ? m.scissorTest ? (h = m.scissor.w, m.scissor.z) : (h = m.width, m.height) : (h = a.width, a.height); for (var v = 0; v < l.length; v++) { var g = l[v]; t.setViewOffset && t.setViewOffset(h, p, .0625 * g[0], .0625 * g[1], h, p); var y = f; this.unbiased && (y += 1 / 32 * ((v + .5) / l.length - .5)), i.setRenderTarget(this.sampleRenderTarget), i.clear(), this.useCopy ? this.copyPass.render(e, t, i, r, a) : s ? s({ target: this.sampleRenderTarget }) : i.render(e, t), i.setRenderTarget(m); g = this.childPass && this.childPass.render(e, t, i, r, a, null, s); this.renderUniforms.bgTex.value = this.sampleRenderTarget.texture, this.renderUniforms.outlineTex.value = g ? a.texture : null, this.renderUniforms.opacity.value = y, this.renderToScreen || i.setRenderTarget(r), 0 === v && (i.setClearColor(0, 0), i.clear()), i.render(this.scene2, this.camera2), this.renderToScreen || i.setRenderTarget(m) } t.clearViewOffset && t.clearViewOffset(), i.autoClear = u, i.setClearColor(c, d) } }), sx.JitterVectors = [[[0, 0]], [[4, 4], [-4, -4]], [[-2, -6], [6, -2], [-6, 2], [2, 6]], [[1, -3], [-1, 3], [5, 1], [-3, -5], [-5, 5], [-7, -1], [3, 7], [7, -7]], [[1, 1], [-1, -3], [-3, 2], [4, -1], [-5, -2], [2, 5], [5, 3], [3, -5], [-2, 6], [0, -7], [-4, -6], [-6, 4], [-8, 0], [7, -4], [6, 7], [-7, -8]], [[-4, -7], [-7, -5], [-3, -5], [-5, -4], [-1, -4], [-2, -2], [-6, -1], [-4, 0], [-7, 1], [-1, 2], [-6, 3], [-3, 3], [-7, 6], [-3, 6], [-5, 7], [-1, 7], [5, -7], [1, -6], [6, -5], [4, -4], [2, -3], [7, -2], [1, -1], [4, -1], [2, 1], [6, 2], [0, 4], [4, 4], [2, 5], [7, 5], [5, 6], [3, 7]]]; function ux(e, t) { var n; this.renderer = e, void 0 === t && (n = { minFilter: Oe, magFilter: Oe, format: et, stencilBuffer: !1 }, (t = new An((e = e.getDrawingBufferSize(new yn)).width,e.height,n)).texture.name = "EffectComposer.rt1"), this.renderTarget1 = t, this.renderTarget2 = t.clone(), this.renderTarget2.texture.name = "EffectComposer.rt2", this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2, this.passes = [], this.copyPass = new ox(lx) } var cx = function() { y(r, ax); var i = w(r); function r(e, t) { var n; return O(this, r), (n = i.call(this)).scene = e, n.camera = t, n.clear = !0, n.needsSwap = !1, n.inverse = !1, n } return h(r, [{ key: "render", value: function(e, t, n) { var i, r, a = e.getContext(), o = e.state; o.buffers.color.setMask(!1), o.buffers.depth.setMask(!1), o.buffers.color.setLocked(!0), o.buffers.depth.setLocked(!0), r = this.inverse ? (i = 0, 1) : (i = 1, 0), o.buffers.stencil.setTest(!0), o.buffers.stencil.setOp(a.REPLACE, a.REPLACE, a.REPLACE), o.buffers.stencil.setFunc(a.ALWAYS, i, 4294967295), o.buffers.stencil.setClear(r), o.buffers.stencil.setLocked(!0), e.setRenderTarget(n), this.clear && e.clear(), e.render(this.scene, this.camera), e.setRenderTarget(t), this.clear && e.clear(), e.render(this.scene, this.camera), o.buffers.color.setLocked(!1), o.buffers.depth.setLocked(!1), o.buffers.stencil.setLocked(!1), o.buffers.stencil.setFunc(a.EQUAL, 1, 4294967295), o.buffers.stencil.setOp(a.KEEP, a.KEEP, a.KEEP), o.buffers.stencil.setLocked(!0) } }]), r }() , dx = function() { y(n, ax); var t = w(n); function n() { var e; return O(this, n), (e = t.call(this)).needsSwap = !1, e } return h(n, [{ key: "render", value: function(e) { e.state.buffers.stencil.setLocked(!1), e.state.buffers.stencil.setTest(!1) } }]), n }(); Object.assign(ux.prototype, { swapBuffers: function() { var e = this.readBuffer; this.readBuffer = this.writeBuffer, this.writeBuffer = e }, addPass: function(e) { this.passes.push(e); var t = this.renderer.getDrawingBufferSize(new yn); e.setSize(t.width, t.height) }, removePass: function(e) { e = this.passes.indexOf(e); -1 < e && this.passes.splice(e, 1) }, insertPass: function(e, t) { this.passes.splice(t, 0, e) }, render: function(e, t, n, i) { var r, a, o, s = !1, l = this.passes.filter(function(e) { return e.enabled }), u = l.length; for (this.readTarget && this.copyPass.render(e, this.renderer, this.readBuffer, this.renderer.getRenderTarget()), r = 0; r < u; r++) (o = l[r]).render(e, t, n, this.renderer, this.writeBuffer, this.readBuffer, s, i), o.needsSwap && (s && ((a = this.renderer.context).stencilFunc(a.NOTEQUAL, 1, 4294967295), this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer), a.stencilFunc(a.EQUAL, 1, 4294967295)), this.swapBuffers()), void 0 !== cx && (o instanceof cx ? s = !0 : o instanceof dx && (s = !1)); o.renderToScreen || (this.copyPass.renderToScreen = !0, this.copyPass.render(null, null, this.renderer, this.writeBuffer, this.readBuffer)) }, reset: function(e) { var t; void 0 === e && (t = this.renderer.getDrawingBufferSize(new yn), (e = this.renderTarget1.clone()).setSize(t.width, t.height)), this.renderTarget1.dispose(), this.renderTarget2.dispose(), this.renderTarget1 = e, this.renderTarget2 = e.clone(), this.writeBuffer = this.renderTarget1, this.readBuffer = this.renderTarget2 }, setSize: function(e, t, n) { this.renderTarget1.setSize(e * (n = n || 1), t * n), this.renderTarget2.setSize(e * n, t * n); for (var i = 0; i < this.passes.length; i++) this.passes[i].setSize(e * n, t * n) } }); function hx(e) { this.selectedObjects = void 0 !== e ? e : [], this.visibleEdgeColor = new Yi(1,1,1), this.hiddenEdgeColor = new Yi(.1,.04,.02), this.edgeGlow = 0, this.usePatternTexture = !1, this.edgeStrength = 50, this.downSampleRatio = 1, this.pulsePeriod = 0, ax.call(this), this.resolution = new yn(256,256); var t = { minFilter: Oe, magFilter: Oe, format: et } , n = Math.round(this.resolution.x / this.downSampleRatio) , e = Math.round(this.resolution.y / this.downSampleRatio); this.renderTargetMaskBuffer = new An(this.resolution.x,this.resolution.y,t), this.renderTargetMaskBuffer.texture.name = "OutlinePass.mask", this.renderTargetMaskBuffer.texture.generateMipmaps = !1, this.depthMaterial = new es, this.depthMaterial.side = Y, this.depthMaterial.depthPacking = on, this.depthMaterial.blending = Z, this.prepareMaskMaterial = this.getPrepareMaskMaterial(), this.prepareMaskMaterial.side = Y, this.renderTargetDepthBuffer = new An(this.resolution.x,this.resolution.y,t), this.renderTargetDepthBuffer.texture.name = "OutlinePass.depth", this.renderTargetDepthBuffer.texture.generateMipmaps = !1, this.edgeDetectionMaterial = this.getEdgeDetectionMaterial(this.edgeStrength), this.renderTargetEdgeBuffer1 = new An(n,e,t), this.renderTargetEdgeBuffer1.texture.name = "OutlinePass.edge1", this.renderTargetEdgeBuffer1.texture.generateMipmaps = !1, this.overlayMaterial = this.getOverlayMaterial(), this.copyUniforms = Jr.clone(lx.uniforms), this.copyUniforms.opacity.value = 1, this.materialCopy = new Qr({ uniforms: this.copyUniforms, vertexShader: lx.vertexShader, fragmentShader: lx.fragmentShader, blending: Z, depthTest: !1, depthWrite: !1, transparent: !0 }), this.enabled = !0, this.needsSwap = !1, this.oldClearColor = new Yi, this.oldClearAlpha = 1, this.camera = new ed(-1,1,1,-1,0,1), this.scene = new gs, this.quad = new Hr(new ua(2,2),null), this.quad.frustumCulled = !1, this.scene.add(this.quad), this.textureMatrix = new ni } new yn(1 / 1024,1 / 512); hx.prototype = Object.assign(Object.create(ax.prototype), { constructor: hx, dispose: function() { this.renderTargetMaskBuffer.dispose(), this.renderTargetEdgeBuffer1.dispose(), this.renderTargetDepthBuffer.dispose() }, replaceDepthToViewZ: function(e) { e = e.isPerspectiveCamera ? "perspective" : "orthographic"; e != this.lastCameraType && (this.lastCameraType = e, this.prepareMaskMaterial.fragmentShader = this.prepareMaskMaterial.fragmentShader.replace(/DEPTH_TO_VIEW_Z/g, e + "DepthToViewZ"), this.prepareMaskMaterial.needsUpdate = !0) }, setSize: function(e, t) { this.renderTargetEdgeBuffer1.setSize(e, t), this.renderTargetMaskBuffer.setSize(e, t), this.resolution.set(e, t) }, changeVisibilityOfSelectedObjects: function(t) { function e(e) { (e.isPointcloud || e.isMesh || e.isLine || e.isSprite) && viewer.updateVisible(e, "overlinePass", t) } for (var n = 0; n < this.selectedObjects.length; n++) this.selectedObjects[n].traverse(e) }, changeVisibilityOfNonSelectedObjects: function(r, e) { var a = []; function t(e) { (e.isPointcloud || e.isMesh || e.isLine || e.isSprite) && a.push(e) } for (var n = 0; n < this.selectedObjects.length; n++) this.selectedObjects[n].traverse(t); function i(e) { if (e.isPointcloud || e.isMesh || e.isLine || e.isSprite) { for (var t = !1, n = 0; n < a.length; n++) if (a[n].id === e.id) { t = !0; break } if (!t) { var i = e.visible; return viewer.updateVisible(e, "overlinePass", r), e.visible = !!r && !!e.bVisible, e.bVisible = i, { stopContinue: !0 } } } } e.forEach(function(e) { return e.traverse(i) }) }, updateTextureMatrix: function(e) { this.textureMatrix.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1), this.textureMatrix.multiply(e.projectionMatrix), this.textureMatrix.multiply(e.matrixWorldInverse) }, render: function(t, n, e, i, r, a, o, s) { var l = this; if (t instanceof Array || (t = [t]), 0 < this.selectedObjects.length) { var u = function(e) { s ? s({ target: e, dontRenderRtEDL: !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1] }) : (i.setRenderTarget(e), i.clear(), t.forEach(function(e) { return i.render(e, n) })) }; e.forEach(function(e) { return e.beforeRender = function() { l.replaceDepthToViewZ(e.camera) } }), this.oldClearColor.copy(i.getClearColor(new Yi)), this.oldClearAlpha = i.getClearAlpha(); var c = i.autoClear , d = i.getRenderTarget(); i.autoClear = !1, o && i.context.disable(i.context.STENCIL_TEST), i.setClearColor(16777215, 1), this.changeVisibilityOfSelectedObjects(!1), t.forEach(function(e) { e.currentBackground = e.background, e.background = null, e.overrideMaterial = l.depthMaterial }), u(this.renderTargetDepthBuffer), this.changeVisibilityOfSelectedObjects(!0), e.forEach(function(e) { return e.beforeRender = function() { l.updateTextureMatrix(e.camera), l.prepareMaskMaterial.uniforms.cameraNearFar.value = new yn(e.camera.near,e.camera.far) } }), this.changeVisibilityOfNonSelectedObjects(!1, t), t.forEach(function(e) { e.overrideMaterial = l.prepareMaskMaterial }), this.prepareMaskMaterial.uniforms.depthTexture.value = this.renderTargetDepthBuffer.texture, this.prepareMaskMaterial.uniforms.textureMatrix.value = this.textureMatrix, u(this.renderTargetMaskBuffer), e.forEach(function(e) { e.beforeRender = null }), this.changeVisibilityOfNonSelectedObjects(!0, t), t.forEach(function(e) { e.overrideMaterial = null, e.background = e.currentBackground }), this.quad.material = this.edgeDetectionMaterial, this.edgeDetectionMaterial.uniforms.maskTexture.value = this.renderTargetMaskBuffer.texture, this.edgeDetectionMaterial.uniforms.texSize.value = new yn(this.resolution.x,this.resolution.y), this.edgeDetectionMaterial.uniforms.thickness.value = this.edgeStrength, this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value = this.visibleEdgeColor, this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value = this.hiddenEdgeColor; a = a; return this.renderToScreen ? (this.quad.material.transparent = !0, a = null, i.setClearColor(this.oldClearColor, this.oldClearAlpha), u(null, !1), u = i.getSize(new yn), i.setViewport(0, 0, u.x, u.y), i.setScissorTest(!1)) : (i.setClearColor(0, 0), i.clear()), i.setRenderTarget(a), i.render(this.scene, this.camera), i.setRenderTarget(d), i.setClearColor(this.oldClearColor, this.oldClearAlpha), i.autoClear = c, !0 } }, getPrepareMaskMaterial: function() { return new Qr({ uniforms: { depthTexture: { value: null }, cameraNearFar: { value: new yn(.5,.5) }, textureMatrix: { value: new ni } }, vertexShader: ["varying vec4 projTexCoord;", "varying vec4 vPosition;", "uniform mat4 textureMatrix;", "void main() {", "\tvPosition = modelViewMatrix * vec4( position, 1.0 );", "\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );", "\tprojTexCoord = textureMatrix * worldPosition;", "\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"), fragmentShader: ["#include ", "varying vec4 vPosition;", "varying vec4 projTexCoord;", "uniform sampler2D depthTexture;", "uniform vec2 cameraNearFar;", "void main() {", "\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));", "\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );", "\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;", "\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);", "}"].join("\n") }) }, getEdgeDetectionMaterial: function(e) { return new Qr({ uniforms: { thickness: { value: e }, maskTexture: { value: null }, texSize: { value: new yn(10,10) }, visibleEdgeColor: { value: new Cn(1,1,1) }, hiddenEdgeColor: { value: new Cn(1,1,1) } }, vertexShader: "varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}", fragmentShader: "varying vec2 vUv;\t\t\t\tuniform sampler2D maskTexture; uniform float thickness;\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec3 visibleEdgeColor;\t\t\t\tuniform vec3 hiddenEdgeColor;\t\t\t\t\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\t\t\t\t\tfloat d = length( vec2(diff1, diff2) ) * thickness;\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\t\t\t\t}" }) }, getSeperableBlurMaterial: function(e) { return new Qr({ defines: { MAX_RADIUS: e }, uniforms: { colorTexture: { value: null }, texSize: { value: new yn(.5,.5) }, direction: { value: new yn(.5,.5) }, kernelRadius: { value: 1 } }, vertexShader: "varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}", fragmentShader: "#include \t\t\t\tvarying vec2 vUv;\t\t\t\tuniform sampler2D colorTexture;\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec2 direction;\t\t\t\tuniform float kernelRadius;\t\t\t\t\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\t\t\t\t}\t\t\t\tvoid main() {\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, kernelRadius);\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\t\t\t\t\tvec2 uvOffset = delta;\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\t\t\t\t\t\tfloat w = gaussianPdf(uvOffset.x, kernelRadius);\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\t\t\t\t\t\tweightSum += (2.0 * w);\t\t\t\t\t\tuvOffset += delta;\t\t\t\t\t}\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\t\t\t\t}" }) }, getOverlayMaterial: function() { return new Qr({ uniforms: { maskTexture: { value: null }, edgeTexture1: { value: null }, edgeTexture2: { value: null }, patternTexture: { value: null }, edgeStrength: { value: 1 }, edgeGlow: { value: 1 }, usePatternTexture: { value: 0 } }, vertexShader: "varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}", fragmentShader: "varying vec2 vUv; \n\t\t\t\tuniform sampler2D edgeTexture1; \n\t\t\t\tuniform float edgeStrength; \n\t\t\t\t \n\t\t\t\tvoid main() { \n\t\t\t\t\tgl_FragColor = edgeStrength * texture2D(edgeTexture1, vUv); \n\t\t\t\t}", blending: ee, depthTest: !1, depthWrite: !1, transparent: !0 }) } }), hx.BlurDirectionX = new yn(1,0), hx.BlurDirectionY = new yn(0,1); var px, fx = function() { y(n, Qr); var t = w(n); function n() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; return O(this, n), t.call(this, Object.assign({}, { uniforms: { tDiffuse: { type: "t", value: e.map }, alpha: { type: "f", value: 1 } }, vertexShader: Hp["basicTextured.vs"], fragmentShader: Hp["basicTextured.fs"] }, e)) } return h(n, [{ key: "opacity", get: function() { return this.uniforms.alpha.value }, set: function(e) { this.uniforms && (this.uniforms.alpha.value = e) } }, { key: "map", get: function() { return this.uniforms.tDiffuse.value }, set: function(e) { this.uniforms.tDiffuse.value = e } }]), n }(), mx = new pc, vx = {}, gx = new Map, Ch = function() { y(v, zg); var n, m = w(v); function v(e, t) { var n, i, r, a, o, s = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}; O(this, v), n = m.call(this, e, $.extend(s, { name: "mainViewer" })), window.viewer = g(n), "pano" == Potree.settings.editType || "merge" == Potree.settings.editType ? (n.modules = { Alignment: C1, SiteModel: G1 }, Potree.settings.useDepthTex = !1, "pano" == Potree.settings.editType ? n.modules.PanoEditor = ex : "merge" == Potree.settings.editType && (n.modules.MergeEditor = j1, n.modules.CamAniEditor = Lb)) : n.modules = { Clip: M1, Alignment: C1, SiteModel: G1, RouteGuider: new vb, ParticleEditor: Bb, CamAniEditor: Lb }, console.log("create viewer"), n.navigateMode = "free", n.isEdit = !0, n.waitQueue = [], n.unitConvert = new hb, px = t, n.visible = !0, n.fpVisiDatasets = [], n.atDatasets = [], n.objs = new Si, jp.EXT_DEPTH.isSupported() || console.error("ExtFragDepth unsupported! 边缘增强和测量线遮挡失效"), n.guiLoaded = !1, n.guiLoadTasks = [], n.onVrListeners = [], n.messages = [], n.elMessages = $('\n\t\t
    \n\t\t
    '), $(e).append(n.elMessages), n.paused, document.addEventListener("visibilitychange", function(e) { n.dispatchEvent({ type: "pageVisible", v: !document.hidden }) }); try { Potree.settings.isOfficial || (0 === $(e).find("#potree_map").length && (i = $('\n \n '), $(e).append(i)), 0 === $(e).find("#potree_description").length && (r = $('
    '), $(e).append(r)), 0 === $(e).find("#potree_annotations").length && (a = $('\n
    '), $(e).append(a)), 0 === $(e).find("#potree_quick_buttons").length && (o = $('\n
    \n
    \n '), $(e).append(o)), px || "merge" == Potree.settings.editType || ($(e).append($("
    ")), px = $("
    "), $(e).append(px), px = px[0])), n.pointCloudLoadedCallback = s.onPointCloudLoaded || function() {} , n.server = null, n.fov = 60, n.isFlipYZ = !1, n.useDEMCollisions = !1, n.generateDEM = !1, n.minNodeSize = 30, n.edlStrength = 1, n.edlRadius = 1.4, n.edlOpacity = 1, n.useEDL = !1, n.description = "", n.classifications = Bm.DEFAULT, n.moveSpeed = 10, n.lengthUnit = lm.METER, n.lengthUnitDisplay = lm.METER, n.showBoundingBox = !1, n.showAnnotations = !0, n.freeze = !1, n.clipTask = tm.HIGHLIGHT, n.clipMethod = nm.INSIDE_ANY, n.elevationGradientRepeat = im.CLAMP, n.filterReturnNumberRange = [0, 7], n.filterNumberOfReturnsRange = [0, 7], n.filterGPSTimeRange = [-1 / 0, 1 / 0], n.filterPointSourceIDRange = [0, 65535], n.potreeRenderer = null, n.edlRenderer = null, n.pRenderer = null, n.scene = null, n.sceneVR = null, n.overlay = null, n.overlayCamera = null, n.inputHandler = null, n.controls = null, n.clippingTool = null, n.transformationTool = null, n.navigationCube = null, n.compass = null, n.skybox = null, n.clock = new Cd, n.background = null, s.noDragAndDrop || n.initDragAndDrop(), "undefined" != typeof Stats && (n.stats = new Stats, n.stats.showPanel(0), document.body.appendChild(n.stats.dom)), n.renderer.domElement.addEventListener("webglcontextlost", function(e) { console.log(e), n.postMessage("WebGL context lost. ☹"); e = n.renderer.getContext().getError(); console.log(e), n.dispatchEvent({ type: "webglError", msg: "webglcontextlost" }) }, !1), n.overlay = new gs, n.overlayCamera = new ed(0,1,1,0,-1e3,1e3), n.pRenderer = new Zm(n.renderer); n.shadowTestCam = new $r(90,1,2.5,10), n.shadowTestCam.position.set(3.5, -2.8, 8.561), n.shadowTestCam.lookAt(new Cn(0,0,4.87)); var l = new rg(n.renderer); n.sceneVR = new gs, n.setScene(l), n.composer = new ux(n.renderer), n.ssaaRenderPass = new sx(0,0), n.composer.addPass(n.ssaaRenderPass); var u = n.outlinePass = new hx; u.renderToScreen = !0, u.enabled = !1, n.composer.addPass(u), u.edgeStrength = 10, u.edgeGlow = 0, u.visibleEdgeColor = new Yi("#09a1b3"), u.hiddenEdgeColor = new Yi("#09a1b3"), n.mainViewport = new Ig(n.scene.view,n.scene.cameraP,{ left: 0, bottom: 0, width: 1, height: 1, name: "MainView" }), n.viewports = [n.mainViewport], n.compass = new Kv(g(n)), n.magnifier = new ab(g(n)), n.reticule = new sb(g(n)), n.scene.scene.add(n.magnifier), n.scene.scene.add(n.reticule), "pano" != Potree.settings.editType && "merge" != Potree.settings.editType && (n.mapViewer = new fy(px)), n.inputHandler = new Og(g(n),n.scene.scene), n.clippingTool = new jv(g(n)), n.transformationTool = new Zv(g(n)), n.navigationCube = new Dw(g(n)), n.navigationCube.visible = !1, n.createControls(), n.clippingTool.setScene(n.scene); var c = function(e) { 1 === n.scene.pointclouds.length && (e = e.pointcloud.boundingBox.getSize(new Cn).length(), n.setMoveSpeed(e /= 2e3)) } , d = function(e) { n.inputHandler.deselect(e.volume) }; n.addEventListener("scene_changed", function(e) { n.inputHandler.setScene(e.scene), n.clippingTool.setScene(n.scene), e.scene.hasEventListener("pointcloud_added", c) || e.scene.addEventListener("pointcloud_added", c), e.scene.hasEventListener("volume_removed", c) || e.scene.addEventListener("volume_removed", d) }), n.scene.addEventListener("volume_removed", d), n.scene.addEventListener("pointcloud_added", c), n.setFOV(60), n.setEDLEnabled(!1), n.setEDLRadius(1.4), n.setEDLStrength(.4), n.setEDLOpacity(1), n.setClipTask(tm.HIGHLIGHT), n.setClipMethod(nm.INSIDE_ANY), n.setPointBudget(1e6), n.setShowBoundingBox(!1), n.setFreeze(!1), n.setControls(n.fpControls), n.setBackground(new Yi(Potree.config.background), 1), n.scaleFactor = 1, n.loadSettingsFromURL(), n.renderer.setAnimationLoop(n.loop.bind(g(n))), n.loadGUI = n.loadGUI.bind(g(n)), n.annotationTool = new _w(g(n)), n.measuringTool = new Wv(g(n)), n.profileTool = new qv(g(n)), n.volumeTool = new Qv(g(n)), n.tagTool = new Pw(g(n)), y1.init(g(n), n.mapViewer ? [g(n), n.mapViewer] : [g(n)]), "pano" == Potree.settings.editType ? n.modules.PanoEditor.init() : "merge" == Potree.settings.editType ? n.modules.MergeEditor.init() : (n.modules.SiteModel.init(), n.modules.ParticleEditor.init()), n.modules.Alignment.init(), n.images360 = new ly(g(n)), n.scene.scene.add(n.objs), vx = { objLoader: new tx(mx), mtlLoader: new rx(mx), glbLoader: new Qw(void 0,n.renderer,Potree.settings.libsUrl) } } catch (e) { n.onCrash(e) } var h = ""; Object.defineProperty(Potree.settings, "pointDensity", { get: function() { return h }, set: function(e) { var t; e && e != h && (t = Potree.config.pointDensity[e], t = (n.magnifier.visible ? Potree.config.pointDensity.magnifier : t).pointBudget, viewer.setPointBudget(t), h = e, n.setPointLevels()) } }); var p = ""; Object.defineProperty(Potree.settings, "UserPointDensity", { get: function() { return p }, set: function(e) { p != e && ("showPointCloud" == Potree.settings.displayMode && 4 != n.viewports.length && (Potree.settings.pointDensity = e), p = e) } }); var f = Potree.settings.cameraFar; return Object.defineProperty(Potree.settings, "cameraFar", { get: function() { return f }, set: function(e) { e != f && ("showPanos" != Potree.settings.displayMode && (n.mainViewport.camera.far = e, n.mainViewport.camera.updateProjectionMatrix()), f = e) } }), n.addEventListener("allLoaded", function() { setTimeout(n.testPointcloudsMaxLevel.bind(g(n)), 2e3) }), "pano" != Potree.settings.editType && "merge" != Potree.settings.editType && (n.addEventListener("switchFloorplanSelect", function(e) { var t; n.selectedFloorplan = e.pointcloud, n.updateFpVisiDatasets(), e.pointcloud ? t = [e.pointcloud] : n.fpVisiDatasets.length && (t = n.fpVisiDatasets), t && n.mapViewer.fitToDatasets(t) }), n.modules.SiteModel.bus.addEventListener("FloorChange", function() { n.updateFpVisiDatasets() }), n.mapViewer.mapLayer.addEventListener("floorplanLoaded", function() { n.updateCadVisibles(n.fpVisiDatasets, !0) })), n.addEventListener("camera_changed", function(e) { e.changeInfo.positionChanged && (gx.clear(), n.updateDatasetAt()) }), n } return h(v, [{ key: "ifPointBlockedByIntersect", value: function(e, t) { var n, i = gx.get(t || e); return i ? n = i.ifShelter : (n = viewer.inputHandler.ifBlockedByIntersect(e, .3, !0), gx.set(t || e, { ifShelter: n })), n } }, { key: "updateDatasetAt", value: function(n) { function e() { var t = viewer.mainViewport.view.position , e = i.scene.pointclouds.filter(function(e) { return e.ifContainsPoint(t) }); return Fm.getDifferenceSet(e, i.atDatasets).length && (i.atDatasets = e, "pano" != Potree.settings.editType && "merge" != Potree.settings.editType && i.updateFpVisiDatasets(), i.dispatchEvent({ type: "pointcloudAtChange", pointclouds: e })), !(n = !1) } var i = this; n ? e() : Fm.intervalTool.isWaiting("atWhichDataset", e, 500) } }, { key: "updatePanosVisibles", value: function(n) { viewer.images360.panos.forEach(function(e) { var t = n && n.panos.includes(e); viewer.updateVisible(e, "buildingChange", t, 2) }) } }, { key: "updateFpVisiDatasets", value: function() { var e, t, n = this, i = (this.modules.Clip, this.modules.SiteModel), r = this.modules.Alignment, a = i.currentFloor; this.selectedFloorplan ? (e = [this.selectedFloorplan], this.updateCadVisibles(e)) : (i.editing || r.editing ? (t = this.scene.pointclouds.filter(function(e) { return n.getObjVisiByReason(e, "datasetSelection") }), this.updateCadVisibles(t)) : (0 == (t = a ? this.findPointcloudsAtFloor(a) : []).length && (t = this.atDatasets), this.updateCadVisibles(t)), this.updatePanosVisibles(a)) } }, { key: "findPointcloudsAtFloor", value: function(i) { var r = [] , e = viewer.scene.pointclouds.filter(function(e) { var t = 0; if (e.belongToEntity && (e.belongToEntity == i || e.belongToEntity.buildParent == i)) return !0; if (e.panos.length) { var n = e.panos.filter(function(e) { return i.ifContainsPoint(e.position) }).length / e.panos.length; if (.5 < n) return !0; n < .2 && (t += n) } n = i.intersectPointcloudVolume(e) / i.getVolume(!0); if (.95 < n) return !0; r.push({ score: t += n, pointcloud: e }) }); return 0 == e.length && (r.sort(function(e, t) { return e.score - t.score }), .4 < r[0].score && (e = [r[0].pointcloud])), e } }, { key: "updateCadVisibles", value: function(n, e) { var t = this.fpVisiDatasets , n = this.fpVisiDatasets = n; if (!e && 0 == Fm.getDifferenceSet(t, n).length) return; viewer.scene.pointclouds.forEach(function(e) { var t = viewer.mapViewer.mapLayer.getFloorplan(e.dataset_id) , e = n.includes(e); t && viewer.updateVisible(t.objectGroup, "buildingChange", e) }), viewer.mapViewer.mapLayer.needUpdate = !0, viewer.mapViewer.needRender = !0 } }, { key: "testPointcloudsMaxLevel", value: function() { function e() { n = !0, Fm.intervalTool.isWaiting("testPointcloudsMaxLevel", function() { if (n || !(20 < r)) { r++; var t = !(n = !1); if (viewer.scene.pointclouds.forEach(function(e) { e.testMaxNodeLevel() && (t = !1) }), !t) return !0; i.removeEventListener("camera_changed", e), console.log("testPointcloudsMaxLevel结束") } }, r < 10 ? 150 : 500) } var n, i = this, r = 0; this.addEventListener("camera_changed", e), e() } }, { key: "setPointLevels", value: function() { this.scene.pointclouds.forEach(function(e) { e.setPointLevel() }) } }, { key: "onCrash", value: function(e) { var t; throw $(this.renderArea).empty(), 0 === $(this.renderArea).find("#potree_failpage").length && ((t = $('\n\t\t\t
    \n\t\t\t\t\n\t\t\t\t

    Potree Encountered An Error

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

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

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

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

    \n\t\t\t\t

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

    \n\n\t\t\t\t
    \n\t\t\t\t\n\t\t\t
    ')).find("#potree_error_console").html(e.stack), $(this.renderArea).append(t)), e } }, { key: "setScene", value: function(e) { var t, n = this; e !== this.scene && (t = this.scene, this.scene = e, this.dispatchEvent({ type: "scene_changed", oldScene: t, scene: e }), $(".annotation").detach(), this.scene.annotations.traverse(function(e) { n.renderArea.appendChild(e.domElement[0]) }), this.onAnnotationAdded || (this.onAnnotationAdded = function(e) { e.annotation.traverse(function(e) { $("#potree_annotation_container").append(e.domElement), e.scene = n.scene }) } ), t && t.annotations.removeEventListener("annotation_added", this.onAnnotationAdded), this.scene.annotations.addEventListener("annotation_added", this.onAnnotationAdded)) } }, { key: "setControls", value: function(e) { e !== this.controls && (this.controls && (this.controls.setEnable(!1), this.controls.moveSpeed = this.moveSpeed), (this.controls = e).moveSpeed && this.setMoveSpeed(e.moveSpeed), this.controls.setEnable(!0)) } }, { key: "getControls", value: function() { return this.renderer.xr.isPresenting ? this.vrControls : this.controls } }, { key: "getMinNodeSize", value: function() { return this.minNodeSize } }, { key: "setMinNodeSize", value: function(e) { this.minNodeSize !== e && (this.minNodeSize = e, this.dispatchEvent({ type: "minnodesize_changed", viewer: this })) } }, { key: "getBackground", value: function() { return this.background } }, { key: "setBackground", value: function(e) { this.background !== e && ("skybox" === e && (this.skybox = Jf.loadSkybox(new URL(Potree.resourcePath + "/textures/skybox2/").href)), this.background = e, this.backgroundOpacity = 1, this.dispatchEvent({ type: "background_changed", viewer: this })) } }, { key: "setDescription", value: function(e) { this.description = e, $("#potree_description").html(e) } }, { key: "getDescription", value: function() { return this.description } }, { key: "setShowBoundingBox", value: function(e) { this.showBoundingBox !== e && (this.showBoundingBox = e, this.dispatchEvent({ type: "show_boundingbox_changed", viewer: this })) } }, { key: "getShowBoundingBox", value: function() { return this.showBoundingBox } }, { key: "setMoveSpeed", value: function(e) { this.getMoveSpeed() !== e && (this.mainViewport.setMoveSpeed(e), this.dispatchEvent({ type: "move_speed_changed", viewer: this, speed: e })) } }, { key: "getMoveSpeed", value: function() { return this.mainViewport.moveSpeed } }, { key: "setWeightClassification", value: function(e) { for (var t = 0; t < this.scene.pointclouds.length; t++) this.scene.pointclouds[t].material.weightClassification = e, this.dispatchEvent({ type: "attribute_weights_changed" + t, viewer: this }) } }, { key: "setFreeze", value: function(e) { e = Boolean(e), this.freeze !== e && (this.freeze = e, this.dispatchEvent({ type: "freeze_changed", viewer: this })) } }, { key: "getFreeze", value: function() { return this.freeze } }, { key: "getClipTask", value: function() { return this.clipTask } }, { key: "getClipMethod", value: function() { return this.clipMethod } }, { key: "setClipTask", value: function(e) { this.clipTask !== e && (this.clipTask = e, this.dispatchEvent({ type: "cliptask_changed", viewer: this })) } }, { key: "setClipMethod", value: function(e) { this.clipMethod !== e && (this.clipMethod = e, this.dispatchEvent({ type: "clipmethod_changed", viewer: this })) } }, { key: "setElevationGradientRepeat", value: function(e) { this.elevationGradientRepeat !== e && (this.elevationGradientRepeat = e, this.dispatchEvent({ type: "elevation_gradient_repeat_changed", viewer: this })) } }, { key: "setPointBudget", value: function(e) { Potree.pointBudget !== e && (Potree.pointBudget = parseInt(e), this.dispatchEvent({ type: "point_budget_changed", viewer: this })) } }, { key: "getPointBudget", value: function() { return Potree.pointBudget } }, { key: "setShowAnnotations", value: function(e) { this.showAnnotations !== e && (this.showAnnotations = e, this.dispatchEvent({ type: "show_annotations_changed", viewer: this })) } }, { key: "getShowAnnotations", value: function() { return this.showAnnotations } }, { key: "setDEMCollisionsEnabled", value: function(e) { this.useDEMCollisions !== e && (this.useDEMCollisions = e, this.dispatchEvent({ type: "use_demcollisions_changed", viewer: this })) } }, { key: "getDEMCollisionsEnabled", value: function() { return this.useDEMCollisions } }, { key: "setEDLEnabled", value: function(e) { e = Boolean(e) && jp.SHADER_EDL.isSupported(), this.useEDL !== e && (this.useEDL = e, this.dispatchEvent({ type: "use_edl_changed", viewer: this })) } }, { key: "getEDLEnabled", value: function() { return this.useEDL } }, { key: "setEDLRadius", value: function(e) { this.edlRadius !== e && (this.edlRadius = e, this.dispatchEvent({ type: "edl_radius_changed", viewer: this })) } }, { key: "getEDLRadius", value: function() { return this.edlRadius } }, { key: "setEDLStrength", value: function(e) { this.edlStrength !== e && (this.edlStrength = e, this.dispatchEvent({ type: "edl_strength_changed", viewer: this })) } }, { key: "getEDLStrength", value: function() { return this.edlStrength } }, { key: "setEDLOpacity", value: function(e) { this.edlOpacity !== e && (this.edlOpacity = e, this.dispatchEvent({ type: "edl_opacity_changed", viewer: this })) } }, { key: "getEDLOpacity", value: function() { return this.edlOpacity } }, { key: "setFOV", value: function(e) { var t; this.fov !== e && (t = this.fov, this.fov = e, this.scene.cameraP.fov = this.fov, this.scene.cameraP.updateProjectionMatrix(), this.dispatchEvent({ type: "fov_changed", viewer: this, oldFov: t, fov: this.fov })) } }, { key: "getFOV", value: function() { return this.fov } }, { key: "disableAnnotations", value: function() { this.scene.annotations.traverse(function(e) { e.domElement.css("pointer-events", "none") }) } }, { key: "enableAnnotations", value: function() { this.scene.annotations.traverse(function(e) { e.domElement.css("pointer-events", "auto") }) } }, { key: "setClassifications", value: function(e) { this.classifications = e, this.dispatchEvent({ type: "classifications_changed", viewer: this }) } }, { key: "setClassificationVisibility", value: function(e, t) { this.classifications[e] ? this.classifications[e].visible !== t && (this.classifications[e].visible = t, this.dispatchEvent({ type: "classification_visibility_changed", viewer: this })) : (this.classifications[e] = { visible: t, name: "no name" }, this.dispatchEvent({ type: "classification_visibility_changed", viewer: this })) } }, { key: "toggleAllClassificationsVisibility", value: function() { for (var e = 0, t = 0, n = 0, i = Object.keys(this.classifications); n < i.length; n++) { var r = i[n]; this.classifications[r].visible && e++, t++ } var a = !0; e === t && (a = !1); for (var o = !1, s = 0, l = Object.keys(this.classifications); s < l.length; s++) { var u = l[s]; this.classifications[u].visible !== a && (this.classifications[u].visible = a, o = !0) } o && this.dispatchEvent({ type: "classification_visibility_changed", viewer: this }) } }, { key: "setFilterReturnNumberRange", value: function(e, t) { this.filterReturnNumberRange = [e, t], this.dispatchEvent({ type: "filter_return_number_range_changed", viewer: this }) } }, { key: "setFilterNumberOfReturnsRange", value: function(e, t) { this.filterNumberOfReturnsRange = [e, t], this.dispatchEvent({ type: "filter_number_of_returns_range_changed", viewer: this }) } }, { key: "setFilterGPSTimeRange", value: function(e, t) { this.filterGPSTimeRange = [e, t], this.dispatchEvent({ type: "filter_gps_time_range_changed", viewer: this }) } }, { key: "setFilterPointSourceIDRange", value: function(e, t) { this.filterPointSourceIDRange = [e, t], this.dispatchEvent({ type: "filter_point_source_id_range_changed", viewer: this }) } }, { key: "setLengthUnit", value: function(e) { switch (e) { case "m": this.lengthUnit = lm.METER, this.lengthUnitDisplay = lm.METER; break; case "ft": this.lengthUnit = lm.FEET, this.lengthUnitDisplay = lm.FEET; break; case "in": this.lengthUnit = lm.INCH, this.lengthUnitDisplay = lm.INCH } this.dispatchEvent({ type: "length_unit_changed", viewer: this, value: e }) } }, { key: "setLengthUnitAndDisplayUnit", value: function(e, t) { switch (e) { case "m": this.lengthUnit = lm.METER; break; case "ft": this.lengthUnit = lm.FEET; break; case "in": this.lengthUnit = lm.INCH } switch (t) { case "m": this.lengthUnitDisplay = lm.METER; break; case "ft": this.lengthUnitDisplay = lm.FEET; break; case "in": this.lengthUnitDisplay = lm.INCH } this.dispatchEvent({ type: "length_unit_changed", viewer: this, value: e }) } }, { key: "zoomTo", value: function(e, t) { var n = this , i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0 , r = this.scene.view , a = this.scene.cameraP.clone(); a.rotation.copy(this.scene.cameraP.rotation), a.rotation.order = "ZXY", a.rotation.x = Math.PI / 2 + r.pitch, a.rotation.z = r.yaw, a.updateMatrix(), a.updateMatrixWorld(), a.zoomTo(e, t); var o = (o = e.boundingSphere || (e.geometry && e.geometry.boundingSphere ? e.geometry.boundingSphere : e.boundingBox.getBoundingSphere(new qn))).clone().applyMatrix4(e.matrixWorld) , s = r.position.clone() , t = a.position.clone() , e = r.getPivot() , a = o.center , o = (r.radius, t.distanceTo(a), TWEEN.Easing.Quartic.Out) , l = s.clone() , t = new TWEEN.Tween(l).to(t, i); t.easing(o), t.onUpdate(function() { r.position.copy(l) }), t.start(); var u = e.clone() , i = new TWEEN.Tween(u).to(a, i); i.easing(o), i.onUpdate(function() { r.lookAt(u) }), i.onComplete(function() { r.lookAt(u), n.dispatchEvent({ type: "focusing_finished", target: n }) }), this.dispatchEvent({ type: "focusing_started", target: this }), i.start() } }, { key: "moveToGpsTimeVicinity", value: function(e) { var t = Potree.Utils.findClosestGpsTime(e, viewer) , e = t.node.pointcloud.deepestNodeAt(t.position).getBoundingBox() , e = e.min.distanceTo(e.max) , e = this.scene.getActiveCamera().getWorldDirection(new Cn).multiplyScalar(e) , e = t.position.clone().sub(e); this.scene.view.position.copy(e), this.scene.view.lookAt(t.position) } }, { key: "showAbout", value: function() { $(function() { $("#about-panel").dialog() }) } }, { key: "getGpsTimeExtent", value: function() { var e, t = [1 / 0, -1 / 0], n = ue(this.scene.pointclouds); try { for (n.s(); !(e = n.n()).done; ) { var i = e.value.pcoGeometry.pointAttributes.attributes.find(function(e) { return "gps-time" === e.name }); i && (t[0] = Math.min(t[0], i.range[0]), t[1] = Math.max(t[1], i.range[1])) } } catch (e) { n.e(e) } finally { n.f() } return t } }, { key: "fitToScreen", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1 , t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0 , n = this.getBoundingBox(this.scene.pointclouds) , i = new Si; i.boundingBox = n, this.zoomTo(i, e, t), this.controls.stop() } }, { key: "toggleNavigationCube", value: function() { this.navigationCube.visible = !this.navigationCube.visible } }, { key: "setTopView", value: function(e) { (e = e || this.scene.view).setCubeView("top"), this.fitToScreen() } }, { key: "setBottomView", value: function() { this.scene.view.yaw = -Math.PI, this.scene.view.pitch = Math.PI / 2, this.fitToScreen() } }, { key: "setFrontView", value: function(e) { (e = e || this.scene.view).yaw = 0, e.pitch = 0, this.fitToScreen() } }, { key: "setBackView", value: function(e) { (e = e || this.scene.view).yaw = Math.PI, e.pitch = 0, this.fitToScreen() } }, { key: "setLeftView", value: function() { this.scene.view.yaw = -Math.PI / 2, this.scene.view.pitch = 0, this.fitToScreen() } }, { key: "setRightView", value: function() { this.scene.view.yaw = Math.PI / 2, this.scene.view.pitch = 0, this.fitToScreen() } }, { key: "flipYZ", value: function() { this.isFlipYZ = !this.isFlipYZ, console.log("TODO") } }, { key: "setCameraMode", value: function(e) { this.scene.cameraMode = e; var t, n = ue(this.scene.pointclouds); try { for (n.s(); !(t = n.n()).done; ) t.value.material.useOrthographicCamera = e == em.ORTHOGRAPHIC } catch (e) { n.e(e) } finally { n.f() } } }, { key: "getProjection", value: function() { var e = this.scene.pointclouds[0]; return e ? e.projection : null } }, { key: "loadProject", value: (n = r(regeneratorRuntime.mark(function e(t, n) { var i; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return e.next = 2, fetch(t); case 2: if ((i = e.sent).ok) return e.next = 6, i.text(); e.next = 11; break; case 6: i = e.sent, "Potree" === (i = xw.parse(i)).type && Potree.loadProject(viewer, i, n), e.next = 12; break; case 11: console.warn("未能加载:" + t); case 12: case "end": return e.stop() } }, e) })), function(e, t) { return n.apply(this, arguments) } ) }, { key: "saveProject", value: function() { return Potree.saveProject(this) } }, { key: "loadSettingsFromURL", value: function() { var e, t, n, i, r, a; Jf.getParameterByName("pointSize") && this.setPointSize(parseFloat(Jf.getParameterByName("pointSize"))), Jf.getParameterByName("FOV") && this.setFOV(parseFloat(Jf.getParameterByName("FOV"))), Jf.getParameterByName("opacity") && this.setOpacity(parseFloat(Jf.getParameterByName("opacity"))), Jf.getParameterByName("edlEnabled") && (e = "true" === Jf.getParameterByName("edlEnabled"), this.setEDLEnabled(e)), Jf.getParameterByName("edlRadius") && this.setEDLRadius(parseFloat(Jf.getParameterByName("edlRadius"))), Jf.getParameterByName("edlStrength") && this.setEDLStrength(parseFloat(Jf.getParameterByName("edlStrength"))), Jf.getParameterByName("pointBudget") && this.setPointBudget(parseFloat(Jf.getParameterByName("pointBudget"))), Jf.getParameterByName("showBoundingBox") && ("true" === Jf.getParameterByName("showBoundingBox") ? this.setShowBoundingBox(!0) : this.setShowBoundingBox(!1)), Jf.getParameterByName("material") && (t = Jf.getParameterByName("material"), this.setMaterial(t)), Jf.getParameterByName("pointSizing") && (t = Jf.getParameterByName("pointSizing"), this.setPointSizing(t)), Jf.getParameterByName("quality") && (n = Jf.getParameterByName("quality"), this.setQuality(n)), Jf.getParameterByName("position") && (r = Jf.getParameterByName("position").replace("[", "").replace("]", "").split(";"), n = parseFloat(r[0]), i = parseFloat(r[1]), r = parseFloat(r[2]), this.scene.view.position.set(n, i, r)), Jf.getParameterByName("target") && (a = Jf.getParameterByName("target").replace("[", "").replace("]", "").split(";"), i = parseFloat(a[0]), r = parseFloat(a[1]), a = parseFloat(a[2]), this.scene.view.lookAt(new Cn(i,r,a))), Jf.getParameterByName("background") && (a = Jf.getParameterByName("background"), this.setBackground(a)) } }, { key: "createControls", value: function() { this.fpControls = new Fg(this,this.mainViewport), this.fpControls.enabled = !1, this.fpControls.addEventListener("start", this.disableAnnotations.bind(this)), this.fpControls.addEventListener("end", this.enableAnnotations.bind(this)), this.orbitControls = new Bw(this), this.orbitControls.enabled = !1, this.orbitControls.addEventListener("start", this.disableAnnotations.bind(this)), this.orbitControls.addEventListener("end", this.enableAnnotations.bind(this)), this.earthControls = new Lw(this), this.earthControls.enabled = !1, this.earthControls.addEventListener("start", this.disableAnnotations.bind(this)), this.earthControls.addEventListener("end", this.enableAnnotations.bind(this)), this.deviceControls = new Rw(this), this.deviceControls.enabled = !1, this.deviceControls.addEventListener("start", this.disableAnnotations.bind(this)), this.deviceControls.addEventListener("end", this.enableAnnotations.bind(this)) } }, { key: "toggleSidebar", value: function() { var e = $("#potree_render_area"); "0px" !== e.css("left") ? e.css("left", "0px") : e.css("left", "300px") } }, { key: "toggleMap", value: function() { this.mapView && this.mapView.toggle() } }, { key: "onGUILoaded", value: function(e) { this.guiLoaded ? e() : this.guiLoadTasks.push(e) } }, { key: "promiseGuiLoaded", value: function() { var t = this; return new Promise(function(e) { t.guiLoaded ? e() : t.guiLoadTasks.push(e) } ) } }, { key: "loadGUI", value: function(e) { var i = this; e && this.onGUILoaded(e); var r = $("#potree_sidebar_container"); return r.load(new URL(Potree.scriptPath + "/" + (Potree.settings.sidebar || "sidebar.html")).href, function() { r.css("width", "300px"), r.css("height", "100%"); var e = document.createElement("img"); e.src = new URL(Potree.resourcePath + "/icons/menu_button.svg").href, e.onclick = i.toggleSidebar, e.classList.add("potree_menu_toggle"); var t = document.createElement("img"); t.src = new URL(Potree.resourcePath + "/icons/map_icon.png").href, t.style.display = "none", t.onclick = function(e) { i.toggleMap() } , t.id = "potree_map_toggle"; var n = $("#potree_quick_buttons").get(0); n.append(e), n.append(t), i18n.init({ lng: "en", resGetPath: Potree.resourcePath + "/lang/__lng__/__ns__.json", preload: ["en", "fr", "de", "jp", "se", "es", "zh"], getAsync: !0, debug: !1 }, function(e) { $("body").i18n() }), $(function() { var e = new Ew(i); e.init(), i.sidebar = e; var t = $("
    ").load(new URL(Potree.scriptPath + "/profile.html").href, function() { $(document.body).append(t.children()), i.profileWindow = new by(i), i.profileWindowController = new xy(i), $("#profile_window").draggable({ handle: $("#profile_titlebar"), containment: $(document.body) }), $("#profile_window").resizable({ containment: $(document.body), handles: "n, e, s, w" }), $(function() { i.guiLoaded = !0; var e, t = ue(i.guiLoadTasks); try { for (t.s(); !(e = t.n()).done; ) (0, e.value)() } catch (e) { t.e(e) } finally { t.f() } }) }) }) }), this.promiseGuiLoaded() } }, { key: "setLanguage", value: function(e) { i18n.setLng(e), $("body").i18n() } }, { key: "setServer", value: function(e) { this.server = e } }, { key: "initDragAndDrop", value: function() { var c = this; function e(e) { e.dataTransfer.dropEffect = "copy", e.preventDefault() } var t = function() { var t = r(regeneratorRuntime.mark(function e(t) { var n, i, r, a, o, s, l, u; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: console.log(t), t.preventDefault(), n = ue(t.dataTransfer.items), e.prev = 3, n.s(); case 5: if ((a = n.n()).done) { e.next = 49; break } if (i = a.value, console.log(i), "file" !== i.kind) return e.abrupt("continue", 47); e.next = 10; break; case 10: if (r = i.getAsFile(), a = r.name.toLowerCase().endsWith(".json"), o = r.name.toLowerCase().endsWith(".gpkg"), a) return e.prev = 14, e.next = 17, r.text(); e.next = 28; break; case 17: l = e.sent, "Potree" === (l = JSON.parse(l)).type && Potree.loadProject(viewer, l), e.next = 26; break; case 22: e.prev = 22, e.t0 = e.catch(14), console.error("failed to parse the dropped file as JSON"), console.error(e.t0); case 26: e.next = 47; break; case 28: if (!o) { e.next = 47; break } if (0 < viewer.scene.pointclouds.length) { e.next = 36; break } console.error("At least one point cloud is needed that specifies the coordinate reference system before loading vector data."), e.next = 47; break; case 36: return proj4.defs("WGS84", "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"), proj4.defs("pointcloud", c.getProjection()), s = proj4("WGS84", "pointcloud"), e.next = 41, r.arrayBuffer(); case 41: return l = e.sent, u = { transform: s, source: r.name }, e.next = 45, Potree.GeoPackageLoader.loadBuffer(l, u); case 45: u = e.sent, viewer.scene.addGeopackage(u); case 47: e.next = 5; break; case 49: e.next = 54; break; case 51: e.prev = 51, e.t1 = e.catch(3), n.e(e.t1); case 54: return e.prev = 54, n.f(), e.finish(54); case 57: case "end": return e.stop() } }, e, null, [[3, 51, 54, 57], [14, 22]]) })); return function(e) { return t.apply(this, arguments) } }(); $("body")[0].addEventListener("dragenter", e), $("body")[0].addEventListener("dragover", e), $("body")[0].addEventListener("drop", t) } }, { key: "updateAnnotations", value: function() { var s = this; this.visibleAnnotations || (this.visibleAnnotations = new Set), this.scene.annotations.updateBounds(), this.scene.cameraP.updateMatrixWorld(), this.scene.cameraO.updateMatrixWorld(); var l = this.renderer.getSize(new yn) , u = this , c = []; this.scene.annotations.traverse(function(e) { if (e === s.scene.annotations) return !0; if (!e.visible) return !1; e.scene = s.scene; var t = e.domElement; (n = e.position.clone()).add(e.offset); var n = n || e.boundingBox.getCenter(new Cn) , i = u.scene.cameraP.position.distanceTo(n) , r = e.boundingBox.getBoundingSphere(new qn).radius , a = new Cn , o = 0; a.copy(n).project(s.scene.getActiveCamera()), a.x = l.x * (a.x + 1) / 2, a.y = l.y * (1 - (a.y + 1) / 2), o = u.scene.cameraMode == em.PERSPECTIVE ? (n = Math.PI * u.scene.cameraP.fov / 180, n = Math.tan(n / 2), r * (.5 * l.y / (n * i))) : Jf.projectedRadiusOrtho(r, u.scene.cameraO.projectionMatrix, l.x, l.y), t.css("left", a.x + "px"), t.css("top", a.y + "px"); i = 1e7 - i * (1e7 / s.scene.cameraP.far); if (e.descriptionVisible && (i += 1e7), t.css("z-index", parseInt(i)), 0 < e.children.length) { o = o > e.collapseThreshold || e.boundingBox.containsPoint(s.scene.getActiveCamera().position); return (e.expand = o) || -1 <= a.z && a.z <= 1 && c.push(e), o } -1 <= a.z && a.z <= 1 && c.push(e) }); for (var e = new Set(this.visibleAnnotations), t = 0, n = c; t < n.length; t++) { var i = n[t]; i.display = !0, e.delete(i) } this.visibleAnnotations = c; var r, a = ue(e); try { for (a.s(); !(r = a.n()).done; ) r.value.display = !1 } catch (e) { a.e(e) } finally { a.f() } } }, { key: "updateMaterialDefaults", value: function(e) { var t = e.material , e = e.getAttribute("intensity"); null != e && t.intensityRange[0] === 1 / 0 && (t.intensityRange = Q(e.range)) } }, { key: "update", value: function(e, t) { Potree.measureTimings && performance.mark("update-start"), this.dispatchEvent({ type: "update_start", delta: e, timestamp: t }), this.updateScreenSize(); var n = this.scene , i = n.getActiveCamera() , r = this.scene.pointclouds.filter(function(e) { return e.visible }); Potree.pointLoadLimit = 2 * Potree.pointBudget; var a = i.position.clone().add(i.getWorldDirection(new Cn).multiplyScalar(1e3)); this.scene.directionalLight.position.copy(i.position), this.scene.directionalLight.lookAt(a); var o, s = ue(r); try { for (s.s(); !(o = s.n()).done; ) { var l = o.value; l.showBoundingBox = this.showBoundingBox, l.generateDEM = this.generateDEM, l.minimumNodePixelSize = this.minNodeSize; var u = l.material; u.uniforms.uFilterReturnNumberRange.value = this.filterReturnNumberRange, u.uniforms.uFilterNumberOfReturnsRange.value = this.filterNumberOfReturnsRange, u.uniforms.uFilterGPSTimeClipRange.value = this.filterGPSTimeRange, u.uniforms.uFilterPointSourceIDClipRange.value = this.filterPointSourceIDRange, u.classification = this.classifications, u.recomputeClassification(), this.updateMaterialDefaults(l) } } catch (e) { s.e(e) } finally { s.f() } if (this.showBoundingBox) { var c = this.scene.scene.getObjectByName("potree_bounding_box_root"); c || ((a = new Si).name = "potree_bounding_box_root", this.scene.scene.add(a), c = a); var d, h = [], p = ue(this.scene.pointclouds); try { for (p.s(); !(d = p.n()).done; ) { var f, m = ue(d.value.visibleNodes.filter(function(e) { return void 0 !== e.boundingBoxNode })); try { for (m.s(); !(f = m.n()).done; ) { var v = f.value.boundingBoxNode; h.push(v) } } catch (e) { m.e(e) } finally { m.f() } } } catch (e) { p.e(e) } finally { p.f() } c.children = h } this.freeze, this.scene.cameraP.fov = this.fov; c = this.getControls(); c === this.deviceControls ? (this.controls.setScene(n), this.controls.update(e), this.scene.cameraP.position.copy(n.view.position), this.scene.cameraO.position.copy(n.view.position)) : null !== c && (c.setScene(n), c.update(e), this.viewports.forEach(function(e) { e.active && e.view.applyToCamera(e.camera) })), this.cameraChanged(); var g = []; g.push.apply(g, Q(this.scene.volumes.filter(function(e) { return e.clip && e instanceof Zp }))); var y, w = ue(this.scene.profiles); try { for (w.s(); !(y = w.n()).done; ) { var b = y.value; g.push.apply(g, Q(b.boxes)) } } catch (e) { w.e(e) } finally { w.f() } var x, E = g.filter(function(e) { return 0 !== e.matrixWorld.determinant() }).map(function(e) { e.updateMatrixWorld(); var t = e.matrixWorld.clone().invert() , n = e.getWorldPosition(new Cn); return { box: e, inverse: t, position: n } }), _ = this.scene.polygonClipVolumes.filter(function(e) { return e.initialized }), M = ue(r); try { for (M.s(); !(x = M.n()).done; ) { var A = x.value; A.material.setClipBoxes(E), A.material.setClipPolygons(_, this.clippingTool.maxPolygonVertices), A.material.clipTask = this.clipTask, A.material.clipMethod = this.clipMethod } } catch (e) { M.e(e) } finally { M.f() } var T, S = ue(r); try { for (S.s(); !(T = S.n()).done; ) T.value.material.elevationGradientRepeat = this.elevationGradientRepeat } catch (e) { S.e(e) } finally { S.f() } this.navigationCube.update(i.rotation), this.updateAnnotations(), this.mapView && (this.mapView.update(e), this.mapView.sceneProjection && $("#potree_map_toggle").css("display", "block")), TWEEN.update(t), gv.update(e), this.transformationTool.update(), "pano" != Potree.settings.editType && "merge" != Potree.settings.editType && (this.modules.ParticleEditor.update(e), this.mapViewer.update(e)), this.dispatchEvent({ type: "update", delta: e, timestamp: t }), Potree.measureTimings && (performance.mark("update-end"), performance.measure("update", "update-start", "update-end")), this.reticule.updateVisible() } }, { key: "updateViewPointcloud", value: function(e, t, n) { var i, r = Potree.updatePointClouds(this.scene.pointclouds, e, t), a = (performance.now(), e.position), o = 1 / 0, s = ue(this.scene.orientedImages); try { for (s.s(); !(i = s.n()).done; ) { var l, u = ue(i.value.images); try { for (u.s(); !(l = u.n()).done; ) var c = l.value.mesh.position.distanceTo(a) , o = Math.min(o, c) } catch (e) { u.e(e) } finally { u.f() } } } catch (e) { s.e(e) } finally { s.f() } performance.now(); var d = e.near , t = e.far; e.limitFar || r.lowestSpacing === 1 / 0 || (r = -this.getBoundingBox().applyMatrix4(e.matrixWorldInverse).min.z, r = Math.max(1.5 * r, 1e4), r = Math.max(r, d + 1e4), e.far = r), t != e.far && e.updateProjectionMatrix() } }, { key: "getPRenderer", value: function() { return this.useHQ ? (this.hqRenderer || (this.hqRenderer = new eg(this)), this.hqRenderer.useEDL = this.useEDL, this.hqRenderer) : (this.edlRenderer || (this.edlRenderer = new $v(this)), this.edlRenderer) } }, { key: "renderVR", value: function() { var e = this.renderer; e.setClearColor(5570560, 0), e.clear(); var t = e.xr , n = new $r , i = t.getCamera(n); if (2 === i.cameras.length) { t = this.vrControls.getCamera.bind(this.vrControls); "skybox" === viewer.background ? e.setClearColor(16711680, 1) : "gradient" === viewer.background ? e.setClearColor(1122867, 1) : "black" === viewer.background ? e.setClearColor(0, 1) : "white" === viewer.background ? e.setClearColor(16777215, 1) : e.setClearColor(0, 0), e.clear(), "skybox" === this.background ? (r = this.skybox, n = t(), r.camera.rotation.copy(n.rotation), r.camera.fov = n.fov, r.camera.aspect = n.aspect, (n = r.parent).rotation.x = Math.PI / 2, n.updateMatrix(), n.updateMatrixWorld(), r.camera.updateMatrix(), r.camera.updateMatrixWorld(), r.camera.updateProjectionMatrix(), e.render(r.scene, r.camera)) : this.background, this.renderer.xr.getSession().updateRenderState({ depthNear: .1, depthFar: 1e4 }); var r = null , a = null; (r = t()).position.z -= .8 * r.scale.x, r.parent = null, r.near = viewer.scene.getActiveCamera().near, r.far = viewer.scene.getActiveCamera().far, r.updateMatrix(), r.updateMatrixWorld(), this.scene.scene.updateMatrix(), this.scene.scene.updateMatrixWorld(), this.scene.scene.matrixAutoUpdate = !1; a = r.matrixWorld.clone().clone().invert(); this.scene.scene.matrix.copy(a), this.scene.scene.matrixWorld.copy(a), r.matrix.identity(), r.matrixWorld.identity(), r.matrixWorldInverse.identity(), e.render(this.scene.scene, r), this.scene.scene.matrixWorld.identity(); var o, s = ue(this.scene.pointclouds); try { for (s.s(); !(o = s.n()).done; ) { var l = o.value , u = i.cameras[0].viewport; l.material.useEDL = !1, l.screenHeight = u.height, l.screenWidth = u.width } } catch (e) { s.e(e) } finally { s.f() } var c, d = ue(i.cameras); try { for (d.s(); !(c = d.n()).done; ) { var h = c.value , p = h.viewport; e.setViewport(p.x, p.y, p.width, p.height); var f = h.projectionMatrix.clone().invert() , m = new Mn(0,1,-1,1).applyMatrix4(f).y / Math.PI * 180; h.fov = m; var v, g = ue(this.scene.pointclouds); try { for (g.s(); !(v = g.n()).done; ) v.value.material.useEDL = !1 } catch (e) { g.e(e) } finally { g.f() } var y = a.clone().invert(); y.multiply(h.matrixWorld); var w = y.clone().invert(); this.pRenderer.render(this.scene.scenePointCloud, h, null, { viewOverride: w }) } } catch (e) { d.e(e) } finally { d.f() } t = t(); t.parent = null, e.render(this.sceneVR, t), e.resetState() } } }, { key: "clear", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {} , t = e.background || this.background , n = (null == e.backgroundOpacity ? this : e).backgroundOpacity , i = this.renderer; t instanceof Yi ? i.setClearColor(t, n) : "skybox" === t || "gradient" === t ? i.setClearColor(0, 0) : "black" === t ? i.setClearColor(0, 1) : "white" === t ? i.setClearColor(16777215, 1) : i.setClearColor(t, n), e.target || i.clear() } }, { key: "renderDefault", value: function() { var s, e, l, u, c = this, d = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; this.visible && !this.paused && (s = this.getPRenderer(), e = d.viewports || this.viewports, l = d.target ? new yn(d.target.width,d.target.height) : this.renderer.getSize(new yn), u = 1 < e.filter(function(e) { return e.active }).length || d.resize, e.forEach(function(e) { var t, n, i, r, a, o = $.extend({}, d); o.viewport = e, o.camera = o.camera || e.camera, o.extraEnableLayers = e.extraEnableLayers, o.cameraLayers = e.cameraLayers, e.active && (i = Math.ceil(l.x * e.left), r = Math.ceil(l.y * e.bottom), a = d.target ? (t = Math.ceil(l.x * e.width), Math.ceil(l.y * e.height)) : (t = e.resolution.x, e.resolution.y), 0 != t && 0 != a && (n = e.width < 1 || e.height < 1, d.target ? (d.target.viewport.set(i, r, t, a), n && d.target.scissor.set(i, r, t, a), d.target.scissorTest = n) : (c.renderer.setViewport(i, r, t, a), n && c.renderer.setScissor(i, r, t, a), c.renderer.setScissorTest(n)), u && c.emitResizeMsg({ viewport: e }), viewer.dispatchEvent({ type: "render.begin", viewer: viewer, viewport: e, params: o }), e.render && e.render($.extend({}, o, { renderer: c.renderer, clear: c.clear.bind(c), resize: null, renderOverlay: c.renderOverlay.bind(c), force: !e.noPointcloud })), e.noPointcloud || (e.render && (o.noBG = !0), e.beforeRender && e.beforeRender(), c.updateViewPointcloud(o.camera, e.resolution2, !0), o.background = e.background, o.backgroundColor = e.backgroundColor, o.backgroundOpacity = e.backgroundOpacity, e.render || c.clear(o), s.clearTargets(o), s.render(o)), e.render || c.renderOverlay(o), e.afterRender && e.afterRender(), c.dispatchEvent({ type: "render.end", viewer: c, viewport: e }))) }), this.renderer.setRenderTarget(null)) } }, { key: "renderOverlay", value: function(e) { var t, n = e.camera || this.scene.getActiveCamera(); this.reticule.updateAtViewports(e.viewport), (t = e.cameraLayers || (e.isMap ? ["bothMapAndScene"] : ["sceneObjects", "model", "bothMapAndScene"])).length && (this.setCameraLayers(n, t, e.extraEnableLayers), this.renderer.render(this.scene.scene, n)), this.dispatchEvent({ type: "render.pass.scene", viewer: viewer }), this.renderer.clearDepth(), e.magnifier || (this.dispatchEvent({ type: "render.pass.perspective_overlay", camera: n, screenshot: e.screenshot }), e.screenshot || e.isMap || (this.setCameraLayers(n, ["magnifier"]), this.renderer.render(this.scene.scene, n))), e.isMap || (this.setCameraLayers(n, ["volume", "transformationTool"]), this.renderer.render(this.clippingTool.sceneVolume, n), this.renderer.render(this.transformationTool.scene, n)) } }, { key: "setLimitFar", value: function(e) { viewer.mainViewport.camera.limitFar = !!e, e && (viewer.mainViewport.camera.near = .02, viewer.mainViewport.camera.far = "showPanos" == Potree.settings.displayMode ? viewer.farWhenShowPano : Potree.settings.cameraFar, viewer.mainViewport.camera.updateProjectionMatrix()) } }, { key: "setCameraLayers", value: function(t, e) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : []; t.layers.disableAll(), e.concat(n).forEach(function(e) { e = Potree.config.renderLayers[e]; null != e ? t.layers.enable(e) : console.error("setCameraLayer没找到layer!") }) } }, { key: "setObjectLayers", value: function(e, t) { var n = Potree.config.renderLayers[t]; null != n ? e.traverse(function(e) { e.layers.set(n) }) : console.error("setCameraLayer没找到layer!") } }, { key: "updateVisible", value: function(t, n, e) { var i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0 , r = 4 < arguments.length ? arguments[4] : void 0; t.unvisibleReasons || (t.unvisibleReasons = []), t.visibleReasons || (t.visibleReasons = []); var a; e ? (-1 < (a = t.unvisibleReasons.findIndex(function(e) { return e.reason == n })) && (r = "cancel", t.unvisibleReasons.splice(a, 1)), "add" == r && (t.visibleReasons.some(function(e) { return e.reason == n }) || t.visibleReasons.push({ reason: n, level: i }))) : (-1 < (a = t.visibleReasons.findIndex(function(e) { return e.reason == n })) && (r = "cancel", t.visibleReasons.splice(a, 1)), "cancel" != r && (t.unvisibleReasons.some(function(e) { return e.reason == n }) || t.unvisibleReasons.push({ reason: n, level: i }))), function() { t.unvisibleReasons = t.unvisibleReasons.sort(function(e, t) { return t.level - e.level }), t.visibleReasons = t.visibleReasons.sort(function(e, t) { return t.level - e.level }); var e = t.visibleReasons[0] ? t.visibleReasons[0].level : -1 , e = (t.unvisibleReasons[0] ? t.unvisibleReasons[0].level : -1) <= e; t.visible != e && (t.visible = e, t.dispatchEvent({ type: "isVisible", visible: e, reason: n })) }() } }, { key: "getObjVisiByReason", value: function(e, t) { return !!e.visible || (!e.unvisibleReasons || !e.unvisibleReasons.some(function(e) { return e.reason == t })) } }, { key: "render", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; Potree.measureTimings && performance.mark("render-start"), this.outlinePass.selectedObjects.length && !e.screenshot ? this.composer.render(this.inputHandler.interactiveScenes.concat(this.scene.scene).concat(viewer.scene.scenePointCloud), null, this.viewports, this.renderDefault.bind(this)) : this.renderDefault(e), Potree.measureTimings && (performance.mark("render-end"), performance.measure("render", "render-start", "render-end")) } }, { key: "startScreenshot", value: function() { var n = this , i = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {} , r = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 800 , a = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 400 , o = 3 < arguments.length ? arguments[3] : void 0 , s = i.deferred || $.Deferred() , l = i.map ? this.mapViewer : this , u = "measure" == i.type || i.map; if (this.images360.flying) return i.deferred = s, this.images360.addEventListener("cameraMoveDone", function e() { n.startScreenshot(i, r, a, o), n.images360.removeEventListener("cameraMoveDone", e) }), s.promise(); var c = Date.now(); console.log("startScreenshot: " + c); var d, e, h = function() { n.viewports.forEach(function(e) { e.view.applyToCamera(e.camera), n.dispatchEvent({ type: "camera_changed", camera: e.camera, viewport: e, changeInfo: { positionChanged: !0, changed: !0 } }) }) }, t = function() { u && (viewer.mapViewer.needRender = !0); var e = l.makeScreenshot(new yn(r,a), null, o).dataUrl; Potree.settings.isOfficial || Fm.downloadFile(e, "screenshot.jpg"); function t() { m.viewports.forEach(function(t) { var e = f.find(function(e) { return e.name == t.name }); e.left = t.left, e.width = t.width, e.view.copy(t.view), e.view.applyToCamera(e.camera) }), viewer.updateScreenSize({ forceUpdateSize: !0 }), h(), s.resolve(e), console.log("screenshot done: " + c) } "measure" == i.type && (n.scene.measurements.forEach(function(e) { return n.updateVisible(e, "screenshot", !0) }), i.measurement.setSelected(!1, "screenshot")), n.images360.panos.forEach(function(e) { viewer.updateVisible(e, "screenshot", !0) }), viewer.updateVisible(n.reticule, "screenshot", !0), u && (viewer.updateVisible(n.mapViewer.cursor, "screenshot", !0), m.attachedToViewer != n.mapViewer.attachedToViewer && "measure" == i.type && n.mapViewer.attachToMainViewer(!1), d.camera.zoom = m.mapZoom, d.camera.updateProjectionMatrix()), "showPanos" == Potree.settings.displayMode ? viewer.images360.flyToPano({ pano: m.pano, duration: 0, callback: function() { t() } }) : t() }, p = this.mainViewport, f = [p], m = { viewports: [p.clone()], pano: "showPanos" == Potree.settings.displayMode ? viewer.images360.currentPano : null }; return u && (d = this.mapViewer.viewports[0], f.push(d), m.viewports.push(d.clone()), m.attachedToViewer = this.mapViewer.attachedToViewer, m.mapZoom = d.camera.zoom, viewer.updateVisible(this.mapViewer.cursor, "screenshot", !1)), i.hideMarkers && this.images360.panos.forEach(function(e) { viewer.updateVisible(e, "screenshot", !1) }), viewer.updateVisible(this.reticule, "screenshot", !1), "measure" == i.type ? (this.scene.measurements.forEach(function(e) { return n.updateVisible(e, "screenshot", e == i.measurement) }), i.measurement.setSelected(!0, "screenshot"), Potree.settings.floorplanEnable && this.mapViewer.attachToMainViewer(!0, "measure", .5), viewer.updateScreenSize({ forceUpdateSize: !0, width: r, height: a }), e = function() { u = n.mapViewer.attachedToViewer, h(); var e = "showPointCloud" == Potree.settings.displayMode ? 500 : 0; u ? setTimeout(function() { n.mapViewer.waitLoadDone(t.bind(n)) } .bind(n), e) : setTimeout(t.bind(n), e) } , this.focusOnObject(i.measurement, "measure", 0, { basePanoSize: 1024 }).promise.done(function() { n.updateDatasetAt(!0), n.modules.SiteModel.updateEntityAt(!0), !n.mapViewer.mapLayer.maps.some(function(e) { return e.name.includes("floorplan") && e.objectGroup.visible }) && n.mapViewer.attachedToViewer ? (n.mapViewer.attachToMainViewer(!1), viewer.updateScreenSize({ forceUpdateSize: !0, width: r, height: a }), n.focusOnObject(i.measurement, "measure", 0, { basePanoSize: 1024 }).promise.done(function() { e() })) : e() })) : t(), s.promise() } }, { key: "focusOnObject", value: function(u, t, n) { var c = this , s = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : {} , i = s.deferred || $.Deferred() , d = new Cn , h = new Cn; n = null == n ? 1e3 : n; function e(e, t, n, i) { var r = g.clone(); r.position.copy(i), r.lookAt(n), r.updateMatrix(), r.updateMatrixWorld(); var a = r.matrixWorldInverse , o = new kn; e ? e.forEach(function(e) { e = e.clone().applyMatrix4(a); o.expandByPoint(e) }) : o = t.applyMatrix4(a), e = o.getSize(new Cn), c.boundBox || (c.boundBox = new Hr(new Cl(1,1,1,1)), c.boundBox.material.wireframe = !0, c.boundBox.up.set(0, 0, 1), viewer.updateVisible(c.boundBox, "hidden", !1), c.setObjectLayers(c.boundBox, "sceneObjects"), c.scene.scene.add(c.boundBox)), c.boundBox.position.copy(n), c.boundBox.scale.copy(e), c.boundBox.lookAt(i), e.x *= 1.1, e.y *= 1.1; var t = e.x / e.y; return E = g.aspect > t ? e.y / 2 / Math.tan(gn.degToRad(g.fov / 2)) + e.z / 2 : (t = Rg.getHFOVForCamera(g, !0), e.x / 2 / Math.tan(t / 2) + e.z / 2), E = Math.max(.1, E), i = (new Cn).subVectors(i, n).normalize(), s.dontLookUp && i.z < 0 && i.negate(), h.copy(n).add(i.multiplyScalar(E)), h } var r, a, o, l, p, f, m, v, g = viewer.scene.getActiveCamera(), y = g.position.clone(); if (this.images360.flying) return this.images360.addEventListener("cameraMoveDone", function e() { c.focusOnObject(u, t, n, $.extend(s, { deferred: i })), c.images360.removeEventListener("cameraMoveDone", e) }), { promise: i.promise() }; if ("measure" == t) { if (d.copy(u.getCenter()), u.facePlane ? (u.facePlane && (l = u.facePlane.normal.clone()), r = this.scene.view.direction.angleTo(l), (a = gn.degToRad(60)) < r && r < Math.PI - a && (r < Math.PI / 2 && l.negate(), o = (new Cn).subVectors(g.position, d).normalize(), p = (new Cn).addVectors(o, l), y.copy(d.clone().add(p)))) : 2 == u.points.length ? (o = (new Cn).subVectors(u.points[0], u.points[1]).normalize(), ((l = this.scene.view.direction.angleTo(o)) < (p = .25 * Math.PI) || l > Math.PI - p) && (l > Math.PI / 2 && o.negate(), v = (new Cn).subVectors(g.position, d).normalize(), f = (new Cn).addVectors(o, v).normalize(), v = (new Cn).addVectors(v, f), y.copy(d.clone().add(v)))) : console.error("measure 没有facePlane points点数还不为2?"), h = e(u.points, null, d, y), this.mapViewer && (f = new yn(4,4), m = new kn, u.points.forEach(function(e) { m.expandByPoint(e) }), (v = m.getSize(new Cn).clone().multiplyScalar(2)).x = Math.max(f.x, v.x), v.y = Math.max(f.y, v.y), this.mapViewer.moveTo(d.clone(), v, n)), "showPointCloud" == Potree.settings.displayMode) { var w = .3; !function() { var t = c.inputHandler.ifBlockedByIntersect(h, null, !0, d); if (t) { for (var e, n = 0, i = 0, r = 0; r < u.points.length; r++) { var a = u.points[r]; if (c.inputHandler.ifBlockedByIntersect(a, .3, !0, h, 4)) { if (.5 <= ++n / u.points.length) { e = !1; break } } else if (.5 < ++i / u.points.length) { e = !0; break } } var o, s, l = function() { var e = (new Cn).subVectors(h, d).normalize().multiplyScalar(t.distance); h.copy(d).add(e), console.log("checkIntersect newPos", h.clone()) }; (e = null == e ? .5 < i / u.points.length : e) || (t.distance < w ? (console.log("检测到intersect 反向", t.distance), o = h.clone(), s = (new Cn).subVectors(h, d), h.copy(d).sub(s), (s = c.inputHandler.ifBlockedByIntersect(h, null, !0, d)) && (s.distance < t.distance && h.copy(o), l())) : l()) } }() } else if ("showPanos" == Potree.settings.displayMode) { var b = viewer.images360.fitPanoTowardPoint({ target: d, point: h, bestDistance: 0, checkIntersect: s.checkIntersect }); if (b && viewer.images360.flyToPano({ pano: b, target: d, duration: n, deferred: i, dontMoveMap: !0, basePanoSize: s.basePanoSize }), viewer.images360.currentPano != b) return { promise: i.promise() }; var x = viewer.images360.currentPano.position.distanceTo(d) , b = h.distanceTo(d); return console.log("dis1 / dis2", x / b, "dis1-dis2", x - b), { mag: 1.5 < x / b && 10 < x - b ? "tooFar" : "posNoChange", promise: i.promise() } } } else if ("tag" == t || "point" == t) { d.copy(u.position); var E, x = s.distance || 3; if (!s.dontMoveMap && this.mapViewer && this.mapViewer.moveTo(d.clone(), null, n), "showPointCloud" == Potree.settings.displayMode) s.dontChangePos ? h.copy(y) : (E = x, b = (s.direction ? s.direction.clone() : this.mainViewport.view.direction).negate(), s.dontLookUp && b.z < 0 && (b.z *= -1), h.copy(d).add(b.multiplyScalar(E))); else if ("showPanos" == Potree.settings.displayMode) { x = viewer.images360.fitPanoTowardPoint({ point: d, bestDistance: x }); return x && viewer.images360.flyToPano({ pano: x, target: d, duration: n, deferred: i, dontMoveMap: !0, basePanoSize: s.basePanoSize }), { promise: i.promise() } } } else if (u.boundingBox && "boundingBox" == t && (d = u.boundingBox.getCenter(new Cn), h = e(u.points, u.boundingBox, d, y), "showPanos" == Potree.settings.displayMode)) { y = viewer.images360.fitPanoTowardPoint({ point: h, bestDistance: 0 }); return y && viewer.images360.flyToPano({ pano: y, target: d, duration: n, deferred: i, dontMoveMap: !0, basePanoSize: s.basePanoSize }), y || console.error("no pano"), { promise: i.promise() } } return viewer.scene.view.setView({ position: h, target: d, duration: n, callback: function() { i.resolve() } }), { promise: i.promise() } } }, { key: "flyToDataset", value: function() { function e() { var e = [ly.scoreFunctions.distanceSquared({ position: o })]; if ((e = Fm.sortByScore(r.panos, [], e)) && e.length) return e[0].item } var t, n, i = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, r = i instanceof Si ? i : i.pointcloud || this.scene.pointclouds.find(function(e) { return e.dataset_id == i.id }), a = null == i.duration ? 1e3 : i.duration, o = r.bound.getCenter(new Cn); if ("showPanos" == Potree.settings.displayMode) { var s = e(); if (!s) return !1; if (s == this.images360.currentPano) return "posNoChange"; this.images360.flyToPano({ pano: s }) } else if (n = o, r.panosBound && (n = r.panosBound.center.clone(), (s = e()) && (t = s.position, n.z = t.z)), this.modules.Clip.editing) n.z = o.z, this.modules.Clip.bus.dispatchEvent({ type: "flyToPos", position: n }); else { if (Up.closeTo(n, this.images360.position)) return "posNoChange"; viewer.scene.view.setView({ position: n, target: t, duration: a }), i.dontMoveMap || viewer.mapViewer.moveTo(n.clone(), null, a) } return !0 } }, { key: "resolveTimings", value: function(e) { if (Potree.measureTimings && (this.toggle || (this.toggle = e), 1e3 < e - this.toggle)) { var t, n = performance.getEntriesByType("measure"), i = new Set, r = ue(n); try { for (r.s(); !(t = r.n()).done; ) { var a = t.value; i.add(a.name) } } catch (e) { r.e(e) } finally { r.f() } var o, s = new Map, l = ue(i); try { for (l.s(); !(o = l.n()).done; ) { var u = o.value; s.set(u, { measures: [], sum: 0, n: 0, min: 1 / 0, max: -1 / 0 }) } } catch (e) { l.e(e) } finally { l.f() } var c, d = ue(n); try { for (d.s(); !(c = d.n()).done; ) { var h = c.value , p = s.get(h.name); p.measures.push(h), p.sum += h.duration, p.n++, p.min = Math.min(p.min, h.duration), p.max = Math.max(p.max, h.duration) } } catch (e) { d.e(e) } finally { d.f() } var f, m = ue(Potree.resolveQueries(this.renderer.getContext())); try { for (m.s(); !(f = m.n()).done; ) { var v = N(f.value, 2) , g = v[0] , y = v[1] , w = { measures: y.map(function(e) { return { duration: e } }), sum: y.reduce(function(e, t) { return e + t }, 0), n: y.length, min: Math.min.apply(Math, Q(y)), max: Math.max.apply(Math, Q(y)) } , b = "[tq] ".concat(g); s.set(b, w), i.add(b) } } catch (e) { m.e(e) } finally { m.f() } var x, E = ue(s); try { for (E.s(); !(x = E.n()).done; ) { var _ = N(x.value, 2) , M = (_[0], _[1]); M.mean = M.sum / M.n, M.measures.sort(function(e, t) { return e.duration - t.duration }), 1 === M.n ? M.median = M.measures[0].duration : 1 < M.n && (M.median = M.measures[parseInt(M.n / 2)].duration) } } catch (e) { E.e(e) } finally { E.f() } var A = Array.from(i).reduce(function(e, t) { return Math.max(e, t.length) }, 0) + 5 , T = " ".concat("NAME".padEnd(A), " |") + " ".concat("MIN".padStart(10), " |") + " ".concat("MEDIAN".padStart(10), " |") + " ".concat("MAX".padStart(10), " |") + " ".concat("SAMPLES".padStart(6), " \n"); T += " ".concat("-".repeat(T.length), "\n"); var S, C = ue(i = Array.from(i).sort()); try { for (C.s(); !(S = C.n()).done; ) { var P = S.value , D = s.get(P) , k = D.min.toFixed(3) , B = D.median.toFixed(3) , L = D.max.toFixed(3) , R = D.n; T += " ".concat(P.padEnd(A), " |") + " ".concat(k.padStart(10), " |") + " ".concat(B.padStart(10), " |") + " ".concat(L.padStart(10), " |") + " ".concat(R.toString().padStart(6), "\n") } } catch (e) { C.e(e) } finally { C.f() } T += "\n", console.log(T), performance.clearMarks(), performance.clearMeasures(), this.toggle = e } } }, { key: "loop", value: function(e) { this.stats && this.stats.begin(), Potree.measureTimings && performance.mark("loop-start"), this.update(this.clock.getDelta(), e), this.magnifier.render(), this.render(), Potree.measureTimings && (performance.mark("loop-end"), performance.measure("loop", "loop-start", "loop-end")), this.resolveTimings(e), Potree.framenumber++, this.stats && this.stats.end() } }, { key: "postError", value: function(e) { e = this.postMessage(e, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}); return e.element.addClass("potree_message_error"), e } }, { key: "postMessage", value: function(e) { var t = this , n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {} , i = new Xv(e); return i.element.css("display", "none"), i.elClose.click(function() { i.element.slideToggle(100); var e = t.messages.indexOf(i); 0 <= e && t.messages.splice(e, 1) }), this.elMessages.prepend(i.element), i.element.slideToggle(100), this.messages.push(i), void 0 !== n.duration && setTimeout(function() { i.element.animate({ opacity: 0 }, 500), i.element.slideToggle(200) }, n.duration), i } }, { key: "getBoundingBox", value: function(e) { return this.bound || this.updateModelBound(), this.bound.boundingBox.clone() } }, { key: "updateModelBound", value: function() { var t = this; this.bound = Jf.computePointcloudsBound(this.scene.pointclouds), Potree.settings.boundAddObjs && (this.objs.children.forEach(function(e) { t.bound.boundingBox.union(e.boundingBox.clone().applyMatrix4(e.matrixWorld)) }), this.bound.boundingBox.getSize(this.bound.boundSize), this.bound.boundingBox.getCenter(this.bound.center)), viewer.farWhenShowPano = 10 * this.bound.boundSize.length(); var e = new kn; e.expandByPoint(this.bound.boundingBox.min.clone()), e.expandByPoint(this.bound.boundingBox.max.clone().setZ(this.bound.center.z)), Fg.boundPlane = e, Fg.standardSpeed = gn.clamp(Math.sqrt(this.bound.boundSize.length()) / 100, .02, .5), viewer.scene.pointclouds.forEach(function(e) { e.material.heightMin = t.bound.boundingBox.min.z, e.material.heightMax = t.bound.boundingBox.max.z }), this.dispatchEvent({ type: "updateModelBound" }) } }, { key: "waitForLoad", value: function(e, t) { this.waitQueue.push({ object: e, isLoadedCallback: t }), 1 === this.waitQueue.length && this.dispatchEvent({ type: "loading", show: !0 }) } }, { key: "ifAllLoaded", value: function(e) { 0 < this.waitQueue.length && (this.waitQueue = this.waitQueue.filter(function(e) { return !e.isLoadedCallback() })), 0 === this.waitQueue.length && this.dispatchEvent({ type: "loading", show: !1 }) } }, { key: "setView", value: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; null != e.pano ? this.images360.flyToPano(e) : this.scene.view.setView($.extend({}, e, { callback: function() { e.displayMode && (Potree.settings.displayMode = e.displayMode), e.callback && e.callback() } })) } }, { key: "setPointStandardMat", value: function(e, t, n) { var i = this; if (console.log("setPointStandardMat", e), e) { if (this.pointStatesBefore) return console.error("已设置过pointStatesBefore!"); this.pointStatesBefore = { opacity: new Map, size: new Map, density: Potree.settings.pointDensity, useEDL: this.getEDLEnabled(), shape: viewer.scene.pointclouds[0].material.shape }, viewer.scene.pointclouds.forEach(function(e) { i.pointStatesBefore.opacity.set(e, e.temp.pointOpacity), i.pointStatesBefore.colorType = e.material.activeAttributeName, n && i.pointStatesBefore.size.set(e, e.temp.pointSize) }), t && (Potree.settings.pointDensity = t), n && (Potree.settings.sizeFitToLevel = !0), viewer.scene.pointclouds.forEach(function(e) { e.material.activeAttributeName = "rgba", e.material.shape = Potree.PointShape.SQUARE, n && e.changePointSize(Potree.config.material.realPointSize, !0), e.changePointOpacity(1) }), viewer.setEDLEnabled(!1) } else { if (!this.pointStatesBefore) return console.error("未设置过pointStatesBefore!"); Potree.settings.sizeFitToLevel = !1, t && (Potree.settings.pointDensity = this.pointStatesBefore.pointDensity), viewer.scene.pointclouds.forEach(function(e) { e.material.activeAttributeName = i.pointStatesBefore.colorType, e.changePointOpacity(i.pointStatesBefore.opacity.get(e)), e.material.shape = i.pointStatesBefore.shape; var t = i.pointStatesBefore.size.get(e); t && e.changePointSize(t) }), viewer.setEDLEnabled(this.pointStatesBefore.useEDL), this.pointStatesBefore = null } } }, { key: "transformObject", value: function(e) { var t = viewer.inputHandler.selection[0]; if (e) { if (t && t != e) return this.transformObject(null); e.boundingBox || (e.boundingBox = new kn), viewer.inputHandler.selection.includes(e) || viewer.inputHandler.toggleSelection(e) } else t && viewer.inputHandler.toggleSelection(t) } }, { key: "pointInWhichPointcloud", value: function(n) { var e = Fm.sortByScore(this.scene.pointclouds, [], [function(e) { var t = e.pcoGeometry.tightBoundingBox.getSize(new Cn) , e = e.bound.getCenter(new Cn); return t.length() / 2 / n.distanceTo(e) } ]); return 1 < (e && e[0]).score ? e[0].item : null } }, { key: "loadModel", value: function(r, a, t, e) { var o = this , s = new kn; Potree.settings.boundAddObjs || (s.min.set(-.5, -.5, -.5), s.max.set(.5, .5, .5)); function n(n, e, t) { function i(e) { var t = r.transform[e]; t && (t instanceof Array ? n[e].fromArray(t) : n[e].copy(t)) } n.updateMatrixWorld(), e = Math.round(e / 1024 / 1024 * 100) / 100, null != r.id && (n.dataset_id = r.id), console.log(t.split("/").pop(), "加载完毕, 模型数据量:" + e + "M"), o.setObjectLayers(n, "model"), n.traverse(function(e) { var t; e instanceof Hr && (e.renderOrder = 10, Potree.settings.boundAddObjs && (e.geometry.computeBoundingBox(), s.union(e.geometry.boundingBox.clone().applyMatrix4(e.matrixWorld))), Fm.makeTexDontResize(e.material.map), !r.unlit || e.material instanceof $i && "glb" != l || (t = new fx({ map: e.material.map }), e.material = t), e.material instanceof Hu && (e.material.roughness = .6, e.material.metalness = .3)) }), n.name = null != r.name ? r.name : "obj", o.objs.add(n), n.boundingBox = s, i("position"), i("rotation"), i("scale"), r.moveWithPointcloud && (n.updateMatrix(), n.matrixAutoUpdate = !1, n.matrix.premultiply(viewer.scene.pointclouds[0].transformMatrix), n.matrixWorldNeedsUpdate = !0), a && a(n) } function i(e) { e.lengthComputable && (e = e.loaded / e.total * 100, t && t(e)) } var l = r.objurl ? "obj" : "glb"; "obj" == l ? vx.mtlLoader.load(r.mtlurl, function(e) { e.preload(), vx.objLoader.setMaterials(e).load(r.objurl, function(e, t) { n(e, t, r.objurl) }) }, i, e) : "glb" == l && (vx.glbLoader.unlitMat = !0, vx.glbLoader.load(r.glburl, function(e, t) { n(e.scene, t, r.glburl) }, i, e)) } }, { key: "removeObj", value: function(e) { this.objs.remove(e), Potree.settings.boundAddObjs && this.updateModelBound() } }, { key: "loadGLTF", value: function() { var t = this , e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "87b3a367bc3e4273832cb4fa398782e5.glb"; new Qw(void 0,this.renderer).setPath(Potree.resourcePath + "/models/glb/").load(e, function(e) { console.log("loadGLTF", e), t.objs.add(e.scene) }) } }, { key: "addFire", value: function() { var e; "t-CwfhfqJ" == Potree.settings.number && (e = Potree.Utils.datasetPosTransform({ pointcloud: viewer.scene.pointclouds[0], position: new Cn(4.4318,-.580291847759,-.78), fromDataset: !0 }), viewer.modules.ParticleEditor.addParticle({ type: "fire", positions: [e], radius: .42, height: 10 }), viewer.modules.ParticleEditor.addParticle({ type: "smoke", positions: [(new Cn).addVectors(e, new Cn(0,0,.3))], positionStyle: "sphere", positionRadius: .3, sizeTween: [[0, .3, .9, 1], [.05, .1, 1, .8]], opacityBase: .2, opacityTween: [[0, .3, .7, .95, 1], [0, .2, 1, .1, 0]], velocityBase: new Cn(0,0,1), velocitySpread: new Cn(.2,.2,-.3), accelerationBase: .2, accelerationSpread: .7, radius: 0, particleDeathAge: 3 }), viewer.modules.ParticleEditor.addParticle({ type: "explode", name: "fire splash", position: (new Cn).addVectors(e, new Cn(0,0,.3)), size: .1, sizeRange: .3, sizeTween: [[0, .05, .3, .45], [0, .02, .1, .05]], opacityTween: [[0, .05, .3, .45], [1, 1, .5, 0]], speed: 1, speedRange: 4, radius: .1, acceleration: .3, accelerationRange: 1, particleSpaceTime: 0, strength: 4 })) } }, { key: "addVideo11", value: function() { var n, e, i, r, t = this; "SS-fckI7CClKC" == Potree.settings.number && ((n = $('')[0]).setAttribute("crossOrigin", "Anonymous"), e = new wl(n), (i = this.videoPlane = new Hr(new bu(1,1,1,1),new $i({ color: "#ffffff", transparent: !0, depthTest: !1, opacity: .7, side: 2, map: e }))).visible = !1, i.geometry.computeBoundingBox(), i.boundingBox = i.geometry.boundingBox.clone(), i.boundingBox.max.z = 1, i.boundingBox.max.y = -.4, i.boundingBox.max.x = 1, n.addEventListener("loadeddata", function(e) { n.play(), console.log("video loadeddata") }), i.scale.set(1.08, 1.92, 1), this.addEventListener("global_mousedown", function e() { n.play(), t.removeEventListener("global_mousedown", e) }), r = { 9: { rotation: [-1.432978005954197, 1.2296264545169697, 3.0098547630197667], position: [6.532456676287381, -9.806373049095631, -.024205281024294284] }, 19: { rotation: [1.627167773445286, -1.172425902600188, .04682299709711613], position: [-9.558613948539932, -1.042301166581578, .08159683876743667] } }, this.images360.addEventListener("flyToPano", function(e) { var t; "showPanos" == Potree.settings.displayMode && ((t = r[e.toPano.pano.id]) && setTimeout(function() { i.visible = !0, i.position.fromArray(t.position), i.rotation.fromArray(t.rotation), n.src = Potree.resourcePath + "/video/".concat(Potree.settings.number, "/").concat(e.toPano.pano.id, ".mp4"), n.play(), n.currentTime = 0, Potree.settings.zoom.enabled = !1, gv.start(vv(i.material, "opacity", 1), .4 * e.toPano.duration, function() {}, 0, pv.easeInOutQuad) }, .6 * e.toPano.duration), gv.start(vv(i.material, "opacity", 0), .4 * e.toPano.duration, function() { t || (i.visible = !1, n.pause(), Potree.settings.zoom.enabled = !0) }, 0, pv.easeInOutQuad)) }), this.images360.addEventListener("endChangeMode", function(e) { "showPanos" == e.mode ? (e = r[t.images360.currentPano.id]) && (i.visible = !0, i.position.fromArray(e.position), i.rotation.fromArray(e.rotation), i.material.opacity = 0, n.src = Potree.resourcePath + "/video/".concat(Potree.settings.number, "/").concat(t.images360.currentPano.id, ".mp4"), n.play(), n.currentTime = 0, Potree.settings.zoom.enabled = !1, gv.start(vv(i.material, "opacity", 1, function(e) { console.log("fadeIn", e) }), 300, function() {}, 0, pv.easeInOutQuad)) : (i.visible = !1, Potree.settings.zoom.enabled = !0) }), this.scene.scene.add(i)) } }, { key: "addVideo", value: function() { var r, e, a = this; "SS-t-P6zBR73Gke" == Potree.settings.number && (r = new bu(1,1,1,1), e = this.videoInfo = [{ id: "40-2", url: "https://laser-oss.4dkankan.com/testdata/SS-t-P6zBR73Gke/temp/poi/2022/05/10/0aabafee-36b8-455d-9c11-0780bf694786.mp4", rotation: [-1.494468618954883, -1.4987317433158989, -3.061254983446741], position: [19.801820617361624, 2.884673619844108, -.03362305858221648], scale: [3.5741423153151763, 2.8738725275578703, 1] }, { id: 40, url: "https://laser-oss.4dkankan.com/testdata/SS-t-P6zBR73Gke/temp/poi/2022/05/09/7896d6ef-a2d6-4fd7-949c-768782a5b484.mp4", rotation: [-1.5487684197910518, .021848470169552752, -3.1387534893955236], position: [17.277316608096, 2.0840432922115846, -.0931149415437065], scale: [2.0821757723834047, .6129478480765236, 1], visibles: [40] }], e.forEach(function(e) { !function(t) { var n = $('')[0]; n.setAttribute("crossOrigin", "Anonymous"), n.src = t.url || Potree.resourcePath + "/video/".concat(Potree.settings.number, "/").concat(t.id, ".mp4"); var e = new wl(n) , i = a.videoPlane = new Hr(r,new $i({ color: "#ffffff", transparent: !0, depthTest: !1, opacity: 0, map: e })); i.position.fromArray(t.position), i.rotation.fromArray(t.rotation), t.scale && i.scale.fromArray(t.scale), a.scene.scene.add(i), (t.plane = i).boundingBox = new kn(new Cn(0,-.5,0),new Cn(1,-.4,.2)), n.addEventListener("loadeddata", function(e) { n.play(), t.visibles || (i.material.opacity = 1), t.scale || i.scale.set(n.videoWidth / 1e3, n.videoHeight / 1e3, 1), console.log("video loadeddata", t.id) }), t.visibles && a.images360.addEventListener("flyToPano", function(e) { t.visibles.includes(e.toPano.pano.id) ? setTimeout(function() { i.visible = !0, n.currentTime = 0, n.play(), n.paused && a.addEventListener("global_mousedown", function e() { i.visible && n.play(), a.removeEventListener("global_mousedown", e) }), Potree.settings.zoom.enabled = !1, gv.start(vv(i.material, "opacity", 1), .4 * e.toPano.duration, function() {}, 0, pv.easeInOutQuad) }, .6 * e.toPano.duration) : gv.start(vv(i.material, "opacity", 0), .4 * e.toPano.duration, function() { t || (i.visible = !1, n.pause(), Potree.settings.zoom.enabled = !0) }, 0, pv.easeInOutQuad) }), a.addEventListener("global_mousedown", function e() { n.play(), a.removeEventListener("global_mousedown", e) }), Potree.settings.isTest && i.addEventListener("select", function(e) { console.log(e) }) }(e) })) } }]), v }(); ed.prototype.zoomTo = function(e) { (e.geometry || e.boundingBox) && this.updateProjectionMatrix() } , $r.prototype.zoomTo = function(e, t) { var n, i; (e.geometry || e.boundingSphere || e.boundingBox) && (e.geometry && null === e.geometry.boundingSphere && e.geometry.computeBoundingSphere(), e.updateMatrixWorld(), i = t || 1, t = (n = (n = e.boundingSphere || (e.geometry && e.geometry.boundingSphere ? e.geometry.boundingSphere : e.boundingBox.getBoundingSphere(new qn))).clone().applyMatrix4(e.matrixWorld)).radius, e = this.fov * Math.PI / 180, this.aspect < 1 && (e *= this.aspect), i = Math.abs(t / Math.sin(e / 2)) * i, i = this.getWorldDirection(new Cn).multiplyScalar(-i), this.position.copy(n.center.clone().add(i))) } , ti.prototype.distanceToPlaneWithNegative = function(e) { var t = e.normal.dot(this.direction); return 0 === t ? 0 === e.distanceToPoint(this.origin) ? 0 : null : -(this.origin.dot(e.normal) + e.constant) / t } ; rh = new ch, Ou = new xu; le.scriptPath = "", document.currentScript && document.currentScript.src ? le.scriptPath = new URL(document.currentScript.src + "/..").href : ("undefined" == typeof document ? new (require("url").URL)("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("potree.js",document.baseURI).href, le.scriptPath = new URL(("undefined" == typeof document ? new (require("url").URL)("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("potree.js",document.baseURI).href) + "/..").href), "/" === le.scriptPath.slice(-1) && (le.scriptPath = le.scriptPath.slice(0, -1)); var yx, Dl = le.scriptPath + "/resources"; function wx(e, t, n) { return bx.apply(this, arguments) } function bx() { return (bx = r(regeneratorRuntime.mark(function e(t, n, i) { var r; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: if (!Potree.fileServer) { e.next = 4; break } Potree.fileServer.get(t).then(function(e) { n && n(e) }).catch(i), e.next = 20; break; case 4: return e.prev = 4, e.next = 7, fetch(t); case 7: return r = e.sent, e.next = 10, r.text(); case 10: return r = e.sent, (r = JSON.parse(r)).data && (r = r.data), n && n(r), e.abrupt("return", r); case 17: e.prev = 17, e.t0 = e.catch(4), i && i(e.t0); case 20: case "end": return e.stop() } }, e, null, [[4, 17]]) }))).apply(this, arguments) } function xx() { return (xx = r(regeneratorRuntime.mark(function e(t, n, i) { var r; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return n = n || Potree.settings.number, r = (Potree.fileServer ? "/laser/dataset/" : "".concat(Potree.settings.urls.prefix4, "laser/dataset/")).concat(n, "/getDataSet"), e.abrupt("return", wx(r, t, i)); case 3: case "end": return e.stop() } }, e) }))).apply(this, arguments) } function Ex() { return (Ex = r(regeneratorRuntime.mark(function e(t, n) { var i, r, a = this; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: if (Potree.settings.floorplanEnable || n || !Potree.fileServer) { e.next = 2; break } return e.abrupt("return"); case 2: i = "all" == t ? viewer.scene.pointclouds.map(function(e) { return e.dataset_id }) : [t], r = function(t, e, n) { e == Potree.settings.floorplanType[t] && ((e = viewer.mapViewer.mapLayer.maps.find(function(e) { return e.name == "floorplan_" + t })) && viewer.mapViewer.mapLayer.removeMap(e), n = viewer.mapViewer.mapLayer.addMapEntity(n.data || n, t), e && (n.visibleReasons = e.visibleReasons, n.unvisibleReasons = e.unvisibleReasons), 0) } , i.forEach(function(e) { var t = Potree.settings.floorplanType[e]; if (t) { var n = Potree.fileServer ? "/laser/tiledMap/".concat(Potree.settings.number, "/tiledMap/").concat(t, "/").concat(e) : "".concat(Potree.settings.urls.prefix2, "/indoor/").concat(Potree.settings.number, "/api/tiled_maps"); return Potree.settings.floorplanRequests[e] = !0, wx(n, r.bind(a, e, t)) } }); case 6: case "end": return e.stop() } }, e) }))).apply(this, arguments) } function _x() { return (_x = r(regeneratorRuntime.mark(function e(t, n) { var i; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return i = "?datasetId=".concat(t), i = Potree.fileServer ? "/laser/filter/".concat(Potree.settings.number, "/query") + i : "".concat(Potree.settings.urls.prefix4, "laser/filter/").concat(Potree.settings.number, "/query") + i, e.abrupt("return", wx(i, n)); case 3: case "end": return e.stop() } }, e) }))).apply(this, arguments) } function Mx() { return (Mx = r(regeneratorRuntime.mark(function e(t) { var n; return regeneratorRuntime.wrap(function(e) { for (; ; ) switch (e.prev = e.next) { case 0: return Potree.fileServer || (n = "".concat(Potree.scriptPath, "/data/panoEdit/vision_edit.txt")), e.abrupt("return", wx(n, t)); case 2: case "end": return e.stop() } }, e) }))).apply(this, arguments) } (yx = jQuery).fn.extend({ selectgroup: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {} , o = yx(this) , t = o.prop("id") , s = "".concat(t) , e = void 0 !== e.title ? e.title : "" , l = []; o.find("option").each(function(e, t) { var n = yx(t).prop("id") , i = yx(t).html() , t = yx(t).prop("value") , t = yx('\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')) , r = t.find("label") , a = t.find("input"); a.change(function() { o.find("label").removeClass("ui-state-active"), o.find("label").addClass("ui-state-default"), a.is(":checked") && r.addClass("ui-state-active") }), l.push(t) }); for (var e = yx('\n\t\t\t\t
    \n\t\t\t\t\t'.concat(e, '\n\t\t\t\t\t\n\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t')), n = e.find("span"), i = 0, r = l; i < r.length; i++) { var a = r[i]; n.append(a) } n.find("label").each(function(e, t) { yx(t).css("margin", "0px"), yx(t).css("border-radius", "0px"), yx(t).css("border", "1px solid black"), yx(t).css("border-left", "none") }), n.find("label:first").each(function(e, t) { yx(t).css("border-radius", "4px 0px 0px 4px") }), n.find("label:last").each(function(e, t) { yx(t).css("border-radius", "0px 4px 4px 0px"), yx(t).css("border-left", "none") }), o.empty(), o.append(e) } }), le.Action = Zf, le.Alignment = C1, le.AnimationPath = Yd, le.Annotation = Kf, le.Box3Helper = Hm, le.BoxVolume = Zp, le.Buttons = rm, le.CameraAnimation = bv, le.CameraMode = em, le.ClassificationScheme = Bm, le.ClipMethod = nm, le.ClipTask = tm, le.ClipVolume = Vv, le.ClippingTool = jv, le.Compass = Kv, le.DeviceOrientationControls = Rw, le.DownloadStatus = vm, le.EarthControls = Lw, le.ElevationGradientRepeat = im, le.Enum = Mh, le.EnumItem = $f, le.EptBinaryLoader = Lv, le.EptKey = _u, le.EptLaszipLoader = wh, le.EptLazBatcher = Rv, le.EptLoader = Bv, le.EptZstandardLoader = Pu, le.EventDispatcher = Dh, le.EyeDomeLightingMaterial = _v, le.Features = jp, le.FirstPersonControls = Fg, le.GLCubeFaces = um, le.GeoPackageLoader = Fu, le.Geopackage = Hv, le.Gradients = km, le.HierarchicalSlider = zy, le.Images360 = ly, le.KeyCodes = ym, le.LRU = xu, le.LRUItem = wm, le.LengthUnits = lm, le.Log = function(e, t, n) { t = t || "#13f", n = n || 14, console.warn("%c".concat(e), "color:".concat(t, ";font-size:").concat(n, "px")) } , le.Measure = Wf, le.MeasuringTool = Wv, le.Message = Xv, le.ModelManagerEvents = { ModelAdded: "model-added", ActiveModelChanged: "active-model-changed" }, le.NormalizationEDLMaterial = Mv, le.NormalizationMaterial = Av, le.OrbitControls = Bw, le.OrientedImage = nw, le.OrientedImageLoader = pd, le.OrientedImages = iw, le.POCLoader = kv, le.PanoRendererEvents = dm, le.PanoSizeClass = cm, le.PanoramaEvents = gm, le.PathAnimation = Qf, le.PointAttribute = Am, le.PointAttributeTypes = Em, le.PointAttributes = Sm, le.PointCloudEptGeometry = Ud, le.PointCloudEptGeometryNode = Jd, le.PointCloudMaterial = Rm, le.PointCloudOctree = Um, le.PointCloudOctreeGeometry = Pm, le.PointCloudOctreeGeometryNode = Dm, le.PointCloudOctreeNode = Nm, le.PointCloudSM = pu, le.PointCloudTree = xm, le.PointCloudTreeNode = bm, le.PointShape = om, le.PointSizeType = am, le.Points = Gm, le.PolygonClipVolume = qf, le.Profile = Kp, le.ProfileData = Qm, le.ProfileRequest = _h, le.ProfileTool = qv, le.Renderer = Zm, le.Scene = rg, le.SceneRendererEvents = { ContextCreated: "scene-renderer-context-created", AfterRender: "after-render", MemoryUsageUpdated: "scene-renderer-memory-usage-updated" }, le.ScreenBoxSelectTool = Jv, le.ShapefileLoader = ku, le.SphereVolume = Qp, le.SpotLightHelper = mu, le.TileDownloaderEvents = hm, le.TransformationTool = Zv, le.TreeType = sm, le.Utils = Jf, le.VRControls = gu, le.Vectors = pm, le.Vectors2 = fm, le.Version = Km, le.Viewer = Ch, le.Volume = Yp, le.VolumeTool = Qv, le.WorkerPool = ch, le.XHRFactory = Gp, le.config = T, le.debug = {}, le.framenumber = 0, le.loadDatasets = function(e, t, n) { return xx.apply(this, arguments) } , le.loadFile = wx, le.loadMapEntity = function(e, t) { return Ex.apply(this, arguments) } , le.loadPanos = function(e, t) { return _x.apply(this, arguments) } , le.loadPanosInfo = function(e) { return Mx.apply(this, arguments) } , le.loadPointCloud = function(n, t, i, e, r, a) { var o = new Promise(function(t) { n && (0 < n.indexOf("ept.json") ? Bv.load(n, function(e) { e ? (e = new Um(e), t({ type: "pointcloud_loaded", pointcloud: e })) : console.error(new Error("failed to load point cloud from URL: ".concat(n))) }) : 0 < n.indexOf("cloud.js") ? kv.load(n, e, function(e) { e ? (e = new Um(e), t({ type: "pointcloud_loaded", pointcloud: e })) : (console.error(new Error("failed to load point cloud from URL: ".concat(n))), a && a()) }) : 0 < n.indexOf(".vpc") ? PointCloudArena4DGeometry.load(n, function(e) { e ? (e = new PointCloudArena4D(e), t({ type: "pointcloud_loaded", pointcloud: e })) : console.error(new Error("failed to load point cloud from URL: ".concat(n))) }) : console.error(new Error("failed to load point cloud from URL: ".concat(n)))) } ); if (!r) return o; o.then(function(e) { (e = e).pointcloud.name = t, e.pointcloud.sceneCode = i, r(e) }) } , le.loadProject = function(e, t, n) { return Ev.apply(this, arguments) } , le.lru = Ou, le.maxNodesLoading = 4, le.mergeEditStart = function(e) { Potree.settings.editType = "merge", Potree.settings.intersectOnObjs = !0, Potree.settings.boundAddObjs = !0, Potree.settings.unableNavigate = !0; var s = new Potree.Viewer(e); s.modules.Alignment; s.setEDLEnabled(!1), s.setFOV(T.view.fov), s.loadSettingsFromURL(), s.mainViewport.view.position.set(30, 30, 30), s.mainViewport.view.lookAt(0, 0, 0), s.updateModelBound(), s.transformationTool.setModeEnable("scale", !1), s.ssaaRenderPass.sampleLevel = 1, s.inputHandler.fixSelection = !0, Potree.settings.sizeFitToLevel = !0, Potree.loadPointCloudScene = function(t, o, n) { Potree.loadDatasets(function(e) { var r = e.find(function(e) { return e.sceneCode == t }) , e = "".concat(Potree.settings.urls.prefix, "/").concat(Potree.settings.webSite, "/").concat(t, "/data/").concat(t, "/webcloud/cloud.js") , a = r.createTime ? r.createTime.replace(/[^0-9]/gi, "") : ""; Potree.loadPointCloud(e, r.sceneName, t, a, function(e) { var t = s.scene , n = e.pointcloud , i = Potree.config.material , e = n.material; e.minSize = i.minSize, e.maxSize = i.maxSize, e.pointSizeType = i.pointSizeType, n.changePointSize(i.realPointSize), n.changePointOpacity(1), e.shape = Potree.PointShape.SQUARE, n.color = n.material.color = r.color, n.dataset_id = r.id, n.timeStamp = a, t.addPointCloud(n), s.updateModelBound(); t = s.bound; t.boundSize, t.center; s.dispatchEvent({ type: "loadPointCloudDone" }), Potree.settings.UserPointDensity || (Potree.settings.UserPointDensity = "high"), Potree.Log("loadPointCloudDone 点云加载完毕", null, 10), s.dispatchEvent("allLoaded"), o(n) }, n) }, t, n) } ; function o(e) { var t = s.mainViewport.camera , n = new Cn(e.pointer.x,e.pointer.y,-1).unproject(t) , i = new Cn(e.pointer.x,e.pointer.y,1).unproject(t).sub(n) , t = (e = (0 - n.z) / i.z) * i.x + n.x , n = e * i.y + n.y; c.moveBoundCenterTo(u, new Cn(t,n,u.boundCenter.z)), u.dispatchEvent("position_changed") } function l() { return c.focusOn(u), t(), { stopContinue: !0 } } var u, t = function() { u = null, s.removeEventListener("global_mousemove", o), s.removeEventListener("global_click", l) }, c = s.modules.MergeEditor; return Potree.addModel = function(i, r, e, t) { var n, a = function(e) { i.isFirstLoad ? (u = e, c.setModelBtmHeight(e, 0), s.addEventListener("global_mousemove", o), s.addEventListener("global_click", l, 3)) : (c.setModelBtmHeight(e, i.bottom || 0), u = null); function t() { e.updateMatrixWorld(), s.updateModelBound() } function n() { c.maintainBoundXY(e), c.setModelBtmHeight(e), t(), e.dispatchEvent("transformChanged") } e.addEventListener("position_changed", function() { t(), c.getBoundCenter(e), c.computeBtmHeight(e), i.bottomRange && (e.btmHeight > i.bottomRange.max || e.btmHeight < i.bottomRange.min) && (e.btmHeight = gn.clamp(e.btmHeight, i.bottomRange.min, i.bottomRange.max), c.setModelBtmHeight(e), t()), e.dispatchEvent("transformChanged") }), e.addEventListener("rotation_changed", n), e.addEventListener("scale_changed", n), e.addEventListener("transformChanged", function() { c.modelTransformCallback(e) }), e.updateMatrixWorld(), s.updateModelBound(), c.getBoundCenter(e), e.lastMatrixWorld = e.matrixWorld.clone(), r(e) }; "laser" == i.type ? Potree.loadPointCloudScene(i.url, function(e) { e.matrixAutoUpdate = !0, e.initialPosition = e.position.clone(), e.pos1MatrixInvert = (new ni).setPosition(e.initialPosition).invert(), a(e) }, t) : (n = { name: i.type, id: i.id, unlit: !0, transform: { position: i.position, rotation: (new ci).setFromVector3(i.rotation), scale: new Cn(i.scale,i.scale,i.scale) } }, "glb" == i.type ? n.glburl = i.url : (n.objurl = i.url, n.mtlurl = i.mtlurl), s.loadModel(n, function(e) { e.isModel = !0, e.traverse(function(e) { return e.material && (e.material.transparent = !0) }), a(e) }, e, t)) } , { THREE: mp } } , le.numNodesLoading = 0, le.panoEditStart = function(e, t, n, i) { Potree.settings.editType = "pano", Potree.settings.number = t, Potree.settings.unableNavigate = !0; var c = new Potree.Viewer(e) , r = c.modules.Alignment; c.setEDLEnabled(!1), c.setFOV(T.view.fov), c.loadSettingsFromURL(); var d = 0; Potree.settings.isOfficial || (c.loadGUI(function() { c.setLanguage("en"), $("#menu_tools").next().show(), $("#panos").show(), $("#alignment").show(), c.toggleSidebar() }), Potree.settings.sizeFitToLevel = !0); function h(e) { c.sidebar && c.sidebar.addAlignmentButton(e); var t = e.panos[0].dataRotation.z + Math.PI , n = e.panos[0].dataPosition.clone()//.negate(); r.rotate(e, null, t), r.translate(e, n), e.updateMatrixWorld() } var a = Potree.loadPanosDone = function(a, o) { Potree.settings.datasetsPanos[a] = { panoData: o, panos: [] }, console.log("panoData", a, o); var s = o.length , l = 0 , u = Object.keys(Potree.settings.datasetsPanos).length; o.forEach(function(r, e) { var t = "https://laser-oss.4dkankan.com/".concat(Potree.settings.webSite, "/").concat(Potree.settings.number, "/data/bundle_").concat(Potree.settings.number, "/building/uuidcloud/").concat(r.uuid, "/cloud.js") , n = a + "-" + r.uuid; r.index = e, Potree.loadPointCloud(t, n, n, 0, function(e) { var t = c.scene , n = e.pointcloud , i = Potree.config.material , e = n.material; e.minSize = i.minSize, e.maxSize = i.maxSize, e.pointSizeType = i.pointSizeType, n.changePointSize(.2), n.changePointOpacity(1), e.shape = Potree.PointShape.SQUARE, n.color = i.pointColor, n.dataset_id = a, n.panoUuid = r.uuid, n.timeStamp = 0, t.addPointCloud(n), ++l == s && (d++, c.images360.addPanoData(o, a), d == u && function() { c.scene.pointclouds.forEach(function(e) { h(e) }), c.images360.loadDone(), c.scene.add360Images(c.images360), c.updateModelBound(); var e = c.bound , t = e.boundSize , e = e.center; Potree.Log("中心点: ".concat(Up.toPrecision(e.toArray(), 2), ", boundSize: ").concat(Up.toPrecision(t.toArray(), 2), " "), null, 12), c.scene.view.setView({ position: e.clone().add(new Cn(10,5,10)), target: e }), c.dispatchEvent({ type: "loadPointCloudDone" }), Potree.settings.UserPointDensity || (Potree.settings.UserPointDensity = "panoEdit"), Potree.Log("loadPointCloudDone 点云加载完毕", null, 10), c.dispatchEvent("allLoaded") }()) }) }) } ; Potree.settings.isOfficial || (Potree.settings.datasetsPano = { testDataset: null }, Potree.loadPanosInfo(function(e) { a("testDataset", e.sweepLocations) })) } , le.pointBudget = 1e6, le.resourcePath = Dl, le.saveProject = function(e) { var t, n = e.scene; return { type: "Potree", version: 1.7, settings: { pointBudget: (t = e).getPointBudget(), fov: t.getFOV(), edlEnabled: t.getEDLEnabled(), edlRadius: t.getEDLRadius(), edlStrength: t.getEDLStrength(), background: t.getBackground(), minNodeSize: t.getMinNodeSize(), showBoundingBoxes: t.getShowBoundingBox() }, view: { position: (t = (t = e).scene.view).position.toArray(), target: t.getPivot().toArray() }, classification: e.classifications, pointclouds: n.pointclouds.map($m), measurements: n.measurements.map(iv), volumes: n.volumes.map(tv), cameraAnimations: n.cameraAnimations.map(nv), profiles: n.profiles.map(ev), annotations: ov(e), orientedImages: n.orientedImages.map(rv), geopackages: n.geopackages.map(av) } } , le.settings = S, le.start = function(e, t, n, i) { Potree.settings.number = n || "t-o5YMR13", Potree.fileServer = i; var d = new Potree.Viewer(e,t) , h = d.modules.Alignment; d.setEDLEnabled(!1), d.setFOV(T.view.fov), d.loadSettingsFromURL(), Potree.settings.isOfficial || (d.loadGUI(function() { d.setLanguage("en"), $("#menu_tools").next().show(), $("#menu_scene").next().show(), $("#siteModel").show(), d.toggleSidebar() }), Potree.settings.sizeFitToLevel = !0), Potree.loadDatasetsCallback = function(e, o) { if (!e || 0 == e.length) return console.error("getDataSet加载的数据为空"); Potree.datasetData = e, d.transform = null; function s(e, t) { var n = t.location.slice(0, 2) , i = d.transform.lonlatToLocal.forward(n); d.sidebar && d.sidebar.addAlignmentButton(e), h.rotate(e, null, t.orientation), h.translate(e, new Cn(i[0],i[1],t.location[2])), e.updateMatrixWorld(), Potree.Log("点云".concat(e.dataset_id, "旋转值:").concat(e.orientationUser, ", 位置").concat(Up.toPrecision(e.translateUser.toArray(), 3), ", 经纬度 ").concat(n, ", spacing ").concat(e.material.spacing), null, 17) } var l = e.length , u = 0 , c = 0; Potree.settings.originDatasetId || (Potree.settings.originDatasetId = e[0].id); var t = e.find(function(e) { return e.id == Potree.settings.originDatasetId }).location.slice(0, 2); proj4.defs("NAVVIS:TMERC", "+proj=tmerc +ellps=WGS84 +lon_0=" + t[0].toPrecision(15) + " +lat_0=" + t[1].toPrecision(15)), proj4.defs("WGS84", "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"); var n = proj4("WGS84", "NAVVIS:TMERC") , t = proj4("+proj=tmerc +lat_0=0 +lon_0=123 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs;"); d.transform = { lonlatToLocal: n, lonlatTo4550: t }, d.mapViewer && d.mapViewer.mapLayer.maps[0].updateProjection(), e.forEach(function(r, e) { var t, n, a; o ? ((n = d.scene.pointclouds.find(function(e) { return e.dataset_id == r.id })) || (Potree.Log("数据集id变了,自动使用第一个", "#500"), n = d.scene.pointclouds[0]), h.translate(n, n.translateUser.clone().negate()), h.rotate(n, null, -n.orientationUser), s(n, r)) : (t = r.sceneCode || r.name, n = "".concat(Potree.settings.urls.prefix, "/").concat(Potree.settings.webSite, "/").concat(t, "/data/").concat(t, "/webcloud/cloud.js"), a = r.createTime ? r.createTime.replace(/[^0-9]/gi, "") : "", Potree.loadPointCloud(n, r.name, t, a, function(e) { var t = d.scene , n = e.pointcloud , i = Potree.config.material , e = n.material; n.hasDepthTex = Potree.settings.useDepthTex && (!!r.has_depth || Potree.settings.isLocalhost && "SS-t-7DUfWAUZ3V" == Potree.settings.number), e.minSize = i.minSize, e.maxSize = i.maxSize, e.pointSizeType = i.pointSizeType, n.changePointSize(i.realPointSize), n.changePointOpacity(1), e.shape = Potree.PointShape.SQUARE, n.color = n.material.color = r.color, n.dataset_id = r.id, n.timeStamp = a, s(n, r), t.addPointCloud(n), ++u == l && function() { d.updateModelBound(); var e = d.bound , t = e.boundSize , e = e.center; Potree.Log("中心点: ".concat(Up.toPrecision(e.toArray(), 2), ", boundSize: ").concat(Up.toPrecision(t.toArray(), 2), " "), null, 12), Potree.settings.isOfficial || Potree.loadMapEntity("all"), o || (d.scene.view.setView({ position: e.clone().add(new Cn(10,5,10)), target: e }), d.dispatchEvent({ type: "loadPointCloudDone" }), Potree.settings.UserPointDensity || (Potree.settings.UserPointDensity = "high"), Potree.Log("loadPointCloudDone 点云加载完毕", null, 10)) }(), Potree.loadPanos(r.id, function(e) { d.images360.addPanoData(e, r.id), ++c == l && function() { d.images360.loadDone(), d.scene.add360Images(d.images360), d.mapViewer.addListener(d.images360); var e, t = A.urlHasValue("pano", !0); "" !== t ? (e = d.images360.panos.find(function(e) { return e.id == t })) && d.images360.focusPano({ pano: e, duration: 0, callback: function() {} }) : ((e = d.bound).boundSize, e = e.center, (e = d.images360.findNearestPano(e)) && d.images360.flyToPano({ pano: e, duration: 0, target: d.images360.bound.center })), d.addVideo(), console.log("allLoaded"), d.dispatchEvent("allLoaded") }() }) })) }) } , Potree.loadDatasets(Potree.loadDatasetsCallback), window.testTransform = function(e, t, n) { proj4.defs("NAVVIS:test", "+proj=tmerc +ellps=WGS84 +lon_0=" + e[0].toPrecision(15) + " +lat_0=" + e[1].toPrecision(15)); e = proj4("WGS84", "NAVVIS:test"); return t ? e.forward(t) : e.inverse(n) } , window.THREE = mp, window.buttonFunction = function() { d.scene.pointclouds.forEach(function(e) { return e.predictNodeMaxLevel() }) } , Potree.settings.isLocalhost && d.inputHandler.addEventListener("keydown", function(e) { "t" == e.event.key ? (d.images360.cube.visible = !0, d.images360.cube.material.wireframe = !0) : "y" == e.event.key && (d.images360.cube.material.wireframe = !1, d.images360.cube.visible = "showPanos" == Potree.settings.displayMode) }) } , le.updatePointClouds = function(e, t, n) { var i, r = ue(e); try { for (r.s(); !(i = r.n()).done; ) { var a, o = i.value, s = performance.now(), l = ue(o.profileRequests); try { for (l.s(); !(a = l.n()).done; ) if (a.value.update(), 5 < performance.now() - s) break } catch (e) { l.e(e) } finally { l.f() } performance.now() } } catch (e) { r.e(e) } finally { r.f() } var u, n = jm(e, t, n), c = ue(e); try { for (c.s(); !(u = c.n()).done; ) u.value.updateVisibleBounds() } catch (e) { c.e(e) } finally { c.f() } return le.lru.freeMemory(), n } , le.updateVisibility = jm, le.updateVisibilityStructures = Vm, le.version = { major: 1, minor: 8, suffix: ".0" }, le.workerPool = rh, Object.defineProperty(le, "__esModule", { value: !0 }) });