@realsee/five 6.7.0-alpha.12 → 6.7.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/five.Model.html +1 -1
- package/docs/classes/five.ModelScene.html +1 -1
- package/docs/classes/five.PBMContainer.html +1 -1
- package/docs/classes/five.PBMGroup.html +1 -1
- package/docs/classes/five.PBMMesh.html +1 -1
- package/docs/classes/five.PBMMeshMaterial.html +1 -1
- package/docs/classes/five.PBMPointCloud.html +1 -1
- package/docs/classes/five.PBMPointCloudMaterial.html +1 -1
- package/docs/classes/five.PBMSkinnedMesh.html +1 -1
- package/docs/classes/five.PanoCircleMeshSolid.html +5 -5
- package/docs/classes/five.Parameter.html +1 -1
- package/docs/classes/five.Tile3D.html +1 -1
- package/docs/classes/five.TileNode.html +1 -1
- package/docs/classes/five.TrajectoryNode.html +1 -1
- package/docs/classes/five.Work.html +16 -16
- package/docs/classes/five.WorkResolvedObserver.html +17 -17
- package/docs/classes/gltf-loader.DDSLoader.html +1 -1
- package/docs/classes/gltf-loader.DRACOLoader.html +1 -1
- package/docs/classes/gltf-loader.GLTFObject.html +1 -1
- package/docs/classes/gltf-loader.THREEGLTFLoader.html +1 -1
- package/docs/classes/line.LineGeometry.html +1 -1
- package/docs/classes/line.LineMaterial.html +1 -1
- package/docs/classes/line.LineSegmentsGeometry.html +1 -1
- package/docs/classes/line.THREE_Line2.html +1 -1
- package/docs/classes/line.THREE_LineSegments2.html +1 -1
- package/docs/classes/plugins.RoundedBoxGeometry.html +1 -1
- package/docs/classes/vfx.Airflow.html +1 -1
- package/docs/classes/vfx.Flame.html +1 -1
- package/docs/classes/vfx.Particle.html +1 -1
- package/docs/classes/vfx.ParticleGPU.html +1 -1
- package/docs/classes/vfx.SpotLight.html +1 -1
- package/docs/functions/five.parseWork.html +1 -1
- package/docs/functions/vue.useFiveWorks.html +2 -2
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/five.LooseWorkPanorama.html +1 -1
- package/docs/interfaces/five.LooseWorkWithExtrinsics.html +6 -6
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +5 -3
- package/docs/interfaces/five.ModelLike.html +1 -1
- package/docs/interfaces/five.PBMMaterial.html +1 -1
- package/docs/interfaces/five.PBMMeshMaterialParameters.html +1 -1
- package/docs/interfaces/five.PBMPointCloudMaterialParameters.html +1 -1
- package/docs/interfaces/five.PanoCircleMeshSolidOptions.html +2 -2
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +12 -10
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +5 -3
- package/docs/interfaces/five.ParameterMaterialValue.html +1 -1
- package/docs/interfaces/five.ParameterTilesetValue.html +1 -1
- package/docs/interfaces/five.ParameterValue.html +1 -1
- package/docs/interfaces/five.ResolvedParameterValue.html +1 -1
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +12 -10
- package/docs/interfaces/five.ViewLayer.html +1 -1
- package/docs/interfaces/five.WorkCubeImage.html +2 -2
- package/docs/interfaces/five.WorkImage.html +3 -3
- package/docs/interfaces/five.WorkInitial.html +8 -8
- package/docs/interfaces/five.WorkModel.html +8 -8
- package/docs/interfaces/five.WorkModelLayer.html +6 -6
- package/docs/interfaces/five.WorkObserver.html +18 -18
- package/docs/interfaces/five.WorkTile.html +4 -4
- package/docs/interfaces/five.WorkVideo.html +4 -4
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +12 -10
- package/docs/interfaces/plugins.BackgroundPluginController.html +1 -1
- package/docs/interfaces/plugins.BackgroundPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginController.html +35 -24
- package/docs/interfaces/plugins.DynamicPathLinePluginType.Config.html +22 -12
- package/docs/interfaces/plugins.DynamicPathLinePluginType.EventMap.html +9 -9
- package/docs/interfaces/plugins.DynamicPathLinePluginType.Params.html +3 -3
- package/docs/interfaces/plugins.DynamicPathLinePluginType.PathConfig.html +12 -4
- package/docs/interfaces/plugins.DynamicPathLinePluginType.State.html +4 -4
- package/docs/interfaces/plugins.ItemMaskController.html +1 -1
- package/docs/interfaces/plugins.ItemMaskPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.ItemMaskPluginType.State.html +1 -1
- package/docs/interfaces/plugins.OrientationPluginController.html +1 -1
- package/docs/interfaces/plugins.OrientationPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.OrientationPluginType.State.html +1 -1
- package/docs/interfaces/plugins.PanoAnimeController.html +1 -1
- package/docs/interfaces/plugins.PanoAnimePluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.PanoAnimePluginType.State.html +1 -1
- package/docs/interfaces/plugins.PluginTemplateType.EventMap.html +1 -1
- package/docs/interfaces/plugins.PluginTemplateType.State.html +1 -1
- package/docs/interfaces/plugins.TrajectoryController.html +1 -1
- package/docs/interfaces/react.FiveInjectionTypes.html +1 -1
- package/docs/types/five.ParseOptions.html +6 -6
- package/docs/types/plugins.DynamicPathLinePluginType.PluginData.html +2 -2
- package/docs/types/plugins.DynamicPathLinePluginType.ServerData.html +2 -2
- package/five/index.d.ts +6 -2
- package/five/index.js +66 -56
- package/five/index.mjs +2100 -2053
- package/gltf-loader/index.js +3 -3
- package/gltf-loader/index.mjs +3 -3
- package/line/index.js +3 -3
- package/line/index.mjs +3 -3
- package/package.json +1 -1
- package/plugins/index.d.ts +63 -7
- package/plugins/index.js +111 -26
- package/plugins/index.mjs +1182 -943
- package/react/index.js +2 -2
- package/react/index.mjs +2 -2
- package/shader-lib/index.js +2 -2
- package/shader-lib/index.mjs +2 -2
- package/sticker/index.js +3 -3
- package/sticker/index.mjs +3 -3
- package/umd/five-gltf-loader.js +3 -3
- package/umd/five-line.js +3 -3
- package/umd/five-plugins.js +111 -26
- package/umd/five-react.js +2 -2
- package/umd/five-shader-lib.js +2 -2
- package/umd/five-sticker.js +3 -3
- package/umd/five-vfx.js +2 -2
- package/umd/five-vue.js +2 -2
- package/umd/five.js +66 -56
- package/vfx/index.js +2 -2
- package/vfx/index.mjs +2 -2
- package/vue/index.js +2 -2
- package/vue/index.mjs +2 -2
- package/work-downloader/index.js +2 -2
- package/work-downloader/index.mjs +2 -2
package/umd/five-plugins.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated: 2025/11/
|
|
5
|
-
* Version: 6.7.0-alpha.
|
|
4
|
+
* Generated: 2025/11/10
|
|
5
|
+
* Version: 6.7.0-alpha.13
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
* No amendment to or modification of this Agreement will be binding unless in
|
|
253
253
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
254
254
|
* Agreement and all related documents shall be drafted in English.
|
|
255
|
-
*/(function(
|
|
255
|
+
*/(function(te,pe){typeof exports=="object"&&typeof module!="undefined"?pe(exports,require("@realsee/five"),require("three"),require("@realsee/five/plugins")):typeof define=="function"&&define.amd?define(["exports","@realsee/five","three","@realsee/five/plugins"],pe):(te=typeof globalThis!="undefined"?globalThis:te||self,pe(te.FiveSDK_Plugins={},te.FiveSDK,te.THREE,te.FiveSDK_Plugins))})(this,(function(te,pe,F,lt){"use strict";function Jt(f){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const e in f)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(f,e);Object.defineProperty(o,e,n.get?n:{enumerable:!0,get:()=>f[e]})}}return o.default=f,Object.freeze(o)}const v=Jt(F);function $t(f){return/^https?:\/\/|^\/\//.test(f)||/^data:/.test(f)}function en(f,o){return $t(o)?o:"".concat(f).concat(o)}te.BasePlugin=void 0,(function(f){var o=(function(){function e(n,t){this.hooks=new pe.Subscribe,this.staticPrefix="//vr-image-4.realsee-cdn.cn",this.five=n,t!=null&&t.staticPrefix&&(this.staticPrefix=t.staticPrefix)}return e.prototype.getCurrentState=function(){return this.state},e.prototype.absoluteUrl=function(n){return en(this.staticPrefix,n)},e})();f.Controller=o})(te.BasePlugin||(te.BasePlugin={}));var ut=function(f,o){return ut=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])},ut(f,o)};function de(f,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");ut(f,o);function e(){this.constructor=f}f.prototype=o===null?Object.create(o):(e.prototype=o.prototype,new e)}var V=function(){return V=Object.assign||function(o){for(var e,n=1,t=arguments.length;n<t;n++){e=arguments[n];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(o[a]=e[a])}return o},V.apply(this,arguments)};function Oe(f,o,e,n){function t(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function l(g){try{c(n.next(g))}catch(w){s(w)}}function h(g){try{c(n.throw(g))}catch(w){s(w)}}function c(g){g.done?a(g.value):t(g.value).then(l,h)}c((n=n.apply(f,o||[])).next())})}function _e(f,o){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,t,a,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=l(0),s.throw=l(1),s.return=l(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(c){return function(g){return h([c,g])}}function h(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(e=0)),e;)try{if(n=1,t&&(a=c[0]&2?t.return:c[0]?t.throw||((a=t.return)&&a.call(t),0):t.next)&&!(a=a.call(t,c[1])).done)return a;switch(t=0,a&&(c=[c[0]&2,a.value]),c[0]){case 0:case 1:a=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,t=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(a=e.trys,!(a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){e.label=c[1];break}if(c[0]===6&&e.label<a[1]){e.label=a[1],a=c;break}if(a&&e.label<a[2]){e.label=a[2],e.ops.push(c);break}a[2]&&e.ops.pop(),e.trys.pop();continue}c=o.call(f,e)}catch(g){c=[6,g],t=0}finally{n=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function _t(f,o,e){if(e||arguments.length===2)for(var n=0,t=o.length,a;n<t;n++)(a||!(n in o))&&(a||(a=Array.prototype.slice.call(o,0,n)),a[n]=o[n]);return f.concat(a||Array.prototype.slice.call(o))}typeof SuppressedError=="function"&&SuppressedError;function tn(f){return new Promise(function(o,e){var n=new Image;n.onload=function(){n.onload=n.onerror=function(){},o(n)},n.onerror=function(t){n.onload=n.onerror=function(){},e(t)},n.crossOrigin="",n.src=f})}var nn=typeof performance!="undefined"&&typeof performance.timing!="undefined"?performance.timing.navigationStart:Date.now(),ct=typeof performance!="undefined"?(function(){return nn+performance.now()}):(function(){return Date.now()});function He(f,o,e){return f+(o-f)*e}function rn(f,o,e,n){var t=(o*e+2*f)/Math.pow(e,3),a=-(2*o*e+3*f)/Math.pow(e,2),s=o,l=f;return t*Math.pow(n,3)+a*Math.pow(n,2)+s*n+l}function an(f,o,e,n){var t=(o*e+2*f)/Math.pow(e,3),a=-(2*o*e+3*f)/Math.pow(e,2),s=o;return 3*t*Math.pow(n,2)+2*a*n+s}function on(f,o,e,n){var t=n[1]-n[0];return f=qe(f,n),o=qe(o,n),o-f>t/2?He(f+t,o,e):f-o>t/2?He(f-t,o,e):He(f,o,e)}function qe(f,o){var e=o[1]-o[0];return f<o[0]?qe(f+e,o):f>=o[1]?qe(f-e,o):f}function sn(f,o,e,n){return n?on(f,o,e,n):He(f,o,e)}var Ct=(function(){function f(o){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=ct(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(var e in o){var n=o[e];typeof n=="number"?(this.value[e]=n,this.config[e]={circle:!1}):(this.value[e]=n.value,this.config[e]={circle:n.circle})}this.keyframes=[{progress:0,value:V({},this.value)},{progress:1,value:V({},this.value)}]}return f.prototype.getProgress=function(o){var e=o-this.startTime;return e<0?0:e>=this.duration?1:1-rn(1,this.startVelocity,this.duration,e)},f.prototype.getValue=function(o){for(var e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>o){var n=this.keyframes[e-1],t=this.keyframes[e],a={};for(var s in this.config){var l=(o-n.progress)/(t.progress-n.progress);a[s]=sn(n.value[s],t.value[s],l,this.config[s].circle)}return a}return V({},this.keyframes[this.keyframes.length-1].value)},f.prototype.getProgressVelocity=function(o){var e=o-this.startTime;return e>=this.duration?0:an(1,this.startVelocity,this.duration,e)},f.prototype.update=function(o){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(o))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},f.prototype.getKeyFrameSegment=function(o){for(var e=this.getProgress(o),n=1;n<this.keyframes.length;n++)if(this.keyframes[n].progress>e)return[this.keyframes[n-1],this.keyframes[n]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},f.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},f.prototype.set=function(o,e,n,t){var a;n===void 0&&(n=0),isNaN(e)&&(e=0),isNaN(n)&&(n=0),t=t!=null?t:ct();var s=this.getProgress(t),l=this.getValue(s),h={};for(var c in this.config)h[c]=(a=o[c])!==null&&a!==void 0?a:l[c];var g=[{progress:0,value:l},{progress:1,value:h}];return this.setKeyframes(g,e,n,t)},f.prototype.setKeyframes=function(o,e,n,t){var a=this;if(n===void 0&&(n=0),o.length<2)throw new Error("keyframes invalid.");return isNaN(e)&&(e=0),isNaN(n)&&(n=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise(function(s,l){t=t!=null?t:ct(),a.progress=0,a.ended=!1,a.startTime=t,a.startVelocity=n,a.keyframes=o,a.duration=e,e===0?(a.progress=1,a.value=V({},o[o.length-1].value)):a.value=V({},o[0].value),a.callbacks=[s,l]})},f.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},f})(),ln=[{progress:0,value:{scale:0,opacity:0,shadow:2}},{progress:.2,value:{scale:.5,opacity:1,shadow:1}},{progress:.8,value:{scale:2,opacity:0,shadow:.5}},{progress:1,value:{scale:2,opacity:0,shadow:.5}}],un=[{progress:0,value:{scale:0,opacity:0,shadow:2}},{progress:.2,value:{scale:.4,opacity:1,shadow:2}},{progress:.8,value:{scale:1.6,opacity:.4,shadow:.5}},{progress:1,value:{scale:2,opacity:0,shadow:.5}}],cn=`
|
|
256
256
|
varying vec2 vUv;
|
|
257
257
|
void main() {
|
|
258
258
|
vUv = uv;
|
|
@@ -304,7 +304,7 @@ void main() {
|
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
`,hn=(function(
|
|
307
|
+
`,hn=(function(f){de(o,f);function o(e,n){var t=f.call(this,e)||this;t.canvas=document.createElement("canvas"),t.group=new v.Group,t.wrapper=document.createElement("div"),t.style=document.createElement("style"),t.itemMaskMesh=(function(){var l=new v.Mesh(new v.SphereBufferGeometry(1,60,40),new v.ShaderMaterial({vertexShader:cn,fragmentShader:fn,uniforms:{map:{value:new v.Texture},color:{value:new v.Vector4}},depthWrite:!1,depthTest:!1,transparent:!0}));return l.renderOrder=-3,l.geometry.rotateY(-Math.PI/2),l.geometry.scale(-1,1,1),l})(),t.onFivePanoArrived=function(l){t.state.mode==="mask"&&t.loadPanoMask(l)},t.onFiveWantsMoveToPano=function(l){t.state.mode==="box"&&t.select()},t.loadPanoMask=function(l){return Oe(t,void 0,void 0,function(){var h,c,g,w,M,T,E,S,C,b;return _e(this,function(y){switch(y.label){case 0:return h=this,c=h.five,g=h.canvas,w=h.itemMaskMesh,M=h.data,T=g.getContext("2d"),E=c.observers[l],S=(b=M==null?void 0:M.object_mask_list.find(function(A){return A.derived_id===String(E.derivedId)}))===null||b===void 0?void 0:b.object_mask_url,S?[4,tn(S)]:[2];case 1:return C=y.sent(),g.width=C.width,g.height=C.height,T==null||T.drawImage(C,0,0,C.width,C.height),w.material.uniforms.map.value.image=C,w.material.uniforms.map.value.minFilter=v.LinearFilter,w.material.uniforms.map.value.needsUpdate=!0,w.position.copy(E.position),w.quaternion.copy(E.quaternion),c.scene.add(w),c.needsRender=!0,[2]}})})},t.onFiveMouseMove=function(l){var h;if(t.state.mode==="mask"&&t.five.state.mode==="Panorama"){var c=t,g=c.five,w=c.itemMaskMesh,M=g.observers[g.state.panoIndex],T=(h=l.pointers[0])===null||h===void 0?void 0:h.raycaster;if(T){var E=T.intersectObjects(t.group.children.filter(function(S){return S.userData.visible_viewpoint.includes(String(M.derivedId))}),!0)[0];E?w.material.uniforms.color.value=E.object.userData.color:w.material.uniforms.color.value=new v.Vector4(0,0,0,1)}}},t.onFiveTapGesture=function(l){var h=t.five,c=h.observers[h.state.panoIndex];if(l){var g=l.intersectObjects(t.group.children.filter(function(T){return T.userData.visible_viewpoint.includes(String(c.derivedId))}),!0)[0];if(g){t.select(g.object.name),t.stopAnimation&&t.stopAnimation(),t.tapPosition=g.point,t.changeTapScreenPosition();var w=new Ct({opacity:0,scale:0,shadow:2}),M=new Ct({opacity:0,scale:0,shadow:2});return w.setKeyframes(ln,1e3),M.setKeyframes(un,1e3),t.stopAnimation=pe.AnimationFrameLoop.shared.add(function(T,E){var S,C=w.update(T),b=M.update(T);t.wrapper.firstChild.style.opacity="".concat(w.value.opacity),t.wrapper.firstChild.style.transform="scale(".concat(w.value.scale,")"),t.wrapper.firstChild.style.boxShadow="0 0 0 ".concat(w.value.shadow,"px #fff"),t.wrapper.lastChild.style.opacity="".concat(M.value.opacity),t.wrapper.lastChild.style.transform="scale(".concat(M.value.scale,")"),t.wrapper.lastChild.style.boxShadow="0 0 0 ".concat(M.value.shadow,"px #fff"),C&&b&&((S=t.stopAnimation)===null||S===void 0||S.call(t),t.stopAnimation=void 0,h.getElement().parentElement.removeChild(t.wrapper))},!1,0,10),h.getElement().parentElement.appendChild(t.wrapper),!1}}},t.changeTapScreenPosition=function(){if(t.tapPosition){var l=t.tapPosition.clone().project(t.five.camera),h=(l.x+1)/2,c=-(l.y-1)/2;t.wrapper.style.opacity=l.z>0&&l.z<1?"1":"0",t.wrapper.style.transform="translate(".concat(h*100,"%, ").concat(c*100,"%)")}},t.onFiveCameraUpdate=function(l){t.changeTapScreenPosition()},t.dispose=function(){t.disable()},t.five=e;var a={enabled:!0,visible:!0,mode:"box",selectedId:null,selectAll:!1};t.state=Object.assign(a,n==null?void 0:n.initialState);var s=V({},n==null?void 0:n.config);return t._config=s,t.group.rotateX(Math.PI),t.wrapper.className="ItemMaskPlugin",t.wrapper.innerHTML='<span class="ItemMaskPluginCircle"></span><span class="ItemMaskPluginCircle"></span>',t.style.innerHTML=`
|
|
308
308
|
.ItemMaskPlugin {
|
|
309
309
|
position: absolute;
|
|
310
310
|
top: 0;
|
|
@@ -322,7 +322,7 @@ void main() {
|
|
|
322
322
|
border-radius: 50%;
|
|
323
323
|
box-shadow: 0px 0px 0px 2px #fff;
|
|
324
324
|
}
|
|
325
|
-
`,t.state.enabled&&t._enable({userAction:!1}),t}return Object.defineProperty(
|
|
325
|
+
`,t.state.enabled&&t._enable({userAction:!1}),t}return Object.defineProperty(o.prototype,"config",{get:function(){return V({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(e,n){var t=this.state;this.state=V(V({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},o.prototype.load=function(e){return Oe(this,void 0,void 0,function(){var n,t,a=this;return _e(this,function(s){return this.data=e,n=e.data_list.map(function(l){var h,c=l.position.end.map(function(O){return Number(O)}),g=l.position.start.map(function(O){return Number(O)}),w=Math.abs(c[0]-g[0]),M=Math.abs(c[1]-g[1]),T=Math.abs(c[2]-g[2]),E=c[0]/2+g[0]/2,S=c[1]/2+g[1]/2,C=c[2]/2+g[2]/2,b=new v.Vector3(E,S,C),y=new v.BoxBufferGeometry(w,M,T),A=new v.ShaderMaterial({vertexShader:`
|
|
326
326
|
varying vec2 vUv;
|
|
327
327
|
void main() {
|
|
328
328
|
vUv = uv;
|
|
@@ -347,13 +347,13 @@ void main() {
|
|
|
347
347
|
gl_FragColor = vec4(1.0, 1.0, 1.0, alpha / 4.0 * opacity);
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
`,side:
|
|
350
|
+
`,side:v.DoubleSide,visible:a.state.selectedId==="".concat(l.category_name).concat(l.index),uniforms:{opacity:{value:a.state.mode==="box"?1:0}},depthWrite:!1,depthTest:!1,transparent:!0}),m=new v.Mesh(y,A);return m.position.copy(b),m.name="".concat(l.category_name).concat(l.index),m.userData.color=new((h=v.Vector4).bind.apply(h,_t(_t([void 0],l.mask_color.map(function(O){return O/255}).reverse(),!1),[1],!1))),m.userData.visible_viewpoint=Object.keys(l.visible_viewpoint),m}),(t=this.group).add.apply(t,n),[2]})})},o.prototype.setState=function(e,n){n===void 0&&(n={});var t=this.state,a=n.userAction!==void 0?n.userAction:!0;if(this.updateState(e,a),e.enabled!==void 0&&t.enabled!==e.enabled){var s={userAction:a};e.enabled?this._enable(s):this._disable(s)}},o.prototype.setMode=function(e){this.updateState({mode:e},!1),e==="mask"?(this.group.children.forEach(function(n){n.material.uniforms.opacity.value=0}),this.loadPanoMask(this.five.state.panoIndex)):e==="box"&&(this.itemMaskMesh.material.uniforms.color.value=new v.Vector4(0,0,0,1),this.group.children.forEach(function(n){n.material.uniforms.opacity.value=1}),this.five.needsRender=!0)},o.prototype.select=function(e,n){var t=this,a;this.updateState({selectedId:e!=null?e:null},(a=n==null?void 0:n.userAction)!==null&&a!==void 0?a:!1),this.group.children.forEach(function(s){s.material.visible=t.state.selectAll||s.name===e}),this.five.needsRender=!0},o.prototype.selectAll=function(e){e===void 0&&(e=!0),this.updateState({selectAll:!!e},!1),this.select()},o.prototype._enable=function(e){this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("wantsMoveToPano",this.onFiveWantsMoveToPano),this.five.on("gesture.mousemove",this.onFiveMouseMove),this.five.on("wantsTapGesture",this.onFiveTapGesture),this.five.on("cameraUpdate",this.onFiveCameraUpdate),this.five.scene.add(this.group),document.head.appendChild(this.style)},o.prototype._disable=function(e){this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("wantsMoveToPano",this.onFiveWantsMoveToPano),this.five.off("gesture.mousemove",this.onFiveMouseMove),this.five.off("wantsTapGesture",this.onFiveTapGesture),this.five.off("cameraUpdate",this.onFiveCameraUpdate),this.five.scene.remove(this.group),document.head.removeChild(this.style)},o.prototype.enable=function(e){var n;if(!this.state.enabled){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!0},t),this._enable({userAction:t})}},o.prototype.disable=function(e){var n;if(this.state.enabled!==!1){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!1},t),this._disable({userAction:t})}},o})(te.BasePlugin.Controller),dn=function(f,o){return new hn(f,o)};/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
351
351
|
* http://hammerjs.github.io/
|
|
352
352
|
*
|
|
353
353
|
* Copyright (c) 2016 Jorik Tangelder;
|
|
354
|
-
* Licensed under the MIT license */var ft=(function(
|
|
354
|
+
* Licensed under the MIT license */var ft=(function(f,o,e,n){var t=["","webkit","Moz","MS","ms","o"],a=o.createElement?o.createElement("div"):n,s="function",l=Math.round,h=Math.abs,c=Date.now;function g(r,i,u){return setTimeout(y(r,u),i)}function w(r,i,u){return Array.isArray(r)?(M(r,u[i],u),!0):!1}function M(r,i,u){var p;if(r)if(r.forEach)r.forEach(i,u);else if(r.length!==n)for(p=0;p<r.length;)i.call(u,r[p],p,r),p++;else for(p in r)r.hasOwnProperty(p)&&i.call(u,r[p],p,r)}function T(r,i,u){var p="DEPRECATED METHOD: "+i+`
|
|
355
355
|
`+u+` AT
|
|
356
|
-
`;return function(){var T=new Error("get-stack-trace"),M=T&&T.stack?T.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",L=c.console&&(c.console.warn||c.console.log);return L&&L.call(c.console,v,M),r.apply(this,arguments)}}var S;typeof Object.assign!="function"?S=function(i){if(i===n||i===null)throw new TypeError("Cannot convert undefined or null to object");for(var u=Object(i),v=1;v<arguments.length;v++){var T=arguments[v];if(T!==n&&T!==null)for(var M in T)T.hasOwnProperty(M)&&(u[M]=T[M])}return u}:S=Object.assign;var E=x(function(i,u,v){for(var T=Object.keys(u),M=0;M<T.length;)(!v||v&&i[T[M]]===n)&&(i[T[M]]=u[T[M]]),M++;return i},"extend","Use `assign`."),C=x(function(i,u){return E(i,u,!0)},"merge","Use `assign`.");function P(r,i,u){var v=i.prototype,T;T=r.prototype=Object.create(v),T.constructor=r,T._super=v,u&&S(T,u)}function b(r,i){return function(){return r.apply(i,arguments)}}function A(r,i){return typeof r==s?r.apply(i&&i[0]||n,i):r}function m(r,i){return r===n?i:r}function O(r,i,u){w(z(i),function(v){r.addEventListener(v,u,!1)})}function _(r,i,u){w(z(i),function(v){r.removeEventListener(v,u,!1)})}function X(r,i){for(;r;){if(r==i)return!0;r=r.parentNode}return!1}function Y(r,i){return r.indexOf(i)>-1}function z(r){return r.trim().split(/\s+/g)}function $(r,i,u){if(r.indexOf&&!u)return r.indexOf(i);for(var v=0;v<r.length;){if(u&&r[v][u]==i||!u&&r[v]===i)return v;v++}return-1}function le(r){return Array.prototype.slice.call(r,0)}function ce(r,i,u){for(var v=[],T=[],M=0;M<r.length;){var L=r[M][i];$(T,L)<0&&v.push(r[M]),T[M]=L,M++}return v=v.sort(function(he,te){return he[i]>te[i]}),v}function ee(r,i){for(var u,v,T=i[0].toUpperCase()+i.slice(1),M=0;M<t.length;){if(u=t[M],v=u?u+T:i,v in r)return v;M++}return n}var J=1;function F(){return J++}function N(r){var i=r.ownerDocument||r;return i.defaultView||i.parentWindow||c}var k=/mobile|tablet|ip(ad|hone|od)|android/i,U="ontouchstart"in c,W=ee(c,"PointerEvent")!==n,se=U&&k.test(navigator.userAgent),q="touch",j="pen",ne="mouse",G="kinect",R=25,D=1,oe=2,H=4,K=8,Ce=1,Se=2,Ie=4,Ne=8,Ee=16,fe=Se|Ie,me=Ne|Ee,je=fe|me,Re=["x","y"],ke=["clientX","clientY"];function ue(r,i){var u=this;this.manager=r,this.callback=i,this.element=r.element,this.target=r.options.inputTarget,this.domHandler=function(v){A(r.options.enable,[r])&&u.handler(v)},this.init()}ue.prototype={handler:function(){},init:function(){this.evEl&&O(this.element,this.evEl,this.domHandler),this.evTarget&&O(this.target,this.evTarget,this.domHandler),this.evWin&&O(N(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(N(this.element),this.evWin,this.domHandler)}};function Je(r){var i,u=r.options.inputClass;return u?i=u:W?i=wt:se?i=nt:U?i=Tt:i=tt,new i(r,$e)}function $e(r,i,u){var v=u.pointers.length,T=u.changedPointers.length,M=i&D&&v-T===0,L=i&(H|K)&&v-T===0;u.isFirst=!!M,u.isFinal=!!L,M&&(r.session={}),u.eventType=i,d(r,u),r.emit("hammer.input",u),r.recognize(u),r.session.prevInput=u}function d(r,i){var u=r.session,v=i.pointers,T=v.length;u.firstInput||(u.firstInput=re(i)),T>1&&!u.firstMultiple?u.firstMultiple=re(i):T===1&&(u.firstMultiple=!1);var M=u.firstInput,L=u.firstMultiple,ie=L?L.center:M.center,he=i.center=ye(v);i.timeStamp=f(),i.deltaTime=i.timeStamp-M.timeStamp,i.angle=bt(ie,he),i.distance=et(ie,he),B(u,i),i.offsetDirection=Pe(i.deltaX,i.deltaY);var te=Ge(i.deltaTime,i.deltaX,i.deltaY);i.overallVelocityX=te.x,i.overallVelocityY=te.y,i.overallVelocity=h(te.x)>h(te.y)?te.x:te.y,i.scale=L?On(L.pointers,v):1,i.rotation=L?_n(L.pointers,v):0,i.maxPointers=u.prevInput?i.pointers.length>u.prevInput.maxPointers?i.pointers.length:u.prevInput.maxPointers:i.pointers.length,Z(u,i);var we=r.element;X(i.srcEvent.target,we)&&(we=i.srcEvent.target),i.target=we}function B(r,i){var u=i.center,v=r.offsetDelta||{},T=r.prevDelta||{},M=r.prevInput||{};(i.eventType===D||M.eventType===H)&&(T=r.prevDelta={x:M.deltaX||0,y:M.deltaY||0},v=r.offsetDelta={x:u.x,y:u.y}),i.deltaX=T.x+(u.x-v.x),i.deltaY=T.y+(u.y-v.y)}function Z(r,i){var u=r.lastInterval||i,v=i.timeStamp-u.timeStamp,T,M,L,ie;if(i.eventType!=K&&(v>R||u.velocity===n)){var he=i.deltaX-u.deltaX,te=i.deltaY-u.deltaY,we=Ge(v,he,te);M=we.x,L=we.y,T=h(we.x)>h(we.y)?we.x:we.y,ie=Pe(he,te),r.lastInterval=i}else T=u.velocity,M=u.velocityX,L=u.velocityY,ie=u.direction;i.velocity=T,i.velocityX=M,i.velocityY=L,i.direction=ie}function re(r){for(var i=[],u=0;u<r.pointers.length;)i[u]={clientX:l(r.pointers[u].clientX),clientY:l(r.pointers[u].clientY)},u++;return{timeStamp:f(),pointers:i,center:ye(i),deltaX:r.deltaX,deltaY:r.deltaY}}function ye(r){var i=r.length;if(i===1)return{x:l(r[0].clientX),y:l(r[0].clientY)};for(var u=0,v=0,T=0;T<i;)u+=r[T].clientX,v+=r[T].clientY,T++;return{x:l(u/i),y:l(v/i)}}function Ge(r,i,u){return{x:i/r||0,y:u/r||0}}function Pe(r,i){return r===i?Ce:h(r)>=h(i)?r<0?Se:Ie:i<0?Ne:Ee}function et(r,i,u){u||(u=Re);var v=i[u[0]]-r[u[0]],T=i[u[1]]-r[u[1]];return Math.sqrt(v*v+T*T)}function bt(r,i,u){u||(u=Re);var v=i[u[0]]-r[u[0]],T=i[u[1]]-r[u[1]];return Math.atan2(T,v)*180/Math.PI}function _n(r,i){return bt(i[1],i[0],ke)+bt(r[1],r[0],ke)}function On(r,i){return et(i[0],i[1],ke)/et(r[0],r[1],ke)}var Cn={mousedown:D,mousemove:oe,mouseup:H},In="mousedown",Nn="mousemove mouseup";function tt(){this.evEl=In,this.evWin=Nn,this.pressed=!1,ue.apply(this,arguments)}P(tt,ue,{handler:function(i){var u=Cn[i.type];u&D&&(i.button===0||i.button===2)&&(this.pressed=!0),u&oe&&i.which!==1&&(u=H),this.pressed&&(u&H&&(this.pressed=!1),this.callback(this.manager,u,{pointers:[i],changedPointers:[i],pointerType:ne,srcEvent:i}))}});var Ut={pointerdown:D,pointermove:oe,pointerup:H,pointercancel:K,pointerout:K},kn={2:q,3:j,4:ne,5:G},Vt="pointerdown",zt="pointermove pointerup pointercancel";c.MSPointerEvent&&!c.PointerEvent&&(Vt="MSPointerDown",zt="MSPointerMove MSPointerUp MSPointerCancel");function wt(){this.evEl=Vt,this.evWin=zt,ue.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}P(wt,ue,{handler:function(i){var u=this.store,v=!1,T=!1,M=i.type.toLowerCase().replace("ms",""),L=Ut[M],ie=kn[i.pointerType]||i.pointerType,he=ie==q,te=$(u,i.pointerId,"pointerId");L&D&&(i.button===0||i.button===2||he)?te<0&&(u.push(i),te=u.length-1):L&(H|K)?v=!0:!he&&i.buttons===0&&(v=!0,T=!0,L=Ut.pointerup),!(te<0)&&(T||(u[te]=i),this.callback(this.manager,L,{pointers:u,changedPointers:[i],pointerType:ie,srcEvent:u[te]}),v&&u.splice(te,1))}});var Ln={touchstart:D,touchmove:oe,touchend:H,touchcancel:K},Dn="touchstart",Fn="touchstart touchmove touchend touchcancel";function jt(){this.evTarget=Dn,this.evWin=Fn,this.started=!1,ue.apply(this,arguments)}P(jt,ue,{handler:function(i){var u=Ln[i.type];if(u===D&&(this.started=!0),!!this.started){var v=Bn.call(this,i,u);u&(H|K)&&v[0].length-v[1].length===0&&(this.started=!1),this.callback(this.manager,u,{pointers:v[0],changedPointers:v[1],pointerType:q,srcEvent:i})}}});function Bn(r,i){var u=le(r.touches),v=le(r.changedTouches);return i&(H|K)&&(u=ce(u.concat(v),"identifier")),[u,v]}var Un={touchstart:D,touchmove:oe,touchend:H,touchcancel:K},Vn="touchstart touchmove touchend touchcancel";function nt(){this.evTarget=Vn,this.targetIds={},ue.apply(this,arguments)}P(nt,ue,{handler:function(i){var u=Un[i.type],v=zn.call(this,i,u);v&&this.callback(this.manager,u,{pointers:v[0],changedPointers:v[1],pointerType:q,srcEvent:i})}});function zn(r,i){var u=le(r.touches),v=this.targetIds;if(i&(D|oe)&&u.length===1)return v[u[0].identifier]=!0,[u,u];var T,M,L=le(r.changedTouches),ie=[],he=this.target;if(M=u.filter(function(te){return X(te.target,he)}),i===D)for(T=0;T<M.length;)v[M[T].identifier]=!0,T++;for(T=0;T<L.length;)v[L[T].identifier]&&ie.push(L[T]),i&(H|K)&&delete v[L[T].identifier],T++;if(ie.length)return[ce(M.concat(ie),"identifier"),ie]}var jn=2500,Rt=25;function Tt(){ue.apply(this,arguments);var r=b(this.handler,this);this.touch=new nt(this.manager,r),this.mouse=new tt(this.manager,r),this.primaryTouch=null,this.lastTouches=[]}P(Tt,ue,{handler:function(i,u,v){var T=v.pointerType==q,M=v.pointerType==ne;if(!(M&&v.sourceCapabilities&&v.sourceCapabilities.firesTouchEvents)){if(T)Rn.call(this,u,v);else if(M&&Gn.call(this,v))return;this.callback(i,u,v)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Rn(r,i){r&D?(this.primaryTouch=i.changedPointers[0].identifier,Gt.call(this,i)):r&(H|K)&&Gt.call(this,i)}function Gt(r){var i=r.changedPointers[0];if(i.identifier===this.primaryTouch){var u={x:i.clientX,y:i.clientY};this.lastTouches.push(u);var v=this.lastTouches,T=function(){var M=v.indexOf(u);M>-1&&v.splice(M,1)};setTimeout(T,jn)}}function Gn(r){for(var i=r.srcEvent.clientX,u=r.srcEvent.clientY,v=0;v<this.lastTouches.length;v++){var T=this.lastTouches[v],M=Math.abs(i-T.x),L=Math.abs(u-T.y);if(M<=Rt&&L<=Rt)return!0}return!1}var Yt=o?ee(o.style,"touchAction"):n,Wt=Yt!==n,Xt="compute",Ht="auto",Pt="manipulation",Le="none",Ye="pan-x",We="pan-y",rt=Wn();function xt(r,i){this.manager=r,this.set(i)}xt.prototype={set:function(r){r==Xt&&(r=this.compute()),Wt&&this.manager.element.style&&rt[r]&&(this.manager.element.style[Yt]=r),this.actions=r.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var r=[];return w(this.manager.recognizers,function(i){A(i.options.enable,[i])&&(r=r.concat(i.getTouchAction()))}),Yn(r.join(" "))},preventDefaults:function(r){var i=r.srcEvent,u=r.offsetDirection;if(this.manager.session.prevented){i.preventDefault();return}var v=this.actions,T=Y(v,Le)&&!rt[Le],M=Y(v,We)&&!rt[We],L=Y(v,Ye)&&!rt[Ye];if(T){var ie=r.pointers.length===1,he=r.distance<2,te=r.deltaTime<250;if(ie&&he&&te)return}if(!(L&&M)&&(T||M&&u&fe||L&&u&me))return this.preventSrc(i)},preventSrc:function(r){this.manager.session.prevented=!0,r.preventDefault()}};function Yn(r){if(Y(r,Le))return Le;var i=Y(r,Ye),u=Y(r,We);return i&&u?Le:i||u?i?Ye:We:Y(r,Pt)?Pt:Ht}function Wn(){if(!Wt)return!1;var r={},i=c.CSS&&c.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(u){r[u]=i?c.CSS.supports("touch-action",u):!0}),r}var it=1,ve=2,Fe=4,Me=8,xe=Me,Xe=16,be=32;function Ae(r){this.options=S({},this.defaults,r||{}),this.id=F(),this.manager=null,this.options.enable=m(this.options.enable,!0),this.state=it,this.simultaneous={},this.requireFail=[]}Ae.prototype={defaults:{},set:function(r){return S(this.options,r),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(r){if(y(r,"recognizeWith",this))return this;var i=this.simultaneous;return r=at(r,this),i[r.id]||(i[r.id]=r,r.recognizeWith(this)),this},dropRecognizeWith:function(r){return y(r,"dropRecognizeWith",this)?this:(r=at(r,this),delete this.simultaneous[r.id],this)},requireFailure:function(r){if(y(r,"requireFailure",this))return this;var i=this.requireFail;return r=at(r,this),$(i,r)===-1&&(i.push(r),r.requireFailure(this)),this},dropRequireFailure:function(r){if(y(r,"dropRequireFailure",this))return this;r=at(r,this);var i=$(this.requireFail,r);return i>-1&&this.requireFail.splice(i,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(r){return!!this.simultaneous[r.id]},emit:function(r){var i=this,u=this.state;function v(T){i.manager.emit(T,r)}u<Me&&v(i.options.event+qt(u)),v(i.options.event),r.additionalEvent&&v(r.additionalEvent),u>=Me&&v(i.options.event+qt(u))},tryEmit:function(r){if(this.canEmit())return this.emit(r);this.state=be},canEmit:function(){for(var r=0;r<this.requireFail.length;){if(!(this.requireFail[r].state&(be|it)))return!1;r++}return!0},recognize:function(r){var i=S({},r);if(!A(this.options.enable,[this,i])){this.reset(),this.state=be;return}this.state&(xe|Xe|be)&&(this.state=it),this.state=this.process(i),this.state&(ve|Fe|Me|Xe)&&this.tryEmit(i)},process:function(r){},getTouchAction:function(){},reset:function(){}};function qt(r){return r&Xe?"cancel":r&Me?"end":r&Fe?"move":r&ve?"start":""}function Kt(r){return r==Ee?"down":r==Ne?"up":r==Se?"left":r==Ie?"right":""}function at(r,i){var u=i.manager;return u?u.get(r):r}function ge(){Ae.apply(this,arguments)}P(ge,Ae,{defaults:{pointers:1},attrTest:function(r){var i=this.options.pointers;return i===0||r.pointers.length===i},process:function(r){var i=this.state,u=r.eventType,v=i&(ve|Fe),T=this.attrTest(r);return v&&(u&K||!T)?i|Xe:v||T?u&H?i|Me:i&ve?i|Fe:ve:be}});function ot(){ge.apply(this,arguments),this.pX=null,this.pY=null}P(ot,ge,{defaults:{event:"pan",threshold:10,pointers:1,direction:je},getTouchAction:function(){var r=this.options.direction,i=[];return r&fe&&i.push(We),r&me&&i.push(Ye),i},directionTest:function(r){var i=this.options,u=!0,v=r.distance,T=r.direction,M=r.deltaX,L=r.deltaY;return T&i.direction||(i.direction&fe?(T=M===0?Ce:M<0?Se:Ie,u=M!=this.pX,v=Math.abs(r.deltaX)):(T=L===0?Ce:L<0?Ne:Ee,u=L!=this.pY,v=Math.abs(r.deltaY))),r.direction=T,u&&v>i.threshold&&T&i.direction},attrTest:function(r){return ge.prototype.attrTest.call(this,r)&&(this.state&ve||!(this.state&ve)&&this.directionTest(r))},emit:function(r){this.pX=r.deltaX,this.pY=r.deltaY;var i=Kt(r.direction);i&&(r.additionalEvent=this.options.event+i),this._super.emit.call(this,r)}});function At(){ge.apply(this,arguments)}P(At,ge,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Le]},attrTest:function(r){return this._super.attrTest.call(this,r)&&(Math.abs(r.scale-1)>this.options.threshold||this.state&ve)},emit:function(r){if(r.scale!==1){var i=r.scale<1?"in":"out";r.additionalEvent=this.options.event+i}this._super.emit.call(this,r)}});function St(){Ae.apply(this,arguments),this._timer=null,this._input=null}P(St,Ae,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ht]},process:function(r){var i=this.options,u=r.pointers.length===i.pointers,v=r.distance<i.threshold,T=r.deltaTime>i.time;if(this._input=r,!v||!u||r.eventType&(H|K)&&!T)this.reset();else if(r.eventType&D)this.reset(),this._timer=g(function(){this.state=xe,this.tryEmit()},i.time,this);else if(r.eventType&H)return xe;return be},reset:function(){clearTimeout(this._timer)},emit:function(r){this.state===xe&&(r&&r.eventType&H?this.manager.emit(this.options.event+"up",r):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}});function Et(){ge.apply(this,arguments)}P(Et,ge,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Le]},attrTest:function(r){return this._super.attrTest.call(this,r)&&(Math.abs(r.rotation)>this.options.threshold||this.state&ve)}});function Mt(){ge.apply(this,arguments)}P(Mt,ge,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:fe|me,pointers:1},getTouchAction:function(){return ot.prototype.getTouchAction.call(this)},attrTest:function(r){var i=this.options.direction,u;return i&(fe|me)?u=r.overallVelocity:i&fe?u=r.overallVelocityX:i&me&&(u=r.overallVelocityY),this._super.attrTest.call(this,r)&&i&r.offsetDirection&&r.distance>this.options.threshold&&r.maxPointers==this.options.pointers&&h(u)>this.options.velocity&&r.eventType&H},emit:function(r){var i=Kt(r.offsetDirection);i&&this.manager.emit(this.options.event+i,r),this.manager.emit(this.options.event,r)}});function st(){Ae.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}P(st,Ae,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Pt]},process:function(r){var i=this.options,u=r.pointers.length===i.pointers,v=r.distance<i.threshold,T=r.deltaTime<i.time;if(this.reset(),r.eventType&D&&this.count===0)return this.failTimeout();if(v&&T&&u){if(r.eventType!=H)return this.failTimeout();var M=this.pTime?r.timeStamp-this.pTime<i.interval:!0,L=!this.pCenter||et(this.pCenter,r.center)<i.posThreshold;this.pTime=r.timeStamp,this.pCenter=r.center,!L||!M?this.count=1:this.count+=1,this._input=r;var ie=this.count%i.taps;if(ie===0)return this.hasRequireFailures()?(this._timer=g(function(){this.state=xe,this.tryEmit()},i.interval,this),ve):xe}return be},failTimeout:function(){return this._timer=g(function(){this.state=be},this.options.interval,this),be},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==xe&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Be(r,i){return i=i||{},i.recognizers=m(i.recognizers,Be.defaults.preset),new _t(r,i)}Be.VERSION="2.0.7",Be.defaults={domEvents:!1,touchAction:Xt,enable:!0,inputTarget:null,inputClass:null,preset:[[Et,{enable:!1}],[At,{enable:!1},["rotate"]],[Mt,{direction:fe}],[ot,{direction:fe},["swipe"]],[st],[st,{event:"doubletap",taps:2},["tap"]],[St]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Xn=1,Zt=2;function _t(r,i){this.options=S({},Be.defaults,i||{}),this.options.inputTarget=this.options.inputTarget||r,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=r,this.input=Je(this),this.touchAction=new xt(this,this.options.touchAction),Qt(this,!0),w(this.options.recognizers,function(u){var v=this.add(new u[0](u[1]));u[2]&&v.recognizeWith(u[2]),u[3]&&v.requireFailure(u[3])},this)}_t.prototype={set:function(r){return S(this.options,r),r.touchAction&&this.touchAction.update(),r.inputTarget&&(this.input.destroy(),this.input.target=r.inputTarget,this.input.init()),this},stop:function(r){this.session.stopped=r?Zt:Xn},recognize:function(r){var i=this.session;if(!i.stopped){this.touchAction.preventDefaults(r);var u,v=this.recognizers,T=i.curRecognizer;(!T||T&&T.state&xe)&&(T=i.curRecognizer=null);for(var M=0;M<v.length;)u=v[M],i.stopped!==Zt&&(!T||u==T||u.canRecognizeWith(T))?u.recognize(r):u.reset(),!T&&u.state&(ve|Fe|Me)&&(T=i.curRecognizer=u),M++}},get:function(r){if(r instanceof Ae)return r;for(var i=this.recognizers,u=0;u<i.length;u++)if(i[u].options.event==r)return i[u];return null},add:function(r){if(y(r,"add",this))return this;var i=this.get(r.options.event);return i&&this.remove(i),this.recognizers.push(r),r.manager=this,this.touchAction.update(),r},remove:function(r){if(y(r,"remove",this))return this;if(r=this.get(r),r){var i=this.recognizers,u=$(i,r);u!==-1&&(i.splice(u,1),this.touchAction.update())}return this},on:function(r,i){if(r!==n&&i!==n){var u=this.handlers;return w(z(r),function(v){u[v]=u[v]||[],u[v].push(i)}),this}},off:function(r,i){if(r!==n){var u=this.handlers;return w(z(r),function(v){i?u[v]&&u[v].splice($(u[v],i),1):delete u[v]}),this}},emit:function(r,i){this.options.domEvents&&Hn(r,i);var u=this.handlers[r]&&this.handlers[r].slice();if(!(!u||!u.length)){i.type=r,i.preventDefault=function(){i.srcEvent.preventDefault()};for(var v=0;v<u.length;)u[v](i),v++}},destroy:function(){this.element&&Qt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Qt(r,i){var u=r.element;if(u.style){var v;w(r.options.cssProps,function(T,M){v=ee(u.style,M),i?(r.oldCssProps[v]=u.style[v],u.style[v]=T):u.style[v]=r.oldCssProps[v]||""}),i||(r.oldCssProps={})}}function Hn(r,i){var u=a.createEvent("Event");u.initEvent(r,!0,!0),u.gesture=i,i.target.dispatchEvent(u)}return S(Be,{INPUT_START:D,INPUT_MOVE:oe,INPUT_END:H,INPUT_CANCEL:K,STATE_POSSIBLE:it,STATE_BEGAN:ve,STATE_CHANGED:Fe,STATE_ENDED:Me,STATE_RECOGNIZED:xe,STATE_CANCELLED:Xe,STATE_FAILED:be,DIRECTION_NONE:Ce,DIRECTION_LEFT:Se,DIRECTION_RIGHT:Ie,DIRECTION_UP:Ne,DIRECTION_DOWN:Ee,DIRECTION_HORIZONTAL:fe,DIRECTION_VERTICAL:me,DIRECTION_ALL:je,Manager:_t,Input:ue,TouchAction:xt,TouchInput:nt,MouseInput:tt,PointerEventInput:wt,TouchMouseInput:Tt,SingleTouchInput:jt,Recognizer:Ae,AttrRecognizer:ge,Tap:st,Pan:ot,Swipe:Mt,Pinch:At,Rotate:Et,Press:St,on:O,off:_,each:w,merge:C,extend:E,assign:S,inherit:P,bindFn:b,prefixed:ee}),Be})(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{}),De=function(c,a){a===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),a===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=c,this.domElement=a,this.enabled=!0,this.target=new I.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:I.MOUSE.ROTATE,MIDDLE:I.MOUSE.DOLLY,RIGHT:I.MOUSE.PAN},this.touches={ONE:I.TOUCH.ROTATE,TWO:I.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return f.phi},this.getAzimuthalAngle=function(){return f.theta},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent(n),e.update(),l=s.NONE},this.update=(function(){var d=new I.Vector3,B=new I.Quaternion().setFromUnitVectors(c.up,new I.Vector3(0,1,0)),Z=B.clone().inverse(),re=new I.Vector3,ye=new I.Quaternion;return function(){var Pe=e.object.position;return d.copy(Pe).sub(e.target),d.applyQuaternion(B),f.setFromVector3(d),e.autoRotate&&l===s.NONE&&z(X()),e.enableDamping?(f.theta+=g.theta*e.dampingFactor,f.phi+=g.phi*e.dampingFactor):(f.theta+=g.theta,f.phi+=g.phi),f.theta=Math.max(e.minAzimuthAngle,Math.min(e.maxAzimuthAngle,f.theta)),f.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,f.phi)),f.makeSafe(),f.radius*=y,f.radius=Math.max(e.minDistance,Math.min(e.maxDistance,f.radius)),e.enableDamping===!0?e.target.addScaledVector(w,e.dampingFactor):e.target.add(w),d.setFromSpherical(f),d.applyQuaternion(Z),Pe.copy(e.target).add(d),e.object.lookAt(e.target),e.enableDamping===!0?(g.theta*=1-e.dampingFactor,g.phi*=1-e.dampingFactor,w.multiplyScalar(1-e.dampingFactor)):(g.set(0,0,0),w.set(0,0,0)),y=1,x||re.distanceToSquared(e.object.position)>h||8*(1-ye.dot(e.object.quaternion))>h?(e.dispatchEvent(n),re.copy(e.object.position),ye.copy(e.object.quaternion),x=!1,!0):!1}})(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",$e,!1),e.domElement.removeEventListener("mousedown",Ee,!1),e.domElement.removeEventListener("wheel",je,!1),e.domElement.removeEventListener("touchstart",ke,!1),e.domElement.removeEventListener("touchend",Je,!1),e.domElement.removeEventListener("touchmove",ue,!1),document.removeEventListener("mousemove",fe,!1),document.removeEventListener("mouseup",me,!1),e.domElement.removeEventListener("keydown",Re,!1)};var e=this,n={type:"change"},t={type:"start"},o={type:"end"},s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},l=s.NONE,h=1e-6,f=new I.Spherical,g=new I.Spherical,y=1,w=new I.Vector3,x=!1,S=new I.Vector2,E=new I.Vector2,C=new I.Vector2,P=new I.Vector2,b=new I.Vector2,A=new I.Vector2,m=new I.Vector2,O=new I.Vector2,_=new I.Vector2;function X(){return 2*Math.PI/60/60*e.autoRotateSpeed}function Y(){return Math.pow(.95,e.zoomSpeed)}function z(d){g.theta-=d}function $(d){g.phi-=d}var le=(function(){var d=new I.Vector3;return function(Z,re){d.setFromMatrixColumn(re,0),d.multiplyScalar(-Z),w.add(d)}})(),ce=(function(){var d=new I.Vector3;return function(Z,re){e.screenSpacePanning===!0?d.setFromMatrixColumn(re,1):(d.setFromMatrixColumn(re,0),d.crossVectors(e.object.up,d)),d.multiplyScalar(Z),w.add(d)}})(),ee=(function(){var d=new I.Vector3;return function(Z,re){var ye=e.domElement;if(e.object.isPerspectiveCamera){var Ge=e.object.position;d.copy(Ge).sub(e.target);var Pe=d.length();Pe*=Math.tan(e.object.fov/2*Math.PI/180),le(2*Z*Pe/ye.clientHeight,e.object.matrix),ce(2*re*Pe/ye.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(le(Z*(e.object.right-e.object.left)/e.object.zoom/ye.clientWidth,e.object.matrix),ce(re*(e.object.top-e.object.bottom)/e.object.zoom/ye.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}})();function J(d){e.object.isPerspectiveCamera?y/=d:e.object.isOrthographicCamera?(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom*d)),e.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function F(d){e.object.isPerspectiveCamera?y*=d:e.object.isOrthographicCamera?(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/d)),e.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function N(d){S.set(d.clientX,d.clientY)}function k(d){m.set(d.clientX,d.clientY)}function U(d){P.set(d.clientX,d.clientY)}function W(d){E.set(d.clientX,d.clientY),C.subVectors(E,S).multiplyScalar(e.rotateSpeed);var B=e.domElement;z(2*Math.PI*C.x/B.clientHeight),$(2*Math.PI*C.y/B.clientHeight),S.copy(E),e.update()}function se(d){O.set(d.clientX,d.clientY),_.subVectors(O,m),_.y>0?J(Y()):_.y<0&&F(Y()),m.copy(O),e.update()}function q(d){b.set(d.clientX,d.clientY),A.subVectors(b,P).multiplyScalar(e.panSpeed),ee(A.x,A.y),P.copy(b),e.update()}function j(d){d.deltaY<0?F(Y()):d.deltaY>0&&J(Y()),e.update()}function ne(d){var B=!1;switch(d.keyCode){case e.keys.UP:ee(0,e.keyPanSpeed),B=!0;break;case e.keys.BOTTOM:ee(0,-e.keyPanSpeed),B=!0;break;case e.keys.LEFT:ee(e.keyPanSpeed,0),B=!0;break;case e.keys.RIGHT:ee(-e.keyPanSpeed,0),B=!0;break}B&&(d.preventDefault(),e.update())}function G(d){if(d.touches.length==1)S.set(d.touches[0].pageX,d.touches[0].pageY);else{var B=.5*(d.touches[0].pageX+d.touches[1].pageX),Z=.5*(d.touches[0].pageY+d.touches[1].pageY);S.set(B,Z)}}function R(d){if(d.touches.length==1)P.set(d.touches[0].pageX,d.touches[0].pageY);else{var B=.5*(d.touches[0].pageX+d.touches[1].pageX),Z=.5*(d.touches[0].pageY+d.touches[1].pageY);P.set(B,Z)}}function D(d){var B=d.touches[0].pageX-d.touches[1].pageX,Z=d.touches[0].pageY-d.touches[1].pageY,re=Math.sqrt(B*B+Z*Z);m.set(0,re)}function oe(d){e.enableZoom&&D(d),e.enablePan&&R(d)}function H(d){e.enableZoom&&D(d),e.enableRotate&&G(d)}function K(d){if(d.touches.length==1)E.set(d.touches[0].pageX,d.touches[0].pageY);else{var B=.5*(d.touches[0].pageX+d.touches[1].pageX),Z=.5*(d.touches[0].pageY+d.touches[1].pageY);E.set(B,Z)}C.subVectors(E,S).multiplyScalar(e.rotateSpeed);var re=e.domElement;z(2*Math.PI*C.x/re.clientHeight),$(2*Math.PI*C.y/re.clientHeight),S.copy(E)}function Ce(d){if(d.touches.length==1)b.set(d.touches[0].pageX,d.touches[0].pageY);else{var B=.5*(d.touches[0].pageX+d.touches[1].pageX),Z=.5*(d.touches[0].pageY+d.touches[1].pageY);b.set(B,Z)}A.subVectors(b,P).multiplyScalar(e.panSpeed),ee(A.x,A.y),P.copy(b)}function Se(d){var B=d.touches[0].pageX-d.touches[1].pageX,Z=d.touches[0].pageY-d.touches[1].pageY,re=Math.sqrt(B*B+Z*Z);O.set(0,re),_.set(0,Math.pow(O.y/m.y,e.zoomSpeed)),J(_.y),m.copy(O)}function Ie(d){e.enableZoom&&Se(d),e.enablePan&&Ce(d)}function Ne(d){e.enableZoom&&Se(d),e.enableRotate&&K(d)}function Ee(d){if(e.enabled!==!1){d.preventDefault(),e.domElement.focus?e.domElement.focus():window.focus();var B;switch(d.button){case 0:B=e.mouseButtons.LEFT;break;case 1:B=e.mouseButtons.MIDDLE;break;case 2:B=e.mouseButtons.RIGHT;break;default:B=-1}switch(B){case I.MOUSE.DOLLY:if(e.enableZoom===!1)return;k(d),l=s.DOLLY;break;case I.MOUSE.ROTATE:if(d.ctrlKey||d.metaKey||d.shiftKey){if(e.enablePan===!1)return;U(d),l=s.PAN}else{if(e.enableRotate===!1)return;N(d),l=s.ROTATE}break;case I.MOUSE.PAN:if(d.ctrlKey||d.metaKey||d.shiftKey){if(e.enableRotate===!1)return;N(d),l=s.ROTATE}else{if(e.enablePan===!1)return;U(d),l=s.PAN}break;default:l=s.NONE}l!==s.NONE&&(document.addEventListener("mousemove",fe,!1),document.addEventListener("mouseup",me,!1),e.dispatchEvent(t))}}function fe(d){if(e.enabled!==!1)switch(d.preventDefault(),l){case s.ROTATE:if(e.enableRotate===!1)return;W(d);break;case s.DOLLY:if(e.enableZoom===!1)return;se(d);break;case s.PAN:if(e.enablePan===!1)return;q(d);break}}function me(d){e.enabled!==!1&&(document.removeEventListener("mousemove",fe,!1),document.removeEventListener("mouseup",me,!1),e.dispatchEvent(o),l=s.NONE)}function je(d){e.enabled===!1||e.enableZoom===!1||l!==s.NONE&&l!==s.ROTATE||(d.preventDefault(),d.stopPropagation(),e.dispatchEvent(t),j(d),e.dispatchEvent(o))}function Re(d){e.enabled===!1||e.enableKeys===!1||e.enablePan===!1||ne(d)}function ke(d){if(e.enabled!==!1){switch(d.preventDefault(),d.touches.length){case 1:switch(e.touches.ONE){case I.TOUCH.ROTATE:if(e.enableRotate===!1)return;G(d),l=s.TOUCH_ROTATE;break;case I.TOUCH.PAN:if(e.enablePan===!1)return;R(d),l=s.TOUCH_PAN;break;default:l=s.NONE}break;case 2:switch(e.touches.TWO){case I.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;oe(d),l=s.TOUCH_DOLLY_PAN;break;case I.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;H(d),l=s.TOUCH_DOLLY_ROTATE;break;default:l=s.NONE}break;default:l=s.NONE}l!==s.NONE&&e.dispatchEvent(t)}}function ue(d){if(e.enabled!==!1)switch(d.preventDefault(),d.stopPropagation(),l){case s.TOUCH_ROTATE:if(e.enableRotate===!1)return;K(d),e.update();break;case s.TOUCH_PAN:if(e.enablePan===!1)return;Ce(d),e.update();break;case s.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Ie(d),e.update();break;case s.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Ne(d),e.update();break;default:l=s.NONE}}function Je(d){e.enabled!==!1&&(e.dispatchEvent(o),l=s.NONE)}function $e(d){e.enabled!==!1&&d.preventDefault()}e.domElement.addEventListener("contextmenu",$e,!1),e.domElement.addEventListener("mousedown",Ee,!1),e.domElement.addEventListener("wheel",je,!1),e.domElement.addEventListener("touchstart",ke,!1),e.domElement.addEventListener("touchend",Je,!1),e.domElement.addEventListener("touchmove",ue,!1),e.domElement.addEventListener("keydown",Re,!1),e.domElement.tabIndex===-1&&(e.domElement.tabIndex=0),this.update()};De.prototype=Object.create(I.EventDispatcher.prototype),De.prototype.constructor=De;var ht=function(c,a){De.call(this,c,a),this.mouseButtons.LEFT=I.MOUSE.PAN,this.mouseButtons.RIGHT=I.MOUSE.ROTATE,this.touches.ONE=I.TOUCH.PAN,this.touches.TWO=I.TOUCH.DOLLY_ROTATE};ht.prototype=Object.create(I.EventDispatcher.prototype),ht.prototype.constructor=ht;var Te=function(c){I.Object3D.call(this),this.element=c,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.addEventListener("removed",function(){this.traverse(function(a){a.element instanceof Element&&a.element.parentNode!==null&&a.element.parentNode.removeChild(a.element)})})};Te.prototype=Object.create(I.Object3D.prototype),Te.prototype.constructor=Te;var Ke=function(c){Te.call(this,c)};Ke.prototype=Object.create(Te.prototype),Ke.prototype.constructor=Ke;var It=function(){var c=this,a,e,n,t,o=new I.Matrix4,s={camera:{fov:0,style:""},objects:new WeakMap},l=document.createElement("div");l.style.overflow="hidden",this.domElement=l;var h=document.createElement("div");h.style.WebkitTransformStyle="preserve-3d",h.style.transformStyle="preserve-3d",h.style.pointerEvents="none",l.appendChild(h);var f=/Trident/i.test(navigator.userAgent);this.getSize=function(){return{width:a,height:e}},this.setSize=function(P,b){a=P,e=b,n=a/2,t=e/2,l.style.width=P+"px",l.style.height=b+"px",h.style.width=P+"px",h.style.height=b+"px"};function g(P){return Math.abs(P)<1e-10?0:P}function y(P){var b=P.elements;return"matrix3d("+g(b[0])+","+g(-b[1])+","+g(b[2])+","+g(b[3])+","+g(b[4])+","+g(-b[5])+","+g(b[6])+","+g(b[7])+","+g(b[8])+","+g(-b[9])+","+g(b[10])+","+g(b[11])+","+g(b[12])+","+g(-b[13])+","+g(b[14])+","+g(b[15])+")"}function w(P,b){var A=P.elements,m="matrix3d("+g(A[0])+","+g(A[1])+","+g(A[2])+","+g(A[3])+","+g(-A[4])+","+g(-A[5])+","+g(-A[6])+","+g(-A[7])+","+g(A[8])+","+g(A[9])+","+g(A[10])+","+g(A[11])+","+g(A[12])+","+g(A[13])+","+g(A[14])+","+g(A[15])+")";return f?"translate(-50%,-50%)translate("+n+"px,"+t+"px)"+b+m:"translate(-50%,-50%)"+m}function x(P,b,A,m){if(P instanceof Te){P.onBeforeRender(c,b,A);var O;P instanceof Ke?(o.copy(A.matrixWorldInverse),o.transpose(),o.copyPosition(P.matrixWorld),o.scale(P.scale),o.elements[3]=0,o.elements[7]=0,o.elements[11]=0,o.elements[15]=1,O=w(o,m)):O=w(P.matrixWorld,m);var _=P.element,X=s.objects.get(P);if(X===void 0||X.style!==O){_.style.WebkitTransform=O,_.style.transform=O;var Y={style:O};f&&(Y.distanceToCameraSquared=S(A,P)),s.objects.set(P,Y)}_.style.display=P.visible?"":"none",_.parentNode!==h&&h.appendChild(_),P.onAfterRender(c,b,A)}for(var z=0,$=P.children.length;z<$;z++)x(P.children[z],b,A,m)}var S=(function(){var P=new I.Vector3,b=new I.Vector3;return function(A,m){return P.setFromMatrixPosition(A.matrixWorld),b.setFromMatrixPosition(m.matrixWorld),P.distanceToSquared(b)}})();function E(P){var b=[];return P.traverse(function(A){A instanceof Te&&b.push(A)}),b}function C(P){for(var b=E(P).sort(function(_,X){var Y=s.objects.get(_).distanceToCameraSquared,z=s.objects.get(X).distanceToCameraSquared;return Y-z}),A=b.length,m=0,O=b.length;m<O;m++)b[m].element.style.zIndex=A-m}this.render=function(P,b){var A=b.projectionMatrix.elements[5]*t;if(s.camera.fov!==A&&(b.isPerspectiveCamera?(l.style.WebkitPerspective=A+"px",l.style.perspective=A+"px"):(l.style.WebkitPerspective="",l.style.perspective=""),s.camera.fov=A),P.autoUpdate===!0&&P.updateMatrixWorld(),b.parent===null&&b.updateMatrixWorld(),b.isOrthographicCamera)var m=-(b.right+b.left)/2,O=(b.top+b.bottom)/2;var _=b.isOrthographicCamera?"scale("+A+")translate("+g(m)+"px,"+g(O)+"px)"+y(b.matrixWorldInverse):"translateZ("+A+"px)"+y(b.matrixWorldInverse),X=_+"translate("+n+"px,"+t+"px)";s.camera.style!==X&&!f&&(h.style.WebkitTransform=X,h.style.transform=X,s.camera.style=X),x(P,P,b,_),f&&C(P)}};function Nt(c,a,e){var n=a.getBoundingClientRect(),t=n.top,o=n.left,s=n.width,l=n.height;return new p.Vector2((c.x-o)/s*2-1,-(c.y-t)/l*2+1)}var kt=(function(c){de(a,c);function a(e,n,t,o,s){var l=c.call(this)||this;l.type="RoundedBoxGeometry",s=isNaN(s)?1:Math.max(1,Math.floor(s)),e=isNaN(e)?1:e,n=isNaN(n)?1:n,t=isNaN(t)?1:t,o=isNaN(o)?.15:o,o=Math.min(o,Math.min(e,Math.min(n,Math.min(t)))/2);var h=e/2-o,f=n/2-o,g=t/2-o;l.parameters={width:e,height:n,depth:t,radius:o,radiusSegments:s};var y=s+1,w=y*s+1<<3,x=new p.BufferAttribute(new Float32Array(w*3),3),S=new p.BufferAttribute(new Float32Array(w*3),3),E=[],C=[];new p.Vector3;var P=new p.Vector3,b=[],A=[],m=[],O=y*s,_=y*s+1;X(),z(),Y(),$(),ce(),le();function X(){for(var F=[new p.Vector3(1,1,1),new p.Vector3(1,1,-1),new p.Vector3(-1,1,-1),new p.Vector3(-1,1,1),new p.Vector3(1,-1,1),new p.Vector3(1,-1,-1),new p.Vector3(-1,-1,-1),new p.Vector3(-1,-1,1)],N=0;N<8;N++)E.push([]),C.push([]);for(var k=Math.PI/2,U=new p.Vector3(h,f,g),W=0;W<=s;W++){var se=W/s,q=se*k,j=Math.cos(q),ne=Math.sin(q);if(W==s){P.set(0,1,0);var G=P.clone().multiplyScalar(o).add(U);E[0].push(G),b.push(G);var R=P.clone();C[0].push(R),A.push(R);continue}for(var D=0;D<=s;D++){var oe=D/s,H=oe*k;P.x=j*Math.cos(H),P.y=ne,P.z=j*Math.sin(H);var G=P.clone().multiplyScalar(o).add(U);E[0].push(G),b.push(G);var R=P.clone().normalize();C[0].push(R),A.push(R)}}for(var K=1;K<8;K++)for(var N=0;N<E[0].length;N++){var G=E[0][N].clone().multiply(F[K]);E[K].push(G),b.push(G);var R=C[0][N].clone().multiply(F[K]);C[K].push(R),A.push(R)}}function Y(){for(var F=[!0,!1,!0,!1,!1,!0,!1,!0],N=y*(s-1),k=0;k<8;k++){for(var U=_*k,W=0;W<s-1;W++)for(var se=W*y,q=(W+1)*y,j=0;j<s;j++){var ne=j+1,G=U+se+j,R=U+se+ne,D=U+q+j,oe=U+q+ne;F[k]?(m.push(G),m.push(D),m.push(R),m.push(R),m.push(D),m.push(oe)):(m.push(G),m.push(R),m.push(D),m.push(R),m.push(oe),m.push(D))}for(var j=0;j<s;j++){var G=U+N+j,R=U+N+j+1,D=U+O;F[k]?(m.push(G),m.push(D),m.push(R)):(m.push(G),m.push(R),m.push(D))}}}function z(){var F=O,N=O+_,k=O+_*2,U=O+_*3;m.push(F),m.push(N),m.push(k),m.push(F),m.push(k),m.push(U),F=O+_*4,N=O+_*5,k=O+_*6,U=O+_*7,m.push(F),m.push(k),m.push(N),m.push(F),m.push(U),m.push(k),F=0,N=_,k=_*4,U=_*5,m.push(F),m.push(k),m.push(N),m.push(N),m.push(k),m.push(U),F=_*2,N=_*3,k=_*6,U=_*7,m.push(F),m.push(k),m.push(N),m.push(N),m.push(k),m.push(U),F=s,N=s+_*3,k=s+_*4,U=s+_*7,m.push(F),m.push(N),m.push(k),m.push(N),m.push(U),m.push(k),F=s+_,N=s+_*2,k=s+_*5,U=s+_*6,m.push(F),m.push(k),m.push(N),m.push(N),m.push(k),m.push(U)}function $(){for(var F=0;F<4;F++)for(var N=F*_,k=4*_+N,U=(F&1)===1,W=0;W<s;W++){var se=W+1,q=N+W,j=N+se,ne=k+W,G=k+se;U?(m.push(q),m.push(ne),m.push(j),m.push(j),m.push(ne),m.push(G)):(m.push(q),m.push(j),m.push(ne),m.push(j),m.push(G),m.push(ne))}}function le(){for(var F=[0,2,4,6],N=[1,3,5,7],k=0;k<4;k++)for(var U=_*F[k],W=_*N[k],se=1>=k,q=0;q<s;q++){var j=q*y,ne=(q+1)*y,G=U+j,R=U+ne,D=W+j,oe=W+ne;se?(m.push(G),m.push(D),m.push(R),m.push(R),m.push(D),m.push(oe)):(m.push(G),m.push(R),m.push(D),m.push(R),m.push(oe),m.push(D))}}function ce(){for(var F=s-1,N=[0,1,4,5],k=[3,2,7,6],U=[0,1,1,0],W=0;W<4;W++)for(var se=N[W]*_,q=k[W]*_,j=0;j<=F;j++){var ne=se+s+j*y,G=se+(j!=F?s+(j+1)*y:_-1),R=q+s+j*y,D=q+(j!=F?s+(j+1)*y:_-1);U[W]?(m.push(ne),m.push(R),m.push(G),m.push(G),m.push(R),m.push(D)):(m.push(ne),m.push(G),m.push(R),m.push(G),m.push(D),m.push(R))}}for(var ee=0,J=0;J<b.length;J++)x.setXYZ(ee,b[J].x,b[J].y,b[J].z),S.setXYZ(ee,A[J].x,A[J].y,A[J].z),ee++;return l.setIndex(new p.BufferAttribute(new Uint16Array(m),1)),l.setAttribute("position",x),l.setAttribute("normal",S),l}return a})(p.BufferGeometry);function Ue(c,a){return typeof c!="number"||typeof a!="number"?!1:Math.abs(c-a)<.001}function Ve(c,a,e,n){n===void 0&&(n=function(o){return o});var t=n(e);return c*(1-t)+a*t}var ae=Number((Math.PI/2).toFixed(5));function vn(c,a,e){var n=new p.Shape;return n.moveTo(e,0),n.lineTo(c-e,0),n.absarc(c-e,e,e,-ae,0,!1),n.lineTo(c,a-e),n.absarc(c-e,a-e,e,0,ae,!1),n.lineTo(e,a),n.absarc(e,a-e,e,ae,Math.PI,!1),n.lineTo(0,e),n.absarc(e,e,e,Math.PI,Math.PI*1.5,!1),n}var ze=function(c){var a=document.createElement("div");a.innerText=c;var e=new Te(a);return e.name=c,e.scale.set(.3,.3,.3),a.style.pointerEvents="none",a.style.backfaceVisibility="hidden",e},Ze=function(c){var a=new p.PlaneGeometry(5,5),e=new p.MeshBasicMaterial({transparent:!0,opacity:0}),n=new p.Mesh(a,e),t=document.createElement("div");t.innerText=c;var o=new Te(t);return o.name=c,o.scale.set(.3,.3,.3),t.style.color="#ffffff",t.style.opacity="0.5",t.style.pointerEvents="none",t.style.backfaceVisibility="hidden",n.rotateX(-ae),n.add(o),n},pn=(function(c){de(a,c);function a(e,n){var t=c.call(this,e)||this;t.camera=new pe.Camera(90),t.scene=new p.Scene,t.renderer=new p.WebGLRenderer({antialias:!0,alpha:!0}),t.css3drenderer=new It,t.ambientLight=new p.AmbientLight(16777215,.7),t.wrapper=document.createElement("div"),t.arrows=document.createElement("div"),t.arrowLeft=document.createElement("div"),t.arrowRight=document.createElement("div"),t.arrowFront=document.createElement("div"),t.arrowBack=document.createElement("div"),t.arrowTop=document.createElement("div"),t.arrowBottom=document.createElement("div"),t.spherical=null,t.dragging=!1,t.style=document.createElement("style"),t.directionalLight=new p.DirectionalLight(16777215,.2),t.box=new p.Mesh(new kt(8,8,8,.5,20),new p.MeshPhongMaterial({color:16777215})),t.faces=new p.Group,t.orient=function(l){var h=l.longitude,f=l.latitude;t.dragging=!1,t.spherical=null,t.controls.enableDamping=!1,t.five.setState(Object.assign({latitude:f},h!==void 0?{longitude:h+t.config.fixedLongitude}:{})),t.five.ready().then(function(){t.controls.enableDamping=!0,t.setState({arrowsVisible:!0})})},t.onRenderFrame=function(){var l,h,f,g,y;if(t.renderer.render(t.scene,t.camera),t.css3drenderer.render(t.scene,t.camera),t.directionalLight.position.copy(t.camera.position),(l=t.controls)===null||l===void 0||l.update(),t.dragging){t.camera.computePose(),t.updateByCamera();var w=t.camera.pose,x=w.longitude,S=w.latitude;t.five.setState({longitude:x,latitude:S},!0),t.updateArrows({longitude:x,latitude:S})}else if(t.spherical&&(!Ue(t.spherical.pi,(h=t.controls)===null||h===void 0?void 0:h.getPolarAngle())||!Ue(t.spherical.theta,(f=t.controls)===null||f===void 0?void 0:f.getAzimuthalAngle()))){t.spherical={pi:(g=t.controls)===null||g===void 0?void 0:g.getPolarAngle(),theta:(y=t.controls)===null||y===void 0?void 0:y.getAzimuthalAngle()},t.camera.computePose(),t.updateByCamera();var E=t.camera.pose,x=E.longitude,S=E.latitude;t.five.setState({longitude:x,latitude:S},!0),t.updateArrows({longitude:x,latitude:S})}else t.spherical=null},t.onTapGesture=function(l){var h=l.pointers[0].clientX,f=l.pointers[0].clientY,g=Nt({x:h,y:f},t.wrapper),y=new p.Raycaster;y.setFromCamera(g,t.camera);var w=y.intersectObjects(t.faces.children,!1)[0];if(w){var x=w.object.userData,S=x.longitude,E=x.latitude;t.orient({longitude:S,latitude:E})}},t.onFiveWantsGesture=function(){if(t.spherical)return!1},t.onFiveModeChange=function(l){t.controls&&(t.controls.maxPolarAngle=l==="Topview"?0:ae)},t.onCameraUpdate=function(l){var h=l.state;if(!t.dragging&&!t.spherical){var f=h.longitude,g=h.latitude;t.camera.pose.longitude===f&&t.camera.pose.latitude===g||(t.camera.setFromPose({longitude:f,latitude:g,distance:20,offset:new p.Vector3(0,0,0)}),t.updateByCamera(),t.updateArrows({longitude:f,latitude:g}))}},t.onPanStart=function(l){t.dragging=!0,t.spherical={}},t.onMouseMove=function(l){if(!t.dragging){var h=Nt({x:l.clientX,y:l.clientY},t.wrapper),f=new p.Raycaster;f.setFromCamera(h,t.camera);var g=f.intersectObjects(t.faces.children,!1)[0];t.faces.children.forEach(function(y){y.material.opacity=0,y.children[0].element.style.color=""}),g&&(g.object.material.opacity=.3,g.object.children[0].element.style.color="#336dff")}},t.onPanEnd=function(l){t.dragging=!1,t.spherical={pi:t.controls.getPolarAngle(),theta:t.controls.getAzimuthalAngle()}},t.dispose=function(){t.disable()},t.five=e;var o={enabled:!1,visible:!0,arrowsVisible:!1};t.state=Object.assign(o,n==null?void 0:n.initialState);var s=V({fixedLongitude:0,orthoView:!0},n==null?void 0:n.config);return t._config=s,t.state.enabled&&t._enable({userAction:!1}),t.mc=new ft.Manager(t.wrapper),t.mc.add(new ft.Tap({interval:410})),t.mc.add(new ft.Pan({threshold:10,pointers:0})),t.camera.setFromPose({distance:20,offset:new p.Vector3(0,0,0),longitude:e.camera.pose.latitude,latitude:e.camera.pose.latitude}),t.cylinder=new p.Mesh(new p.CylinderGeometry(13.2,14,.01,50,1,!0),new p.ShaderMaterial({uniforms:{radiusTop:{value:13.2},radiusBottom:{value:14},opacity:{value:1}},vertexShader:`
|
|
356
|
+
`;return function(){var P=new Error("get-stack-trace"),_=P&&P.stack?P.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",k=f.console&&(f.console.warn||f.console.log);return k&&k.call(f.console,p,_),r.apply(this,arguments)}}var E;typeof Object.assign!="function"?E=function(i){if(i===n||i===null)throw new TypeError("Cannot convert undefined or null to object");for(var u=Object(i),p=1;p<arguments.length;p++){var P=arguments[p];if(P!==n&&P!==null)for(var _ in P)P.hasOwnProperty(_)&&(u[_]=P[_])}return u}:E=Object.assign;var S=T(function(i,u,p){for(var P=Object.keys(u),_=0;_<P.length;)(!p||p&&i[P[_]]===n)&&(i[P[_]]=u[P[_]]),_++;return i},"extend","Use `assign`."),C=T(function(i,u){return S(i,u,!0)},"merge","Use `assign`.");function b(r,i,u){var p=i.prototype,P;P=r.prototype=Object.create(p),P.constructor=r,P._super=p,u&&E(P,u)}function y(r,i){return function(){return r.apply(i,arguments)}}function A(r,i){return typeof r==s?r.apply(i&&i[0]||n,i):r}function m(r,i){return r===n?i:r}function O(r,i,u){M(H(i),function(p){r.addEventListener(p,u,!1)})}function x(r,i,u){M(H(i),function(p){r.removeEventListener(p,u,!1)})}function j(r,i){for(;r;){if(r==i)return!0;r=r.parentNode}return!1}function z(r,i){return r.indexOf(i)>-1}function H(r){return r.trim().split(/\s+/g)}function Q(r,i,u){if(r.indexOf&&!u)return r.indexOf(i);for(var p=0;p<r.length;){if(u&&r[p][u]==i||!u&&r[p]===i)return p;p++}return-1}function q(r){return Array.prototype.slice.call(r,0)}function le(r,i,u){for(var p=[],P=[],_=0;_<r.length;){var k=r[_][i];Q(P,k)<0&&p.push(r[_]),P[_]=k,_++}return p=p.sort(function(he,ne){return he[i]>ne[i]}),p}function X(r,i){for(var u,p,P=i[0].toUpperCase()+i.slice(1),_=0;_<t.length;){if(u=t[_],p=u?u+P:i,p in r)return p;_++}return n}var K=1;function D(){return K++}function I(r){var i=r.ownerDocument||r;return i.defaultView||i.parentWindow||f}var L=/mobile|tablet|ip(ad|hone|od)|android/i,N="ontouchstart"in f,Y=X(f,"PointerEvent")!==n,ie=N&&L.test(navigator.userAgent),J="touch",G="pen",re="mouse",W="kinect",R=25,B=1,ue=2,Z=4,$=8,Ce=1,Ae=2,Fe=4,Le=8,Se=16,fe=Ae|Fe,me=Le|Se,ze=fe|me,Ge=["x","y"],Ie=["clientX","clientY"];function ce(r,i){var u=this;this.manager=r,this.callback=i,this.element=r.element,this.target=r.options.inputTarget,this.domHandler=function(p){A(r.options.enable,[r])&&u.handler(p)},this.init()}ce.prototype={handler:function(){},init:function(){this.evEl&&O(this.element,this.evEl,this.domHandler),this.evTarget&&O(this.target,this.evTarget,this.domHandler),this.evWin&&O(I(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(I(this.element),this.evWin,this.domHandler)}};function Je(r){var i,u=r.options.inputClass;return u?i=u:Y?i=wt:ie?i=nt:N?i=Pt:i=tt,new i(r,$e)}function $e(r,i,u){var p=u.pointers.length,P=u.changedPointers.length,_=i&B&&p-P===0,k=i&(Z|$)&&p-P===0;u.isFirst=!!_,u.isFinal=!!k,_&&(r.session={}),u.eventType=i,d(r,u),r.emit("hammer.input",u),r.recognize(u),r.session.prevInput=u}function d(r,i){var u=r.session,p=i.pointers,P=p.length;u.firstInput||(u.firstInput=ae(i)),P>1&&!u.firstMultiple?u.firstMultiple=ae(i):P===1&&(u.firstMultiple=!1);var _=u.firstInput,k=u.firstMultiple,oe=k?k.center:_.center,he=i.center=ye(p);i.timeStamp=c(),i.deltaTime=i.timeStamp-_.timeStamp,i.angle=bt(oe,he),i.distance=et(oe,he),U(u,i),i.offsetDirection=Te(i.deltaX,i.deltaY);var ne=Re(i.deltaTime,i.deltaX,i.deltaY);i.overallVelocityX=ne.x,i.overallVelocityY=ne.y,i.overallVelocity=h(ne.x)>h(ne.y)?ne.x:ne.y,i.scale=k?_n(k.pointers,p):1,i.rotation=k?On(k.pointers,p):0,i.maxPointers=u.prevInput?i.pointers.length>u.prevInput.maxPointers?i.pointers.length:u.prevInput.maxPointers:i.pointers.length,ee(u,i);var we=r.element;j(i.srcEvent.target,we)&&(we=i.srcEvent.target),i.target=we}function U(r,i){var u=i.center,p=r.offsetDelta||{},P=r.prevDelta||{},_=r.prevInput||{};(i.eventType===B||_.eventType===Z)&&(P=r.prevDelta={x:_.deltaX||0,y:_.deltaY||0},p=r.offsetDelta={x:u.x,y:u.y}),i.deltaX=P.x+(u.x-p.x),i.deltaY=P.y+(u.y-p.y)}function ee(r,i){var u=r.lastInterval||i,p=i.timeStamp-u.timeStamp,P,_,k,oe;if(i.eventType!=$&&(p>R||u.velocity===n)){var he=i.deltaX-u.deltaX,ne=i.deltaY-u.deltaY,we=Re(p,he,ne);_=we.x,k=we.y,P=h(we.x)>h(we.y)?we.x:we.y,oe=Te(he,ne),r.lastInterval=i}else P=u.velocity,_=u.velocityX,k=u.velocityY,oe=u.direction;i.velocity=P,i.velocityX=_,i.velocityY=k,i.direction=oe}function ae(r){for(var i=[],u=0;u<r.pointers.length;)i[u]={clientX:l(r.pointers[u].clientX),clientY:l(r.pointers[u].clientY)},u++;return{timeStamp:c(),pointers:i,center:ye(i),deltaX:r.deltaX,deltaY:r.deltaY}}function ye(r){var i=r.length;if(i===1)return{x:l(r[0].clientX),y:l(r[0].clientY)};for(var u=0,p=0,P=0;P<i;)u+=r[P].clientX,p+=r[P].clientY,P++;return{x:l(u/i),y:l(p/i)}}function Re(r,i,u){return{x:i/r||0,y:u/r||0}}function Te(r,i){return r===i?Ce:h(r)>=h(i)?r<0?Ae:Fe:i<0?Le:Se}function et(r,i,u){u||(u=Ge);var p=i[u[0]]-r[u[0]],P=i[u[1]]-r[u[1]];return Math.sqrt(p*p+P*P)}function bt(r,i,u){u||(u=Ge);var p=i[u[0]]-r[u[0]],P=i[u[1]]-r[u[1]];return Math.atan2(P,p)*180/Math.PI}function On(r,i){return bt(i[1],i[0],Ie)+bt(r[1],r[0],Ie)}function _n(r,i){return et(i[0],i[1],Ie)/et(r[0],r[1],Ie)}var Cn={mousedown:B,mousemove:ue,mouseup:Z},Fn="mousedown",Ln="mousemove mouseup";function tt(){this.evEl=Fn,this.evWin=Ln,this.pressed=!1,ce.apply(this,arguments)}b(tt,ce,{handler:function(i){var u=Cn[i.type];u&B&&(i.button===0||i.button===2)&&(this.pressed=!0),u&ue&&i.which!==1&&(u=Z),this.pressed&&(u&Z&&(this.pressed=!1),this.callback(this.manager,u,{pointers:[i],changedPointers:[i],pointerType:re,srcEvent:i}))}});var Ut={pointerdown:B,pointermove:ue,pointerup:Z,pointercancel:$,pointerout:$},In={2:J,3:G,4:re,5:W},Vt="pointerdown",jt="pointermove pointerup pointercancel";f.MSPointerEvent&&!f.PointerEvent&&(Vt="MSPointerDown",jt="MSPointerMove MSPointerUp MSPointerCancel");function wt(){this.evEl=Vt,this.evWin=jt,ce.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}b(wt,ce,{handler:function(i){var u=this.store,p=!1,P=!1,_=i.type.toLowerCase().replace("ms",""),k=Ut[_],oe=In[i.pointerType]||i.pointerType,he=oe==J,ne=Q(u,i.pointerId,"pointerId");k&B&&(i.button===0||i.button===2||he)?ne<0&&(u.push(i),ne=u.length-1):k&(Z|$)?p=!0:!he&&i.buttons===0&&(p=!0,P=!0,k=Ut.pointerup),!(ne<0)&&(P||(u[ne]=i),this.callback(this.manager,k,{pointers:u,changedPointers:[i],pointerType:oe,srcEvent:u[ne]}),p&&u.splice(ne,1))}});var Dn={touchstart:B,touchmove:ue,touchend:Z,touchcancel:$},Nn="touchstart",kn="touchstart touchmove touchend touchcancel";function zt(){this.evTarget=Nn,this.evWin=kn,this.started=!1,ce.apply(this,arguments)}b(zt,ce,{handler:function(i){var u=Dn[i.type];if(u===B&&(this.started=!0),!!this.started){var p=Bn.call(this,i,u);u&(Z|$)&&p[0].length-p[1].length===0&&(this.started=!1),this.callback(this.manager,u,{pointers:p[0],changedPointers:p[1],pointerType:J,srcEvent:i})}}});function Bn(r,i){var u=q(r.touches),p=q(r.changedTouches);return i&(Z|$)&&(u=le(u.concat(p),"identifier")),[u,p]}var Un={touchstart:B,touchmove:ue,touchend:Z,touchcancel:$},Vn="touchstart touchmove touchend touchcancel";function nt(){this.evTarget=Vn,this.targetIds={},ce.apply(this,arguments)}b(nt,ce,{handler:function(i){var u=Un[i.type],p=jn.call(this,i,u);p&&this.callback(this.manager,u,{pointers:p[0],changedPointers:p[1],pointerType:J,srcEvent:i})}});function jn(r,i){var u=q(r.touches),p=this.targetIds;if(i&(B|ue)&&u.length===1)return p[u[0].identifier]=!0,[u,u];var P,_,k=q(r.changedTouches),oe=[],he=this.target;if(_=u.filter(function(ne){return j(ne.target,he)}),i===B)for(P=0;P<_.length;)p[_[P].identifier]=!0,P++;for(P=0;P<k.length;)p[k[P].identifier]&&oe.push(k[P]),i&(Z|$)&&delete p[k[P].identifier],P++;if(oe.length)return[le(_.concat(oe),"identifier"),oe]}var zn=2500,Gt=25;function Pt(){ce.apply(this,arguments);var r=y(this.handler,this);this.touch=new nt(this.manager,r),this.mouse=new tt(this.manager,r),this.primaryTouch=null,this.lastTouches=[]}b(Pt,ce,{handler:function(i,u,p){var P=p.pointerType==J,_=p.pointerType==re;if(!(_&&p.sourceCapabilities&&p.sourceCapabilities.firesTouchEvents)){if(P)Gn.call(this,u,p);else if(_&&Rn.call(this,p))return;this.callback(i,u,p)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Gn(r,i){r&B?(this.primaryTouch=i.changedPointers[0].identifier,Rt.call(this,i)):r&(Z|$)&&Rt.call(this,i)}function Rt(r){var i=r.changedPointers[0];if(i.identifier===this.primaryTouch){var u={x:i.clientX,y:i.clientY};this.lastTouches.push(u);var p=this.lastTouches,P=function(){var _=p.indexOf(u);_>-1&&p.splice(_,1)};setTimeout(P,zn)}}function Rn(r){for(var i=r.srcEvent.clientX,u=r.srcEvent.clientY,p=0;p<this.lastTouches.length;p++){var P=this.lastTouches[p],_=Math.abs(i-P.x),k=Math.abs(u-P.y);if(_<=Gt&&k<=Gt)return!0}return!1}var Yt=a?X(a.style,"touchAction"):n,Wt=Yt!==n,Xt="compute",Ht="auto",Tt="manipulation",De="none",Ye="pan-x",We="pan-y",rt=Wn();function Mt(r,i){this.manager=r,this.set(i)}Mt.prototype={set:function(r){r==Xt&&(r=this.compute()),Wt&&this.manager.element.style&&rt[r]&&(this.manager.element.style[Yt]=r),this.actions=r.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var r=[];return M(this.manager.recognizers,function(i){A(i.options.enable,[i])&&(r=r.concat(i.getTouchAction()))}),Yn(r.join(" "))},preventDefaults:function(r){var i=r.srcEvent,u=r.offsetDirection;if(this.manager.session.prevented){i.preventDefault();return}var p=this.actions,P=z(p,De)&&!rt[De],_=z(p,We)&&!rt[We],k=z(p,Ye)&&!rt[Ye];if(P){var oe=r.pointers.length===1,he=r.distance<2,ne=r.deltaTime<250;if(oe&&he&&ne)return}if(!(k&&_)&&(P||_&&u&fe||k&&u&me))return this.preventSrc(i)},preventSrc:function(r){this.manager.session.prevented=!0,r.preventDefault()}};function Yn(r){if(z(r,De))return De;var i=z(r,Ye),u=z(r,We);return i&&u?De:i||u?i?Ye:We:z(r,Tt)?Tt:Ht}function Wn(){if(!Wt)return!1;var r={},i=f.CSS&&f.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(u){r[u]=i?f.CSS.supports("touch-action",u):!0}),r}var at=1,ve=2,ke=4,xe=8,Me=xe,Xe=16,be=32;function Ee(r){this.options=E({},this.defaults,r||{}),this.id=D(),this.manager=null,this.options.enable=m(this.options.enable,!0),this.state=at,this.simultaneous={},this.requireFail=[]}Ee.prototype={defaults:{},set:function(r){return E(this.options,r),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(r){if(w(r,"recognizeWith",this))return this;var i=this.simultaneous;return r=it(r,this),i[r.id]||(i[r.id]=r,r.recognizeWith(this)),this},dropRecognizeWith:function(r){return w(r,"dropRecognizeWith",this)?this:(r=it(r,this),delete this.simultaneous[r.id],this)},requireFailure:function(r){if(w(r,"requireFailure",this))return this;var i=this.requireFail;return r=it(r,this),Q(i,r)===-1&&(i.push(r),r.requireFailure(this)),this},dropRequireFailure:function(r){if(w(r,"dropRequireFailure",this))return this;r=it(r,this);var i=Q(this.requireFail,r);return i>-1&&this.requireFail.splice(i,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(r){return!!this.simultaneous[r.id]},emit:function(r){var i=this,u=this.state;function p(P){i.manager.emit(P,r)}u<xe&&p(i.options.event+qt(u)),p(i.options.event),r.additionalEvent&&p(r.additionalEvent),u>=xe&&p(i.options.event+qt(u))},tryEmit:function(r){if(this.canEmit())return this.emit(r);this.state=be},canEmit:function(){for(var r=0;r<this.requireFail.length;){if(!(this.requireFail[r].state&(be|at)))return!1;r++}return!0},recognize:function(r){var i=E({},r);if(!A(this.options.enable,[this,i])){this.reset(),this.state=be;return}this.state&(Me|Xe|be)&&(this.state=at),this.state=this.process(i),this.state&(ve|ke|xe|Xe)&&this.tryEmit(i)},process:function(r){},getTouchAction:function(){},reset:function(){}};function qt(r){return r&Xe?"cancel":r&xe?"end":r&ke?"move":r&ve?"start":""}function Kt(r){return r==Se?"down":r==Le?"up":r==Ae?"left":r==Fe?"right":""}function it(r,i){var u=i.manager;return u?u.get(r):r}function ge(){Ee.apply(this,arguments)}b(ge,Ee,{defaults:{pointers:1},attrTest:function(r){var i=this.options.pointers;return i===0||r.pointers.length===i},process:function(r){var i=this.state,u=r.eventType,p=i&(ve|ke),P=this.attrTest(r);return p&&(u&$||!P)?i|Xe:p||P?u&Z?i|xe:i&ve?i|ke:ve:be}});function ot(){ge.apply(this,arguments),this.pX=null,this.pY=null}b(ot,ge,{defaults:{event:"pan",threshold:10,pointers:1,direction:ze},getTouchAction:function(){var r=this.options.direction,i=[];return r&fe&&i.push(We),r&me&&i.push(Ye),i},directionTest:function(r){var i=this.options,u=!0,p=r.distance,P=r.direction,_=r.deltaX,k=r.deltaY;return P&i.direction||(i.direction&fe?(P=_===0?Ce:_<0?Ae:Fe,u=_!=this.pX,p=Math.abs(r.deltaX)):(P=k===0?Ce:k<0?Le:Se,u=k!=this.pY,p=Math.abs(r.deltaY))),r.direction=P,u&&p>i.threshold&&P&i.direction},attrTest:function(r){return ge.prototype.attrTest.call(this,r)&&(this.state&ve||!(this.state&ve)&&this.directionTest(r))},emit:function(r){this.pX=r.deltaX,this.pY=r.deltaY;var i=Kt(r.direction);i&&(r.additionalEvent=this.options.event+i),this._super.emit.call(this,r)}});function Et(){ge.apply(this,arguments)}b(Et,ge,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[De]},attrTest:function(r){return this._super.attrTest.call(this,r)&&(Math.abs(r.scale-1)>this.options.threshold||this.state&ve)},emit:function(r){if(r.scale!==1){var i=r.scale<1?"in":"out";r.additionalEvent=this.options.event+i}this._super.emit.call(this,r)}});function At(){Ee.apply(this,arguments),this._timer=null,this._input=null}b(At,Ee,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ht]},process:function(r){var i=this.options,u=r.pointers.length===i.pointers,p=r.distance<i.threshold,P=r.deltaTime>i.time;if(this._input=r,!p||!u||r.eventType&(Z|$)&&!P)this.reset();else if(r.eventType&B)this.reset(),this._timer=g(function(){this.state=Me,this.tryEmit()},i.time,this);else if(r.eventType&Z)return Me;return be},reset:function(){clearTimeout(this._timer)},emit:function(r){this.state===Me&&(r&&r.eventType&Z?this.manager.emit(this.options.event+"up",r):(this._input.timeStamp=c(),this.manager.emit(this.options.event,this._input)))}});function St(){ge.apply(this,arguments)}b(St,ge,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[De]},attrTest:function(r){return this._super.attrTest.call(this,r)&&(Math.abs(r.rotation)>this.options.threshold||this.state&ve)}});function xt(){ge.apply(this,arguments)}b(xt,ge,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:fe|me,pointers:1},getTouchAction:function(){return ot.prototype.getTouchAction.call(this)},attrTest:function(r){var i=this.options.direction,u;return i&(fe|me)?u=r.overallVelocity:i&fe?u=r.overallVelocityX:i&me&&(u=r.overallVelocityY),this._super.attrTest.call(this,r)&&i&r.offsetDirection&&r.distance>this.options.threshold&&r.maxPointers==this.options.pointers&&h(u)>this.options.velocity&&r.eventType&Z},emit:function(r){var i=Kt(r.offsetDirection);i&&this.manager.emit(this.options.event+i,r),this.manager.emit(this.options.event,r)}});function st(){Ee.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}b(st,Ee,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Tt]},process:function(r){var i=this.options,u=r.pointers.length===i.pointers,p=r.distance<i.threshold,P=r.deltaTime<i.time;if(this.reset(),r.eventType&B&&this.count===0)return this.failTimeout();if(p&&P&&u){if(r.eventType!=Z)return this.failTimeout();var _=this.pTime?r.timeStamp-this.pTime<i.interval:!0,k=!this.pCenter||et(this.pCenter,r.center)<i.posThreshold;this.pTime=r.timeStamp,this.pCenter=r.center,!k||!_?this.count=1:this.count+=1,this._input=r;var oe=this.count%i.taps;if(oe===0)return this.hasRequireFailures()?(this._timer=g(function(){this.state=Me,this.tryEmit()},i.interval,this),ve):Me}return be},failTimeout:function(){return this._timer=g(function(){this.state=be},this.options.interval,this),be},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Me&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Be(r,i){return i=i||{},i.recognizers=m(i.recognizers,Be.defaults.preset),new Ot(r,i)}Be.VERSION="2.0.7",Be.defaults={domEvents:!1,touchAction:Xt,enable:!0,inputTarget:null,inputClass:null,preset:[[St,{enable:!1}],[Et,{enable:!1},["rotate"]],[xt,{direction:fe}],[ot,{direction:fe},["swipe"]],[st],[st,{event:"doubletap",taps:2},["tap"]],[At]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Xn=1,Zt=2;function Ot(r,i){this.options=E({},Be.defaults,i||{}),this.options.inputTarget=this.options.inputTarget||r,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=r,this.input=Je(this),this.touchAction=new Mt(this,this.options.touchAction),Qt(this,!0),M(this.options.recognizers,function(u){var p=this.add(new u[0](u[1]));u[2]&&p.recognizeWith(u[2]),u[3]&&p.requireFailure(u[3])},this)}Ot.prototype={set:function(r){return E(this.options,r),r.touchAction&&this.touchAction.update(),r.inputTarget&&(this.input.destroy(),this.input.target=r.inputTarget,this.input.init()),this},stop:function(r){this.session.stopped=r?Zt:Xn},recognize:function(r){var i=this.session;if(!i.stopped){this.touchAction.preventDefaults(r);var u,p=this.recognizers,P=i.curRecognizer;(!P||P&&P.state&Me)&&(P=i.curRecognizer=null);for(var _=0;_<p.length;)u=p[_],i.stopped!==Zt&&(!P||u==P||u.canRecognizeWith(P))?u.recognize(r):u.reset(),!P&&u.state&(ve|ke|xe)&&(P=i.curRecognizer=u),_++}},get:function(r){if(r instanceof Ee)return r;for(var i=this.recognizers,u=0;u<i.length;u++)if(i[u].options.event==r)return i[u];return null},add:function(r){if(w(r,"add",this))return this;var i=this.get(r.options.event);return i&&this.remove(i),this.recognizers.push(r),r.manager=this,this.touchAction.update(),r},remove:function(r){if(w(r,"remove",this))return this;if(r=this.get(r),r){var i=this.recognizers,u=Q(i,r);u!==-1&&(i.splice(u,1),this.touchAction.update())}return this},on:function(r,i){if(r!==n&&i!==n){var u=this.handlers;return M(H(r),function(p){u[p]=u[p]||[],u[p].push(i)}),this}},off:function(r,i){if(r!==n){var u=this.handlers;return M(H(r),function(p){i?u[p]&&u[p].splice(Q(u[p],i),1):delete u[p]}),this}},emit:function(r,i){this.options.domEvents&&Hn(r,i);var u=this.handlers[r]&&this.handlers[r].slice();if(!(!u||!u.length)){i.type=r,i.preventDefault=function(){i.srcEvent.preventDefault()};for(var p=0;p<u.length;)u[p](i),p++}},destroy:function(){this.element&&Qt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Qt(r,i){var u=r.element;if(u.style){var p;M(r.options.cssProps,function(P,_){p=X(u.style,_),i?(r.oldCssProps[p]=u.style[p],u.style[p]=P):u.style[p]=r.oldCssProps[p]||""}),i||(r.oldCssProps={})}}function Hn(r,i){var u=o.createEvent("Event");u.initEvent(r,!0,!0),u.gesture=i,i.target.dispatchEvent(u)}return E(Be,{INPUT_START:B,INPUT_MOVE:ue,INPUT_END:Z,INPUT_CANCEL:$,STATE_POSSIBLE:at,STATE_BEGAN:ve,STATE_CHANGED:ke,STATE_ENDED:xe,STATE_RECOGNIZED:Me,STATE_CANCELLED:Xe,STATE_FAILED:be,DIRECTION_NONE:Ce,DIRECTION_LEFT:Ae,DIRECTION_RIGHT:Fe,DIRECTION_UP:Le,DIRECTION_DOWN:Se,DIRECTION_HORIZONTAL:fe,DIRECTION_VERTICAL:me,DIRECTION_ALL:ze,Manager:Ot,Input:ce,TouchAction:Mt,TouchInput:nt,MouseInput:tt,PointerEventInput:wt,TouchMouseInput:Pt,SingleTouchInput:zt,Recognizer:Ee,AttrRecognizer:ge,Tap:st,Pan:ot,Swipe:xt,Pinch:Et,Rotate:St,Press:At,on:O,off:x,each:M,merge:C,extend:S,assign:E,inherit:b,bindFn:y,prefixed:X}),Be})(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{}),Ne=function(f,o){o===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),o===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=f,this.domElement=o,this.enabled=!0,this.target=new F.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:F.MOUSE.ROTATE,MIDDLE:F.MOUSE.DOLLY,RIGHT:F.MOUSE.PAN},this.touches={ONE:F.TOUCH.ROTATE,TWO:F.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return c.phi},this.getAzimuthalAngle=function(){return c.theta},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent(n),e.update(),l=s.NONE},this.update=(function(){var d=new F.Vector3,U=new F.Quaternion().setFromUnitVectors(f.up,new F.Vector3(0,1,0)),ee=U.clone().inverse(),ae=new F.Vector3,ye=new F.Quaternion;return function(){var Te=e.object.position;return d.copy(Te).sub(e.target),d.applyQuaternion(U),c.setFromVector3(d),e.autoRotate&&l===s.NONE&&H(j()),e.enableDamping?(c.theta+=g.theta*e.dampingFactor,c.phi+=g.phi*e.dampingFactor):(c.theta+=g.theta,c.phi+=g.phi),c.theta=Math.max(e.minAzimuthAngle,Math.min(e.maxAzimuthAngle,c.theta)),c.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,c.phi)),c.makeSafe(),c.radius*=w,c.radius=Math.max(e.minDistance,Math.min(e.maxDistance,c.radius)),e.enableDamping===!0?e.target.addScaledVector(M,e.dampingFactor):e.target.add(M),d.setFromSpherical(c),d.applyQuaternion(ee),Te.copy(e.target).add(d),e.object.lookAt(e.target),e.enableDamping===!0?(g.theta*=1-e.dampingFactor,g.phi*=1-e.dampingFactor,M.multiplyScalar(1-e.dampingFactor)):(g.set(0,0,0),M.set(0,0,0)),w=1,T||ae.distanceToSquared(e.object.position)>h||8*(1-ye.dot(e.object.quaternion))>h?(e.dispatchEvent(n),ae.copy(e.object.position),ye.copy(e.object.quaternion),T=!1,!0):!1}})(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",$e,!1),e.domElement.removeEventListener("mousedown",Se,!1),e.domElement.removeEventListener("wheel",ze,!1),e.domElement.removeEventListener("touchstart",Ie,!1),e.domElement.removeEventListener("touchend",Je,!1),e.domElement.removeEventListener("touchmove",ce,!1),document.removeEventListener("mousemove",fe,!1),document.removeEventListener("mouseup",me,!1),e.domElement.removeEventListener("keydown",Ge,!1)};var e=this,n={type:"change"},t={type:"start"},a={type:"end"},s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},l=s.NONE,h=1e-6,c=new F.Spherical,g=new F.Spherical,w=1,M=new F.Vector3,T=!1,E=new F.Vector2,S=new F.Vector2,C=new F.Vector2,b=new F.Vector2,y=new F.Vector2,A=new F.Vector2,m=new F.Vector2,O=new F.Vector2,x=new F.Vector2;function j(){return 2*Math.PI/60/60*e.autoRotateSpeed}function z(){return Math.pow(.95,e.zoomSpeed)}function H(d){g.theta-=d}function Q(d){g.phi-=d}var q=(function(){var d=new F.Vector3;return function(ee,ae){d.setFromMatrixColumn(ae,0),d.multiplyScalar(-ee),M.add(d)}})(),le=(function(){var d=new F.Vector3;return function(ee,ae){e.screenSpacePanning===!0?d.setFromMatrixColumn(ae,1):(d.setFromMatrixColumn(ae,0),d.crossVectors(e.object.up,d)),d.multiplyScalar(ee),M.add(d)}})(),X=(function(){var d=new F.Vector3;return function(ee,ae){var ye=e.domElement;if(e.object.isPerspectiveCamera){var Re=e.object.position;d.copy(Re).sub(e.target);var Te=d.length();Te*=Math.tan(e.object.fov/2*Math.PI/180),q(2*ee*Te/ye.clientHeight,e.object.matrix),le(2*ae*Te/ye.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(q(ee*(e.object.right-e.object.left)/e.object.zoom/ye.clientWidth,e.object.matrix),le(ae*(e.object.top-e.object.bottom)/e.object.zoom/ye.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}})();function K(d){e.object.isPerspectiveCamera?w/=d:e.object.isOrthographicCamera?(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom*d)),e.object.updateProjectionMatrix(),T=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function D(d){e.object.isPerspectiveCamera?w*=d:e.object.isOrthographicCamera?(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/d)),e.object.updateProjectionMatrix(),T=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function I(d){E.set(d.clientX,d.clientY)}function L(d){m.set(d.clientX,d.clientY)}function N(d){b.set(d.clientX,d.clientY)}function Y(d){S.set(d.clientX,d.clientY),C.subVectors(S,E).multiplyScalar(e.rotateSpeed);var U=e.domElement;H(2*Math.PI*C.x/U.clientHeight),Q(2*Math.PI*C.y/U.clientHeight),E.copy(S),e.update()}function ie(d){O.set(d.clientX,d.clientY),x.subVectors(O,m),x.y>0?K(z()):x.y<0&&D(z()),m.copy(O),e.update()}function J(d){y.set(d.clientX,d.clientY),A.subVectors(y,b).multiplyScalar(e.panSpeed),X(A.x,A.y),b.copy(y),e.update()}function G(d){d.deltaY<0?D(z()):d.deltaY>0&&K(z()),e.update()}function re(d){var U=!1;switch(d.keyCode){case e.keys.UP:X(0,e.keyPanSpeed),U=!0;break;case e.keys.BOTTOM:X(0,-e.keyPanSpeed),U=!0;break;case e.keys.LEFT:X(e.keyPanSpeed,0),U=!0;break;case e.keys.RIGHT:X(-e.keyPanSpeed,0),U=!0;break}U&&(d.preventDefault(),e.update())}function W(d){if(d.touches.length==1)E.set(d.touches[0].pageX,d.touches[0].pageY);else{var U=.5*(d.touches[0].pageX+d.touches[1].pageX),ee=.5*(d.touches[0].pageY+d.touches[1].pageY);E.set(U,ee)}}function R(d){if(d.touches.length==1)b.set(d.touches[0].pageX,d.touches[0].pageY);else{var U=.5*(d.touches[0].pageX+d.touches[1].pageX),ee=.5*(d.touches[0].pageY+d.touches[1].pageY);b.set(U,ee)}}function B(d){var U=d.touches[0].pageX-d.touches[1].pageX,ee=d.touches[0].pageY-d.touches[1].pageY,ae=Math.sqrt(U*U+ee*ee);m.set(0,ae)}function ue(d){e.enableZoom&&B(d),e.enablePan&&R(d)}function Z(d){e.enableZoom&&B(d),e.enableRotate&&W(d)}function $(d){if(d.touches.length==1)S.set(d.touches[0].pageX,d.touches[0].pageY);else{var U=.5*(d.touches[0].pageX+d.touches[1].pageX),ee=.5*(d.touches[0].pageY+d.touches[1].pageY);S.set(U,ee)}C.subVectors(S,E).multiplyScalar(e.rotateSpeed);var ae=e.domElement;H(2*Math.PI*C.x/ae.clientHeight),Q(2*Math.PI*C.y/ae.clientHeight),E.copy(S)}function Ce(d){if(d.touches.length==1)y.set(d.touches[0].pageX,d.touches[0].pageY);else{var U=.5*(d.touches[0].pageX+d.touches[1].pageX),ee=.5*(d.touches[0].pageY+d.touches[1].pageY);y.set(U,ee)}A.subVectors(y,b).multiplyScalar(e.panSpeed),X(A.x,A.y),b.copy(y)}function Ae(d){var U=d.touches[0].pageX-d.touches[1].pageX,ee=d.touches[0].pageY-d.touches[1].pageY,ae=Math.sqrt(U*U+ee*ee);O.set(0,ae),x.set(0,Math.pow(O.y/m.y,e.zoomSpeed)),K(x.y),m.copy(O)}function Fe(d){e.enableZoom&&Ae(d),e.enablePan&&Ce(d)}function Le(d){e.enableZoom&&Ae(d),e.enableRotate&&$(d)}function Se(d){if(e.enabled!==!1){d.preventDefault(),e.domElement.focus?e.domElement.focus():window.focus();var U;switch(d.button){case 0:U=e.mouseButtons.LEFT;break;case 1:U=e.mouseButtons.MIDDLE;break;case 2:U=e.mouseButtons.RIGHT;break;default:U=-1}switch(U){case F.MOUSE.DOLLY:if(e.enableZoom===!1)return;L(d),l=s.DOLLY;break;case F.MOUSE.ROTATE:if(d.ctrlKey||d.metaKey||d.shiftKey){if(e.enablePan===!1)return;N(d),l=s.PAN}else{if(e.enableRotate===!1)return;I(d),l=s.ROTATE}break;case F.MOUSE.PAN:if(d.ctrlKey||d.metaKey||d.shiftKey){if(e.enableRotate===!1)return;I(d),l=s.ROTATE}else{if(e.enablePan===!1)return;N(d),l=s.PAN}break;default:l=s.NONE}l!==s.NONE&&(document.addEventListener("mousemove",fe,!1),document.addEventListener("mouseup",me,!1),e.dispatchEvent(t))}}function fe(d){if(e.enabled!==!1)switch(d.preventDefault(),l){case s.ROTATE:if(e.enableRotate===!1)return;Y(d);break;case s.DOLLY:if(e.enableZoom===!1)return;ie(d);break;case s.PAN:if(e.enablePan===!1)return;J(d);break}}function me(d){e.enabled!==!1&&(document.removeEventListener("mousemove",fe,!1),document.removeEventListener("mouseup",me,!1),e.dispatchEvent(a),l=s.NONE)}function ze(d){e.enabled===!1||e.enableZoom===!1||l!==s.NONE&&l!==s.ROTATE||(d.preventDefault(),d.stopPropagation(),e.dispatchEvent(t),G(d),e.dispatchEvent(a))}function Ge(d){e.enabled===!1||e.enableKeys===!1||e.enablePan===!1||re(d)}function Ie(d){if(e.enabled!==!1){switch(d.preventDefault(),d.touches.length){case 1:switch(e.touches.ONE){case F.TOUCH.ROTATE:if(e.enableRotate===!1)return;W(d),l=s.TOUCH_ROTATE;break;case F.TOUCH.PAN:if(e.enablePan===!1)return;R(d),l=s.TOUCH_PAN;break;default:l=s.NONE}break;case 2:switch(e.touches.TWO){case F.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;ue(d),l=s.TOUCH_DOLLY_PAN;break;case F.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Z(d),l=s.TOUCH_DOLLY_ROTATE;break;default:l=s.NONE}break;default:l=s.NONE}l!==s.NONE&&e.dispatchEvent(t)}}function ce(d){if(e.enabled!==!1)switch(d.preventDefault(),d.stopPropagation(),l){case s.TOUCH_ROTATE:if(e.enableRotate===!1)return;$(d),e.update();break;case s.TOUCH_PAN:if(e.enablePan===!1)return;Ce(d),e.update();break;case s.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Fe(d),e.update();break;case s.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Le(d),e.update();break;default:l=s.NONE}}function Je(d){e.enabled!==!1&&(e.dispatchEvent(a),l=s.NONE)}function $e(d){e.enabled!==!1&&d.preventDefault()}e.domElement.addEventListener("contextmenu",$e,!1),e.domElement.addEventListener("mousedown",Se,!1),e.domElement.addEventListener("wheel",ze,!1),e.domElement.addEventListener("touchstart",Ie,!1),e.domElement.addEventListener("touchend",Je,!1),e.domElement.addEventListener("touchmove",ce,!1),e.domElement.addEventListener("keydown",Ge,!1),e.domElement.tabIndex===-1&&(e.domElement.tabIndex=0),this.update()};Ne.prototype=Object.create(F.EventDispatcher.prototype),Ne.prototype.constructor=Ne;var ht=function(f,o){Ne.call(this,f,o),this.mouseButtons.LEFT=F.MOUSE.PAN,this.mouseButtons.RIGHT=F.MOUSE.ROTATE,this.touches.ONE=F.TOUCH.PAN,this.touches.TWO=F.TOUCH.DOLLY_ROTATE};ht.prototype=Object.create(F.EventDispatcher.prototype),ht.prototype.constructor=ht;var Pe=function(f){F.Object3D.call(this),this.element=f,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.addEventListener("removed",function(){this.traverse(function(o){o.element instanceof Element&&o.element.parentNode!==null&&o.element.parentNode.removeChild(o.element)})})};Pe.prototype=Object.create(F.Object3D.prototype),Pe.prototype.constructor=Pe;var Ke=function(f){Pe.call(this,f)};Ke.prototype=Object.create(Pe.prototype),Ke.prototype.constructor=Ke;var Ft=function(){var f=this,o,e,n,t,a=new F.Matrix4,s={camera:{fov:0,style:""},objects:new WeakMap},l=document.createElement("div");l.style.overflow="hidden",this.domElement=l;var h=document.createElement("div");h.style.WebkitTransformStyle="preserve-3d",h.style.transformStyle="preserve-3d",h.style.pointerEvents="none",l.appendChild(h);var c=/Trident/i.test(navigator.userAgent);this.getSize=function(){return{width:o,height:e}},this.setSize=function(b,y){o=b,e=y,n=o/2,t=e/2,l.style.width=b+"px",l.style.height=y+"px",h.style.width=b+"px",h.style.height=y+"px"};function g(b){return Math.abs(b)<1e-10?0:b}function w(b){var y=b.elements;return"matrix3d("+g(y[0])+","+g(-y[1])+","+g(y[2])+","+g(y[3])+","+g(y[4])+","+g(-y[5])+","+g(y[6])+","+g(y[7])+","+g(y[8])+","+g(-y[9])+","+g(y[10])+","+g(y[11])+","+g(y[12])+","+g(-y[13])+","+g(y[14])+","+g(y[15])+")"}function M(b,y){var A=b.elements,m="matrix3d("+g(A[0])+","+g(A[1])+","+g(A[2])+","+g(A[3])+","+g(-A[4])+","+g(-A[5])+","+g(-A[6])+","+g(-A[7])+","+g(A[8])+","+g(A[9])+","+g(A[10])+","+g(A[11])+","+g(A[12])+","+g(A[13])+","+g(A[14])+","+g(A[15])+")";return c?"translate(-50%,-50%)translate("+n+"px,"+t+"px)"+y+m:"translate(-50%,-50%)"+m}function T(b,y,A,m){if(b instanceof Pe){b.onBeforeRender(f,y,A);var O;b instanceof Ke?(a.copy(A.matrixWorldInverse),a.transpose(),a.copyPosition(b.matrixWorld),a.scale(b.scale),a.elements[3]=0,a.elements[7]=0,a.elements[11]=0,a.elements[15]=1,O=M(a,m)):O=M(b.matrixWorld,m);var x=b.element,j=s.objects.get(b);if(j===void 0||j.style!==O){x.style.WebkitTransform=O,x.style.transform=O;var z={style:O};c&&(z.distanceToCameraSquared=E(A,b)),s.objects.set(b,z)}x.style.display=b.visible?"":"none",x.parentNode!==h&&h.appendChild(x),b.onAfterRender(f,y,A)}for(var H=0,Q=b.children.length;H<Q;H++)T(b.children[H],y,A,m)}var E=(function(){var b=new F.Vector3,y=new F.Vector3;return function(A,m){return b.setFromMatrixPosition(A.matrixWorld),y.setFromMatrixPosition(m.matrixWorld),b.distanceToSquared(y)}})();function S(b){var y=[];return b.traverse(function(A){A instanceof Pe&&y.push(A)}),y}function C(b){for(var y=S(b).sort(function(x,j){var z=s.objects.get(x).distanceToCameraSquared,H=s.objects.get(j).distanceToCameraSquared;return z-H}),A=y.length,m=0,O=y.length;m<O;m++)y[m].element.style.zIndex=A-m}this.render=function(b,y){var A=y.projectionMatrix.elements[5]*t;if(s.camera.fov!==A&&(y.isPerspectiveCamera?(l.style.WebkitPerspective=A+"px",l.style.perspective=A+"px"):(l.style.WebkitPerspective="",l.style.perspective=""),s.camera.fov=A),b.autoUpdate===!0&&b.updateMatrixWorld(),y.parent===null&&y.updateMatrixWorld(),y.isOrthographicCamera)var m=-(y.right+y.left)/2,O=(y.top+y.bottom)/2;var x=y.isOrthographicCamera?"scale("+A+")translate("+g(m)+"px,"+g(O)+"px)"+w(y.matrixWorldInverse):"translateZ("+A+"px)"+w(y.matrixWorldInverse),j=x+"translate("+n+"px,"+t+"px)";s.camera.style!==j&&!c&&(h.style.WebkitTransform=j,h.style.transform=j,s.camera.style=j),T(b,b,y,x),c&&C(b)}};function Lt(f,o,e){var n=o.getBoundingClientRect(),t=n.top,a=n.left,s=n.width,l=n.height;return new v.Vector2((f.x-a)/s*2-1,-(f.y-t)/l*2+1)}var It=(function(f){de(o,f);function o(e,n,t,a,s){var l=f.call(this)||this;l.type="RoundedBoxGeometry",s=isNaN(s)?1:Math.max(1,Math.floor(s)),e=isNaN(e)?1:e,n=isNaN(n)?1:n,t=isNaN(t)?1:t,a=isNaN(a)?.15:a,a=Math.min(a,Math.min(e,Math.min(n,Math.min(t)))/2);var h=e/2-a,c=n/2-a,g=t/2-a;l.parameters={width:e,height:n,depth:t,radius:a,radiusSegments:s};var w=s+1,M=w*s+1<<3,T=new v.BufferAttribute(new Float32Array(M*3),3),E=new v.BufferAttribute(new Float32Array(M*3),3),S=[],C=[];new v.Vector3;var b=new v.Vector3,y=[],A=[],m=[],O=w*s,x=w*s+1;j(),H(),z(),Q(),le(),q();function j(){for(var D=[new v.Vector3(1,1,1),new v.Vector3(1,1,-1),new v.Vector3(-1,1,-1),new v.Vector3(-1,1,1),new v.Vector3(1,-1,1),new v.Vector3(1,-1,-1),new v.Vector3(-1,-1,-1),new v.Vector3(-1,-1,1)],I=0;I<8;I++)S.push([]),C.push([]);for(var L=Math.PI/2,N=new v.Vector3(h,c,g),Y=0;Y<=s;Y++){var ie=Y/s,J=ie*L,G=Math.cos(J),re=Math.sin(J);if(Y==s){b.set(0,1,0);var W=b.clone().multiplyScalar(a).add(N);S[0].push(W),y.push(W);var R=b.clone();C[0].push(R),A.push(R);continue}for(var B=0;B<=s;B++){var ue=B/s,Z=ue*L;b.x=G*Math.cos(Z),b.y=re,b.z=G*Math.sin(Z);var W=b.clone().multiplyScalar(a).add(N);S[0].push(W),y.push(W);var R=b.clone().normalize();C[0].push(R),A.push(R)}}for(var $=1;$<8;$++)for(var I=0;I<S[0].length;I++){var W=S[0][I].clone().multiply(D[$]);S[$].push(W),y.push(W);var R=C[0][I].clone().multiply(D[$]);C[$].push(R),A.push(R)}}function z(){for(var D=[!0,!1,!0,!1,!1,!0,!1,!0],I=w*(s-1),L=0;L<8;L++){for(var N=x*L,Y=0;Y<s-1;Y++)for(var ie=Y*w,J=(Y+1)*w,G=0;G<s;G++){var re=G+1,W=N+ie+G,R=N+ie+re,B=N+J+G,ue=N+J+re;D[L]?(m.push(W),m.push(B),m.push(R),m.push(R),m.push(B),m.push(ue)):(m.push(W),m.push(R),m.push(B),m.push(R),m.push(ue),m.push(B))}for(var G=0;G<s;G++){var W=N+I+G,R=N+I+G+1,B=N+O;D[L]?(m.push(W),m.push(B),m.push(R)):(m.push(W),m.push(R),m.push(B))}}}function H(){var D=O,I=O+x,L=O+x*2,N=O+x*3;m.push(D),m.push(I),m.push(L),m.push(D),m.push(L),m.push(N),D=O+x*4,I=O+x*5,L=O+x*6,N=O+x*7,m.push(D),m.push(L),m.push(I),m.push(D),m.push(N),m.push(L),D=0,I=x,L=x*4,N=x*5,m.push(D),m.push(L),m.push(I),m.push(I),m.push(L),m.push(N),D=x*2,I=x*3,L=x*6,N=x*7,m.push(D),m.push(L),m.push(I),m.push(I),m.push(L),m.push(N),D=s,I=s+x*3,L=s+x*4,N=s+x*7,m.push(D),m.push(I),m.push(L),m.push(I),m.push(N),m.push(L),D=s+x,I=s+x*2,L=s+x*5,N=s+x*6,m.push(D),m.push(L),m.push(I),m.push(I),m.push(L),m.push(N)}function Q(){for(var D=0;D<4;D++)for(var I=D*x,L=4*x+I,N=(D&1)===1,Y=0;Y<s;Y++){var ie=Y+1,J=I+Y,G=I+ie,re=L+Y,W=L+ie;N?(m.push(J),m.push(re),m.push(G),m.push(G),m.push(re),m.push(W)):(m.push(J),m.push(G),m.push(re),m.push(G),m.push(W),m.push(re))}}function q(){for(var D=[0,2,4,6],I=[1,3,5,7],L=0;L<4;L++)for(var N=x*D[L],Y=x*I[L],ie=1>=L,J=0;J<s;J++){var G=J*w,re=(J+1)*w,W=N+G,R=N+re,B=Y+G,ue=Y+re;ie?(m.push(W),m.push(B),m.push(R),m.push(R),m.push(B),m.push(ue)):(m.push(W),m.push(R),m.push(B),m.push(R),m.push(ue),m.push(B))}}function le(){for(var D=s-1,I=[0,1,4,5],L=[3,2,7,6],N=[0,1,1,0],Y=0;Y<4;Y++)for(var ie=I[Y]*x,J=L[Y]*x,G=0;G<=D;G++){var re=ie+s+G*w,W=ie+(G!=D?s+(G+1)*w:x-1),R=J+s+G*w,B=J+(G!=D?s+(G+1)*w:x-1);N[Y]?(m.push(re),m.push(R),m.push(W),m.push(W),m.push(R),m.push(B)):(m.push(re),m.push(W),m.push(R),m.push(W),m.push(B),m.push(R))}}for(var X=0,K=0;K<y.length;K++)T.setXYZ(X,y[K].x,y[K].y,y[K].z),E.setXYZ(X,A[K].x,A[K].y,A[K].z),X++;return l.setIndex(new v.BufferAttribute(new Uint16Array(m),1)),l.setAttribute("position",T),l.setAttribute("normal",E),l}return o})(v.BufferGeometry);function Ue(f,o){return typeof f!="number"||typeof o!="number"?!1:Math.abs(f-o)<.001}function Ve(f,o,e,n){n===void 0&&(n=function(a){return a});var t=n(e);return f*(1-t)+o*t}var se=Number((Math.PI/2).toFixed(5));function vn(f,o,e){var n=new v.Shape;return n.moveTo(e,0),n.lineTo(f-e,0),n.absarc(f-e,e,e,-se,0,!1),n.lineTo(f,o-e),n.absarc(f-e,o-e,e,0,se,!1),n.lineTo(e,o),n.absarc(e,o-e,e,se,Math.PI,!1),n.lineTo(0,e),n.absarc(e,e,e,Math.PI,Math.PI*1.5,!1),n}var je=function(f){var o=document.createElement("div");o.innerText=f;var e=new Pe(o);return e.name=f,e.scale.set(.3,.3,.3),o.style.pointerEvents="none",o.style.backfaceVisibility="hidden",e},Ze=function(f){var o=new v.PlaneGeometry(5,5),e=new v.MeshBasicMaterial({transparent:!0,opacity:0}),n=new v.Mesh(o,e),t=document.createElement("div");t.innerText=f;var a=new Pe(t);return a.name=f,a.scale.set(.3,.3,.3),t.style.color="#ffffff",t.style.opacity="0.5",t.style.pointerEvents="none",t.style.backfaceVisibility="hidden",n.rotateX(-se),n.add(a),n},pn=(function(f){de(o,f);function o(e,n){var t=f.call(this,e)||this;t.camera=new pe.Camera(90),t.scene=new v.Scene,t.renderer=new v.WebGLRenderer({antialias:!0,alpha:!0}),t.css3drenderer=new Ft,t.ambientLight=new v.AmbientLight(16777215,.7),t.wrapper=document.createElement("div"),t.arrows=document.createElement("div"),t.arrowLeft=document.createElement("div"),t.arrowRight=document.createElement("div"),t.arrowFront=document.createElement("div"),t.arrowBack=document.createElement("div"),t.arrowTop=document.createElement("div"),t.arrowBottom=document.createElement("div"),t.spherical=null,t.dragging=!1,t.style=document.createElement("style"),t.directionalLight=new v.DirectionalLight(16777215,.2),t.box=new v.Mesh(new It(8,8,8,.5,20),new v.MeshPhongMaterial({color:16777215})),t.faces=new v.Group,t.orient=function(l){var h=l.longitude,c=l.latitude;t.dragging=!1,t.spherical=null,t.controls.enableDamping=!1,t.five.setState(Object.assign({latitude:c},h!==void 0?{longitude:h+t.config.fixedLongitude}:{})),t.five.ready().then(function(){t.controls.enableDamping=!0,t.setState({arrowsVisible:!0})})},t.onRenderFrame=function(){var l,h,c,g,w;if(t.renderer.render(t.scene,t.camera),t.css3drenderer.render(t.scene,t.camera),t.directionalLight.position.copy(t.camera.position),(l=t.controls)===null||l===void 0||l.update(),t.dragging){t.camera.computePose(),t.updateByCamera();var M=t.camera.pose,T=M.longitude,E=M.latitude;t.five.setState({longitude:T,latitude:E},!0),t.updateArrows({longitude:T,latitude:E})}else if(t.spherical&&(!Ue(t.spherical.pi,(h=t.controls)===null||h===void 0?void 0:h.getPolarAngle())||!Ue(t.spherical.theta,(c=t.controls)===null||c===void 0?void 0:c.getAzimuthalAngle()))){t.spherical={pi:(g=t.controls)===null||g===void 0?void 0:g.getPolarAngle(),theta:(w=t.controls)===null||w===void 0?void 0:w.getAzimuthalAngle()},t.camera.computePose(),t.updateByCamera();var S=t.camera.pose,T=S.longitude,E=S.latitude;t.five.setState({longitude:T,latitude:E},!0),t.updateArrows({longitude:T,latitude:E})}else t.spherical=null},t.onTapGesture=function(l){var h=l.pointers[0].clientX,c=l.pointers[0].clientY,g=Lt({x:h,y:c},t.wrapper),w=new v.Raycaster;w.setFromCamera(g,t.camera);var M=w.intersectObjects(t.faces.children,!1)[0];if(M){var T=M.object.userData,E=T.longitude,S=T.latitude;t.orient({longitude:E,latitude:S})}},t.onFiveWantsGesture=function(){if(t.spherical)return!1},t.onFiveModeChange=function(l){t.controls&&(t.controls.maxPolarAngle=l==="Topview"?0:se)},t.onCameraUpdate=function(l){var h=l.state;if(!t.dragging&&!t.spherical){var c=h.longitude,g=h.latitude;t.camera.pose.longitude===c&&t.camera.pose.latitude===g||(t.camera.setFromPose({longitude:c,latitude:g,distance:20,offset:new v.Vector3(0,0,0)}),t.updateByCamera(),t.updateArrows({longitude:c,latitude:g}))}},t.onPanStart=function(l){t.dragging=!0,t.spherical={}},t.onMouseMove=function(l){if(!t.dragging){var h=Lt({x:l.clientX,y:l.clientY},t.wrapper),c=new v.Raycaster;c.setFromCamera(h,t.camera);var g=c.intersectObjects(t.faces.children,!1)[0];t.faces.children.forEach(function(w){w.material.opacity=0,w.children[0].element.style.color=""}),g&&(g.object.material.opacity=.3,g.object.children[0].element.style.color="#336dff")}},t.onPanEnd=function(l){t.dragging=!1,t.spherical={pi:t.controls.getPolarAngle(),theta:t.controls.getAzimuthalAngle()}},t.dispose=function(){t.disable()},t.five=e;var a={enabled:!1,visible:!0,arrowsVisible:!1};t.state=Object.assign(a,n==null?void 0:n.initialState);var s=V({fixedLongitude:0,orthoView:!0},n==null?void 0:n.config);return t._config=s,t.state.enabled&&t._enable({userAction:!1}),t.mc=new ft.Manager(t.wrapper),t.mc.add(new ft.Tap({interval:410})),t.mc.add(new ft.Pan({threshold:10,pointers:0})),t.camera.setFromPose({distance:20,offset:new v.Vector3(0,0,0),longitude:e.camera.pose.latitude,latitude:e.camera.pose.latitude}),t.cylinder=new v.Mesh(new v.CylinderGeometry(13.2,14,.01,50,1,!0),new v.ShaderMaterial({uniforms:{radiusTop:{value:13.2},radiusBottom:{value:14},opacity:{value:1}},vertexShader:`
|
|
357
357
|
varying vec3 pos;
|
|
358
358
|
varying mat4 vViewMatrix;
|
|
359
359
|
void main() {
|
|
@@ -383,7 +383,7 @@ void main() {
|
|
|
383
383
|
vec4 color = mix(color1, color2, z);
|
|
384
384
|
gl_FragColor = color;
|
|
385
385
|
}
|
|
386
|
-
`,transparent:!0})),t.init(),t}return Object.defineProperty(
|
|
386
|
+
`,transparent:!0})),t.init(),t}return Object.defineProperty(o.prototype,"config",{get:function(){return V({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(e,n){var t=this.state;this.state=V(V({},this.state),e),typeof e.arrowsVisible=="boolean"&&this.handleArrowsVisible(e.arrowsVisible),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},o.prototype.appendTo=function(e){if(e){e.appendChild(this.wrapper);var n=this.wrapper.getBoundingClientRect(),t=n.width,a=n.height;this.renderer.setSize(t,a),this.css3drenderer.setSize(t,a)}},o.prototype.init=function(){this.renderer.setClearAlpha(0),this.renderer.domElement.style.outline="none",this.initDom(),this.initFaces(),this.initControls(),this.initLights();var e=this.cylinder;e.position.y=-3;var n=Ze("西");n.position.set(-19,0,0),e.add(n);var t=Ze("东");t.position.set(19,0,0),e.add(t);var a=Ze("北");a.position.set(0,0,-19),e.add(a);var s=Ze("南");s.position.set(0,0,19),e.add(s),this.updateByCamera(),this.scene.add(e,this.box,this.faces),this.scene.rotation.y=this.config.fixedLongitude},o.prototype.initDom=function(){this.style.innerHTML=`
|
|
387
387
|
.OrientationPlugin .OrientationArrows {
|
|
388
388
|
position: absolute;
|
|
389
389
|
top: 0;
|
|
@@ -483,7 +483,7 @@ void main() {
|
|
|
483
483
|
border-color: transparent transparent var(--color) transparent;
|
|
484
484
|
transform: translate(0, -15px);
|
|
485
485
|
}
|
|
486
|
-
`,this.wrapper.className="OrientationPlugin",this.arrows.className="OrientationArrows",this.wrapper.style.cssText="position: relative; width: 100%; height: 100%",this.wrapper.appendChild(this.arrows),this.arrowLeft.className=this.arrowRight.className=this.arrowTop.className=this.arrowBack.className=this.arrowFront.className="OrientationArrow",this.arrowBottom.className="OrientationArrow disabled",this.arrowBack.innerText="后",this.arrowFront.innerText="前",this.arrowLeft.innerText="左",this.arrowRight.innerText="右",this.arrowTop.innerText="上",this.arrowBottom.innerText="下",this.css3drenderer.domElement.style.cssText="position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; color: #00000090;"},
|
|
486
|
+
`,this.wrapper.className="OrientationPlugin",this.arrows.className="OrientationArrows",this.wrapper.style.cssText="position: relative; width: 100%; height: 100%",this.wrapper.appendChild(this.arrows),this.arrowLeft.className=this.arrowRight.className=this.arrowTop.className=this.arrowBack.className=this.arrowFront.className="OrientationArrow",this.arrowBottom.className="OrientationArrow disabled",this.arrowBack.innerText="后",this.arrowFront.innerText="前",this.arrowLeft.innerText="左",this.arrowRight.innerText="右",this.arrowTop.innerText="上",this.arrowBottom.innerText="下",this.css3drenderer.domElement.style.cssText="position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; color: #00000090;"},o.prototype.bindEvents=function(){var e=this;this.five.on("renderFrame",this.onRenderFrame),this.five.on("camera.update",this.onCameraUpdate),this.five.on("wantsGesture",this.onFiveWantsGesture),this.five.on("modeChange",this.onFiveModeChange),this.mc.on("tap",this.onTapGesture),this.mc.on("panstart",this.onPanStart),this.mc.on("panend",this.onPanEnd),this.wrapper.addEventListener("mousemove",this.onMouseMove),this.arrowTop.onclick=function(){return e.orient({longitude:0,latitude:se})},this.arrowLeft.onclick=function(){return e.orient({longitude:-se,latitude:0})},this.arrowRight.onclick=function(){return e.orient({longitude:se,latitude:0})},this.arrowFront.onclick=function(){return e.orient({longitude:0,latitude:0})},this.arrowBack.onclick=function(){return e.orient({longitude:Math.PI,latitude:0})}},o.prototype.unbindEvents=function(){this.five.off("renderFrame",this.onRenderFrame),this.five.off("camera.update",this.onCameraUpdate),this.five.off("wantsGesture",this.onFiveWantsGesture),this.five.off("modeChange",this.onFiveModeChange),this.mc.off("tap",this.onTapGesture),this.mc.off("panstart",this.onPanStart),this.mc.off("panend",this.onPanEnd),this.wrapper.removeEventListener("mousemove",this.onMouseMove),this.arrowTop.onclick=null,this.arrowLeft.onclick=null,this.arrowRight.onclick=null,this.arrowFront.onclick=null,this.arrowBack.onclick=null},o.prototype.updateByCamera=function(){var e=Ve(.2,1,this.camera.pose.latitude/Math.PI*2,function(l){return l*l}),n=Ve(11,13,this.camera.pose.latitude/Math.PI*2,function(l){return l*l}),t=Ve(12,15,this.camera.pose.latitude/Math.PI*2,function(l){return l*l}),a=Ve(13,19,this.camera.pose.latitude/Math.PI*2,function(l){return l*l}),s=Ve(-.2,.5,this.camera.pose.latitude/Math.PI*2,function(l){return l*l});this.cylinder.geometry=new v.CylinderGeometry(n,t,.01,50,1,!0),this.cylinder.material.uniforms.radiusTop.value=n,this.cylinder.material.uniforms.radiusBottom.value=t,this.cylinder.material.needsUpdate=!0,this.cylinder.children.forEach(function(l){l.position.normalize().multiplyScalar(a),l.scale.set(e,e,e);var h=l.children[0];h&&(h.element.style.opacity=s.toString())})},o.prototype.updateArrows=function(e){e.longitude;var n=e.latitude,t=se-n<.02;this.setState({arrowsVisible:t})},o.prototype.handleArrowsVisible=function(e){var n=this;if(this.state.enabled)if(this.cylinder.material.uniforms.opacity.value=e?.4:1,this.cylinder.material.needsUpdate=!0,e){var t=this.five.getCurrentState(),a=t.longitude,s=t.latitude;if(se-s<.03)this.five.state.mode==="Topview"||this.five.state.mode==="Mapview"?(this.faces.getObjectByName("上").element.className="active",this.arrows.innerHTML="",this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowFront),this.arrows.style.transform="rotate(".concat((a-this.config.fixedLongitude)/Math.PI*180,"deg)")):(this.arrows.innerHTML="",this.faces.getObjectByName("上").element.className="");else{switch(this.arrows.innerHTML="",this.arrows.appendChild(this.arrowTop),this.config.orthoView&&this.five.ready().then(function(){n.five.controller.cameraType="orthographic",n.five.ready().then(function(){return n.five.controller.cameraMotion.ended=!1})}),!0){case Ue(0,a-this.config.fixedLongitude):this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("前").element.className="active";break;case Ue(se,a-this.config.fixedLongitude):this.arrows.appendChild(this.arrowFront),this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("右").element.className="active";break;case Ue(Math.PI,a-this.config.fixedLongitude):this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("后").element.className="active";break;default:this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowFront),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("左").element.className="active";break}this.arrows.style.transform=""}this.arrows.style.display="block"}else this.config.orthoView&&(this.five.controller.cameraType="auto",this.five.ready().then(function(){return n.five.controller.cameraMotion.ended=!1})),this.arrows.style.display="none",this.faces.children.forEach(function(l){l.children[0].element.className=""})},o.prototype.setState=function(e,n){n===void 0&&(n={});var t=this.state,a=n.userAction!==void 0?n.userAction:!0;if(this.updateState(e,a),e.enabled!==void 0&&t.enabled!==e.enabled){var s={userAction:a};e.enabled?this._enable(s):this._disable(s)}},o.prototype.initLights=function(){this.directionalLight.target=this.box,this.scene.add(this.ambientLight,this.directionalLight)},o.prototype.initFaces=function(){var e=vn(7,7,.5),n=new v.ShapeGeometry(e);n.translate(-3.5,-3.5,0);var t=new v.Mesh(n,new v.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));t.userData={longitude:0,latitude:0},t.position.z=4.1,t.add(je("前"));var a=new v.Mesh(n,new v.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));a.rotateY(Math.PI),a.position.z=-4.1,a.add(je("后")),a.userData={longitude:Math.PI,latitude:0};var s=new v.Mesh(n,new v.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));s.rotateY(se),s.position.x=4.1,s.add(je("右")),s.userData={longitude:se,latitude:0};var l=new v.Mesh(n,new v.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));l.rotateY(-se),l.position.x=-4.1,l.add(je("左")),l.userData={longitude:-se,latitude:0};var h=new v.Mesh(n,new v.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));h.rotateX(-se),h.position.y=4.1,h.add(je("上")),h.userData={longitude:0,latitude:se},this.faces.add(t,a,l,s,h)},o.prototype.initControls=function(){var e=this.controls=new Ne(this.camera,this.renderer.domElement);e.enableZoom=!1,e.enableDamping=!0,e.enablePan=!1,e.maxPolarAngle=se,e.dampingFactor=.15,e.rotateSpeed=.25},o.prototype.load=function(e){return Oe(this,void 0,void 0,function(){return _e(this,function(n){return[2]})})},o.prototype._enable=function(e){var n=this.five.getCurrentState(),t=n.longitude,a=n.latitude;this.camera.setFromPose({longitude:t,latitude:a,distance:20,offset:new v.Vector3(0,0,0)}),this.updateByCamera(),this.wrapper.appendChild(this.renderer.domElement),this.wrapper.appendChild(this.css3drenderer.domElement),this.bindEvents()},o.prototype._disable=function(e){this.wrapper.removeChild(this.renderer.domElement),this.wrapper.removeChild(this.css3drenderer.domElement),this.unbindEvents()},o.prototype.enable=function(e){var n;if(!this.state.enabled){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!0},t),this._enable({userAction:t}),document.head.appendChild(this.style)}},o.prototype.disable=function(e){var n;if(this.state.enabled!==!1){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!1},t),this._disable({userAction:t}),document.head.removeChild(this.style)}},o})(te.BasePlugin.Controller),mn=function(f,o){return new pn(f,o)},gn=(function(f){de(o,f);function o(e,n){var t=f.call(this,e)||this;return t.data={},t.pluginName="BackgroundPlugin",t._onFiveCameraUpdate=function(a){var s=(Math.PI/2-Math.max(a.latitude,0))/(Math.PI/2),l=Math.max(.2-s,0)*10;t.gradientBg&&(t.gradientBg.style.transform="translateY(-".concat((1-s)*50,"%)")),t.groundBg&&(t.groundBg.style.backgroundImage="radial-gradient(circle, #2E303350 ".concat(l*100,"%, transparent ").concat(l*120,"%)"))},t._addEventListener=function(){t.five.on("cameraUpdate",t._onFiveCameraUpdate)},t._removeEventListener=function(){t.five.off("cameraUpdate",t._onFiveCameraUpdate)},t.load=function(){return Oe(t,void 0,void 0,function(){return _e(this,function(a){return[2]})})},t.setState=function(a,s){},t.enable=function(){var a,s=(a=t.five.getElement())===null||a===void 0?void 0:a.parentNode;if(!s){t.five.ready().then(function(){return t.enable()});return}t.state.enabled||(t._onFiveCameraUpdate(t.five.getPose(),!1),t.gradientBg&&s.appendChild(t.gradientBg),t.groundBg&&s.appendChild(t.groundBg),t.style&&document.head.appendChild(t.style),t._addEventListener(),t.hooks.emit("enable",{userAction:!0}),t.state.enabled=!0)},t.disable=function(a){var s,l,h,c;t.state.enabled&&((l=(s=t.gradientBg)===null||s===void 0?void 0:s.parentNode)===null||l===void 0||l.removeChild(t.gradientBg),(c=(h=t.groundBg)===null||h===void 0?void 0:h.parentNode)===null||c===void 0||c.removeChild(t.groundBg),t.style&&document.head.removeChild(t.style),t._removeEventListener(),t.hooks.emit("disable",{userAction:!0}),t.state.enabled=!1)},t.dispose=function(){t._removeEventListener(),t.hooks.emit("disable",{userAction:!0}),t.state.enabled=!1},t.state={enabled:!1},typeof document=="undefined"||(t.gradientBg=document.createElement("div"),t.groundBg=document.createElement("div"),t.style=document.createElement("style"),t.gradientBg.className="BackgroundPluginBg",t.groundBg.className="BackgroundPluginGroundBg",t.style.innerHTML=`
|
|
487
487
|
.BackgroundPluginBg {
|
|
488
488
|
position: absolute;
|
|
489
489
|
top: 0;
|
|
@@ -504,7 +504,7 @@ void main() {
|
|
|
504
504
|
z-index: -1;
|
|
505
505
|
pointerEvents: none;
|
|
506
506
|
}
|
|
507
|
-
`,t.enable()),t}return
|
|
507
|
+
`,t.enable()),t}return o})(lt.BasePlugin.Controller),yn=function(f,o){return new gn(f,o)};new v.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);var dt=(function(){function f(o,e,n,t,a){this.R=o,this.Q=e,this.A=n,this.B=t,this.C=a,this.cov=NaN,this.x=NaN}return f.prototype.filter=function(o,e){if(e===void 0&&(e=0),isNaN(this.x))this.x=1/this.C*o,this.cov=1/this.C*this.Q*(1/this.C);else{var n=this.A*this.x+this.B*e,t=this.A*this.cov*this.A+this.R,a=t*this.C*(1/(this.C*t*this.C+this.Q));this.x=n+a*(o-this.C*n),this.cov=t-a*this.C*t}return this.x},f})(),bn=(function(f){de(o,f);function o(e,n){var t=f.call(this,e)||this;t.dispose=function(){t.disable()},t.five=e;var a={enabled:!0,visible:!0};t.state=Object.assign(a,n==null?void 0:n.initialState);var s=V({},n==null?void 0:n.config);return t._config=s,t.state.enabled&&t._enable({userAction:!1}),t.cancelAnimation=null,t.skipStart=0,t.skipEnd=0,t.location=0,t.totalDistance=0,t.trajectory=null,t.currentKeyFrame=null,t.nextKeyframe=null,t.nextButOneKeyframe=null,t.keyframes=[],t.rate=t.config.rate||1,t.virualCamera=t.five.camera.clone(),t.playingState={keyframeIndex:null,progress:null},Object.defineProperties(t,{currentDistance:{get:function(){return this._currentDistance},set:function(l){this._currentDistance=l}}}),t}return Object.defineProperty(o.prototype,"config",{get:function(){return V({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(e,n){var t=this.state;this.state=V(V({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},o.prototype.load=function(e){return Oe(this,void 0,void 0,function(){return _e(this,function(n){return[2]})})},o.prototype.loadTrajectory=function(e){this.trajectory=e,this.cancelAnimation&&this.cancelAnimation(),this.playingState.keyframeIndex=null,this.playingState.progress=null;var n=.01,t=.1,a=1,s=0,l=1,h=new dt(n,t,a,s,l),c=new dt(n,t,a,s,l),g=new dt(n,t,a,s,l);if(this.trajectory&&this.trajectory.content.loadState==="READY"){for(var w=this.trajectory.content.data.positionArray,M=new Float32Array(w.length/3),T=0;T<M.length;T++)if(T===0)M[T]=0;else{var E=new v.Vector3(w[T-3],w[T-2],w[T-1]),S=new v.Vector3(w[T],w[T+1],w[T+2]);M[T]=S.distanceTo(E)+M[T-1]}this.totalDistance=M[M.length-1];for(var T=0;T<M.length;T++){for(var C=new v.Vector3(0,0,0),b=0,y=T-5;y<T+6;y++)y>=0&&y<M.length&&(C.add(new v.Vector3(w[y*3],w[y*3+1],w[y*3+2])),b++);C.divideScalar(b).applyMatrix4(e.transform);var A=h.filter(C.x),m=c.filter(C.y),O=g.filter(C.z),x={position:new v.Vector3(A,m,O),location:M[T]};this.keyframes.push(x)}}else throw new Error("trajectory content is not ready")},o.prototype.setPlayingState=function(e){(e.keyframeIndex!==null||e.progress!==null)&&(this.cancelAnimation&&this.cancelAnimation(),this.playingState.keyframeIndex=e.keyframeIndex?e.keyframeIndex:this.playingState.keyframeIndex,this.playingState.progress=e.progress?e.progress:this.playingState.progress,this.play())},o.prototype._enable=function(e){},o.prototype.play=function(){var e=this,n=this.keyframes.length;if(n<2)throw new Error("keyframes length must be greater than 2");var t={keyframeIndex:null,progress:null};this.playingState.keyframeIndex!==null&&this.playingState.progress!==null?(t.keyframeIndex=this.playingState.keyframeIndex,t.progress=this.playingState.progress):this.playingState.keyframeIndex===null&&this.playingState.progress===null&&(this.playingState.keyframeIndex=this.skipStart,this.playingState.progress=0,this.virualCamera.position.copy(this.keyframes[this.playingState.keyframeIndex].position.clone()),this.virualCamera.lookAt(this.keyframes[1].position.clone()),this.virualCamera.computePose(),this.five.setState(V({},this.virualCamera.pose)));var a=this.playingState.keyframeIndex,s=0;this.cancelAnimation=pe.AnimationFrameLoop.shared.add(function(l,h){if(a===n-1-e.skipEnd&&e.cancelAnimation){e.cancelAnimation();return}e.currentKeyFrame=e.keyframes[a],e.nextKeyframe=e.keyframes[a+1],a+2<=n-1?e.nextButOneKeyframe=e.keyframes[a+2]:e.nextButOneKeyframe=null;var c=e.currentKeyFrame.position.clone(),g=e.nextKeyframe.position.clone(),w=e.nextKeyframe.position.clone().sub(e.currentKeyFrame.position.clone()).normalize(),M=c.clone().add(w.clone().multiplyScalar(.01)),T=new v.Vector3;e.nextButOneKeyframe!==null?T=e.nextButOneKeyframe.position.clone().sub(e.nextKeyframe.position.clone()).normalize():T.copy(w);var E=g.clone().add(T.clone().multiplyScalar(.01));s+=h/1e3*e.rate;var S=s/c.distanceTo(g);S=S>=1?1:S,t.keyframeIndex!==null&&t.progress!==null&&(S=t.progress,t.keyframeIndex=null,t.progress=null);var C=c.clone().lerp(g,S),b=M.clone().lerp(E,S);e.virualCamera.position.copy(C),e.virualCamera.lookAt(b),e.virualCamera.updateMatrixWorld(),e.virualCamera.updateMatrix(),e.virualCamera.computePose(),e.five.setState(V({},e.virualCamera.pose)),e.location=e.keyframes[a].location+c.clone().distanceTo(C),S===1?(s=0,a++,e.playingState.keyframeIndex=a,e.playingState.progress=0):(e.playingState.keyframeIndex=a,e.playingState.progress=S)})},o.prototype.pause=function(){this.cancelAnimation&&this.cancelAnimation()},o.prototype.findKeyFrameByLocation=function(e){if(this.keyframes.length!==0){for(var n=0,t=this.keyframes.length-1;n<=t;){var a=Math.floor((n+t)/2);if(this.keyframes[a].location===e)return a;this.keyframes[a].location<e?n=a+1:t=a-1}return{keyframeIndex:n-1,progress:0}}},o.prototype.resetPlayingState=function(){this.playingState.keyframeIndex=null,this.playingState.progress=null},o.prototype._disable=function(e){},o.prototype.enable=function(e){var n;if(!this.state.enabled){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!0},t),this._enable({userAction:t})}},o.prototype.disable=function(e){var n;if(this.state.enabled!==!1){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!1},t),this._disable({userAction:t})}},o})(te.BasePlugin.Controller),wn=function(f,o){return new bn(f,o)};function Dt(f,o,e){return f<o?o:f>e?e:f}var Pn=`
|
|
508
508
|
varying vec2 vUv;
|
|
509
509
|
varying vec3 vPosition;
|
|
510
510
|
void main() {
|
|
@@ -512,7 +512,7 @@ void main() {
|
|
|
512
512
|
vPosition = position;
|
|
513
513
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
514
514
|
}
|
|
515
|
-
`,
|
|
515
|
+
`,Tn=`
|
|
516
516
|
varying vec2 vUv;
|
|
517
517
|
uniform sampler2D map;
|
|
518
518
|
uniform float progress;
|
|
@@ -531,7 +531,7 @@ void main() {
|
|
|
531
531
|
}
|
|
532
532
|
gl_FragColor.a = gl_FragColor.a * opacity;
|
|
533
533
|
}
|
|
534
|
-
`,
|
|
534
|
+
`,Mn=[1,5,2,6,3,7,4,8,9,13,10,14,11,15,12,16],vt=512,pt=512,Qe=128,En=(function(f){de(o,f);function o(e,n){var t=f.call(this,e)||this;t.group=new v.Group,t.mesh=(function(){var l=new v.CylinderGeometry(.12,.12,1,32,1,!0);l.translate(0,.5,0);var h=new v.ShaderMaterial({vertexShader:Pn,fragmentShader:Tn,uniforms:{map:{value:new v.Texture},progress:{value:0},opacity:{value:0}},transparent:!0,depthTest:!1}),c=new v.Mesh(l,h);return c})(),t.panoMesh=new pe.PanoCircleMesh({scale:1.5}),t.stop=function(){},t.drawLine=function(l,h){if(t.ctx){var c=(function(){var M,T=vt/16|0;return T*((M=Mn[l])!==null&&M!==void 0?M:0)})(),g=(1-(h+l*150)%1200/1200)*(pt+Qe),w=t.ctx.createLinearGradient(0,g-Qe,0,g);w.addColorStop(0,"rgba(255,255,255,0)"),w.addColorStop(.5,"rgba(255,255,255,1)"),w.addColorStop(1,"rgba(255,255,255,0)"),t.ctx.fillStyle=w,t.ctx.fillRect(c,g-Qe,3,Qe)}},t.anime=function(l){if(t.ctx&&t.startTime){t.ctx.clearRect(0,0,vt,pt);for(var h=0;h<16;h++)t.drawLine(h,l-t.startTime);var c=Dt((l-t.startTime)/1e3,0,1),g=Dt((l-t.startTime)/300,0,t.config.maxOpacity);t.panoMesh.setOpacity(g),t.mesh.material.uniforms.progress.value=c,t.mesh.material.uniforms.opacity.value=g,t.mesh.material.uniforms.map.value.needsUpdate=!0,t.five.needsRender=!0}},t.dispose=function(){t.disable()},t.five=e;var a={enabled:!1,visible:!0};t.state=Object.assign(a,n==null?void 0:n.initialState);var s=V(V({},n==null?void 0:n.config),{maxOpacity:1});return t._config=s,typeof document=="undefined"||(t.canvas=document.createElement("canvas"),t.ctx=t.canvas.getContext("2d"),t.canvas.width=vt,t.canvas.height=pt,t.ctx.shadowColor="rgba(255,255,255,0.5)",t.ctx.shadowBlur=6,t.ctx.shadowOffsetX=0,t.ctx.shadowOffsetY=0,t.mesh.material.uniforms.map.value=new v.CanvasTexture(t.canvas),t.group.add(t.mesh),t.panoMesh.setProgress(1),t.panoMesh.setOpacity(0),t.group.add(t.panoMesh),t.state.enabled&&t._enable({userAction:!1})),t}return Object.defineProperty(o.prototype,"config",{get:function(){return V({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(e,n){var t=this.state;this.state=V(V({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},o.prototype.updateConfig=function(e,n){var t;n===void 0&&(n={});var a=this.config,s=V(V({},a),e);this._config=s,this.hooks.emit("configChange",{prevConfig:a,config:s,userAction:(t=n.userAction)!==null&&t!==void 0?t:!0})},o.prototype.load=function(e){return Oe(this,void 0,void 0,function(){return _e(this,function(n){return[2]})})},o.prototype._enable=function(e){var n=this;this.mesh.position.copy(this.five.observers[this.five.state.panoIndex].standingPosition),this.panoMesh.position.copy(this.five.observers[this.five.state.panoIndex].standingPosition),this.five.ready().then(function(){n.five.scene.add(n.group),n.stop=pe.AnimationFrameLoop.shared.add(function(t,a){n.startTime||(n.startTime=t),n.panoMesh.updateTime(t,a),n.anime(t)})})},o.prototype._disable=function(e){this.five.scene.remove(this.group),this.panoMesh.setOpacity(0),this.startTime=void 0,this.stop(),this.five.needsRender=!0},o.prototype.enable=function(e){var n;if(this.ctx&&!this.state.enabled&&this.five.observers[this.five.state.panoIndex]){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!0},t),this._enable({userAction:t})}},o.prototype.disable=function(e){var n;if(this.state.enabled!==!1){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!1},t),this._disable({userAction:t})}},o.prototype.setState=function(e,n){n===void 0&&(n={});var t=this.state,a=n.userAction!==void 0?n.userAction:!0;if(this.updateState(e,a),e.enabled!==void 0&&t.enabled!==e.enabled){var s={userAction:a};e.enabled?this._enable(s):this._disable(s)}},o})(lt.BasePlugin.Controller),An=function(f,o){return new En(f,o)},mt=(function(f){de(o,f);function o(){var e=f.call(this)||this;e.type="LineSegmentsGeometry";var n=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],a=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];return e.setIndex(a),e.setAttribute("position",new v.Float32BufferAttribute(n,3)),e.setAttribute("uv",new v.Float32BufferAttribute(t,2)),e}return o.prototype.applyMatrix4=function(e){var n=this.attributes.instanceStart,t=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),t.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},o.prototype.setPositions=function(e){var n;e instanceof Float32Array?n=e:Array.isArray(e)?n=new Float32Array(e):n=new Float32Array;var t=new v.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceStart",new v.InterleavedBufferAttribute(t,3,0)),this.setAttribute("instanceEnd",new v.InterleavedBufferAttribute(t,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},o.prototype.setColors=function(e){var n;e instanceof Float32Array?n=e:Array.isArray(e)?n=new Float32Array(e):n=new Float32Array;var t=new v.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceColorStart",new v.InterleavedBufferAttribute(t,3,0)),this.setAttribute("instanceColorEnd",new v.InterleavedBufferAttribute(t,3,3)),this},o.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},o.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},o.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new v.WireframeGeometry(e.geometry)),this},o.prototype.fromLineSegments=function(e){var n=e.geometry;if(n instanceof v.Geometry){var t=new v.BufferGeometry().fromGeometry(n);this.setPositions(t.attributes.position.array)}else n instanceof v.BufferGeometry&&this.setPositions(n.attributes.position.array);return this},o.prototype.computeBoundingBox=function(){this.boundingBox===null&&(this.boundingBox=new v.Box3);var e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){var t=new v.Box3;this.boundingBox.setFromBufferAttribute(e),t.setFromBufferAttribute(n),this.boundingBox.union(t)}},o.prototype.computeBoundingSphere=function(){this.boundingSphere===null&&(this.boundingSphere=new v.Sphere),this.boundingBox===null&&this.computeBoundingBox();var e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){var t=this.boundingSphere.center;this.boundingBox.getCenter(t);for(var a=0,s=new v.Vector3,l=0,h=e.count;l<h;l++)s.fromBufferAttribute(e,l),a=Math.max(a,t.distanceToSquared(s)),s.fromBufferAttribute(n,l),a=Math.max(a,t.distanceToSquared(s));this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},o.prototype.toJSON=function(){},o})(v.InstancedBufferGeometry);Object.assign(mt.prototype,{isLineSegmentsGeometry:!0});var gt={uniforms:v.UniformsUtils.merge([v.UniformsLib.common,v.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new v.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1},totalLength:{value:1},animationProgress:{value:0},time:{value:0},waveAmp:{value:.15},waveFreq:{value:5},waveDir:{value:2},startOffset:{value:0},endOffset:{value:0},range:{value:.3}}]),vertexShader:`
|
|
535
535
|
#include <common>
|
|
536
536
|
#include <color_pars_vertex>
|
|
537
537
|
#include <fog_pars_vertex>
|
|
@@ -546,6 +546,7 @@ void main() {
|
|
|
546
546
|
uniform float waveFreq;
|
|
547
547
|
uniform float waveDir;
|
|
548
548
|
uniform float startOffset;
|
|
549
|
+
uniform float endOffset; // 新增
|
|
549
550
|
|
|
550
551
|
attribute vec3 instanceStart;
|
|
551
552
|
attribute vec3 instanceEnd;
|
|
@@ -591,7 +592,8 @@ void main() {
|
|
|
591
592
|
if (waveDir > 0.5) { // 0 表示不波动
|
|
592
593
|
float adjustedDistanceStart = max(0.0, instanceDistanceStart - startOffset);
|
|
593
594
|
float adjustedDistanceEnd = max(0.0, instanceDistanceEnd - startOffset);
|
|
594
|
-
float adjustedTotalLength =
|
|
595
|
+
float adjustedTotalLength = totalLength - startOffset - endOffset;
|
|
596
|
+
adjustedTotalLength = max(0.01, adjustedTotalLength);
|
|
595
597
|
float phaseStart = adjustedDistanceStart / adjustedTotalLength;
|
|
596
598
|
float phaseEnd = adjustedDistanceEnd / adjustedTotalLength;
|
|
597
599
|
float waveStart = sin(phaseStart * waveFreq - time * 2.0) * waveAmp;
|
|
@@ -646,11 +648,12 @@ void main() {
|
|
|
646
648
|
vec4 clip = (position.y < 0.5) ? clipStart : clipEnd;
|
|
647
649
|
offset *= clip.w;
|
|
648
650
|
clip.xy += offset;
|
|
649
|
-
|
|
651
|
+
|
|
650
652
|
gl_Position = clip;
|
|
651
653
|
|
|
652
654
|
float adjustedDistanceEnd = max(0.0, instanceDistanceEnd - startOffset);
|
|
653
|
-
float adjustedTotalLength =
|
|
655
|
+
float adjustedTotalLength = totalLength - startOffset - endOffset;
|
|
656
|
+
adjustedTotalLength = max(0.01, adjustedTotalLength);
|
|
654
657
|
vDistanceProgress = adjustedDistanceEnd / adjustedTotalLength;
|
|
655
658
|
|
|
656
659
|
#include <logdepthbuf_vertex>
|
|
@@ -661,6 +664,7 @@ void main() {
|
|
|
661
664
|
uniform vec3 diffuse;
|
|
662
665
|
uniform float opacity;
|
|
663
666
|
uniform float animationProgress;
|
|
667
|
+
uniform float range;
|
|
664
668
|
varying float vDistanceProgress;
|
|
665
669
|
|
|
666
670
|
#ifdef USE_DASH
|
|
@@ -697,24 +701,37 @@ void main() {
|
|
|
697
701
|
|
|
698
702
|
gl_FragColor = vec4(diffuseColor.rgb, diffuseColor.a);
|
|
699
703
|
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
diff = min(diff, 1.0 - diff);
|
|
704
|
-
if (diff < range) {
|
|
705
|
-
alpha = 1.0 - diff / range;
|
|
704
|
+
// 裁剪超出终点的部分
|
|
705
|
+
if (vDistanceProgress > 1.0) {
|
|
706
|
+
discard;
|
|
706
707
|
}
|
|
707
|
-
|
|
708
|
-
|
|
708
|
+
|
|
709
|
+
float alpha = 0.0;
|
|
710
|
+
float diff = (1.0 - 2.0 * range) * vDistanceProgress + range - animationProgress;
|
|
711
|
+
// 使用绝对值计算,在animationProgress前后range范围内过渡
|
|
712
|
+
if (abs(diff) < range) {
|
|
713
|
+
alpha = 1.0 - abs(diff) / range;
|
|
714
|
+
} else {
|
|
715
|
+
alpha = 0.0;
|
|
709
716
|
}
|
|
717
|
+
|
|
710
718
|
alpha = clamp(alpha, 0.0, 1.0);
|
|
711
719
|
gl_FragColor.a = alpha;
|
|
712
720
|
|
|
721
|
+
//增加开头和结尾的渐变alpha遮罩,长度为0.1
|
|
722
|
+
float startFadeLength = 0.05;
|
|
723
|
+
if (vDistanceProgress < startFadeLength) {
|
|
724
|
+
gl_FragColor.a *= vDistanceProgress / startFadeLength;
|
|
725
|
+
}
|
|
726
|
+
float endFadeStart = 1.0 - startFadeLength;
|
|
727
|
+
if (vDistanceProgress > endFadeStart) {
|
|
728
|
+
gl_FragColor.a *= (1.0 - vDistanceProgress) / startFadeLength;
|
|
729
|
+
}
|
|
713
730
|
#include <tonemapping_fragment>
|
|
714
731
|
#include <fog_fragment>
|
|
715
732
|
#include <premultiplied_alpha_fragment>
|
|
716
733
|
}
|
|
717
|
-
`},yt=(function(c){de(a,c);function a(e){var n=c.call(this,{uniforms:p.UniformsUtils.clone(gt.uniforms),vertexShader:gt.vertexShader,fragmentShader:gt.fragmentShader,clipping:!0})||this;return n.type="LineMaterial",n.dashed=!1,Object.defineProperties(n,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(t){this.uniforms.time.value=t}},waveAmp:{enumerable:!0,get:function(){return this.uniforms.waveAmp.value},set:function(t){this.uniforms.waveAmp.value=t}},waveFreq:{enumerable:!0,get:function(){return this.uniforms.waveFreq.value},set:function(t){this.uniforms.waveFreq.value=t}},waveDir:{enumerable:!0,get:function(){return this.uniforms.waveDir.value},set:function(t){this.uniforms.waveDir.value=t}},startOffset:{enumerable:!0,get:function(){return this.uniforms.startOffset.value},set:function(t){this.uniforms.startOffset.value=t}}}),n.setValues(e),n}return a})(p.ShaderMaterial);Object.assign(yt.prototype,{isLineMaterial:!0});var Dt=(function(c){de(a,c);function a(e,n){var t=c.call(this)||this;return t.type="LineSegments2",t.geometry=e!==void 0?e:new mt,t.material=n!==void 0?n:new yt({color:Math.random()*16777215}),t}return a.prototype.computeLineDistances=function(){for(var e=this.geometry,n=e.attributes.instanceStart,t=e.attributes.instanceEnd,o=new Float32Array(2*n.count),s=new p.Vector3,l=new p.Vector3,h=0,f=0,g=n.count;f<g;f++)s.fromBufferAttribute(n,f),l.fromBufferAttribute(t,f),h+=s.distanceTo(l);this.material.uniforms.totalLength.value=h;for(var f=0,y=0,g=n.count;f<g;f++,y+=2){s.fromBufferAttribute(n,f),l.fromBufferAttribute(t,f);var w=s.distanceTo(l);o[y]=y===0?0:o[y-1],o[y+1]=o[y]+w}var x=new p.InstancedInterleavedBuffer(o,2,1);return e.setAttribute("instanceDistanceStart",new p.InterleavedBufferAttribute(x,1,0)),e.setAttribute("instanceDistanceEnd",new p.InterleavedBufferAttribute(x,1,1)),this},a.prototype.raycast=function(e,n){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var t=e.ray,o=e.camera,s=o.projectionMatrix,l=this.geometry,h=this.material,f=h.resolution,g=h.linewidth,y=l.attributes.instanceStart,w=l.attributes.instanceEnd,x=new p.Vector4,S=new p.Vector4,E=new p.Vector4,C=new p.Vector3,P=new p.Matrix4,b=new p.Line3,A=new p.Vector3;t.at(1,E),E.w=1,E.applyMatrix4(o.matrixWorldInverse),E.applyMatrix4(s),E.multiplyScalar(1/E.w),E.x*=f.x/2,E.y*=f.y/2,E.z=0,C.copy(E);var m=this.matrixWorld;P.multiplyMatrices(o.matrixWorldInverse,m);for(var O=0,_=y.count;O<_;O++){x.fromBufferAttribute(y,O),S.fromBufferAttribute(w,O),x.w=1,S.w=1,x.applyMatrix4(P),S.applyMatrix4(P),x.applyMatrix4(s),S.applyMatrix4(s),x.multiplyScalar(1/x.w),S.multiplyScalar(1/S.w);var X=x.z<-1&&S.z<-1,Y=x.z>1&&S.z>1;if(!(X||Y)){x.x*=f.x/2,x.y*=f.y/2,S.x*=f.x/2,S.y*=f.y/2,b.start.copy(x),b.start.z=0,b.end.copy(S),b.end.z=0;var z=b.closestPointToPointParameter(C,!0);b.at(z,A);var $=p.MathUtils.lerp(x.z,S.z,z),le=$>=-1&&$<=1,ce=C.distanceTo(A)<g*.5;if(le&&ce){b.start.fromBufferAttribute(y,O),b.end.fromBufferAttribute(w,O),b.start.applyMatrix4(m),b.end.applyMatrix4(m);var ee=new p.Vector3,J=new p.Vector3;t.distanceSqToSegment(b.start,b.end,J,ee),n.push({point:J,pointOnLine:ee,distance:t.origin.distanceTo(J),object:this,faceIndex:O})}}}},a})(p.Mesh);Object.assign(Dt.prototype,{isLineSegments2:!0});var Ft=(function(c){de(a,c);function a(e,n){var t=c.call(this,e,n)||this;return t.type="Line2",t}return a})(Dt);Object.assign(Ft.prototype,{isLine2:!0});var Bt=(function(c){de(a,c);function a(){var e=c.call(this)||this;return e.type="LineGeometry",e}return a.prototype.setPositions=function(e){for(var n=e.length-3,t=new Float32Array(2*n),o=0;o<n;o+=3)t[2*o]=e[o],t[2*o+1]=e[o+1],t[2*o+2]=e[o+2],t[2*o+3]=e[o+3],t[2*o+4]=e[o+4],t[2*o+5]=e[o+5];return c.prototype.setPositions.call(this,t),this},a.prototype.setColors=function(e){for(var n=e.length-3,t=new Float32Array(2*n),o=0;o<n;o+=3)t[2*o]=e[o],t[2*o+1]=e[o+1],t[2*o+2]=e[o+2],t[2*o+3]=e[o+3],t[2*o+4]=e[o+4],t[2*o+5]=e[o+5];return c.prototype.setColors.call(this,t),this},a.prototype.fromLine=function(e){var n=e.geometry;if(n instanceof p.Geometry){var t=new p.BufferGeometry().fromGeometry(n);this.setPositions(t.attributes.position.array)}else n instanceof p.BufferGeometry&&this.setPositions(n.attributes.position.array);return this},a.prototype.copy=function(){return this},a})(mt);Object.assign(Bt.prototype,{isLineGeometry:!0});var En=(function(c){de(a,c);function a(e,n){var t=c.call(this,e)||this;t.paths=new Map,t.animationId=null,t.up=new p.Vector3(0,1,0);var o={enabled:!0,visible:!0,playing:!1};t.state=Object.assign(o,n==null?void 0:n.initialState);var s={lineCount:6,spacing:.02,divisions:100,lineWidth:2,color:16777215,duration:3,waveAmp:.05,waveFreq:20,particleCount:50,maxDistance:.1};return t._config=V(V({},s),n==null?void 0:n.config),n!=null&&n.paths&&n.paths.length>0&&n.paths.forEach(function(l){t.addPath(l)}),t.state.enabled&&t._enable({userAction:!1}),t}return Object.defineProperty(a.prototype,"config",{get:function(){return V({},this._config)},enumerable:!1,configurable:!0}),a.prototype.updateState=function(e,n){var t=this.state;this.state=V(V({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},a.prototype.load=function(e,n){return _e(this,void 0,void 0,function(){var t,o=this;return Oe(this,function(s){return this.clearAllPaths(),e.paths.forEach(function(l){var h,f,g=l.points.map(function(y){return new p.Vector3(y.x,y.y,y.z)});o.addPath({id:l.id,points:g,enabled:(h=l.enabled)!==null&&h!==void 0?h:!0,visible:(f=l.visible)!==null&&f!==void 0?f:!0,color:l.color,lineWidth:l.lineWidth})}),t=new Map,this.paths.forEach(function(l,h){t.set(h,l.config)}),this.data={paths:t},this.hooks.emit("dataLoaded",this.data),n&&this.setState(n),[2]})})},a.prototype.addPath=function(e){var n,t;if(e.points.length<2)return console.warn("DynamicPathLinePlugin: 路径 ".concat(e.id," 至少需要2个点")),!1;if(this.paths.has(e.id))return console.warn("DynamicPathLinePlugin: 路径 ".concat(e.id," 已存在")),!1;var o=new p.CatmullRomCurve3(e.points),s=this.createLines(e,o),l=this.createParticles(),h=l.particles,f=l.particleGeometry,g=l.particleMaterial,y=l.particleInfos,w=l.particlePositions,x={id:e.id,config:e,curve:o,lines:s,particles:h,particleGeometry:f,particleMaterial:g,particleInfos:y,particlePositions:w,enabled:(n=e.enabled)!==null&&n!==void 0?n:!0,visible:(t=e.visible)!==null&&t!==void 0?t:!0,startOffset:0};this.paths.set(e.id,x);var S=this.data,E=new Map;return this.paths.forEach(function(C,P){E.set(P,C.config)}),this.data={paths:E},this.hooks.emit("dataChange",this.data,S),this.hooks.emit("pathAdd",e.id,e),this.state.playing&&this.animationId===null&&this.startAnimation(),!0},a.prototype.removePath=function(e){var n=this.paths.get(e);if(!n)return console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1;this.disposePathResources(n),this.paths.delete(e);var t=this.data,o=new Map;return this.paths.forEach(function(s,l){o.set(l,s.config)}),this.data={paths:o},this.hooks.emit("dataChange",this.data,t),this.hooks.emit("pathRemove",e),!0},a.prototype.enablePath=function(e){var n=this.paths.get(e);return n?(n.enabled=!0,this.hooks.emit("pathEnable",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},a.prototype.disablePath=function(e){var n=this.paths.get(e);return n?(n.enabled=!1,this.hooks.emit("pathDisable",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},a.prototype.showPath=function(e){var n=this.paths.get(e);return n?(n.visible=!0,n.lines.forEach(function(t){return t.visible=!0}),n.particles.visible=!0,this.hooks.emit("pathShow",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},a.prototype.hidePath=function(e){var n=this.paths.get(e);return n?(n.visible=!1,n.lines.forEach(function(t){return t.visible=!1}),n.particles.visible=!1,this.hooks.emit("pathHide",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},a.prototype.getPathIds=function(){return Array.from(this.paths.keys())},a.prototype.getPathConfig=function(e){var n=this.paths.get(e);return n?V({},n.config):void 0},a.prototype.clearAllPaths=function(){var e=this;this.paths.forEach(function(o){e.disposePathResources(o)}),this.paths.clear();var n=this.data,t=new Map;this.paths.forEach(function(o,s){t.set(s,o.config)}),this.data={paths:t},this.hooks.emit("dataChange",this.data,n)},a.prototype.getPositions=function(e,n){for(var t=[],o=[],s=0,l=[],h=0;h<=n;h++){var f=h/n,g=e.getPoint(f);l.push(g.clone()),h>0&&(s+=g.distanceTo(l[h-1]))}for(var y=0,h=0;h<n;h++){h>0&&(y+=l[h].distanceTo(l[h-1]));var w=y/s;t.push(l[h].x,l[h].y,l[h].z),o.push(w)}return{positions:t,distanceProgress:o}},a.prototype.createLines=function(e,n){for(var t=this,o,s,l=[],h=this._config,f=h.lineCount,g=h.spacing,y=h.divisions,w=h.waveAmp,x=h.waveFreq,S=(o=e.lineWidth)!==null&&o!==void 0?o:this._config.lineWidth,E=(s=e.color)!==null&&s!==void 0?s:this._config.color,C=function(A){var m=(A-(f-1)/2)*g,O=e.points.map(function(le,ce){var ee=ce/(e.points.length-1),J=n.getTangent(ee).normalize(),F=new p.Vector3().crossVectors(t.up,J).normalize(),N=m*Math.abs((ce-e.points.length/2)/e.points.length-.5)*-1;return le.clone().addScaledVector(F,m+N).add(new p.Vector3(0,.02*(A%2===0?1:0),0))}),_=new p.CatmullRomCurve3(O),X=P.getPositions(_,y).positions,Y=new Bt;Y.setPositions(X);var z=new yt({color:E,linewidth:S*(A%2===0?1:.5),transparent:!0,opacity:1});z.resolution.set(P.five.camera.resolution.x,P.five.camera.resolution.y),A===0?z.waveDir=1:A===1?z.waveDir=2:A===2?z.waveDir=0:A===3?z.waveDir=3:A===4&&(z.waveDir=1),z.waveAmp=w,z.waveFreq=x,Object.assign(z.uniforms,{time:{value:0},startOffset:{value:0}});var $=new Ft(Y,z);$.computeLineDistances(),l.push($),P.five.scene.add($)},P=this,b=0;b<f;b++)C(b);return l},a.prototype.createParticleMaterial=function(){return new p.ShaderMaterial({transparent:!0,blending:p.AdditiveBlending,depthWrite:!1,uniforms:{pointTexture:{value:new p.TextureLoader().load("https://threejs.org/examples/textures/sprites/circle.png")}},vertexShader:`
|
|
734
|
+
`},yt=(function(f){de(o,f);function o(e){var n=f.call(this,{uniforms:v.UniformsUtils.clone(gt.uniforms),vertexShader:gt.vertexShader,fragmentShader:gt.fragmentShader,clipping:!0})||this;return n.type="LineMaterial",n.dashed=!1,Object.defineProperties(n,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(t){this.uniforms.time.value=t}},waveAmp:{enumerable:!0,get:function(){return this.uniforms.waveAmp.value},set:function(t){this.uniforms.waveAmp.value=t}},waveFreq:{enumerable:!0,get:function(){return this.uniforms.waveFreq.value},set:function(t){this.uniforms.waveFreq.value=t}},waveDir:{enumerable:!0,get:function(){return this.uniforms.waveDir.value},set:function(t){this.uniforms.waveDir.value=t}},startOffset:{enumerable:!0,get:function(){return this.uniforms.startOffset.value},set:function(t){this.uniforms.startOffset.value=t}},endOffset:{enumerable:!0,get:function(){return this.uniforms.endOffset.value},set:function(t){this.uniforms.endOffset.value=t}},range:{enumerable:!0,get:function(){return this.uniforms.range.value},set:function(t){this.uniforms.range.value=t}},animationProgress:{enumerable:!0,get:function(){return this.uniforms.animationProgress.value},set:function(t){this.uniforms.animationProgress.value=t}}}),n.setValues(e),n}return o})(v.ShaderMaterial);Object.assign(yt.prototype,{isLineMaterial:!0});var Nt=(function(f){de(o,f);function o(e,n){var t=f.call(this)||this;return t.type="LineSegments2",t.geometry=e!==void 0?e:new mt,t.material=n!==void 0?n:new yt({color:Math.random()*16777215}),t}return o.prototype.computeLineDistances=function(){for(var e=this.geometry,n=e.attributes.instanceStart,t=e.attributes.instanceEnd,a=new Float32Array(2*n.count),s=new v.Vector3,l=new v.Vector3,h=0,c=0,g=n.count;c<g;c++)s.fromBufferAttribute(n,c),l.fromBufferAttribute(t,c),h+=s.distanceTo(l);this.material.uniforms.totalLength.value=h;for(var c=0,w=0,g=n.count;c<g;c++,w+=2){s.fromBufferAttribute(n,c),l.fromBufferAttribute(t,c);var M=s.distanceTo(l);a[w]=w===0?0:a[w-1],a[w+1]=a[w]+M}var T=new v.InstancedInterleavedBuffer(a,2,1);return e.setAttribute("instanceDistanceStart",new v.InterleavedBufferAttribute(T,1,0)),e.setAttribute("instanceDistanceEnd",new v.InterleavedBufferAttribute(T,1,1)),this},o.prototype.raycast=function(e,n){e.camera===null&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var t=e.ray,a=e.camera,s=a.projectionMatrix,l=this.geometry,h=this.material,c=h.resolution,g=h.linewidth,w=l.attributes.instanceStart,M=l.attributes.instanceEnd,T=new v.Vector4,E=new v.Vector4,S=new v.Vector4,C=new v.Vector3,b=new v.Matrix4,y=new v.Line3,A=new v.Vector3;t.at(1,S),S.w=1,S.applyMatrix4(a.matrixWorldInverse),S.applyMatrix4(s),S.multiplyScalar(1/S.w),S.x*=c.x/2,S.y*=c.y/2,S.z=0,C.copy(S);var m=this.matrixWorld;b.multiplyMatrices(a.matrixWorldInverse,m);for(var O=0,x=w.count;O<x;O++){T.fromBufferAttribute(w,O),E.fromBufferAttribute(M,O),T.w=1,E.w=1,T.applyMatrix4(b),E.applyMatrix4(b),T.applyMatrix4(s),E.applyMatrix4(s),T.multiplyScalar(1/T.w),E.multiplyScalar(1/E.w);var j=T.z<-1&&E.z<-1,z=T.z>1&&E.z>1;if(!(j||z)){T.x*=c.x/2,T.y*=c.y/2,E.x*=c.x/2,E.y*=c.y/2,y.start.copy(T),y.start.z=0,y.end.copy(E),y.end.z=0;var H=y.closestPointToPointParameter(C,!0);y.at(H,A);var Q=v.MathUtils.lerp(T.z,E.z,H),q=Q>=-1&&Q<=1,le=C.distanceTo(A)<g*.5;if(q&&le){y.start.fromBufferAttribute(w,O),y.end.fromBufferAttribute(M,O),y.start.applyMatrix4(m),y.end.applyMatrix4(m);var X=new v.Vector3,K=new v.Vector3;t.distanceSqToSegment(y.start,y.end,K,X),n.push({point:K,pointOnLine:X,distance:t.origin.distanceTo(K),object:this,faceIndex:O})}}}},o})(v.Mesh);Object.assign(Nt.prototype,{isLineSegments2:!0});var kt=(function(f){de(o,f);function o(e,n){var t=f.call(this,e,n)||this;return t.type="Line2",t}return o})(Nt);Object.assign(kt.prototype,{isLine2:!0});var Bt=(function(f){de(o,f);function o(){var e=f.call(this)||this;return e.type="LineGeometry",e}return o.prototype.setPositions=function(e){for(var n=e.length-3,t=new Float32Array(2*n),a=0;a<n;a+=3)t[2*a]=e[a],t[2*a+1]=e[a+1],t[2*a+2]=e[a+2],t[2*a+3]=e[a+3],t[2*a+4]=e[a+4],t[2*a+5]=e[a+5];return f.prototype.setPositions.call(this,t),this},o.prototype.setColors=function(e){for(var n=e.length-3,t=new Float32Array(2*n),a=0;a<n;a+=3)t[2*a]=e[a],t[2*a+1]=e[a+1],t[2*a+2]=e[a+2],t[2*a+3]=e[a+3],t[2*a+4]=e[a+4],t[2*a+5]=e[a+5];return f.prototype.setColors.call(this,t),this},o.prototype.fromLine=function(e){var n=e.geometry;if(n instanceof v.Geometry){var t=new v.BufferGeometry().fromGeometry(n);this.setPositions(t.attributes.position.array)}else n instanceof v.BufferGeometry&&this.setPositions(n.attributes.position.array);return this},o.prototype.copy=function(){return this},o})(mt);Object.assign(Bt.prototype,{isLineGeometry:!0});var Sn=(function(f){de(o,f);function o(e,n){var t=f.call(this,e)||this;t.paths=new Map,t.up=new v.Vector3(0,1,0);var a={enabled:!0,visible:!0,playing:!1};t.state=Object.assign(a,n==null?void 0:n.initialState);var s={lineCount:6,spacing:.02,divisions:100,lineWidth:2,color:16777215,speed:3,range:.3,waveAmp:.05,waveFreq:20,particleCount:50,maxDistance:.1,lineYOffset:.1,subMeshWidth:.3,subMeshColor:65535,subMeshOpacity:.3};return t._config=V(V({},s),n==null?void 0:n.config),n!=null&&n.paths&&n.paths.length>0&&n.paths.forEach(function(l){t.addPath(l)}),t.state.enabled&&t._enable({userAction:!1}),t}return Object.defineProperty(o.prototype,"config",{get:function(){return V({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(e,n){var t=this.state;this.state=V(V({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},o.prototype.load=function(e,n){return Oe(this,void 0,void 0,function(){var t,a=this;return _e(this,function(s){return this.clearAllPaths(),e.paths.forEach(function(l){var h,c,g=l.points.map(function(w){return new v.Vector3(w.x,w.y,w.z)});a.addPath({id:l.id,points:g,enabled:(h=l.enabled)!==null&&h!==void 0?h:!0,visible:(c=l.visible)!==null&&c!==void 0?c:!0,color:l.color,lineWidth:l.lineWidth})}),t=new Map,this.paths.forEach(function(l,h){t.set(h,l.config)}),this.data={paths:t},this.hooks.emit("dataLoaded",this.data),n&&this.setState(n),[2]})})},o.prototype.addPath=function(e){var n,t,a,s,l,h;if(e.points.length<2)return console.warn("DynamicPathLinePlugin: 路径 ".concat(e.id," 至少需要2个点")),!1;if(this.paths.has(e.id))return console.warn("DynamicPathLinePlugin: 路径 ".concat(e.id," 已存在")),!1;var c=new v.CatmullRomCurve3(e.points),g=this.createLines(e,c),w=this.createParticles(),M=w.particles,T=w.particleGeometry,E=w.particleMaterial,S=w.particleInfos,C=w.particlePositions,b=(n=e.subMeshColor)!==null&&n!==void 0?n:this._config.subMeshColor,y=(t=e.subMeshWidth)!==null&&t!==void 0?t:this._config.subMeshWidth,A=(a=e.subMeshOpacity)!==null&&a!==void 0?a:this._config.subMeshOpacity,m=(s=e.enableSubMesh)!==null&&s!==void 0?s:!0,O=this.createSubMeshGeometry(e,c,y),x=this.createSubMeshMaterial(b,A),j=c.getLength();x.uniforms.totalLength.value=j;var z=new v.Mesh(O,x);z.visible=m,this.five.scene.add(z);var H={id:e.id,config:e,curve:c,lines:g,particles:M,particleGeometry:T,particleMaterial:E,particleInfos:S,particlePositions:C,enabled:(l=e.enabled)!==null&&l!==void 0?l:!0,visible:(h=e.visible)!==null&&h!==void 0?h:!0,startOffset:0,endOffset:0,lastAnimationProgress:0,cycleStartTime:performance.now()/1e3,isInitialAnimation:!0,subMeshUnfoldProgress:0,subMeshUnfoldStarted:!1,lastUpdateTime:performance.now()/1e3,subMesh:z,subMeshGeometry:O,subMeshMaterial:x,subMeshColor:b,subMeshWidth:y,subMeshOpacity:A,animationId:null,enableSubMesh:m};this.paths.set(e.id,H);var Q=this.data,q=new Map;return this.paths.forEach(function(le,X){q.set(X,le.config)}),this.data={paths:q},this.hooks.emit("dataChange",this.data,Q),this.hooks.emit("pathAdd",e.id,e),this.state.playing&&this.startPathAnimation(e.id),!0},o.prototype.removePath=function(e){var n=this.paths.get(e);if(!n)return console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1;this.stopPathAnimation(e),this.disposePathResources(n),this.paths.delete(e);var t=this.data,a=new Map;return this.paths.forEach(function(s,l){a.set(l,s.config)}),this.data={paths:a},this.hooks.emit("dataChange",this.data,t),this.hooks.emit("pathRemove",e),!0},o.prototype.enablePath=function(e){var n=this.paths.get(e);return n?(n.enabled=!0,this.hooks.emit("pathEnable",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},o.prototype.disablePath=function(e){var n=this.paths.get(e);return n?(n.enabled=!1,this.hooks.emit("pathDisable",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},o.prototype.showPath=function(e){var n=this.paths.get(e);return n?(n.visible=!0,n.lines.forEach(function(t){return t.visible=!0}),n.particles.visible=!0,n.subMesh.visible=!0,this.hooks.emit("pathShow",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},o.prototype.hidePath=function(e){var n=this.paths.get(e);return n?(n.visible=!1,n.lines.forEach(function(t){return t.visible=!1}),n.particles.visible=!1,n.subMesh.visible=!1,this.hooks.emit("pathHide",e),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},o.prototype.getPathIds=function(){return Array.from(this.paths.keys())},o.prototype.getPathConfig=function(e){var n=this.paths.get(e);return n?V({},n.config):void 0},o.prototype.clearAllPaths=function(){var e=this;this.paths.forEach(function(a,s){e.stopPathAnimation(s),e.disposePathResources(a)}),this.paths.clear();var n=this.data,t=new Map;this.paths.forEach(function(a,s){t.set(s,a.config)}),this.data={paths:t},this.hooks.emit("dataChange",this.data,n)},o.prototype.getPositions=function(e,n){for(var t=[],a=[],s=0,l=[],h=0;h<=n;h++){var c=h/n,g=e.getPoint(c);l.push(g.clone()),h>0&&(s+=g.distanceTo(l[h-1]))}for(var w=0,h=0;h<n;h++){h>0&&(w+=l[h].distanceTo(l[h-1]));var M=w/s;t.push(l[h].x,l[h].y,l[h].z),a.push(M)}return{positions:t,distanceProgress:a}},o.prototype.createLines=function(e,n){for(var t=this,a,s,l=[],h=this._config,c=h.lineCount,g=h.spacing,w=h.divisions,M=h.waveAmp,T=h.waveFreq,E=h.range,S=h.lineYOffset,C=(a=e.lineWidth)!==null&&a!==void 0?a:this._config.lineWidth,b=(s=e.color)!==null&&s!==void 0?s:this._config.color,y=function(O){var x=(O-(c-1)/2)*g,j=e.points.map(function(X,K){var D=K/(e.points.length-1),I=n.getTangent(D).normalize(),L=new v.Vector3().crossVectors(t.up,I).normalize(),N=x*Math.abs((K-e.points.length/2)/e.points.length-.5)*-1;return X.clone().addScaledVector(L,x+N).add(new v.Vector3(0,S+.02*(O%2===0?1:0),0))}),z=new v.CatmullRomCurve3(j),H=A.getPositions(z,w).positions,Q=new Bt;Q.setPositions(H);var q=new yt({color:b,linewidth:C*(O%2===0?1:.5),transparent:!0,opacity:1,depthWrite:!1});q.resolution.set(A.five.camera.resolution.x,A.five.camera.resolution.y),O===0?q.waveDir=1:O===1?q.waveDir=2:O===2?q.waveDir=0:O===3?q.waveDir=3:O===4&&(q.waveDir=1),q.waveAmp=M,q.waveFreq=T,Object.assign(q.uniforms,{time:{value:0},startOffset:{value:0},range:{value:E}});var le=new kt(Q,q);le.computeLineDistances(),l.push(le),A.five.scene.add(le)},A=this,m=0;m<c;m++)y(m);return l},o.prototype.createParticleMaterial=function(){return new v.ShaderMaterial({transparent:!0,blending:v.AdditiveBlending,depthWrite:!1,uniforms:{pointTexture:{value:new v.TextureLoader().load("https://threejs.org/examples/textures/sprites/circle.png")}},vertexShader:`
|
|
718
735
|
attribute float size;
|
|
719
736
|
varying vec2 vUv;
|
|
720
737
|
void main() {
|
|
@@ -729,4 +746,72 @@ void main() {
|
|
|
729
746
|
gl_FragColor = texture2D(pointTexture, gl_PointCoord);
|
|
730
747
|
gl_FragColor.a *= 0.15;
|
|
731
748
|
}
|
|
732
|
-
`})},
|
|
749
|
+
`})},o.prototype.createParticles=function(){for(var e=this._config.particleCount,n=new Float32Array(e*3),t=new v.BufferGeometry,a=this.createParticleMaterial(),s=new v.Points(t,a),l=new Float32Array(e),h=[],c=0;c<e;c++)n[c*3]=9999,n[c*3+1]=9999,n[c*3+2]=9999,l[c]=v.MathUtils.randFloat(3,9),h.push({velocity:new v.Vector3,life:3+Math.random()*2,age:0,active:!1,alpha:0,startPos:new v.Vector3});return t.setAttribute("position",new v.BufferAttribute(n,3)),t.setAttribute("size",new v.BufferAttribute(l,1)),s.frustumCulled=!1,this.five.scene.add(s),{particles:s,particleGeometry:t,particleMaterial:a,particleInfos:h,particlePositions:n}},o.prototype.createSubMeshGeometry=function(e,n,t){for(var a=this._config.divisions,s=new v.BufferGeometry,l=n.getPoints(a),h=[],c=[],g=[],w=[],M=0,T=[0],E=1;E<l.length;E++)M+=l[E].distanceTo(l[E-1]),T.push(M);for(var S=M,E=0;E<l.length;E++){var C=l[E],b=E/(l.length-1),y=n.getTangent(b).normalize(),A=new v.Vector3().crossVectors(this.up,y).normalize(),m=t/2,O=C.clone().addScaledVector(A,-m);h.push(O.x,O.y,O.z),c.push(0,T[E]/S),w.push(T[E]/S);var x=C.clone().addScaledVector(A,m);h.push(x.x,x.y,x.z),c.push(1,T[E]/S),w.push(T[E]/S)}for(var E=0;E<l.length-1;E++){var j=E*2;g.push(j,j+1,j+2),g.push(j+1,j+3,j+2)}return s.setAttribute("position",new v.Float32BufferAttribute(h,3)),s.setAttribute("uv",new v.Float32BufferAttribute(c,2)),s.setAttribute("distanceProgress",new v.Float32BufferAttribute(w,1)),s.setIndex(g),s.computeVertexNormals(),s},o.prototype.createAlphaMapTexture=function(e,n,t){for(var a=256,s=1,l=a*s,h=new Uint8Array(l),c=1/e,g=n/2,w=0;w<a;w++){var M=w/a,T=Math.floor(M/c),E=(M-T*c)/c,S=0,C=E;if(C>.5&&(C=1-C),C<g){var b=1-C/g,y=b*b*b;S=t+(1-t)*y}else S=t;h[w]=Math.floor(S*255)}var A=new v.DataTexture(h,a,s,v.RedFormat);return A.needsUpdate=!0,A.wrapS=v.RepeatWrapping,A.wrapT=v.ClampToEdgeWrapping,A.minFilter=v.LinearFilter,A.magFilter=v.LinearFilter,A},o.prototype.createSubMeshMaterial=function(e,n){var t=this._config.range,a=this.createAlphaMapTexture(3,1,n);return new v.ShaderMaterial({transparent:!0,side:v.BackSide,depthWrite:!1,uniforms:{baseColor:{value:new v.Color(e)},baseOpacity:{value:n},animationProgress:{value:0},range:{value:t},startOffset:{value:0},endOffset:{value:0},totalLength:{value:1},unfoldProgress:{value:0},alphaMap:{value:a}},vertexShader:`
|
|
750
|
+
attribute float distanceProgress;
|
|
751
|
+
varying vec2 vUv;
|
|
752
|
+
varying float vDistanceProgress;
|
|
753
|
+
|
|
754
|
+
void main() {
|
|
755
|
+
vUv = uv;
|
|
756
|
+
vDistanceProgress = distanceProgress;
|
|
757
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
758
|
+
}
|
|
759
|
+
`,fragmentShader:`
|
|
760
|
+
uniform vec3 baseColor;
|
|
761
|
+
uniform float baseOpacity;
|
|
762
|
+
uniform float animationProgress;
|
|
763
|
+
uniform float range;
|
|
764
|
+
uniform float startOffset;
|
|
765
|
+
uniform float endOffset;
|
|
766
|
+
uniform float totalLength;
|
|
767
|
+
uniform float unfoldProgress;
|
|
768
|
+
uniform sampler2D alphaMap;
|
|
769
|
+
|
|
770
|
+
varying vec2 vUv;
|
|
771
|
+
varying float vDistanceProgress;
|
|
772
|
+
|
|
773
|
+
void main() {
|
|
774
|
+
// 计算调整后的距离进度
|
|
775
|
+
float adjustedDistanceStart = max(0.0, startOffset);
|
|
776
|
+
float adjustedTotalLength = totalLength - startOffset - endOffset;
|
|
777
|
+
adjustedTotalLength = max(0.01, adjustedTotalLength);
|
|
778
|
+
float adjustedProgress = (vDistanceProgress * totalLength - adjustedDistanceStart) / adjustedTotalLength;
|
|
779
|
+
|
|
780
|
+
// 如果在裁剪范围外,丢弃片段
|
|
781
|
+
if (adjustedProgress < 0.0 || adjustedProgress > 1.0) {
|
|
782
|
+
discard;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// 展开效果:只显示已展开的部分
|
|
786
|
+
if (adjustedProgress > unfoldProgress) {
|
|
787
|
+
discard;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
// 计算 UV 坐标用于采样 alphaMap
|
|
791
|
+
// u 坐标 = 当前位置 + 动画进度(形成移动效果)
|
|
792
|
+
float u = fract(adjustedProgress - animationProgress);
|
|
793
|
+
vec2 uv = vec2(u, 0.5);
|
|
794
|
+
|
|
795
|
+
// 从 alphaMap 采样透明度
|
|
796
|
+
float sampledAlpha = texture2D(alphaMap, uv).r;
|
|
797
|
+
|
|
798
|
+
// 展开前进头部的渐变遮罩(0.05 的百分比)
|
|
799
|
+
float unfoldFadeLength = 0.05;
|
|
800
|
+
float distanceToUnfoldEdge = unfoldProgress - adjustedProgress;
|
|
801
|
+
if (distanceToUnfoldEdge < unfoldFadeLength && distanceToUnfoldEdge > 0.0) {
|
|
802
|
+
sampledAlpha *= distanceToUnfoldEdge / unfoldFadeLength;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// 增加开头和结尾的渐变 alpha 遮罩
|
|
806
|
+
float fadeLength = 0.05;
|
|
807
|
+
if (adjustedProgress < fadeLength) {
|
|
808
|
+
sampledAlpha *= adjustedProgress / fadeLength;
|
|
809
|
+
}
|
|
810
|
+
float endFadeStart = 1.0 - fadeLength;
|
|
811
|
+
if (adjustedProgress > endFadeStart) {
|
|
812
|
+
sampledAlpha *= (1.0 - adjustedProgress) / fadeLength;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
gl_FragColor = vec4(baseColor, sampledAlpha);
|
|
816
|
+
}
|
|
817
|
+
`})},o.prototype.projectPointsToScreen=function(e,n){for(var t=[],a=0,s=0;s<e.length;s++){var l=e[s];s>0&&(a+=l.distanceTo(e[s-1]));var h=l.clone().project(n),c=h.x<-1||h.x>1||h.y<-1||h.y>1||h.z<-1||h.z>1;t.push({point:l.clone(),screenPos:new v.Vector2(h.x,h.y),distanceFromStart:a,isOffscreen:c})}return t},o.prototype.findNearestOffscreenPoint=function(e){for(var n=-1,t=0,a=-1,s=0;s<e.length;s++)if(!e[s].isOffscreen){a=s;break}if(a===-1)return null;for(var s=a-1;s>=0;s--)if(e[s].isOffscreen){n=s,t=e[s].distanceFromStart;break}return n===-1?{index:0,distance:0}:{index:n,distance:t}},o.prototype.findFarestOffscreenPoint=function(e){for(var n,t=((n=e[e.length-1])===null||n===void 0?void 0:n.distanceFromStart)||0,a=-1,s=e.length-1;s>=0;s--)if(!e[s].isOffscreen){a=s;break}if(a===-1)return null;var l=a+1;return l<e.length&&e[l].isOffscreen?{index:l,distance:e[l].distanceFromStart,totalLength:t}:{index:e.length-1,distance:t,totalLength:t}},o.prototype.updatePathAnimation=function(e){var n,t=this.paths.get(e);if(!(!t||!t.enabled)){var a=performance.now()/1e3,s=this._config,l=s.speed,h=s.particleCount,c=s.maxDistance,g=((n=t.lines[0])===null||n===void 0?void 0:n.material.uniforms.totalLength.value)||1,w=Math.max(.01,g-t.startOffset-t.endOffset),M=(a-t.cycleStartTime)*l/w%1;if(t.isInitialAnimation){if(t.enableSubMesh&&M>=.2&&!t.subMeshUnfoldStarted&&(t.subMeshUnfoldStarted=!0),t.enableSubMesh&&t.subMeshUnfoldStarted&&t.subMeshUnfoldProgress<1){var T=a-t.lastUpdateTime,E=.5;t.subMeshUnfoldProgress=Math.min(1,t.subMeshUnfoldProgress+E*T),t.subMeshMaterial.uniforms.unfoldProgress.value=t.subMeshUnfoldProgress}M<t.lastAnimationProgress&&(!t.enableSubMesh||t.subMeshUnfoldProgress>=1)&&(t.isInitialAnimation=!1)}else t.enableSubMesh&&(t.subMeshMaterial.uniforms.unfoldProgress.value=1);if(t.lastAnimationProgress=M,t.lastUpdateTime=a,t.isInitialAnimation&&t.lines.forEach(function(z){z.material.uniforms.time.value=a,z.material.uniforms.animationProgress.value=M}),t.isInitialAnimation){var S=null,C=1/0;if(t.lines.forEach(function(z){for(var H=z.geometry,Q=H.attributes.instanceDistanceStart,q=H.attributes.instanceDistanceEnd,le=Q.count,X=0;X<le;X++){var K=Q.getX(X)/z.material.uniforms.totalLength.value,D=q.getX(X)/z.material.uniforms.totalLength.value;if(M>=K&&M<=D){var I=(M-K)/(D-K),L=new v.Vector3().fromBufferAttribute(H.attributes.instanceStart,X),N=new v.Vector3().fromBufferAttribute(H.attributes.instanceEnd,X),Y=new v.Vector3().lerpVectors(L,N,I),ie=Math.abs(M-(K+D)/2);ie<C&&(C=ie,S=Y)}}}),S)for(var b=0;b<h;b++){var y=t.particleInfos[b];!y.active&&Math.random()<.05&&(y.active=!0,y.age=0,y.life=3+Math.random()*2,y.velocity.set((Math.random()-.5)*1e-4,(Math.random()-.5)*1e-4,(Math.random()-.5)*1e-4),t.particlePositions[b*3]=S.x,t.particlePositions[b*3+1]=S.y,t.particlePositions[b*3+2]=S.z,y.startPos.copy(S),y.alpha=0)}for(var b=0;b<h;b++){var y=t.particleInfos[b];if(y.active){y.age+=.016;var A=t.particlePositions[b*3]-y.startPos.x,m=t.particlePositions[b*3+1]-y.startPos.y,O=t.particlePositions[b*3+2]-y.startPos.z,x=Math.sqrt(A*A+m*m+O*O);(x>=c||y.age>=y.life)&&(y.active=!1,t.particlePositions[b*3]=9999,t.particlePositions[b*3+1]=9999,t.particlePositions[b*3+2]=9999,y.alpha=0),y.velocity.x+=(Math.random()-.5)*1e-4,y.velocity.z+=(Math.random()-.5)*1e-4,y.velocity.y+=1e-4,y.velocity.multiplyScalar(.99),t.particlePositions[b*3]+=y.velocity.x,t.particlePositions[b*3+1]+=y.velocity.y,t.particlePositions[b*3+2]+=y.velocity.z;var j=y.age/y.life;j<.2?y.alpha=j/.2:j>.8?y.alpha=(1-j)/.2:y.alpha=1}}t.particleGeometry.attributes.position.needsUpdate=!0,t.particleMaterial.opacity=.6}t.enableSubMesh&&(t.subMeshMaterial.uniforms.animationProgress.value=M),this.five.needsRender=!0}},o.prototype.startPathAnimation=function(e){var n=this,t=this.paths.get(e);if(!t)return console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1;if(t.animationId!==null)return!1;var a=performance.now()/1e3;return t.cycleStartTime=a,t.lastUpdateTime=a,t.animationId=pe.AnimationFrameLoop.shared.add(function(){n.updatePathAnimation(e)}),!0},o.prototype.stopPathAnimation=function(e){var n=this.paths.get(e);return n?(n.animationId!==null&&(n.animationId(),n.animationId=null),!0):(console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1)},o.prototype._enable=function(e){this.paths.size>0&&this.state.playing&&this.play()},o.prototype._disable=function(e){this.pause()},o.prototype.enable=function(e){var n;if(!this.state.enabled){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!0},t),this._enable({userAction:t})}},o.prototype.disable=function(e){var n;if(this.state.enabled!==!1){var t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.updateState({enabled:!1},t),this._disable({userAction:t})}},o.prototype.show=function(e){var n,t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.paths.forEach(function(a){a.lines.forEach(function(s){return s.visible=!0}),a.particles.visible=!0,a.subMesh.visible=!0}),this.updateState({visible:!0},t)},o.prototype.hide=function(e){var n,t=(n=e==null?void 0:e.userAction)!==null&&n!==void 0?n:!0;this.paths.forEach(function(a){a.lines.forEach(function(s){return s.visible=!1}),a.particles.visible=!1,a.subMesh.visible=!1}),this.updateState({visible:!1},t)},o.prototype.setState=function(e,n){var t;t=n==null?void 0:n.userAction,e.enabled!==void 0&&e.enabled!==this.state.enabled&&(e.enabled?this.enable(n):this.disable(n)),e.visible!==void 0&&e.visible!==this.state.visible&&(e.visible?this.show(n):this.hide(n))},o.prototype.play=function(){var e=this;this.paths.forEach(function(n,t){e.startPathAnimation(t)}),this.updateState({playing:!0},!1),this.hooks.emit("animationStart")},o.prototype.pause=function(){var e=this;this.paths.forEach(function(n,t){e.stopPathAnimation(t)}),this.updateState({playing:!1},!1),this.hooks.emit("animationStop")},o.prototype.reset=function(){var e=this;this.paths.forEach(function(n,t){e.stopPathAnimation(t)}),this.paths.forEach(function(n){n.isInitialAnimation=!0,n.subMeshUnfoldProgress=0,n.subMeshUnfoldStarted=!1,n.lastAnimationProgress=0,n.cycleStartTime=performance.now()/1e3,n.lastUpdateTime=performance.now()/1e3,n.startOffset=0,n.endOffset=0,n.lines.forEach(function(l){l.visible=!0,l.material.uniforms.time.value=0,l.material.uniforms.animationProgress.value=0,l.material.uniforms.startOffset.value=0,l.material.uniforms.endOffset.value=0}),n.particles.visible=!0;for(var t=e._config.particleCount,a=0;a<t;a++){var s=n.particleInfos[a];s.active=!1,s.age=0,s.alpha=0,n.particlePositions[a*3]=9999,n.particlePositions[a*3+1]=9999,n.particlePositions[a*3+2]=9999}n.particleGeometry.attributes.position.needsUpdate=!0,n.subMeshMaterial&&(n.subMeshMaterial.uniforms.unfoldProgress.value=0,n.subMeshMaterial.uniforms.animationProgress.value=0,n.subMeshMaterial.uniforms.startOffset.value=0,n.subMeshMaterial.uniforms.endOffset.value=0)})},o.prototype.updateScreenProjection=function(e){var n=this,t=function(s){var l=n.projectPointsToScreen(s.config.points,n.five.camera),h=n.findNearestOffscreenPoint(l);h&&(s.startOffset=h.distance);var c=n.findFarestOffscreenPoint(l);c&&(s.endOffset=c.totalLength-c.distance),s.lines.forEach(function(g){g.material.uniforms.startOffset.value=s.startOffset,g.material.uniforms.endOffset.value=s.endOffset}),s.subMeshMaterial.uniforms.startOffset.value=s.startOffset,s.subMeshMaterial.uniforms.endOffset.value=s.endOffset,s.cycleStartTime=performance.now()/1e3,s.lastAnimationProgress=0};if(e){var a=this.paths.get(e);a&&t(a)}else this.paths.forEach(function(s){s.enabled&&t(s)})},o.prototype.disposePathResources=function(e){var n=this;e.lines.forEach(function(t){n.five.scene.remove(t),t.geometry.dispose(),t.material.dispose()}),this.five.scene.remove(e.particles),e.particleGeometry.dispose(),e.particleMaterial.dispose(),this.five.scene.remove(e.subMesh),e.subMeshGeometry.dispose(),e.subMeshMaterial.dispose()},o.prototype.dispose=function(){this.pause(),this.clearAllPaths(),this.hooks.emit("dispose")},o})(lt.BasePlugin.Controller),xn=function(f,o){return new Sn(f,o)};te.BackgroundPlugin=yn,te.CSS3DRenderer=Ft,te.DynamicPathLinePlugin=xn,te.ItemMaskPlugin=dn,te.OrbitControls=Ne,te.OrientationPlugin=mn,te.PanoAnimePlugin=An,te.RoundedBoxGeometry=It,te.TrajectoryPlugin=wn,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));
|