From bc3a725c974ab9bbb7e4928358c6d55e0bc50ba2 Mon Sep 17 00:00:00 2001 From: Denis Borodin Date: Mon, 16 Nov 2020 09:47:01 +0300 Subject: [PATCH] Build v2.2.4 --- .gitignore | 1 + build/tour-player.css | 2 +- build/tour-player.js | 47 ++++++++++++++++++++++++------------------- package.json | 2 +- src/js/Tour.js | 2 +- 5 files changed, 30 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index fb9a376..d959522 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ node_modules/ bower_components/ build/ +.idea/ src/lib/ build/**/*.map Thumbs.db diff --git a/build/tour-player.css b/build/tour-player.css index 629a42d..2f6d62b 100644 --- a/build/tour-player.css +++ b/build/tour-player.css @@ -1,2 +1,2 @@ -h1,h2,h3,h4{font-weight:normal}body,html{height:100%;overflow:hidden}body{position:relative;width:100%;margin:0;overflow:hidden;font:13px 'HelveticaNeue','Helvetica Neue',Helvetica,Arial,sans-serif}#renderer{position:absolute;top:0;left:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-touch-action:none;touch-action:none}#renderer{will-change:opacity}#background-image{will-change:transform}body.transition #renderer,body.transition #markers{opacity:0}body:not(.transition) #renderer{transition:opacity .4s ease;transition-delay:.1s}body:not(.transition) #background-image{transition:transform .4s ease;-ms-transform:scale(1.2);transform:scale(1.2)}#markers{transition:opacity .4s ease}a{color:#0089ff;border-bottom:1px solid rgba(0,137,255,0.5);text-decoration:none;transition:color .3s ease,border-color .3s ease;}a:visited,a color $visitedLinkColor{border-color:rgba(180,14,180,0.5)}a:active,a:hover{color:#f41224;border-color:rgba(244,18,36,0.5);transition:color .1s ease,border-color .1s ease}a[download],a[href=""],a[href^="#"],a[href^="mailto:"],a[href^="callto:"]{border-bottom-style:dotted}body.load #renderer{cursor:progress}#renderer{cursor:-webkit-grab;cursor:grab;}#renderer:active{cursor:-webkit-grabbing;cursor:grabbing}#control-panel{pointer-events:none;position:absolute;width:100%;text-align:center;z-index:1;opacity:0;left:0;bottom:18px;transition:all .4s ease;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-touch-action:none;touch-action:none;overflow:hidden;}#control-panel.visible{opacity:1;}#control-panel.visible .panel{pointer-events:all}#control-panel .panel{position:relative;display:inline-block;height:36px;background:#fff;box-shadow:0 5px 8px rgba(0,0,0,0.15)}#control-panel.hidden{bottom:72px}#control-panel .progress-bar{position:absolute;width:100%;height:3px;bottom:36px;background:#dbdbdb;transition:height .1s linear,opacity .1s linear;transition-delay:.1s;}#control-panel .progress-bar .value{background:#0080ff;height:inherit;width:0;transition:width .1s linear}#control-panel .progress-bar.hidden{height:0;opacity:0;transition:height .3s linear,opacity .3s linear;transition-delay:.5s}#control-panel .btn-list{font-size:0;height:36px;}#control-panel .btn-list div{display:inline-block;width:36px;height:36px;background:center no-repeat;cursor:pointer;transition:transform .3s ease;}#control-panel .btn-list div:hover{background-color:rgba(0,0,0,0.05)}#control-panel .btn-list div:active{background-color:rgba(0,0,0,0.1)}#control-panel .btn-list .left{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.2%22 d=%22M22 9L13 18L22 27%22/%3E %3C/svg%3E")}#control-panel .btn-list .right{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.2%22 d=%22M14 9L23 18L14 27%22/%3E %3C/svg%3E")}#control-panel .btn-list .up{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.2%22 d=%22M9 22L18 13L27 22%22/%3E %3C/svg%3E")}#control-panel .btn-list .down{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.2%22 d=%22M9 14L18 23L27 14%22/%3E %3C/svg%3E")}#control-panel .btn-list .zoom-in{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Ccircle fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.1%22 cx=%2218.5%22 cy=%2218.5%22 r=%2210%22/%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221%22 d=%22M18.5 14L18.5 23M14 18.5L23 18.5%22/%3E %3C/svg%3E")}#control-panel .btn-list .zoom-out{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Ccircle fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.1%22 cx=%2218.5%22 cy=%2218.5%22 r=%2210%22/%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221%22 d=%22M14 18.5L23 18.5%22/%3E %3C/svg%3E")}#control-panel .btn-list .fullscreen{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 xmlns:xlink=%22http://www.w3.org/1999/xlink%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Csymbol id=%22arrow%22%3E%3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.2%22 d=%22M0.5 7L0.5 0.5L7 0.5M0.5 0.5L7 7%22/%3E%3C/symbol%3E %3Cuse xlink:href=%22%23arrow%22 x=%228%22 y=%228%22/%3E %3Cuse xlink:href=%22%23arrow%22 transform=%22translate(28 8) scale(-1,1)%22/%3E %3Cuse xlink:href=%22%23arrow%22 transform=%22translate(8 28) scale(1,-1)%22/%3E %3Cuse xlink:href=%22%23arrow%22 transform=%22translate(28 28) scale(-1,-1)%22/%3E %3C/svg%3E")}#control-panel .btn-list .rotate{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Ccircle fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.1%22 cx=%2218.5%22 cy=%2218.5%22 r=%2210%22/%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221%22 d=%22M18.5 12L21 18.5L18.5 25L16 18.5Z%22 transform=%22rotate(45, 18.5, 18.5)%22/%3E %3Ccircle fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.1%22 cx=%2218.5%22 cy=%2218.5%22 r=%222%22/%3E %3C/svg%3E")}#control-panel[data-orientation="landscape-primary"] .marker{-ms-transform:rotate(-90deg);transform:rotate(-90deg)}#control-panel[data-orientation="landscape-secondary"] .marker{-ms-transform:rotate(90deg);transform:rotate(90deg)}#control-panel[data-orientation="portrait-secondary"] .marker{-ms-transform:rotate(180deg);transform:rotate(180deg)}body.fullscreen #control-panel .fullscreen{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 xmlns:xlink=%22http://www.w3.org/1999/xlink%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Csymbol id=%22arrow%22%3E%3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.2%22 d=%22M0.5 7L0.5 0.5L7 0.5M0.5 0.5L7 7%22/%3E%3C/symbol%3E %3Cuse xlink:href=%22%23arrow%22 transform=%22translate(20 20)%22/%3E %3Cuse xlink:href=%22%23arrow%22 transform=%22translate(20 16) scale(1,-1)%22/%3E %3Cuse xlink:href=%22%23arrow%22 transform=%22translate(16 20) scale(-1,1)%22/%3E %3Cuse xlink:href=%22%23arrow%22 transform=%22translate(16 16) scale(-1,-1)%22/%3E %3C/svg%3E")}@supports ((-webkit-backdrop-filter: none) or (backdrop-filter: none)){#control-panel .panel{background:rgba(255,255,255,0.8);-webkit-backdrop-filter:brightness(1.5) blur(40px);backdrop-filter:brightness(1.5) blur(40px)}}#mouse-menu{position:absolute;display:none;background:#fff;border:1px solid #efefef;border-radius:3px;padding:5px 0;box-shadow:0 5px 8px rgba(0,0,0,0.15);z-index:2;}#mouse-menu.visible{display:block}#mouse-menu .item{padding:5px;padding-left:26px;padding-right:20px;white-space:nowrap;cursor:default;}#mouse-menu .item .key{float:right;margin-left:50px;color:#9e9e9e;}#mouse-menu .item .key:empty{display:none}#mouse-menu .item:not(.disabled):hover{background:#0080ff;color:#fff;}#mouse-menu .item:not(.disabled):hover .key{color:#fff}#mouse-menu .item.disabled{color:#9e9e9e}#mouse-menu .item.hidden{display:none}#mouse-menu hr{margin:5px 1px;border:none;border-bottom:1px solid #efefef}@supports ((-webkit-backdrop-filter: none) or (backdrop-filter: none)){#mouse-menu{background:rgba(255,255,255,0.8);-webkit-backdrop-filter:brightness(1.5) blur(40px);backdrop-filter:brightness(1.5) blur(40px)}}#markers{position:absolute;overflow:hidden;pointer-events:none;width:100%;height:100%;top:0;left:0;}#markers .marker{position:absolute;height:32px;width:32px;margin-left:-16px;margin-top:-16px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-touch-action:none;touch-action:none;will-change:left,top;pointer-events:all;}#markers .marker .hidden{display:none}#markers .button{width:100%;height:100%;position:absolute;background-color:rgba(0,0,0,0.8);border-radius:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:transform .5s ease;will-change:transform;}#markers .button:hover{transition:transform .2s ease;-ms-transform:scale(1.15);transform:scale(1.15)}#markers .button.left{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 d=%22M18.5 10L12.5 16L18.5 22%22/%3E %3C/svg%3E")}#markers .button.right{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 d=%22M13.5 10L19.5 16L13.5 22%22/%3E %3C/svg%3E")}#markers .button.up{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 d=%22M10 18.5L16 12.5L22 18.5%22/%3E %3C/svg%3E")}#markers .button.down{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 d=%22M10 13.5L16 19.5L22 13.5%22/%3E %3C/svg%3E")}#markers .button.info{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 d=%22M16 9L16 23M9 16L23 16%22/%3E %3C/svg%3E")}#markers .button.point{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Ccircle fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 cx=%2216%22 cy=%2216%22 r=%225%22/%3E %3C/svg%3E")}#markers .title{position:absolute;width:300px;left:-9999px;opacity:0;font-size:0;transition:opacity .3s ease,padding .2s ease;}#markers .title span{position:relative;display:inline-block;background:#fff;font-size:13px;line-height:18px;padding:5px 10px;}#markers .title span:before{content:'';position:absolute;display:block}#markers .title.bottom,#markers .title.top{text-align:center;}#markers .title.bottom span:before,#markers .title.top span:before{left:50%;margin-left:-8px;border-left:8px solid transparent;border-right:8px solid transparent;border-bottom:8px solid #fff}#markers .title.bottom{margin-top:32px;}#markers .title.bottom span:before{top:-8px}#markers .title.top{margin-bottom:32px;bottom:0;}#markers .title.top span:before{bottom:-8px;border-bottom:none;border-top:8px solid #fff}#markers .title.left span:before,#markers .title.right span:before{top:50%;margin-top:-8px;border-top:8px solid transparent;border-bottom:8px solid transparent;border-right:8px solid #fff}#markers .title.right{margin-left:32px;}#markers .title.right span:before{left:-8px}#markers .title.left{margin-right:32px;right:0;}#markers .title.left span:before{right:-8px;border-right:none;border-left:8px solid #fff}#markers .marker:hover .title{z-index:1;opacity:1;left:0;}#markers .marker:hover .title.bottom{padding-top:12px}#markers .marker:hover .title.top{padding-bottom:12px}#markers .marker:hover .title.right{padding-left:12px}#markers .marker:hover .title.left{padding-right:12px;left:auto}#notification{position:absolute;width:100%;height:0;left:0;top:50%;margin-top:-16px;text-align:center;opacity:0;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:opacity .3s ease;}#notification.visible{opacity:1}#notification.hidden{display:none}#notification span{display:inline-block;max-width:70%;padding:5px 28px;line-height:1.6em;background:rgba(0,0,0,0.8);color:#fff;border-radius:16px;text-shadow:0 1px rgba(0,0,0,0.3)}.background-image__wrapper{position:absolute;overflow:hidden;height:100%;width:100%}#background-image{position:absolute;z-index:-1;width:100%;height:100%}.popup-layout{position:absolute;top:0;right:0;bottom:0;left:0;display:-ms-flexbox;display:flex;visibility:hidden;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;z-index:2;background:rgba(0,0,0,0.6);opacity:0;}.popup-layout.visible{opacity:1;transition:opacity .3s ease;visibility:visible;-ms-transform:none;transform:none;}.popup-layout.visible .popups{transition:transform .3s ease;-ms-transform:scale(1);transform:scale(1)}.popup-layout .popups{position:relative;-ms-transform:scale(.8);transform:scale(.8)}.popup-layout .close{position:absolute;background:#fff no-repeat;background-position:center;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.2%22 d=%22M9 9L24 24M24 9L9 24%22/%3E %3C/svg%3E");right:0;top:0;width:32px;height:32px;cursor:pointer;z-index:1;}.popup-layout .close:hover{background-color:#dbdbdb}.popup-layout .popup{display:none;position:relative;min-width:200px;max-width:700px;min-height:140px;max-height:calc(100vh - 150px);background:#fff;box-shadow:0 5px 8px rgba(0,0,0,0.15);overflow:auto;-webkit-overflow-scrolling:touch;}.popup-layout .popup:target{display:block}.popup-layout .popup img{width:100%;display:block}.popup-layout .popup .content{padding:22px}.popup-layout .popup p{margin-right:2em;line-height:1.6em}#gallery{position:absolute;width:200px;left:-200px;height:100%;background:rgba(0,0,0,0.8);z-index:2;transition:left .3s ease;will-change:left;}#gallery.visible{left:0}#gallery .gallery-toggler{cursor:pointer;position:absolute;background:rgba(0,0,0,0.8);top:0;bottom:0;margin:auto 0;right:-18px;width:18px;height:50px;border-radius:0 5px 5px 0;}#gallery .gallery-toggler:after{content:'';display:block;position:absolute;top:0;right:0;bottom:0;left:0;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2214%22 height=%2228%22 viewBox=%220 0 14 28%22%3E %3Cpath fill=%22none%22 stroke=%22%23FFF%22 stroke-width=%222%22 d=%22M10 1L3 14L10 27%22/%3E %3C/svg%3E");background-position:center;background-repeat:no-repeat;-ms-transform:scale(-1,1);transform:scale(-1,1)}#gallery.visible .gallery-toggler:after{-ms-transform:scale(1,1);transform:scale(1,1)}#gallery ul{margin:0;padding:5px;height:100%;overflow:hidden;overflow-y:scroll;box-sizing:border-box;transform:translateZ(0);will-change:scroll-position;-webkit-overflow-scrolling:touch;}#gallery ul::-webkit-scrollbar{width:8px;background:rgba(0,0,0,0.5)}#gallery ul::-webkit-scrollbar-thumb{background:rgba(255,255,255,0.8);width:4px;margin:3px;border-radius:4px;transform:scale(.1);}#gallery ul::-webkit-scrollbar-thumb:hover{background:#fff}#gallery ul li{box-sizing:border-box;background-size:100%;background-position:center;position:relative;cursor:pointer;background-color:#666;padding:0;margin:5px 0;box-shadow:0 0 0 0 #fff;transition:box-shadow .1s ease;}#gallery ul li.active{box-shadow:0 0 0 5px #0080ff}#gallery ul li:hover{box-shadow:0 0 0 2px #fff}#gallery ul li:before{content:'';height:0;display:block;padding-top:50%}#gallery ul li .item-title{position:absolute;bottom:0;margin:0;background:linear-gradient(to top,rgba(0,0,0,0.5) 40%,transparent);color:#fff;padding:24px 10px 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;box-sizing:border-box}.slider{position:relative;overflow:hidden;}.slider .tape{will-change:transform;transition:transform .3s ease;font-size:0;line-height:0;white-space:nowrap;}.slider .tape img{width:100%;vertical-align:top;display:inline-block}.slider-button{z-index:2;position:absolute;top:50%;margin-top:-16px;background-color:rgba(0,0,0,0.6);height:32px;width:32px;border-radius:50%;cursor:pointer;}.slider-button.hidden{pointer-events:none;opacity:.3}.slider-button.prev{left:16px;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 d=%22M18.5 10L12.5 16L18.5 22%22/%3E %3C/svg%3E")}.slider-button.next{right:16px;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 d=%22M13.5 10L19.5 16L13.5 22%22/%3E %3C/svg%3E")} +h1,h2,h3,h4{font-weight:normal}*{outline:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body,html{height:100%;overflow:hidden;-webkit-text-size-adjust:none;-ms-touch-action:manipulation;touch-action:manipulation}body{position:fixed;width:100%;margin:0;font:13px 'HelveticaNeue','Helvetica Neue',Helvetica,Arial,sans-serif;-webkit-tap-highlight-color:transparent}#renderer{position:absolute;top:0;left:0;-webkit-user-select:none;-ms-user-select:none;user-select:none;-ms-touch-action:none;touch-action:none;user-drag:none;-webkit-user-drag:none}#renderer{will-change:opacity}#background-image{will-change:transform}body.transition-zoomin-start #renderer{opacity:0}body.transition-zoomin-start #markers{opacity:0}body.transition-zoomin-end #markers{opacity:1;transition:opacity .6s ease}body.transition-zoomin-end #renderer{transition:opacity .4s ease;transition-delay:.05s}body.transition-zoomin-end #background-image{transition:transform .4s ease;-ms-transform:scale(1.3);transform:scale(1.3)}body.transition-fadein-start #renderer{opacity:0}body.transition-fadein-end #markers{opacity:1}body.transition-fadein-end #renderer{transition:opacity .5s ease}body.transition-fadein-end #background-image{transition:transform .5s ease}a{color:#0089ff;text-decoration:underline;-webkit-text-decoration-color:rgba(0,137,255,0.3);text-decoration-color:rgba(0,137,255,0.3);text-underline-position:under;transition:color .3s ease,-webkit-text-decoration-color .3s ease;transition:color .3s ease,text-decoration-color .3s ease;transition:color .3s ease,text-decoration-color .3s ease,-webkit-text-decoration-color .3s ease}a:visited,a color $visitedLinkColor{-webkit-text-decoration-color:rgba(180,14,180,0.3);text-decoration-color:rgba(180,14,180,0.3)}a:active,a:hover{color:#f41224;-webkit-text-decoration-color:rgba(244,18,36,0.3);text-decoration-color:rgba(244,18,36,0.3);transition:color .1s ease,-webkit-text-decoration-color .3s ease;transition:color .1s ease,text-decoration-color .3s ease;transition:color .1s ease,text-decoration-color .3s ease,-webkit-text-decoration-color .3s ease}a[download],a[href=""],a[href^="#"],a[href^="mailto:"],a[href^="callto:"]{-webkit-text-decoration-style:dashed;text-decoration-style:dashed}body.load #renderer{cursor:progress}#renderer{cursor:grab}#renderer:active{cursor:grabbing}#control-panel{pointer-events:none;position:absolute;width:100%;text-align:center;z-index:1;opacity:0;left:0;bottom:18px;transition:all .4s ease;-webkit-user-select:none;-ms-user-select:none;user-select:none;-ms-touch-action:none;touch-action:none}#control-panel.visible{opacity:1}#control-panel.visible .panel{pointer-events:all}#control-panel .panel{position:relative;display:inline-block;height:36px;background:#fff;box-shadow:0 5px 8px rgba(0,0,0,0.15)}#control-panel.hidden{bottom:72px}#control-panel .progress-bar{position:absolute;width:100%;height:3px;bottom:36px;background:#dbdbdb;transition:height .1s linear,opacity .1s linear;transition-delay:.1s}#control-panel .progress-bar .value{background:#0080ff;height:inherit;width:0;transition:width .1s linear}#control-panel .progress-bar.hidden{height:0;opacity:0;transition:height .3s linear,opacity .3s linear;transition-delay:.5s}#control-panel .btn-list{font-size:0;height:36px}#control-panel .btn-list div{display:inline-block;width:36px;height:36px;background:center no-repeat;cursor:pointer;transition:transform .3s ease}#control-panel .btn-list div:hover{background-color:rgba(0,0,0,0.05)}#control-panel .btn-list div:active{background-color:rgba(0,0,0,0.1)}#control-panel .btn-list .left{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.2%22 d=%22M22 9L13 18L22 27%22/%3E %3C/svg%3E")}#control-panel .btn-list .right{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.2%22 d=%22M14 9L23 18L14 27%22/%3E %3C/svg%3E")}#control-panel .btn-list .up{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.2%22 d=%22M9 22L18 13L27 22%22/%3E %3C/svg%3E")}#control-panel .btn-list .down{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.2%22 d=%22M9 14L18 23L27 14%22/%3E %3C/svg%3E")}#control-panel .btn-list .zoom-in{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Ccircle fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.1%22 cx=%2218.5%22 cy=%2218.5%22 r=%2210%22/%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221%22 d=%22M18.5 14L18.5 23M14 18.5L23 18.5%22/%3E %3C/svg%3E")}#control-panel .btn-list .zoom-out{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Ccircle fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.1%22 cx=%2218.5%22 cy=%2218.5%22 r=%2210%22/%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221%22 d=%22M14 18.5L23 18.5%22/%3E %3C/svg%3E")}#control-panel .btn-list .fullscreen{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 xmlns:xlink=%22http://www.w3.org/1999/xlink%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Csymbol id=%22arrow%22%3E%3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.2%22 d=%22M0.5 7L0.5 0.5L7 0.5M0.5 0.5L7 7%22/%3E%3C/symbol%3E %3Cuse xlink:href=%22%23arrow%22 x=%228%22 y=%228%22/%3E %3Cuse xlink:href=%22%23arrow%22 transform=%22translate(28 8) scale(-1,1)%22/%3E %3Cuse xlink:href=%22%23arrow%22 transform=%22translate(8 28) scale(1,-1)%22/%3E %3Cuse xlink:href=%22%23arrow%22 transform=%22translate(28 28) scale(-1,-1)%22/%3E %3C/svg%3E")}#control-panel .btn-list .rotate{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Ccircle fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.1%22 cx=%2218.5%22 cy=%2218.5%22 r=%2210%22/%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221%22 d=%22M18.5 12L21 18.5L18.5 25L16 18.5Z%22 transform=%22rotate(45, 18.5, 18.5)%22/%3E %3Ccircle fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.1%22 cx=%2218.5%22 cy=%2218.5%22 r=%222%22/%3E %3C/svg%3E")}#control-panel[data-orientation="landscape-primary"] .marker{-ms-transform:rotate(-90deg);transform:rotate(-90deg)}#control-panel[data-orientation="landscape-secondary"] .marker{-ms-transform:rotate(90deg);transform:rotate(90deg)}#control-panel[data-orientation="portrait-secondary"] .marker{-ms-transform:rotate(180deg);transform:rotate(180deg)}body.fullscreen #control-panel .fullscreen{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 xmlns:xlink=%22http://www.w3.org/1999/xlink%22 width=%2236%22 height=%2236%22 viewBox=%220 0 36 36%22%3E %3Csymbol id=%22arrow%22%3E%3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.2%22 d=%22M0.5 7L0.5 0.5L7 0.5M0.5 0.5L7 7%22/%3E%3C/symbol%3E %3Cuse xlink:href=%22%23arrow%22 transform=%22translate(20 20)%22/%3E %3Cuse xlink:href=%22%23arrow%22 transform=%22translate(20 16) scale(1,-1)%22/%3E %3Cuse xlink:href=%22%23arrow%22 transform=%22translate(16 20) scale(-1,1)%22/%3E %3Cuse xlink:href=%22%23arrow%22 transform=%22translate(16 16) scale(-1,-1)%22/%3E %3C/svg%3E")}@supports ((-webkit-backdrop-filter: none) or (backdrop-filter: none)){#control-panel .panel{background:rgba(255,255,255,0.8);-webkit-backdrop-filter:brightness(1.5) blur(40px);backdrop-filter:brightness(1.5) blur(40px)}}@media (prefers-color-scheme:dark){#control-panel .panel{background:rgba(50,50,50,0.9)}#control-panel .btn-list div{filter:brightness(1.8)}}#mouse-menu{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;position:absolute;display:none;background:#fff;border:1px solid #efefef;border-radius:3px;padding:5px 0;box-shadow:0 5px 8px rgba(0,0,0,0.15);z-index:2}#mouse-menu.visible{display:block}#mouse-menu .item{padding:5px;padding-left:26px;padding-right:20px;white-space:nowrap;cursor:default}#mouse-menu .item .key{float:right;margin-left:50px;color:#9e9e9e}#mouse-menu .item .key:empty{display:none}#mouse-menu .item:not(.disabled):hover{background:#0080ff;color:#fff}#mouse-menu .item:not(.disabled):hover .key{color:#fff}#mouse-menu .item.disabled{color:#9e9e9e}#mouse-menu .item.hidden{display:none}#mouse-menu hr{margin:5px 1px;border:none;border-bottom:1px solid #efefef}@supports ((-webkit-backdrop-filter: none) or (backdrop-filter: none)){#mouse-menu{background:rgba(255,255,255,0.8);-webkit-backdrop-filter:brightness(1.5) blur(40px);backdrop-filter:brightness(1.5) blur(40px)}}@media (prefers-color-scheme:dark){#mouse-menu{background:rgba(50,50,50,0.8);color:#fff;border-color:#6e6e6e}#mouse-menu hr{border-bottom-color:#6e6e6e}}#markers{position:absolute;overflow:hidden;pointer-events:none;width:100%;height:100%;top:0;left:0}#markers .marker{position:absolute;height:32px;width:32px;margin-left:-16px;margin-top:-16px;-webkit-user-select:none;-ms-user-select:none;user-select:none;-ms-touch-action:none;touch-action:none;will-change:transform;pointer-events:all}#markers .marker .hidden{display:none}#markers .button{width:100%;height:100%;position:absolute;background-color:rgba(0,0,0,0.8);border-radius:50%;cursor:pointer;-webkit-user-select:none;-ms-user-select:none;user-select:none;transition:transform .5s ease;will-change:transform}#markers .button:hover{transition:transform .2s ease;-ms-transform:scale(1.15);transform:scale(1.15)}#markers .button.left{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 d=%22M18.5 10L12.5 16L18.5 22%22/%3E %3C/svg%3E")}#markers .button.right{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 d=%22M13.5 10L19.5 16L13.5 22%22/%3E %3C/svg%3E")}#markers .button.up{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 d=%22M10 18.5L16 12.5L22 18.5%22/%3E %3C/svg%3E")}#markers .button.down{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 d=%22M10 13.5L16 19.5L22 13.5%22/%3E %3C/svg%3E")}#markers .button.info{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 d=%22M16 9L16 23M9 16L23 16%22/%3E %3C/svg%3E")}#markers .button.point{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Ccircle fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 cx=%2216%22 cy=%2216%22 r=%225%22/%3E %3C/svg%3E")}#markers .title{position:absolute;width:300px;width:-webkit-max-content;width:max-content;left:-9999px;opacity:0;font-size:0;transition:opacity .3s ease,padding .2s ease}#markers .title span{position:relative;display:inline-block;background:#fff;font-size:13px;line-height:18px;padding:5px 10px}#markers .title span:before{content:'';position:absolute;display:block}#markers .title.bottom,#markers .title.top{text-align:center}#markers .title.bottom span:before,#markers .title.top span:before{left:50%;margin-left:-8px;border-left:8px solid transparent;border-right:8px solid transparent;border-bottom:8px solid #fff}#markers .title.bottom{margin-top:32px}#markers .title.bottom span:before{top:-8px}#markers .title.top{margin-bottom:32px;bottom:0}#markers .title.top span:before{bottom:-8px;border-bottom:none;border-top:8px solid #fff}#markers .title.left span:before,#markers .title.right span:before{top:50%;margin-top:-8px;border-top:8px solid transparent;border-bottom:8px solid transparent;border-right:8px solid #fff}#markers .title.right{margin-left:32px}#markers .title.right span:before{left:-8px}#markers .title.left{margin-right:32px;right:0}#markers .title.left span:before{right:-8px;border-right:none;border-left:8px solid #fff}#markers .marker:hover .title{z-index:1;opacity:1;left:0}#markers .marker:hover .title.bottom{padding-top:12px}#markers .marker:hover .title.top{padding-bottom:12px}#markers .marker:hover .title.right{padding-left:12px}#markers .marker:hover .title.left{padding-right:12px;left:auto}@media (prefers-color-scheme:dark){#markers .marker .title{color:#fff}#markers .marker .title span{background-color:#323232}#markers .marker .title.bottom span:before{border-bottom-color:#323232}#markers .marker .title.top span:before{border-top-color:#323232}#markers .marker .title.left span:before{border-left-color:#323232}#markers .marker .title.right span:before{border-right-color:#323232}}#notification{position:absolute;width:100%;height:0;left:0;top:50%;margin-top:-16px;text-align:center;opacity:0;cursor:default;-webkit-user-select:none;-ms-user-select:none;user-select:none;transition:opacity .3s ease}#notification.visible{opacity:1}#notification.hidden{display:none}#notification span{display:inline-block;max-width:70%;padding:5px 28px;line-height:1.6em;background:rgba(0,0,0,0.8);color:#fff;border-radius:16px;text-shadow:0 1px rgba(0,0,0,0.3)}.background-image__wrapper{position:absolute;overflow:hidden;height:100%;width:100%}#background-image{position:absolute;z-index:-1;width:100%;height:100%;-ms-touch-action:none;touch-action:none;pointer-events:none;user-drag:none;-webkit-user-drag:none}.popup-layout{position:absolute;top:0;right:0;bottom:0;left:0;display:-ms-flexbox;display:flex;visibility:hidden;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;z-index:2;background:rgba(0,0,0,0.6);opacity:0}.popup-layout.visible{opacity:1;transition:opacity .3s ease;visibility:visible;-ms-transform:none;transform:none}.popup-layout.visible .popups{transition:transform .3s ease;-ms-transform:scale(1);transform:scale(1)}.popup-layout .popups{position:relative;-ms-transform:scale(.8);transform:scale(.8)}.popup-layout .close{position:absolute;background:#fff no-repeat;background-position:center;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23666%22 stroke-width=%221.2%22 d=%22M9 9L24 24M24 9L9 24%22/%3E %3C/svg%3E");right:0;top:0;width:32px;height:32px;cursor:pointer;z-index:1}.popup-layout .close:hover{background-color:#dbdbdb}.popup-layout .popup{display:none;position:relative;min-width:200px;max-width:400px;min-height:140px;max-height:calc(100vh - 150px);background:#fff;box-shadow:0 5px 8px rgba(0,0,0,0.15);overflow:auto;border-radius:7px;-webkit-overflow-scrolling:touch}.popup-layout .popup:target{display:block}.popup-layout .popup img,.popup-layout .popup video{width:100%;display:block}.popup-layout .popup ul{padding-left:2em}.popup-layout .popup ul li{margin-bottom:.2em;line-height:1.4em}.popup-layout .popup .content{padding:22px}.popup-layout .popup p{margin-right:2em;line-height:1.6em}#gallery{position:absolute;width:200px;left:-200px;height:100%;background:rgba(0,0,0,0.8);z-index:2;transition:left .3s ease;will-change:left}#gallery.visible{left:0}#gallery .gallery-toggler{cursor:pointer;position:absolute;background:rgba(0,0,0,0.8);top:0;bottom:0;margin:auto 0;right:-18px;width:18px;height:50px;border-radius:0 5px 5px 0}#gallery .gallery-toggler:after{content:'';display:block;position:absolute;top:0;right:0;bottom:0;left:0;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2214%22 height=%2228%22 viewBox=%220 0 14 28%22%3E %3Cpath fill=%22none%22 stroke=%22%23FFF%22 stroke-width=%222%22 d=%22M10 1L3 14L10 27%22/%3E %3C/svg%3E");background-position:center;background-repeat:no-repeat;-ms-transform:scale(-1,1);transform:scale(-1,1)}#gallery.visible .gallery-toggler:after{-ms-transform:scale(1,1);transform:scale(1,1)}#gallery ul{margin:0;padding:5px;height:100%;overflow:hidden;overflow-y:scroll;box-sizing:border-box;transform:translateZ(0);will-change:scroll-position;-webkit-overflow-scrolling:touch}@supports (-webkit-overflow-scrolling:touch){#gallery ul::-webkit-scrollbar{width:8px;background:rgba(0,0,0,0.5)}#gallery ul::-webkit-scrollbar-thumb{background:rgba(255,255,255,0.8);width:4px;margin:3px;border-radius:4px;transform:scale(.1)}#gallery ul::-webkit-scrollbar-thumb:hover{background:#fff}}#gallery ul li{box-sizing:border-box;background-size:100%;background-position:center;position:relative;cursor:pointer;background-color:#666;padding:0;margin:5px 0;box-shadow:0 0 0 0 #fff;transition:box-shadow .1s ease}#gallery ul li.active{box-shadow:0 0 0 5px #0080ff}#gallery ul li:hover{box-shadow:0 0 0 2px #fff}#gallery ul li:before{content:'';height:0;display:block;padding-top:50%}#gallery ul li .item-title{position:absolute;bottom:0;margin:0;background:linear-gradient(to top,rgba(0,0,0,0.5) 40%,transparent);color:#fff;padding:24px 10px 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;box-sizing:border-box}.slider{position:relative;overflow:hidden}.slider .tape{will-change:transform;transition:transform .3s ease,height .2s ease;font-size:0;line-height:0;white-space:nowrap}.slider .tape img{width:100%;vertical-align:top;display:inline-block}.slider-button{z-index:2;position:absolute;top:50%;margin-top:-16px;background-color:rgba(0,0,0,0.6);height:32px;width:32px;border-radius:50%;cursor:pointer}.slider-button.hidden{pointer-events:none;opacity:.3}.slider-button.prev{left:16px;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 d=%22M18.5 10L12.5 16L18.5 22%22/%3E %3C/svg%3E")}.slider-button.next{right:16px;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2232%22 height=%2232%22 viewBox=%220 0 32 32%22%3E %3Cpath fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222%22 d=%22M13.5 10L19.5 16L13.5 22%22/%3E %3C/svg%3E")}.slider .bullets{position:absolute;z-index:1;width:100%;height:30px;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}.slider .bullets .bullet{width:6px;height:6px;border-radius:50%;background-color:rgba(0,0,0,0.6);margin:3px;cursor:pointer;transition:background-color .3s ease}.slider .bullets .bullet.select{background-color:#fff}.dev-cursor{position:absolute;z-index:1;left:0;top:0;bottom:0;right:0;margin:auto;width:32px;height:32px;border:2px solid #000;border-radius:50%;box-shadow:0 0 0 2px #fff;pointer-events:none} /*# sourceMappingURL=tour-player.css.map */ diff --git a/build/tour-player.js b/build/tour-player.js index 7b77e51..4ca39a1 100644 --- a/build/tour-player.js +++ b/build/tour-player.js @@ -1,22 +1,27 @@ -var BrouserInfo;BrouserInfo=function(){var e=screen?screen.width+" x "+screen.height:"",t=function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},n=function(){try{var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(t){return!1}},i=function(){var e={webkitTransformStyle:"-webkit-transform-style",MozTransformStyle:"-moz-transform-style",msTransformStyle:"-ms-transform-style",transformStyle:"transform-style"},t=document.createElement("p");document.body.insertBefore(t,null);for(var n in e)void 0!==t.style[n]&&(t.style[n]="preserve-3d");var i,r=window.getComputedStyle(t,null);for(var o in e)i=r.getPropertyValue(e[o])||i;return document.body.removeChild(t),"preserve-3d"==i},r=function(){var e="-",t="-",n=[{s:"Windows 3.11",r:/Win16/},{s:"Windows 95",r:/(Windows 95|Win95|Windows_95)/},{s:"Windows ME",r:/(Win 9x 4.90|Windows ME)/},{s:"Windows 98",r:/(Windows 98|Win98)/},{s:"Windows CE",r:/Windows CE/},{s:"Windows 2000",r:/(Windows NT 5.0|Windows 2000)/},{s:"Windows XP",r:/(Windows NT 5.1|Windows XP)/},{s:"Windows Server 2003",r:/Windows NT 5.2/},{s:"Windows Vista",r:/Windows NT 6.0/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows NT 4.0",r:/(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/},{s:"Windows ME",r:/Windows ME/},{s:"Android",r:/Android/},{s:"Open BSD",r:/OpenBSD/},{s:"Sun OS",r:/SunOS/},{s:"Linux",r:/(Linux|X11)/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/},{s:"QNX",r:/QNX/},{s:"UNIX",r:/UNIX/},{s:"BeOS",r:/BeOS/},{s:"OS/2",r:/OS\/2/},{s:"Search Bot",r:/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/}];for(var i in n){var r=n[i];if(r.r.test(navigator.userAgent)){e=r.s;break}}switch(/Windows/.test(e)&&(t=/Windows (.*)/.exec(e)[1],e="Windows"),e){case"Mac OS X":t=/Mac OS X (10[\.\_\d]+)/.exec(navigator.userAgent)[1];break;case"Android":t=/Android ([\.\_\d]+)/.exec(navigator.userAgent)[1];break;case"iOS":t=/OS (\d+)_(\d+)_?(\d+)?/.exec(navigator.appVersion),t=t[1]+"."+t[2]+"."+(0|t[3])}return{name:e,version:t}},o=function(){var e,t,n,i=navigator.userAgent,r=navigator.appName,o=parseFloat(navigator.appVersion);return(t=i.indexOf("Opera"))!=-1?(r="Opera",o=i.substring(t+6),(t=i.indexOf("Version"))!=-1&&(o=i.substring(t+8))):(t=i.indexOf("MSIE"))!=-1?(r="Microsoft Internet Explorer",o=i.substring(t+5)):(t=i.indexOf("Chrome"))!=-1?(r="Chrome",o=i.substring(t+7)):(t=i.indexOf("Safari"))!=-1?(r="Safari",o=i.substring(t+7),(t=i.indexOf("Version"))!=-1&&(o=i.substring(t+8))):(t=i.indexOf("Firefox"))!=-1?(r="Firefox",o=i.substring(t+8)):i.indexOf("Trident/")!=-1?(r="Microsoft Internet Explorer",o=i.substring(i.indexOf("rv:")+3)):(e=i.lastIndexOf(" ")+1)<(t=i.lastIndexOf("/"))&&(r=i.substring(e,t),o=i.substring(t+1),r.toLowerCase()==r.toUpperCase()&&(r=navigator.appName)),(n=o.indexOf(";"))!=-1&&(o=o.substring(0,n)),(n=o.indexOf(" "))!=-1&&(o=o.substring(0,n)),(n=o.indexOf(")"))!=-1&&(o=o.substring(0,n)),{name:r,version:o}},a=function(){return!!~["iOS","Mac OS X","iOS"].indexOf(r().name)},s=function(){return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(navigator.appVersion)},c=function(){return"file:"!=location.protocol};BrouserInfo={screenSize:e,canvas:t(),webgl:n(),css:i(),os:r(),brouser:o(),mobile:s(),apple:a(),array:!!window.Float32Array,protocol:c}};var Lang={};Lang["default"]="en",Lang.set=function(e,t){return this.language=(e||document.documentElement.lang||navigator.language||navigator.userLanguage||this["default"]).split("-")[0],t&&(this.dictionary=t),this.language},Lang.translate=function(e){return"object"==typeof e?e[this.language]||e[this["default"]]:e},Lang.get=function(e){return Lang.dictionary[e]?this.translate(this.dictionary[e]):"["+e+"]"};var Tools={},Tour={};Tour.version=[2,2,3];var UI={};UI.gallery={borderHoverSize:5,init:function(e){this.visible=e,this.domElement=document.createElement("div"),this.domElement.id="gallery",this.ul=document.createElement("ul"),this.toggler=document.createElement("div"),this.toggler.classList.add("gallery-toggler"),this.toggler.addEventListener("click",this.toggle.bind(this)),this.domElement.appendChild(this.toggler),this.domElement.appendChild(this.ul),document.body.appendChild(this.domElement),this.items={},this.display(e)},toggle:function(){this.display(!this.visible)},display:function(e){this.visible=e,e?this.onOpen&&this.onOpen():this.onClose&&this.onClose(),this.domElement.classList[e?"add":"remove"]("visible")},addItem:function(e){this.item=document.createElement("li"),this.item.onclick=e.onclick,this.item.style.backgroundImage="url("+e.image+")",this.items[e.id]=this.item,e.title&&(this.titleElem=document.createElement("div"),this.titleElem.classList.add("item-title"),this.titleElem.innerText=e.title,this.titleElem.title=e.title,this.item.appendChild(this.titleElem)),this.ul.appendChild(this.item)},setActive:function(e){for(var t in this.items)this.items[t].classList.remove("active");if(this.items[e]){this.items[e].classList.add("active");var n=this.items[e].getBoundingClientRect(),i=this.ul.getBoundingClientRect();(i.height-n.top<0||n.top+n.height<0)&&this.ul.scrollTo(0,this.ul.scrollTop+this.items[e].getBoundingClientRect().y-this.borderHoverSize)}}},UI.Marker=function(e,t,n){var i=document.getElementById("markers");i||(i=document.createElement("div"),i.id="markers",document.body.appendChild(i)),this.buttonDomElement=document.createElement("div"),this.buttonDomElement.classList.add("button"),this.buttonDomElement.addEventListener("click",e),this.domElement=document.createElement("div"),this.domElement.classList.add("marker"),this.domElement.appendChild(this.buttonDomElement),i.appendChild(this.domElement),this.size=this.domElement.clientWidth,t&&this.setIcon(t),n&&this.setTitle(n),this.setPosition()},UI.Marker.prototype.setTitle=function(e){if(!e)return!1;var t;if(!this.title){t=document.createElement("span"),t.innerHTML=e;var n=document.createElement("div");n.classList.add("title"),n.appendChild(t),this.domElement.appendChild(n),this.titleDomElement=n}t=this.titleDomElement.children[0],t.innerHTML=e,this.titleDomElement.style.width=t.clientWidth+1+"px",this.title=e},UI.Marker.prototype.setPosition=function(e,t){if(this.x=e||0,this.y=t||0,this.domElement.style.left=this.x*window.devicePixelRatio+"px",this.domElement.style.top=this.y*window.devicePixelRatio+"px",this.title){var n="bottom";this.y>window.innerHeight-200&&(n="top"),this.x>window.innerWidth-200&&(n="left"),this.x<200&&(n="right"),this.y<200&&(n="bottom"),"top"==n||"bottom"==n?(this.titleDomElement.style.marginTop="",this.titleDomElement.style.marginLeft=-(this.titleDomElement.clientWidth/2-this.size/2)+"px"):(this.titleDomElement.style.marginLeft="",this.titleDomElement.style.marginTop=-(this.titleDomElement.children[0].clientHeight/2-this.size/2)+"px"),this.titleDomElement.className="title "+n}},UI.Marker.prototype.setVisible=function(e){this.domElement.style.display=e?"block":"none"},UI.Marker.prototype.setIcon=function(e){e&&(this.icon=e,this.buttonDomElement.className="button",this.buttonDomElement.classList.add(e))},UI.Marker.prototype.remove=function(){this.domElement.parentNode.removeChild(this.domElement)},UI.slider={init:function(){function e(e,t,n){this.domElement=document.createElement("div"),this.domElement.classList.add("slider-button",t),this.domElement.onClick=n,e.appendChild(this.domElement),this.domElement.addEventListener("click",n),this.setVisible=function(e){this.domElement.classList[e?"remove":"add"]("hidden")}}var t=0;this.domElements=document.querySelectorAll(".slider"),Array.from(this.domElements).map(function(n){function i(e){s.setVisible(e!=r.length-1),a.setVisible(0!=e),o.style.transform="translateX("+e*-100+"%)"}const r=n.getElementsByTagName("img"),o=document.createElement("div");o.className="tape";const a=new e(n,"prev",function(){i(--t)}),s=new e(n,"next",function(){i(++t)});i(0),Array.from(r).map(function(e){const t=e.cloneNode();o.appendChild(t),e.remove()}),n.appendChild(o)})}},UI.controlPanel={},UI.controlPanel.init=function(e){this.progressValue=document.createElement("div"),this.progressValue.className="value",this.progressBar=document.createElement("div"),this.progressBar.className="progress-bar",this.progressBar.appendChild(this.progressValue),this.btnList=document.createElement("div"),this.btnList.className="btn-list",this.panel=document.createElement("div"),this.panel.className="panel",this.panel.appendChild(this.btnList),this.panel.appendChild(this.progressBar),this.domElement=document.createElement("div"),this.domElement.id="control-panel",this.domElement.appendChild(this.panel),this.setProgress(0),this.setVisible(e),document.body.appendChild(this.domElement)},UI.controlPanel.setVisible=function(e){this.domElement.classList[e?"add":"remove"]("visible")},UI.controlPanel.addBtn=function(e,t,n){var i=document.createElement("div");i.classList.add("marker"),i.classList.add(e),i.addEventListener("click",t,!1),i.title=n||"",this.btnList.appendChild(i)},UI.controlPanel.setProgress=function(e){document.body.classList[e<1?"add":"remove"]("load"),this.progressBar&&(this.progressBar.classList[e>=1?"add":"remove"]("hidden"),this.progressValue.style.width=100*Math.min(e,1)+"%")},UI.controlPanel.setOrientation=function(e){var t=e-45,n="";t<0&&t>-90?n="portrait-primary":t>90&&t<180?n="portrait-secondary":t<-90&&t>-180?n="landscape-primary":t>0&&t<90&&(n="landscape-secondary"),this.domElement&&this.domElement.setAttribute("data-orientation",n)},UI.mouseMenu={},UI.mouseMenu.init=function(){this.domElement=document.createElement("div"),this.domElement.id="mouse-menu",this.domElement.addEventListener("selectstart",function(){event.preventDefault()}),document.body.appendChild(this.domElement),document.addEventListener("contextmenu",function(e){e.preventDefault(),UI.mouseMenu.open(e)}),this.domElement.addEventListener("mousedown",function(e){e.stopPropagation()}),document.addEventListener("mousedown",function(){this.close()}.bind(this)),window.addEventListener("blur",function(){this.close()}.bind(this))},UI.mouseMenu.setPosition=function(e,t){this.domElement.style.left=e+"px",this.domElement.style.top=t+"px"},UI.mouseMenu.open=function(e){if(this.domElement.classList.add("visible"),e){var t=5,n=e.clientX,i=e.clientY+t,r=UI.mouseMenu.domElement.clientHeight,o=UI.mouseMenu.domElement.clientWidth;e.clientX+o>window.innerWidth&&(n=Math.max(0,e.clientX-o)),e.clientY+r>window.innerHeight&&(i=Math.max(0,e.clientY-r+t)),this.setPosition(n,i)}},UI.mouseMenu.close=function(){this.domElement.classList.remove("visible")},UI.mouseMenu.Item=function(e,t,n){this.titleElement=document.createElement("span"),this.titleElement.classList.add("title"),this.titleElement.textContent=t,this.action=e,this.keyElement=document.createElement("span"),this.keyElement.classList.add("key"),this.keyElement.textContent=n||"",this.domElement=document.createElement("div"),this.domElement.classList.add("item"),this.disabled=!1,this.domElement.appendChild(this.titleElement),this.domElement.appendChild(this.keyElement);var i=function(e){e.stopPropagation(),e.preventDefault(),!this.disabled&&this.action&&(this.action(),UI.mouseMenu.close())};this.domElement.addEventListener("click",i.bind(this)),this.domElement.addEventListener("contextmenu",i.bind(this)),UI.mouseMenu.domElement.appendChild(this.domElement)},UI.mouseMenu.Item.prototype.setDisable=function(e){this.disabled=e,this.domElement.classList[e?"add":"remove"]("disabled")},UI.mouseMenu.Item.prototype.setVisible=function(e){this.visible=e,this.domElement.classList[e?"remove":"add"]("hidden")},UI.mouseMenu.Item.prototype.setText=function(e,t){e&&(this.titleElement.textContent=e),t&&(this.keyElement.textContent=t)},UI.mouseMenu.Hr=function(){this.domElement=document.createElement("hr"),UI.mouseMenu.domElement.appendChild(this.domElement)},UI.notification={init:function(){this.domElement=document.createElement("div"),this.domElement.id="notification",this.textDomElement=document.createElement("span"),this.domElement.appendChild(this.textDomElement),document.body.appendChild(this.domElement),this.setVisible(!1)},setVisible:function(e){e?(this.domElement.classList.add("visible"),this.domElement.classList.remove("hidden")):(this.setTimeout&&clearTimeout(this.setTimeout),this.domElement.classList.remove("visible"),this.setTimeout=setTimeout(function(){this.domElement.classList.add("hidden")}.bind(this),300))},setText:function(e){this.textDomElement.textContent=e},show:function(e,t){this.setText(e),this.setVisible(!0),this.setTimeout&&clearTimeout(this.setTimeout),t!==!1&&(this.setTimeout=setTimeout(function(){this.setVisible(!1)}.bind(this),t||2e3))}},UI.popUp={init:function(){this.domElement=document.querySelector(".popup-layout"),this.domElement&&(this.domElement.addEventListener("click",function(e){e.target==this.domElement&&this.set()}.bind(this)),this.closeElement=document.querySelector(".popup-layout .close"),this.closeElement.addEventListener("click",this.set.bind(this,!1)),window.addEventListener("popstate",this.popstate.bind(this)),this.popstate())},set:function(e){var t=!!~Object.keys(window.parent.location).indexOf("host");if(t)var n=window.parent.scrollY,i=window.parent.scrollX;window.location.hash=e||"",t&&setTimeout(function(){window.parent.scrollTo(i,n)},0),setTimeout(function(){window.scroll(0,0)},0)},popstate:function(){this.domElement.classList[window.location.hash?"add":"remove"]("visible")}},Tools.copyDirectionMarker=function(e,t){console.info("Pano id:",Tour.view.id);var n=JSON.stringify({lat:t||parseFloat(Tour.view.lat.value.toFixed(2)),lon:parseFloat(Tour.view.lon.value.toFixed(2)),icon:Tools.point.icon,action:{type:"panorama",id:e}},null,"");Tour.controls.copyText(n)},Tools.copyInfoMarker=function(e,t){console.info("Pano id:",Tour.view.id);var n={lat:parseFloat(Tour.view.lat.value.toFixed(2)),lon:parseFloat(Tour.view.lon.value.toFixed(2))};e&&(n.title=e),t&&(n.action={type:"popup",id:t});var i=JSON.stringify(n,null,"");Tour.controls.copyText(i)},Tools.copyMarker=function(){"info"==this.point.icon?this.copyInfoMarker(prompt("Enter title for info marker","title"),prompt("Enter popup id","")):this.copyDirectionMarker(prompt("Enter pano id",Tour.view.id))},Tools.init=function(){this.setPoint(),window.addEventListener("keydown",function(e){switch(e.keyCode){case 13:Tools.copyMarker();break;case 49:Tools.copyLon();break;case 50:Tools.meshEditor()}}),new UI.mouseMenu.Hr,new UI.mouseMenu.Item(Tools.copyLon,"Copy lon","1"),new UI.mouseMenu.Item(Tools.meshEditor,"Mesh editor","2"),this.meshEditor(),Tour.view.fov.min=5,Tour.view.fov.max=130},Tools.copyLon=function(){Tour.controls.copyText(parseFloat(Tour.view.get().lon.toFixed(2)))},Tools.meshEditor=function(){function e(e){var t=new THREE.Vector2;t.x=e.clientX/window.innerWidth*2-1,t.y=2*-(e.clientY/window.innerHeight)+1;var n=new THREE.Raycaster;n.setFromCamera(t,Tour.camera);var i=n.intersectObjects(Tour.meshs);Tour.meshs.forEach(function(e){e.material.color&&e.material.color.set(16777215),e.material.opacity=1}),Tools.selectedMesh=!1;for(var r=0;r';Tour.controls.copyText(e)},copyText:function(e){var t=function(t){if(t)UI.notification.show(Lang.get("notification.successfully-copied"));else{var n=BrouserInfo.apple?"⌘":"Ctrl";window.prompt(Lang.get("notification.embed-code").replace("*",n+"+C"),e)}};if(document.execCommand){var n=document.createElement("span");n.textContent=e,document.body.appendChild(n);var i=document.createRange();i.selectNode(n),window.getSelection().removeAllRanges(),window.getSelection().addRange(i),t(document.execCommand("copy")),window.getSelection().removeAllRanges(),document.body.removeChild(n)}else window.clipboardData?(window.clipboardData.setData("Text",e),t(!0)):t(!1)},editor:function(){Tools.init()},suport:function(){},help:function(e){e.preventDefault();var t="Помощь-в-пользовании-плеером-виртуальных-туров";window.open("http://github.com/Tour-360/tour-player/wiki/"+t,"_blank")},badBrowser:function(){},closeWindow:function(){UI.popUp.set()}},Tour.createScene=function(){if(this.setRenderer(Tour.options.rendererType,Tour.options.imageType),document.body.appendChild(this.renderer.domElement),this.scene=new THREE.Scene,this.camera=new THREE.PerspectiveCamera,"css"==Tour.options.rendererType){var e=[[[-1,0,0],[0,.5,0]],[[1,0,0],[0,-.5,0]],[[0,1,0],[.5,0,1]],[[0,-1,0],[-.5,0,1]],[[0,0,1],[0,1,0]],[[0,0,-1],[0,0,0]]],t=function(e){return this*e};this.mesh=new THREE.Object3D;for(var n=0;n20&&(this.cineticLon=this.cineticLat=0);else{var t=Tour.view.fov.value/Tour.options.fov/Tour.options.mouseSensitivity;this.cineticLon=(e.clientX-this.previousEvent.clientX)*t,this.cineticLat=(e.clientY-this.previousEvent.clientY)*t}this.previousEvent=e},Tour.mouseEvents._touches2mouse=function(e){e.touches&&e.touches.length&&(e.clientX=e.touches[0].pageX*window.devicePixelRatio,e.clientY=e.touches[0].pageY*window.devicePixelRatio,e.defaultPrevented&&e.preventDefault())},Tour.mouseEvents.wheel=function(e){this.options.scaleControl&&e.composed&&e.deltaY&&(this.controls.autoRotate(!1),e.defaultPrevented&&e.preventDefault(),this.view.fov.move(e.deltaY*(e.deltaMode?10/3:.1)),clearTimeout(this.mouseEvents.zoomTimeout),this.mouseEvents.zoomTimeout=setTimeout(function(){Tour.history.set()},300))},Tour.mouseEvents.down=function(e){return(!this.options.touchScroll||"touchstart"!=e.type)&&(2==e.which?(e.preventDefault(),!1):(this.mouseEvents._touches2mouse(e),this.mouseEvents.drag=!0,this.controls.autoRotate(!1),void(this.mouseEvents.previousEvent=e)))},Tour.mouseEvents.move=function(e){if(this.mouseEvents.drag&&(!e.touches||this.options.touchDrag)){this.mouseEvents._touches2mouse(e);var t=Tour.view.fov.value/Tour.options.fov/Tour.options.mouseSensitivity;this.view.lon.set(this.view.lon.value+(e.clientX-this.mouseEvents.previousEvent.clientX)*t),this.view.lat.set(this.view.lat.value+(e.clientY-this.mouseEvents.previousEvent.clientY)*t),this.mouseEvents._setCinetic(e)}},Tour.mouseEvents.up=function(e){if(this.mouseEvents.drag){var t=Date.now()-this.mouseEvents.lastclick;this.mouseEvents.lastclick&&t>30&&t<300&&this.controls.fullscreen(),this.mouseEvents.lastclick=Date.now(),this.mouseEvents._touches2mouse(e),this.mouseEvents._setCinetic(e),this.view.rotation.lat=this.mouseEvents.cineticLat,this.view.rotation.lon=this.mouseEvents.cineticLon,this.history.set()}this.mouseEvents.cineticLon=this.mouseEvents.cineticLat=0,this.mouseEvents.drag=!1},Tour.options={},Tour.options.set=function(e){if("object"==typeof e)for(var t in e)this[t]=e[t]},Object.defineProperty(Tour.options,"set",{enumerable:!1}),Tour.orientationControls={init:function(){window.isSecureContext&&(this.controls=new THREE.DeviceOrientationControls(Tour.camera),this.controls.disconnect(),window.addEventListener("deviceorientation",this.detectDevice))},detectDevice:function(e){e.alpha&&UI.controlPanel.addBtn("rotate",Tour.controls.toggleControls,""),window.removeEventListener("deviceorientation",Tour.orientationControls.detectDevice)}},Tour.query={},Tour.query.get=function(){for(var e=location.search.slice(1).split("&"),t={},n=0;n0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function r(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1}function o(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function a(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function s(e,t,i,r,o,c,l,h,u,d){Object.defineProperty(this,"id",{value:Xc++}),this.uuid=jc.generateUUID(),this.name="",this.image=void 0!==e?e:s.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:s.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:Ms,this.wrapT=void 0!==r?r:Ms,this.magFilter=void 0!==o?o:Ls,this.minFilter=void 0!==c?c:Rs,this.anisotropy=void 0!==u?u:1,this.format=void 0!==l?l:js,this.type=void 0!==h?h:Cs,this.offset=new n(0,0),this.repeat=new n(1,1),this.center=new n(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new a,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==d?d:Ic,this.version=0,this.onUpdate=null}function c(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==i?i:1}function l(e,t,n){this.width=e,this.height=t,this.scissor=new c(0,0,e,t),this.scissorTest=!1,this.viewport=new c(0,0,e,t),n=n||{},this.texture=new s((void 0),(void 0),n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:Ls,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 h(e,t,n){l.call(this,e,t,n),this.samples=4}function u(e,t,n){l.call(this,e,t,n),this.activeCubeFace=0,this.activeMipMapLevel=0}function d(e,t,n,i,r,o,a,c,l,h,u,d){s.call(this,null,o,a,c,l,h,i,r,u,d),this.image={data:e,width:t,height:n},this.magFilter=void 0!==l?l:Es,this.minFilter=void 0!==h?h:Es,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function p(e,t){this.min=void 0!==e?e:new o((+(1/0)),(+(1/0)),(+(1/0))),this.max=void 0!==t?t:new o((-(1/0)),(-(1/0)),(-(1/0)))}function f(e,t){this.center=void 0!==e?e:new o,this.radius=void 0!==t?t:0}function m(e,t){this.normal=void 0!==e?e:new o(1,0,0),this.constant=void 0!==t?t:0}function v(e,t,n,i,r,o){this.planes=[void 0!==e?e:new m,void 0!==t?t:new m,void 0!==n?n:new m,void 0!==i?i:new m,void 0!==r?r:new m,void 0!==o?o:new m]}function g(e){var t={};for(var n in e){t[n]={};for(var i in e[n]){var r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}}return t}function y(e){for(var t={},n=0;nt&&(t=e[n]);return t}function H(){Object.defineProperty(this,"id",{value:du+=2}),this.uuid=jc.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}function F(e,t,n,i,r,o){S.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:o},this.fromBufferGeometry(new G(e,t,n,i,r,o)),this.mergeVertices()}function G(e,t,n,i,r,a){function s(e,t,n,i,r,a,s,m,v,g,y){var x,b,w=a/v,M=s/g,_=a/2,E=s/2,T=m/2,S=v+1,L=g+1,A=0,R=0,C=new o;for(b=0;b0?1:-1,u.push(C.x,C.y,C.z),d.push(x/v),d.push(1-b/g),A+=1}}for(b=0;b0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var o,a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext,s=void 0!==n.precision?n.precision:"highp",c=r(s);c!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",c,"instead."),s=c);var l=n.logarithmicDepthBuffer===!0,h=e.getParameter(34930),u=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),f=e.getParameter(34921),m=e.getParameter(36347),v=e.getParameter(36348),g=e.getParameter(36349),y=u>0,x=a||!!t.get("OES_texture_float"),b=y&&x,w=a?e.getParameter(36183):0;return{isWebGL2:a,getMaxAnisotropy:i,getMaxPrecision:r,precision:s,logarithmicDepthBuffer:l,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:v,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:b,maxSamples:w}}function $(){function e(){h.value!==i&&(h.value=i,h.needsUpdate=r>0),n.numPlanes=r,n.numIntersection=0}function t(e,t,i,r){var o=null!==e?e.length:0,a=null;if(0!==o){if(a=h.value,r!==!0||null===a){var s=i+4*o,u=t.matrixWorldInverse;l.getNormalMatrix(u),(null===a||a.length65535?D:I)(i,1),t.update(n,34963),c[e.id]=n,n}var s={},c={};return{get:r,update:o,getWireframeAttribute:a}}function ne(e,t,n,i){function r(e){c=e}function o(e){l=e.type,h=e.bytesPerElement}function a(t,i){e.drawElements(c,i,l,t*h),n.update(i,c)}function s(r,o,a){var s;if(i.isWebGL2)s=e;else{var s=t.get("ANGLE_instanced_arrays");if(null===s)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}s[i.isWebGL2?"drawElementsInstanced":"drawElementsInstancedANGLE"](c,a,l,o*h,r.maxInstancedCount),n.update(a,c,r.maxInstancedCount)}var c,l,h;this.setMode=r,this.setIndex=o,this.render=a,this.renderInstances=s}function ie(e){function t(e,t,n){switch(n=n||1,r.calls++,t){case 4:r.triangles+=n*(e/3);break;case 5:case 6:r.triangles+=n*(e-2);break;case 1:r.lines+=n*(e/2);break;case 3:r.lines+=n*(e-1);break;case 2:r.lines+=n*e;break;case 0:r.points+=n*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",t)}}function n(){r.frame++,r.calls=0,r.triangles=0,r.points=0,r.lines=0}var i={geometries:0,textures:0},r={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:i,render:r,programs:null,autoReset:!0,reset:n,update:t}}function re(e,t){return Math.abs(t[1])-Math.abs(e[1])}function oe(e){function t(t,r,o,a){var s=t.morphTargetInfluences,c=s.length,l=n[r.id];if(void 0===l){l=[];for(var h=0;h0)return e;var r=t*n,o=gu[r];if(void 0===o&&(o=new Float32Array(r),gu[r]=o),0!==t){i.toArray(o,0);for(var a=1,s=0;a!==t;++a)s+=n,e[a].toArray(o,s)}return o}function ue(e,t){if(e.length!==t.length)return!1;for(var n=0,i=e.length;n");return rt(n)}var n=/^[ \t]*#include +<([\w\d.\/]+)>/gm;return e.replace(n,t)}function ot(e){function t(e,t,n,i){for(var r="",o=parseInt(t);o0?e.gammaFactor:1,y=a.isWebGL2?"":Ke(i.extensions,o,t),x=$e(c),b=s.createProgram();if(i.isRawShaderMaterial?(m=[x].filter(tt).join("\n"),m.length>0&&(m+="\n"),v=[y,x].filter(tt).join("\n"),v.length>0&&(v+="\n")):(m=["precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+r.name,x,o.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+g,"#define MAX_BONES "+o.maxBones,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+p:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.normalMap&&o.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",o.displacementMap&&o.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.flatShading?"#define FLAT_SHADED":"",o.skinning?"#define USE_SKINNING":"",o.useVertexTexture?"#define BONE_TEXTURE":"",o.morphTargets?"#define USE_MORPHTARGETS":"",o.morphNormals&&o.flatShading===!1?"#define USE_MORPHNORMALS":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+u:"",o.sizeAttenuation?"#define USE_SIZEATTENUATION":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&(a.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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(tt).join("\n"),v=[y,"precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+r.name,x,o.alphaTest?"#define ALPHATEST "+o.alphaTest+(o.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+g,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.matcap?"#define USE_MATCAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+d:"",o.envMap?"#define "+p:"",o.envMap?"#define "+f:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.normalMap&&o.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.gradientMap?"#define USE_GRADIENTMAP":"",o.flatShading?"#define FLAT_SHADED":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"",o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+u:"",o.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",o.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&(a.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",o.envMap&&(a.isWebGL2||t.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",o.toneMapping!==ss?"#define TONE_MAPPING":"",o.toneMapping!==ss?ou.tonemapping_pars_fragment:"",o.toneMapping!==ss?Qe("toneMapping",o.toneMapping):"",o.dithering?"#define DITHERING":"",o.outputEncoding||o.mapEncoding||o.matcapEncoding||o.envMapEncoding||o.emissiveMapEncoding?ou.encodings_pars_fragment:"",o.mapEncoding?Je("mapTexelToLinear",o.mapEncoding):"",o.matcapEncoding?Je("matcapTexelToLinear",o.matcapEncoding):"",o.envMapEncoding?Je("envMapTexelToLinear",o.envMapEncoding):"",o.emissiveMapEncoding?Je("emissiveMapTexelToLinear",o.emissiveMapEncoding):"",o.outputEncoding?Ze("linearToOutputTexel",o.outputEncoding):"",o.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(tt).join("\n")),l=rt(l),l=nt(l,o),l=it(l,o),h=rt(h),h=nt(h,o),h=it(h,o),l=ot(l),h=ot(h),a.isWebGL2&&!i.isRawShaderMaterial){var w=!1,M=/^\s*#version\s+300\s+es\s*\n/;i.isShaderMaterial&&null!==l.match(M)&&null!==h.match(M)&&(w=!0,l=l.replace(M,""),h=h.replace(M,"")),m=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,v=["#version 300 es\n","#define varying in",w?"":"out highp vec4 pc_fragColor;",w?"":"#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"+v}var _=m+l,E=v+h,T=Xe(s,35633,_),S=Xe(s,35632,E);s.attachShader(b,T),s.attachShader(b,S),void 0!==i.index0AttributeName?s.bindAttribLocation(b,0,i.index0AttributeName):o.morphTargets===!0&&s.bindAttribLocation(b,0,"position"),s.linkProgram(b);var L=s.getProgramInfoLog(b).trim(),A=s.getShaderInfoLog(T).trim(),R=s.getShaderInfoLog(S).trim(),C=!0,P=!0;s.getProgramParameter(b,35714)===!1?(C=!1,console.error("THREE.WebGLProgram: shader error: ",s.getError(),"35715",s.getProgramParameter(b,35715),"gl.getProgramInfoLog",L,A,R)):""!==L?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",L):""!==A&&""!==R||(P=!1), -P&&(this.diagnostics={runnable:C,material:i,programLog:L,vertexShader:{log:A,prefix:m},fragmentShader:{log:R,prefix:v}}),s.deleteShader(T),s.deleteShader(S);var I;this.getUniforms=function(){return void 0===I&&(I=new We(s,b,e)),I};var O;return this.getAttributes=function(){return void 0===O&&(O=et(s,b)),O},this.destroy=function(){s.deleteProgram(b),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.name=r.name,this.id=_u++,this.code=n,this.usedTimes=1,this.program=b,this.vertexShader=T,this.fragmentShader=S,this}function st(e,t,n){function i(e){var t=e.skeleton,i=t.bones;if(n.floatVertexTextures)return 1024;var r=n.maxVertexUniforms,o=Math.floor((r-20)/4),a=Math.min(o,i.length);return a0,maxBones:p,useVertexTexture:n.floatVertexTextures,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numClippingPlanes:l,numClipIntersection:h,dithering:t.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.receiveShadow&&s.length>0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:t.premultipliedAlpha,alphaTest:t.alphaTest,doubleSided:t.side===Ma,flipSided:t.side===wa,depthPacking:void 0!==t.depthPacking&&t.depthPacking};return v},this.getProgramCode=function(t,n){var i=[];if(n.shaderID?i.push(n.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)i.push(r),i.push(t.defines[r]);for(var o=0;o1&&s.sort(lt),c.length>1&&c.sort(ht)}var o=[],a=0,s=[],c=[];return{opaque:s,transparent:c,init:e,push:n,unshift:i,sort:r}}function dt(){function e(t){var n=t.target;n.removeEventListener("dispose",e),delete i[n.id]}function t(t,n){var r,o=i[t.id];return void 0===o?(r=new ut,i[t.id]={},i[t.id][n.id]=r,t.addEventListener("dispose",e)):(r=o[n.id],void 0===r&&(r=new ut,o[n.id]=r)),r}function n(){i={}}var i={};return{get:t,dispose:n}}function pt(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var i;switch(t.type){case"DirectionalLight":i={direction:new o,color:new x,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new n};break;case"SpotLight":i={position:new o,direction:new o,color:new x,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new n};break;case"PointLight":i={position:new o,color:new x,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new n,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":i={direction:new o,skyColor:new x,groundColor:new x};break;case"RectAreaLight":i={color:new x,position:new o,halfWidth:new o,halfHeight:new o}}return e[t.id]=i,i}}}function ft(){function e(e,i,o){for(var c=0,l=0,h=0,u=0,d=0,p=0,f=0,m=0,v=o.matrixWorldInverse,g=0,y=e.length;g0:s&&s.isGeometry&&(u=s.morphTargets&&s.morphTargets.length>0)),t.isSkinnedMesh&&n.skinning===!1&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t);var d=t.isSkinnedMesh&&n.skinning,p=0;u&&(p|=g),d&&(p|=y),c=l[p]}if(e.localClippingEnabled&&n.clipShadows===!0&&0!==n.clippingPlanes.length){var f=c.uuid,m=n.uuid,v=M[f];void 0===v&&(v={},M[f]=v);var x=v[m];void 0===x&&(x=c.clone(),v[m]=x),c=x}return c.visible=n.visible,c.wireframe=n.wireframe,c.side=null!=n.shadowSide?n.shadowSide:_[n.side],c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,i&&c.isMeshDistanceMaterial&&(c.referencePosition.copy(r),c.nearDistance=o,c.farDistance=a),c}function s(n,i,r,o){if(n.visible!==!1){var c=n.layers.test(i.layers);if(c&&(n.isMesh||n.isLine||n.isPoints)&&n.castShadow&&(!n.frustumCulled||h.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,n.matrixWorld);var l=t.update(n),u=n.material;if(Array.isArray(u))for(var d=l.groups,p=0,f=d.length;p=1):oe.indexOf("OpenGL ES")!==-1&&(re=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(oe)[1]),ie=re>=2);var ae=null,se={},ce=new c,le=new c,he={};return he[3553]=s(3553,3553,1),he[34067]=s(34067,34069,6),I.setClear(0,0,0,1),O.setClear(1),D.setClear(0),p(2929),O.setFunc($a),x(!1),b(da),p(2884),g(Aa),{buffers:{color:I,depth:O,stencil:D},initAttributes:l,enableAttribute:h,enableAttributeAndDivisor:u,disableUnusedAttributes:d,enable:p,disable:f,getCompressedTextureFormats:m,useProgram:v,setBlending:g,setMaterial:y,setFlipSided:x,setCullFace:b,setLineWidth:w,setPolygonOffset:M,setScissorTest:_,activeTexture:E,bindTexture:T,compressedTexImage2D:S,texImage2D:L,texImage3D:A,scissor:R,viewport:C,reset:P}}function wt(e,t,n,i,r,o,a){function s(e,t,n,i){var r=1;if((e.width>i||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||t===!0){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof ImageBitmap){void 0===O&&(O=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"));var o=n?document.createElementNS("http://www.w3.org/1999/xhtml","canvas"):O,a=t?jc.floorPowerOfTwo:Math.floor;o.width=a(r*e.width),o.height=a(r*e.height);var s=o.getContext("2d");return s.drawImage(e,0,0,o.width,o.height),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o.width+"x"+o.height+")."),o}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function c(e){return jc.isPowerOfTwo(e.width)&&jc.isPowerOfTwo(e.height)}function l(e){return!r.isWebGL2&&(e.wrapS!==Ms||e.wrapT!==Ms||e.minFilter!==Es&&e.minFilter!==Ls)}function h(e,t){return e.generateMipmaps&&t&&e.minFilter!==Es&&e.minFilter!==Ls}function u(t,n,r,o){e.generateMipmap(t);var a=i.get(n);a.__maxMipLevel=Math.log(Math.max(r,o))*Math.LOG2E}function d(e,n){if(!r.isWebGL2)return e;var i=e;return 6403===e&&(5126===n&&(i=33326),5131===n&&(i=33325),5121===n&&(i=33321)),6407===e&&(5126===n&&(i=34837),5131===n&&(i=34843),5121===n&&(i=32849)),6408===e&&(5126===n&&(i=34836),5131===n&&(i=34842),5121===n&&(i=32856)),33325===i||33326===i||34842===i||34836===i?t.get("EXT_color_buffer_float"):34843!==i&&34837!==i||console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."),i}function p(e){return e===Es||e===Ts||e===Ss?9728:9729}function f(e){var t=e.target;t.removeEventListener("dispose",f),v(t),t.isVideoTexture&&delete D[t.id],a.memory.textures--}function m(e){var t=e.target;t.removeEventListener("dispose",m),g(t),a.memory.textures--}function v(t){var n=i.get(t);if(t.image&&n.__image__webglTextureCube)e.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture)}i.remove(t)}function g(t){var n=i.get(t),r=i.get(t.texture);if(t){if(void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLRenderTargetCube)for(var o=0;o<6;o++)e.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[o]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer);i.remove(t.texture),i.remove(t)}}function y(e,t){var r=i.get(e);if(e.isVideoTexture&&I(e),e.version>0&&r.__version!==e.version){var o=e.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(o.complete!==!1)return void _(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}function x(e,t){var r=i.get(e);return e.version>0&&r.__version!==e.version?void _(r,e,t):(n.activeTexture(33984+t),void n.bindTexture(32879,r.__webglTexture))}function b(t,l){var p=i.get(t);if(6===t.image.length)if(t.version>0&&p.__version!==t.version){p.__image__webglTextureCube||(t.addEventListener("dispose",f),p.__image__webglTextureCube=e.createTexture(),a.memory.textures++),n.activeTexture(33984+l),n.bindTexture(34067,p.__image__webglTextureCube),e.pixelStorei(37440,t.flipY);for(var m=t&&t.isCompressedTexture,v=t.image[0]&&t.image[0].isDataTexture,g=[],y=0;y<6;y++)m||v?g[y]=v?t.image[y].image:t.image[y]:g[y]=s(t.image[y],!1,!0,r.maxCubemapSize);var x=g[0],b=c(x)||r.isWebGL2,w=o.convert(t.format),_=o.convert(t.type),E=d(w,_);M(34067,t,b);for(var y=0;y<6;y++)if(m)for(var T,S=g[y].mipmaps,L=0,A=S.length;L-1?n.compressedTexImage2D(34069+y,L,E,T.width,T.height,0,T.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+y,L,E,T.width,T.height,0,w,_,T.data);else v?n.texImage2D(34069+y,0,E,g[y].width,g[y].height,0,w,_,g[y].data):n.texImage2D(34069+y,0,E,w,_,g[y]);m?p.__maxMipLevel=S.length-1:p.__maxMipLevel=0,h(t,b)&&u(34067,t,x.width,x.height),p.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(33984+l),n.bindTexture(34067,p.__image__webglTextureCube)}function w(e,t){n.activeTexture(33984+t),n.bindTexture(34067,i.get(e).__webglTexture)}function M(n,a,s){var c;if(s?(e.texParameteri(n,10242,o.convert(a.wrapS)),e.texParameteri(n,10243,o.convert(a.wrapT)),e.texParameteri(n,10240,o.convert(a.magFilter)),e.texParameteri(n,10241,o.convert(a.minFilter))):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),a.wrapS===Ms&&a.wrapT===Ms||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,p(a.magFilter)),e.texParameteri(n,10241,p(a.minFilter)),a.minFilter!==Es&&a.minFilter!==Ls&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),c=t.get("EXT_texture_filter_anisotropic")){if(a.type===Bs&&null===t.get("OES_texture_float_linear"))return;if(a.type===Us&&null===(r.isWebGL2||t.get("OES_texture_half_float_linear")))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function _(t,i,p){var m;m=i.isDataTexture3D?32879:3553,void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",f),t.__webglTexture=e.createTexture(),a.memory.textures++),n.activeTexture(33984+p),n.bindTexture(m,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment);var v=l(i)&&c(i.image)===!1,g=s(i.image,v,!1,r.maxTextureSize),y=c(g)||r.isWebGL2,x=o.convert(i.format),b=o.convert(i.type),w=d(x,b);M(m,i,y);var _,E=i.mipmaps;if(i.isDepthTexture){if(w=6402,i.type===Bs){if(!r.isWebGL2)throw new Error("Float Depth Texture only supported in WebGL2.0");w=36012}else r.isWebGL2&&(w=33189);i.format===Ys&&6402===w&&i.type!==Os&&i.type!==zs&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Os,b=o.convert(i.type)),i.format===Js&&(w=34041,i.type!==Gs&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Gs,b=o.convert(i.type))),n.texImage2D(3553,0,w,g.width,g.height,0,x,b,null)}else if(i.isDataTexture)if(E.length>0&&y){for(var T=0,S=E.length;T-1?n.compressedTexImage2D(3553,T,w,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,T,w,_.width,_.height,0,x,b,_.data);t.__maxMipLevel=E.length-1}else if(i.isDataTexture3D)n.texImage3D(32879,0,w,g.width,g.height,g.depth,0,x,b,g.data),t.__maxMipLevel=0;else if(E.length>0&&y){for(var T=0,S=E.length;T=0){var c=i[a];if(void 0!==c){var l=c.normalized,h=c.itemSize,u=ke.get(c);if(void 0===u)continue;var d=u.buffer,p=u.type,f=u.bytesPerElement;if(c.isInterleavedBufferAttribute){var m=c.data,v=m.stride,g=c.offset;m&&m.isInstancedInterleavedBuffer?(Ne.enableAttributeAndDivisor(s,m.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=m.meshPerAttribute*m.count)):Ne.enableAttribute(s),ce.bindBuffer(34962,d),ce.vertexAttribPointer(s,h,p,l,v*f,g*f)}else c.isInstancedBufferAttribute?(Ne.enableAttributeAndDivisor(s,c.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=c.meshPerAttribute*c.count)):Ne.enableAttribute(s),ce.bindBuffer(34962,d),ce.vertexAttribPointer(s,h,p,l,0,0)}else if(void 0!==o){var y=o[a];if(void 0!==y)switch(y.length){case 2:ce.vertexAttrib2fv(s,y);break;case 3:ce.vertexAttrib3fv(s,y);break;case 4:ce.vertexAttrib4fv(s,y);break;default:ce.vertexAttrib1fv(s,y)}}}}Ne.disableUnusedAttributes()}function f(e){et.isPresenting()||nt&&nt(e)}function m(e,t,n,i){if(e.visible!==!1){var r=e.layers.test(t.layers);if(r)if(e.isGroup)n=e.renderOrder;else if(e.isLight)se.pushLight(e),e.castShadow&&se.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||Ae.intersectsSprite(e)){i&&Oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Ie);var o=je.update(e),a=e.material;re.push(e,o,a,n,Oe.z,null)}}else if(e.isImmediateRenderObject)i&&Oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Ie),re.push(e,null,e.material,n,Oe.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.update(),!e.frustumCulled||Ae.intersectsObject(e))){i&&Oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Ie);var o=je.update(e),a=e.material;if(Array.isArray(a))for(var s=o.groups,c=0,l=s.length;c=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(var v=0;v=0&&e.numSupportedMorphNormals++}var y=i.shader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&e.clipping!==!0||(i.numClippingPlanes=Re.numPlanes,i.numIntersection=Re.numIntersection,y.clippingPlanes=Re.uniform),i.fog=t,void 0===a&&(i.lightsHash=a={}),a.stateID=c.stateID,a.directionalLength=c.directionalLength,a.pointLength=c.pointLength,a.spotLength=c.spotLength,a.rectAreaLength=c.rectAreaLength,a.hemiLength=c.hemiLength,a.shadowsLength=c.shadowsLength,e.lights&&(y.ambientLightColor.value=r.state.ambient,y.directionalLights.value=r.state.directional,y.spotLights.value=r.state.spot,y.rectAreaLights.value=r.state.rectArea,y.pointLights.value=r.state.point,y.hemisphereLights.value=r.state.hemi,y.directionalShadowMap.value=r.state.directionalShadowMap,y.directionalShadowMatrix.value=r.state.directionalShadowMatrix,y.spotShadowMap.value=r.state.spotShadowMap,y.spotShadowMatrix.value=r.state.spotShadowMatrix,y.pointShadowMap.value=r.state.pointShadowMap,y.pointShadowMatrix.value=r.state.pointShadowMatrix);var x=i.program.getUniforms(),b=We.seqWithValue(x.seq,y);i.uniformsList=b}function _(e,t,n,i){we=0;var r=Fe.get(n),o=se.state.lights,a=r.lightsHash,s=o.state.hash;if(Ce&&(Pe||e!==ve)){var c=e===ve&&n.id===fe;Re.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,r,c)}n.needsUpdate===!1&&(void 0===r.program?n.needsUpdate=!0:n.fog&&r.fog!==t?n.needsUpdate=!0:!n.lights||a.stateID===s.stateID&&a.directionalLength===s.directionalLength&&a.pointLength===s.pointLength&&a.spotLength===s.spotLength&&a.rectAreaLength===s.rectAreaLength&&a.hemiLength===s.hemiLength&&a.shadowsLength===s.shadowsLength?void 0===r.numClippingPlanes||r.numClippingPlanes===Re.numPlanes&&r.numIntersection===Re.numIntersection||(n.needsUpdate=!0):n.needsUpdate=!0),n.needsUpdate&&(M(n,t,i),n.needsUpdate=!1);var l=!1,h=!1,u=!1,p=r.program,f=p.getUniforms(),m=r.shader.uniforms;if(Ne.useProgram(p.program)&&(l=!0,h=!0,u=!0),n.id!==fe&&(fe=n.id,h=!0),l||ve!==e){if(f.setValue(ce,"projectionMatrix",e.projectionMatrix),Ue.logarithmicDepthBuffer&&f.setValue(ce,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),ve!==e&&(ve=e,h=!0,u=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var v=f.map.cameraPosition;void 0!==v&&v.setValue(ce,Oe.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&f.setValue(ce,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){f.setOptional(ce,i,"bindMatrix"),f.setOptional(ce,i,"bindMatrixInverse");var g=i.skeleton;if(g){var y=g.bones;if(Ue.floatVertexTextures){if(void 0===g.boneTexture){var x=Math.sqrt(4*y.length);x=jc.ceilPowerOfTwo(x),x=Math.max(x,4);var b=new Float32Array(x*x*4);b.set(g.boneMatrices);var w=new d(b,x,x,js,Bs);w.needsUpdate=!0,g.boneMatrices=b,g.boneTexture=w,g.boneTextureSize=x}f.setValue(ce,"boneTexture",g.boneTexture),f.setValue(ce,"boneTextureSize",g.boneTextureSize)}else f.setOptional(ce,g,"boneMatrices")}}return h&&(f.setValue(ce,"toneMappingExposure",le.toneMappingExposure),f.setValue(ce,"toneMappingWhitePoint",le.toneMappingWhitePoint),n.lights&&H(m,u),t&&n.fog&&R(m,t),n.isMeshBasicMaterial?E(m,n):n.isMeshLambertMaterial?(E(m,n),C(m,n)):n.isMeshPhongMaterial?(E(m,n),n.isMeshToonMaterial?I(m,n):P(m,n)):n.isMeshStandardMaterial?(E(m,n),n.isMeshPhysicalMaterial?D(m,n):O(m,n)):n.isMeshMatcapMaterial?(E(m,n),z(m,n)):n.isMeshDepthMaterial?(E(m,n),B(m,n)):n.isMeshDistanceMaterial?(E(m,n),U(m,n)):n.isMeshNormalMaterial?(E(m,n),N(m,n)):n.isLineBasicMaterial?(T(m,n),n.isLineDashedMaterial&&S(m,n)):n.isPointsMaterial?L(m,n):n.isSpriteMaterial?A(m,n):n.isShadowMaterial&&(m.color.value=n.color,m.opacity.value=n.opacity),void 0!==m.ltc_1&&(m.ltc_1.value=cu.LTC_1),void 0!==m.ltc_2&&(m.ltc_2.value=cu.LTC_2),We.upload(ce,r.uniformsList,m,le)),n.isShaderMaterial&&n.uniformsNeedUpdate===!0&&(We.upload(ce,r.uniformsList,m,le),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&f.setValue(ce,"center",i.center),f.setValue(ce,"modelViewMatrix",i.modelViewMatrix),f.setValue(ce,"normalMatrix",i.normalMatrix),f.setValue(ce,"modelMatrix",i.matrixWorld),p}function E(e,t){e.opacity.value=t.opacity,t.color&&(e.diffuse.value=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),t.envMap&&(e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=Fe.get(t.envMap).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity);var n;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),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),n.matrixAutoUpdate===!0&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}function T(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function S(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function L(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*Ee,e.scale.value=.5*_e,e.map.value=t.map,null!==t.map&&(t.map.matrixAutoUpdate===!0&&t.map.updateMatrix(),e.uvTransform.value.copy(t.map.matrix))}function A(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity,e.rotation.value=t.rotation,e.map.value=t.map,null!==t.map&&(t.map.matrixAutoUpdate===!0&&t.map.updateMatrix(),e.uvTransform.value.copy(t.map.matrix))}function R(e,t){e.fogColor.value=t.color,t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}function C(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}function P(e,t){e.specular.value=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===wa&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===wa&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function I(e,t){P(e,t),t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function O(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===wa&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===wa&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function D(e,t){O(e,t),e.reflectivity.value=t.reflectivity,e.clearCoat.value=t.clearCoat,e.clearCoatRoughness.value=t.clearCoatRoughness}function z(e,t){t.matcap&&(e.matcap.value=t.matcap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===wa&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===wa&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function B(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function U(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}function N(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===wa&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===wa&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function H(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLights.needsUpdate=t,e.pointLights.needsUpdate=t,e.spotLights.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function F(){var e=we;return e>=Ue.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+e+" texture units while this GPU supports only "+Ue.maxTextures),we+=1,e}console.log("THREE.WebGLRenderer",la),e=e||{};var G=void 0!==e.canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),k=void 0!==e.context?e.context:null,V=void 0!==e.alpha&&e.alpha,j=void 0===e.depth||e.depth,W=void 0===e.stencil||e.stencil,q=void 0!==e.antialias&&e.antialias,X=void 0===e.premultipliedAlpha||e.premultipliedAlpha,Y=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,J=void 0!==e.powerPreference?e.powerPreference:"default",re=null,se=null;this.domElement=G,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=cs,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var ce,le=this,he=!1,ue=null,de=null,pe=null,fe=-1,me={geometry:null,program:null,wireframe:!1},ve=null,ge=null,ye=new c,xe=new c,be=null,we=0,Me=G.width,_e=G.height,Ee=1,Te=new c(0,0,Me,_e),Se=new c(0,0,Me,_e),Le=!1,Ae=new v,Re=new $,Ce=!1,Pe=!1,Ie=new i,Oe=new o;try{var De={alpha:V,depth:j,stencil:W,antialias:q,premultipliedAlpha:X,preserveDrawingBuffer:Y,powerPreference:J};if(G.addEventListener("webglcontextlost",r,!1),G.addEventListener("webglcontextrestored",a,!1),ce=k||G.getContext("webgl",De)||G.getContext("experimental-webgl",De),null===ce)throw null!==G.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===ce.getShaderPrecisionFormat&&(ce.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(ze){console.error("THREE.WebGLRenderer: "+ze.message)}var Be,Ue,Ne,He,Fe,Ge,ke,Ve,je,qe,Xe,Ye,Je,Ze,Qe,Ke,$e;n();var et=null;"undefined"!=typeof navigator&&(et="xr"in navigator?new Rt(le):new At(le)),this.vr=et;var tt=new xt(le,je,Ue.maxTextureSize);this.shadowMap=tt,this.getContext=function(){return ce},this.getContextAttributes=function(){return ce.getContextAttributes()},this.forceContextLoss=function(){var e=Be.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=Be.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return Ee},this.setPixelRatio=function(e){void 0!==e&&(Ee=e,this.setSize(Me,_e,!1))},this.getSize=function(){return{width:Me,height:_e}},this.setSize=function(e,t,n){return et.isPresenting()?void console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(Me=e,_e=t,G.width=e*Ee,G.height=t*Ee,n!==!1&&(G.style.width=e+"px",G.style.height=t+"px"),void this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(){return{width:Me*Ee,height:_e*Ee}},this.setDrawingBufferSize=function(e,t,n){Me=e,_e=t,Ee=n,G.width=e*n,G.height=t*n,this.setViewport(0,0,e,t)},this.getCurrentViewport=function(){return ye},this.setViewport=function(e,t,n,i){Te.set(e,_e-t-i,n,i),Ne.viewport(ye.copy(Te).multiplyScalar(Ee))},this.setScissor=function(e,t,n,i){Se.set(e,_e-t-i,n,i),Ne.scissor(xe.copy(Se).multiplyScalar(Ee))},this.setScissorTest=function(e){Ne.setScissorTest(Le=e)},this.getClearColor=function(){return Je.getClearColor()},this.setClearColor=function(){Je.setClearColor.apply(Je,arguments)},this.getClearAlpha=function(){return Je.getClearAlpha()},this.setClearAlpha=function(){Je.setClearAlpha.apply(Je,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),ce.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(){G.removeEventListener("webglcontextlost",r,!1),G.removeEventListener("webglcontextrestored",a,!1),Xe.dispose(),Ye.dispose(),Fe.dispose(),je.dispose(),et.dispose(),it.stop()},this.renderBufferImmediate=function(e,t){Ne.initAttributes();var n=Fe.get(e);e.hasPositions&&!n.position&&(n.position=ce.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=ce.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=ce.createBuffer()),e.hasColors&&!n.color&&(n.color=ce.createBuffer());var i=t.getAttributes();e.hasPositions&&(ce.bindBuffer(34962,n.position),ce.bufferData(34962,e.positionArray,35048),Ne.enableAttribute(i.position),ce.vertexAttribPointer(i.position,3,5126,!1,0,0)),e.hasNormals&&(ce.bindBuffer(34962,n.normal),ce.bufferData(34962,e.normalArray,35048),Ne.enableAttribute(i.normal),ce.vertexAttribPointer(i.normal,3,5126,!1,0,0)),e.hasUvs&&(ce.bindBuffer(34962,n.uv),ce.bufferData(34962,e.uvArray,35048),Ne.enableAttribute(i.uv),ce.vertexAttribPointer(i.uv,2,5126,!1,0,0)),e.hasColors&&(ce.bindBuffer(34962,n.color),ce.bufferData(34962,e.colorArray,35048),Ne.enableAttribute(i.color),ce.vertexAttribPointer(i.color,3,5126,!1,0,0)),Ne.disableUnusedAttributes(),ce.drawArrays(4,0,e.count),e.count=0},this.renderBufferDirect=function(e,n,i,r,o,a){var s=o.isMesh&&o.normalMatrix.determinant()<0;Ne.setMaterial(r,s);var c=_(e,n,r,o),l=!1;me.geometry===i.id&&me.program===c.id&&me.wireframe===(r.wireframe===!0)||(me.geometry=i.id,me.program=c.id,me.wireframe=r.wireframe===!0,l=!0),o.morphTargetInfluences&&(Ze.update(o,i,r,c), -l=!0);var h=i.index,u=i.attributes.position,d=1;r.wireframe===!0&&(h=Ve.getWireframeAttribute(i),d=2);var f,m=Qe;null!==h&&(f=ke.get(h),m=Ke,m.setIndex(f)),l&&(p(r,c,i),null!==h&&ce.bindBuffer(34963,f.buffer));var v=1/0;null!==h?v=h.count:void 0!==u&&(v=u.count);var g=i.drawRange.start*d,y=i.drawRange.count*d,x=null!==a?a.start*d:0,b=null!==a?a.count*d:1/0,w=Math.max(g,x),M=Math.min(v,g+y,x+b)-1,E=Math.max(0,M-w+1);if(0!==E){if(o.isMesh)if(r.wireframe===!0)Ne.setLineWidth(r.wireframeLinewidth*t()),m.setMode(1);else switch(o.drawMode){case Rc:m.setMode(4);break;case Cc:m.setMode(5);break;case Pc:m.setMode(6)}else if(o.isLine){var T=r.linewidth;void 0===T&&(T=1),Ne.setLineWidth(T*t()),o.isLineSegments?m.setMode(1):o.isLineLoop?m.setMode(2):m.setMode(3)}else o.isPoints?m.setMode(0):o.isSprite&&m.setMode(4);i&&i.isInstancedBufferGeometry?i.maxInstancedCount>0&&m.renderInstances(i,w,E):m.render(w,E)}},this.compile=function(e,t){se=Ye.get(e,t),se.init(),e.traverse(function(e){e.isLight&&(se.pushLight(e),e.castShadow&&se.pushShadow(e))}),se.setupLights(t),e.traverse(function(t){if(t.material)if(Array.isArray(t.material))for(var n=0;n=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&ce.readPixels(t,n,i,r,$e.convert(l),$e.convert(h),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&ce.bindFramebuffer(36160,pe)}}},this.copyFramebufferToTexture=function(e,t,n){var i=t.image.width,r=t.image.height,o=$e.convert(t.format);this.setTexture2D(t,0),ce.copyTexImage2D(3553,n||0,o,e.x,e.y,i,r,0)},this.copyTextureToTexture=function(e,t,n,i){var r=t.image.width,o=t.image.height,a=$e.convert(n.format),s=$e.convert(n.type);this.setTexture2D(n,0),t.isDataTexture?ce.texSubImage2D(3553,i||0,e.x,e.y,r,o,a,s,t.image.data):ce.texSubImage2D(3553,i||0,e.x,e.y,a,s,t.image)}}function Pt(e,t){this.name="",this.color=new x(e),this.density=void 0!==t?t:25e-5}function It(e,t,n){this.name="",this.color=new x(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function Ot(){T.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Dt(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function zt(e,t,n,i){this.data=e,this.itemSize=t,this.offset=n,this.normalized=i===!0}function Bt(e){j.call(this),this.type="SpriteMaterial",this.color=new x(16777215),this.map=null,this.rotation=0,this.sizeAttenuation=!0,this.lights=!1,this.transparent=!0,this.setValues(e)}function Ut(e){if(T.call(this),this.type="Sprite",void 0===Lu){Lu=new H;var t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new Dt(t,5);Lu.setIndex([0,1,2,0,2,3]),Lu.addAttribute("position",new zt(i,3,0,(!1))),Lu.addAttribute("uv",new zt(i,2,3,(!1)))}this.geometry=Lu,this.material=void 0!==e?e:new Bt,this.center=new n(.5,.5)}function Nt(){T.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Ht(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),J.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new i,this.bindMatrixInverse=new i}function Ft(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,r=this.bones.length;n=0?(e(y-h,g,p),f.subVectors(d,p)):(e(y+h,g,p),f.subVectors(p,d)),g-h>=0?(e(y,g-h,p),m.subVectors(d,p)):(e(y,g+h,p),m.subVectors(p,d)),u.crossVectors(f,m).normalize(),c.push(u.x,u.y,u.z),l.push(y,g)}}for(i=0;i.9&&o<.1&&(t<.2&&(y[e+0]+=1),n<.2&&(y[e+2]+=1),i<.2&&(y[e+4]+=1))}}function u(e){g.push(e.x,e.y,e.z)}function d(t,n){var i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function p(){for(var e=new o,t=new o,i=new o,r=new o,a=new n,s=new n,c=new n,l=0,h=0;l0)for(o=t;o=t;o-=i)a=kn(o,e[o],e[o+1],a);return a&&Bn(a,a.next)&&(Vn(a),a=a.next),a}function xn(e,t){if(!e)return e;t||(t=e);var n,i=e;do if(n=!1,i.steiner||!Bn(i,i.next)&&0!==zn(i.prev,i,i.next))i=i.next;else{if(Vn(i),i=t=i.prev,i===i.next)break;n=!0}while(n||i!==t);return t}function bn(e,t,n,i,r,o,a){if(e){!a&&o&&Rn(e,i,r,o);for(var s,c,l=e;e.prev!==e.next;)if(s=e.prev,c=e.next,o?Mn(e,i,r,o):wn(e))t.push(s.i/n),t.push(e.i/n),t.push(c.i/n),Vn(e),e=c.next,l=c.next;else if(e=c,e===l){a?1===a?(e=_n(e,t,n),bn(e,t,n,i,r,o,2)):2===a&&En(e,t,n,i,r,o):bn(xn(e),t,n,i,r,o,1);break}}}function wn(e){var t=e.prev,n=e,i=e.next;if(zn(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(On(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&zn(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Mn(e,t,n,i){var r=e.prev,o=e,a=e.next;if(zn(r,o,a)>=0)return!1;for(var s=r.xo.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,h=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,u=Pn(s,c,t,n,i),d=Pn(l,h,t,n,i),p=e.nextZ;p&&p.z<=d;){if(p!==e.prev&&p!==e.next&&On(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&zn(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(p=e.prevZ;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&On(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&zn(p.prev,p,p.next)>=0)return!1;p=p.prevZ}return!0}function _n(e,t,n){var i=e;do{var r=i.prev,o=i.next.next;!Bn(r,o)&&Un(r,i,i.next,o)&&Hn(r,o)&&Hn(o,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(o.i/n),Vn(i),Vn(i.next),i=e=o),i=i.next}while(i!==e);return i}function En(e,t,n,i,r,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Dn(a,s)){var c=Gn(a,s);return a=xn(a,a.next),c=xn(c,c.next),bn(a,t,n,i,r,o),void bn(c,t,n,i,r,o)}s=s.next}a=a.next}while(a!==e)}function Tn(e,t,n,i){var r,o,a,s,c,l=[];for(r=0,o=t.length;r=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>a){if(a=s,s===r){if(o===i.y)return i;if(o===i.next.y)return i.next}n=i.x=i.x&&i.x>=h&&r!==i.x&&On(on.x)&&Hn(i,e)&&(n=i,d=c)),i=i.next;return n}function Rn(e,t,n,i){var r=e;do null===r.z&&(r.z=Pn(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,Cn(r)}function Cn(e){var t,n,i,r,o,a,s,c,l=1;do{for(n=e,e=null,o=null,a=0;n;){for(a++,i=n,s=0,t=0;t0||c>0&&i;)0!==s&&(0===c||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,c--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;n=i}o.nextZ=null,l*=2}while(a>1);return e}function Pn(e,t,n,i,r){return e=32767*(e-n)*r,t=32767*(t-i)*r,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1}function In(e){var t=e,n=e;do t.x=0&&(e-a)*(i-s)-(n-a)*(t-s)>=0&&(n-a)*(o-s)-(r-a)*(i-s)>=0}function Dn(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Nn(e,t)&&Hn(e,t)&&Hn(t,e)&&Fn(e,t)}function zn(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Bn(e,t){return e.x===t.x&&e.y===t.y}function Un(e,t,n,i){return!!(Bn(e,t)&&Bn(n,i)||Bn(e,i)&&Bn(n,t))||zn(e,t,n)>0!=zn(e,t,i)>0&&zn(n,i,e)>0!=zn(n,i,t)>0}function Nn(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&&Un(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Hn(e,t){return zn(e.prev,e,e.next)<0?zn(e,t,e.next)>=0&&zn(e,e.prev,t)>=0:zn(e,t,e.prev)<0||zn(e,e.next,t)<0}function Fn(e,t){var n=e,i=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==e);return i}function Gn(e,t){var n=new jn(e.i,e.x,e.y),i=new jn(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function kn(e,t,n,i){var r=new jn(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Vn(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 jn(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}function Wn(e,t,n,i){for(var r=0,o=t,a=n-i;o2&&e[t-1].equals(e[0])&&e.pop()}function Xn(e,t){for(var n=0;nNumber.EPSILON){var p=Math.sqrt(u),f=Math.sqrt(l*l+h*h),m=t.x-c/p,v=t.y+s/p,g=i.x-h/f,y=i.y+l/f,x=((g-m)*h-(y-v)*l)/(s*h-c*l);r=m+s*x-e.x,o=v+c*x-e.y;var b=r*r+o*o;if(b<=2)return new n(r,o);a=Math.sqrt(b/2)}else{var w=!1;s>Number.EPSILON?l>Number.EPSILON&&(w=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(w=!0):Math.sign(c)===Math.sign(h)&&(w=!0),w?(r=-c,o=s,a=Math.sqrt(u)):(r=s,o=c,a=Math.sqrt(u/2))}return new n(r/a,o/a)}function l(){var e=a.length/3;if(w){var t=0,n=Y*t;for(Q=0;Q=0;){n=Q,i=Q-1,i<0&&(i=e.length-1);var r=0,o=x+2*E;for(r=0;r=0;k--){for(j=k/E,W=M*Math.cos(j*Math.PI/2),V=_*Math.sin(j*Math.PI/2),Q=0,K=G.length;Q0)&&m.push(M,_,T),(l!==n-1||h0&&u(!0),t>0&&u(!1)),this.setIndex(p),this.addAttribute("position",new z(f,3)),this.addAttribute("normal",new z(m,3)),this.addAttribute("uv",new z(v,2))}function ui(e,t,n,i,r,o,a){li.call(this,0,e,t,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function di(e,t,n,i,r,o,a){hi.call(this,0,e,t,n,i,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function pi(e,t,n,i){S.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new fi(e,t,n,i)),this.mergeVertices()}function fi(e,t,i,r){H.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},e=e||1,t=void 0!==t?Math.max(3,t):8,i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI;var a,s,c=[],l=[],h=[],u=[],d=new o,p=new n;for(l.push(0,0,0),h.push(0,0,1),u.push(.5,.5),s=0,a=3;s<=t;s++,a+=3){var f=i+s/t*r;d.x=e*Math.cos(f),d.y=e*Math.sin(f),l.push(d.x,d.y,d.z),h.push(0,0,1),p.x=(l[a]/e+1)/2,p.y=(l[a+1]/e+1)/2,u.push(p.x,p.y)}for(a=1;a<=t;a++)c.push(a,a+1,0);this.setIndex(c),this.addAttribute("position",new z(l,3)),this.addAttribute("normal",new z(h,3)),this.addAttribute("uv",new z(u,2))}function mi(e){j.call(this),this.type="ShadowMaterial",this.color=new x(0),this.transparent=!0,this.setValues(e)}function vi(e){W.call(this,e),this.type="RawShaderMaterial"}function gi(e){j.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new x(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new x(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kc,this.normalScale=new n(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.setValues(e)}function yi(e){gi.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)}function xi(e){j.call(this),this.type="MeshPhongMaterial",this.color=new x(16777215),this.specular=new x(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new x(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kc,this.normalScale=new n(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=rs,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 bi(e){xi.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function wi(e){j.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kc,this.normalScale=new n(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Mi(e){j.call(this),this.type="MeshLambertMaterial",this.color=new x(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new x(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=rs,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 _i(e){j.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new x(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kc,this.normalScale=new n(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.lights=!1,this.setValues(e)}function Ei(e){kt.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}function Ti(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 Si(e,t,n,i){Ti.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Li(e,t,n,i){Ti.call(this,e,t,n,i)}function Ai(e,t,n,i){Ti.call(this,e,t,n,i)}function Ri(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=Ou.convertArray(t,this.TimeBufferType),this.values=Ou.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}function Ci(e,t,n){Ri.call(this,e,t,n)}function Pi(e,t,n,i){Ri.call(this,e,t,n,i)}function Ii(e,t,n,i){Ri.call(this,e,t,n,i)}function Oi(e,t,n,i){Ti.call(this,e,t,n,i)}function Di(e,t,n,i){Ri.call(this,e,t,n,i)}function zi(e,t,n,i){Ri.call(this,e,t,n,i)}function Bi(e,t,n,i){Ri.call(this,e,t,n,i)}function Ui(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=jc.generateUUID(),this.duration<0&&this.resetDuration()}function Ni(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ii;case"vector":case"vector2":case"vector3":case"vector4":return Bi;case"color":return Pi;case"quaternion":return Di;case"bool":case"boolean":return Ci;case"string":return zi}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function Hi(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=Ni(e.type);if(void 0===e.times){var n=[],i=[];Ou.flattenJSON(e.keys,n,i,"value"),e.times=n,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}function Fi(e,t,n){var i=this,r=!1,o=0,a=0,s=void 0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){a++,r===!1&&void 0!==i.onStart&&i.onStart(e,o,a),r=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,a),o===a&&(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}}function Gi(e){this.manager=void 0!==e?e:zu}function ki(e){this.manager=void 0!==e?e:zu}function Vi(e){this.manager=void 0!==e?e:zu,this._parser=null}function ji(e){this.manager=void 0!==e?e:zu,this._parser=null}function Wi(e){this.manager=void 0!==e?e:zu}function qi(e){this.manager=void 0!==e?e:zu}function Xi(e){this.manager=void 0!==e?e:zu}function Yi(){this.type="Curve",this.arcLengthDivisions=200}function Ji(e,t,n,i,r,o,a,s){Yi.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=o||2*Math.PI,this.aClockwise=a||!1,this.aRotation=s||0}function Zi(e,t,n,i,r,o){Ji.call(this,e,t,n,n,i,r,o),this.type="ArcCurve"}function Qi(){function e(e,o,a,s){t=e,n=a,i=-3*e+3*o-2*a-s,r=2*e-2*o+a+s}var t=0,n=0,i=0,r=0;return{initCatmullRom:function(t,n,i,r,o){e(n,i,o*(i-t),o*(r-n))},initNonuniformCatmullRom:function(t,n,i,r,o,a,s){var c=(n-t)/o-(i-t)/(o+a)+(i-n)/a,l=(i-n)/a-(r-n)/(a+s)+(r-i)/s;c*=a,l*=a,e(n,i,c,l)},calc:function(e){var o=e*e,a=o*e;return t+n*e+i*o+r*a}}}function Ki(e,t,n,i){Yi.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=i||.5}function $i(e,t,n,i,r){var o=.5*(i-t),a=.5*(r-n),s=e*e,c=e*s;return(2*n-2*i+o+a)*c+(-3*n+3*i-2*o-a)*s+o*e+n}function er(e,t){var n=1-e;return n*n*t}function tr(e,t){return 2*(1-e)*e*t}function nr(e,t){return e*e*t}function ir(e,t,n,i){return er(e,t)+tr(e,n)+nr(e,i)}function rr(e,t){var n=1-e;return n*n*n*t}function or(e,t){var n=1-e;return 3*n*n*e*t}function ar(e,t){return 3*(1-e)*e*e*t}function sr(e,t){return e*e*e*t}function cr(e,t,n,i,r){return rr(e,t)+or(e,n)+ar(e,i)+sr(e,r)}function lr(e,t,i,r){Yi.call(this),this.type="CubicBezierCurve",this.v0=e||new n,this.v1=t||new n,this.v2=i||new n,this.v3=r||new n}function hr(e,t,n,i){Yi.call(this),this.type="CubicBezierCurve3",this.v0=e||new o,this.v1=t||new o,this.v2=n||new o,this.v3=i||new o}function ur(e,t){Yi.call(this),this.type="LineCurve",this.v1=e||new n,this.v2=t||new n}function dr(e,t){Yi.call(this),this.type="LineCurve3",this.v1=e||new o,this.v2=t||new o}function pr(e,t,i){Yi.call(this),this.type="QuadraticBezierCurve",this.v0=e||new n,this.v1=t||new n,this.v2=i||new n}function fr(e,t,n){Yi.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new o,this.v1=t||new o,this.v2=n||new o}function mr(e){Yi.call(this),this.type="SplineCurve",this.points=e||[]}function vr(){Yi.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function gr(e){vr.call(this),this.type="Path",this.currentPoint=new n,e&&this.setFromPoints(e)}function yr(e){gr.call(this,e),this.uuid=jc.generateUUID(),this.type="Shape",this.holes=[]}function xr(e,t){T.call(this),this.type="Light",this.color=new x(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function br(e,t,n){xr.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(T.DefaultUp),this.updateMatrix(),this.groundColor=new x(t)}function wr(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new n(512,512),this.map=null,this.matrix=new i}function Mr(){wr.call(this,new Tt(50,1,.5,500))}function _r(e,t,n,i,r,o){xr.call(this,e,t),this.type="SpotLight",this.position.copy(T.DefaultUp),this.updateMatrix(),this.target=new T,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!==o?o:1,this.shadow=new Mr}function Er(e,t,n,i){xr.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 wr(new Tt(90,1,.5,500))}function Tr(e,t,n,i,r,o){Et.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==n?n:1,this.bottom=void 0!==i?i:-1,this.near=void 0!==r?r:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()}function Sr(){wr.call(this,new Tr((-5),5,5,(-5),.5,500))}function Lr(e,t){xr.call(this,e,t),this.type="DirectionalLight",this.position.copy(T.DefaultUp),this.updateMatrix(),this.target=new T,this.shadow=new Sr}function Ar(e,t){xr.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function Rr(e,t,n,i){xr.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==i?i:10}function Cr(e){this.manager=void 0!==e?e:zu,this.textures={}}function Pr(e){this.manager=void 0!==e?e:zu}function Ir(e){this.manager=void 0!==e?e:zu,this.resourcePath=""}function Or(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.manager=void 0!==e?e:zu,this.options=void 0}function Dr(){this.type="ShapePath",this.color=new x,this.subPaths=[],this.currentPath=null}function zr(e){this.type="Font",this.data=e}function Br(e,t,n){for(var i=Array.from?Array.from(e):String(e).split(""),r=t/n.resolution,o=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,a=[],s=0,c=0,l=0;l0?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&!function(){Object.assign=function(e){if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n>8&255]+e[t>>16&255]+e[t>>24&255]+"-"+e[255&n]+e[n>>8&255]+"-"+e[n>>16&15|64]+e[n>>24&255]+"-"+e[63&i|128]+e[i>>8&255]+"-"+e[i>>16&255]+e[i>>24&255]+e[255&r]+e[r>>8&255]+e[r>>16&255]+e[r>>24&255];return o.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:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*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())},degToRad:function(e){return e*jc.DEG2RAD},radToDeg:function(e){return e*jc.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))}};Object.defineProperties(n.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(n.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent: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},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add: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)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub: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)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp: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},clampScalar:function(){var e=new n,t=new n;return function(n,i){return e.set(n,n),t.set(i,i),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero: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},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute: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},rotateAround:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*n-o*i+e.x,this.y=r*i+o*n+e.y,this}}),Object.assign(i.prototype,{isMatrix4:!0,set:function(e,t,n,i,r,o,a,s,c,l,h,u,d,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]=o,v[9]=a,v[13]=s,v[2]=c,v[6]=l,v[10]=h,v[14]=u,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new i).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis: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},extractRotation:function(){var e=new o;return function(t){var n=this.elements,i=t.elements,r=1/e.setFromMatrixColumn(t,0).length(),o=1/e.setFromMatrixColumn(t,1).length(),a=1/e.setFromMatrixColumn(t,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[3]=0,n[4]=i[4]*o,n[5]=i[5]*o,n[6]=i[6]*o,n[7]=0,n[8]=i[8]*a,n[9]=i[9]*a,n[10]=i[10]*a,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}}(),makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,i=e.y,r=e.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(i),c=Math.sin(i),l=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){var u=o*l,d=o*h,p=a*l,f=a*h;t[0]=s*l,t[4]=-s*h,t[8]=c,t[1]=d+p*c,t[5]=u-f*c,t[9]=-a*s,t[2]=f-u*c,t[6]=p+d*c,t[10]=o*s}else if("YXZ"===e.order){var m=s*l,v=s*h,g=c*l,y=c*h;t[0]=m+y*a,t[4]=g*a-v,t[8]=o*c,t[1]=o*h,t[5]=o*l,t[9]=-a,t[2]=v*a-g,t[6]=y+m*a,t[10]=o*s}else if("ZXY"===e.order){var m=s*l,v=s*h,g=c*l,y=c*h;t[0]=m-y*a,t[4]=-o*h,t[8]=g+v*a,t[1]=v+g*a,t[5]=o*l,t[9]=y-m*a,t[2]=-o*c,t[6]=a,t[10]=o*s}else if("ZYX"===e.order){var u=o*l,d=o*h,p=a*l,f=a*h;t[0]=s*l,t[4]=p*c-d,t[8]=u*c+f,t[1]=s*h,t[5]=f*c+u,t[9]=d*c-p,t[2]=-c,t[6]=a*s,t[10]=o*s}else if("YZX"===e.order){var x=o*s,b=o*c,w=a*s,M=a*c;t[0]=s*l,t[4]=M-x*h,t[8]=w*h+b,t[1]=h,t[5]=o*l,t[9]=-a*l,t[2]=-c*l,t[6]=b*h+w,t[10]=x-M*h}else if("XZY"===e.order){var x=o*s,b=o*c,w=a*s,M=a*c;t[0]=s*l,t[4]=-h,t[8]=c*l,t[1]=x*h+M,t[5]=o*l,t[9]=b*h-w,t[2]=w*h-b,t[6]=a*l,t[10]=M*h+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(){var e=new o(0,0,0),t=new o(1,1,1);return function(n){return this.compose(e,n,t)}}(),lookAt:function(){var e=new o,t=new o,n=new o;return function(i,r,o){var a=this.elements;return n.subVectors(i,r),0===n.lengthSq()&&(n.z=1),n.normalize(),e.crossVectors(o,n),0===e.lengthSq()&&(1===Math.abs(o.z)?n.x+=1e-4:n.z+=1e-4,n.normalize(),e.crossVectors(o,n)),e.normalize(),t.crossVectors(n,e),a[0]=e.x,a[4]=t.x,a[8]=n.x,a[1]=e.y,a[5]=t.y,a[9]=n.y,a[2]=e.z,a[6]=t.z,a[10]=n.z,this}}(),multiply: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)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[4],s=n[8],c=n[12],l=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],x=n[11],b=n[15],w=i[0],M=i[4],_=i[8],E=i[12],T=i[1],S=i[5],L=i[9],A=i[13],R=i[2],C=i[6],P=i[10],I=i[14],O=i[3],D=i[7],z=i[11],B=i[15];return r[0]=o*w+a*T+s*R+c*O,r[4]=o*M+a*S+s*C+c*D,r[8]=o*_+a*L+s*P+c*z,r[12]=o*E+a*A+s*I+c*B,r[1]=l*w+h*T+u*R+d*O,r[5]=l*M+h*S+u*C+d*D,r[9]=l*_+h*L+u*P+d*z,r[13]=l*E+h*A+u*I+d*B,r[2]=p*w+f*T+m*R+v*O,r[6]=p*M+f*S+m*C+v*D,r[10]=p*_+f*L+m*P+v*z,r[14]=p*E+f*A+m*I+v*B,r[3]=g*w+y*T+x*R+b*O,r[7]=g*M+y*S+x*C+b*D,r[11]=g*_+y*L+x*P+b*z,r[15]=g*E+y*A+x*I+b*B,this},multiplyScalar: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},applyToBufferAttribute:function(){var e=new o;return function(t){for(var n=0,i=t.count;n=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,a=Math.sin(a*b)/x}var w=a*g;if(s=s*m+u*w,c=c*m+d*w,l=l*m+p*w,h=h*m+f*w,m===1-a){var M=1/Math.sqrt(s*s+c*c+l*l+h*h);s*=M,c*=M,l*=M,h*=M}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=h}}),Object.defineProperties(r.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this.onChangeCallback()}}}),Object.assign(r.prototype,{isQuaternion:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler: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,o=e.order,a=Math.cos,s=Math.sin,c=a(n/2),l=a(i/2),h=a(r/2),u=s(n/2),d=s(i/2),p=s(r/2);return"XYZ"===o?(this._x=u*l*h+c*d*p,this._y=c*d*h-u*l*p,this._z=c*l*p+u*d*h,this._w=c*l*h-u*d*p):"YXZ"===o?(this._x=u*l*h+c*d*p,this._y=c*d*h-u*l*p,this._z=c*l*p-u*d*h,this._w=c*l*h+u*d*p):"ZXY"===o?(this._x=u*l*h-c*d*p,this._y=c*d*h+u*l*p,this._z=c*l*p+u*d*h,this._w=c*l*h-u*d*p):"ZYX"===o?(this._x=u*l*h-c*d*p,this._y=c*d*h+u*l*p,this._z=c*l*p-u*d*h,this._w=c*l*h+u*d*p):"YZX"===o?(this._x=u*l*h+c*d*p,this._y=c*d*h+u*l*p,this._z=c*l*p-u*d*h,this._w=c*l*h-u*d*p):"XZY"===o&&(this._x=u*l*h-c*d*p,this._y=c*d*h-u*l*p,this._z=c*l*p+u*d*h,this._w=c*l*h+u*d*p),t!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,i=n[0],r=n[4],o=n[8],a=n[1],s=n[5],c=n[9],l=n[2],h=n[6],u=n[10],d=i+s+u;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(h-c)*t,this._y=(o-l)*t,this._z=(a-r)*t):i>s&&i>u?(t=2*Math.sqrt(1+i-s-u),this._w=(h-c)/t,this._x=.25*t,this._y=(r+a)/t,this._z=(o+l)/t):s>u?(t=2*Math.sqrt(1+s-i-u),this._w=(o-l)/t,this._x=(r+a)/t,this._y=.25*t,this._z=(c+h)/t):(t=2*Math.sqrt(1+u-i-s),this._w=(a-r)/t,this._x=(o+l)/t,this._y=(c+h)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t=new o,n=1e-6;return function(i,r){return void 0===t&&(t=new o),e=i.dot(r)+1,eMath.abs(i.z)?t.set(-i.y,i.x,0):t.set(0,-i.z,i.y)):t.crossVectors(i,r),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),angleTo:function(e){return 2*Math.acos(Math.abs(jc.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},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):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply: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)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,o=e._w,a=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+o*a+i*c-r*s,this._y=i*l+o*s+r*a-n*c,this._z=r*l+o*c+n*s-i*a,this._w=o*l-n*a-i*s-r*c,this.onChangeCallback(),this},slerp: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,o=this._w,a=o*e._w+n*e._x+i*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;var s=1-a*a;if(s<=Number.EPSILON){var c=1-t;return this._w=c*o+t*this._w,this._x=c*n+t*this._x,this._y=c*i+t*this._y,this._z=c*r+t*this._z,this.normalize()}var l=Math.sqrt(s),h=Math.atan2(l,a),u=Math.sin((1-t)*h)/l,d=Math.sin(t*h)/l;return this._w=o*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=r*u+this._z*d,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(o.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent: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},getComponent: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)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add: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)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub: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)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply: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)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e=new r;return function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(e.setFromEuler(t))}}(),applyAxisAngle:function(){var e=new r;return function(t,n){return this.applyQuaternion(e.setFromAxisAngle(t,n))}}(),applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,o=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])*o,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*o,this},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,o=e.y,a=e.z,s=e.w,c=s*t+o*i-a*n,l=s*n+a*t-r*i,h=s*i+r*n-o*t,u=-r*t-o*n-a*i;return this.x=c*s+u*-r+l*-a-h*-o,this.y=l*s+u*-o+h*-r-c*-a,this.z=h*s+u*-a+c*-o-l*-r,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(){var e=new i;return function(t){return this.applyMatrix4(e.getInverse(t.projectionMatrix)).applyMatrix4(t.matrixWorld)}}(),transformDirection:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min: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},max: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},clamp: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},clampScalar:function(){var e=new o,t=new o;return function(n,i){return e.set(n,n,n),t.set(i,i,i),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero: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},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp: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},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross: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)},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,o=t.x,a=t.y,s=t.z;return this.x=i*s-r*a,this.y=r*o-n*s,this.z=n*a-i*o,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(){var e=new o;return function(t){return e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e=new o;return function(t){return this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(jc.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},manhattanDistanceTo:function(e){ -return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords: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},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute: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}}),Object.assign(a.prototype,{isMatrix3:!0,set:function(e,t,n,i,r,o,a,s,c){var l=this.elements;return l[0]=e,l[1]=i,l[2]=a,l[3]=t,l[4]=r,l[5]=s,l[6]=n,l[7]=o,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(){var e=new o;return function(t){for(var n=0,i=t.count;n2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},Xc=0;s.DEFAULT_IMAGE=void 0,s.DEFAULT_MAPPING=ps,s.prototype=Object.assign(Object.create(t.prototype),{constructor:s,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.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=jc.generateUUID()),!t&&void 0===e.images[i.uuid]){var r;if(Array.isArray(i)){r=[];for(var o=0,a=i.length;o1)switch(this.wrapS){case ws:e.x=e.x-Math.floor(e.x);break;case Ms:e.x=e.x<0?0:1;break;case _s: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||e.y>1)switch(this.wrapT){case ws:e.y=e.y-Math.floor(e.y);break;case Ms:e.y=e.y<0?0:1;break;case _s: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(s.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}}),Object.assign(c.prototype,{isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent: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},getComponent: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)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy: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},add: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)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors: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},addScaledVector: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},sub: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)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors: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},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion: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},setAxisAngleFromRotationMatrix:function(e){var t,n,i,r,o=.01,a=.1,s=e.elements,c=s[0],l=s[4],h=s[8],u=s[1],d=s[5],p=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(l-u)y&&g>x?gx?yr&&(r=l),h>o&&(o=h),u>a&&(a=u)}return this.min.set(t,n,i),this.max.set(r,o,a),this},setFromBufferAttribute:function(e){for(var t=+(1/0),n=+(1/0),i=+(1/0),r=-(1/0),o=-(1/0),a=-(1/0),s=0,c=e.count;sr&&(r=l),h>o&&(o=h),u>a&&(a=u)}return this.min.set(t,n,i),this.max.set(r,o,a),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox: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},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new o),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))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:function(){var e=new o;return function(t){return this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(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),e.normal.z>0?(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},intersectsTriangle:function(){function e(e){var r,o;for(r=0,o=e.length-3;r<=o;r+=3){c.fromArray(e,r);var a=h.x*Math.abs(c.x)+h.y*Math.abs(c.y)+h.z*Math.abs(c.z),s=t.dot(c),l=n.dot(c),u=i.dot(c);if(Math.max(-Math.max(s,l,u),Math.min(s,l,u))>a)return!1}return!0}var t=new o,n=new o,i=new o,r=new o,a=new o,s=new o,c=new o,l=new o,h=new o,u=new o;return function(o){if(this.isEmpty())return!1;this.getCenter(l),h.subVectors(this.max,l),t.subVectors(o.a,l),n.subVectors(o.b,l),i.subVectors(o.c,l),r.subVectors(n,t),a.subVectors(i,n),s.subVectors(t,i);var c=[0,-r.z,r.y,0,-a.z,a.y,0,-s.z,s.y,r.z,0,-r.x,a.z,0,-a.x,s.z,0,-s.x,-r.y,r.x,0,-a.y,a.x,0,-s.y,s.x,0];return!!e(c)&&(c=[1,0,0,0,1,0,0,0,1],!!e(c)&&(u.crossVectors(r,a),c=[u.x,u.y,u.z],e(c)))}}(),clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new o),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new o;return function(t){var n=e.copy(t).clamp(this.min,this.max);return n.sub(t).length()}}(),getBoundingSphere:function(){var e=new o;return function(t){return void 0===t&&(console.warn("THREE.Box3: .getBoundingSphere() target is now required"),t=new f),this.getCenter(t.center),t.radius=.5*this.getSize(e).length(),t}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new o,new o,new o,new o,new o,new o,new o,new o];return function(t){return this.isEmpty()?this:(e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(e),this)}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(f.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new p;return function(t,n){var i=this.center;void 0!==n?i.copy(n):e.setFromPoints(t).getCenter(i);for(var r=0,o=0,a=t.length;othis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new p),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}),Object.assign(m.prototype,{set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new o,t=new o;return function(n,i,r){var o=e.subVectors(r,i).cross(t.subVectors(n,i)).normalize();return this.setFromNormalAndCoplanarPoint(o,n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new o),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(){var e=new o;return function(t,n){void 0===n&&(console.warn("THREE.Plane: .intersectLine() target is now required"),n=new o);var i=t.delta(e),r=this.normal.dot(i);if(0!==r){var a=-(t.start.dot(this.normal)+this.constant)/r;if(!(a<0||a>1))return n.copy(i).multiplyScalar(a).add(t.start)}else if(0===this.distanceToPoint(t.start))return n.copy(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new o),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new o,t=new a;return function(n,i){var r=i||t.getNormalMatrix(n),o=this.coplanarPoint(e).applyMatrix4(n),a=this.normal.applyMatrix3(r).normalize();return this.constant=-o.dot(a),this}}(),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),Object.assign(v.prototype,{set:function(e,t,n,i,r,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],c=n[5],l=n[6],h=n[7],u=n[8],d=n[9],p=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(a-i,h-s,f-u,y-m).normalize(),t[1].setComponents(a+i,h+s,f+u,y+m).normalize(),t[2].setComponents(a+r,h+c,f+d,y+v).normalize(),t[3].setComponents(a-r,h-c,f-d,y-v).normalize(),t[4].setComponents(a-o,h-l,f-p,y-g).normalize(),t[5].setComponents(a+o,h+l,f+p,y+g).normalize(),this},intersectsObject:function(){var e=new f;return function(t){var n=t.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),e.copy(n.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSprite:function(){var e=new f;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++){var o=t[r].distanceToPoint(n);if(o0?t.max.x:t.min.x,e.y=r.normal.y>0?t.max.y:t.min.y,e.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(e)<0)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var Yc="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",Jc="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",Zc="#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",Qc="#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( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",Kc="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",$c="vec3 transformed = vec3( position );",el="vec3 objectNormal = vec3( normal );",tl="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}\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 GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, 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_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 GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.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( specularColor, dotNV );\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}",nl="#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",il="#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",rl="#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",ol="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",al="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif",sl="#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",cl="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",ll="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",hl="#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",ul="#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(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}\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};\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}",dl="#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif",pl="vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif",fl="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",ml="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif",vl="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",gl="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",yl="gl_FragColor = linearToOutputTexel( gl_FragColor );",xl="\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 = min( floor( D ) / 255.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}",bl="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, 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_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\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",wl="#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",Ml="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",_l="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\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",El="#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",Tl="#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",Sl="#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\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",Ll="#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",Al="#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif",Rl="#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif",Cl="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",Pl="vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = 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;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\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#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\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#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\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#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\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#endif",Il="uniform vec3 ambientLightColor;\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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\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",Ol="#if defined( USE_ENVMAP ) && defined( PHYSICAL )\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\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 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 blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, 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\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent ));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",Dl="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",zl="varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\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)",Bl="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif",Ul="struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#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#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#endif\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#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\tfloat clearCoatInv = 1.0 - clearCoatDHR;\n\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec3 singleScattering = vec3( 0.0 );\n\t\tvec3 multiScattering = vec3( 0.0 );\n\t\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\t\tvec3 diffuse = material.diffuseColor;\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * singleScattering;\n\t\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\t\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\t#else\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#endif\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\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}",Nl="\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\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#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif",Hl="#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * 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( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif",Fl="#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, irradiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif",Gl="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",kl="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n#endif",Vl="#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",jl="#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif",Wl="#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",ql="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",Xl="#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif",Yl="#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif",Jl="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",Zl="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",Ql="#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif",Kl="#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",$l="#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",eh="#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#endif",th="#ifdef USE_NORMALMAP\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t#ifdef FLIP_SIDED\n\t\t\tnormal = - normal;\n\t\t#endif\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tnormal = normalize( normalMatrix * normal );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",nh="#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tuniform mat3 normalMatrix;\n\t#else\n\t\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\t\tvec2 st0 = dFdx( vUv.st );\n\t\t\tvec2 st1 = dFdy( vUv.st );\n\t\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\t\tvec3 N = normalize( surf_norm );\n\t\t\tmat3 tsn = mat3( S, T, N );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy *= normalScale;\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\treturn normalize( tsn * mapN );\n\t\t}\n\t#endif\n#endif",ih="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}\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}",rh="#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",oh="vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;",ah="#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",sh="#if defined( 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",ch="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",lh="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",hh="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\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\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( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, 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( 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 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\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\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\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 )\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",uh="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif",dh="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif",ph="float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}",fh="#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",mh="#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform 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",vh="#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",gh="#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#endif",yh="float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",xh="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",bh="#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",wh="#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\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}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\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 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",Mh="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",_h="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif",Eh="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",Th="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",Sh="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",Lh="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",Ah="#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif",Rh="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}",Ch="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}",Ph="uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",Ih="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}",Oh="#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \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#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\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}",Dh="#include \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}",zh="#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}",Bh="#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}",Uh="uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",Nh="varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",Hh="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}",Fh="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",Gh="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 \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\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * 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}",kh="#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}",Vh="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 \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\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\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}",jh="#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}",Wh="#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 \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\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}",qh="#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 \nvoid main() {\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}",Xh="#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 \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}",Yh="#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}",Jh="#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\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 \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\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",Zh="#define PHYSICAL\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}",Qh="#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",Kh="#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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#endif\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( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",$h="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}",eu="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 = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\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}",tu="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}",nu="#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",iu="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\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}",ru="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 = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\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}",ou={ -alphamap_fragment:Yc,alphamap_pars_fragment:Jc,alphatest_fragment:Zc,aomap_fragment:Qc,aomap_pars_fragment:Kc,begin_vertex:$c,beginnormal_vertex:el,bsdfs:tl,bumpmap_pars_fragment:nl,clipping_planes_fragment:il,clipping_planes_pars_fragment:rl,clipping_planes_pars_vertex:ol,clipping_planes_vertex:al,color_fragment:sl,color_pars_fragment:cl,color_pars_vertex:ll,color_vertex:hl,common:ul,cube_uv_reflection_fragment:dl,defaultnormal_vertex:pl,displacementmap_pars_vertex:fl,displacementmap_vertex:ml,emissivemap_fragment:vl,emissivemap_pars_fragment:gl,encodings_fragment:yl,encodings_pars_fragment:xl,envmap_fragment:bl,envmap_pars_fragment:wl,envmap_pars_vertex:Ml,envmap_physical_pars_fragment:Ol,envmap_vertex:_l,fog_vertex:El,fog_pars_vertex:Tl,fog_fragment:Sl,fog_pars_fragment:Ll,gradientmap_pars_fragment:Al,lightmap_fragment:Rl,lightmap_pars_fragment:Cl,lights_lambert_vertex:Pl,lights_pars_begin:Il,lights_phong_fragment:Dl,lights_phong_pars_fragment:zl,lights_physical_fragment:Bl,lights_physical_pars_fragment:Ul,lights_fragment_begin:Nl,lights_fragment_maps:Hl,lights_fragment_end:Fl,logdepthbuf_fragment:Gl,logdepthbuf_pars_fragment:kl,logdepthbuf_pars_vertex:Vl,logdepthbuf_vertex:jl,map_fragment:Wl,map_pars_fragment:ql,map_particle_fragment:Xl,map_particle_pars_fragment:Yl,metalnessmap_fragment:Jl,metalnessmap_pars_fragment:Zl,morphnormal_vertex:Ql,morphtarget_pars_vertex:Kl,morphtarget_vertex:$l,normal_fragment_begin:eh,normal_fragment_maps:th,normalmap_pars_fragment:nh,packing:ih,premultiplied_alpha_fragment:rh,project_vertex:oh,dithering_fragment:ah,dithering_pars_fragment:sh,roughnessmap_fragment:ch,roughnessmap_pars_fragment:lh,shadowmap_pars_fragment:hh,shadowmap_pars_vertex:uh,shadowmap_vertex:dh,shadowmask_pars_fragment:ph,skinbase_vertex:fh,skinning_pars_vertex:mh,skinning_vertex:vh,skinnormal_vertex:gh,specularmap_fragment:yh,specularmap_pars_fragment:xh,tonemapping_fragment:bh,tonemapping_pars_fragment:wh,uv_pars_fragment:Mh,uv_pars_vertex:_h,uv_vertex:Eh,uv2_pars_fragment:Th,uv2_pars_vertex:Sh,uv2_vertex:Lh,worldpos_vertex:Ah,background_frag:Rh,background_vert:Ch,cube_frag:Ph,cube_vert:Ih,depth_frag:Oh,depth_vert:Dh,distanceRGBA_frag:zh,distanceRGBA_vert:Bh,equirect_frag:Uh,equirect_vert:Nh,linedashed_frag:Hh,linedashed_vert:Fh,meshbasic_frag:Gh,meshbasic_vert:kh,meshlambert_frag:Vh,meshlambert_vert:jh,meshmatcap_frag:Wh,meshmatcap_vert:qh,meshphong_frag:Xh,meshphong_vert:Yh,meshphysical_frag:Jh,meshphysical_vert:Zh,normal_frag:Qh,normal_vert:Kh,points_frag:$h,points_vert:eu,shadow_frag:tu,shadow_vert:nu,sprite_frag:iu,sprite_vert:ru},au={clone:g,merge:y},su={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};Object.assign(x.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex: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},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(){function e(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}return function(t,n,i){if(t=jc.euclideanModulo(t,1),n=jc.clamp(n,0,1),i=jc.clamp(i,0,1),0===n)this.r=this.g=this.b=i;else{var r=i<=.5?i*(1+n):i+n-i*n,o=2*i-r;this.r=e(o,r,t+1/3),this.g=e(o,r,t),this.b=e(o,r,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[1],o=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(a,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l=n[1],h=l.length;if(3===h)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}if(e&&e.length>0){var l=su[e];void 0!==l?this.setHex(l):console.warn("THREE.Color: Unknown color "+e)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(){function e(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}return function(t){return this.r=e(t.r),this.g=e(t.g),this.b=e(t.b),this}}(),copyLinearToSRGB:function(){function e(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}return function(t){return this.r=e(t.r),this.g=e(t.g),this.b=e(t.b),this}}(),convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,i=this.r,r=this.g,o=this.b,a=Math.max(i,r,o),s=Math.min(i,r,o),c=(s+a)/2;if(s===a)t=0,n=0;else{var l=a-s;switch(n=c<=.5?l/(a+s):l/(2-a-s),a){case i:t=(r-o)/l+(r1){for(var t=0;t1){for(var t=0;t0){o.children=[];for(var c=0;c0&&(r.geometries=d),p.length>0&&(r.materials=p),f.length>0&&(r.textures=f),m.length>0&&(r.images=m),s.length>0&&(r.shapes=s)}return r.object=o,r},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),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)),t===!0)for(var n=0;n0)for(var d=0;d0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,i,r;for(n=0,i=this.faces.length;n=0;n--){var m=p[n];for(this.faces.splice(m,1),a=0,s=this.faceVertexUvs.length;a0,M=g.vertexNormals.length>0,_=1!==g.color.r||1!==g.color.g||1!==g.color.b,E=g.vertexColors.length>0,T=0;if(T=e(T,0,0),T=e(T,1,y),T=e(T,2,x),T=e(T,3,b),T=e(T,4,w),T=e(T,5,M),T=e(T,6,_),T=e(T,7,E),h.push(T),h.push(g.a,g.b,g.c),h.push(g.materialIndex),b){var S=this.faceVertexUvs[0][c];h.push(i(S[0]),i(S[1]),i(S[2]))}if(w&&h.push(t(g.normal)),M){var L=g.vertexNormals;h.push(t(L[0]),t(L[1]),t(L[2]))}if(_&&h.push(n(g.color)),E){var A=g.vertexColors;h.push(n(A[0]),n(A[1]),n(A[2]))}}return r.data={},r.data.vertices=s,r.data.normals=u,p.length>0&&(r.data.colors=p),m.length>0&&(r.data.uvs=[m]),r.data.faces=h,r},clone:function(){return(new S).copy(this)},copy:function(e){var t,n,i,r,o,a;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;var s=e.vertices;for(t=0,n=s.length;t0,s=o[1]&&o[1].length>0,c=e.morphTargets,l=c.length;if(l>0){t=[];for(var h=0;h0){u=[];for(var h=0;h0&&0===i.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(var h=0;h65535?D:I)(e,1):this.index=e},addAttribute:function(e,t){return t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):(this.attributes[e]=t,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(e,new L(arguments[1],arguments[2])))},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var i=(new a).getNormalMatrix(e);i.applyToBufferAttribute(n),n.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e=new i;return function(t){return e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e=new i;return function(t){return e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e=new i;return function(t){return e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e=new i;return function(t,n,i){return e.makeTranslation(t,n,i),this.applyMatrix(e),this}}(),scale:function(){var e=new i;return function(t,n,i){return e.makeScale(t,n,i),this.applyMatrix(e),this}}(),lookAt:function(){var e=new T;return function(t){e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){var e=new o;return function(){return this.computeBoundingBox(),this.boundingBox.getCenter(e).negate(),this.translate(e.x,e.y,e.z),this}}(),setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new z(3*t.vertices.length,3),i=new z(3*t.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(t.vertices)),this.addAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new z(t.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,i=e.length;n0){var n=new Float32Array(3*e.normals.length);this.addAttribute("normal",new L(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.addAttribute("color",new L(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new L(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var o=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new L(o,2).copyVector2sArray(e.uvs2))}this.groups=e.groups;for(var a in e.morphTargets){for(var s=[],c=e.morphTargets[a],l=0,h=c.length;l0){var p=new z(4*e.skinIndices.length,4);this.addAttribute("skinIndex",p.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new z(4*e.skinWeights.length,4);this.addAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return 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 p);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):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(){var e=new p,t=new o;return function(){null===this.boundingSphere&&(this.boundingSphere=new f);var n=this.attributes.position;if(n){var i=this.boundingSphere.center;e.setFromBufferAttribute(n),e.getCenter(i);for(var r=0,o=0,a=n.count;o0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;if(null!==i){var r=Array.prototype.slice.call(i.array);e.data.index={type:i.array.constructor.name,array:r}}var o=this.attributes;for(var n in o){var a=o[n],r=Array.prototype.slice.call(a.array);e.data.attributes[n]={itemSize:a.itemSize,type:a.array.constructor.name,array:r,normalized:a.normalized}}var s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),e},clone:function(){return(new H).copy(this)},copy:function(e){var t,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var o=e.attributes;for(t in o){var a=o[t];this.addAttribute(t,a.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(n=0,i=l.length;n0&&(i.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),this.morphTargets===!0&&(i.morphTargets=!0),this.skinning===!0&&(i.skinning=!0),this.visible===!1&&(i.visible=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),n){var r=t(e.textures),o=t(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,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.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.userData=JSON.parse(JSON.stringify(e.userData)),this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.shadowSide=e.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),W.prototype=Object.create(j.prototype),W.prototype.constructor=W,W.prototype.isShaderMaterial=!0,W.prototype.copy=function(e){return j.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=g(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=e.extensions,this},W.prototype.toJSON=function(e){var t=j.prototype.toJSON.call(this,e);t.uniforms={};for(var n in this.uniforms){var i=this.uniforms[n],r=i.value;r&&r.isTexture?t.uniforms[n]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:"m4",value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var o={};for(var a in this.extensions)this.extensions[a]===!0&&(o[a]=!0);return Object.keys(o).length>0&&(t.extensions=o),t},Object.assign(q.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new o),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(){var e=new o;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new o),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new o;return function(t){var n=e.subVectors(t,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(n).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new o,t=new o,n=new o;return function(i,r,o,a){e.copy(i).add(r).multiplyScalar(.5),t.copy(r).sub(i).normalize(),n.copy(this.origin).sub(e);var s,c,l,h,u=.5*i.distanceTo(r),d=-this.direction.dot(t),p=n.dot(this.direction),f=-n.dot(t),m=n.lengthSq(),v=Math.abs(1-d*d);if(v>0)if(s=d*f-p,c=d*p-f,h=u*v,s>=0)if(c>=-h)if(c<=h){var g=1/v;s*=g,c*=g,l=s*(s+d*c+2*p)+c*(d*s+c+2*f)+m}else c=u,s=Math.max(0,-(d*c+p)),l=-s*s+c*(c+2*f)+m;else c=-u,s=Math.max(0,-(d*c+p)),l=-s*s+c*(c+2*f)+m;else c<=-h?(s=Math.max(0,-(-d*u+p)),c=s>0?-u:Math.min(Math.max(-u,-f),u),l=-s*s+c*(c+2*f)+m):c<=h?(s=0,c=Math.min(Math.max(-u,-f),u),l=c*(c+2*f)+m):(s=Math.max(0,-(d*u+p)),c=s>0?u:Math.min(Math.max(-u,-f),u),l=-s*s+c*(c+2*f)+m);else c=d>0?-u:u,s=Math.max(0,-(d*c+p)), -l=-s*s+c*(c+2*f)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(t).multiplyScalar(c).add(e),l}}(),intersectSphere:function(){var e=new o;return function(t,n){e.subVectors(t.center,this.origin);var i=e.dot(this.direction),r=e.dot(e)-i*i,o=t.radius*t.radius;if(r>o)return null;var a=Math.sqrt(o-r),s=i-a,c=i+a;return s<0&&c<0?null:s<0?this.at(c,n):this.at(s,n)}}(),intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var n=e.normal.dot(this.direction);return n*t<0},intersectBox:function(e,t){var n,i,r,o,a,s,c=1/this.direction.x,l=1/this.direction.y,h=1/this.direction.z,u=this.origin;return c>=0?(n=(e.min.x-u.x)*c,i=(e.max.x-u.x)*c):(n=(e.max.x-u.x)*c,i=(e.min.x-u.x)*c),l>=0?(r=(e.min.y-u.y)*l,o=(e.max.y-u.y)*l):(r=(e.max.y-u.y)*l,o=(e.min.y-u.y)*l),n>o||r>i?null:((r>n||n!==n)&&(n=r),(o=0?(a=(e.min.z-u.z)*h,s=(e.max.z-u.z)*h):(a=(e.max.z-u.z)*h,s=(e.min.z-u.z)*h),n>s||a>i?null:((a>n||n!==n)&&(n=a),(s=0?n:i,t)))},intersectsBox:function(){var e=new o;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new o,t=new o,n=new o,i=new o;return function(r,o,a,s,c){t.subVectors(o,r),n.subVectors(a,r),i.crossVectors(t,n);var l,h=this.direction.dot(i);if(h>0){if(s)return null;l=1}else{if(!(h<0))return null;l=-1,h=-h}e.subVectors(this.origin,r);var u=l*this.direction.dot(n.crossVectors(e,n));if(u<0)return null;var d=l*this.direction.dot(t.cross(e));if(d<0)return null;if(u+d>h)return null;var p=-l*e.dot(i);return p<0?null:this.at(p/h,c)}}(),applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),Object.assign(X,{getNormal:function(){var e=new o;return function(t,n,i,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new o),r.subVectors(i,n),e.subVectors(t,n),r.cross(e);var a=r.lengthSq();return a>0?r.multiplyScalar(1/Math.sqrt(a)):r.set(0,0,0)}}(),getBarycoord:function(){var e=new o,t=new o,n=new o;return function(i,r,a,s,c){e.subVectors(s,r),t.subVectors(a,r),n.subVectors(i,r);var l=e.dot(e),h=e.dot(t),u=e.dot(n),d=t.dot(t),p=t.dot(n),f=l*d-h*h;if(void 0===c&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),c=new o),0===f)return c.set(-2,-1,-1);var m=1/f,v=(d*u-h*p)*m,g=(l*p-h*u)*m;return c.set(1-v-g,g,v)}}(),containsPoint:function(){var e=new o;return function(t,n,i,r){return X.getBarycoord(t,n,i,r,e),e.x>=0&&e.y>=0&&e.x+e.y<=1}}(),getUV:function(){var e=new o;return function(t,n,i,r,o,a,s,c){return this.getBarycoord(t,n,i,r,e),c.set(0,0),c.addScaledVector(o,e.x),c.addScaledVector(a,e.y),c.addScaledVector(s,e.z),c}}()}),Object.assign(X.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){var e=new o,t=new o;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new o),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return X.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new o),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return X.getBarycoord(e,this.a,this.b,this.c,t)},containsPoint:function(e){return X.containsPoint(e,this.a,this.b,this.c)},getUV:function(e,t,n,i,r){return X.getUV(e,this.a,this.b,this.c,t,n,i,r)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(){var e=new o,t=new o,n=new o,i=new o,r=new o,a=new o;return function(s,c){void 0===c&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),c=new o);var l,h,u=this.a,d=this.b,p=this.c;e.subVectors(d,u),t.subVectors(p,u),i.subVectors(s,u);var f=e.dot(i),m=t.dot(i);if(f<=0&&m<=0)return c.copy(u);r.subVectors(s,d);var v=e.dot(r),g=t.dot(r);if(v>=0&&g<=v)return c.copy(d);var y=f*g-v*m;if(y<=0&&f>=0&&v<=0)return l=f/(f-v),c.copy(u).addScaledVector(e,l);a.subVectors(s,p);var x=e.dot(a),b=t.dot(a);if(b>=0&&x<=b)return c.copy(p);var w=x*m-f*b;if(w<=0&&m>=0&&b<=0)return h=m/(m-b),c.copy(u).addScaledVector(t,h);var M=v*b-x*g;if(M<=0&&g-v>=0&&x-b>=0)return n.subVectors(p,d),h=(g-v)/(g-v+(x-b)),c.copy(d).addScaledVector(n,h);var _=1/(M+w+y);return l=w*_,h=y*_,c.copy(u).addScaledVector(e,l).addScaledVector(t,h)}}(),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}),Y.prototype=Object.create(j.prototype),Y.prototype.constructor=Y,Y.prototype.isMeshBasicMaterial=!0,Y.prototype.copy=function(e){return j.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},J.prototype=Object.assign(Object.create(T.prototype),{constructor:J,isMesh:!0,setDrawMode:function(e){this.drawMode=e},copy:function(e){return T.prototype.copy.call(this,e),this.drawMode=e.drawMode,void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,o=Object.keys(r);if(o.length>0){var a=r[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(){function e(e,t,n,i,r,o,a,s){var c;if(c=t.side===wa?i.intersectTriangle(a,o,r,!0,s):i.intersectTriangle(r,o,a,t.side!==Ma,s),null===c)return null;x.copy(s),x.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(x);return ln.far?null:{distance:l,point:x.clone(),object:e}}function t(t,i,r,o,a,s,u,d,p){c.fromBufferAttribute(a,u),l.fromBufferAttribute(a,d),h.fromBufferAttribute(a,p);var f=e(t,i,r,o,c,l,h,y);if(f){s&&(m.fromBufferAttribute(s,u),v.fromBufferAttribute(s,d),g.fromBufferAttribute(s,p),f.uv=X.getUV(y,c,l,h,m,v,g,new n));var x=new M(u,d,p);X.getNormal(c,l,h,x.normal),f.face=x}return f}var r=new i,a=new q,s=new f,c=new o,l=new o,h=new o,u=new o,d=new o,p=new o,m=new n,v=new n,g=new n,y=new o,x=new o;return function(i,o){var f=this.geometry,x=this.material,b=this.matrixWorld;if(void 0!==x&&(null===f.boundingSphere&&f.computeBoundingSphere(),s.copy(f.boundingSphere),s.applyMatrix4(b),i.ray.intersectsSphere(s)!==!1&&(r.getInverse(b),a.copy(i.ray).applyMatrix4(r),null===f.boundingBox||a.intersectsBox(f.boundingBox)!==!1))){var w;if(f.isBufferGeometry){var M,_,E,T,S,L,A,R,C,P,I,O=f.index,D=f.attributes.position,z=f.attributes.uv,B=f.groups,U=f.drawRange;if(null!==O)if(Array.isArray(x))for(T=0,L=B.length;T0&&(G=W);for(var q=0,Y=j.length;qi.far||o.push({distance:x,point:t.clone(),uv:X.getUV(t,h,u,d,p,f,m,new n),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return T.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}}),Nt.prototype=Object.assign(Object.create(T.prototype),{constructor:Nt,copy:function(e){T.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n1){e.setFromMatrixPosition(n.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var r=e.distanceTo(t);i[0].object.visible=!0;for(var o=1,a=i.length;o=i[o].distance;o++)i[o-1].object.visible=!1,i[o].object.visible=!0;for(;oh)){f.applyMatrix4(this.matrixWorld);var T=i.ray.origin.distanceTo(f);Ti.far||r.push({distance:T,point:p.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else for(var b=0,w=y.length/3-1;bh)){f.applyMatrix4(this.matrixWorld);var T=i.ray.origin.distanceTo(f);Ti.far||r.push({distance:T,point:p.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}else if(s.isGeometry)for(var S=s.vertices,L=S.length,b=0;bh)){f.applyMatrix4(this.matrixWorld);var T=i.ray.origin.distanceTo(f);Ti.far||r.push({distance:T,point:p.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}}}(),copy:function(e){return T.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),jt.prototype=Object.assign(Object.create(Vt.prototype),{constructor:jt,isLineSegments:!0,computeLineDistances:function(){var e=new o,t=new o;return function(){var n=this.geometry;if(n.isBufferGeometry)if(null===n.index){for(var i=n.attributes.position,r=[],o=0,a=i.count;oi.far)return;r.push({distance:a,distanceToRay:Math.sqrt(o),point:f.clone(),index:n,face:null,object:s})}}var s=this,c=this.geometry,l=this.matrixWorld,h=i.params.Points.threshold;if(null===c.boundingSphere&&c.computeBoundingSphere(),n.copy(c.boundingSphere),n.applyMatrix4(l),n.radius+=h,i.ray.intersectsSphere(n)!==!1){e.getInverse(l),t.copy(i.ray).applyMatrix4(e);var u=h/((this.scale.x+this.scale.y+this.scale.z)/3),d=u*u,p=new o,f=new o;if(c.isBufferGeometry){var m=c.index,v=c.attributes,g=v.position.array;if(null!==m)for(var y=m.array,x=0,b=y.length;x=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Jt.prototype=Object.create(s.prototype),Jt.prototype.constructor=Jt,Jt.prototype.isCompressedTexture=!0,Zt.prototype=Object.create(s.prototype),Zt.prototype.constructor=Zt,Zt.prototype.isCanvasTexture=!0,Qt.prototype=Object.create(s.prototype),Qt.prototype.constructor=Qt,Qt.prototype.isDepthTexture=!0,Kt.prototype=Object.create(H.prototype),Kt.prototype.constructor=Kt,$t.prototype=Object.create(S.prototype),$t.prototype.constructor=$t,en.prototype=Object.create(H.prototype),en.prototype.constructor=en,tn.prototype=Object.create(S.prototype),tn.prototype.constructor=tn,nn.prototype=Object.create(H.prototype),nn.prototype.constructor=nn,rn.prototype=Object.create(S.prototype),rn.prototype.constructor=rn,on.prototype=Object.create(nn.prototype),on.prototype.constructor=on,an.prototype=Object.create(S.prototype),an.prototype.constructor=an,sn.prototype=Object.create(nn.prototype),sn.prototype.constructor=sn,cn.prototype=Object.create(S.prototype),cn.prototype.constructor=cn,ln.prototype=Object.create(nn.prototype),ln.prototype.constructor=ln,hn.prototype=Object.create(S.prototype),hn.prototype.constructor=hn,un.prototype=Object.create(nn.prototype),un.prototype.constructor=un,dn.prototype=Object.create(S.prototype),dn.prototype.constructor=dn,pn.prototype=Object.create(H.prototype),pn.prototype.constructor=pn,fn.prototype=Object.create(S.prototype),fn.prototype.constructor=fn,mn.prototype=Object.create(H.prototype),mn.prototype.constructor=mn,vn.prototype=Object.create(S.prototype),vn.prototype.constructor=vn,gn.prototype=Object.create(H.prototype),gn.prototype.constructor=gn;var Au={triangulate:function(e,t,n){n=n||2;var i=t&&t.length,r=i?t[0]*n:e.length,o=yn(e,0,r,n,!0),a=[];if(!o)return a;var s,c,l,h,u,d,p;if(i&&(o=Tn(e,t,o,n)),e.length>80*n){s=l=e[0],c=h=e[1];for(var f=n;fl&&(l=u),d>h&&(h=d);p=Math.max(l-s,h-c),p=0!==p?1/p:0}return bn(o,a,n,s,c,p),a}},Ru={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r=r)break e;var s=t[1];e=r)break t}o=n,n=0}}for(;n>>1;et;)--o;if(++o,0!==r||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);var a=this.getValueSize();this.times=Ou.arraySlice(n,r,o),this.values=Ou.arraySlice(this.values,r*a,o*a)}return 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 o=null,a=0;a!==r;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),e=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,s,o),e=!1;break}o=s}if(void 0!==i&&Ou.isTypedArray(i))for(var a=0,c=i.length;a!==c;++a){var l=i[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),i=this.getInterpolation()===Tc,r=1,o=e.length-1,a=1;a0){e[r]=e[o];for(var m=o*n,v=r*n,p=0;p!==n;++p)t[v+p]=t[m+p];++r}return r!==e.length&&(this.times=Ou.arraySlice(e,0,r),this.values=Ou.arraySlice(t,0,r*n)),this},clone:function(){var e=Ou.arraySlice(this.times,0),t=Ou.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}),Ci.prototype=Object.assign(Object.create(Ri.prototype),{constructor:Ci,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:_c,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Pi.prototype=Object.assign(Object.create(Ri.prototype),{constructor:Pi,ValueTypeName:"color"}),Ii.prototype=Object.assign(Object.create(Ri.prototype),{constructor:Ii,ValueTypeName:"number"}),Oi.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Oi,interpolate_:function(e,t,n,i){for(var o=this.resultBuffer,a=this.sampleValues,s=this.valueSize,c=e*s,l=(n-t)/(i-t),h=c+s;c!==h;c+=4)r.slerpFlat(o,0,a,c-s,a,c,l);return o}}),Di.prototype=Object.assign(Object.create(Ri.prototype),{constructor:Di,ValueTypeName:"quaternion",DefaultInterpolation:Ec,InterpolantFactoryMethodLinear:function(e){return new Oi(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),zi.prototype=Object.assign(Object.create(Ri.prototype),{constructor:zi,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:_c,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Bi.prototype=Object.assign(Object.create(Ri.prototype),{constructor:Bi,ValueTypeName:"vector"}),Object.assign(Ui,{parse:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,o=n.length;r!==o;++r)t.push(Hi(n[r]).scale(i));return new Ui(e.name,e.duration,t)},toJSON:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid},r=0,o=n.length;r!==o;++r)t.push(Ri.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(e,t,n,i){for(var r=t.length,o=[],a=0;a1){var l=c[1],h=i[l];h||(i[l]=h=[]),h.push(s)}}var u=[];for(var l in i)u.push(Ui.CreateFromMorphTargetSequence(l,i[l],t,n));return u},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){if(0!==n.length){var o=[],a=[];Ou.flattenJSON(n,o,a,i),0!==o.length&&r.push(new e(t,o,a))}},i=[],r=e.name||"default",o=e.length||-1,a=e.fps||30,s=e.hierarchy||[],c=0;c0||0===e.search(/^data\:image\/jpeg/);r.format=i?Vs:js,r.needsUpdate=!0,void 0!==t&&t(r)},n,i),r},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Yi.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var 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=[],r=this.getPoint(0),o=0;for(i.push(0),n=1;n<=e;n++)t=this.getPoint(n/e),o+=t.distanceTo(r),i.push(o),r=t;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,i=this.getLengths(),r=0,o=i.length;n=t?t:e*i[o-1];for(var a,s=0,c=o-1;s<=c;)if(r=Math.floor(s+(c-s)/2),a=i[r]-n,a<0)s=r+1;else{if(!(a>0)){c=r;break}c=r-1}if(r=c,i[r]===n)return r/(o-1);var l=i[r],h=i[r+1],u=h-l,d=(n-l)/u,p=(r+d)/(o-1);return p},getTangent:function(e){var t=1e-4,n=e-t,i=e+t;n<0&&(n=0),i>1&&(i=1);var r=this.getPoint(n),o=this.getPoint(i),a=o.clone().sub(r);return a.normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,r,a,s=new o,c=[],l=[],h=[],u=new o,d=new i;for(n=0;n<=e;n++)r=n/e,c[n]=this.getTangentAt(r),c[n].normalize();l[0]=new o,h[0]=new o;var p=Number.MAX_VALUE,f=Math.abs(c[0].x),m=Math.abs(c[0].y),v=Math.abs(c[0].z);for(f<=p&&(p=f,s.set(1,0,0)),m<=p&&(p=m,s.set(0,1,0)),v<=p&&s.set(0,0,1),u.crossVectors(c[0],s).normalize(),l[0].crossVectors(c[0],u),h[0].crossVectors(c[0],l[0]),n=1;n<=e;n++)l[n]=l[n-1].clone(),h[n]=h[n-1].clone(),u.crossVectors(c[n-1],c[n]),u.length()>Number.EPSILON&&(u.normalize(),a=Math.acos(jc.clamp(c[n-1].dot(c[n]),-1,1)),l[n].applyMatrix4(d.makeRotationAxis(u,a))),h[n].crossVectors(c[n],l[n]);if(t===!0)for(a=Math.acos(jc.clamp(l[0].dot(l[e]),-1,1)),a/=e,c[0].dot(u.crossVectors(l[0],l[e]))>0&&(a=-a),n=1;n<=e;n++)l[n].applyMatrix4(d.makeRotationAxis(c[n],a*n)),h[n].crossVectors(c[n],l[n]);return{tangents:c,normals:l,binormals:h}},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}}),Ji.prototype=Object.create(Yi.prototype),Ji.prototype.constructor=Ji,Ji.prototype.isEllipseCurve=!0,Ji.prototype.getPoint=function(e,t){for(var i=t||new n,r=2*Math.PI,o=this.aEndAngle-this.aStartAngle,a=Math.abs(o)r;)o-=r;o0?0:(Math.floor(Math.abs(s)/r)+1)*r:0===c&&s===r-1&&(s=r-2,c=1);var l,h,u,d;if(this.closed||s>0?l=i[(s-1)%r]:(Uu.subVectors(i[0],i[1]).add(i[0]),l=Uu),h=i[s%r],u=i[(s+1)%r],this.closed||s+2r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return i.set($i(s,c.x,l.x,h.x,u.x),$i(s,c.y,l.y,h.y,u.y)),i},mr.prototype.copy=function(e){Yi.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t=t){var r=n[i]-t,o=this.curves[i],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}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;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){Yi.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var h=c.getPoint(1);this.currentPoint.copy(h)},copy:function(e){return vr.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=vr.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return vr.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),yr.prototype=Object.assign(Object.create(gr.prototype),{constructor:yr,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;n0){var o=new Fi(t),a=new Wi(o);a.setCrossOrigin(this.crossOrigin);for(var s=0,c=e.length;s0?new Ht(a,s):new J(a,s),void 0!==e.drawMode&&o.setDrawMode(e.drawMode);break;case"LOD":o=new Nt;break;case"Line":o=new Vt(i(e.geometry),r(e.material),e.mode);break;case"LineLoop":o=new Wt(i(e.geometry),r(e.material));break;case"LineSegments":o=new jt(i(e.geometry),r(e.material));break;case"PointCloud":case"Points":o=new Xt(i(e.geometry),r(e.material));break;case"Sprite":o=new Ut(r(e.material));break;case"Group":o=new _t;break;default:o=new T}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.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 c=e.children,l=0;lNumber.EPSILON){if(l<0&&(a=t[o],c=-c,s=t[r],l=-l),e.ys.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var h=l*(e.x-a.x)-c*(e.y-a.y);if(0===h)return!0;if(h<0)continue;i=!i}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return i}var r=Ru.isClockWise,o=this.subPaths;if(0===o.length)return[];if(t===!0)return n(o);var a,s,c,l=[];if(1===o.length)return s=o[0],c=new yr,c.curves=s.curves,l.push(c),l;var h=!r(o[0].getPoints());h=e?!h:h;var u,d=[],p=[],f=[],m=0;p[m]=void 0,f[m]=[];for(var v=0,g=o.length;v1){for(var y=!1,x=[],b=0,w=p.length;b0&&(y||(f=d))}for(var L,v=0,A=p.length;v0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var o=0;o!==r;++o)e[t+o]=e[n+o]},_slerp:function(e,t,n,i){r.slerpFlat(e,t,e,t,e,n,i)},_lerp:function(e,t,n,i,r){for(var o=1-i,a=0;a!==r;++a){var s=t+a;e[s]=e[s]*o+e[n+a]*i}}});var Ju="\\[\\]\\.:\\/";Object.assign(Jr.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.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(Zr,{Composite:Jr,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Zr.Composite(e,t,n):new Zr(e,t,n)},sanitizeNodeName:function(){var e=new RegExp("["+Ju+"]","g");return function(t){return t.replace(/\s/g,"_").replace(e,"")}}(),parseTrackName:function(){var e="[^"+Ju+"]",t="[^"+Ju.replace("\\.","")+"]",n=/((?:WC+[\/:])*)/.source.replace("WC",e),i=/(WCOD+)?/.source.replace("WCOD",t),r=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",e),o=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",e),a=new RegExp("^"+n+i+r+o+"$"),s=["material","materials","bones"];return function(e){var t=a.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&&i!==-1){var r=n.nodeName.substring(i+1);s.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}}(),findNode:function(e,t){if(!t||""===t||"root"===t||"."===t||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var i=function(e){for(var n=0;n=t){var h=t++,u=e[h];n[u.uuid]=l,e[l]=u,n[c]=h,e[h]=s;for(var d=0,p=r;d!==p;++d){var f=i[d],m=f[h],v=f[l];f[l]=m,f[h]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,o=r.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],l=c.uuid,h=i[l];if(void 0!==h)if(delete i[l],h0)for(var c=this._interpolants,l=this._propertyBindings,h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulate(i,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,i=this.loop,r=this._loopCount,o=i===Mc;if(0===e)return r===-1?t:o&&1===(1&r)?n-t:t;if(i===bc){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),t>=n||t<0){var a=Math.floor(t/n);t-=n*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1===(1&r))return this.time=t,n-t}return this.time=t,t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=Lc,i.endingEnd=Lc):(e?i.endingStart=this.zeroSlopeAtStart?Lc:Sc:i.endingStart=Ac,t?i.endingEnd=this.zeroSlopeAtEnd?Lc:Sc:i.endingEnd=Ac)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=t,a[1]=r+e,s[1]=n,this}}),$r.prototype=Object.assign(Object.create(t.prototype),{constructor:$r,_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,o=e._propertyBindings,a=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var h=0;h!==r;++h){var u=i[h],d=u.name,p=l[d];if(void 0!==p)o[h]=p;else{if(p=o[h],void 0!==p){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[h].binding.parsedPath;p=new Yr(Zr.create(n,d,f),u.ValueTypeName,u.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,s,d),o[h]=p}a[h].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var 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,o=0,a=r.length;o!==a;++o){var s=r[o];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){var t=e._cacheIndex;return null!==t&&tthis.max.x||e.ythis.max.y)},containsBox: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},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new n),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new n),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new n;return function(t){var n=e.copy(t).clamp(this.min,this.max);return n.sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(ho.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new o),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new o),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new o),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new o,t=new o;return function(n,i){e.subVectors(n,this.start),t.subVectors(this.end,this.start);var r=t.dot(t),o=t.dot(e),a=o/r;return i&&(a=jc.clamp(a,0,1)),a}}(),closestPointToPoint:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new o),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),uo.prototype=Object.create(T.prototype),uo.prototype.constructor=uo,uo.prototype.isImmediateRenderObject=!0,po.prototype=Object.create(jt.prototype),po.prototype.constructor=po,po.prototype.update=function(){var e=new o,t=new o,n=new a;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,c=a.faces,l=0,h=0,u=c.length;h1&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)}},yo.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()},xo.prototype=Object.create(T.prototype),xo.prototype.constructor=xo,xo.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},xo.prototype.update=function(){var e=new o,t=new x,n=new x;return function(){var i=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var r=i.geometry.getAttribute("color");t.copy(this.light.color),n.copy(this.light.groundColor);for(var o=0,a=r.count;o.99999?this.quaternion.set(0,0,0,1):n.y<-.99999?this.quaternion.set(1,0,0,0):(t.set(n.z,0,-n.x).normalize(),e=Math.acos(n.y),this.quaternion.setFromAxisAngle(t,e))}}(),Ao.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},Ao.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},Ao.prototype.copy=function(e){return T.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},Ao.prototype.clone=function(){return(new this.constructor).copy(this)},Ro.prototype=Object.create(jt.prototype),Ro.prototype.constructor=Ro;var Ku=0,$u=1;Yi.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Yi.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(vr.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new S,n=0,i=e.length;n=-1&&e.z<=1&&(y=s(),y.id=t.id,y.x=e.x*i,y.y=e.y*i,y.z=e.z,y.renderOrder=t.renderOrder,y.object=t,y.rotation=t.rotation,y.scale.x=t.scale.x*Math.abs(y.x-(e.x+n.projectionMatrix.elements[0])/(e.w+n.projectionMatrix.elements[12])),y.scale.y=t.scale.y*Math.abs(y.y-(e.y+n.projectionMatrix.elements[5])/(e.w+n.projectionMatrix.elements[13])),y.material=t.material,P.elements.push(y))}function i(){if(u===M){var e=new THREE.RenderableObject;return w.push(e),M++,u++,e}return w[u++]}function r(){if(p===E){var e=new THREE.RenderableVertex;return _.push(e),E++,p++,e}return _[p++]}function o(){if(m===S){var e=new THREE.RenderableFace;return T.push(e),S++,m++,e}return T[m++]}function a(){if(g===A){var e=new THREE.RenderableLine;return L.push(e),A++,g++,e}return L[g++]}function s(){if(x===C){var e=new THREE.RenderableSprite;return R.push(e),C++,x++,e}return R[x++]}function c(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id!==t.id?e.id-t.id:0}function l(e,t){var n=0,i=1,r=e.z+e.w,o=t.z+t.w,a=-e.z+e.w,s=-t.z+t.w;return r>=0&&o>=0&&a>=0&&s>=0||!(r<0&&o<0||a<0&&s<0)&&(r<0?n=Math.max(n,r/(r-o)):o<0&&(i=Math.min(i,r/(r-o))),a<0?n=Math.max(n,a/(a-s)):s<0&&(i=Math.min(i,a/(a-s))),!(i=-1&&i.x<=1&&i.y>=-1&&i.y<=1&&i.z>=-1&&i.z<=1}function n(e,n,i){d=r(),d.position.set(e,n,i),t(d)}function i(e,t,n){g.push(e,t,n)}function s(e,t,n){y.push(e,t,n)}function c(e,t){x.push(e,t)}function h(e,t,n){return e.visible===!0||t.visible===!0||n.visible===!0||(B[0]=e.positionScreen,B[1]=t.positionScreen,B[2]=n.positionScreen,D.intersectsBox(z.setFromPoints(B)))}function u(e,t,n){return(n.positionScreen.x-e.positionScreen.x)*(t.positionScreen.y-e.positionScreen.y)-(n.positionScreen.y-e.positionScreen.y)*(t.positionScreen.x-e.positionScreen.x)<0}function p(e,t){var n=_[e],i=_[t];n.positionScreen.copy(n.position).applyMatrix4(H),i.positionScreen.copy(i.position).applyMatrix4(H),l(n.positionScreen,i.positionScreen)===!0&&(n.positionScreen.multiplyScalar(1/n.positionScreen.w),i.positionScreen.multiplyScalar(1/i.positionScreen.w),v=a(),v.id=w.id,v.v1.copy(n),v.v2.copy(i),v.z=Math.max(n.positionScreen.z,i.positionScreen.z),v.renderOrder=w.renderOrder,v.material=w.material,w.material.vertexColors===THREE.VertexColors&&(v.vertexColors[0].fromArray(y,3*e),v.vertexColors[1].fromArray(y,3*t)),P.elements.push(v))}function m(e,t,n,i){var r=_[e],a=_[t],s=_[n];if(h(r,a,s)!==!1&&(i.side===THREE.DoubleSide||u(r,a,s)===!0)){f=o(),f.id=w.id,f.v1.copy(r),f.v2.copy(a),f.v3.copy(s),f.z=(r.positionScreen.z+a.positionScreen.z+s.positionScreen.z)/3,f.renderOrder=w.renderOrder,I.subVectors(s.position,a.position),O.subVectors(r.position,a.position),I.cross(O),f.normalModel.copy(I),f.normalModel.applyMatrix3(E).normalize();for(var c=0;c<3;c++){var l=f.vertexNormalsModel[c];l.fromArray(g,3*arguments[c]),l.applyMatrix3(E).normalize();var d=f.uvs[c];d.fromArray(x,2*arguments[c])}f.vertexNormalsLength=3,f.material=i,i.vertexColors!==THREE.FaceColors&&i.vertexColors!==THREE.VertexColors||f.color.fromArray(y,3*e),P.elements.push(f)}}var g=[],y=[],x=[],w=null,M=null,E=new THREE.Matrix3;return{setObject:e,projectVertex:t,checkTriangleVisibility:h,checkBackfaceCulling:u,pushVertex:n,pushNormal:i,pushColor:s,pushUv:c,pushLine:p,pushTriangle:m}},W=new j;this.projectScene=function(t,i,s,h){m=0,g=0,x=0,P.elements.length=0,t.autoUpdate===!0&&t.updateMatrixWorld(),null===i.parent&&i.updateMatrixWorld(),U.copy(i.matrixWorldInverse),N.multiplyMatrices(i.projectionMatrix,U),G.setFromMatrix(N),u=0,P.objects.length=0,P.lights.length=0,e(t),s===!0&&P.objects.sort(c);for(var d=P.objects,y=0,w=d.length;y0)for(var ne=0;ne0)for(var ne=0;ne0||(ve=_[p-2],k.copy(me.positionScreen),V.copy(ve.positionScreen),l(k,V)===!0&&(k.multiplyScalar(1/k.w),V.multiplyScalar(1/V.w),v=a(),v.id=M.id,v.v1.positionScreen.copy(k),v.v2.positionScreen.copy(V),v.z=Math.max(k.z,V.z),v.renderOrder=M.renderOrder,v.material=M.material,M.material.vertexColors===THREE.VertexColors&&(v.vertexColors[0].copy(M.geometry.colors[se]),v.vertexColors[1].copy(M.geometry.colors[se-1])),P.elements.push(v)))}}else if(M instanceof THREE.Points){if(H.multiplyMatrices(N,b),E instanceof THREE.Geometry)for(var re=M.geometry.vertices,se=0,ce=re.length;se-this.size&&this.y>-this.size&&this.xwindow.innerWidth-e?t="left":this.xwindow.innerHeight-e&&(t="top"),"top"==t||"bottom"==t?(this.titleDomElement.style.marginTop="",this.titleDomElement.style.marginLeft=-(this.titleDomElement.clientWidth/2-this.size/2)+"px"):(this.titleDomElement.style.marginLeft="",this.titleDomElement.style.marginTop=-(this.titleDomElement.children[0].clientHeight/2-this.size/2)+"px"),this.titleDomElement.className="title "+t}},UI.Marker.prototype.setVisible=function(e){this.visible!=e&&(this.domElement.style.visibility=e?"visible":"hidden",this.visible=e)},UI.Marker.prototype.setIcon=function(e){e&&(this.icon=e,this.buttonDomElement.className="button",this.buttonDomElement.classList.add(e))},UI.Marker.prototype.remove=function(){this.domElement.parentNode.removeChild(this.domElement)},UI.Slider=function(e){for(this.frame=0,this.domElement=e,this.popupId=this.domElement.parentNode.id,this.images=this.domElement.getElementsByTagName("img"),this.length=this.images.length,this.tape=document.createElement("div"),this.tape.className="tape";this.images.length;)this.tape.appendChild(this.images[0]);if(this.images=this.tape.getElementsByTagName("img"),this.prevButton=new this.SliderButton(this,"prev"),this.nextButton=new this.SliderButton(this,"next"),Tour.options.sliderBullets){this.bulletsElement=document.createElement("div"),this.bulletsElement.classList.add("bullets"),this.domElement.appendChild(this.bulletsElement);for(var t=0;t100&&(this.tape.style.height=n+"px"),this.prevButton.setVisible(this.frame>0),this.nextButton.setVisible(this.frame=1?"add":"remove"]("hidden"),this.progressValue.style.width=100*Math.min(e,1)+"%")},UI.controlPanel.setOrientation=function(e){var t=e-45,n="";t<0&&t>-90?n="portrait-primary":t>90&&t<180?n="portrait-secondary":t<-90&&t>-180?n="landscape-primary":t>0&&t<90&&(n="landscape-secondary"),this.domElement&&this.domElement.setAttribute("data-orientation",n)},UI.devCursor={},UI.devCursor.init=function(e){if(e){var t=document.createElement("div");t.classList.add("dev-cursor"),document.body.appendChild(t)}},UI.mouseMenu={},UI.mouseMenu.init=function(){this.domElement=document.createElement("div"),this.domElement.id="mouse-menu",this.domElement.addEventListener("selectstart",function(){event.preventDefault()}),document.body.appendChild(this.domElement),document.addEventListener("contextmenu",function(e){e.preventDefault(),UI.mouseMenu.open(e)}),this.domElement.addEventListener("mousedown",function(e){e.stopPropagation()}),document.addEventListener("mousedown",function(){this.close()}.bind(this)),window.addEventListener("blur",function(){this.close()}.bind(this))},UI.mouseMenu.setPosition=function(e,t){this.domElement.style.left=e+"px",this.domElement.style.top=t+"px"},UI.mouseMenu.open=function(e){if(this.domElement.classList.add("visible"),e){var t=5,n=e.clientX,i=e.clientY+t,r=UI.mouseMenu.domElement.clientHeight,o=UI.mouseMenu.domElement.clientWidth;e.clientX+o>window.innerWidth&&(n=Math.max(0,e.clientX-o)),e.clientY+r>window.innerHeight&&(i=Math.max(0,e.clientY-r+t)),this.setPosition(n,i)}},UI.mouseMenu.close=function(){this.domElement.classList.remove("visible")},UI.mouseMenu.Item=function(e,t,n){this.titleElement=document.createElement("span"),this.titleElement.classList.add("title"),this.titleElement.textContent=t,this.action=e,this.keyElement=document.createElement("span"),this.keyElement.classList.add("key"),this.keyElement.textContent=n||"",this.domElement=document.createElement("div"),this.domElement.classList.add("item"),this.disabled=!1,this.domElement.appendChild(this.titleElement),this.domElement.appendChild(this.keyElement);var i=function(e){e.stopPropagation(),e.preventDefault(),!this.disabled&&this.action&&(this.action(),UI.mouseMenu.close())};this.domElement.addEventListener("click",i.bind(this)),this.domElement.addEventListener("contextmenu",i.bind(this)),UI.mouseMenu.domElement.appendChild(this.domElement)},UI.mouseMenu.Item.prototype.setDisable=function(e){this.disabled=e,this.domElement.classList[e?"add":"remove"]("disabled")},UI.mouseMenu.Item.prototype.setVisible=function(e){this.visible=e,this.domElement.classList[e?"remove":"add"]("hidden")},UI.mouseMenu.Item.prototype.setText=function(e,t){e&&(this.titleElement.textContent=e),t&&(this.keyElement.textContent=t)},UI.mouseMenu.Hr=function(){this.domElement=document.createElement("hr"),UI.mouseMenu.domElement.appendChild(this.domElement)},UI.notification={init:function(){this.domElement=document.createElement("div"),this.domElement.id="notification",this.textDomElement=document.createElement("span"),this.domElement.appendChild(this.textDomElement),document.body.appendChild(this.domElement),this.setVisible(!1)},setVisible:function(e){e?(this.domElement.classList.add("visible"),this.domElement.classList.remove("hidden")):(this.setTimeout&&clearTimeout(this.setTimeout),this.domElement.classList.remove("visible"),this.setTimeout=setTimeout(function(){this.domElement.classList.add("hidden")}.bind(this),300))},setText:function(e){this.textDomElement.textContent=e},show:function(e,t){this.setText(e),this.setVisible(!0),this.setTimeout&&clearTimeout(this.setTimeout),t!==!1&&(this.setTimeout=setTimeout(function(){this.setVisible(!1)}.bind(this),t||2e3))}},UI.popUp={init:function(){this.domElement=document.querySelector(".popup-layout"),this.domElement&&(this.domElement.addEventListener("click",function(e){e.target==this.domElement&&this.set()}.bind(this)),this.closeElement=document.querySelector(".popup-layout .close"),this.closeElement.addEventListener("click",this.set.bind(this,!1)),window.addEventListener("hashchange",this.popstate.bind(this)),this.popstate())},set:function(e){var t=!!~Object.keys(window.parent.location).indexOf("host");if(t)var n=window.parent.scrollY,i=window.parent.scrollX;window.location.hash=e||"",t&&setTimeout(function(){window.parent.scrollTo(i,n)},0),setTimeout(function(){window.scroll(0,0)},0)},popstate:function(){var e=window.location.hash.length>1;this.domElement.classList[e?"add":"remove"]("visible")}},Tools.copyDirectionMarker=function(e,t){console.info("Pano id:",Tour.view.id);var n=JSON.stringify({lat:t||parseFloat(Tour.view.lat.value.toFixed(2)),lon:parseFloat(Tour.view.lon.value.toFixed(2)),icon:Tools.point.icon,action:{type:"panorama",id:e}},null,"");Tour.controls.copyText(n)},Tools.copyInfoMarker=function(e,t){console.info("Pano id:",Tour.view.id);var n={lat:parseFloat(Tour.view.lat.value.toFixed(2)),lon:parseFloat(Tour.view.lon.value.toFixed(2))};e&&(n.title=e),t&&(n.action={type:"popup",id:t});var i=JSON.stringify(n,null,"");Tour.controls.copyText(i)},Tools.copyMarker=function(){"info"==this.point.icon?this.copyInfoMarker(prompt("Enter title for info marker","title"),prompt("Enter popup id","")):this.copyDirectionMarker(prompt("Enter pano id",Tour.view.id))},Tools.init=function(){this.setPoint(),window.addEventListener("keydown",function(e){switch(e.keyCode){case 13:Tools.copyMarker();break;case 49:Tools.copyLon();break;case 50:Tools.meshEditor()}}),new UI.mouseMenu.Hr,new UI.mouseMenu.Item(Tools.copyLon,"Copy lon","1"),new UI.mouseMenu.Item(Tools.meshEditor,"Mesh editor","2"),this.meshEditor(),Tour.view.fov.min=5,Tour.view.fov.max=130},Tools.copyLon=function(){Tour.controls.copyText(parseFloat(Tour.view.get().lon.toFixed(2)))},Tools.meshEditor=function(){function e(e){var t=new THREE.Vector2;t.x=e.clientX/window.innerWidth*2-1,t.y=2*-(e.clientY/window.innerHeight)+1;var n=new THREE.Raycaster;n.setFromCamera(t,Tour.camera);var i=n.intersectObjects(Tour.meshs);Tour.meshs.forEach(function(e){e.material.color&&e.material.color.set(16777215),e.material.opacity=1}),Tools.selectedMesh=!1;for(var r=0;r1e-5?(this.value-=(this.value-this.follow)/this.speed,Tour.emmit("moveview")):this.value=this.follow},Tour.Transition.prototype.toString=function(){return parseFloat((this.limit?this.follow%this.limit:this.follow).toFixed(2))},Tour.Video=function(e){this.videoElement=document.createElement("video"),this.videoElement.src=e.src,this.videoElement.loop=e.loop||!0,this.videoElement.muted=e.muted||!0;var t=this,n=function(){t.videoElement.duration&&t.needsUpdate&&(t.videoElement.currentTime=Date.now()/1e3%t.videoElement.duration)};e.sync&&(clearTimeout(this.syncTimeout),Tour.on("changeView",function(){t.syncTimeout=setTimeout(n,2e3)}),this.syncInterval=setInterval(n,1e4)),this.videoElement.pause(),this.canvas=document.createElement("canvas"),this.canvas.width=Math.pow(2,Math.ceil(Math.log(e.width)/Math.log(2))),this.canvas.height=Math.pow(2,Math.ceil(Math.log(e.height)/Math.log(2))),this.ctx=this.canvas.getContext("2d"),this.texture=new THREE.Texture(this.canvas),this.texture.repeat.x=e.width/this.canvas.width,this.texture.repeat.y=e.height/this.canvas.height,this.texture.offset.y=1-this.texture.repeat.y,this.texture.needsUpdate=!0,this.needsUpdate=!1,this.material=new THREE.MeshBasicMaterial({map:this.texture,transparent:!0})},Tour.Video.prototype.draw=function(){this.needsUpdate?(this.videoElement.play(),"css"!=Tour.options.rendererType&&this.ctx.drawImage(this.videoElement,0,0),this.texture.needsUpdate=!0,Tour.needsUpdate=!0):this.videoElement.pause()},Tour.addEventListeners=function(){var e={passive:!1};this.renderer.domElement.addEventListener("dblclick",Tour.controls.fullscreen.bind(this),e),this.renderer.domElement.addEventListener("mousedown",Tour.mouseEvents.down.bind(this),e),this.renderer.domElement.addEventListener("touchstart",Tour.mouseEvents.down.bind(this),e),this.renderer.domElement.addEventListener("mousewheel",Tour.mouseEvents.wheel.bind(this),e),this.renderer.domElement.addEventListener("wheel",Tour.mouseEvents.wheel.bind(this),e),this.renderer.domElement.addEventListener("gesturestart",Tour.mouseEvents.gesturestart.bind(this),e),this.renderer.domElement.addEventListener("gesturechange",Tour.mouseEvents.gesturechange.bind(this),e),document.addEventListener("mousemove",Tour.mouseEvents.move.bind(this),e),document.addEventListener("touchmove",Tour.mouseEvents.move.bind(this),e),document.addEventListener("mouseup",Tour.mouseEvents.up.bind(this),e),document.addEventListener("touchend",Tour.mouseEvents.up.bind(this),e),document.addEventListener("fullscreenchange",Tour.fullscreenEvents.change,e),document.addEventListener("webkitfullscreenchange",Tour.fullscreenEvents.change,e),document.addEventListener("mozfullscreenchange",Tour.fullscreenEvents.change,e),document.addEventListener("MSFullscreenChange",Tour.fullscreenEvents.change,e),window.addEventListener("keydown",Tour.keyEvents.down.bind(this)),window.addEventListener("resize",this.resize.bind(this),e),window.addEventListener("popstate",Tour.history.onpopstate)},Tour.animate=function(){requestAnimationFrame(Tour.animate.bind(this)),this.view.rotation.auto?(Math.abs(this.view.rotation.lon)1e-5||Math.abs(Tour.view.rotation.lon)>1e-5)&&Tour.emmit("moveview")),this.view.lat.move(this.view.rotation.lat,!0),this.view.lon.move(this.view.rotation.lon,!0);var e=THREE.Math.degToRad(90-this.view.lat.value),t=THREE.Math.degToRad(-this.view.lon.value),n=new THREE.Vector3;//! Вынести! +n.x=Math.sin(e)*Math.cos(t),n.y=Math.cos(e),n.z=Math.sin(e)*Math.sin(t),window.isSecureContext&&this.orientationControls.controls.enabled?this.orientationControls.controls.update():this.camera.lookAt(n),this.camera.fov=this.view.fov.value,this.camera.updateProjectionMatrix();for(var i in this.view)"object"==typeof this.view[i]&&this.view[i].animate();Tour.emmit("animate"),this.render()},Tour.backgroundImage={},Tour.backgroundImage.init=function(){var e=document.createElement("div");e.className="background-image__wrapper",this.domElement=new Image,this.domElement.id="background-image",this.domElement.addEventListener("dragstart",function(e){e.preventDefault()},!1),e.appendChild(this.domElement),document.body.appendChild(e),"css"!=Tour.options.rendererType&&document.body.classList.add("transition-zoomin-start")},Tour.backgroundImage.set=function(e,t,n){t&&(document.body.style.backgroundColor=t,Tour.renderer.setClearColor(new THREE.Color(t),1)),e?this.domElement.decode?(this.domElement.src=e,this.domElement.decode().then(n)):(this.domElement.onload=n,this.domElement.src=e):n&&n()},Tour.backgroundImage.getUrl=function(e){var t="image/jpeg",n=.5;Tour.mesh.material[0].map.image?Tour.renderer.domElement.toBlob?Tour.renderer.domElement.toBlob(function(t){e(URL.createObjectURL(t))},t,n):Tour.renderer.domElement&&e(Tour.renderer.domElement.toDataURL(t,n)):e(Tour.data.backgroundImage)},Tour.backgroundImage.transitionStart=function(e,t){this.zoom=t;var n=function(){Tour.data.backgroundImage=!1,document.body.classList.add(t?"transition-zoomin-start":"transition-fadein-start"),document.body.classList.remove("transition-zoomin-end"),document.body.classList.remove("transition-fadein-end"),e&&e()};"css"!=Tour.options.rendererType&&Tour.options.transition?this.getUrl(function(e){this.set(e,Tour.data.backgroundColor,n)}.bind(this)):n()},Tour.backgroundImage.transitionEnd=function(){document.body.classList.add(Tour.backgroundImage.zoom?"transition-zoomin-end":"transition-fadein-end"),document.body.classList.remove("transition-zoomin-start"),document.body.classList.remove("transition-fadein-start")},Tour.controls={back:function(){window.history.back()},forward:function(){window.history.forward()},next:function(){Tour.view.go(1)},previous:function(){Tour.view.go(-1)},opennewtab:function(){window.open(location.href,"_blank")},fullscreen:function(){var e;document.fullscreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement||document.mozFullScreenElemenz?(e=document,e.exitFullscreen?e.exitFullscreen():e.msExitFullscreen?e.msExitFullscreen():e.webkitCancelFullScreen?e.webkitCancelFullScreen():e.mozCancelFullScreen&&e.mozCancelFullScreen(),screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock()):(e=document.documentElement,e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.webkitRequestFullScreen?e.webkitRequestFullScreen():e.mozRequestFullScreen&&e.mozRequestFullScreen(),screen.orientation&&screen.orientation.lock&&screen.orientation.lock(screen.orientation.type)["catch"](function(){}))},visitSite:function(){window.open("http://tour-360.ru","_blank")},download:function(){function e(e){var t=document.createElement("a");t.href=e,t.download=document.title+".jpg",t.dispatchEvent(new MouseEvent("click"))}var t="image/jpeg",n=.95;Tour.renderer.domElement.toBlob?Tour.renderer.domElement.toBlob(function(t){e(URL.createObjectURL(t))},t,n):Tour.renderer.domElement&&e(Tour.renderer.domElement.toDataURL(t,n))},autoRotate:function(e){clearInterval(this.autorotateTimeout),e?(e===!0&&(e=Tour.options.autorotationTimeout),e&&(this.autorotateTimeout=setTimeout(this.autoRotate.bind(this),e))):0===e||e===!1?Tour.view.rotation.auto=!1:void 0===e&&(Tour.view.rotation.auto=!Tour.view.rotation.auto)},reload:function(){location.reload(!0)},toggleMenu:function(){var e=UI.controlPanel;if(e.setVisible(!e.visibility),Tour.toggleMenuItem){var t=Lang.get("mousemenu."+(e.visibility?"hide":"show")+"menu");Tour.toggleMenuItem.setText(t)}},stopRotate:function(){Tour.view.rotation.auto=!1,Tour.view.rotation.lat=Tour.view.rotation.lon=0},zoomIn:function(){Tour.view.fov.move(-10),Tour.history.set()},zoomOut:function(){Tour.view.fov.move(10),Tour.history.set()},moveUp:function(){Tour.controls.stopRotate(),Tour.view.lat.move(30),Tour.history.set()},moveDown:function(){Tour.controls.stopRotate(),Tour.view.lat.move(-30),Tour.history.set()},moveRight:function(){Tour.controls.stopRotate(),Tour.view.lon.move(-22.5),Tour.history.set()},moveLeft:function(){Tour.controls.stopRotate(),Tour.view.lon.move(22.5),Tour.history.set()},toggleControls:function(){if(window.isSecureContext){var e=Tour.orientationControls.controls;e.enabled?e.disconnect():e.connect()}},getCode:function(){var e=["accelerometer","autoplay","gyroscope"],t='';Tour.controls.copyText(t)},copyText:function(e){var t=function(t){if(t)UI.notification.show(Lang.get("notification.successfully-copied"));else{var n=BrouserInfo.apple?"⌘":"Ctrl";window.prompt(Lang.get("notification.embed-code").replace("*",n+"+C"),e)}};if(document.execCommand){var n=document.createElement("span");n.textContent=e,document.body.appendChild(n);var i=document.createRange();i.selectNode(n),window.getSelection().removeAllRanges(),window.getSelection().addRange(i),t(document.execCommand("copy")),window.getSelection().removeAllRanges(),document.body.removeChild(n)}else window.clipboardData?(window.clipboardData.setData("Text",e),t(!0)):t(!1)},editor:function(){Tools.init()},suport:function(){},help:function(e){e.preventDefault();var t="Помощь-в-пользовании-плеером-виртуальных-туров";window.open("http://github.com/Tour-360/tour-player/wiki/"+t,"_blank")},badBrowser:function(){},closeWindow:function(){UI.popUp.set()}},Tour.createScene=function(){if(this.setRenderer(Tour.options.rendererType,Tour.options.imageType),document.body.appendChild(this.renderer.domElement),this.scene=new THREE.Scene,this.camera=new THREE.PerspectiveCamera,"css"==Tour.options.rendererType){var e=[[[-1,0,0],[0,.5,0]],[[1,0,0],[0,-.5,0]],[[0,1,0],[.5,0,1]],[[0,-1,0],[-.5,0,1]],[[0,0,1],[0,1,0]],[[0,0,-1],[0,0,0]]],t=function(e){return this*e};this.mesh=new THREE.Object3D;for(var n=0;n20&&(this.cineticLon=this.cineticLat=0);else{var t=Tour.view.fov.value/Tour.options.initFov/Tour.options.mouseSensitivity;this.cineticLon=(e.clientX-this.previousEvent.clientX)*t,this.cineticLat=(e.clientY-this.previousEvent.clientY)*t}this.previousEvent=e},Tour.mouseEvents._touches2mouse=function(e){e.touches&&e.touches.length&&(e.clientX=e.touches[0].pageX*window.devicePixelRatio,e.clientY=e.touches[0].pageY*window.devicePixelRatio,e.defaultPrevented&&e.preventDefault())},Tour.mouseEvents.wheel=function(e){var t=!(window.parent&&window.parent==window);this.options.scaleControl&&(this.options.iFrameScaleControl||!t)&&e.composed&&e.deltaY&&(this.controls.autoRotate(!1),e.defaultPrevented&&e.preventDefault(),this.view.fov.move(e.deltaY*(e.deltaMode?10/3:.1)),clearTimeout(this.mouseEvents.zoomTimeout),this.mouseEvents.zoomTimeout=setTimeout(function(){Tour.history.set()},300))},Tour.mouseEvents.down=function(e){return(!this.options.touchScroll||"touchstart"!=e.type)&&(2==e.which?(e.preventDefault(),!1):(this.mouseEvents._touches2mouse(e),this.mouseEvents.drag=!0,this.controls.autoRotate(!1),this.mouseEvents.previousEvent=e,void Tour.emmit("touchstart")))},Tour.mouseEvents.move=function(e){if(this.mouseEvents.drag&&(!e.touches||this.options.touchDrag)){this.mouseEvents._touches2mouse(e);var t=4.5/(Math.PI/Math.tan(Tour.view.fov.value/180*Math.PI/2))/Tour.options.mouseSensitivity;this.view.lon.set(this.view.lon.value+(e.clientX-this.mouseEvents.previousEvent.clientX)*t),this.view.lat.set(this.view.lat.value+(e.clientY-this.mouseEvents.previousEvent.clientY)*t),this.mouseEvents._setCinetic(e),Tour.emmit("touchmove")}},Tour.mouseEvents.up=function(e){this.mouseEvents.drag&&(this.mouseEvents._touches2mouse(e),this.mouseEvents._setCinetic(e),this.view.rotation.lat=this.mouseEvents.cineticLat,this.view.rotation.lon=this.mouseEvents.cineticLon,this.history.set(),Tour.emmit("touchend")),this.mouseEvents.cineticLon=this.mouseEvents.cineticLat=0,this.mouseEvents.drag=!1},Tour.mouseEvents.gesturestart=function(e){this.mouseEvents.startFov=Tour.view.fov.value,e.preventDefault()},Tour.mouseEvents.gesturechange=function(e){function t(e){return e/180*Math.PI}function n(e){return e/Math.PI*180}var i=1/(Math.PI/Math.tan(t(this.mouseEvents.startFov)/2));Tour.view.fov.set(n(2*Math.atan(i/e.scale/1*Math.PI))),e.preventDefault()},Tour.options={},Tour.options.set=function(e){if("object"==typeof e)for(var t in e)this[t]=e[t]},Object.defineProperty(Tour.options,"set",{enumerable:!1}),Tour.orientationControls={init:function(){window.isSecureContext&&(this.controls=new THREE.DeviceOrientationControls(Tour.camera),this.controls.disconnect(),window.addEventListener("deviceorientation",this.detectDevice))},detectDevice:function(e){e.alpha&&UI.controlPanel.addBtn("rotate",Tour.controls.toggleControls,""),window.removeEventListener("deviceorientation",Tour.orientationControls.detectDevice)}},Tour.query={},Tour.query.list={},Tour.query.get=function(){for(var e=location.search.slice(1).split("&"),t=0;t1&&this.sliders.push(new UI.Slider(e[t]))},Tour.setTexture=function(e){UI.controlPanel.setProgress(0),this.loadingManager&&this.loadingManager.abort(),this.loadingManager=new Tour.LoadingManager,this.loadingManager.onprogress=function(e){UI.controlPanel.setProgress(e.progress)},this.loadingManager.onerror=function(){UI.notification.show(Lang.get("notification.error-load-pano"))};var t=new THREE.ImageLoader;t.load(this.options.path+e+"/thumbnail/0.jpg",function(t){this.backgroundImage.transitionEnd();var n=document.createElement("canvas");n.width=t.width,n.height=t.height;var i=n.getContext("2d");i.drawImage(t,0,0);for(var r=this.detectFaceInCamera(),o=0;o<6;o++){var a=this.options.tileset[o],s=this.options.path+e+"/"+this.options.imageType+"/"+a+".jpg",c=i.getImageData(a*t.height,0,t.height,t.height);if("css"==this.options.rendererType){var l=document.createElement("canvas");l.width=l.height=t.height;var h=l.getContext("2d");h.putImageData(c,0,0),this.mesh.children[o].element.src=l.toDataURL("image/jpeg")}else{var u=new THREE.Texture(c);u.needsUpdate=!0,this.needsUpdate=!0,this.mesh.material[o].map="canvas"!=this.options.rendererType?u:c}setTimeout(function(e,t,n){this.setPlane(e,t,n)}.bind(this,o,s,this.loadingManager),100-r[o])}}.bind(this),void 0,function(){UI.notification.show(Lang.get("notification.error-load-pano"))})},Tour.setVideos=function(e){if(this.videos={},e)for(var t=0;t0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function r(e,t,o,a,s,c,l,h,u,d){Object.defineProperty(this,"id",{value:Ih++}),this.uuid=Ah.generateUUID(),this.name="",this.image=void 0!==e?e:r.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:r.DEFAULT_MAPPING,this.wrapS=void 0!==o?o:cc,this.wrapT=void 0!==a?a:cc,this.magFilter=void 0!==s?s:mc,this.minFilter=void 0!==c?c:yc,this.anisotropy=void 0!==u?u:1,this.format=void 0!==l?l:Dc,this.internalFormat=null,this.type=void 0!==h?h:bc,this.offset=new n(0,0),this.repeat=new n(1,1),this.center=new n(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new i,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==d?d:jl,this.version=0,this.onUpdate=null}function o(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==i?i:1}function a(e,t,n){this.width=e,this.height=t,this.scissor=new o(0,0,e,t),this.scissorTest=!1,this.viewport=new o(0,0,e,t),n=n||{}, +this.texture=new r((void 0),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:mc,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 s(e,t,n){a.call(this,e,t,n),this.samples=4}function c(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1}function l(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function h(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function u(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._order=i||u.DefaultOrder}function d(){this.mask=1}function p(){function e(){o.setFromEuler(r,!1)}function t(){r.setFromQuaternion(o,void 0,!1)}Object.defineProperty(this,"id",{value:jh++}),this.uuid=Ah.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=p.DefaultUp.clone();var n=new l,r=new u,o=new c,a=new l(1,1,1);r._onChange(e),o._onChange(t),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:n},rotation:{configurable:!0,enumerable:!0,value:r},quaternion:{configurable:!0,enumerable:!0,value:o},scale:{configurable:!0,enumerable:!0,value:a},modelViewMatrix:{value:new h},normalMatrix:{value:new i}}),this.matrix=new h,this.matrixWorld=new h,this.matrixAutoUpdate=p.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new d,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function f(){p.call(this),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function m(e,t){this.min=void 0!==e?e:new l((+(1/0)),(+(1/0)),(+(1/0))),this.max=void 0!==t?t:new l((-(1/0)),(-(1/0)),(-(1/0)))}function v(e,t,n,i,r){var o,a;for(o=0,a=e.length-3;o<=a;o+=3){mu.fromArray(e,o);var s=r.x*Math.abs(mu.x)+r.y*Math.abs(mu.y)+r.z*Math.abs(mu.z),c=t.dot(mu),l=n.dot(mu),h=i.dot(mu);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>s)return!1}return!0}function g(e,t){this.center=void 0!==e?e:new l,this.radius=void 0!==t?t:0}function y(e,t){this.origin=void 0!==e?e:new l,this.direction=void 0!==t?t:new l(0,0,(-1))}function x(e,t){this.normal=void 0!==e?e:new l(1,0,0),this.constant=void 0!==t?t:0}function b(e,t,n){this.a=void 0!==e?e:new l,this.b=void 0!==t?t:new l,this.c=void 0!==n?n:new l}function w(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}function _(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function M(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function E(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function T(e,t,n,i,r,o){this.a=e,this.b=t,this.c=n,this.normal=i&&i.isVector3?i:new l,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new w,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==o?o:0}function S(){Object.defineProperty(this,"id",{value:Fu++}),this.uuid=Ah.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=ms,this.side=ls,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=As,this.blendDst=Cs,this.blendEquation=bs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Us,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=gh,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ih,this.stencilZFail=ih,this.stencilZPass=ih,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 L(e){S.call(this),this.type="MeshBasicMaterial",this.color=new w(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=js,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)}function R(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=n===!0,this.usage=yh,this.updateRange={offset:0,count:-1},this.version=0}function A(e,t,n){R.call(this,new Int8Array(e),t,n)}function C(e,t,n){R.call(this,new Uint8Array(e),t,n)}function P(e,t,n){R.call(this,new Uint8ClampedArray(e),t,n)}function I(e,t,n){R.call(this,new Int16Array(e),t,n)}function O(e,t,n){R.call(this,new Uint16Array(e),t,n)}function D(e,t,n){R.call(this,new Int32Array(e),t,n)}function N(e,t,n){R.call(this,new Uint32Array(e),t,n)}function z(e,t,n){R.call(this,new Float32Array(e),t,n)}function H(e,t,n){R.call(this,new Float64Array(e),t,n)}function B(){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}function U(e){if(0===e.length)return-(1/0);for(var t=e[0],n=1,i=e.length;nt&&(t=e[n]);return t}function F(){Object.defineProperty(this,"id",{value:ku+=2}),this.uuid=Ah.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={}}function G(e,t){p.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new F,this.material=void 0!==t?t:new L,this.updateMorphTargets()}function k(e,t,n,i,r,o,a,s){var c;if(c=t.side===hs?i.intersectTriangle(a,o,r,!0,s):i.intersectTriangle(r,o,a,t.side!==us,s),null===c)return null;ud.copy(s),ud.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(ud);return ln.far?null:{distance:l,point:ud.clone(),object:e}}function V(e,t,i,r,o,a,s,c,l,h,u,d){Ku.fromBufferAttribute(o,h),$u.fromBufferAttribute(o,u),ed.fromBufferAttribute(o,d);var p=e.morphTargetInfluences;if(t.morphTargets&&a&&p){rd.set(0,0,0),od.set(0,0,0),ad.set(0,0,0);for(var f=0,m=a.length;f0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var o,a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,s=void 0!==n.precision?n.precision:"highp",c=r(s);c!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",c,"instead."),s=c);var l=n.logarithmicDepthBuffer===!0,h=e.getParameter(34930),u=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),f=e.getParameter(34921),m=e.getParameter(36347),v=e.getParameter(36348),g=e.getParameter(36349),y=u>0,x=a||!!t.get("OES_texture_float"),b=y&&x,w=a?e.getParameter(36183):0;return{isWebGL2:a,getMaxAnisotropy:i,getMaxPrecision:r,precision:s,logarithmicDepthBuffer:l,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:v,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:b,maxSamples:w}}function se(){function e(){h.value!==r&&(h.value=r,h.needsUpdate=o>0),n.numPlanes=o,n.numIntersection=0}function t(e,t,i,r){var o=null!==e?e.length:0,a=null;if(0!==o){if(a=h.value,r!==!0||null===a){var s=i+4*o,u=t.matrixWorldInverse;l.getNormalMatrix(u),(null===a||a.length65535?N:O)(n,1);p.version=o,t.update(p,34963);var f=l.get(e);f&&t.remove(f),l.set(e,p)}function s(e){var t=l.get(e);if(t){var n=e.index;null!==n&&t.version0)return e;var r=t*n,o=Kf[r];if(void 0===o&&(o=new Float32Array(r),Kf[r]=o),0!==t){i.toArray(o,0);for(var a=1,s=0;a!==t;++a)s+=n,e[a].toArray(o,s)}return o}function xe(e,t){if(e.length!==t.length)return!1;for(var n=0,i=e.length;n"); +return yt(n)}function bt(e){return e.replace(sm,_t).replace(am,wt)}function wt(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),_t(e,t,n,i)}function _t(e,t,n,i){for(var r="",o=parseInt(t);o0?e.gammaFactor:1,f=n.isWebGL2?"":dt(n),m=pt(a),v=o.createProgram();if(n.isRawShaderMaterial?(i=[m].filter(mt).join("\n"),i.length>0&&(i+="\n"),r=[f,m].filter(mt).join("\n"),r.length>0&&(r+="\n")):(i=[Mt(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+p,"#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 "+u:"",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.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&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",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"," attribute mat4 instanceMatrix;","#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(mt).join("\n"),r=[f,Mt(n),"#define SHADER_NAME "+n.shaderName,m,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+p,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 "+h:"",n.envMap?"#define "+u:"",n.envMap?"#define "+d:"",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.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#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 "+l:"",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!==Xs?"#define TONE_MAPPING":"",n.toneMapping!==Xs?qf.tonemapping_pars_fragment:"",n.toneMapping!==Xs?ut("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?qf.encodings_pars_fragment:"",n.mapEncoding?lt("mapTexelToLinear",n.mapEncoding):"",n.matcapEncoding?lt("matcapTexelToLinear",n.matcapEncoding):"",n.envMapEncoding?lt("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?lt("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMapEncoding?lt("lightMapTexelToLinear",n.lightMapEncoding):"",n.outputEncoding?ht("linearToOutputTexel",n.outputEncoding):"",n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(mt).join("\n")),s=yt(s),s=vt(s,n),s=gt(s,n),c=yt(c),c=vt(c,n),c=gt(c,n),s=bt(s),c=bt(c),n.isWebGL2&&!n.isRawShaderMaterial){var g=!1,y=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==s.match(y)&&null!==c.match(y)&&(g=!0,s=s.replace(y,""),c=c.replace(y,"")),i=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,r=["#version 300 es\n","#define varying in",g?"":"out highp vec4 pc_fragColor;",g?"":"#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"+r}var x=i+s,b=r+c,w=ot(o,35633,x),_=ot(o,35632,b);if(o.attachShader(v,w),o.attachShader(v,_),void 0!==n.index0AttributeName?o.bindAttribLocation(v,0,n.index0AttributeName):n.morphTargets===!0&&o.bindAttribLocation(v,0,"position"),o.linkProgram(v),e.debug.checkShaderErrors){var M=o.getProgramInfoLog(v).trim(),E=o.getShaderInfoLog(w).trim(),T=o.getShaderInfoLog(_).trim(),S=!0,L=!0;if(o.getProgramParameter(v,35714)===!1){S=!1;var R=ct(o,w,"vertex"),A=ct(o,_,"fragment");console.error("THREE.WebGLProgram: shader error: ",o.getError(),"35715",o.getProgramParameter(v,35715),"gl.getProgramInfoLog",M,R,A)}else""!==M?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",M):""!==E&&""!==T||(L=!1);L&&(this.diagnostics={runnable:S,programLog:M,vertexShader:{log:E,prefix:i},fragmentShader:{log:T,prefix:r}})}o.detachShader(v,w),o.detachShader(v,_),o.deleteShader(w),o.deleteShader(_);var C;this.getUniforms=function(){return void 0===C&&(C=new rt(o,v)),C};var P;return this.getAttributes=function(){return void 0===P&&(P=ft(o,v)),P},this.destroy=function(){o.deleteProgram(v),this.program=void 0},this.name=n.shaderName,this.id=rm++,this.cacheKey=t,this.usedTimes=1,this.program=v,this.vertexShader=w,this.fragmentShader=_,this}function At(e,t,n){function i(e,t){var n;if(t){var i=Xf[t];n={name:e.type,uniforms:yd.clone(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader}}else n={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};return n}function r(e){var t=e.skeleton,n=t.bones;if(l)return 1024;var i=u,r=Math.floor((i-20)/4),o=Math.min(r,n.length);return o0,maxBones:M,useVertexTexture:l,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:u.directional.length,numPointLights:u.point.length,numSpotLights:u.spot.length,numRectAreaLights:u.rectArea.length,numHemiLights:u.hemi.length,numDirLightShadows:u.directionalShadowMap.length,numPointLightShadows:u.pointShadowMap.length,numSpotLightShadows:u.spotShadowMap.length,numClippingPlanes:v,numClipIntersection:g,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&f.length>0,shadowMapType:e.shadowMap.type,toneMapping:a.toneMapped?e.toneMapping:Xs,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:a.premultipliedAlpha,alphaTest:a.alphaTest,doubleSided:a.side===us,flipSided:a.side===hs,depthPacking:void 0!==a.depthPacking&&a.depthPacking,index0AttributeName:a.index0AttributeName,extensionDerivatives:a.extensions&&a.extensions.derivatives,extensionFragDepth:a.extensions&&a.extensions.fragDepth,extensionDrawBuffers:a.extensions&&a.extensions.drawBuffers,extensionShaderTextureLOD:a.extensions&&a.extensions.shaderTextureLOD,rendererExtensionFragDepth:s||null!==t.get("EXT_frag_depth"),rendererExtensionDrawBuffers:s||null!==t.get("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:s||null!==t.get("EXT_shader_texture_lod"),onBeforeCompile:a.onBeforeCompile};return S},this.getProgramCacheKey=function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);if(void 0===t.isRawShaderMaterial){for(var r=0;r1&&c.sort(e||Pt),l.length>1&&l.sort(t||It)}function o(){for(var e=s,t=a.length;e0:l.isGeometry===!0&&(p=l.morphTargets&&l.morphTargets.length>0));var f=!1;t.isSkinnedMesh===!0&&(n.skinning===!0?f=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t));var m=t.isInstancedMesh===!0;h=u(p,f,m)}else h=d;if(e.localClippingEnabled&&n.clipShadows===!0&&0!==n.clippingPlanes.length){var v=h.uuid,x=n.uuid,b=g[v];void 0===b&&(b={},g[v]=b);var w=b[x];void 0===w&&(w=h.clone(),b[x]=w),h=w}return h.visible=n.visible,h.wireframe=n.wireframe,a===cs?h.side=null!==n.shadowSide?n.shadowSide:n.side:h.side=null!==n.shadowSide?n.shadowSide:y[n.side],h.clipShadows=n.clipShadows,h.clippingPlanes=n.clippingPlanes,h.clipIntersection=n.clipIntersection,h.wireframeLinewidth=n.wireframeLinewidth,h.linewidth=n.linewidth,i.isPointLight===!0&&h.isMeshDistanceMaterial===!0&&(h.referencePosition.setFromMatrixPosition(i.matrixWorld),h.nearDistance=r,h.farDistance=o),h}function h(n,i,r,o,a){if(n.visible!==!1){var s=n.layers.test(i.layers);if(s&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===cs)&&(!n.frustumCulled||u.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,n.matrixWorld);var c=t.update(n),d=n.material;if(Array.isArray(d))for(var p=c.groups,f=0,m=p.length;fi||d.y>i)&&(console.warn("THREE.WebGLShadowMap:",y,"has shadow exceeding max texture size, reducing"),d.x>i&&(p.x=Math.floor(i/b.x),d.x=p.x*b.x,x.mapSize.x=p.x),d.y>i&&(p.y=Math.floor(i/b.y),d.y=p.y*b.y,x.mapSize.y=p.y)),null===x.map&&!x.isPointLightShadow&&this.type===cs){var w={minFilter:mc,magFilter:mc,format:Dc};x.map=new a(d.x,d.y,w),x.map.texture.name=y.name+".shadowMap",x.mapPass=new a(d.x,d.y,w),x.camera.updateProjectionMatrix()}if(null===x.map){var w={minFilter:hc,magFilter:hc,format:Dc};x.map=new a(d.x,d.y,w),x.map.texture.name=y.name+".shadowMap",x.camera.updateProjectionMatrix()}e.setRenderTarget(x.map),e.clear();for(var _=x.getViewportCount(),E=0;E<_;E++){var T=x.getViewport(E);f.set(p.x*T.x,p.y*T.y,p.x*T.z,p.y*T.w),m.viewport(f),x.updateMatrices(y,E),u=x.getFrustum(),h(n,o,x.camera,y,this.type)}x.isPointLightShadow||this.type!==cs||r(x,o)}else console.warn("THREE.WebGLShadowMap:",y,"has no shadow.")}M.needsUpdate=!1,e.setRenderTarget(s,c,l)}}}function jt(e,t,n){function i(){var t=!1,n=new o,i=null,r=new o(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,o,a,s){s===!0&&(t*=a,i*=a,o*=a),n.set(t,i,o,a),r.equals(n)===!1&&(e.clearColor(t,i,o,a),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}}function r(){var t=!1,n=null,i=null,r=null;return{setTest:function(e){e?d(2929):p(2929)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==t){if(t)switch(t){case zs:e.depthFunc(512);break;case Hs:e.depthFunc(519);break;case Bs:e.depthFunc(513);break;case Us:e.depthFunc(515);break;case Fs:e.depthFunc(514);break;case Gs:e.depthFunc(518);break;case ks:e.depthFunc(516);break;case Vs:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}}function a(){var t=!1,n=null,i=null,r=null,o=null,a=null,s=null,c=null,l=null;return{setTest:function(e){t||(e?d(2960):p(2960))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,a){i===t&&r===n&&o===a||(e.stencilFunc(t,n,a),i=t,r=n,o=a)},setOp:function(t,n,i){a===t&&s===n&&c===i||(e.stencilOp(t,n,i),a=t,s=n,c=i)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,n=null,i=null,r=null,o=null,a=null,s=null,c=null,l=null}}}function s(t,n,i){var r=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var a=0;a=1):re.indexOf("OpenGL ES")!==-1&&(ie=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(re)[1]),ne=ie>=2);var oe=null,ae={},se=new o,ce=new o,le={};le[3553]=s(3553,3553,1),le[34067]=s(34067,34069,6),I.setClear(0,0,0,1),O.setClear(1),D.setClear(0),d(2929),O.setFunc(Us),g(!1),y(es),d(2884),m(fs);var he={};if(he[bs]=32774,he[ws]=32778,he[_s]=32779,P)he[Ms]=32775,he[Es]=32776;else{var ue=t.get("EXT_blend_minmax");null!==ue&&(he[Ms]=ue.MIN_EXT,he[Es]=ue.MAX_EXT)}var de={};return de[Ts]=0,de[Ss]=1,de[Ls]=768,de[As]=770,de[Ns]=776,de[Os]=774,de[Ps]=772,de[Rs]=769,de[Cs]=771,de[Ds]=775,de[Is]=773,{buffers:{color:I,depth:O,stencil:D},initAttributes:c,enableAttribute:l,enableAttributeAndDivisor:h,disableUnusedAttributes:u,enable:d,disable:p,useProgram:f,setBlending:m,setMaterial:v,setFlipSided:g,setCullFace:y,setLineWidth:x,setPolygonOffset:b,setScissorTest:w,activeTexture:_,bindTexture:M,unbindTexture:E,compressedTexImage2D:T,texImage2D:S,texImage3D:L,scissor:R,viewport:A,reset:C}}function Wt(e,t,n,i,r,o,a){function s(e,t){return X?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function c(e,t,n,i){var r=1;if((e.width>i||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||t===!0){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var o=t?Ah.floorPowerOfTwo:Math.floor,a=o(r*e.width),c=o(r*e.height);void 0===F&&(F=s(a,c));var l=n?s(a,c):F;l.width=a,l.height=c;var h=l.getContext("2d");return h.drawImage(e,0,0,a,c),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+a+"x"+c+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function l(e){return Ah.isPowerOfTwo(e.width)&&Ah.isPowerOfTwo(e.height)}function h(e){return!G&&(e.wrapS!==cc||e.wrapT!==cc||e.minFilter!==hc&&e.minFilter!==mc)}function u(e,t){return e.generateMipmaps&&t&&e.minFilter!==hc&&e.minFilter!==mc}function d(t,n,r,o){e.generateMipmap(t);var a=i.get(n);a.__maxMipLevel=Math.log(Math.max(r,o))*Math.LOG2E}function p(n,i,r){if(G===!1)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var o=i;return 6403===i&&(5126===r&&(o=33326),5131===r&&(o=33325),5121===r&&(o=33321)),6407===i&&(5126===r&&(o=34837),5131===r&&(o=34843),5121===r&&(o=32849)),6408===i&&(5126===r&&(o=34836),5131===r&&(o=34842),5121===r&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||t.get("EXT_color_buffer_float"),o}function f(e){return e===hc||e===uc||e===pc?9728:9729}function m(e){var t=e.target;t.removeEventListener("dispose",m),g(t),t.isVideoTexture&&q["delete"](t),a.memory.textures--}function v(e){var t=e.target;t.removeEventListener("dispose",v),y(t),a.memory.textures--}function g(t){var n=i.get(t);void 0!==n.__webglInit&&(e.deleteTexture(n.__webglTexture),i.remove(t))}function y(t){var n=i.get(t),r=i.get(t.texture);if(t){if(void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var o=0;o<6;o++)e.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[o]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);i.remove(t.texture),i.remove(t)}}function x(){Z=0}function b(){var e=Z;return e>=k&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+k),Z+=1,e}function w(e,t){var r=i.get(e);if(e.isVideoTexture&&H(e),e.version>0&&r.__version!==e.version){var o=e.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(o.complete!==!1)return void R(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}function _(e,t){var r=i.get(e);return e.version>0&&r.__version!==e.version?void R(r,e,t):(n.activeTexture(33984+t),void n.bindTexture(35866,r.__webglTexture))}function M(e,t){var r=i.get(e);return e.version>0&&r.__version!==e.version?void R(r,e,t):(n.activeTexture(33984+t),void n.bindTexture(32879,r.__webglTexture))}function E(t,r){if(6===t.image.length){var a=i.get(t);if(t.version>0&&a.__version!==t.version){L(a,t),n.activeTexture(33984+r),n.bindTexture(34067,a.__webglTexture),e.pixelStorei(37440,t.flipY);for(var s=t&&(t.isCompressedTexture||t.image[0].isCompressedTexture),h=t.image[0]&&t.image[0].isDataTexture,f=[],m=0;m<6;m++)s||h?f[m]=h?t.image[m].image:t.image[m]:f[m]=c(t.image[m],!1,!0,V);var v=f[0],g=l(v)||G,y=o.convert(t.format),x=o.convert(t.type),b=p(t.internalFormat,y,x);S(34067,t,g);var w;if(s){for(var m=0;m<6;m++){w=f[m].mipmaps;for(var _=0;_1||i.get(o).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),i.get(o).__currentAnisotropy=o.anisotropy)}}function L(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",m),t.__webglTexture=e.createTexture(),a.memory.textures++)}function R(t,i,r){var a=3553;i.isDataTexture2DArray&&(a=35866),i.isDataTexture3D&&(a=32879),L(t,i),n.activeTexture(33984+r),n.bindTexture(a,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment);var s=h(i)&&l(i.image)===!1,f=c(i.image,s,!1,j),m=l(f)||G,v=o.convert(i.format),g=o.convert(i.type),y=p(i.internalFormat,v,g);S(a,i,m);var x,b=i.mipmaps;if(i.isDepthTexture)y=6402,G?y=i.type===Sc?36012:i.type===Tc?33190:i.type===Pc?35056:33189:i.type===Sc&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===Bc&&6402===y&&i.type!==Mc&&i.type!==Tc&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Mc,g=o.convert(i.type)),i.format===Uc&&6402===y&&(y=34041,i.type!==Pc&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Pc,g=o.convert(i.type))),n.texImage2D(3553,0,y,f.width,f.height,0,v,g,null);else if(i.isDataTexture)if(b.length>0&&m){for(var w=0,_=b.length;w<_;w++)x=b[w],n.texImage2D(3553,w,y,x.width,x.height,0,v,g,x.data);i.generateMipmaps=!1,t.__maxMipLevel=b.length-1}else n.texImage2D(3553,0,y,f.width,f.height,0,v,g,f.data),t.__maxMipLevel=0;else if(i.isCompressedTexture){for(var w=0,_=b.length;w<_;w++)x=b[w],i.format!==Dc&&i.format!==Oc?null!==v?n.compressedTexImage2D(3553,w,y,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,w,y,x.width,x.height,0,v,g,x.data);t.__maxMipLevel=b.length-1}else if(i.isDataTexture2DArray)n.texImage3D(35866,0,y,f.width,f.height,f.depth,0,v,g,f.data),t.__maxMipLevel=0;else if(i.isDataTexture3D)n.texImage3D(32879,0,y,f.width,f.height,f.depth,0,v,g,f.data),t.__maxMipLevel=0;else if(b.length>0&&m){for(var w=0,_=b.length;w<_;w++)x=b[w],n.texImage2D(3553,w,y,v,g,x);i.generateMipmaps=!1,t.__maxMipLevel=b.length-1}else n.texImage2D(3553,0,y,v,g,f),t.__maxMipLevel=0;u(i,m)&&d(a,i,f.width,f.height),t.__version=i.version,i.onUpdate&&i.onUpdate(i)}function A(t,r,a,s){var c=o.convert(r.texture.format),l=o.convert(r.texture.type),h=p(r.texture.internalFormat,c,l);n.texImage2D(s,0,h,r.width,r.height,0,c,l,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,a,s,i.get(r.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function C(t,n,i){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var r=33189;if(i){var a=n.depthTexture;a&&a.isDepthTexture&&(a.type===Sc?r=36012:a.type===Tc&&(r=33190));var s=z(n);e.renderbufferStorageMultisample(36161,s,r,n.width,n.height)}else e.renderbufferStorage(36161,r,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(i){var s=z(n);e.renderbufferStorageMultisample(36161,s,35056,n.width,n.height)}else e.renderbufferStorage(36161,34041,n.width,n.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var c=o.convert(n.texture.format),l=o.convert(n.texture.type),r=p(n.texture.internalFormat,c,l);if(i){var s=z(n);e.renderbufferStorageMultisample(36161,s,r,n.width,n.height)}else e.renderbufferStorage(36161,r,n.width,n.height)}e.bindRenderbuffer(36161,null)}function P(t,n){var r=n&&n.isWebGLCubeRenderTarget;if(r)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),w(n.depthTexture,0);var o=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Bc)e.framebufferTexture2D(36160,36096,3553,o,0);else{if(n.depthTexture.format!==Uc)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,o,0)}}function I(t){var n=i.get(t),r=t.isWebGLCubeRenderTarget===!0;if(t.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");P(n.__webglFramebuffer,t)}else if(r){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)e.bindFramebuffer(36160,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=e.createRenderbuffer(),C(n.__webglDepthbuffer[o],t,!1)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),C(n.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}function O(t){var r=i.get(t),s=i.get(t.texture);t.addEventListener("dispose",v),s.__webglTexture=e.createTexture(),a.memory.textures++;var c=t.isWebGLCubeRenderTarget===!0,h=t.isWebGLMultisampleRenderTarget===!0,f=l(t)||G;if(!G||t.texture.format!==Oc||t.texture.type!==Sc&&t.texture.type!==Lc||(t.texture.format=Dc,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){r.__webglFramebuffer=[];for(var m=0;m<6;m++)r.__webglFramebuffer[m]=e.createFramebuffer()}else if(r.__webglFramebuffer=e.createFramebuffer(),h)if(G){r.__webglMultisampledFramebuffer=e.createFramebuffer(),r.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,r.__webglColorRenderbuffer);var g=o.convert(t.texture.format),y=o.convert(t.texture.type),x=p(t.texture.internalFormat,g,y),b=z(t);e.renderbufferStorageMultisample(36161,b,x,t.width,t.height),e.bindFramebuffer(36160,r.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,r.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(r.__webglDepthRenderbuffer=e.createRenderbuffer(),C(r.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){n.bindTexture(34067,s.__webglTexture),S(34067,t.texture,f);for(var m=0;m<6;m++)A(r.__webglFramebuffer[m],t,36064,34069+m);u(t.texture,f)&&d(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,s.__webglTexture),S(3553,t.texture,f),A(r.__webglFramebuffer,t,36064,3553),u(t.texture,f)&&d(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&I(t)}function D(e){var t=e.texture,r=l(e)||G;if(u(t,r)){var o=e.isWebGLCubeRenderTarget?34067:3553,a=i.get(t).__webglTexture;n.bindTexture(o,a),d(o,t,e.width,e.height),n.bindTexture(o,null)}}function N(t){if(t.isWebGLMultisampleRenderTarget)if(G){var n=i.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);var r=t.width,o=t.height,a=16384;t.depthBuffer&&(a|=256),t.stencilBuffer&&(a|=1024),e.blitFramebuffer(0,0,r,o,0,0,r,o,a,9728),e.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function z(e){return G&&e.isWebGLMultisampleRenderTarget?Math.min(W,e.samples):0}function H(e){var t=a.render.frame;q.get(e)!==t&&(q.set(e,t),e.update())}function B(e,t){e&&e.isWebGLRenderTarget&&(K===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),K=!0),e=e.texture),w(e,t)}function U(e,t){e&&e.isWebGLCubeRenderTarget&&($===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),$=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?E(e,t):T(e,t)}var F,G=r.isWebGL2,k=r.maxTextures,V=r.maxCubemapSize,j=r.maxTextureSize,W=r.maxSamples,q=new WeakMap,X=!1;try{X="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(Y){}var Z=0,J={};J[sc]=10497,J[cc]=33071,J[lc]=33648;var Q={};Q[hc]=9728,Q[uc]=9984,Q[pc]=9986,Q[mc]=9729,Q[vc]=9985,Q[yc]=9987;var K=!1,$=!1;this.allocateTextureUnit=b,this.resetTextureUnits=x,this.setTexture2D=w,this.setTexture2DArray=_,this.setTexture3D=M,this.setTextureCube=E,this.setTextureCubeDynamic=T,this.setupRenderTarget=O,this.updateRenderTargetMipmap=D,this.updateMultisampleRenderTarget=N,this.safeSetTexture2D=B,this.safeSetTextureCube=U}function qt(e,t,n){function i(e){var n;if(e===bc)return 5121;if(e===Rc)return 32819;if(e===Ac)return 32820;if(e===Cc)return 33635;if(e===wc)return 5120;if(e===_c)return 5122;if(e===Mc)return 5123;if(e===Ec)return 5124;if(e===Tc)return 5125;if(e===Sc)return 5126;if(e===Lc)return r?5131:(n=t.get("OES_texture_half_float"),null!==n?n.HALF_FLOAT_OES:null);if(e===Ic)return 6406;if(e===Oc)return 6407;if(e===Dc)return 6408;if(e===Nc)return 6409;if(e===zc)return 6410;if(e===Bc)return 6402;if(e===Uc)return 34041;if(e===Fc)return 6403;if(e===Gc)return 36244;if(e===kc)return 33319;if(e===Vc)return 33320;if(e===jc)return 36248;if(e===Wc)return 36249;if(e===qc||e===Xc||e===Yc||e===Zc){if(n=t.get("WEBGL_compressed_texture_s3tc"),null===n)return null;if(e===qc)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Xc)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Yc)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Zc)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e===Jc||e===Qc||e===Kc||e===$c){if(n=t.get("WEBGL_compressed_texture_pvrtc"),null===n)return null;if(e===Jc)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===Qc)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===Kc)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===$c)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===el)return n=t.get("WEBGL_compressed_texture_etc1"),null!==n?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((e===tl||e===nl)&&(n=t.get("WEBGL_compressed_texture_etc"),null!==n)){if(e===tl)return n.COMPRESSED_RGB8_ETC2;if(e===nl)return n.COMPRESSED_RGBA8_ETC2_EAC}return e===il||e===rl||e===ol||e===al||e===sl||e===cl||e===ll||e===hl||e===ul||e===dl||e===pl||e===fl||e===ml||e===vl||e===yl||e===xl||e===bl||e===wl||e===_l||e===Ml||e===El||e===Tl||e===Sl||e===Ll||e===Rl||e===Al||e===Cl||e===Pl?(n=t.get("WEBGL_compressed_texture_astc"),null!==n?e:null):e===gl?(n=t.get("EXT_texture_compression_bptc"),null!==n?e:null):e===Pc?r?34042:(n=t.get("WEBGL_depth_texture"),null!==n?n.UNSIGNED_INT_24_8_WEBGL:null):void 0}var r=n.isWebGL2;return{convert:i}}function Xt(e){Z.call(this),this.cameras=e||[]}function Yt(){p.call(this),this.type="Group"}function Zt(e,t){function n(e){var t=y.get(e.inputSource);t&&(t.targetRay&&t.targetRay.dispatchEvent({type:e.type}),t.grip&&t.grip.dispatchEvent({type:e.type}))}function i(){y.forEach(function(e,t){e.targetRay&&(e.targetRay.dispatchEvent({type:"disconnected",data:t}),e.targetRay.visible=!1),e.grip&&(e.grip.dispatchEvent({type:"disconnected",data:t}),e.grip.visible=!1)}),y.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),L.stop(),u.isPresenting=!1,u.dispatchEvent({type:"sessionend"})}function r(e){f=e,L.setContext(d),L.start(),u.isPresenting=!0,u.dispatchEvent({type:"sessionstart"})}function a(e){for(var t=d.inputSources,n=0;n=0){var l=r[s];if(void 0!==l){var h=l.normalized,u=l.itemSize,d=Xe.get(l);if(void 0===d)continue;var p=d.buffer,f=d.type,m=d.bytesPerElement;if(l.isInterleavedBufferAttribute){var v=l.data,g=v.stride,y=l.offset;v&&v.isInstancedInterleavedBuffer?(Ve.enableAttributeAndDivisor(c,v.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=v.meshPerAttribute*v.count)):Ve.enableAttribute(c),J.bindBuffer(34962,p),J.vertexAttribPointer(c,u,f,h,g*m,y*m)}else l.isInstancedBufferAttribute?(Ve.enableAttributeAndDivisor(c,l.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=l.meshPerAttribute*l.count)):Ve.enableAttribute(c),J.bindBuffer(34962,p),J.vertexAttribPointer(c,u,f,h,0,0)}else if("instanceMatrix"===s){var d=Xe.get(e.instanceMatrix);if(void 0===d)continue;var p=d.buffer,f=d.type;Ve.enableAttributeAndDivisor(c+0,1),Ve.enableAttributeAndDivisor(c+1,1),Ve.enableAttributeAndDivisor(c+2,1),Ve.enableAttributeAndDivisor(c+3,1),J.bindBuffer(34962,p),J.vertexAttribPointer(c+0,4,f,!1,64,0),J.vertexAttribPointer(c+1,4,f,!1,64,16),J.vertexAttribPointer(c+2,4,f,!1,64,32),J.vertexAttribPointer(c+3,4,f,!1,64,48)}else if(void 0!==a){var x=a[s];if(void 0!==x)switch(x.length){case 2:J.vertexAttrib2fv(c,x);break;case 3:J.vertexAttrib3fv(c,x);break;case 4:J.vertexAttrib4fv(c,x);break;default:J.vertexAttrib1fv(c,x)}}}}Ve.disableUnusedAttributes()}}function m(e){ot.isPresenting||ct&&ct(e)}function v(e,t,n,i){if(e.visible!==!1){var r=e.layers.test(t.layers);if(r)if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)Z.pushLight(e),e.castShadow&&Z.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||Oe.intersectsSprite(e)){i&&Be.setFromMatrixPosition(e.matrixWorld).applyMatrix4(He);var o=Ze.update(e),a=e.material;a.visible&&Y.push(e,o,a,n,Be.z,null)}}else if(e.isImmediateRenderObject)i&&Be.setFromMatrixPosition(e.matrixWorld).applyMatrix4(He),Y.push(e,null,e.material,n,Be.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==je.render.frame&&(e.skeleton.update(),e.skeleton.frame=je.render.frame),!e.frustumCulled||Oe.intersectsObject(e))){i&&Be.setFromMatrixPosition(e.matrixWorld).applyMatrix4(He);var o=Ze.update(e),a=e.material;if(Array.isArray(a))for(var s=o.groups,c=0,l=s.length;c=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(var f=0;f=0&&e.numSupportedMorphNormals++}var m=i.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&e.clipping!==!0||(i.numClippingPlanes=De.numPlanes,i.numIntersection=De.numIntersection,m.clippingPlanes=De.uniform),i.fog=t.fog,i.needsLights=H(e),i.lightsStateVersion=a,i.needsLights&&(m.ambientLightColor.value=r.state.ambient,m.lightProbe.value=r.state.probe,m.directionalLights.value=r.state.directional,m.directionalLightShadows.value=r.state.directionalShadow,m.spotLights.value=r.state.spot,m.spotLightShadows.value=r.state.spotShadow,m.rectAreaLights.value=r.state.rectArea,m.pointLights.value=r.state.point,m.pointLightShadows.value=r.state.pointShadow,m.hemisphereLights.value=r.state.hemi,m.directionalShadowMap.value=r.state.directionalShadowMap,m.directionalShadowMatrix.value=r.state.directionalShadowMatrix,m.spotShadowMap.value=r.state.spotShadowMap,m.spotShadowMatrix.value=r.state.spotShadowMatrix,m.pointShadowMap.value=r.state.pointShadowMap,m.pointShadowMatrix.value=r.state.pointShadowMatrix);var v=i.program.getUniforms(),g=rt.seqWithValue(v.seq,m);i.uniformsList=g}function b(e,t,n,i){qe.resetTextureUnits();var r=t.fog,o=n.isMeshStandardMaterial?t.environment:null,a=We.get(n),s=Z.state.lights;if(Ne&&(ze||e!==be)){var c=e===be&&n.id===ye;De.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,a,c)}n.version===a.__version?void 0===a.program?x(n,t,i):n.fog&&a.fog!==r?x(n,t,i):a.environment!==o?x(n,t,i):a.needsLights&&a.lightsStateVersion!==s.state.version?x(n,t,i):void 0===a.numClippingPlanes||a.numClippingPlanes===De.numPlanes&&a.numIntersection===De.numIntersection?a.outputEncoding!==Q.outputEncoding&&x(n,t,i):x(n,t,i):(x(n,t,i),a.__version=n.version);var l=!1,h=!1,u=!1,d=a.program,p=d.getUniforms(),f=a.uniforms;if(Ve.useProgram(d.program)&&(l=!0,h=!0,u=!0),n.id!==ye&&(ye=n.id,h=!0),l||be!==e){if(p.setValue(J,"projectionMatrix",e.projectionMatrix),ke.logarithmicDepthBuffer&&p.setValue(J,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),be!==e&&(be=e,h=!0,u=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var m=p.map.cameraPosition;void 0!==m&&m.setValue(J,Be.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&p.setValue(J,"isOrthographic",e.isOrthographicCamera===!0), +(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&p.setValue(J,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){p.setOptional(J,i,"bindMatrix"),p.setOptional(J,i,"bindMatrixInverse");var v=i.skeleton;if(v){var g=v.bones;if(ke.floatVertexTextures){if(void 0===v.boneTexture){var y=Math.sqrt(4*g.length);y=Ah.ceilPowerOfTwo(y),y=Math.max(y,4);var b=new Float32Array(y*y*4);b.set(v.boneMatrices);var H=new K(b,y,y,Dc,Sc);v.boneMatrices=b,v.boneTexture=H,v.boneTextureSize=y}p.setValue(J,"boneTexture",v.boneTexture,qe),p.setValue(J,"boneTextureSize",v.boneTextureSize)}else p.setOptional(J,v,"boneMatrices")}}return(h||a.receiveShadow!==i.receiveShadow)&&(a.receiveShadow=i.receiveShadow,p.setValue(J,"receiveShadow",i.receiveShadow)),h&&(p.setValue(J,"toneMappingExposure",Q.toneMappingExposure),p.setValue(J,"toneMappingWhitePoint",Q.toneMappingWhitePoint),a.needsLights&&z(f,u),r&&n.fog&&S(f,r),n.isMeshBasicMaterial?w(f,n):n.isMeshLambertMaterial?(w(f,n),L(f,n)):n.isMeshToonMaterial?(w(f,n),A(f,n)):n.isMeshPhongMaterial?(w(f,n),R(f,n)):n.isMeshStandardMaterial?(w(f,n,o),n.isMeshPhysicalMaterial?P(f,n,o):C(f,n,o)):n.isMeshMatcapMaterial?(w(f,n),I(f,n)):n.isMeshDepthMaterial?(w(f,n),O(f,n)):n.isMeshDistanceMaterial?(w(f,n),D(f,n)):n.isMeshNormalMaterial?(w(f,n),N(f,n)):n.isLineBasicMaterial?(_(f,n),n.isLineDashedMaterial&&M(f,n)):n.isPointsMaterial?E(f,n):n.isSpriteMaterial?T(f,n):n.isShadowMaterial&&(f.color.value.copy(n.color),f.opacity.value=n.opacity),void 0!==f.ltc_1&&(f.ltc_1.value=Td.LTC_1),void 0!==f.ltc_2&&(f.ltc_2.value=Td.LTC_2),rt.upload(J,a.uniformsList,f,qe),n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)),n.isShaderMaterial&&n.uniformsNeedUpdate===!0&&(rt.upload(J,a.uniformsList,f,qe),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&p.setValue(J,"center",i.center),p.setValue(J,"modelViewMatrix",i.modelViewMatrix),p.setValue(J,"normalMatrix",i.normalMatrix),p.setValue(J,"modelMatrix",i.matrixWorld),d}function w(e,t,n){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 i=t.envMap||n;i&&(e.envMap.value=i,e.flipEnvMap.value=i.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=We.get(i).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity);var r;t.map?r=t.map:t.specularMap?r=t.specularMap:t.displacementMap?r=t.displacementMap:t.normalMap?r=t.normalMap:t.bumpMap?r=t.bumpMap:t.roughnessMap?r=t.roughnessMap:t.metalnessMap?r=t.metalnessMap:t.alphaMap?r=t.alphaMap:t.emissiveMap&&(r=t.emissiveMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),r.matrixAutoUpdate===!0&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix));var o;t.aoMap?o=t.aoMap:t.lightMap&&(o=t.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),o.matrixAutoUpdate===!0&&o.updateMatrix(),e.uv2Transform.value.copy(o.matrix))}function _(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}function M(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function E(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*Le,e.scale.value=.5*Se,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&&(n.matrixAutoUpdate===!0&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}function T(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&&(n.matrixAutoUpdate===!0&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}function S(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)}function L(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}function R(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===hs&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===hs&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function A(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),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===hs&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===hs&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function C(e,t,n){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===hs&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===hs&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||n)&&(e.envMapIntensity.value=t.envMapIntensity)}function P(e,t,n){C(e,t,n),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===hs&&e.clearcoatNormalScale.value.negate()),e.transparency.value=t.transparency}function I(e,t){t.matcap&&(e.matcap.value=t.matcap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===hs&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===hs&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function O(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function D(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}function N(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===hs&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===hs&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function z(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function H(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&e.lights===!0}e=e||{};var B=void 0!==e.canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),U=void 0!==e.context?e.context:null,F=void 0!==e.alpha&&e.alpha,G=void 0===e.depth||e.depth,k=void 0===e.stencil||e.stencil,V=void 0!==e.antialias&&e.antialias,j=void 0===e.premultipliedAlpha||e.premultipliedAlpha,W=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,q=void 0!==e.powerPreference?e.powerPreference:"default",X=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,Y=null,Z=null;this.domElement=B,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=jl,this.physicallyCorrectLights=!1,this.toneMapping=Ys,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var J,Q=this,ne=!1,ie=null,de=0,me=0,ve=null,ge=null,ye=-1,xe={geometry:null,program:null,wireframe:!1},be=null,we=null,_e=new o,Me=new o,Ee=null,Te=B.width,Se=B.height,Le=1,Re=null,Ae=null,Ce=new o(0,0,Te,Se),Pe=new o(0,0,Te,Se),Ie=!1,Oe=new $,De=new se,Ne=!1,ze=!1,He=new h,Be=new l;try{var Ue={alpha:F,depth:G,stencil:k,antialias:V,premultipliedAlpha:j,preserveDrawingBuffer:W,powerPreference:q,failIfMajorPerformanceCaveat:X,xrCompatible:!0};if(B.addEventListener("webglcontextlost",r,!1),B.addEventListener("webglcontextrestored",a,!1),J=U||B.getContext("webgl",Ue)||B.getContext("experimental-webgl",Ue),null===J)throw null!==B.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===J.getShaderPrecisionFormat&&(J.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Fe){throw console.error("THREE.WebGLRenderer: "+Fe.message),Fe}var Ge,ke,Ve,je,We,qe,Xe,Ye,Ze,Je,Qe,Ke,$e,et,tt,nt,it;i();var ot=new Zt(Q,J);this.xr=ot;var at=new Vt(Q,Ze,ke.maxTextureSize);this.shadowMap=at,this.getContext=function(){return J},this.getContextAttributes=function(){return J.getContextAttributes()},this.forceContextLoss=function(){var e=Ge.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=Ge.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return Le},this.setPixelRatio=function(e){void 0!==e&&(Le=e,this.setSize(Te,Se,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new n),e.set(Te,Se)},this.setSize=function(e,t,n){return ot.isPresenting?void console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(Te=e,Se=t,B.width=Math.floor(e*Le),B.height=Math.floor(t*Le),n!==!1&&(B.style.width=e+"px",B.style.height=t+"px"),void 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 n),e.set(Te*Le,Se*Le).floor()},this.setDrawingBufferSize=function(e,t,n){Te=e,Se=t,Le=n,B.width=Math.floor(e*n),B.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 o),e.copy(_e)},this.getViewport=function(e){return e.copy(Ce)},this.setViewport=function(e,t,n,i){e.isVector4?Ce.set(e.x,e.y,e.z,e.w):Ce.set(e,t,n,i),Ve.viewport(_e.copy(Ce).multiplyScalar(Le).floor())},this.getScissor=function(e){return e.copy(Pe)},this.setScissor=function(e,t,n,i){e.isVector4?Pe.set(e.x,e.y,e.z,e.w):Pe.set(e,t,n,i),Ve.scissor(Me.copy(Pe).multiplyScalar(Le).floor())},this.getScissorTest=function(){return Ie},this.setScissorTest=function(e){Ve.setScissorTest(Ie=e)},this.setOpaqueSort=function(e){Re=e},this.setTransparentSort=function(e){Ae=e},this.getClearColor=function(){return $e.getClearColor()},this.setClearColor=function(){$e.setClearColor.apply($e,arguments)},this.getClearAlpha=function(){return $e.getClearAlpha()},this.setClearAlpha=function(){$e.setClearAlpha.apply($e,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),J.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(){B.removeEventListener("webglcontextlost",r,!1),B.removeEventListener("webglcontextrestored",a,!1),Qe.dispose(),Ke.dispose(),We.dispose(),Ze.dispose(),ot.dispose(),lt.stop(),this.forceContextLoss()},this.renderBufferImmediate=function(e,t){Ve.initAttributes();var n=We.get(e);e.hasPositions&&!n.position&&(n.position=J.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=J.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=J.createBuffer()),e.hasColors&&!n.color&&(n.color=J.createBuffer());var i=t.getAttributes();e.hasPositions&&(J.bindBuffer(34962,n.position),J.bufferData(34962,e.positionArray,35048),Ve.enableAttribute(i.position),J.vertexAttribPointer(i.position,3,5126,!1,0,0)),e.hasNormals&&(J.bindBuffer(34962,n.normal),J.bufferData(34962,e.normalArray,35048),Ve.enableAttribute(i.normal),J.vertexAttribPointer(i.normal,3,5126,!1,0,0)),e.hasUvs&&(J.bindBuffer(34962,n.uv),J.bufferData(34962,e.uvArray,35048),Ve.enableAttribute(i.uv),J.vertexAttribPointer(i.uv,2,5126,!1,0,0)),e.hasColors&&(J.bindBuffer(34962,n.color),J.bufferData(34962,e.colorArray,35048),Ve.enableAttribute(i.color),J.vertexAttribPointer(i.color,3,5126,!1,0,0)),Ve.disableUnusedAttributes(),J.drawArrays(4,0,e.count),e.count=0};var st=new f;this.renderBufferDirect=function(e,n,i,r,o,a){null===n&&(n=st);var s=o.isMesh&&o.matrixWorld.determinant()<0,c=b(e,n,r,o);Ve.setMaterial(r,s);var l=!1;xe.geometry===i.id&&xe.program===c.id&&xe.wireframe===(r.wireframe===!0)||(xe.geometry=i.id,xe.program=c.id,xe.wireframe=r.wireframe===!0,l=!0),(r.morphTargets||r.morphNormals)&&(et.update(o,i,r,c),l=!0);var h=i.index,u=i.attributes.position;if(null===h){if(void 0===u||0===u.count)return}else if(0===h.count)return;var d=1;r.wireframe===!0&&(h=Ye.getWireframeAttribute(i),d=2);var f,m=tt;null!==h&&(f=Xe.get(h),m=nt,m.setIndex(f)),l&&(p(o,i,r,c),null!==h&&J.bindBuffer(34963,f.buffer));var v=null!==h?h.count:u.count,g=i.drawRange.start*d,y=i.drawRange.count*d,x=null!==a?a.start*d:0,w=null!==a?a.count*d:1/0,_=Math.max(g,x),M=Math.min(v,g+y,x+w)-1,E=Math.max(0,M-_+1);if(0!==E){if(o.isMesh)r.wireframe===!0?(Ve.setLineWidth(r.wireframeLinewidth*t()),m.setMode(1)):m.setMode(4);else if(o.isLine){var T=r.linewidth;void 0===T&&(T=1),Ve.setLineWidth(T*t()),o.isLineSegments?m.setMode(1):o.isLineLoop?m.setMode(2):m.setMode(3)}else o.isPoints?m.setMode(0):o.isSprite&&m.setMode(4);o.isInstancedMesh?m.renderInstances(i,_,E,o.count):i.isInstancedBufferGeometry?m.renderInstances(i,_,E,i.maxInstancedCount):m.render(_,E)}},this.compile=function(e,t){Z=Ke.get(e,t),Z.init(),e.traverse(function(e){e.isLight&&(Z.pushLight(e),e.castShadow&&Z.pushShadow(e))}),Z.setupLights(t);var n={};e.traverse(function(t){if(t.material)if(Array.isArray(t.material))for(var i=0;i=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&J.readPixels(t,n,i,r,it.convert(h),it.convert(u),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{c&&J.bindFramebuffer(36160,ge)}}},this.copyFramebufferToTexture=function(e,t,n){void 0===n&&(n=0);var i=Math.pow(2,-n),r=Math.floor(t.image.width*i),o=Math.floor(t.image.height*i),a=it.convert(t.format);qe.setTexture2D(t,0),J.copyTexImage2D(3553,n,a,e.x,e.y,r,o,0),Ve.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i){var r=t.image.width,o=t.image.height,a=it.convert(n.format),s=it.convert(n.type);qe.setTexture2D(n,0),t.isDataTexture?J.texSubImage2D(3553,i||0,e.x,e.y,r,o,a,s,t.image.data):J.texSubImage2D(3553,i||0,e.x,e.y,a,s,t.image),Ve.unbindTexture()},this.initTexture=function(e){qe.setTexture2D(e,0),Ve.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Qt(e,t){this.name="",this.color=new w(e),this.density=void 0!==t?t:25e-5}function Kt(e,t,n){this.name="",this.color=new w(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function $t(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=yh,this.updateRange={offset:0,count:-1},this.version=0}function en(e,t,n,i){this.data=e,this.itemSize=t,this.offset=n,this.normalized=i===!0}function tn(e){S.call(this),this.type="SpriteMaterial",this.color=new w(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}function nn(e){if(p.call(this),this.type="Sprite",void 0===dm){dm=new F;var t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new $t(t,5);dm.setIndex([0,1,2,0,2,3]),dm.setAttribute("position",new en(i,3,0,(!1))),dm.setAttribute("uv",new en(i,2,3,(!1)))}this.geometry=dm,this.material=void 0!==e?e:new tn,this.center=new n(.5,.5)}function rn(e,t,n,i,r,o){vm.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(gm.x=o*vm.x-r*vm.y,gm.y=r*vm.x+o*vm.y):gm.copy(vm),e.copy(t),e.x+=gm.x,e.y+=gm.y,e.applyMatrix4(ym)}function on(){p.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function an(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),G.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new h,this.bindMatrixInverse=new h}function sn(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;nr.far)return;o.push({distance:h,distanceToRay:Math.sqrt(s),point:c,index:t,face:null,object:a})}}function gn(e,t,n,i,o,a,s,c,l){r.call(this,e,t,n,i,o,a,s,c,l),this.format=void 0!==s?s:Oc,this.minFilter=void 0!==a?a:mc,this.magFilter=void 0!==o?o:mc,this.generateMipmaps=!1}function yn(e,t,n,i,o,a,s,c,l,h,u,d){r.call(this,null,a,s,c,l,h,i,o,u,d),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function xn(e,t,n,i,o,a,s,c,l){r.call(this,e,t,n,i,o,a,s,c,l),this.needsUpdate=!0}function bn(e,t,n,i,o,a,s,c,l,h){if(h=void 0!==h?h:Bc,h!==Bc&&h!==Uc)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&h===Bc&&(n=Mc),void 0===n&&h===Uc&&(n=Pc),r.call(this,null,i,o,a,s,c,h,n,l),this.image={width:e,height:t},this.magFilter=void 0!==s?s:hc,this.minFilter=void 0!==c?c:hc,this.flipY=!1,this.generateMipmaps=!1}function wn(e){F.call(this),this.type="WireframeGeometry";var t,n,i,r,o,a,s,c,h,u,d=[],p=[0,0],f={},m=["a","b","c"];if(e&&e.isGeometry){var v=e.faces;for(t=0,i=v.length;t=0?(e(y-h,g,p),f.subVectors(d,p)):(e(y+h,g,p),f.subVectors(p,d)),g-h>=0?(e(y,g-h,p),m.subVectors(d,p)):(e(y,g+h,p),m.subVectors(p,d)),u.crossVectors(f,m).normalize(),s.push(u.x,u.y,u.z),c.push(y,g)}}for(i=0;i.9&&o<.1&&(t<.2&&(y[e+0]+=1),n<.2&&(y[e+2]+=1),i<.2&&(y[e+4]+=1))}}function u(e){g.push(e.x,e.y,e.z)}function d(t,n){var i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function p(){for(var e=new l,t=new l,i=new l,r=new l,o=new n,a=new n,s=new n,c=0,h=0;c0)for(o=t;o=t;o-=i)a=hi(o,e[o],e[o+1],a);return a&&ri(a,a.next)&&(ui(a),a=a.next),a}function Gn(e,t){if(!e)return e;t||(t=e);var n,i=e;do if(n=!1,i.steiner||!ri(i,i.next)&&0!==ii(i.prev,i,i.next))i=i.next;else{if(ui(i),i=t=i.prev,i===i.next)break;n=!0}while(n||i!==t);return t}function kn(e,t,n,i,r,o,a){if(e){!a&&o&&Qn(e,i,r,o);for(var s,c,l=e;e.prev!==e.next;)if(s=e.prev,c=e.next,o?jn(e,i,r,o):Vn(e))t.push(s.i/n),t.push(e.i/n),t.push(c.i/n),ui(e),e=c.next,l=c.next;else if(e=c,e===l){a?1===a?(e=Wn(e,t,n),kn(e,t,n,i,r,o,2)):2===a&&qn(e,t,n,i,r,o):kn(Gn(e),t,n,i,r,o,1);break}}}function Vn(e){var t=e.prev,n=e,i=e.next;if(ii(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(ti(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&ii(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function jn(e,t,n,i){var r=e.prev,o=e,a=e.next;if(ii(r,o,a)>=0)return!1;for(var s=r.xo.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,h=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,u=$n(s,c,t,n,i),d=$n(l,h,t,n,i),p=e.prevZ,f=e.nextZ;p&&p.z>=u&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&ti(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&ii(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&ti(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&ii(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&ti(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&ii(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&ti(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&ii(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Wn(e,t,n){var i=e;do{var r=i.prev,o=i.next.next;!ri(r,o)&&oi(r,i,i.next,o)&&si(r,o)&&si(o,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(o.i/n),ui(i),ui(i.next),i=e=o),i=i.next}while(i!==e);return i}function qn(e,t,n,i,r,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&ni(a,s)){var c=li(a,s);return a=Gn(a,a.next),c=Gn(c,c.next),kn(a,t,n,i,r,o),void kn(c,t,n,i,r,o)}s=s.next}a=a.next}while(a!==e)}function Xn(e,t,n,i){var r,o,a,s,c,l=[];for(r=0,o=t.length;r=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>a){if(a=s,s===r){if(o===i.y)return i;if(o===i.next.y)return i.next}n=i.x=i.x&&i.x>=h&&r!==i.x&&ti(on.x)&&si(i,e)&&(n=i,d=c)),i=i.next;return n}function Qn(e,t,n,i){var r=e;do null===r.z&&(r.z=$n(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,Kn(r)}function Kn(e){var t,n,i,r,o,a,s,c,l=1;do{for(n=e,e=null,o=null,a=0;n;){for(a++,i=n,s=0,t=0;t0||c>0&&i;)0!==s&&(0===c||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,c--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;n=i}o.nextZ=null,l*=2}while(a>1);return e}function $n(e,t,n,i,r){return e=32767*(e-n)*r,t=32767*(t-i)*r,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1}function ei(e){var t=e,n=e;do(t.x=0&&(e-a)*(i-s)-(n-a)*(t-s)>=0&&(n-a)*(o-s)-(r-a)*(i-s)>=0}function ni(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!ai(e,t)&&si(e,t)&&si(t,e)&&ci(e,t)}function ii(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ri(e,t){return e.x===t.x&&e.y===t.y}function oi(e,t,n,i){return!!(ri(e,n)&&ri(t,i)||ri(e,i)&&ri(n,t))||ii(e,t,n)>0!=ii(e,t,i)>0&&ii(n,i,e)>0!=ii(n,i,t)>0}function ai(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&&oi(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function si(e,t){return ii(e.prev,e,e.next)<0?ii(e,t,e.next)>=0&&ii(e,e.prev,t)>=0:ii(e,t,e.prev)<0||ii(e,e.next,t)<0}function ci(e,t){var n=e,i=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==e);return i}function li(e,t){var n=new di(e.i,e.x,e.y),i=new di(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function hi(e,t,n,i){var r=new di(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function ui(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 di(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}function pi(e,t,n,i){for(var r=0,o=t,a=n-i;o2&&e[t-1].equals(e[0])&&e.pop()}function mi(e,t){for(var n=0;nNumber.EPSILON){var p=Math.sqrt(u),f=Math.sqrt(l*l+h*h),m=t.x-c/p,v=t.y+s/p,g=i.x-h/f,y=i.y+l/f,x=((g-m)*h-(y-v)*l)/(s*h-c*l);r=m+s*x-e.x,o=v+c*x-e.y;var b=r*r+o*o;if(b<=2)return new n(r,o);a=Math.sqrt(b/2)}else{var w=!1;s>Number.EPSILON?l>Number.EPSILON&&(w=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(w=!0):Math.sign(c)===Math.sign(h)&&(w=!0),w?(r=-c,o=s,a=Math.sqrt(u)):(r=s,o=c,a=Math.sqrt(u/2))}return new n(r/a,o/a)}function c(){var e=o.length/3;if(w){var t=0,n=Z*t;for(K=0;K=0;){n=K,i=K-1,i<0&&(i=e.length-1);var r=0,o=x+2*T;for(r=0;r=0;V--){for(W=V/T,q=_*Math.cos(W*Math.PI/2),j=M*Math.sin(W*Math.PI/2)+E,K=0,$=k.length;K<$;K++)X=i(k[K],Q[K],j),d(X.x,X.y,b+q);for(N=0,z=U.length;N0)&&m.push(M,E,S),(c!==n-1||h0&&u(!0),t>0&&u(!1)),this.setIndex(p),this.setAttribute("position",new z(f,3)),this.setAttribute("normal",new z(m,3)),this.setAttribute("uv",new z(v,2))}function Oi(e,t,n,i,r,o,a){Pi.call(this,0,e,t,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function Di(e,t,n,i,r,o,a){Ii.call(this,0,e,t,n,i,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function Ni(e,t,n,i){j.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new zi(e,t,n,i)),this.mergeVertices()}function zi(e,t,i,r){F.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},e=e||1,t=void 0!==t?Math.max(3,t):8,i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI;var o,a,s=[],c=[],h=[],u=[],d=new l,p=new n;for(c.push(0,0,0),h.push(0,0,1),u.push(.5,.5),a=0,o=3;a<=t;a++,o+=3){var f=i+a/t*r;d.x=e*Math.cos(f),d.y=e*Math.sin(f),c.push(d.x,d.y,d.z),h.push(0,0,1),p.x=(c[o]/e+1)/2,p.y=(c[o+1]/e+1)/2,u.push(p.x,p.y)}for(o=1;o<=t;o++)s.push(o,o+1,0);this.setIndex(s),this.setAttribute("position",new z(c,3)),this.setAttribute("normal",new z(h,3)),this.setAttribute("uv",new z(u,2))}function Hi(e){S.call(this),this.type="ShadowMaterial",this.color=new w(0),this.transparent=!0,this.setValues(e)}function Bi(e){X.call(this,e),this.type="RawShaderMaterial"}function Ui(e){S.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new w(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 w(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=eh,this.normalScale=new n(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 Fi(e){Ui.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new n(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function Gi(e){S.call(this),this.type="MeshPhongMaterial",this.color=new w(16777215),this.specular=new w(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new w(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=eh,this.normalScale=new n(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=js,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 ki(e){S.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new w(16777215),this.specular=new w(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new w(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=eh,this.normalScale=new n(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,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 Vi(e){S.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=eh,this.normalScale=new n(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 ji(e){S.call(this),this.type="MeshLambertMaterial",this.color=new w(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new w(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=js,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 Wi(e){S.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new w(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=eh,this.normalScale=new n(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 qi(e){hn.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}function Xi(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 Yi(e,t,n,i){Xi.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Zi(e,t,n,i){Xi.call(this,e,t,n,i)}function Ji(e,t,n,i){Xi.call(this,e,t,n,i)}function Qi(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=Zm.convertArray(t,this.TimeBufferType),this.values=Zm.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}function Ki(e,t,n){Qi.call(this,e,t,n)}function $i(e,t,n,i){Qi.call(this,e,t,n,i)}function er(e,t,n,i){Qi.call(this,e,t,n,i)}function tr(e,t,n,i){Xi.call(this,e,t,n,i)}function nr(e,t,n,i){Qi.call(this,e,t,n,i)}function ir(e,t,n,i){Qi.call(this,e,t,n,i)}function rr(e,t,n,i){Qi.call(this,e,t,n,i)}function or(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=Ah.generateUUID(),this.duration<0&&this.resetDuration()}function ar(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return er;case"vector":case"vector2":case"vector3":case"vector4":return rr;case"color":return $i;case"quaternion":return nr;case"bool":case"boolean":return Ki;case"string":return ir}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function sr(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=ar(e.type);if(void 0===e.times){var n=[],i=[];Zm.flattenJSON(e.keys,n,i,"value"),e.times=n,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}function cr(e,t,n){var i=this,r=!1,o=0,a=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){a++,r===!1&&void 0!==i.onStart&&i.onStart(e,o,a),r=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,a),o===a&&(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 c.push(e,t),this},this.removeHandler=function(e){var t=c.indexOf(e);return t!==-1&&c.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=c.length;tQv-Jv?a=$v[r-Qv+Jv-1]:0==r&&(a=0),n.push(a);for(var s=1/(o-1),c=-s/2,l=1+s/2,h=[c,c,l,c,l,l,c,c,l,l,c,l],u=6,d=6,p=3,f=2,m=1,v=new Float32Array(p*d*u),g=new Float32Array(f*d*u),y=new Float32Array(m*d*u),x=0;x2?0:-1,_=[b,w,0,b+2/3,w,0,b+2/3,w+1,0,b,w,0,b+2/3,w+1,0,b,w+1,0];v.set(_,p*d*x),g.set(h,f*d*x);var M=[x,x,x,x,x,x];y.set(M,m*d*x)}var E=new F;E.setAttribute("position",new R(v,p)),E.setAttribute("uv",new R(g,f)),E.setAttribute("faceIndex",new R(y,m)),e.push(E),i>Jv&&i--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}function na(e){var t={magFilter:hc,minFilter:hc,generateMipmaps:!1,type:e?e.type:bc,format:e?e.format:Hc,encoding:e?e.encoding:Xl,depthBuffer:!1,stencilBuffer:!1},n=sa(t);return n.depthBuffer=!e,ug=sa(t),n}function ia(e){ug.dispose(),dg.setRenderTarget(pg),e.scissorTest=!1,e.setSize(e.width,e.height)}function ra(e,t,n,i){var r=90,o=1,a=new Z(r,o,t,n),s=[1,1,1,1,-1,1],c=[1,1,-1,-1,-1,1],l=dg.outputEncoding,h=dg.toneMapping,u=dg.toneMappingExposure,d=dg.getClearColor(),p=dg.getClearAlpha();dg.toneMapping=Ys,dg.toneMappingExposure=1,dg.outputEncoding=jl,e.scale.z*=-1;var f=e.background;if(f&&f.isColor){f.convertSRGBToLinear();var m=Math.max(f.r,f.g,f.b),v=Math.min(Math.max(Math.ceil(Math.log2(m)),-128),127);f=f.multiplyScalar(Math.pow(2,-v));var g=(v+128)/255;dg.setClearColor(f,g),e.background=null}for(var y=0;y<6;y++){var x=y%3;0==x?(a.up.set(0,s[y],0),a.lookAt(c[y],0,0)):1==x?(a.up.set(0,0,s[y]),a.lookAt(0,c[y],0)):(a.up.set(0,s[y],0),a.lookAt(0,0,c[y])),ca(i,x*Kv,y>2?Kv:0,Kv,Kv),dg.setRenderTarget(i),dg.render(e,a)}dg.toneMapping=h,dg.toneMappingExposure=u,dg.outputEncoding=l,dg.setClearColor(d,p),e.scale.z*=-1}function oa(e,t){var n=new f;e.isCubeTexture?null==ag&&(ag=fa()):null==og&&(og=pa());var i=e.isCubeTexture?ag:og;n.add(new G(cg[0],i));var r=i.uniforms;r.envMap.value=e,e.isCubeTexture||r.texelSize.value.set(1/e.image.width,1/e.image.height),r.inputEncoding.value=ng[e.encoding],r.outputEncoding.value=ng[e.encoding],ca(t,0,0,3*Kv,2*Kv),dg.setRenderTarget(t),dg.render(n,ig)}function aa(e){var t=new f;t.add(new G(cg[0],e)),dg.compile(t,ig)}function sa(e){var t=new a(3*Kv,3*Kv,e);return t.texture.mapping=oc,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function ca(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function la(e){var t=dg.autoClear;dg.autoClear=!1;for(var n=1;ntg&&console.warn("sigmaRadians, "+r+", is too large and will clip, as it requested "+p+" samples when the maximum is set to "+tg);for(var m=[],v=0,g=0;gQv-Jv?i-Qv+Jv:0);ca(t,y,w,3*b,2*b),dg.setRenderTarget(t),dg.render(c,ig)}function da(e){var t=new Float32Array(e),n=new l(0,1,0),i=new Bi({defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:ng[jl]},outputEncoding:{value:ng[jl]}},vertexShader:ma(),fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n"+va()+"\n\n#define ENVMAP_TYPE_CUBE_UV\n#include \n\nvec3 getSample(float theta, vec3 axis) {\n\tfloat cosTheta = cos(theta);\n\t// Rodrigues' axis-angle rotation\n\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t+ cross(axis, vOutputDirection) * sin(theta)\n\t\t+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n\treturn bilinearCubeUV(envMap, sampleDirection, mipInt);\n}\n\nvoid main() {\n\tvec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n\tif (all(equal(axis, vec3(0.0))))\n\t\taxis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x);\n\taxis = normalize(axis);\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb += weights[0] * getSample(0.0, axis);\n\tfor (int i = 1; i < n; i++) {\n\t\tif (i >= samples)\n\t\t\tbreak;\n\t\tfloat theta = dTheta * float(i);\n\t\tgl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis);\n\t\tgl_FragColor.rgb += weights[i] * getSample(theta, axis);\n\t}\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:fs,depthTest:!1,depthWrite:!1});return i.type="SphericalGaussianBlur",i}function pa(){var e=new n(1,1),t=new Bi({uniforms:{envMap:{value:null},texelSize:{value:e},inputEncoding:{value:ng[jl]},outputEncoding:{value:ng[jl]}},vertexShader:ma(),fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n"+va()+"\n\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tvec3 outputDirection = normalize(vOutputDirection);\n\tvec2 uv;\n\tuv.y = asin(clamp(outputDirection.y, -1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n\tuv.x = atan(outputDirection.z, outputDirection.x) * RECIPROCAL_PI2 + 0.5;\n\tvec2 f = fract(uv / texelSize - 0.5);\n\tuv -= f * texelSize;\n\tvec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x += texelSize.x;\n\tvec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.y += texelSize.y;\n\tvec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x -= texelSize.x;\n\tvec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tvec3 tm = mix(tl, tr, f.x);\n\tvec3 bm = mix(bl, br, f.x);\n\tgl_FragColor.rgb = mix(tm, bm, f.y);\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:fs,depthTest:!1,depthWrite:!1});return t.type="EquirectangularToCubeUV",t}function fa(){var e=new Bi({uniforms:{envMap:{value:null},inputEncoding:{value:ng[jl]},outputEncoding:{value:ng[jl]}},vertexShader:ma(),fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n"+va()+"\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:fs,depthTest:!1,depthWrite:!1});return e.type="CubemapToCubeUV",e}function ma(){return"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.x *= -1.0;\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.y *= -1.0;\n\t} else if (face == 5.0) {\n\t\tdirection.xz *= -1.0;\n\t}\n\treturn direction;\n}\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t"}function va(){return"\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include \n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t"}function ga(e,t,n,i,r,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new T(e,t,n,r,o,a)}function ya(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e}function xa(e){return void 0===e&&(e=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e}function ba(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new mn(e,t)}function wa(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new nn(e)}function _a(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new mn(e,t)}function Ma(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new fn(e)}function Ea(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new fn(e)}function Ta(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new fn(e)}function Sa(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new l(e,t,n)}function La(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new R(e,t).setUsage(xh)}function Ra(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new A(e,t)}function Aa(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new C(e,t)}function Ca(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new P(e,t)}function Pa(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new I(e,t)}function Ia(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new O(e,t)}function Oa(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new D(e,t)}function Da(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new N(e,t)}function Na(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new z(e,t)}function za(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new H(e,t)}function Ha(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),wr.call(this,e),this.type="catmullrom",this.closed=!0}function Ba(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),wr.call(this,e),this.type="catmullrom"}function Ua(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),wr.call(this,e),this.type="catmullrom"}function Fa(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new $o(e)}function Ga(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Zo(e,t)}function ka(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new dn(new Ci(e.geometry),new hn({color:void 0!==t?t:16777215}))}function Va(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new dn(new wn(e.geometry),new hn({color:void 0!==t?t:16777215}))}function ja(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new hr(e)}function Wa(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new pr(e)}function qa(e,t,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Q(e,n)}function Xa(){console.error("THREE.CanvasRenderer has been removed")}function Ya(){console.error("THREE.JSONLoader has been removed.")}function Za(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n>8&255]+Lh[e>>16&255]+Lh[e>>24&255]+"-"+Lh[255&t]+Lh[t>>8&255]+"-"+Lh[t>>16&15|64]+Lh[t>>24&255]+"-"+Lh[63&n|128]+Lh[n>>8&255]+"-"+Lh[n>>16&255]+Lh[n>>24&255]+Lh[255&i]+Lh[i>>8&255]+Lh[i>>16&255]+Lh[i>>24&255];return r.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:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*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())},degToRad:function(e){return e*Ah.DEG2RAD},radToDeg:function(e){return e*Ah.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 o=Math.cos,a=Math.sin,s=o(n/2),c=a(n/2),l=o((t+i)/2),h=a((t+i)/2),u=o((t-i)/2),d=a((t-i)/2),p=o((i-t)/2),f=a((i-t)/2); +"XYX"===r?e.set(s*h,c*u,c*d,s*l):"YZY"===r?e.set(c*d,s*h,c*u,s*l):"ZXZ"===r?e.set(c*u,c*d,s*h,s*l):"XZX"===r?e.set(s*h,c*f,c*p,s*l):"YXY"===r?e.set(c*p,s*h,c*f,s*l):"ZYZ"===r?e.set(c*f,c*p,s*h,s*l):console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.")}};Object.defineProperties(n.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(n.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent: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},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add: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)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub: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)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp: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},clampScalar: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},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero: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},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(-this.y,-this.x)+Math.PI;return e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute: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},rotateAround:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*n-o*i+e.x,this.y=r*i+o*n+e.y,this}}),Object.assign(i.prototype,{isMatrix3:!0,set:function(e,t,n,i,r,o,a,s,c){var l=this.elements;return l[0]=e,l[1]=i,l[2]=a,l[3]=t,l[4]=r,l[5]=s,l[6]=n,l[7]=o,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},extractBasis:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[3],s=n[6],c=n[1],l=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=i[0],m=i[3],v=i[6],g=i[1],y=i[4],x=i[7],b=i[2],w=i[5],_=i[8];return r[0]=o*f+a*g+s*b,r[3]=o*m+a*y+s*w,r[6]=o*v+a*x+s*_,r[1]=c*f+l*g+h*b,r[4]=c*m+l*y+h*w,r[7]=c*v+l*x+h*_,r[2]=u*f+d*g+p*b,r[5]=u*m+d*y+p*w,r[8]=u*v+d*x+p*_,this},multiplyScalar: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},determinant:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],s=e[6],c=e[7],l=e[8];return t*o*l-t*a*c-n*r*l+n*a*s+i*r*c-i*o*s},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var n=e.elements,i=this.elements,r=n[0],o=n[1],a=n[2],s=n[3],c=n[4],l=n[5],h=n[6],u=n[7],d=n[8],p=d*c-l*u,f=l*h-d*s,m=u*s-c*h,v=r*p+o*f+a*m;if(0===v)return this.set(0,0,0,0,0,0,0,0,0);var g=1/v;return i[0]=p*g,i[1]=(a*u-d*o)*g,i[2]=(l*o-a*c)*g,i[3]=f*g,i[4]=(d*r-a*h)*g,i[5]=(a*s-l*r)*g,i[6]=m*g,i[7]=(o*h-u*r)*g,i[8]=(c*r-o*s)*g,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray: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},setUvTransform:function(e,t,n,i,r,o,a){var s=Math.cos(r),c=Math.sin(r);this.set(n*s,n*c,-n*(s*o+c*a)+o+e,-i*c,i*s,-i*(-c*o+s*a)+a+t,0,0,1)},scale: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},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],o=i[3],a=i[6],s=i[1],c=i[4],l=i[7];return i[0]=t*r+n*s,i[3]=t*o+n*c,i[6]=t*a+n*l,i[1]=-n*r+t*s,i[4]=-n*o+t*c,i[7]=-n*a+t*l,this},translate: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},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var 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}});var Ch,Ph={getDataURL:function(e){var t;if("undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Ch&&(Ch=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Ch.width=e.width,Ch.height=e.height;var n=Ch.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Ch}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},Ih=0;r.DEFAULT_IMAGE=void 0,r.DEFAULT_MAPPING=$s,r.prototype=Object.assign(Object.create(t.prototype),{constructor:r,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=Ah.generateUUID()),!t&&void 0===e.images[i.uuid]){var r;if(Array.isArray(i)){r=[];for(var o=0,a=i.length;o1)switch(this.wrapS){case sc:e.x=e.x-Math.floor(e.x);break;case cc:e.x=e.x<0?0:1;break;case lc: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||e.y>1)switch(this.wrapT){case sc:e.y=e.y-Math.floor(e.y);break;case cc:e.y=e.y<0?0:1;break;case lc: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(r.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}}),Object.defineProperties(o.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(o.prototype,{isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent: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},getComponent: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)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy: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},add: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)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors: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},addScaledVector: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},sub: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)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors: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},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion: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},setAxisAngleFromRotationMatrix:function(e){var t,n,i,r,o=.01,a=.1,s=e.elements,c=s[0],l=s[4],h=s[8],u=s[1],d=s[5],p=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(l-u)y&&g>x?gx?y=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,a=Math.sin(a*b)/x}var w=a*g;if(s=s*m+u*w,c=c*m+d*w,l=l*m+p*w,h=h*m+f*w,m===1-a){var _=1/Math.sqrt(s*s+c*c+l*l+h*h);s*=_,c*=_,l*=_,h*=_}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=h}}),Object.defineProperties(c.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(c.prototype,{isQuaternion:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler: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,o=e.order,a=Math.cos,s=Math.sin,c=a(n/2),l=a(i/2),h=a(r/2),u=s(n/2),d=s(i/2),p=s(r/2);return"XYZ"===o?(this._x=u*l*h+c*d*p,this._y=c*d*h-u*l*p,this._z=c*l*p+u*d*h,this._w=c*l*h-u*d*p):"YXZ"===o?(this._x=u*l*h+c*d*p,this._y=c*d*h-u*l*p,this._z=c*l*p-u*d*h,this._w=c*l*h+u*d*p):"ZXY"===o?(this._x=u*l*h-c*d*p,this._y=c*d*h+u*l*p,this._z=c*l*p+u*d*h,this._w=c*l*h-u*d*p):"ZYX"===o?(this._x=u*l*h-c*d*p,this._y=c*d*h+u*l*p,this._z=c*l*p-u*d*h,this._w=c*l*h+u*d*p):"YZX"===o?(this._x=u*l*h+c*d*p,this._y=c*d*h+u*l*p,this._z=c*l*p-u*d*h,this._w=c*l*h-u*d*p):"XZY"===o&&(this._x=u*l*h-c*d*p,this._y=c*d*h-u*l*p,this._z=c*l*p+u*d*h,this._w=c*l*h+u*d*p),t!==!1&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,i=n[0],r=n[4],o=n[8],a=n[1],s=n[5],c=n[9],l=n[2],h=n[6],u=n[10],d=i+s+u;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(h-c)*t,this._y=(o-l)*t,this._z=(a-r)*t):i>s&&i>u?(t=2*Math.sqrt(1+i-s-u),this._w=(h-c)/t,this._x=.25*t,this._y=(r+a)/t,this._z=(o+l)/t):s>u?(t=2*Math.sqrt(1+s-i-u),this._w=(o-l)/t,this._x=(r+a)/t,this._y=.25*t,this._z=(c+h)/t):(t=2*Math.sqrt(1+u-i-s),this._w=(a-r)/t,this._x=(o+l)/t,this._y=(c+h)/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=1e-6,i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(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=i),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(Ah.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},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):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},multiply: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)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,o=e._w,a=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+o*a+i*c-r*s,this._y=i*l+o*s+r*a-n*c,this._z=r*l+o*c+n*s-i*a,this._w=o*l-n*a-i*s-r*c,this._onChangeCallback(),this},slerp: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,o=this._w,a=o*e._w+n*e._x+i*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;var s=1-a*a;if(s<=Number.EPSILON){var c=1-t;return this._w=c*o+t*this._w,this._x=c*n+t*this._x,this._y=c*i+t*this._y,this._z=c*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),h=Math.atan2(l,a),u=Math.sin((1-t)*h)/l,d=Math.sin(t*h)/l;return this._w=o*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=r*u+this._z*d,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute: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},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var Oh=new l,Dh=new c;Object.assign(l.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent: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},getComponent: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)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add: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)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub: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)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply: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)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Dh.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(Dh.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,o=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])*o,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*o,this},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,o=e.y,a=e.z,s=e.w,c=s*t+o*i-a*n,l=s*n+a*t-r*i,h=s*i+r*n-o*t,u=-r*t-o*n-a*i;return this.x=c*s+u*-r+l*-a-h*-o,this.y=l*s+u*-o+h*-r-c*-a,this.z=h*s+u*-a+c*-o-l*-r,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min: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},max: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},clamp: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},clampScalar: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},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero: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},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp: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},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross: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)},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,o=t.x,a=t.y,s=t.z;return this.x=i*s-r*a,this.y=r*o-n*s,this.z=n*a-i*o,this},projectOnVector:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return Oh.copy(this).projectOnVector(e),this.sub(Oh)},reflect:function(e){return this.sub(Oh.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(Ah.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords: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},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,3*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute: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}});var Nh=new l,zh=new h,Hh=new l(0,0,0),Bh=new l(1,1,1),Uh=new l,Fh=new l,Gh=new l;Object.assign(h.prototype,{isMatrix4:!0,set:function(e,t,n,i,r,o,a,s,c,l,h,u,d,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]=o,v[9]=a,v[13]=s,v[2]=c,v[6]=l,v[10]=h,v[14]=u,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new h).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis: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}, +extractRotation:function(e){var t=this.elements,n=e.elements,i=1/Nh.setFromMatrixColumn(e,0).length(),r=1/Nh.setFromMatrixColumn(e,1).length(),o=1/Nh.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]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,i=e.y,r=e.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(i),c=Math.sin(i),l=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){var u=o*l,d=o*h,p=a*l,f=a*h;t[0]=s*l,t[4]=-s*h,t[8]=c,t[1]=d+p*c,t[5]=u-f*c,t[9]=-a*s,t[2]=f-u*c,t[6]=p+d*c,t[10]=o*s}else if("YXZ"===e.order){var m=s*l,v=s*h,g=c*l,y=c*h;t[0]=m+y*a,t[4]=g*a-v,t[8]=o*c,t[1]=o*h,t[5]=o*l,t[9]=-a,t[2]=v*a-g,t[6]=y+m*a,t[10]=o*s}else if("ZXY"===e.order){var m=s*l,v=s*h,g=c*l,y=c*h;t[0]=m-y*a,t[4]=-o*h,t[8]=g+v*a,t[1]=v+g*a,t[5]=o*l,t[9]=y-m*a,t[2]=-o*c,t[6]=a,t[10]=o*s}else if("ZYX"===e.order){var u=o*l,d=o*h,p=a*l,f=a*h;t[0]=s*l,t[4]=p*c-d,t[8]=u*c+f,t[1]=s*h,t[5]=f*c+u,t[9]=d*c-p,t[2]=-c,t[6]=a*s,t[10]=o*s}else if("YZX"===e.order){var x=o*s,b=o*c,w=a*s,_=a*c;t[0]=s*l,t[4]=_-x*h,t[8]=w*h+b,t[1]=h,t[5]=o*l,t[9]=-a*l,t[2]=-c*l,t[6]=b*h+w,t[10]=x-_*h}else if("XZY"===e.order){var x=o*s,b=o*c,w=a*s,_=a*c;t[0]=s*l,t[4]=-h,t[8]=c*l,t[1]=x*h+_,t[5]=o*l,t[9]=b*h-w,t[2]=w*h-b,t[6]=a*l,t[10]=_*h+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(Hh,e,Bh)},lookAt:function(e,t,n){var i=this.elements;return Gh.subVectors(e,t),0===Gh.lengthSq()&&(Gh.z=1),Gh.normalize(),Uh.crossVectors(n,Gh),0===Uh.lengthSq()&&(1===Math.abs(n.z)?Gh.x+=1e-4:Gh.z+=1e-4,Gh.normalize(),Uh.crossVectors(n,Gh)),Uh.normalize(),Fh.crossVectors(Gh,Uh),i[0]=Uh.x,i[4]=Fh.x,i[8]=Gh.x,i[1]=Uh.y,i[5]=Fh.y,i[9]=Gh.y,i[2]=Uh.z,i[6]=Fh.z,i[10]=Gh.z,this},multiply: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)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[4],s=n[8],c=n[12],l=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],x=n[11],b=n[15],w=i[0],_=i[4],M=i[8],E=i[12],T=i[1],S=i[5],L=i[9],R=i[13],A=i[2],C=i[6],P=i[10],I=i[14],O=i[3],D=i[7],N=i[11],z=i[15];return r[0]=o*w+a*T+s*A+c*O,r[4]=o*_+a*S+s*C+c*D,r[8]=o*M+a*L+s*P+c*N,r[12]=o*E+a*R+s*I+c*z,r[1]=l*w+h*T+u*A+d*O,r[5]=l*_+h*S+u*C+d*D,r[9]=l*M+h*L+u*P+d*N,r[13]=l*E+h*R+u*I+d*z,r[2]=p*w+f*T+m*A+v*O,r[6]=p*_+f*S+m*C+v*D,r[10]=p*M+f*L+m*P+v*N,r[14]=p*E+f*R+m*I+v*z,r[3]=g*w+y*T+x*A+b*O,r[7]=g*_+y*S+x*C+b*D,r[11]=g*M+y*L+x*P+b*N,r[15]=g*E+y*R+x*I+b*z,this},multiplyScalar: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},determinant:function(){var e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],o=e[1],a=e[5],s=e[9],c=e[13],l=e[2],h=e[6],u=e[10],d=e[14],p=e[3],f=e[7],m=e[11],v=e[15];return p*(+r*s*h-i*c*h-r*a*u+n*c*u+i*a*d-n*s*d)+f*(+t*s*d-t*c*u+r*o*u-i*o*d+i*c*l-r*s*l)+m*(+t*c*h-t*a*d-r*o*h+n*o*d+r*a*l-n*c*l)+v*(-i*a*l-t*s*h+t*a*u+i*o*h-n*o*u+n*s*l)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition: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},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var n=this.elements,i=e.elements,r=i[0],o=i[1],a=i[2],s=i[3],c=i[4],l=i[5],h=i[6],u=i[7],d=i[8],p=i[9],f=i[10],m=i[11],v=i[12],g=i[13],y=i[14],x=i[15],b=p*y*u-g*f*u+g*h*m-l*y*m-p*h*x+l*f*x,w=v*f*u-d*y*u-v*h*m+c*y*m+d*h*x-c*f*x,_=d*g*u-v*p*u+v*l*m-c*g*m-d*l*x+c*p*x,M=v*p*h-d*g*h-v*l*f+c*g*f+d*l*y-c*p*y,E=r*b+o*w+a*_+s*M;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var T=1/E;return n[0]=b*T,n[1]=(g*f*s-p*y*s-g*a*m+o*y*m+p*a*x-o*f*x)*T,n[2]=(l*y*s-g*h*s+g*a*u-o*y*u-l*a*x+o*h*x)*T,n[3]=(p*h*s-l*f*s-p*a*u+o*f*u+l*a*m-o*h*m)*T,n[4]=w*T,n[5]=(d*y*s-v*f*s+v*a*m-r*y*m-d*a*x+r*f*x)*T,n[6]=(v*h*s-c*y*s-v*a*u+r*y*u+c*a*x-r*h*x)*T,n[7]=(c*f*s-d*h*s+d*a*u-r*f*u-c*a*m+r*h*m)*T,n[8]=_*T,n[9]=(v*p*s-d*g*s-v*o*m+r*g*m+d*o*x-r*p*x)*T,n[10]=(c*g*s-v*l*s+v*o*u-r*g*u-c*o*x+r*l*x)*T,n[11]=(d*l*s-c*p*s-d*o*u+r*p*u+c*o*m-r*l*m)*T,n[12]=M*T,n[13]=(d*g*a-v*p*a+v*o*f-r*g*f-d*o*y+r*p*y)*T,n[14]=(v*l*a-c*g*a-v*o*h+r*g*h+c*o*y-r*l*y)*T,n[15]=(c*p*a-d*l*a+d*o*h-r*p*h-c*o*f+r*l*f)*T,this},scale:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this},getMaxScaleOnAxis: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],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=1-n,o=e.x,a=e.y,s=e.z,c=r*o,l=r*a;return this.set(c*o+n,c*a-i*s,c*s+i*a,0,c*a+i*s,l*a+n,l*s-i*o,0,c*s-i*a,l*s+i*o,r*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var i=this.elements,r=t._x,o=t._y,a=t._z,s=t._w,c=r+r,l=o+o,h=a+a,u=r*c,d=r*l,p=r*h,f=o*l,m=o*h,v=a*h,g=s*c,y=s*l,x=s*h,b=n.x,w=n.y,_=n.z;return i[0]=(1-(f+v))*b,i[1]=(d+x)*b,i[2]=(p-y)*b,i[3]=0,i[4]=(d-x)*w,i[5]=(1-(u+v))*w,i[6]=(m+g)*w,i[7]=0,i[8]=(p+y)*_,i[9]=(m-g)*_,i[10]=(1-(u+f))*_,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this},decompose:function(e,t,n){var i=this.elements,r=Nh.set(i[0],i[1],i[2]).length(),o=Nh.set(i[4],i[5],i[6]).length(),a=Nh.set(i[8],i[9],i[10]).length(),s=this.determinant();s<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],zh.copy(this);var c=1/r,l=1/o,h=1/a;return zh.elements[0]*=c,zh.elements[1]*=c,zh.elements[2]*=c,zh.elements[4]*=l,zh.elements[5]*=l,zh.elements[6]*=l,zh.elements[8]*=h,zh.elements[9]*=h,zh.elements[10]*=h,t.setFromRotationMatrix(zh),n.x=r,n.y=o,n.z=a,this},makePerspective:function(e,t,n,i,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements,s=2*r/(t-e),c=2*r/(n-i),l=(t+e)/(t-e),h=(n+i)/(n-i),u=-(o+r)/(o-r),d=-2*o*r/(o-r);return a[0]=s,a[4]=0,a[8]=l,a[12]=0,a[1]=0,a[5]=c,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(e,t,n,i,r,o){var a=this.elements,s=1/(t-e),c=1/(n-i),l=1/(o-r),h=(t+e)*s,u=(n+i)*c,d=(o+r)*l;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*l,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var 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}});var kh=new h,Vh=new c;u.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],u.DefaultOrder="XYZ",Object.defineProperties(u.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(u.prototype,{isEuler:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._order=i||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var i=Ah.clamp,r=e.elements,o=r[0],a=r[4],s=r[8],c=r[1],l=r[5],h=r[9],u=r[2],d=r[6],p=r[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(d,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-i(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,o),this._z=0)):"ZXY"===t?(this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,o))):"ZYX"===t?(this._y=Math.asin(-i(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-a,l))):"YZX"===t?(this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,o)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===t?(this._z=Math.asin(-i(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-h,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,n!==!1&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return kh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(kh,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return Vh.setFromEuler(this),this.setFromQuaternion(Vh,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray: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},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new l(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(d.prototype,{set:function(e){this.mask=1<1){for(var t=0;t1){for(var t=0;t0){o.children=[];for(var c=0;c0&&(r.geometries=d),p.length>0&&(r.materials=p),f.length>0&&(r.textures=f),m.length>0&&(r.images=m),s.length>0&&(r.shapes=s)}return r.object=o,r},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),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)),t===!0)for(var n=0;nr&&(r=l),h>o&&(o=h),u>a&&(a=u)}return this.min.set(t,n,i),this.max.set(r,o,a),this},setFromBufferAttribute:function(e){for(var t=+(1/0),n=+(1/0),i=+(1/0),r=-(1/0),o=-(1/0),a=-(1/0),s=0,c=e.count;sr&&(r=l),h>o&&(o=h),u>a&&(a=u)}return this.min.set(t,n,i),this.max.set(r,o,a),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox: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},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new l),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))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,ru),ru.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(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),e.normal.z>0?(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},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(du),pu.subVectors(this.max,du),au.subVectors(e.a,du),su.subVectors(e.b,du),cu.subVectors(e.c,du),lu.subVectors(su,au),hu.subVectors(cu,su),uu.subVectors(au,cu);var t=[0,-lu.z,lu.y,0,-hu.z,hu.y,0,-uu.z,uu.y,lu.z,0,-lu.x,hu.z,0,-hu.x,uu.z,0,-uu.x,-lu.y,lu.x,0,-hu.y,hu.x,0,-uu.y,uu.x,0];return!!v(t,au,su,cu,pu)&&(t=[1,0,0,0,1,0,0,0,1],!!v(t,au,su,cu,pu)&&(fu.crossVectors(lu,hu),t=[fu.x,fu.y,fu.z],v(t,au,su,cu,pu)))},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new l),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){var t=ru.copy(e).clamp(this.min,this.max);return t.sub(e).length()},getBoundingSphere:function(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(ru).length(),e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()?this:(iu[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),iu[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),iu[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),iu[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),iu[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),iu[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),iu[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),iu[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(iu),this)},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var vu=new m;Object.assign(g.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;void 0!==t?n.copy(t):vu.setFromPoints(e).getCenter(n);for(var i=0,r=0,o=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new m),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var gu=new l,yu=new l,xu=new l,bu=new l,wu=new l,_u=new l,Mu=new l;Object.assign(y.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new l),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,gu)),this},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new l),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=gu.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(gu.copy(this.direction).multiplyScalar(t).add(this.origin),gu.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,i){yu.copy(e).add(t).multiplyScalar(.5),xu.copy(t).sub(e).normalize(),bu.copy(this.origin).sub(yu);var r,o,a,s,c=.5*e.distanceTo(t),l=-this.direction.dot(xu),h=bu.dot(this.direction),u=-bu.dot(xu),d=bu.lengthSq(),p=Math.abs(1-l*l);if(p>0)if(r=l*u-h,o=l*h-u,s=c*p,r>=0)if(o>=-s)if(o<=s){var f=1/p;r*=f,o*=f,a=r*(r+l*o+2*h)+o*(l*r+o+2*u)+d}else o=c,r=Math.max(0,-(l*o+h)),a=-r*r+o*(o+2*u)+d;else o=-c,r=Math.max(0,-(l*o+h)),a=-r*r+o*(o+2*u)+d;else o<=-s?(r=Math.max(0,-(-l*c+h)),o=r>0?-c:Math.min(Math.max(-c,-u),c),a=-r*r+o*(o+2*u)+d):o<=s?(r=0,o=Math.min(Math.max(-c,-u),c),a=o*(o+2*u)+d):(r=Math.max(0,-(l*c+h)),o=r>0?c:Math.min(Math.max(-c,-u),c),a=-r*r+o*(o+2*u)+d);else o=l>0?-c:c,r=Math.max(0,-(l*o+h)),a=-r*r+o*(o+2*u)+d;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(xu).multiplyScalar(o).add(yu),a},intersectSphere:function(e,t){gu.subVectors(e.center,this.origin);var n=gu.dot(this.direction),i=gu.dot(gu)-n*n,r=e.radius*e.radius;if(i>r)return null;var o=Math.sqrt(r-i),a=n-o,s=n+o;return a<0&&s<0?null:a<0?this.at(s,t):this.at(a,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var n=e.normal.dot(this.direction);return n*t<0},intersectBox:function(e,t){var n,i,r,o,a,s,c=1/this.direction.x,l=1/this.direction.y,h=1/this.direction.z,u=this.origin;return c>=0?(n=(e.min.x-u.x)*c,i=(e.max.x-u.x)*c):(n=(e.max.x-u.x)*c,i=(e.min.x-u.x)*c),l>=0?(r=(e.min.y-u.y)*l,o=(e.max.y-u.y)*l):(r=(e.max.y-u.y)*l,o=(e.min.y-u.y)*l),n>o||r>i?null:((r>n||n!==n)&&(n=r),(o=0?(a=(e.min.z-u.z)*h,s=(e.max.z-u.z)*h):(a=(e.max.z-u.z)*h,s=(e.min.z-u.z)*h),n>s||a>i?null:((a>n||n!==n)&&(n=a),(s=0?n:i,t)))},intersectsBox:function(e){return null!==this.intersectBox(e,gu)},intersectTriangle:function(e,t,n,i,r){wu.subVectors(t,e),_u.subVectors(n,e),Mu.crossVectors(wu,_u);var o,a=this.direction.dot(Mu);if(a>0){if(i)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}bu.subVectors(this.origin,e);var s=o*this.direction.dot(_u.crossVectors(bu,_u));if(s<0)return null;var c=o*this.direction.dot(wu.cross(bu));if(c<0)return null;if(s+c>a)return null;var l=-o*bu.dot(Mu);return l<0?null:this.at(l/a,r)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var Eu=new l,Tu=new l,Su=new i;Object.assign(x.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var i=Eu.subVectors(n,t).cross(Tu.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new l),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"), +t=new l);var n=e.delta(Eu),i=this.normal.dot(n);if(0!==i){var r=-(e.start.dot(this.normal)+this.constant)/i;if(!(r<0||r>1))return t.copy(n).multiplyScalar(r).add(e.start)}else if(0===this.distanceToPoint(e.start))return t.copy(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new l),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||Su.getNormalMatrix(e),i=this.coplanarPoint(Eu).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var Lu=new l,Ru=new l,Au=new l,Cu=new l,Pu=new l,Iu=new l,Ou=new l,Du=new l,Nu=new l,zu=new l;Object.assign(b,{getNormal:function(e,t,n,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new l),i.subVectors(n,t),Lu.subVectors(e,t),i.cross(Lu);var r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)},getBarycoord:function(e,t,n,i,r){Lu.subVectors(i,t),Ru.subVectors(n,t),Au.subVectors(e,t);var o=Lu.dot(Lu),a=Lu.dot(Ru),s=Lu.dot(Au),c=Ru.dot(Ru),h=Ru.dot(Au),u=o*c-a*a;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new l),0===u)return r.set(-2,-1,-1);var d=1/u,p=(c*s-a*h)*d,f=(o*h-a*s)*d;return r.set(1-p-f,f,p)},containsPoint:function(e,t,n,i){return b.getBarycoord(e,t,n,i,Cu),Cu.x>=0&&Cu.y>=0&&Cu.x+Cu.y<=1},getUV:function(e,t,n,i,r,o,a,s){return this.getBarycoord(e,t,n,i,Cu),s.set(0,0),s.addScaledVector(r,Cu.x),s.addScaledVector(o,Cu.y),s.addScaledVector(a,Cu.z),s},isFrontFacing:function(e,t,n,i){return Lu.subVectors(n,t),Ru.subVectors(e,t),Lu.cross(Ru).dot(i)<0}}),Object.assign(b.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return Lu.subVectors(this.c,this.b),Ru.subVectors(this.a,this.b),.5*Lu.cross(Ru).length()},getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new l),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return b.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new x),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return b.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,i,r){return b.getUV(e,this.a,this.b,this.c,t,n,i,r)},containsPoint:function(e){return b.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return b.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new l);var n,i,r=this.a,o=this.b,a=this.c;Pu.subVectors(o,r),Iu.subVectors(a,r),Du.subVectors(e,r);var s=Pu.dot(Du),c=Iu.dot(Du);if(s<=0&&c<=0)return t.copy(r);Nu.subVectors(e,o);var h=Pu.dot(Nu),u=Iu.dot(Nu);if(h>=0&&u<=h)return t.copy(o);var d=s*u-h*c;if(d<=0&&s>=0&&h<=0)return n=s/(s-h),t.copy(r).addScaledVector(Pu,n);zu.subVectors(e,a);var p=Pu.dot(zu),f=Iu.dot(zu);if(f>=0&&p<=f)return t.copy(a);var m=p*c-s*f;if(m<=0&&c>=0&&f<=0)return i=c/(c-f),t.copy(r).addScaledVector(Iu,i);var v=h*f-p*u;if(v<=0&&u-h>=0&&p-f>=0)return Ou.subVectors(a,o),i=(u-h)/(u-h+(p-f)),t.copy(o).addScaledVector(Ou,i);var g=1/(v+m+d);return n=m*g,i=d*g,t.copy(r).addScaledVector(Pu,n).addScaledVector(Iu,i)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var Hu={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},Bu={h:0,s:0,l:0},Uu={h:0,s:0,l:0};Object.assign(w.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex: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},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=Ah.euclideanModulo(e,1),t=Ah.clamp(t,0,1),n=Ah.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=_(r,i,e+1/3),this.g=_(r,i,e),this.b=_(r,i,e-1/3)}return this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[1],o=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(a,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l=n[1],h=l.length;if(3===h)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=Hu[e];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=M(e.r),this.g=M(e.g),this.b=M(e.b),this},copyLinearToSRGB:function(e){return this.r=E(e.r),this.g=E(e.g),this.b=E(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,i=this.r,r=this.g,o=this.b,a=Math.max(i,r,o),s=Math.min(i,r,o),c=(s+a)/2;if(s===a)t=0,n=0;else{var l=a-s;switch(n=c<=.5?l/(a+s):l/(2-a-s),a){case i:t=(r-o)/l+(r0&&(i.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),this.morphTargets===!0&&(i.morphTargets=!0),this.morphNormals===!0&&(i.morphNormals=!0),this.skinning===!0&&(i.skinning=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),n){var r=t(e.textures),o=t(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i},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){var i=t.length;n=new Array(i);for(var 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(S.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}}),L.prototype=Object.create(S.prototype),L.prototype.constructor=L,L.prototype.isMeshBasicMaterial=!0,L.prototype.copy=function(e){return S.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 Gu=new l;Object.defineProperty(R.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}}),Object.assign(R.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;i0,s=o[1]&&o[1].length>0,c=e.morphTargets,l=c.length;if(l>0){t=[];for(var h=0;h0){u=[];for(var h=0;h0&&0===i.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(var h=0;h65535?N:O)(e,1):this.index=e},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},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n: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;if(void 0!==n){var r=(new i).getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var o=this.attributes.tangent;return void 0!==o&&(o.transformDirection(e),o.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return Vu.makeRotationX(e),this.applyMatrix4(Vu),this},rotateY:function(e){return Vu.makeRotationY(e),this.applyMatrix4(Vu),this},rotateZ:function(e){return Vu.makeRotationZ(e),this.applyMatrix4(Vu),this},translate:function(e,t,n){return Vu.makeTranslation(e,t,n),this.applyMatrix4(Vu),this},scale:function(e,t,n){return Vu.makeScale(e,t,n),this.applyMatrix4(Vu),this},lookAt:function(e){return ju.lookAt(e),ju.updateMatrix(),this.applyMatrix4(ju.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Wu).negate(),this.translate(Wu.x,Wu.y,Wu.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new z(3*t.vertices.length,3),i=new z(3*t.colors.length,3);if(this.setAttribute("position",n.copyVector3sArray(t.vertices)),this.setAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new z(t.lineDistances.length,1);this.setAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,i=e.length;n0){var n=new Float32Array(3*e.normals.length);this.setAttribute("normal",new R(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.setAttribute("color",new R(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new R(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var o=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new R(o,2).copyVector2sArray(e.uvs2))}this.groups=e.groups;for(var a in e.morphTargets){for(var s=[],c=e.morphTargets[a],l=0,h=c.length;l0){var p=new z(4*e.skinIndices.length,4);this.setAttribute("skinIndex",p.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new z(4*e.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return 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 m);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,i=t.length;n0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);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=this.attributes;for(var n in r){var o=r[n],a=o.toJSON();""!==o.name&&(a.name=o.name),e.data.attributes[n]=a}var s={},c=!1;for(var n in this.morphAttributes){for(var l=this.morphAttributes[n],h=[],u=0,d=l.length;u0&&(s[n]=h,c=!0)}c&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var p=this.groups;p.length>0&&(e.data.groups=JSON.parse(JSON.stringify(p)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new F).copy(this)},copy:function(e){var t,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var o=e.attributes;for(t in o){var a=o[t];this.setAttribute(t,a.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(n=0,i=l.length;n0){var a=r[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){var i=this.geometry,r=this.material,o=this.matrixWorld;if(void 0!==r&&(null===i.boundingSphere&&i.computeBoundingSphere(),Qu.copy(i.boundingSphere),Qu.applyMatrix4(o),e.ray.intersectsSphere(Qu)!==!1&&(Zu.getInverse(o),Ju.copy(e.ray).applyMatrix4(Zu),null===i.boundingBox||Ju.intersectsBox(i.boundingBox)!==!1))){var a;if(i.isBufferGeometry){var s,c,l,h,u,d,p,f,m,v,g,y=i.index,x=i.attributes.position,w=i.morphAttributes.position,_=i.morphTargetsRelative,M=i.attributes.uv,E=i.attributes.uv2,T=i.groups,S=i.drawRange;if(null!==y)if(Array.isArray(r))for(h=0,d=T.length;h0&&(C=D);for(var N=0,z=O.length;N0)for(var d=0;d0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,i,r;for(n=0,i=this.faces.length;n=0;n--){var m=p[n];for(this.faces.splice(m,1),a=0,s=this.faceVertexUvs.length;a0,_=g.vertexNormals.length>0,M=1!==g.color.r||1!==g.color.g||1!==g.color.b,E=g.vertexColors.length>0,T=0;if(T=e(T,0,0),T=e(T,1,y),T=e(T,2,x),T=e(T,3,b),T=e(T,4,w),T=e(T,5,_),T=e(T,6,M),T=e(T,7,E),h.push(T),h.push(g.a,g.b,g.c),h.push(g.materialIndex),b){var S=this.faceVertexUvs[0][c];h.push(i(S[0]),i(S[1]),i(S[2]))}if(w&&h.push(t(g.normal)),_){var L=g.vertexNormals;h.push(t(L[0]),t(L[1]),t(L[2]))}if(M&&h.push(n(g.color)),E){var R=g.vertexColors;h.push(n(R[0]),n(R[1]),n(R[2]))}}return r.data={},r.data.vertices=s,r.data.normals=u,p.length>0&&(r.data.colors=p),m.length>0&&(r.data.uvs=[m]),r.data.faces=h,r},clone:function(){return(new j).copy(this)},copy:function(e){var t,n,i,r,o,a;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;var s=e.vertices;for(t=0,n=s.length;t0?1:-1,d.push(C.x,C.y,C.z),p.push(x/v),p.push(1-b/g),R+=1}}for(b=0;b0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var o={};for(var a in this.extensions)this.extensions[a]===!0&&(o[a]=!0);return Object.keys(o).length>0&&(t.extensions=o),t},Y.prototype=Object.assign(Object.create(p.prototype),{constructor:Y,isCamera:!0,copy:function(e,t){return p.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 l),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){p.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){p.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),Z.prototype=Object.assign(Object.create(Y.prototype),{constructor:Z,isPerspectiveCamera:!0,copy:function(e,t){return Y.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){var t=.5*this.getFilmHeight()/e;this.fov=2*Ah.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*Ah.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*Ah.RAD2DEG*Math.atan(Math.tan(.5*Ah.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,o){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=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*Ah.DEG2RAD*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,o=this.view;if(null!==this.view&&this.view.enabled){var a=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/a,t-=o.offsetY*n/s,i*=o.width/a,n*=o.height/s}var c=this.filmOffset;0!==c&&(r+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=p.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}});var wd=90,_d=1;J.prototype=Object.create(p.prototype),J.prototype.constructor=J,Q.prototype=Object.create(a.prototype),Q.prototype.constructor=Q,Q.prototype.isWebGLCubeRenderTarget=!0,Q.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new f,i={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","\tvWorldDirection = transformDirection( position, modelMatrix );","\t#include ","\t#include ","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#define RECIPROCAL_PI 0.31830988618","#define RECIPROCAL_PI2 0.15915494","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV;","\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;","\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},r=new X({type:"CubemapFromEquirect",uniforms:W(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:hs,blending:fs});r.uniforms.tEquirect.value=t;var o=new G(new gd(5,5,5),r);n.add(o);var a=new J(1,10,1);return a.renderTarget=this,a.renderTarget.texture.name="CubeCameraTexture",a.update(e,n),o.geometry.dispose(),o.material.dispose(),this},K.prototype=Object.create(r.prototype),K.prototype.constructor=K,K.prototype.isDataTexture=!0;var Md=new g,Ed=new l;Object.assign($.prototype,{set:function(e,t,n,i,r,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],c=n[5],l=n[6],h=n[7],u=n[8],d=n[9],p=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(a-i,h-s,f-u,y-m).normalize(),t[1].setComponents(a+i,h+s,f+u,y+m).normalize(),t[2].setComponents(a+r,h+c,f+d,y+v).normalize(),t[3].setComponents(a-r,h-c,f-d,y-v).normalize(),t[4].setComponents(a-o,h-l,f-p,y-g).normalize(),t[5].setComponents(a+o,h+l,f+p,y+g).normalize(),this},intersectsObject:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Md.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Md)},intersectsSprite:function(e){return Md.center.set(0,0,0),Md.radius=.7071067811865476,Md.applyMatrix4(e.matrixWorld),this.intersectsSphere(Md)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++){var o=t[r].distanceToPoint(n);if(o0?e.max.x:e.min.x,Ed.y=i.normal.y>0?e.max.y:e.min.y,Ed.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ed)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var Td={common:{diffuse:{value:new w(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new i},uv2Transform:{value:new i},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 n(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 w(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new w(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new i}},sprite:{diffuse:{value:new w(15658734)},opacity:{value:1 +},center:{value:new n(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new i}}};ne.prototype=Object.create(j.prototype),ne.prototype.constructor=ne,ie.prototype=Object.create(F.prototype),ie.prototype.constructor=ie;var Sd="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",Ld="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",Rd="#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",Ad="#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",Cd="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",Pd="vec3 transformed = vec3( position );",Id="vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",Od="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",Dd="#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",Nd="#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",zd="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",Hd="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",Bd="#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",Ud="#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",Fd="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",Gd="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",kd="#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",Vd="#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\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 return m[ 2 ][ 3 ] == - 1.0;\n}",jd="#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x);\n } else if (face == 1.0) {\n uv = vec2(direction.x, -direction.z) / abs(direction.y);\n } else if (face == 2.0) {\n uv = direction.xy / abs(direction.z);\n } else if (face == 3.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x);\n } else if (face == 4.0) {\n uv = direction.xz / abs(direction.y);\n } else {\n uv = vec2(-direction.x, direction.y) / abs(direction.z);\n }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif",Wd="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",qd="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",Xd="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",Yd="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",Zd="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",Jd="gl_FragColor = linearToOutputTexel( gl_FragColor );",Qd="\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}",Kd="#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\t\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#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\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",$d="#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",ep="#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",tp="#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",np="#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",ip="#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",rp="#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",op="#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",ap="#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",sp="#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}",cp="#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lp="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",hp="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;\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",up="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\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\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\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\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\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\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\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\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\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",dp="#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 vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 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#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",pp="ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",fp="varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\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\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\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)",mp="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",vp="varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\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)",gp="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",yp="struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\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}",xp="\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",bp="#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",wp="#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",_p="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",Mp="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",Ep="#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",Tp="#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",Sp="#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",Lp="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",Rp="#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",Ap="#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",Cp="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",Pp="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",Ip="#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",Op="#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",Dp="#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\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",Np="#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;",zp="#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",Hp="#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",Bp="#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",Up="#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",Fp="#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",Gp="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}",kp="#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",Vp="vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",jp="#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",Wp="#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",qp="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",Xp="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",Yp="#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#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#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#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",Zp="#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#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#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#endif\n#endif",Jp="#ifdef USE_SHADOWMAP\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\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\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\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\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\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",Qp="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}",Kp="#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",$p="#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",ef="#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",tf="#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",nf="float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",rf="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",of="#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",af="#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\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}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\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 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",sf="#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",cf="#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",lf="#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",hf="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uf="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",df="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",pf="#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",ff="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}",mf="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}",vf="#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}",gf="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}",yf="#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}",xf="#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}",bf="#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}",wf="#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}",_f="uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",Mf="varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",Ef="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}",Tf="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\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}",Sf="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 \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}",Lf="#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}",Rf="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\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\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}",Af="#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}",Cf="#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 \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}",Pf="#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}",If="#define TOON\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 \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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",Of="#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}",Df="#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}",Nf="#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}",zf="#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\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 \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\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\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}",Hf="#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}",Bf="#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}",Uf="#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}",Ff="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}",Gf="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}",kf="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}",Vf="#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",jf="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}",Wf="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}",qf={ +alphamap_fragment:Sd,alphamap_pars_fragment:Ld,alphatest_fragment:Rd,aomap_fragment:Ad,aomap_pars_fragment:Cd,begin_vertex:Pd,beginnormal_vertex:Id,bsdfs:Od,bumpmap_pars_fragment:Dd,clipping_planes_fragment:Nd,clipping_planes_pars_fragment:zd,clipping_planes_pars_vertex:Hd,clipping_planes_vertex:Bd,color_fragment:Ud,color_pars_fragment:Fd,color_pars_vertex:Gd,color_vertex:kd,common:Vd,cube_uv_reflection_fragment:jd,defaultnormal_vertex:Wd,displacementmap_pars_vertex:qd,displacementmap_vertex:Xd,emissivemap_fragment:Yd,emissivemap_pars_fragment:Zd,encodings_fragment:Jd,encodings_pars_fragment:Qd,envmap_fragment:Kd,envmap_common_pars_fragment:$d,envmap_pars_fragment:ep,envmap_pars_vertex:tp,envmap_physical_pars_fragment:dp,envmap_vertex:np,fog_vertex:ip,fog_pars_vertex:rp,fog_fragment:op,fog_pars_fragment:ap,gradientmap_pars_fragment:sp,lightmap_fragment:cp,lightmap_pars_fragment:lp,lights_lambert_vertex:hp,lights_pars_begin:up,lights_toon_fragment:pp,lights_toon_pars_fragment:fp,lights_phong_fragment:mp,lights_phong_pars_fragment:vp,lights_physical_fragment:gp,lights_physical_pars_fragment:yp,lights_fragment_begin:xp,lights_fragment_maps:bp,lights_fragment_end:wp,logdepthbuf_fragment:_p,logdepthbuf_pars_fragment:Mp,logdepthbuf_pars_vertex:Ep,logdepthbuf_vertex:Tp,map_fragment:Sp,map_pars_fragment:Lp,map_particle_fragment:Rp,map_particle_pars_fragment:Ap,metalnessmap_fragment:Cp,metalnessmap_pars_fragment:Pp,morphnormal_vertex:Ip,morphtarget_pars_vertex:Op,morphtarget_vertex:Dp,normal_fragment_begin:Np,normal_fragment_maps:zp,normalmap_pars_fragment:Hp,clearcoat_normal_fragment_begin:Bp,clearcoat_normal_fragment_maps:Up,clearcoat_pars_fragment:Fp,packing:Gp,premultiplied_alpha_fragment:kp,project_vertex:Vp,dithering_fragment:jp,dithering_pars_fragment:Wp,roughnessmap_fragment:qp,roughnessmap_pars_fragment:Xp,shadowmap_pars_fragment:Yp,shadowmap_pars_vertex:Zp,shadowmap_vertex:Jp,shadowmask_pars_fragment:Qp,skinbase_vertex:Kp,skinning_pars_vertex:$p,skinning_vertex:ef,skinnormal_vertex:tf,specularmap_fragment:nf,specularmap_pars_fragment:rf,tonemapping_fragment:of,tonemapping_pars_fragment:af,uv_pars_fragment:sf,uv_pars_vertex:cf,uv_vertex:lf,uv2_pars_fragment:hf,uv2_pars_vertex:uf,uv2_vertex:df,worldpos_vertex:pf,background_frag:ff,background_vert:mf,cube_frag:vf,cube_vert:gf,depth_frag:yf,depth_vert:xf,distanceRGBA_frag:bf,distanceRGBA_vert:wf,equirect_frag:_f,equirect_vert:Mf,linedashed_frag:Ef,linedashed_vert:Tf,meshbasic_frag:Sf,meshbasic_vert:Lf,meshlambert_frag:Rf,meshlambert_vert:Af,meshmatcap_frag:Cf,meshmatcap_vert:Pf,meshtoon_frag:If,meshtoon_vert:Of,meshphong_frag:Df,meshphong_vert:Nf,meshphysical_frag:zf,meshphysical_vert:Hf,normal_frag:Bf,normal_vert:Uf,points_frag:Ff,points_vert:Gf,shadow_frag:kf,shadow_vert:Vf,sprite_frag:jf,sprite_vert:Wf},Xf={basic:{uniforms:q([Td.common,Td.specularmap,Td.envmap,Td.aomap,Td.lightmap,Td.fog]),vertexShader:qf.meshbasic_vert,fragmentShader:qf.meshbasic_frag},lambert:{uniforms:q([Td.common,Td.specularmap,Td.envmap,Td.aomap,Td.lightmap,Td.emissivemap,Td.fog,Td.lights,{emissive:{value:new w(0)}}]),vertexShader:qf.meshlambert_vert,fragmentShader:qf.meshlambert_frag},phong:{uniforms:q([Td.common,Td.specularmap,Td.envmap,Td.aomap,Td.lightmap,Td.emissivemap,Td.bumpmap,Td.normalmap,Td.displacementmap,Td.fog,Td.lights,{emissive:{value:new w(0)},specular:{value:new w(1118481)},shininess:{value:30}}]),vertexShader:qf.meshphong_vert,fragmentShader:qf.meshphong_frag},standard:{uniforms:q([Td.common,Td.envmap,Td.aomap,Td.lightmap,Td.emissivemap,Td.bumpmap,Td.normalmap,Td.displacementmap,Td.roughnessmap,Td.metalnessmap,Td.fog,Td.lights,{emissive:{value:new w(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:qf.meshphysical_vert,fragmentShader:qf.meshphysical_frag},toon:{uniforms:q([Td.common,Td.specularmap,Td.aomap,Td.lightmap,Td.emissivemap,Td.bumpmap,Td.normalmap,Td.displacementmap,Td.gradientmap,Td.fog,Td.lights,{emissive:{value:new w(0)},specular:{value:new w(1118481)},shininess:{value:30}}]),vertexShader:qf.meshtoon_vert,fragmentShader:qf.meshtoon_frag},matcap:{uniforms:q([Td.common,Td.bumpmap,Td.normalmap,Td.displacementmap,Td.fog,{matcap:{value:null}}]),vertexShader:qf.meshmatcap_vert,fragmentShader:qf.meshmatcap_frag},points:{uniforms:q([Td.points,Td.fog]),vertexShader:qf.points_vert,fragmentShader:qf.points_frag},dashed:{uniforms:q([Td.common,Td.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:qf.linedashed_vert,fragmentShader:qf.linedashed_frag},depth:{uniforms:q([Td.common,Td.displacementmap]),vertexShader:qf.depth_vert,fragmentShader:qf.depth_frag},normal:{uniforms:q([Td.common,Td.bumpmap,Td.normalmap,Td.displacementmap,{opacity:{value:1}}]),vertexShader:qf.normal_vert,fragmentShader:qf.normal_frag},sprite:{uniforms:q([Td.sprite,Td.fog]),vertexShader:qf.sprite_vert,fragmentShader:qf.sprite_frag},background:{uniforms:{uvTransform:{value:new i},t2D:{value:null}},vertexShader:qf.background_vert,fragmentShader:qf.background_frag},cube:{uniforms:q([Td.envmap,{opacity:{value:1}}]),vertexShader:qf.cube_vert,fragmentShader:qf.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:qf.equirect_vert,fragmentShader:qf.equirect_frag},distanceRGBA:{uniforms:q([Td.common,Td.displacementmap,{referencePosition:{value:new l},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:qf.distanceRGBA_vert,fragmentShader:qf.distanceRGBA_frag},shadow:{uniforms:q([Td.lights,Td.fog,{color:{value:new w(0)},opacity:{value:1}}]),vertexShader:qf.shadow_vert,fragmentShader:qf.shadow_frag}};Xf.physical={uniforms:q([Xf.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new n(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new w(0)},transparency:{value:0}}]),vertexShader:qf.meshphysical_vert,fragmentShader:qf.meshphysical_frag},me.prototype=Object.create(r.prototype),me.prototype.constructor=me,me.prototype.isCubeTexture=!0,Object.defineProperty(me.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),ve.prototype=Object.create(r.prototype),ve.prototype.constructor=ve,ve.prototype.isDataTexture2DArray=!0,ge.prototype=Object.create(r.prototype),ge.prototype.constructor=ge,ge.prototype.isDataTexture3D=!0;var Yf=new r,Zf=new ve,Jf=new ge,Qf=new me,Kf=[],$f=[],em=new Float32Array(16),tm=new Float32Array(9),nm=new Float32Array(4);et.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),be(t,e)},tt.prototype.setValue=function(e,t,n){for(var i=this.seq,r=0,o=i.length;r!==o;++r){var a=i[r];a.setValue(e,t[a.id],n)}};var im=/([\w\d_]+)(\])?(\[|\.)?/g;rt.prototype.setValue=function(e,t,n,i){var r=this.map[t];void 0!==r&&r.setValue(e,n,i)},rt.prototype.setOptional=function(e,t,n){var i=t[n];void 0!==i&&this.setValue(e,n,i)},rt.upload=function(e,t,n,i){for(var r=0,o=t.length;r!==o;++r){var a=t[r],s=n[a.id];s.needsUpdate!==!1&&a.setValue(e,s.value,i)}},rt.seqWithValue=function(e,t){for(var n=[],i=0,r=e.length;i!==r;++i){var o=e[i];o.id in t&&n.push(o)}return n};var rm=0,om=/^[ \t]*#include +<([\w\d.\/]+)>/gm,am=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,sm=/#pragma unroll_loop_start[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}[\s]+?#pragma unroll_loop_end/g,cm=0;Gt.prototype=Object.create(S.prototype),Gt.prototype.constructor=Gt,Gt.prototype.isMeshDepthMaterial=!0,Gt.prototype.copy=function(e){return S.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},kt.prototype=Object.create(S.prototype),kt.prototype.constructor=kt,kt.prototype.isMeshDistanceMaterial=!0,kt.prototype.copy=function(e){return S.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 lm="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",hm="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";Xt.prototype=Object.assign(Object.create(Z.prototype),{constructor:Xt,isArrayCamera:!0}),Yt.prototype=Object.assign(Object.create(p.prototype),{constructor:Yt,isGroup:!0}),Object.assign(Zt.prototype,t.prototype),Object.assign(Qt.prototype,{isFogExp2:!0,clone:function(){return new Qt(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(Kt.prototype,{isFog:!0,clone:function(){return new Kt(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty($t.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}}),Object.assign($t.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;ie.far||t.push({distance:c,point:pm.clone(),uv:b.getUV(pm,xm,bm,wm,_m,Mm,Em,new n),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return p.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}});var Tm=new l,Sm=new l;on.prototype=Object.assign(Object.create(p.prototype),{constructor:on,isLOD:!0,copy:function(e){p.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n0){for(var n=1,i=t.length;n0){Tm.setFromMatrixPosition(this.matrixWorld);var i=e.ray.origin.distanceTo(Tm);this.getObjectForDistance(i).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){Tm.setFromMatrixPosition(e.matrixWorld),Sm.setFromMatrixPosition(this.matrixWorld);var n=Tm.distanceTo(Sm)/e.zoom;t[0].object.visible=!0;for(var i=1,r=t.length;i=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i0&&(Pm[0].instanceId=r,Pm[0].object=this,t.push(Pm[0]),Pm.length=0)},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){}}),hn.prototype=Object.create(S.prototype),hn.prototype.constructor=hn,hn.prototype.isLineBasicMaterial=!0,hn.prototype.copy=function(e){return S.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this};var Om=new l,Dm=new l,Nm=new h,zm=new y,Hm=new g;un.prototype=Object.assign(Object.create(p.prototype),{constructor:un,isLine:!0,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;ia)){u.applyMatrix4(this.matrixWorld);var _=e.ray.origin.distanceTo(u);_e.far||t.push({distance:_,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}}else for(var g=0,y=m.length/3-1;ga)){u.applyMatrix4(this.matrixWorld);var _=e.ray.origin.distanceTo(u);_e.far||t.push({distance:_,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}}}else if(n.isGeometry)for(var M=n.vertices,E=M.length,g=0;ga)){u.applyMatrix4(this.matrixWorld);var _=e.ray.origin.distanceTo(u);_e.far||t.push({distance:_,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Bm=new l,Um=new l;dn.prototype=Object.assign(Object.create(un.prototype),{constructor:dn,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;i0){var a=r[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),gn.prototype=Object.assign(Object.create(r.prototype),{constructor:gn,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),yn.prototype=Object.create(r.prototype),yn.prototype.constructor=yn,yn.prototype.isCompressedTexture=!0,xn.prototype=Object.create(r.prototype),xn.prototype.constructor=xn,xn.prototype.isCanvasTexture=!0,bn.prototype=Object.create(r.prototype),bn.prototype.constructor=bn,bn.prototype.isDepthTexture=!0,wn.prototype=Object.create(F.prototype),wn.prototype.constructor=wn,_n.prototype=Object.create(j.prototype),_n.prototype.constructor=_n,Mn.prototype=Object.create(F.prototype),Mn.prototype.constructor=Mn,En.prototype=Object.create(j.prototype),En.prototype.constructor=En,Tn.prototype=Object.create(F.prototype),Tn.prototype.constructor=Tn,Sn.prototype=Object.create(j.prototype),Sn.prototype.constructor=Sn,Ln.prototype=Object.create(Tn.prototype),Ln.prototype.constructor=Ln,Rn.prototype=Object.create(j.prototype),Rn.prototype.constructor=Rn,An.prototype=Object.create(Tn.prototype),An.prototype.constructor=An,Cn.prototype=Object.create(j.prototype),Cn.prototype.constructor=Cn,Pn.prototype=Object.create(Tn.prototype),Pn.prototype.constructor=Pn,In.prototype=Object.create(j.prototype),In.prototype.constructor=In,On.prototype=Object.create(Tn.prototype),On.prototype.constructor=On,Dn.prototype=Object.create(j.prototype),Dn.prototype.constructor=Dn,Nn.prototype=Object.create(F.prototype),Nn.prototype.constructor=Nn,Nn.prototype.toJSON=function(){var e=F.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},zn.prototype=Object.create(j.prototype),zn.prototype.constructor=zn,Hn.prototype=Object.create(F.prototype),Hn.prototype.constructor=Hn,Bn.prototype=Object.create(j.prototype),Bn.prototype.constructor=Bn,Un.prototype=Object.create(F.prototype),Un.prototype.constructor=Un;var jm={triangulate:function(e,t,n){n=n||2;var i=t&&t.length,r=i?t[0]*n:e.length,o=Fn(e,0,r,n,!0),a=[];if(!o||o.next===o.prev)return a;var s,c,l,h,u,d,p;if(i&&(o=Xn(e,t,o,n)),e.length>80*n){s=l=e[0],c=h=e[1];for(var f=n;fl&&(l=u),d>h&&(h=d);p=Math.max(l-s,h-c),p=0!==p?1/p:0}return kn(o,a,n,s,c,p),a}},Wm={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r=i)){h.push(c.times[d]);for(var f=0;fo.tracks[s].times[0]&&(m=o.tracks[s].times[0]);for(var s=0;s=r)break e;var s=t[1];e=r)break t}o=n,n=0}}for(;n>>1;et;)--o;if(++o,0!==r||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);var a=this.getValueSize();this.times=Zm.arraySlice(n,r,o),this.values=Zm.arraySlice(this.values,r*a,o*a)}return 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 o=null,a=0;a!==r;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),e=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,s,o),e=!1;break}o=s}if(void 0!==i&&Zm.isTypedArray(i))for(var a=0,c=i.length;a!==c;++a){var l=i[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e},optimize:function(){for(var e=Zm.arraySlice(this.times),t=Zm.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Hl,r=1,o=e.length-1,a=1;a0){e[r]=e[o];for(var m=o*n,v=r*n,p=0;p!==n;++p)t[v+p]=t[m+p];++r}return r!==e.length?(this.times=Zm.arraySlice(e,0,r),this.values=Zm.arraySlice(t,0,r*n)):(this.times=e,this.values=t),this},clone:function(){var e=Zm.arraySlice(this.times,0),t=Zm.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}),Ki.prototype=Object.assign(Object.create(Qi.prototype),{constructor:Ki,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Nl,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),$i.prototype=Object.assign(Object.create(Qi.prototype),{constructor:$i,ValueTypeName:"color"}),er.prototype=Object.assign(Object.create(Qi.prototype),{constructor:er,ValueTypeName:"number"}),tr.prototype=Object.assign(Object.create(Xi.prototype),{constructor:tr,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,l=(n-t)/(i-t),h=s+a;s!==h;s+=4)c.slerpFlat(r,0,o,s-a,o,s,l);return r}}),nr.prototype=Object.assign(Object.create(Qi.prototype),{constructor:nr,ValueTypeName:"quaternion",DefaultInterpolation:zl,InterpolantFactoryMethodLinear:function(e){return new tr(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),ir.prototype=Object.assign(Object.create(Qi.prototype),{constructor:ir,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Nl,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),rr.prototype=Object.assign(Object.create(Qi.prototype),{constructor:rr,ValueTypeName:"vector"}),Object.assign(or,{parse:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,o=n.length;r!==o;++r)t.push(sr(n[r]).scale(i));return new or(e.name,e.duration,t)},toJSON:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid},r=0,o=n.length;r!==o;++r)t.push(Qi.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(e,t,n,i){for(var r=t.length,o=[],a=0;a1){var l=c[1],h=i[l];h||(i[l]=h=[]),h.push(s)}}var u=[];for(var l in i)u.push(or.CreateFromMorphTargetSequence(l,i[l],t,n));return u},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){if(0!==n.length){var o=[],a=[];Zm.flattenJSON(n,o,a,i),0!==o.length&&r.push(new e(t,o,a))}},i=[],r=e.name||"default",o=e.length||-1,a=e.fps||30,s=e.hierarchy||[],c=0;c0||0===e.search(/^data\:image\/jpeg/);o.format=i?Oc:Dc,o.needsUpdate=!0,void 0!==t&&t(o)},n,i),o}}),Object.assign(gr.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var 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=[],r=this.getPoint(0),o=0;for(i.push(0),n=1;n<=e;n++)t=this.getPoint(n/e),o+=t.distanceTo(r),i.push(o),r=t;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,i=this.getLengths(),r=0,o=i.length;n=t?t:e*i[o-1];for(var a,s=0,c=o-1;s<=c;)if(r=Math.floor(s+(c-s)/2),a=i[r]-n,a<0)s=r+1;else{if(!(a>0)){c=r;break}c=r-1}if(r=c,i[r]===n)return r/(o-1);var l=i[r],h=i[r+1],u=h-l,d=(n-l)/u,p=(r+d)/(o-1);return p},getTangent:function(e){var t=1e-4,n=e-t,i=e+t;n<0&&(n=0),i>1&&(i=1);var r=this.getPoint(n),o=this.getPoint(i),a=o.clone().sub(r);return a.normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,i,r,o=new l,a=[],s=[],c=[],u=new l,d=new h;for(n=0;n<=e;n++)i=n/e,a[n]=this.getTangentAt(i),a[n].normalize();s[0]=new l,c[0]=new l;var p=Number.MAX_VALUE,f=Math.abs(a[0].x),m=Math.abs(a[0].y),v=Math.abs(a[0].z);for(f<=p&&(p=f,o.set(1,0,0)),m<=p&&(p=m,o.set(0,1,0)),v<=p&&o.set(0,0,1),u.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],u),c[0].crossVectors(a[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),u.crossVectors(a[n-1],a[n]),u.length()>Number.EPSILON&&(u.normalize(),r=Math.acos(Ah.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(d.makeRotationAxis(u,r))),c[n].crossVectors(a[n],s[n]);if(t===!0)for(r=Math.acos(Ah.clamp(s[0].dot(s[e]),-1,1)),r/=e,a[0].dot(u.crossVectors(s[0],s[e]))>0&&(r=-r),n=1;n<=e;n++)s[n].applyMatrix4(d.makeRotationAxis(a[n],r*n)),c[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:c}},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}}),yr.prototype=Object.create(gr.prototype),yr.prototype.constructor=yr,yr.prototype.isEllipseCurve=!0,yr.prototype.getPoint=function(e,t){for(var i=t||new n,r=2*Math.PI,o=this.aEndAngle-this.aStartAngle,a=Math.abs(o)r;)o-=r;o0?0:(Math.floor(Math.abs(a)/r)+1)*r:0===s&&a===r-1&&(a=r-2,s=1);var c,h,u,d;if(this.closed||a>0?c=i[(a-1)%r]:($m.subVectors(i[0],i[1]).add(i[0]),c=$m),h=i[a%r],u=i[(a+1)%r],this.closed||a+2r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return i.set(_r(s,c.x,l.x,h.x,u.x),_r(s,c.y,l.y,h.y,u.y)),i},Br.prototype.copy=function(e){gr.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t=t){var r=n[i]-t,o=this.curves[i],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}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;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){gr.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var h=c.getPoint(1);return this.currentPoint.copy(h),this},copy:function(e){return Ur.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=Ur.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return Ur.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),Gr.prototype=Object.assign(Object.create(Fr.prototype),{constructor:Gr,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;n0:a.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var s in e.uniforms){var c=e.uniforms[s];switch(a.uniforms[s]={},c.type){case"t":a.uniforms[s].value=t(c.value);break;case"c":a.uniforms[s].value=(new w).setHex(c.value);break;case"v2":a.uniforms[s].value=(new n).fromArray(c.value);break;case"v3":a.uniforms[s].value=(new l).fromArray(c.value);break;case"v4":a.uniforms[s].value=(new o).fromArray(c.value);break;case"m3":a.uniforms[s].value=(new i).fromArray(c.value);case"m4":a.uniforms[s].value=(new h).fromArray(c.value);break;default:a.uniforms[s].value=c.value}}if(void 0!==e.defines&&(a.defines=e.defines),void 0!==e.vertexShader&&(a.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(a.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var u in e.extensions)a.extensions[u]=e.extensions[u];if(void 0!==e.shading&&(a.flatShading=1===e.shading),void 0!==e.size&&(a.size=e.size),void 0!==e.sizeAttenuation&&(a.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(a.map=t(e.map)),void 0!==e.matcap&&(a.matcap=t(e.matcap)),void 0!==e.alphaMap&&(a.alphaMap=t(e.alphaMap)),void 0!==e.bumpMap&&(a.bumpMap=t(e.bumpMap)),void 0!==e.bumpScale&&(a.bumpScale=e.bumpScale),void 0!==e.normalMap&&(a.normalMap=t(e.normalMap)),void 0!==e.normalMapType&&(a.normalMapType=e.normalMapType),void 0!==e.normalScale){var d=e.normalScale;Array.isArray(d)===!1&&(d=[d,d]),a.normalScale=(new n).fromArray(d)}return void 0!==e.displacementMap&&(a.displacementMap=t(e.displacementMap)),void 0!==e.displacementScale&&(a.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(a.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(a.roughnessMap=t(e.roughnessMap)),void 0!==e.metalnessMap&&(a.metalnessMap=t(e.metalnessMap)),void 0!==e.emissiveMap&&(a.emissiveMap=t(e.emissiveMap)),void 0!==e.emissiveIntensity&&(a.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(a.specularMap=t(e.specularMap)),void 0!==e.envMap&&(a.envMap=t(e.envMap)),void 0!==e.envMapIntensity&&(a.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(a.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(a.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(a.lightMap=t(e.lightMap)),void 0!==e.lightMapIntensity&&(a.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(a.aoMap=t(e.aoMap)),void 0!==e.aoMapIntensity&&(a.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(a.gradientMap=t(e.gradientMap)),void 0!==e.clearcoatMap&&(a.clearcoatMap=t(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(a.clearcoatRoughnessMap=t(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(a.clearcoatNormalMap=t(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(a.clearcoatNormalScale=(new n).fromArray(e.clearcoatNormalScale)),a},setTextures:function(e){return this.textures=e,this}});var rv={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,i=e.length;n0){var o=new cr(t),a=new fr(o);a.setCrossOrigin(this.crossOrigin);for(var s=0,c=e.length;sNumber.EPSILON){if(l<0&&(a=t[o],c=-c,s=t[r],l=-l),e.ys.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var h=l*(e.x-a.x)-c*(e.y-a.y);if(0===h)return!0;if(h<0)continue;i=!i}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return i}var r=Wm.isClockWise,o=this.subPaths;if(0===o.length)return[];if(t===!0)return n(o);var a,s,c,l=[];if(1===o.length)return s=o[0],c=new Gr,c.curves=s.curves,l.push(c),l;var h=!r(o[0].getPoints());h=e?!h:h;var u,d=[],p=[],f=[],m=0;p[m]=void 0,f[m]=[];for(var v=0,g=o.length;v1){for(var y=!1,x=[],b=0,w=p.length;b0&&(y||(f=d))}for(var L,v=0,R=p.length;v0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var o=0;o!==r;++o)e[t+o]=e[n+o]},_slerp:function(e,t,n,i){c.slerpFlat(e,t,e,t,e,n,i)},_lerp:function(e,t,n,i,r){for(var o=1-i,a=0;a!==r;++a){var s=t+a;e[s]=e[s]*o+e[n+a]*i}}});var wv="\\[\\]\\.:\\/",_v=new RegExp("["+wv+"]","g"),Mv="[^"+wv+"]",Ev="[^"+wv.replace("\\.","")+"]",Tv=/((?:WC+[\/:])*)/.source.replace("WC",Mv),Sv=/(WCOD+)?/.source.replace("WCOD",Ev),Lv=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Mv),Rv=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Mv),Av=new RegExp("^"+Tv+Sv+Lv+Rv+"$"),Cv=["material","materials","bones"];Object.assign(Eo.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.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(To,{Composite:Eo,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new To.Composite(e,t,n):new To(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(_v,"")},parseTrackName:function(e){var t=Av.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&&i!==-1){var r=n.nodeName.substring(i+1);Cv.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n},findNode:function(e,t){if(!t||""===t||"."===t||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var i=function(e){for(var n=0;n=t){var h=t++,u=e[h];n[u.uuid]=l,e[l]=u,n[c]=h,e[h]=s;for(var d=0,p=r;d!==p;++d){var f=i[d],m=f[h],v=f[l];f[l]=m,f[h]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,o=r.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],l=c.uuid,h=i[l];if(void 0!==h)if(delete i[l],h0)for(var c=this._interpolants,l=this._propertyBindings,h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulate(i,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,i=this.loop,r=this._loopCount,o=i===Dl;if(0===e)return r===-1?t:o&&1===(1&r)?n-t:t;if(i===Il){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),t>=n||t<0){var a=Math.floor(t/n);t-=n*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=t;if(o&&1===(1&r))return n-t}return t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=Ul,i.endingEnd=Ul):(e?i.endingStart=this.zeroSlopeAtStart?Ul:Bl:i.endingStart=Fl,t?i.endingEnd=this.zeroSlopeAtEnd?Ul:Bl:i.endingEnd=Fl)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=t,a[1]=r+e,s[1]=n,this}}),Ro.prototype=Object.assign(Object.create(t.prototype),{constructor:Ro,_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,o=e._propertyBindings,a=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var h=0;h!==r;++h){var u=i[h],d=u.name,p=l[d];if(void 0!==p)o[h]=p;else{if(p=o[h],void 0!==p){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[h].binding.parsedPath;p=new Mo(To.create(n,d,f),u.ValueTypeName,u.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,s,d),o[h]=p}a[h].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var 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,o=0,a=r.length;o!==a;++o){var s=r[o];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){var t=e._cacheIndex;return null!==t&&tthis.max.x||e.ythis.max.y)},containsBox: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},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new n),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new n),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){var t=Pv.copy(e).clamp(this.min,this.max);return t.sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Iv=new l,Ov=new l;Object.assign(Ho.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new l),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new l),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new l),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){Iv.subVectors(e,this.start),Ov.subVectors(this.end,this.start);var n=Ov.dot(Ov),i=Ov.dot(Iv),r=i/n;return t&&(r=Ah.clamp(r,0,1)),r},closestPointToPoint:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new l),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),Bo.prototype=Object.create(p.prototype),Bo.prototype.constructor=Bo,Bo.prototype.isImmediateRenderObject=!0;var Dv=new l;Uo.prototype=Object.create(p.prototype),Uo.prototype.constructor=Uo,Uo.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Uo.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Dv.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Dv),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var Nv=new l,zv=new h,Hv=new h;Go.prototype=Object.create(dn.prototype),Go.prototype.constructor=Go,Go.prototype.isSkeletonHelper=!0,Go.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,i=n.getAttribute("position");Hv.getInverse(this.root.matrixWorld);for(var r=0,o=0;r.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Zv.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Zv,t)}},Ko.prototype.setLength=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()},Ko.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},Ko.prototype.copy=function(e){return p.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},Ko.prototype.clone=function(){return(new this.constructor).copy(this)},$o.prototype=Object.create(dn.prototype),$o.prototype.constructor=$o;var Jv=4,Qv=8,Kv=Math.pow(2,Qv),$v=[.125,.215,.35,.446,.526,.582],eg=Qv-Jv+1+$v.length,tg=20,ng={};ng[jl]=0,ng[Wl]=1,ng[Xl]=2,ng[Zl]=3,ng[Jl]=4,ng[Ql]=5,ng[ql]=6;var ig=new Zr,rg=da(tg),og=null,ag=null,sg=ta(),cg=sg._lodPlanes,lg=sg._sizeLods,hg=sg._sigmas,ug=null,dg=null,pg=null,fg=(1+Math.sqrt(5))/2,mg=1/fg,vg=[new l(1,1,1),new l((-1),1,1),new l(1,1,(-1)),new l((-1),1,(-1)),new l(0,fg,mg),new l(0,fg,(-mg)),new l(mg,0,fg),new l((-mg),0,fg),new l(fg,mg,0),new l((-fg),mg,0)];ea.prototype={constructor:ea,fromScene:function(e,t,n,i){void 0===t&&(t=0),void 0===n&&(n=.1),void 0===i&&(i=100),pg=dg.getRenderTarget();var r=na();return ra(e,n,i,r),t>0&&ha(r,0,0,t),la(r),ia(r),r},fromEquirectangular:function(e){return e.magFilter=hc,e.minFilter=hc,e.generateMipmaps=!1,this.fromCubemap(e)},fromCubemap:function(e){pg=dg.getRenderTarget();var t=na(e);return oa(e,t),la(t),ia(t),t},compileCubemapShader:function(){null==ag&&(ag=fa(),aa(ag))},compileEquirectangularShader:function(){null==og&&(og=pa(),aa(og))},dispose:function(){rg.dispose(),null!=ag&&ag.dispose(),null!=og&&og.dispose();for(var e=0;e0&&(d(1),p(THREE.NormalBlending),y("rgba("+Math.floor(255*K.r)+","+Math.floor(255*K.g)+","+Math.floor(255*K.b)+","+$+")"),Q.fillRect(0|fe.min.x,0|fe.max.y,fe.max.x-fe.min.x|0,fe.min.y-fe.max.y|0)),fe.makeEmpty())},this.clearColor=function(){},this.clearDepth=function(){},this.clearStencil=function(){},this.render=function(e,n){if(void 0===n.isCamera)return void console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");var a=e.background;a&&a.isColor?(d(1),p(THREE.NormalBlending),y(a.getStyle()),Q.fillRect(0,0,k,V)):this.autoClear===!0&&this.clear(),U.info.render.vertices=0,U.info.render.faces=0,Q.setTransform(Y/k,0,0,-Z/V,q,V-X),Q.translate(j,W),b=F.projectScene(e,n,this.sortObjects,this.sortElements),w=b.elements,_=b.lights,_e.getNormalMatrix(n.matrixWorldInverse),t();for(var s=0,c=w.length;s1)continue;if(E.positionScreen.z<-1||E.positionScreen.z>1)continue;if(T.positionScreen.z<-1||T.positionScreen.z>1)continue;M.positionScreen.x*=j,M.positionScreen.y*=W,E.positionScreen.x*=j,E.positionScreen.y*=W,T.positionScreen.x*=j,T.positionScreen.y*=W,h.overdraw>0&&(u(M.positionScreen,E.positionScreen,h.overdraw),u(E.positionScreen,T.positionScreen,h.overdraw),u(T.positionScreen,M.positionScreen,h.overdraw)),me.setFromPoints([M.positionScreen,E.positionScreen,T.positionScreen]),pe.intersectsBox(me)===!0&&o(M,E,T,0,1,2,l,h)}fe.union(me)}}Q.setTransform(1,0,0,1,0,0)}},THREE.DeviceOrientationControls=function(e){var t=this;this.object=e,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0,this.alphaOffset=0;var n=function(e){t.deviceOrientation=e},i=function(){t.screenOrientation=window.orientation||0},r=function(){var e=new THREE.Vector3(0,0,1),t=new THREE.Euler,n=new THREE.Quaternion,i=new THREE.Quaternion((-Math.sqrt(.5)),0,0,Math.sqrt(.5));return function(r,o,a,s,c){t.set(a,o,-s,"YXZ"),r.setFromEuler(t),r.multiply(i),r.multiply(n.setFromAxisAngle(e,-c))}}();this.connect=function(){i(),void 0!==window.DeviceOrientationEvent&&"function"==typeof window.DeviceOrientationEvent.requestPermission?window.DeviceOrientationEvent.requestPermission().then(function(e){"granted"==e&&(window.addEventListener("orientationchange",i,!1),window.addEventListener("deviceorientation",n,!1))})["catch"](function(e){console.error("THREE.DeviceOrientationControls: Unable to use DeviceOrientation API:",e)}):(window.addEventListener("orientationchange",i,!1),window.addEventListener("deviceorientation",n,!1)),t.enabled=!0},this.disconnect=function(){window.removeEventListener("orientationchange",i,!1),window.removeEventListener("deviceorientation",n,!1),t.enabled=!1},this.update=function(){if(t.enabled!==!1){var e=t.deviceOrientation;if(e){var n=e.alpha?THREE.MathUtils.degToRad(e.alpha)+t.alphaOffset:0,i=e.beta?THREE.MathUtils.degToRad(e.beta):0,o=e.gamma?THREE.MathUtils.degToRad(e.gamma):0,a=t.screenOrientation?THREE.MathUtils.degToRad(t.screenOrientation):0;r(t.object.quaternion,n,i,o,a)}}},this.dispose=function(){t.disconnect()},this.connect()},THREE.RenderableObject=function(){this.id=0,this.object=null,this.z=0,this.renderOrder=0},THREE.RenderableFace=function(){this.id=0,this.v1=new THREE.RenderableVertex,this.v2=new THREE.RenderableVertex,this.v3=new THREE.RenderableVertex,this.normalModel=new THREE.Vector3,this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3],this.vertexNormalsLength=0,this.color=new THREE.Color,this.material=null,this.uvs=[new THREE.Vector2,new THREE.Vector2,new THREE.Vector2],this.z=0,this.renderOrder=0},THREE.RenderableVertex=function(){this.position=new THREE.Vector3,this.positionWorld=new THREE.Vector3,this.positionScreen=new THREE.Vector4,this.visible=!0},THREE.RenderableVertex.prototype.copy=function(e){this.positionWorld.copy(e.positionWorld),this.positionScreen.copy(e.positionScreen)},THREE.RenderableLine=function(){this.id=0,this.v1=new THREE.RenderableVertex,this.v2=new THREE.RenderableVertex,this.vertexColors=[new THREE.Color,new THREE.Color],this.material=null,this.z=0,this.renderOrder=0},THREE.RenderableSprite=function(){this.id=0,this.object=null,this.x=0,this.y=0,this.z=0,this.rotation=0,this.scale=new THREE.Vector2,this.material=null,this.renderOrder=0},THREE.Projector=function(){function e(n){if(n.visible!==!1){if(n instanceof THREE.Light)P.lights.push(n);else if(n instanceof THREE.Mesh||n instanceof THREE.Line||n instanceof THREE.Points){if(n.material.visible===!1)return;if(n.frustumCulled===!0&&G.intersectsObject(n)===!1)return;t(n)}else if(n instanceof THREE.Sprite){if(n.material.visible===!1)return;if(n.frustumCulled===!0&&G.intersectsSprite(n)===!1)return;t(n)}for(var i=n.children,r=0,o=i.length;r=-1&&e.z<=1&&(y=s(),y.id=t.id,y.x=e.x*i,y.y=e.y*i,y.z=e.z,y.renderOrder=t.renderOrder,y.object=t,y.rotation=t.rotation,y.scale.x=t.scale.x*Math.abs(y.x-(e.x+n.projectionMatrix.elements[0])/(e.w+n.projectionMatrix.elements[12])),y.scale.y=t.scale.y*Math.abs(y.y-(e.y+n.projectionMatrix.elements[5])/(e.w+n.projectionMatrix.elements[13])),y.material=t.material,P.elements.push(y))}function i(){if(u===_){var e=new THREE.RenderableObject;return w.push(e),_++,u++,e}return w[u++]}function r(){if(p===E){var e=new THREE.RenderableVertex;return M.push(e),E++,p++,e}return M[p++]}function o(){if(m===S){var e=new THREE.RenderableFace;return T.push(e),S++,m++,e}return T[m++]}function a(){if(g===R){var e=new THREE.RenderableLine;return L.push(e),R++,g++,e}return L[g++]}function s(){if(x===C){var e=new THREE.RenderableSprite;return A.push(e),C++,x++,e}return A[x++]}function c(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id!==t.id?e.id-t.id:0}function l(e,t){var n=0,i=1,r=e.z+e.w,o=t.z+t.w,a=-e.z+e.w,s=-t.z+t.w;return r>=0&&o>=0&&a>=0&&s>=0||!(r<0&&o<0||a<0&&s<0)&&(r<0?n=Math.max(n,r/(r-o)):o<0&&(i=Math.min(i,r/(r-o))),a<0?n=Math.max(n,a/(a-s)):s<0&&(i=Math.min(i,a/(a-s))),!(i=-1&&i.x<=1&&i.y>=-1&&i.y<=1&&i.z>=-1&&i.z<=1}function n(e,n,i){d=r(),d.position.set(e,n,i),t(d)}function i(e,t,n){g.push(e,t,n)}function s(e,t,n){y.push(e,t,n)}function c(e,t){x.push(e,t)}function h(e,t,n){return e.visible===!0||t.visible===!0||n.visible===!0||(z[0]=e.positionScreen,z[1]=t.positionScreen,z[2]=n.positionScreen,D.intersectsBox(N.setFromPoints(z)))}function u(e,t,n){return(n.positionScreen.x-e.positionScreen.x)*(t.positionScreen.y-e.positionScreen.y)-(n.positionScreen.y-e.positionScreen.y)*(t.positionScreen.x-e.positionScreen.x)<0}function p(e,t){var n=M[e],i=M[t];n.positionScreen.copy(n.position).applyMatrix4(U),i.positionScreen.copy(i.position).applyMatrix4(U),l(n.positionScreen,i.positionScreen)===!0&&(n.positionScreen.multiplyScalar(1/n.positionScreen.w),i.positionScreen.multiplyScalar(1/i.positionScreen.w),v=a(),v.id=w.id,v.v1.copy(n),v.v2.copy(i),v.z=Math.max(n.positionScreen.z,i.positionScreen.z),v.renderOrder=w.renderOrder,v.material=w.material,w.material.vertexColors&&(v.vertexColors[0].fromArray(y,3*e),v.vertexColors[1].fromArray(y,3*t)),P.elements.push(v))}function m(e,t,n,i){var r=M[e],a=M[t],s=M[n];if(h(r,a,s)!==!1&&(i.side===THREE.DoubleSide||u(r,a,s)===!0)){f=o(),f.id=w.id,f.v1.copy(r),f.v2.copy(a),f.v3.copy(s),f.z=(r.positionScreen.z+a.positionScreen.z+s.positionScreen.z)/3,f.renderOrder=w.renderOrder,I.subVectors(s.position,a.position),O.subVectors(r.position,a.position),I.cross(O),f.normalModel.copy(I),f.normalModel.applyMatrix3(_).normalize();for(var c=0;c<3;c++){var l=f.vertexNormalsModel[c];l.fromArray(g,3*arguments[c]),l.applyMatrix3(_).normalize();var d=f.uvs[c];d.fromArray(x,2*arguments[c])}f.vertexNormalsLength=3,f.material=i,i.vertexColors&&f.color.fromArray(y,3*e),P.elements.push(f)}}var g=[],y=[],x=[],w=null,_=new THREE.Matrix3;return{setObject:e,projectVertex:t,checkTriangleVisibility:h,checkBackfaceCulling:u,pushVertex:n,pushNormal:i,pushColor:s,pushUv:c,pushLine:p,pushTriangle:m}},W=new j;this.projectScene=function(t,i,s,h){m=0,g=0,x=0,P.elements.length=0,t.autoUpdate===!0&&t.updateMatrixWorld(),null===i.parent&&i.updateMatrixWorld(),H.copy(i.matrixWorldInverse),B.multiplyMatrices(i.projectionMatrix,H),G.setFromProjectionMatrix(B),u=0,P.objects.length=0,P.lights.length=0,e(t),s===!0&&P.objects.sort(c);for(var d=P.objects,y=0,w=d.length;y0)for(var ie=0;ie0)for(var ie=0;ie0||(ge=M[p-2],k.copy(ve.positionScreen),V.copy(ge.positionScreen),l(k,V)===!0&&(k.multiplyScalar(1/k.w),V.multiplyScalar(1/V.w),v=a(),v.id=_.id,v.v1.positionScreen.copy(k),v.v2.positionScreen.copy(V),v.z=Math.max(k.z,V.z),v.renderOrder=_.renderOrder,v.material=_.material,_.material.vertexColors&&(v.vertexColors[0].copy(_.geometry.colors[ce]),v.vertexColors[1].copy(_.geometry.colors[ce-1])),P.elements.push(v)))}}else if(_ instanceof THREE.Points){if(U.multiplyMatrices(B,b),E instanceof THREE.Geometry)for(var oe=_.geometry.vertices,ce=0,le=oe.length;ce + * @license MIT + */ +function(e){"use strict";function t(e){return Object(e)===e}if(!e.WeakMap){var n=Object.prototype.hasOwnProperty,i=function(e,t,n){Object.defineProperty?Object.defineProperty(e,t,{configurable:!0,writable:!0,value:n}):e[t]=n};e.WeakMap=function(){function e(){if(void 0===this)throw new TypeError("Constructor WeakMap requires 'new'");if(i(this,"_id",o("_WeakMap")),arguments.length>0)throw new TypeError("WeakMap iterable is not supported")}function r(e,i){if(!t(e)||!n.call(e,"_id"))throw new TypeError(i+" method called on incompatible receiver "+typeof e)}function o(e){return e+"_"+a()+"."+a()}function a(){return Math.random().toString().substring(2)}return i(e.prototype,"delete",function(e){if(r(this,"delete"),!t(e))return!1;var n=e[this._id];return!(!n||n[0]!==e)&&(delete e[this._id],!0)}),i(e.prototype,"get",function(e){if(r(this,"get"),t(e)){var n=e[this._id];return n&&n[0]===e?n[1]:void 0}}),i(e.prototype,"has",function(e){if(r(this,"has"),!t(e))return!1;var n=e[this._id];return!(!n||n[0]!==e)}),i(e.prototype,"set",function(e,n){if(r(this,"set"),!t(e))throw new TypeError("Invalid value used as weak map key");var o=e[this._id];return o&&o[0]===e?(o[1]=n,this):(i(e,this._id,[e,n]),this)}),i(e,"_polyfill",!0),e}()}}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this); //# sourceMappingURL=tour-player.js.map diff --git a/package.json b/package.json index 6a0332b..0aa56a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tour-player", - "version": "2.2.3", + "version": "2.2.4", "description": "", "repository": { "type": "git", diff --git a/src/js/Tour.js b/src/js/Tour.js index f739491..b0f53d2 100644 --- a/src/js/Tour.js +++ b/src/js/Tour.js @@ -1,4 +1,4 @@ var Tour = {}; // Версия плеера -Tour.version = [2, 2, 3]; +Tour.version = [2, 2, 4];