@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/plugins/index.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
|
-
*/"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
255
|
+
*/"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Le=require("@realsee/five"),F=require("three"),At=require("@realsee/five/plugins");function yn(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=yn(F);function bn(f){return/^https?:\/\/|^\/\//.test(f)||/^data:/.test(f)}function wn(f,o){return bn(o)?o:"".concat(f).concat(o)}exports.BasePlugin=void 0;(function(f){var o=(function(){function e(n,t){this.hooks=new Le.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 wn(this.staticPrefix,n)},e})();f.Controller=o})(exports.BasePlugin||(exports.BasePlugin={}));var Pt=function(f,o){return Pt=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])},Pt(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");Pt(f,o);function e(){this.constructor=f}f.prototype=o===null?Object.create(o):(e.prototype=o.prototype,new e)}var z=function(){return z=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},z.apply(this,arguments)};function Fe(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 Ie(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 zt(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))}function En(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 Tn=typeof performance!="undefined"&&typeof performance.timing!="undefined"?performance.timing.navigationStart:Date.now(),gt=typeof performance!="undefined"?(function(){return Tn+performance.now()}):(function(){return Date.now()});function at(f,o,e){return f+(o-f)*e}function Pn(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 Mn(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 An(f,o,e,n){var t=n[1]-n[0];return f=it(f,n),o=it(o,n),o-f>t/2?at(f+t,o,e):f-o>t/2?at(f-t,o,e):at(f,o,e)}function it(f,o){var e=o[1]-o[0];return f<o[0]?it(f+e,o):f>=o[1]?it(f-e,o):f}function Sn(f,o,e,n){return n?An(f,o,e,n):at(f,o,e)}var Gt=(function(){function f(o){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=gt(),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:z({},this.value)},{progress:1,value:z({},this.value)}]}return f.prototype.getProgress=function(o){var e=o-this.startTime;return e<0?0:e>=this.duration?1:1-Pn(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 z({},this.keyframes[this.keyframes.length-1].value)},f.prototype.getProgressVelocity=function(o){var e=o-this.startTime;return e>=this.duration?0:Mn(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:gt();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:gt(),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=z({},o[o.length-1].value)):a.value=z({},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})(),xn=[{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}}],On=[{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}}],_n=`
|
|
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
|
-
`,
|
|
307
|
+
`,Ln=(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:_n,fragmentShader:Cn,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 Fe(t,void 0,void 0,function(){var h,c,g,w,P,T,M,S,C,b;return Ie(this,function(y){switch(y.label){case 0:return h=this,c=h.five,g=h.canvas,w=h.itemMaskMesh,P=h.data,T=g.getContext("2d"),M=c.observers[l],S=(b=P==null?void 0:P.object_mask_list.find(function(A){return A.derived_id===String(M.derivedId)}))===null||b===void 0?void 0:b.object_mask_url,S?[4,En(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(M.position),w.quaternion.copy(M.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,P=g.observers[g.state.panoIndex],T=(h=l.pointers[0])===null||h===void 0?void 0:h.raycaster;if(T){var M=T.intersectObjects(t.group.children.filter(function(S){return S.userData.visible_viewpoint.includes(String(P.derivedId))}),!0)[0];M?w.material.uniforms.color.value=M.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 Gt({opacity:0,scale:0,shadow:2}),P=new Gt({opacity:0,scale:0,shadow:2});return w.setKeyframes(xn,1e3),P.setKeyframes(On,1e3),t.stopAnimation=Le.AnimationFrameLoop.shared.add(function(T,M){var S,C=w.update(T),b=P.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(P.value.opacity),t.wrapper.lastChild.style.transform="scale(".concat(P.value.scale,")"),t.wrapper.lastChild.style.boxShadow="0 0 0 ".concat(P.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=z({},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 z({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(e,n){var t=this.state;this.state=z(z({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},o.prototype.load=function(e){return Fe(this,void 0,void 0,function(){var n,t,a=this;return Ie(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]),P=Math.abs(c[1]-g[1]),T=Math.abs(c[2]-g[2]),M=c[0]/2+g[0]/2,S=c[1]/2+g[1]/2,C=c[2]/2+g[2]/2,b=new v.Vector3(M,S,C),y=new v.BoxBufferGeometry(w,P,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:v.DoubleSide,visible:
|
|
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,zt(zt([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})(exports.BasePlugin.Controller),Fn=function(f,o){return new Ln(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 yt=(function(
|
|
354
|
+
* Licensed under the MIT license */var yt=(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)?(P(r,u[i],u),!0):!1}function P(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 E=new Error("get-stack-trace"),M=E&&E.stack?E.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,p,M),r.apply(this,arguments)}}var A;typeof Object.assign!="function"?A=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 E=arguments[p];if(E!==n&&E!==null)for(var M in E)E.hasOwnProperty(M)&&(u[M]=E[M])}return u}:A=Object.assign;var S=P(function(i,u,p){for(var E=Object.keys(u),M=0;M<E.length;)(!p||p&&i[E[M]]===n)&&(i[E[M]]=u[E[M]]),M++;return i},"extend","Use `assign`."),C=P(function(i,u){return S(i,u,!0)},"merge","Use `assign`.");function T(r,i,u){var p=i.prototype,E;E=r.prototype=Object.create(p),E.constructor=r,E._super=p,u&&A(E,u)}function b(r,i){return function(){return r.apply(i,arguments)}}function x(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(R(i),function(p){r.addEventListener(p,u,!1)})}function _(r,i,u){w(R(i),function(p){r.removeEventListener(p,u,!1)})}function W(r,i){for(;r;){if(r==i)return!0;r=r.parentNode}return!1}function H(r,i){return r.indexOf(i)>-1}function R(r){return r.trim().split(/\s+/g)}function J(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 se(r){return Array.prototype.slice.call(r,0)}function ue(r,i,u){for(var p=[],E=[],M=0;M<r.length;){var L=r[M][i];J(E,L)<0&&p.push(r[M]),E[M]=L,M++}return p=p.sort(function(fe,ee){return fe[i]>ee[i]}),p}function $(r,i){for(var u,p,E=i[0].toUpperCase()+i.slice(1),M=0;M<t.length;){if(u=t[M],p=u?u+E:i,p in r)return p;M++}return n}var Q=1;function F(){return Q++}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,Y=$(c,"PointerEvent")!==n,oe=U&&k.test(navigator.userAgent),q="touch",V="pen",te="mouse",G="kinect",j=25,D=1,ae=2,X=4,K=8,Se=1,Pe=2,Me=4,_e=8,xe=16,ce=Pe|Me,pe=_e|xe,Be=ce|pe,Ue=["x","y"],Oe=["clientX","clientY"];function le(r,i){var u=this;this.manager=r,this.callback=i,this.element=r.element,this.target=r.options.inputTarget,this.domHandler=function(p){x(r.options.enable,[r])&&u.handler(p)},this.init()}le.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 We(r){var i,u=r.options.inputClass;return u?i=u:Y?i=lt:oe?i=Ze:U?i=ut:i=Ke,new i(r,Xe)}function Xe(r,i,u){var p=u.pointers.length,E=u.changedPointers.length,M=i&D&&p-E===0,L=i&(X|K)&&p-E===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,p=i.pointers,E=p.length;u.firstInput||(u.firstInput=ne(i)),E>1&&!u.firstMultiple?u.firstMultiple=ne(i):E===1&&(u.firstMultiple=!1);var M=u.firstInput,L=u.firstMultiple,re=L?L.center:M.center,fe=i.center=me(p);i.timeStamp=f(),i.deltaTime=i.timeStamp-M.timeStamp,i.angle=st(re,fe),i.distance=qe(re,fe),B(u,i),i.offsetDirection=be(i.deltaX,i.deltaY);var ee=Re(i.deltaTime,i.deltaX,i.deltaY);i.overallVelocityX=ee.x,i.overallVelocityY=ee.y,i.overallVelocity=h(ee.x)>h(ee.y)?ee.x:ee.y,i.scale=L?Jt(L.pointers,p):1,i.rotation=L?Qt(L.pointers,p):0,i.maxPointers=u.prevInput?i.pointers.length>u.prevInput.maxPointers?i.pointers.length:u.prevInput.maxPointers:i.pointers.length,Z(u,i);var ye=r.element;W(i.srcEvent.target,ye)&&(ye=i.srcEvent.target),i.target=ye}function B(r,i){var u=i.center,p=r.offsetDelta||{},E=r.prevDelta||{},M=r.prevInput||{};(i.eventType===D||M.eventType===X)&&(E=r.prevDelta={x:M.deltaX||0,y:M.deltaY||0},p=r.offsetDelta={x:u.x,y:u.y}),i.deltaX=E.x+(u.x-p.x),i.deltaY=E.y+(u.y-p.y)}function Z(r,i){var u=r.lastInterval||i,p=i.timeStamp-u.timeStamp,E,M,L,re;if(i.eventType!=K&&(p>j||u.velocity===n)){var fe=i.deltaX-u.deltaX,ee=i.deltaY-u.deltaY,ye=Re(p,fe,ee);M=ye.x,L=ye.y,E=h(ye.x)>h(ye.y)?ye.x:ye.y,re=be(fe,ee),r.lastInterval=i}else E=u.velocity,M=u.velocityX,L=u.velocityY,re=u.direction;i.velocity=E,i.velocityX=M,i.velocityY=L,i.direction=re}function ne(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:me(i),deltaX:r.deltaX,deltaY:r.deltaY}}function me(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,E=0;E<i;)u+=r[E].clientX,p+=r[E].clientY,E++;return{x:l(u/i),y:l(p/i)}}function Re(r,i,u){return{x:i/r||0,y:u/r||0}}function be(r,i){return r===i?Se:h(r)>=h(i)?r<0?Pe:Me:i<0?_e:xe}function qe(r,i,u){u||(u=Ue);var p=i[u[0]]-r[u[0]],E=i[u[1]]-r[u[1]];return Math.sqrt(p*p+E*E)}function st(r,i,u){u||(u=Ue);var p=i[u[0]]-r[u[0]],E=i[u[1]]-r[u[1]];return Math.atan2(E,p)*180/Math.PI}function Qt(r,i){return st(i[1],i[0],Oe)+st(r[1],r[0],Oe)}function Jt(r,i){return qe(i[0],i[1],Oe)/qe(r[0],r[1],Oe)}var $t={mousedown:D,mousemove:ae,mouseup:X},en="mousedown",tn="mousemove mouseup";function Ke(){this.evEl=en,this.evWin=tn,this.pressed=!1,le.apply(this,arguments)}T(Ke,le,{handler:function(i){var u=$t[i.type];u&D&&(i.button===0||i.button===2)&&(this.pressed=!0),u&ae&&i.which!==1&&(u=X),this.pressed&&(u&X&&(this.pressed=!1),this.callback(this.manager,u,{pointers:[i],changedPointers:[i],pointerType:te,srcEvent:i}))}});var _t={pointerdown:D,pointermove:ae,pointerup:X,pointercancel:K,pointerout:K},nn={2:q,3:V,4:te,5:G},Ot="pointerdown",Ct="pointermove pointerup pointercancel";c.MSPointerEvent&&!c.PointerEvent&&(Ot="MSPointerDown",Ct="MSPointerMove MSPointerUp MSPointerCancel");function lt(){this.evEl=Ot,this.evWin=Ct,le.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}T(lt,le,{handler:function(i){var u=this.store,p=!1,E=!1,M=i.type.toLowerCase().replace("ms",""),L=_t[M],re=nn[i.pointerType]||i.pointerType,fe=re==q,ee=J(u,i.pointerId,"pointerId");L&D&&(i.button===0||i.button===2||fe)?ee<0&&(u.push(i),ee=u.length-1):L&(X|K)?p=!0:!fe&&i.buttons===0&&(p=!0,E=!0,L=_t.pointerup),!(ee<0)&&(E||(u[ee]=i),this.callback(this.manager,L,{pointers:u,changedPointers:[i],pointerType:re,srcEvent:u[ee]}),p&&u.splice(ee,1))}});var rn={touchstart:D,touchmove:ae,touchend:X,touchcancel:K},an="touchstart",on="touchstart touchmove touchend touchcancel";function It(){this.evTarget=an,this.evWin=on,this.started=!1,le.apply(this,arguments)}T(It,le,{handler:function(i){var u=rn[i.type];if(u===D&&(this.started=!0),!!this.started){var p=sn.call(this,i,u);u&(X|K)&&p[0].length-p[1].length===0&&(this.started=!1),this.callback(this.manager,u,{pointers:p[0],changedPointers:p[1],pointerType:q,srcEvent:i})}}});function sn(r,i){var u=se(r.touches),p=se(r.changedTouches);return i&(X|K)&&(u=ue(u.concat(p),"identifier")),[u,p]}var ln={touchstart:D,touchmove:ae,touchend:X,touchcancel:K},un="touchstart touchmove touchend touchcancel";function Ze(){this.evTarget=un,this.targetIds={},le.apply(this,arguments)}T(Ze,le,{handler:function(i){var u=ln[i.type],p=cn.call(this,i,u);p&&this.callback(this.manager,u,{pointers:p[0],changedPointers:p[1],pointerType:q,srcEvent:i})}});function cn(r,i){var u=se(r.touches),p=this.targetIds;if(i&(D|ae)&&u.length===1)return p[u[0].identifier]=!0,[u,u];var E,M,L=se(r.changedTouches),re=[],fe=this.target;if(M=u.filter(function(ee){return W(ee.target,fe)}),i===D)for(E=0;E<M.length;)p[M[E].identifier]=!0,E++;for(E=0;E<L.length;)p[L[E].identifier]&&re.push(L[E]),i&(X|K)&&delete p[L[E].identifier],E++;if(re.length)return[ue(M.concat(re),"identifier"),re]}var fn=2500,Nt=25;function ut(){le.apply(this,arguments);var r=b(this.handler,this);this.touch=new Ze(this.manager,r),this.mouse=new Ke(this.manager,r),this.primaryTouch=null,this.lastTouches=[]}T(ut,le,{handler:function(i,u,p){var E=p.pointerType==q,M=p.pointerType==te;if(!(M&&p.sourceCapabilities&&p.sourceCapabilities.firesTouchEvents)){if(E)hn.call(this,u,p);else if(M&&dn.call(this,p))return;this.callback(i,u,p)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function hn(r,i){r&D?(this.primaryTouch=i.changedPointers[0].identifier,kt.call(this,i)):r&(X|K)&&kt.call(this,i)}function kt(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,E=function(){var M=p.indexOf(u);M>-1&&p.splice(M,1)};setTimeout(E,fn)}}function dn(r){for(var i=r.srcEvent.clientX,u=r.srcEvent.clientY,p=0;p<this.lastTouches.length;p++){var E=this.lastTouches[p],M=Math.abs(i-E.x),L=Math.abs(u-E.y);if(M<=Nt&&L<=Nt)return!0}return!1}var Lt=o?$(o.style,"touchAction"):n,Dt=Lt!==n,Ft="compute",Bt="auto",ct="manipulation",Ce="none",Ve="pan-x",ze="pan-y",Qe=vn();function ft(r,i){this.manager=r,this.set(i)}ft.prototype={set:function(r){r==Ft&&(r=this.compute()),Dt&&this.manager.element.style&&Qe[r]&&(this.manager.element.style[Lt]=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){x(i.options.enable,[i])&&(r=r.concat(i.getTouchAction()))}),pn(r.join(" "))},preventDefaults:function(r){var i=r.srcEvent,u=r.offsetDirection;if(this.manager.session.prevented){i.preventDefault();return}var p=this.actions,E=H(p,Ce)&&!Qe[Ce],M=H(p,ze)&&!Qe[ze],L=H(p,Ve)&&!Qe[Ve];if(E){var re=r.pointers.length===1,fe=r.distance<2,ee=r.deltaTime<250;if(re&&fe&&ee)return}if(!(L&&M)&&(E||M&&u&ce||L&&u&pe))return this.preventSrc(i)},preventSrc:function(r){this.manager.session.prevented=!0,r.preventDefault()}};function pn(r){if(H(r,Ce))return Ce;var i=H(r,Ve),u=H(r,ze);return i&&u?Ce:i||u?i?Ve:ze:H(r,ct)?ct:Bt}function vn(){if(!Dt)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 Je=1,he=2,Le=4,Ae=8,we=Ae,je=16,ge=32;function Ee(r){this.options=A({},this.defaults,r||{}),this.id=F(),this.manager=null,this.options.enable=m(this.options.enable,!0),this.state=Je,this.simultaneous={},this.requireFail=[]}Ee.prototype={defaults:{},set:function(r){return A(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=$e(r,this),i[r.id]||(i[r.id]=r,r.recognizeWith(this)),this},dropRecognizeWith:function(r){return y(r,"dropRecognizeWith",this)?this:(r=$e(r,this),delete this.simultaneous[r.id],this)},requireFailure:function(r){if(y(r,"requireFailure",this))return this;var i=this.requireFail;return r=$e(r,this),J(i,r)===-1&&(i.push(r),r.requireFailure(this)),this},dropRequireFailure:function(r){if(y(r,"dropRequireFailure",this))return this;r=$e(r,this);var i=J(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(E){i.manager.emit(E,r)}u<Ae&&p(i.options.event+Ut(u)),p(i.options.event),r.additionalEvent&&p(r.additionalEvent),u>=Ae&&p(i.options.event+Ut(u))},tryEmit:function(r){if(this.canEmit())return this.emit(r);this.state=ge},canEmit:function(){for(var r=0;r<this.requireFail.length;){if(!(this.requireFail[r].state&(ge|Je)))return!1;r++}return!0},recognize:function(r){var i=A({},r);if(!x(this.options.enable,[this,i])){this.reset(),this.state=ge;return}this.state&(we|je|ge)&&(this.state=Je),this.state=this.process(i),this.state&(he|Le|Ae|je)&&this.tryEmit(i)},process:function(r){},getTouchAction:function(){},reset:function(){}};function Ut(r){return r&je?"cancel":r&Ae?"end":r&Le?"move":r&he?"start":""}function Rt(r){return r==xe?"down":r==_e?"up":r==Pe?"left":r==Me?"right":""}function $e(r,i){var u=i.manager;return u?u.get(r):r}function ve(){Ee.apply(this,arguments)}T(ve,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&(he|Le),E=this.attrTest(r);return p&&(u&K||!E)?i|je:p||E?u&X?i|Ae:i&he?i|Le:he:ge}});function et(){ve.apply(this,arguments),this.pX=null,this.pY=null}T(et,ve,{defaults:{event:"pan",threshold:10,pointers:1,direction:Be},getTouchAction:function(){var r=this.options.direction,i=[];return r&ce&&i.push(ze),r&pe&&i.push(Ve),i},directionTest:function(r){var i=this.options,u=!0,p=r.distance,E=r.direction,M=r.deltaX,L=r.deltaY;return E&i.direction||(i.direction&ce?(E=M===0?Se:M<0?Pe:Me,u=M!=this.pX,p=Math.abs(r.deltaX)):(E=L===0?Se:L<0?_e:xe,u=L!=this.pY,p=Math.abs(r.deltaY))),r.direction=E,u&&p>i.threshold&&E&i.direction},attrTest:function(r){return ve.prototype.attrTest.call(this,r)&&(this.state&he||!(this.state&he)&&this.directionTest(r))},emit:function(r){this.pX=r.deltaX,this.pY=r.deltaY;var i=Rt(r.direction);i&&(r.additionalEvent=this.options.event+i),this._super.emit.call(this,r)}});function ht(){ve.apply(this,arguments)}T(ht,ve,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Ce]},attrTest:function(r){return this._super.attrTest.call(this,r)&&(Math.abs(r.scale-1)>this.options.threshold||this.state&he)},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 dt(){Ee.apply(this,arguments),this._timer=null,this._input=null}T(dt,Ee,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Bt]},process:function(r){var i=this.options,u=r.pointers.length===i.pointers,p=r.distance<i.threshold,E=r.deltaTime>i.time;if(this._input=r,!p||!u||r.eventType&(X|K)&&!E)this.reset();else if(r.eventType&D)this.reset(),this._timer=g(function(){this.state=we,this.tryEmit()},i.time,this);else if(r.eventType&X)return we;return ge},reset:function(){clearTimeout(this._timer)},emit:function(r){this.state===we&&(r&&r.eventType&X?this.manager.emit(this.options.event+"up",r):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}});function pt(){ve.apply(this,arguments)}T(pt,ve,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Ce]},attrTest:function(r){return this._super.attrTest.call(this,r)&&(Math.abs(r.rotation)>this.options.threshold||this.state&he)}});function vt(){ve.apply(this,arguments)}T(vt,ve,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:ce|pe,pointers:1},getTouchAction:function(){return et.prototype.getTouchAction.call(this)},attrTest:function(r){var i=this.options.direction,u;return i&(ce|pe)?u=r.overallVelocity:i&ce?u=r.overallVelocityX:i&pe&&(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&X},emit:function(r){var i=Rt(r.offsetDirection);i&&this.manager.emit(this.options.event+i,r),this.manager.emit(this.options.event,r)}});function tt(){Ee.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}T(tt,Ee,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ct]},process:function(r){var i=this.options,u=r.pointers.length===i.pointers,p=r.distance<i.threshold,E=r.deltaTime<i.time;if(this.reset(),r.eventType&D&&this.count===0)return this.failTimeout();if(p&&E&&u){if(r.eventType!=X)return this.failTimeout();var M=this.pTime?r.timeStamp-this.pTime<i.interval:!0,L=!this.pCenter||qe(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 re=this.count%i.taps;if(re===0)return this.hasRequireFailures()?(this._timer=g(function(){this.state=we,this.tryEmit()},i.interval,this),he):we}return ge},failTimeout:function(){return this._timer=g(function(){this.state=ge},this.options.interval,this),ge},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==we&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function De(r,i){return i=i||{},i.recognizers=m(i.recognizers,De.defaults.preset),new mt(r,i)}De.VERSION="2.0.7",De.defaults={domEvents:!1,touchAction:Ft,enable:!0,inputTarget:null,inputClass:null,preset:[[pt,{enable:!1}],[ht,{enable:!1},["rotate"]],[vt,{direction:ce}],[et,{direction:ce},["swipe"]],[tt],[tt,{event:"doubletap",taps:2},["tap"]],[dt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var mn=1,Vt=2;function mt(r,i){this.options=A({},De.defaults,i||{}),this.options.inputTarget=this.options.inputTarget||r,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=r,this.input=We(this),this.touchAction=new ft(this,this.options.touchAction),zt(this,!0),w(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)}mt.prototype={set:function(r){return A(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?Vt:mn},recognize:function(r){var i=this.session;if(!i.stopped){this.touchAction.preventDefaults(r);var u,p=this.recognizers,E=i.curRecognizer;(!E||E&&E.state&we)&&(E=i.curRecognizer=null);for(var M=0;M<p.length;)u=p[M],i.stopped!==Vt&&(!E||u==E||u.canRecognizeWith(E))?u.recognize(r):u.reset(),!E&&u.state&(he|Le|Ae)&&(E=i.curRecognizer=u),M++}},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(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=J(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(R(r),function(p){u[p]=u[p]||[],u[p].push(i)}),this}},off:function(r,i){if(r!==n){var u=this.handlers;return w(R(r),function(p){i?u[p]&&u[p].splice(J(u[p],i),1):delete u[p]}),this}},emit:function(r,i){this.options.domEvents&&gn(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&&zt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function zt(r,i){var u=r.element;if(u.style){var p;w(r.options.cssProps,function(E,M){p=$(u.style,M),i?(r.oldCssProps[p]=u.style[p],u.style[p]=E):u.style[p]=r.oldCssProps[p]||""}),i||(r.oldCssProps={})}}function gn(r,i){var u=a.createEvent("Event");u.initEvent(r,!0,!0),u.gesture=i,i.target.dispatchEvent(u)}return A(De,{INPUT_START:D,INPUT_MOVE:ae,INPUT_END:X,INPUT_CANCEL:K,STATE_POSSIBLE:Je,STATE_BEGAN:he,STATE_CHANGED:Le,STATE_ENDED:Ae,STATE_RECOGNIZED:we,STATE_CANCELLED:je,STATE_FAILED:ge,DIRECTION_NONE:Se,DIRECTION_LEFT:Pe,DIRECTION_RIGHT:Me,DIRECTION_UP:_e,DIRECTION_DOWN:xe,DIRECTION_HORIZONTAL:ce,DIRECTION_VERTICAL:pe,DIRECTION_ALL:Be,Manager:mt,Input:le,TouchAction:ft,TouchInput:Ze,MouseInput:Ke,PointerEventInput:lt,TouchMouseInput:ut,SingleTouchInput:It,Recognizer:Ee,AttrRecognizer:ve,Tap:tt,Pan:et,Swipe:vt,Pinch:ht,Rotate:pt,Press:dt,on:O,off:_,each:w,merge:C,extend:S,assign:A,inherit:T,bindFn:b,prefixed:$}),De})(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{}),Fe=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(),ne=new I.Vector3,me=new I.Quaternion;return function(){var be=e.object.position;return d.copy(be).sub(e.target),d.applyQuaternion(B),f.setFromVector3(d),e.autoRotate&&l===s.NONE&&R(W()),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),be.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,P||ne.distanceToSquared(e.object.position)>h||8*(1-me.dot(e.object.quaternion))>h?(e.dispatchEvent(n),ne.copy(e.object.position),me.copy(e.object.quaternion),P=!1,!0):!1}})(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",Xe,!1),e.domElement.removeEventListener("mousedown",xe,!1),e.domElement.removeEventListener("wheel",Be,!1),e.domElement.removeEventListener("touchstart",Oe,!1),e.domElement.removeEventListener("touchend",We,!1),e.domElement.removeEventListener("touchmove",le,!1),document.removeEventListener("mousemove",ce,!1),document.removeEventListener("mouseup",pe,!1),e.domElement.removeEventListener("keydown",Ue,!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,P=!1,A=new I.Vector2,S=new I.Vector2,C=new I.Vector2,T=new I.Vector2,b=new I.Vector2,x=new I.Vector2,m=new I.Vector2,O=new I.Vector2,_=new I.Vector2;function W(){return 2*Math.PI/60/60*e.autoRotateSpeed}function H(){return Math.pow(.95,e.zoomSpeed)}function R(d){g.theta-=d}function J(d){g.phi-=d}var se=(function(){var d=new I.Vector3;return function(Z,ne){d.setFromMatrixColumn(ne,0),d.multiplyScalar(-Z),w.add(d)}})(),ue=(function(){var d=new I.Vector3;return function(Z,ne){e.screenSpacePanning===!0?d.setFromMatrixColumn(ne,1):(d.setFromMatrixColumn(ne,0),d.crossVectors(e.object.up,d)),d.multiplyScalar(Z),w.add(d)}})(),$=(function(){var d=new I.Vector3;return function(Z,ne){var me=e.domElement;if(e.object.isPerspectiveCamera){var Re=e.object.position;d.copy(Re).sub(e.target);var be=d.length();be*=Math.tan(e.object.fov/2*Math.PI/180),se(2*Z*be/me.clientHeight,e.object.matrix),ue(2*ne*be/me.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(se(Z*(e.object.right-e.object.left)/e.object.zoom/me.clientWidth,e.object.matrix),ue(ne*(e.object.top-e.object.bottom)/e.object.zoom/me.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}})();function Q(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(),P=!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(),P=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function N(d){A.set(d.clientX,d.clientY)}function k(d){m.set(d.clientX,d.clientY)}function U(d){T.set(d.clientX,d.clientY)}function Y(d){S.set(d.clientX,d.clientY),C.subVectors(S,A).multiplyScalar(e.rotateSpeed);var B=e.domElement;R(2*Math.PI*C.x/B.clientHeight),J(2*Math.PI*C.y/B.clientHeight),A.copy(S),e.update()}function oe(d){O.set(d.clientX,d.clientY),_.subVectors(O,m),_.y>0?Q(H()):_.y<0&&F(H()),m.copy(O),e.update()}function q(d){b.set(d.clientX,d.clientY),x.subVectors(b,T).multiplyScalar(e.panSpeed),$(x.x,x.y),T.copy(b),e.update()}function V(d){d.deltaY<0?F(H()):d.deltaY>0&&Q(H()),e.update()}function te(d){var B=!1;switch(d.keyCode){case e.keys.UP:$(0,e.keyPanSpeed),B=!0;break;case e.keys.BOTTOM:$(0,-e.keyPanSpeed),B=!0;break;case e.keys.LEFT:$(e.keyPanSpeed,0),B=!0;break;case e.keys.RIGHT:$(-e.keyPanSpeed,0),B=!0;break}B&&(d.preventDefault(),e.update())}function G(d){if(d.touches.length==1)A.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);A.set(B,Z)}}function j(d){if(d.touches.length==1)T.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);T.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,ne=Math.sqrt(B*B+Z*Z);m.set(0,ne)}function ae(d){e.enableZoom&&D(d),e.enablePan&&j(d)}function X(d){e.enableZoom&&D(d),e.enableRotate&&G(d)}function K(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)}C.subVectors(S,A).multiplyScalar(e.rotateSpeed);var ne=e.domElement;R(2*Math.PI*C.x/ne.clientHeight),J(2*Math.PI*C.y/ne.clientHeight),A.copy(S)}function Se(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)}x.subVectors(b,T).multiplyScalar(e.panSpeed),$(x.x,x.y),T.copy(b)}function Pe(d){var B=d.touches[0].pageX-d.touches[1].pageX,Z=d.touches[0].pageY-d.touches[1].pageY,ne=Math.sqrt(B*B+Z*Z);O.set(0,ne),_.set(0,Math.pow(O.y/m.y,e.zoomSpeed)),Q(_.y),m.copy(O)}function Me(d){e.enableZoom&&Pe(d),e.enablePan&&Se(d)}function _e(d){e.enableZoom&&Pe(d),e.enableRotate&&K(d)}function xe(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",ce,!1),document.addEventListener("mouseup",pe,!1),e.dispatchEvent(t))}}function ce(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;oe(d);break;case s.PAN:if(e.enablePan===!1)return;q(d);break}}function pe(d){e.enabled!==!1&&(document.removeEventListener("mousemove",ce,!1),document.removeEventListener("mouseup",pe,!1),e.dispatchEvent(o),l=s.NONE)}function Be(d){e.enabled===!1||e.enableZoom===!1||l!==s.NONE&&l!==s.ROTATE||(d.preventDefault(),d.stopPropagation(),e.dispatchEvent(t),V(d),e.dispatchEvent(o))}function Ue(d){e.enabled===!1||e.enableKeys===!1||e.enablePan===!1||te(d)}function Oe(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;j(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;ae(d),l=s.TOUCH_DOLLY_PAN;break;case I.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;X(d),l=s.TOUCH_DOLLY_ROTATE;break;default:l=s.NONE}break;default:l=s.NONE}l!==s.NONE&&e.dispatchEvent(t)}}function le(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;Se(d),e.update();break;case s.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Me(d),e.update();break;case s.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;_e(d),e.update();break;default:l=s.NONE}}function We(d){e.enabled!==!1&&(e.dispatchEvent(o),l=s.NONE)}function Xe(d){e.enabled!==!1&&d.preventDefault()}e.domElement.addEventListener("contextmenu",Xe,!1),e.domElement.addEventListener("mousedown",xe,!1),e.domElement.addEventListener("wheel",Be,!1),e.domElement.addEventListener("touchstart",Oe,!1),e.domElement.addEventListener("touchend",We,!1),e.domElement.addEventListener("touchmove",le,!1),e.domElement.addEventListener("keydown",Ue,!1),e.domElement.tabIndex===-1&&(e.domElement.tabIndex=0),this.update()};Fe.prototype=Object.create(I.EventDispatcher.prototype);Fe.prototype.constructor=Fe;var xt=function(c,a){Fe.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};xt.prototype=Object.create(I.EventDispatcher.prototype);xt.prototype.constructor=xt;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 ot=function(c){Te.call(this,c)};ot.prototype=Object.create(Te.prototype);ot.prototype.constructor=ot;var Wt=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(T,b){a=T,e=b,n=a/2,t=e/2,l.style.width=T+"px",l.style.height=b+"px",h.style.width=T+"px",h.style.height=b+"px"};function g(T){return Math.abs(T)<1e-10?0:T}function y(T){var b=T.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(T,b){var x=T.elements,m="matrix3d("+g(x[0])+","+g(x[1])+","+g(x[2])+","+g(x[3])+","+g(-x[4])+","+g(-x[5])+","+g(-x[6])+","+g(-x[7])+","+g(x[8])+","+g(x[9])+","+g(x[10])+","+g(x[11])+","+g(x[12])+","+g(x[13])+","+g(x[14])+","+g(x[15])+")";return f?"translate(-50%,-50%)translate("+n+"px,"+t+"px)"+b+m:"translate(-50%,-50%)"+m}function P(T,b,x,m){if(T instanceof Te){T.onBeforeRender(c,b,x);var O;T instanceof ot?(o.copy(x.matrixWorldInverse),o.transpose(),o.copyPosition(T.matrixWorld),o.scale(T.scale),o.elements[3]=0,o.elements[7]=0,o.elements[11]=0,o.elements[15]=1,O=w(o,m)):O=w(T.matrixWorld,m);var _=T.element,W=s.objects.get(T);if(W===void 0||W.style!==O){_.style.WebkitTransform=O,_.style.transform=O;var H={style:O};f&&(H.distanceToCameraSquared=A(x,T)),s.objects.set(T,H)}_.style.display=T.visible?"":"none",_.parentNode!==h&&h.appendChild(_),T.onAfterRender(c,b,x)}for(var R=0,J=T.children.length;R<J;R++)P(T.children[R],b,x,m)}var A=(function(){var T=new I.Vector3,b=new I.Vector3;return function(x,m){return T.setFromMatrixPosition(x.matrixWorld),b.setFromMatrixPosition(m.matrixWorld),T.distanceToSquared(b)}})();function S(T){var b=[];return T.traverse(function(x){x instanceof Te&&b.push(x)}),b}function C(T){for(var b=S(T).sort(function(_,W){var H=s.objects.get(_).distanceToCameraSquared,R=s.objects.get(W).distanceToCameraSquared;return H-R}),x=b.length,m=0,O=b.length;m<O;m++)b[m].element.style.zIndex=x-m}this.render=function(T,b){var x=b.projectionMatrix.elements[5]*t;if(s.camera.fov!==x&&(b.isPerspectiveCamera?(l.style.WebkitPerspective=x+"px",l.style.perspective=x+"px"):(l.style.WebkitPerspective="",l.style.perspective=""),s.camera.fov=x),T.autoUpdate===!0&&T.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("+x+")translate("+g(m)+"px,"+g(O)+"px)"+y(b.matrixWorldInverse):"translateZ("+x+"px)"+y(b.matrixWorldInverse),W=_+"translate("+n+"px,"+t+"px)";s.camera.style!==W&&!f&&(h.style.WebkitTransform=W,h.style.transform=W,s.camera.style=W),P(T,T,b,_),f&&C(T)}};function Ht(c,a,e){var n=a.getBoundingClientRect(),t=n.top,o=n.left,s=n.width,l=n.height;return new v.Vector2((c.x-o)/s*2-1,-(c.y-t)/l*2+1)}var Xt=(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,P=new v.BufferAttribute(new Float32Array(w*3),3),A=new v.BufferAttribute(new Float32Array(w*3),3),S=[],C=[];new v.Vector3;var T=new v.Vector3,b=[],x=[],m=[],O=y*s,_=y*s+1;W(),R(),H(),J(),ue(),se();function W(){for(var F=[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)],N=0;N<8;N++)S.push([]),C.push([]);for(var k=Math.PI/2,U=new v.Vector3(h,f,g),Y=0;Y<=s;Y++){var oe=Y/s,q=oe*k,V=Math.cos(q),te=Math.sin(q);if(Y==s){T.set(0,1,0);var G=T.clone().multiplyScalar(o).add(U);S[0].push(G),b.push(G);var j=T.clone();C[0].push(j),x.push(j);continue}for(var D=0;D<=s;D++){var ae=D/s,X=ae*k;T.x=V*Math.cos(X),T.y=te,T.z=V*Math.sin(X);var G=T.clone().multiplyScalar(o).add(U);S[0].push(G),b.push(G);var j=T.clone().normalize();C[0].push(j),x.push(j)}}for(var K=1;K<8;K++)for(var N=0;N<S[0].length;N++){var G=S[0][N].clone().multiply(F[K]);S[K].push(G),b.push(G);var j=C[0][N].clone().multiply(F[K]);C[K].push(j),x.push(j)}}function H(){for(var F=[!0,!1,!0,!1,!1,!0,!1,!0],N=y*(s-1),k=0;k<8;k++){for(var U=_*k,Y=0;Y<s-1;Y++)for(var oe=Y*y,q=(Y+1)*y,V=0;V<s;V++){var te=V+1,G=U+oe+V,j=U+oe+te,D=U+q+V,ae=U+q+te;F[k]?(m.push(G),m.push(D),m.push(j),m.push(j),m.push(D),m.push(ae)):(m.push(G),m.push(j),m.push(D),m.push(j),m.push(ae),m.push(D))}for(var V=0;V<s;V++){var G=U+N+V,j=U+N+V+1,D=U+O;F[k]?(m.push(G),m.push(D),m.push(j)):(m.push(G),m.push(j),m.push(D))}}}function R(){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 J(){for(var F=0;F<4;F++)for(var N=F*_,k=4*_+N,U=(F&1)===1,Y=0;Y<s;Y++){var oe=Y+1,q=N+Y,V=N+oe,te=k+Y,G=k+oe;U?(m.push(q),m.push(te),m.push(V),m.push(V),m.push(te),m.push(G)):(m.push(q),m.push(V),m.push(te),m.push(V),m.push(G),m.push(te))}}function se(){for(var F=[0,2,4,6],N=[1,3,5,7],k=0;k<4;k++)for(var U=_*F[k],Y=_*N[k],oe=1>=k,q=0;q<s;q++){var V=q*y,te=(q+1)*y,G=U+V,j=U+te,D=Y+V,ae=Y+te;oe?(m.push(G),m.push(D),m.push(j),m.push(j),m.push(D),m.push(ae)):(m.push(G),m.push(j),m.push(D),m.push(j),m.push(ae),m.push(D))}}function ue(){for(var F=s-1,N=[0,1,4,5],k=[3,2,7,6],U=[0,1,1,0],Y=0;Y<4;Y++)for(var oe=N[Y]*_,q=k[Y]*_,V=0;V<=F;V++){var te=oe+s+V*y,G=oe+(V!=F?s+(V+1)*y:_-1),j=q+s+V*y,D=q+(V!=F?s+(V+1)*y:_-1);U[Y]?(m.push(te),m.push(j),m.push(G),m.push(G),m.push(j),m.push(D)):(m.push(te),m.push(G),m.push(j),m.push(G),m.push(D),m.push(j))}}for(var $=0,Q=0;Q<b.length;Q++)P.setXYZ($,b[Q].x,b[Q].y,b[Q].z),A.setXYZ($,x[Q].x,x[Q].y,x[Q].z),$++;return l.setIndex(new v.BufferAttribute(new Uint16Array(m),1)),l.setAttribute("position",P),l.setAttribute("normal",A),l}return a})(v.BufferGeometry);function Ge(c,a){return typeof c!="number"||typeof a!="number"?!1:Math.abs(c-a)<.001}function He(c,a,e,n){n===void 0&&(n=function(o){return o});var t=n(e);return c*(1-t)+a*t}var ie=Number((Math.PI/2).toFixed(5));function kn(c,a,e){var n=new v.Shape;return n.moveTo(e,0),n.lineTo(c-e,0),n.absarc(c-e,e,e,-ie,0,!1),n.lineTo(c,a-e),n.absarc(c-e,a-e,e,0,ie,!1),n.lineTo(e,a),n.absarc(e,a-e,e,ie,Math.PI,!1),n.lineTo(0,e),n.absarc(e,e,e,Math.PI,Math.PI*1.5,!1),n}var Ye=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},nt=function(c){var a=new v.PlaneGeometry(5,5),e=new v.MeshBasicMaterial({transparent:!0,opacity:0}),n=new v.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(-ie),n.add(o),n},Ln=(function(c){de(a,c);function a(e,n){var t=c.call(this,e)||this;t.camera=new Ie.Camera(90),t.scene=new v.Scene,t.renderer=new v.WebGLRenderer({antialias:!0,alpha:!0}),t.css3drenderer=new Wt,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 Xt(8,8,8,.5,20),new v.MeshPhongMaterial({color:16777215})),t.faces=new v.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,P=w.longitude,A=w.latitude;t.five.setState({longitude:P,latitude:A},!0),t.updateArrows({longitude:P,latitude:A})}else if(t.spherical&&(!Ge(t.spherical.pi,(h=t.controls)===null||h===void 0?void 0:h.getPolarAngle())||!Ge(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 S=t.camera.pose,P=S.longitude,A=S.latitude;t.five.setState({longitude:P,latitude:A},!0),t.updateArrows({longitude:P,latitude:A})}else t.spherical=null},t.onTapGesture=function(l){var h=l.pointers[0].clientX,f=l.pointers[0].clientY,g=Ht({x:h,y:f},t.wrapper),y=new v.Raycaster;y.setFromCamera(g,t.camera);var w=y.intersectObjects(t.faces.children,!1)[0];if(w){var P=w.object.userData,A=P.longitude,S=P.latitude;t.orient({longitude:A,latitude:S})}},t.onFiveWantsGesture=function(){if(t.spherical)return!1},t.onFiveModeChange=function(l){t.controls&&(t.controls.maxPolarAngle=l==="Topview"?0:ie)},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 v.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=Ht({x:l.clientX,y:l.clientY},t.wrapper),f=new v.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=z({fixedLongitude:0,orthoView:!0},n==null?void 0:n.config);return t._config=s,t.state.enabled&&t._enable({userAction:!1}),t.mc=new yt.Manager(t.wrapper),t.mc.add(new yt.Tap({interval:410})),t.mc.add(new yt.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:`
|
|
356
|
+
`;return function(){var E=new Error("get-stack-trace"),_=E&&E.stack?E.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 M;typeof Object.assign!="function"?M=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 E=arguments[p];if(E!==n&&E!==null)for(var _ in E)E.hasOwnProperty(_)&&(u[_]=E[_])}return u}:M=Object.assign;var S=T(function(i,u,p){for(var E=Object.keys(u),_=0;_<E.length;)(!p||p&&i[E[_]]===n)&&(i[E[_]]=u[E[_]]),_++;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,E;E=r.prototype=Object.create(p),E.constructor=r,E._super=p,u&&M(E,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){P(X(i),function(p){r.addEventListener(p,u,!1)})}function x(r,i,u){P(X(i),function(p){r.removeEventListener(p,u,!1)})}function V(r,i){for(;r;){if(r==i)return!0;r=r.parentNode}return!1}function R(r,i){return r.indexOf(i)>-1}function X(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 se(r,i,u){for(var p=[],E=[],_=0;_<r.length;){var k=r[_][i];Q(E,k)<0&&p.push(r[_]),E[_]=k,_++}return p=p.sort(function(fe,te){return fe[i]>te[i]}),p}function W(r,i){for(var u,p,E=i[0].toUpperCase()+i.slice(1),_=0;_<t.length;){if(u=t[_],p=u?u+E: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=W(f,"PointerEvent")!==n,ae=N&&L.test(navigator.userAgent),J="touch",j="pen",ne="mouse",H="kinect",G=25,B=1,le=2,Z=4,$=8,Se=1,Pe=2,xe=4,Oe=8,Me=16,ce=Pe|xe,ve=Oe|Me,Be=ce|ve,Ue=["x","y"],_e=["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(p){A(r.options.enable,[r])&&u.handler(p)},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(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 We(r){var i,u=r.options.inputClass;return u?i=u:Y?i=lt:ae?i=Ze:N?i=ut:i=Ke,new i(r,Xe)}function Xe(r,i,u){var p=u.pointers.length,E=u.changedPointers.length,_=i&B&&p-E===0,k=i&(Z|$)&&p-E===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,E=p.length;u.firstInput||(u.firstInput=re(i)),E>1&&!u.firstMultiple?u.firstMultiple=re(i):E===1&&(u.firstMultiple=!1);var _=u.firstInput,k=u.firstMultiple,ie=k?k.center:_.center,fe=i.center=me(p);i.timeStamp=c(),i.deltaTime=i.timeStamp-_.timeStamp,i.angle=st(ie,fe),i.distance=qe(ie,fe),U(u,i),i.offsetDirection=be(i.deltaX,i.deltaY);var te=Ve(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=k?Jt(k.pointers,p):1,i.rotation=k?Qt(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 ye=r.element;V(i.srcEvent.target,ye)&&(ye=i.srcEvent.target),i.target=ye}function U(r,i){var u=i.center,p=r.offsetDelta||{},E=r.prevDelta||{},_=r.prevInput||{};(i.eventType===B||_.eventType===Z)&&(E=r.prevDelta={x:_.deltaX||0,y:_.deltaY||0},p=r.offsetDelta={x:u.x,y:u.y}),i.deltaX=E.x+(u.x-p.x),i.deltaY=E.y+(u.y-p.y)}function ee(r,i){var u=r.lastInterval||i,p=i.timeStamp-u.timeStamp,E,_,k,ie;if(i.eventType!=$&&(p>G||u.velocity===n)){var fe=i.deltaX-u.deltaX,te=i.deltaY-u.deltaY,ye=Ve(p,fe,te);_=ye.x,k=ye.y,E=h(ye.x)>h(ye.y)?ye.x:ye.y,ie=be(fe,te),r.lastInterval=i}else E=u.velocity,_=u.velocityX,k=u.velocityY,ie=u.direction;i.velocity=E,i.velocityX=_,i.velocityY=k,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:c(),pointers:i,center:me(i),deltaX:r.deltaX,deltaY:r.deltaY}}function me(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,E=0;E<i;)u+=r[E].clientX,p+=r[E].clientY,E++;return{x:l(u/i),y:l(p/i)}}function Ve(r,i,u){return{x:i/r||0,y:u/r||0}}function be(r,i){return r===i?Se:h(r)>=h(i)?r<0?Pe:xe:i<0?Oe:Me}function qe(r,i,u){u||(u=Ue);var p=i[u[0]]-r[u[0]],E=i[u[1]]-r[u[1]];return Math.sqrt(p*p+E*E)}function st(r,i,u){u||(u=Ue);var p=i[u[0]]-r[u[0]],E=i[u[1]]-r[u[1]];return Math.atan2(E,p)*180/Math.PI}function Qt(r,i){return st(i[1],i[0],_e)+st(r[1],r[0],_e)}function Jt(r,i){return qe(i[0],i[1],_e)/qe(r[0],r[1],_e)}var $t={mousedown:B,mousemove:le,mouseup:Z},en="mousedown",tn="mousemove mouseup";function Ke(){this.evEl=en,this.evWin=tn,this.pressed=!1,ue.apply(this,arguments)}b(Ke,ue,{handler:function(i){var u=$t[i.type];u&B&&(i.button===0||i.button===2)&&(this.pressed=!0),u&le&&i.which!==1&&(u=Z),this.pressed&&(u&Z&&(this.pressed=!1),this.callback(this.manager,u,{pointers:[i],changedPointers:[i],pointerType:ne,srcEvent:i}))}});var Ot={pointerdown:B,pointermove:le,pointerup:Z,pointercancel:$,pointerout:$},nn={2:J,3:j,4:ne,5:H},_t="pointerdown",Ct="pointermove pointerup pointercancel";f.MSPointerEvent&&!f.PointerEvent&&(_t="MSPointerDown",Ct="MSPointerMove MSPointerUp MSPointerCancel");function lt(){this.evEl=_t,this.evWin=Ct,ue.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}b(lt,ue,{handler:function(i){var u=this.store,p=!1,E=!1,_=i.type.toLowerCase().replace("ms",""),k=Ot[_],ie=nn[i.pointerType]||i.pointerType,fe=ie==J,te=Q(u,i.pointerId,"pointerId");k&B&&(i.button===0||i.button===2||fe)?te<0&&(u.push(i),te=u.length-1):k&(Z|$)?p=!0:!fe&&i.buttons===0&&(p=!0,E=!0,k=Ot.pointerup),!(te<0)&&(E||(u[te]=i),this.callback(this.manager,k,{pointers:u,changedPointers:[i],pointerType:ie,srcEvent:u[te]}),p&&u.splice(te,1))}});var rn={touchstart:B,touchmove:le,touchend:Z,touchcancel:$},an="touchstart",on="touchstart touchmove touchend touchcancel";function Lt(){this.evTarget=an,this.evWin=on,this.started=!1,ue.apply(this,arguments)}b(Lt,ue,{handler:function(i){var u=rn[i.type];if(u===B&&(this.started=!0),!!this.started){var p=sn.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 sn(r,i){var u=q(r.touches),p=q(r.changedTouches);return i&(Z|$)&&(u=se(u.concat(p),"identifier")),[u,p]}var ln={touchstart:B,touchmove:le,touchend:Z,touchcancel:$},un="touchstart touchmove touchend touchcancel";function Ze(){this.evTarget=un,this.targetIds={},ue.apply(this,arguments)}b(Ze,ue,{handler:function(i){var u=ln[i.type],p=cn.call(this,i,u);p&&this.callback(this.manager,u,{pointers:p[0],changedPointers:p[1],pointerType:J,srcEvent:i})}});function cn(r,i){var u=q(r.touches),p=this.targetIds;if(i&(B|le)&&u.length===1)return p[u[0].identifier]=!0,[u,u];var E,_,k=q(r.changedTouches),ie=[],fe=this.target;if(_=u.filter(function(te){return V(te.target,fe)}),i===B)for(E=0;E<_.length;)p[_[E].identifier]=!0,E++;for(E=0;E<k.length;)p[k[E].identifier]&&ie.push(k[E]),i&(Z|$)&&delete p[k[E].identifier],E++;if(ie.length)return[se(_.concat(ie),"identifier"),ie]}var fn=2500,Ft=25;function ut(){ue.apply(this,arguments);var r=y(this.handler,this);this.touch=new Ze(this.manager,r),this.mouse=new Ke(this.manager,r),this.primaryTouch=null,this.lastTouches=[]}b(ut,ue,{handler:function(i,u,p){var E=p.pointerType==J,_=p.pointerType==ne;if(!(_&&p.sourceCapabilities&&p.sourceCapabilities.firesTouchEvents)){if(E)hn.call(this,u,p);else if(_&&dn.call(this,p))return;this.callback(i,u,p)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function hn(r,i){r&B?(this.primaryTouch=i.changedPointers[0].identifier,It.call(this,i)):r&(Z|$)&&It.call(this,i)}function It(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,E=function(){var _=p.indexOf(u);_>-1&&p.splice(_,1)};setTimeout(E,fn)}}function dn(r){for(var i=r.srcEvent.clientX,u=r.srcEvent.clientY,p=0;p<this.lastTouches.length;p++){var E=this.lastTouches[p],_=Math.abs(i-E.x),k=Math.abs(u-E.y);if(_<=Ft&&k<=Ft)return!0}return!1}var Dt=a?W(a.style,"touchAction"):n,Nt=Dt!==n,kt="compute",Bt="auto",ct="manipulation",Ce="none",Re="pan-x",je="pan-y",Qe=pn();function ft(r,i){this.manager=r,this.set(i)}ft.prototype={set:function(r){r==kt&&(r=this.compute()),Nt&&this.manager.element.style&&Qe[r]&&(this.manager.element.style[Dt]=r),this.actions=r.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var r=[];return P(this.manager.recognizers,function(i){A(i.options.enable,[i])&&(r=r.concat(i.getTouchAction()))}),vn(r.join(" "))},preventDefaults:function(r){var i=r.srcEvent,u=r.offsetDirection;if(this.manager.session.prevented){i.preventDefault();return}var p=this.actions,E=R(p,Ce)&&!Qe[Ce],_=R(p,je)&&!Qe[je],k=R(p,Re)&&!Qe[Re];if(E){var ie=r.pointers.length===1,fe=r.distance<2,te=r.deltaTime<250;if(ie&&fe&&te)return}if(!(k&&_)&&(E||_&&u&ce||k&&u&ve))return this.preventSrc(i)},preventSrc:function(r){this.manager.session.prevented=!0,r.preventDefault()}};function vn(r){if(R(r,Ce))return Ce;var i=R(r,Re),u=R(r,je);return i&&u?Ce:i||u?i?Re:je:R(r,ct)?ct:Bt}function pn(){if(!Nt)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 Je=1,he=2,De=4,Ae=8,we=Ae,ze=16,ge=32;function Ee(r){this.options=M({},this.defaults,r||{}),this.id=D(),this.manager=null,this.options.enable=m(this.options.enable,!0),this.state=Je,this.simultaneous={},this.requireFail=[]}Ee.prototype={defaults:{},set:function(r){return M(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=$e(r,this),i[r.id]||(i[r.id]=r,r.recognizeWith(this)),this},dropRecognizeWith:function(r){return w(r,"dropRecognizeWith",this)?this:(r=$e(r,this),delete this.simultaneous[r.id],this)},requireFailure:function(r){if(w(r,"requireFailure",this))return this;var i=this.requireFail;return r=$e(r,this),Q(i,r)===-1&&(i.push(r),r.requireFailure(this)),this},dropRequireFailure:function(r){if(w(r,"dropRequireFailure",this))return this;r=$e(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(E){i.manager.emit(E,r)}u<Ae&&p(i.options.event+Ut(u)),p(i.options.event),r.additionalEvent&&p(r.additionalEvent),u>=Ae&&p(i.options.event+Ut(u))},tryEmit:function(r){if(this.canEmit())return this.emit(r);this.state=ge},canEmit:function(){for(var r=0;r<this.requireFail.length;){if(!(this.requireFail[r].state&(ge|Je)))return!1;r++}return!0},recognize:function(r){var i=M({},r);if(!A(this.options.enable,[this,i])){this.reset(),this.state=ge;return}this.state&(we|ze|ge)&&(this.state=Je),this.state=this.process(i),this.state&(he|De|Ae|ze)&&this.tryEmit(i)},process:function(r){},getTouchAction:function(){},reset:function(){}};function Ut(r){return r&ze?"cancel":r&Ae?"end":r&De?"move":r&he?"start":""}function Vt(r){return r==Me?"down":r==Oe?"up":r==Pe?"left":r==xe?"right":""}function $e(r,i){var u=i.manager;return u?u.get(r):r}function pe(){Ee.apply(this,arguments)}b(pe,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&(he|De),E=this.attrTest(r);return p&&(u&$||!E)?i|ze:p||E?u&Z?i|Ae:i&he?i|De:he:ge}});function et(){pe.apply(this,arguments),this.pX=null,this.pY=null}b(et,pe,{defaults:{event:"pan",threshold:10,pointers:1,direction:Be},getTouchAction:function(){var r=this.options.direction,i=[];return r&ce&&i.push(je),r&ve&&i.push(Re),i},directionTest:function(r){var i=this.options,u=!0,p=r.distance,E=r.direction,_=r.deltaX,k=r.deltaY;return E&i.direction||(i.direction&ce?(E=_===0?Se:_<0?Pe:xe,u=_!=this.pX,p=Math.abs(r.deltaX)):(E=k===0?Se:k<0?Oe:Me,u=k!=this.pY,p=Math.abs(r.deltaY))),r.direction=E,u&&p>i.threshold&&E&i.direction},attrTest:function(r){return pe.prototype.attrTest.call(this,r)&&(this.state&he||!(this.state&he)&&this.directionTest(r))},emit:function(r){this.pX=r.deltaX,this.pY=r.deltaY;var i=Vt(r.direction);i&&(r.additionalEvent=this.options.event+i),this._super.emit.call(this,r)}});function ht(){pe.apply(this,arguments)}b(ht,pe,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Ce]},attrTest:function(r){return this._super.attrTest.call(this,r)&&(Math.abs(r.scale-1)>this.options.threshold||this.state&he)},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 dt(){Ee.apply(this,arguments),this._timer=null,this._input=null}b(dt,Ee,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Bt]},process:function(r){var i=this.options,u=r.pointers.length===i.pointers,p=r.distance<i.threshold,E=r.deltaTime>i.time;if(this._input=r,!p||!u||r.eventType&(Z|$)&&!E)this.reset();else if(r.eventType&B)this.reset(),this._timer=g(function(){this.state=we,this.tryEmit()},i.time,this);else if(r.eventType&Z)return we;return ge},reset:function(){clearTimeout(this._timer)},emit:function(r){this.state===we&&(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 vt(){pe.apply(this,arguments)}b(vt,pe,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Ce]},attrTest:function(r){return this._super.attrTest.call(this,r)&&(Math.abs(r.rotation)>this.options.threshold||this.state&he)}});function pt(){pe.apply(this,arguments)}b(pt,pe,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:ce|ve,pointers:1},getTouchAction:function(){return et.prototype.getTouchAction.call(this)},attrTest:function(r){var i=this.options.direction,u;return i&(ce|ve)?u=r.overallVelocity:i&ce?u=r.overallVelocityX:i&ve&&(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=Vt(r.offsetDirection);i&&this.manager.emit(this.options.event+i,r),this.manager.emit(this.options.event,r)}});function tt(){Ee.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}b(tt,Ee,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ct]},process:function(r){var i=this.options,u=r.pointers.length===i.pointers,p=r.distance<i.threshold,E=r.deltaTime<i.time;if(this.reset(),r.eventType&B&&this.count===0)return this.failTimeout();if(p&&E&&u){if(r.eventType!=Z)return this.failTimeout();var _=this.pTime?r.timeStamp-this.pTime<i.interval:!0,k=!this.pCenter||qe(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 ie=this.count%i.taps;if(ie===0)return this.hasRequireFailures()?(this._timer=g(function(){this.state=we,this.tryEmit()},i.interval,this),he):we}return ge},failTimeout:function(){return this._timer=g(function(){this.state=ge},this.options.interval,this),ge},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==we&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Ne(r,i){return i=i||{},i.recognizers=m(i.recognizers,Ne.defaults.preset),new mt(r,i)}Ne.VERSION="2.0.7",Ne.defaults={domEvents:!1,touchAction:kt,enable:!0,inputTarget:null,inputClass:null,preset:[[vt,{enable:!1}],[ht,{enable:!1},["rotate"]],[pt,{direction:ce}],[et,{direction:ce},["swipe"]],[tt],[tt,{event:"doubletap",taps:2},["tap"]],[dt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var mn=1,Rt=2;function mt(r,i){this.options=M({},Ne.defaults,i||{}),this.options.inputTarget=this.options.inputTarget||r,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=r,this.input=We(this),this.touchAction=new ft(this,this.options.touchAction),jt(this,!0),P(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)}mt.prototype={set:function(r){return M(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?Rt:mn},recognize:function(r){var i=this.session;if(!i.stopped){this.touchAction.preventDefaults(r);var u,p=this.recognizers,E=i.curRecognizer;(!E||E&&E.state&we)&&(E=i.curRecognizer=null);for(var _=0;_<p.length;)u=p[_],i.stopped!==Rt&&(!E||u==E||u.canRecognizeWith(E))?u.recognize(r):u.reset(),!E&&u.state&(he|De|Ae)&&(E=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 P(X(r),function(p){u[p]=u[p]||[],u[p].push(i)}),this}},off:function(r,i){if(r!==n){var u=this.handlers;return P(X(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&&gn(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&&jt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function jt(r,i){var u=r.element;if(u.style){var p;P(r.options.cssProps,function(E,_){p=W(u.style,_),i?(r.oldCssProps[p]=u.style[p],u.style[p]=E):u.style[p]=r.oldCssProps[p]||""}),i||(r.oldCssProps={})}}function gn(r,i){var u=o.createEvent("Event");u.initEvent(r,!0,!0),u.gesture=i,i.target.dispatchEvent(u)}return M(Ne,{INPUT_START:B,INPUT_MOVE:le,INPUT_END:Z,INPUT_CANCEL:$,STATE_POSSIBLE:Je,STATE_BEGAN:he,STATE_CHANGED:De,STATE_ENDED:Ae,STATE_RECOGNIZED:we,STATE_CANCELLED:ze,STATE_FAILED:ge,DIRECTION_NONE:Se,DIRECTION_LEFT:Pe,DIRECTION_RIGHT:xe,DIRECTION_UP:Oe,DIRECTION_DOWN:Me,DIRECTION_HORIZONTAL:ce,DIRECTION_VERTICAL:ve,DIRECTION_ALL:Be,Manager:mt,Input:ue,TouchAction:ft,TouchInput:Ze,MouseInput:Ke,PointerEventInput:lt,TouchMouseInput:ut,SingleTouchInput:Lt,Recognizer:Ee,AttrRecognizer:pe,Tap:tt,Pan:et,Swipe:pt,Pinch:ht,Rotate:vt,Press:dt,on:O,off:x,each:P,merge:C,extend:S,assign:M,inherit:b,bindFn:y,prefixed:W}),Ne})(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{}),ke=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(),re=new F.Vector3,me=new F.Quaternion;return function(){var be=e.object.position;return d.copy(be).sub(e.target),d.applyQuaternion(U),c.setFromVector3(d),e.autoRotate&&l===s.NONE&&X(V()),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(P,e.dampingFactor):e.target.add(P),d.setFromSpherical(c),d.applyQuaternion(ee),be.copy(e.target).add(d),e.object.lookAt(e.target),e.enableDamping===!0?(g.theta*=1-e.dampingFactor,g.phi*=1-e.dampingFactor,P.multiplyScalar(1-e.dampingFactor)):(g.set(0,0,0),P.set(0,0,0)),w=1,T||re.distanceToSquared(e.object.position)>h||8*(1-me.dot(e.object.quaternion))>h?(e.dispatchEvent(n),re.copy(e.object.position),me.copy(e.object.quaternion),T=!1,!0):!1}})(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",Xe,!1),e.domElement.removeEventListener("mousedown",Me,!1),e.domElement.removeEventListener("wheel",Be,!1),e.domElement.removeEventListener("touchstart",_e,!1),e.domElement.removeEventListener("touchend",We,!1),e.domElement.removeEventListener("touchmove",ue,!1),document.removeEventListener("mousemove",ce,!1),document.removeEventListener("mouseup",ve,!1),e.domElement.removeEventListener("keydown",Ue,!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,P=new F.Vector3,T=!1,M=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 V(){return 2*Math.PI/60/60*e.autoRotateSpeed}function R(){return Math.pow(.95,e.zoomSpeed)}function X(d){g.theta-=d}function Q(d){g.phi-=d}var q=(function(){var d=new F.Vector3;return function(ee,re){d.setFromMatrixColumn(re,0),d.multiplyScalar(-ee),P.add(d)}})(),se=(function(){var d=new F.Vector3;return function(ee,re){e.screenSpacePanning===!0?d.setFromMatrixColumn(re,1):(d.setFromMatrixColumn(re,0),d.crossVectors(e.object.up,d)),d.multiplyScalar(ee),P.add(d)}})(),W=(function(){var d=new F.Vector3;return function(ee,re){var me=e.domElement;if(e.object.isPerspectiveCamera){var Ve=e.object.position;d.copy(Ve).sub(e.target);var be=d.length();be*=Math.tan(e.object.fov/2*Math.PI/180),q(2*ee*be/me.clientHeight,e.object.matrix),se(2*re*be/me.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(q(ee*(e.object.right-e.object.left)/e.object.zoom/me.clientWidth,e.object.matrix),se(re*(e.object.top-e.object.bottom)/e.object.zoom/me.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){M.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,M).multiplyScalar(e.rotateSpeed);var U=e.domElement;X(2*Math.PI*C.x/U.clientHeight),Q(2*Math.PI*C.y/U.clientHeight),M.copy(S),e.update()}function ae(d){O.set(d.clientX,d.clientY),x.subVectors(O,m),x.y>0?K(R()):x.y<0&&D(R()),m.copy(O),e.update()}function J(d){y.set(d.clientX,d.clientY),A.subVectors(y,b).multiplyScalar(e.panSpeed),W(A.x,A.y),b.copy(y),e.update()}function j(d){d.deltaY<0?D(R()):d.deltaY>0&&K(R()),e.update()}function ne(d){var U=!1;switch(d.keyCode){case e.keys.UP:W(0,e.keyPanSpeed),U=!0;break;case e.keys.BOTTOM:W(0,-e.keyPanSpeed),U=!0;break;case e.keys.LEFT:W(e.keyPanSpeed,0),U=!0;break;case e.keys.RIGHT:W(-e.keyPanSpeed,0),U=!0;break}U&&(d.preventDefault(),e.update())}function H(d){if(d.touches.length==1)M.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);M.set(U,ee)}}function G(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,re=Math.sqrt(U*U+ee*ee);m.set(0,re)}function le(d){e.enableZoom&&B(d),e.enablePan&&G(d)}function Z(d){e.enableZoom&&B(d),e.enableRotate&&H(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,M).multiplyScalar(e.rotateSpeed);var re=e.domElement;X(2*Math.PI*C.x/re.clientHeight),Q(2*Math.PI*C.y/re.clientHeight),M.copy(S)}function Se(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),W(A.x,A.y),b.copy(y)}function Pe(d){var U=d.touches[0].pageX-d.touches[1].pageX,ee=d.touches[0].pageY-d.touches[1].pageY,re=Math.sqrt(U*U+ee*ee);O.set(0,re),x.set(0,Math.pow(O.y/m.y,e.zoomSpeed)),K(x.y),m.copy(O)}function xe(d){e.enableZoom&&Pe(d),e.enablePan&&Se(d)}function Oe(d){e.enableZoom&&Pe(d),e.enableRotate&&$(d)}function Me(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",ce,!1),document.addEventListener("mouseup",ve,!1),e.dispatchEvent(t))}}function ce(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;ae(d);break;case s.PAN:if(e.enablePan===!1)return;J(d);break}}function ve(d){e.enabled!==!1&&(document.removeEventListener("mousemove",ce,!1),document.removeEventListener("mouseup",ve,!1),e.dispatchEvent(a),l=s.NONE)}function Be(d){e.enabled===!1||e.enableZoom===!1||l!==s.NONE&&l!==s.ROTATE||(d.preventDefault(),d.stopPropagation(),e.dispatchEvent(t),j(d),e.dispatchEvent(a))}function Ue(d){e.enabled===!1||e.enableKeys===!1||e.enablePan===!1||ne(d)}function _e(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;H(d),l=s.TOUCH_ROTATE;break;case F.TOUCH.PAN:if(e.enablePan===!1)return;G(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;le(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 ue(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;Se(d),e.update();break;case s.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;xe(d),e.update();break;case s.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Oe(d),e.update();break;default:l=s.NONE}}function We(d){e.enabled!==!1&&(e.dispatchEvent(a),l=s.NONE)}function Xe(d){e.enabled!==!1&&d.preventDefault()}e.domElement.addEventListener("contextmenu",Xe,!1),e.domElement.addEventListener("mousedown",Me,!1),e.domElement.addEventListener("wheel",Be,!1),e.domElement.addEventListener("touchstart",_e,!1),e.domElement.addEventListener("touchend",We,!1),e.domElement.addEventListener("touchmove",ue,!1),e.domElement.addEventListener("keydown",Ue,!1),e.domElement.tabIndex===-1&&(e.domElement.tabIndex=0),this.update()};ke.prototype=Object.create(F.EventDispatcher.prototype);ke.prototype.constructor=ke;var Mt=function(f,o){ke.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};Mt.prototype=Object.create(F.EventDispatcher.prototype);Mt.prototype.constructor=Mt;var Te=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)})})};Te.prototype=Object.create(F.Object3D.prototype);Te.prototype.constructor=Te;var ot=function(f){Te.call(this,f)};ot.prototype=Object.create(Te.prototype);ot.prototype.constructor=ot;var Wt=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 P(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 Te){b.onBeforeRender(f,y,A);var O;b instanceof ot?(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=P(a,m)):O=P(b.matrixWorld,m);var x=b.element,V=s.objects.get(b);if(V===void 0||V.style!==O){x.style.WebkitTransform=O,x.style.transform=O;var R={style:O};c&&(R.distanceToCameraSquared=M(A,b)),s.objects.set(b,R)}x.style.display=b.visible?"":"none",x.parentNode!==h&&h.appendChild(x),b.onAfterRender(f,y,A)}for(var X=0,Q=b.children.length;X<Q;X++)T(b.children[X],y,A,m)}var M=(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 Te&&y.push(A)}),y}function C(b){for(var y=S(b).sort(function(x,V){var R=s.objects.get(x).distanceToCameraSquared,X=s.objects.get(V).distanceToCameraSquared;return R-X}),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),V=x+"translate("+n+"px,"+t+"px)";s.camera.style!==V&&!c&&(h.style.WebkitTransform=V,h.style.transform=V,s.camera.style=V),T(b,b,y,x),c&&C(b)}};function Yt(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 Xt=(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,P=w*s+1<<3,T=new v.BufferAttribute(new Float32Array(P*3),3),M=new v.BufferAttribute(new Float32Array(P*3),3),S=[],C=[];new v.Vector3;var b=new v.Vector3,y=[],A=[],m=[],O=w*s,x=w*s+1;V(),X(),R(),Q(),se(),q();function V(){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 ae=Y/s,J=ae*L,j=Math.cos(J),ne=Math.sin(J);if(Y==s){b.set(0,1,0);var H=b.clone().multiplyScalar(a).add(N);S[0].push(H),y.push(H);var G=b.clone();C[0].push(G),A.push(G);continue}for(var B=0;B<=s;B++){var le=B/s,Z=le*L;b.x=j*Math.cos(Z),b.y=ne,b.z=j*Math.sin(Z);var H=b.clone().multiplyScalar(a).add(N);S[0].push(H),y.push(H);var G=b.clone().normalize();C[0].push(G),A.push(G)}}for(var $=1;$<8;$++)for(var I=0;I<S[0].length;I++){var H=S[0][I].clone().multiply(D[$]);S[$].push(H),y.push(H);var G=C[0][I].clone().multiply(D[$]);C[$].push(G),A.push(G)}}function R(){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 ae=Y*w,J=(Y+1)*w,j=0;j<s;j++){var ne=j+1,H=N+ae+j,G=N+ae+ne,B=N+J+j,le=N+J+ne;D[L]?(m.push(H),m.push(B),m.push(G),m.push(G),m.push(B),m.push(le)):(m.push(H),m.push(G),m.push(B),m.push(G),m.push(le),m.push(B))}for(var j=0;j<s;j++){var H=N+I+j,G=N+I+j+1,B=N+O;D[L]?(m.push(H),m.push(B),m.push(G)):(m.push(H),m.push(G),m.push(B))}}}function X(){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 ae=Y+1,J=I+Y,j=I+ae,ne=L+Y,H=L+ae;N?(m.push(J),m.push(ne),m.push(j),m.push(j),m.push(ne),m.push(H)):(m.push(J),m.push(j),m.push(ne),m.push(j),m.push(H),m.push(ne))}}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],ae=1>=L,J=0;J<s;J++){var j=J*w,ne=(J+1)*w,H=N+j,G=N+ne,B=Y+j,le=Y+ne;ae?(m.push(H),m.push(B),m.push(G),m.push(G),m.push(B),m.push(le)):(m.push(H),m.push(G),m.push(B),m.push(G),m.push(le),m.push(B))}}function se(){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 ae=I[Y]*x,J=L[Y]*x,j=0;j<=D;j++){var ne=ae+s+j*w,H=ae+(j!=D?s+(j+1)*w:x-1),G=J+s+j*w,B=J+(j!=D?s+(j+1)*w:x-1);N[Y]?(m.push(ne),m.push(G),m.push(H),m.push(H),m.push(G),m.push(B)):(m.push(ne),m.push(H),m.push(G),m.push(H),m.push(B),m.push(G))}}for(var W=0,K=0;K<y.length;K++)T.setXYZ(W,y[K].x,y[K].y,y[K].z),M.setXYZ(W,A[K].x,A[K].y,A[K].z),W++;return l.setIndex(new v.BufferAttribute(new Uint16Array(m),1)),l.setAttribute("position",T),l.setAttribute("normal",M),l}return o})(v.BufferGeometry);function Ge(f,o){return typeof f!="number"||typeof o!="number"?!1:Math.abs(f-o)<.001}function Ye(f,o,e,n){n===void 0&&(n=function(a){return a});var t=n(e);return f*(1-t)+o*t}var oe=Number((Math.PI/2).toFixed(5));function In(f,o,e){var n=new v.Shape;return n.moveTo(e,0),n.lineTo(f-e,0),n.absarc(f-e,e,e,-oe,0,!1),n.lineTo(f,o-e),n.absarc(f-e,o-e,e,0,oe,!1),n.lineTo(e,o),n.absarc(e,o-e,e,oe,Math.PI,!1),n.lineTo(0,e),n.absarc(e,e,e,Math.PI,Math.PI*1.5,!1),n}var He=function(f){var o=document.createElement("div");o.innerText=f;var e=new Te(o);return e.name=f,e.scale.set(.3,.3,.3),o.style.pointerEvents="none",o.style.backfaceVisibility="hidden",e},nt=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 Te(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(-oe),n.add(a),n},Dn=(function(f){de(o,f);function o(e,n){var t=f.call(this,e)||this;t.camera=new Le.Camera(90),t.scene=new v.Scene,t.renderer=new v.WebGLRenderer({antialias:!0,alpha:!0}),t.css3drenderer=new Wt,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 Xt(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 P=t.camera.pose,T=P.longitude,M=P.latitude;t.five.setState({longitude:T,latitude:M},!0),t.updateArrows({longitude:T,latitude:M})}else if(t.spherical&&(!Ge(t.spherical.pi,(h=t.controls)===null||h===void 0?void 0:h.getPolarAngle())||!Ge(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,M=S.latitude;t.five.setState({longitude:T,latitude:M},!0),t.updateArrows({longitude:T,latitude:M})}else t.spherical=null},t.onTapGesture=function(l){var h=l.pointers[0].clientX,c=l.pointers[0].clientY,g=Yt({x:h,y:c},t.wrapper),w=new v.Raycaster;w.setFromCamera(g,t.camera);var P=w.intersectObjects(t.faces.children,!1)[0];if(P){var T=P.object.userData,M=T.longitude,S=T.latitude;t.orient({longitude:M,latitude:S})}},t.onFiveWantsGesture=function(){if(t.spherical)return!1},t.onFiveModeChange=function(l){t.controls&&(t.controls.maxPolarAngle=l==="Topview"?0:oe)},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=Yt({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=z({fixedLongitude:0,orthoView:!0},n==null?void 0:n.config);return t._config=s,t.state.enabled&&t._enable({userAction:!1}),t.mc=new yt.Manager(t.wrapper),t.mc.add(new yt.Tap({interval:410})),t.mc.add(new yt.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 z({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(e,n){var t=this.state;this.state=z(z({},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=nt("西");n.position.set(-19,0,0),e.add(n);var t=nt("东");t.position.set(19,0,0),e.add(t);var a=nt("北");a.position.set(0,0,-19),e.add(a);var s=nt("南");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:oe})},this.arrowLeft.onclick=function(){return e.orient({longitude:-oe,latitude:0})},this.arrowRight.onclick=function(){return e.orient({longitude:oe,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=Ye(.2,1,this.camera.pose.latitude/Math.PI*2,function(l){return l*l}),n=Ye(11,13,this.camera.pose.latitude/Math.PI*2,function(l){return l*l}),t=Ye(12,15,this.camera.pose.latitude/Math.PI*2,function(l){return l*l}),a=Ye(13,19,this.camera.pose.latitude/Math.PI*2,function(l){return l*l}),s=Ye(-.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=oe-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(oe-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 Ge(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 Ge(oe,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 Ge(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=In(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(He("前"));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(He("后")),a.userData={longitude:Math.PI,latitude:0};var s=new v.Mesh(n,new v.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));s.rotateY(oe),s.position.x=4.1,s.add(He("右")),s.userData={longitude:oe,latitude:0};var l=new v.Mesh(n,new v.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));l.rotateY(-oe),l.position.x=-4.1,l.add(He("左")),l.userData={longitude:-oe,latitude:0};var h=new v.Mesh(n,new v.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));h.rotateX(-oe),h.position.y=4.1,h.add(He("上")),h.userData={longitude:0,latitude:oe},this.faces.add(t,a,l,s,h)},o.prototype.initControls=function(){var e=this.controls=new ke(this.camera,this.renderer.domElement);e.enableZoom=!1,e.enableDamping=!0,e.enablePan=!1,e.maxPolarAngle=oe,e.dampingFactor=.15,e.rotateSpeed=.25},o.prototype.load=function(e){return Fe(this,void 0,void 0,function(){return Ie(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})(exports.BasePlugin.Controller),Nn=function(f,o){return new Dn(f,o)},kn=(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 Fe(t,void 0,void 0,function(){return Ie(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})(At.BasePlugin.Controller),Bn=function(f,o){return new kn(f,o)};new v.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);var bt=(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})(),Un=(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=z({},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 z({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(e,n){var t=this.state;this.state=z(z({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},o.prototype.load=function(e){return Fe(this,void 0,void 0,function(){return Ie(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 bt(n,t,a,s,l),c=new bt(n,t,a,s,l),g=new bt(n,t,a,s,l);if(this.trajectory&&this.trajectory.content.loadState==="READY"){for(var w=this.trajectory.content.data.positionArray,P=new Float32Array(w.length/3),T=0;T<P.length;T++)if(T===0)P[T]=0;else{var M=new v.Vector3(w[T-3],w[T-2],w[T-1]),S=new v.Vector3(w[T],w[T+1],w[T+2]);P[T]=S.distanceTo(M)+P[T-1]}this.totalDistance=P[P.length-1];for(var T=0;T<P.length;T++){for(var C=new v.Vector3(0,0,0),b=0,y=T-5;y<T+6;y++)y>=0&&y<P.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:P[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(z({},this.virualCamera.pose)));var a=this.playingState.keyframeIndex,s=0;this.cancelAnimation=Le.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(),P=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 M=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=P.clone().lerp(M,S);e.virualCamera.position.copy(C),e.virualCamera.lookAt(b),e.virualCamera.updateMatrixWorld(),e.virualCamera.updateMatrix(),e.virualCamera.computePose(),e.five.setState(z({},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})(exports.BasePlugin.Controller),Vn=function(f,o){return new Un(f,o)};function Ht(f,o,e){return f<o?o:f>e?e:f}var Rn=`
|
|
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
|
+
`,jn=`
|
|
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
|
+
`,zn=[1,5,2,6,3,7,4,8,9,13,10,14,11,15,12,16],wt=512,Et=512,rt=128,Gn=(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:Rn,fragmentShader:jn,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 Le.PanoCircleMesh({scale:1.5}),t.stop=function(){},t.drawLine=function(l,h){if(t.ctx){var c=(function(){var P,T=wt/16|0;return T*((P=zn[l])!==null&&P!==void 0?P:0)})(),g=(1-(h+l*150)%1200/1200)*(Et+rt),w=t.ctx.createLinearGradient(0,g-rt,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-rt,3,rt)}},t.anime=function(l){if(t.ctx&&t.startTime){t.ctx.clearRect(0,0,wt,Et);for(var h=0;h<16;h++)t.drawLine(h,l-t.startTime);var c=Ht((l-t.startTime)/1e3,0,1),g=Ht((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=z(z({},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=wt,t.canvas.height=Et,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 z({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(e,n){var t=this.state;this.state=z(z({},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=z(z({},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 Fe(this,void 0,void 0,function(){return Ie(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=Le.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})(At.BasePlugin.Controller),Yn=function(f,o){return new Gn(f,o)},St=(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(St.prototype,{isLineSegmentsGeometry:!0});var Tt={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
|
-
`},Mt=(function(c){de(a,c);function a(e){var n=c.call(this,{uniforms:v.UniformsUtils.clone(Tt.uniforms),vertexShader:Tt.vertexShader,fragmentShader:Tt.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})(v.ShaderMaterial);Object.assign(Mt.prototype,{isLineMaterial:!0});var qt=(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 St,t.material=n!==void 0?n:new Mt({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 v.Vector3,l=new v.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 P=new v.InstancedInterleavedBuffer(o,2,1);return e.setAttribute("instanceDistanceStart",new v.InterleavedBufferAttribute(P,1,0)),e.setAttribute("instanceDistanceEnd",new v.InterleavedBufferAttribute(P,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,P=new v.Vector4,A=new v.Vector4,S=new v.Vector4,C=new v.Vector3,T=new v.Matrix4,b=new v.Line3,x=new v.Vector3;t.at(1,S),S.w=1,S.applyMatrix4(o.matrixWorldInverse),S.applyMatrix4(s),S.multiplyScalar(1/S.w),S.x*=f.x/2,S.y*=f.y/2,S.z=0,C.copy(S);var m=this.matrixWorld;T.multiplyMatrices(o.matrixWorldInverse,m);for(var O=0,_=y.count;O<_;O++){P.fromBufferAttribute(y,O),A.fromBufferAttribute(w,O),P.w=1,A.w=1,P.applyMatrix4(T),A.applyMatrix4(T),P.applyMatrix4(s),A.applyMatrix4(s),P.multiplyScalar(1/P.w),A.multiplyScalar(1/A.w);var W=P.z<-1&&A.z<-1,H=P.z>1&&A.z>1;if(!(W||H)){P.x*=f.x/2,P.y*=f.y/2,A.x*=f.x/2,A.y*=f.y/2,b.start.copy(P),b.start.z=0,b.end.copy(A),b.end.z=0;var R=b.closestPointToPointParameter(C,!0);b.at(R,x);var J=v.MathUtils.lerp(P.z,A.z,R),se=J>=-1&&J<=1,ue=C.distanceTo(x)<g*.5;if(se&&ue){b.start.fromBufferAttribute(y,O),b.end.fromBufferAttribute(w,O),b.start.applyMatrix4(m),b.end.applyMatrix4(m);var $=new v.Vector3,Q=new v.Vector3;t.distanceSqToSegment(b.start,b.end,Q,$),n.push({point:Q,pointOnLine:$,distance:t.origin.distanceTo(Q),object:this,faceIndex:O})}}}},a})(v.Mesh);Object.assign(qt.prototype,{isLineSegments2:!0});var Kt=(function(c){de(a,c);function a(e,n){var t=c.call(this,e,n)||this;return t.type="Line2",t}return a})(qt);Object.assign(Kt.prototype,{isLine2:!0});var Zt=(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 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},a.prototype.copy=function(){return this},a})(St);Object.assign(Zt.prototype,{isLineGeometry:!0});var Yn=(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 v.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=z(z({},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 z({},this._config)},enumerable:!1,configurable:!0}),a.prototype.updateState=function(e,n){var t=this.state;this.state=z(z({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},a.prototype.load=function(e,n){return Ne(this,void 0,void 0,function(){var t,o=this;return ke(this,function(s){return this.clearAllPaths(),e.paths.forEach(function(l){var h,f,g=l.points.map(function(y){return new v.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 v.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,P={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,P);var A=this.data,S=new Map;return this.paths.forEach(function(C,T){S.set(T,C.config)}),this.data={paths:S},this.hooks.emit("dataChange",this.data,A),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?z({},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,P=h.waveFreq,A=(o=e.lineWidth)!==null&&o!==void 0?o:this._config.lineWidth,S=(s=e.color)!==null&&s!==void 0?s:this._config.color,C=function(x){var m=(x-(f-1)/2)*g,O=e.points.map(function(se,ue){var $=ue/(e.points.length-1),Q=n.getTangent($).normalize(),F=new v.Vector3().crossVectors(t.up,Q).normalize(),N=m*Math.abs((ue-e.points.length/2)/e.points.length-.5)*-1;return se.clone().addScaledVector(F,m+N).add(new v.Vector3(0,.02*(x%2===0?1:0),0))}),_=new v.CatmullRomCurve3(O),W=T.getPositions(_,y).positions,H=new Zt;H.setPositions(W);var R=new Mt({color:S,linewidth:A*(x%2===0?1:.5),transparent:!0,opacity:1});R.resolution.set(T.five.camera.resolution.x,T.five.camera.resolution.y),x===0?R.waveDir=1:x===1?R.waveDir=2:x===2?R.waveDir=0:x===3?R.waveDir=3:x===4&&(R.waveDir=1),R.waveAmp=w,R.waveFreq=P,Object.assign(R.uniforms,{time:{value:0},startOffset:{value:0}});var J=new Kt(H,R);J.computeLineDistances(),l.push(J),T.five.scene.add(J)},T=this,b=0;b<f;b++)C(b);return l},a.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:`
|
|
734
|
+
`},xt=(function(f){de(o,f);function o(e){var n=f.call(this,{uniforms:v.UniformsUtils.clone(Tt.uniforms),vertexShader:Tt.vertexShader,fragmentShader:Tt.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(xt.prototype,{isLineMaterial:!0});var qt=(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 St,t.material=n!==void 0?n:new xt({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 P=s.distanceTo(l);a[w]=w===0?0:a[w-1],a[w+1]=a[w]+P}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,P=l.attributes.instanceEnd,T=new v.Vector4,M=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),M.fromBufferAttribute(P,O),T.w=1,M.w=1,T.applyMatrix4(b),M.applyMatrix4(b),T.applyMatrix4(s),M.applyMatrix4(s),T.multiplyScalar(1/T.w),M.multiplyScalar(1/M.w);var V=T.z<-1&&M.z<-1,R=T.z>1&&M.z>1;if(!(V||R)){T.x*=c.x/2,T.y*=c.y/2,M.x*=c.x/2,M.y*=c.y/2,y.start.copy(T),y.start.z=0,y.end.copy(M),y.end.z=0;var X=y.closestPointToPointParameter(C,!0);y.at(X,A);var Q=v.MathUtils.lerp(T.z,M.z,X),q=Q>=-1&&Q<=1,se=C.distanceTo(A)<g*.5;if(q&&se){y.start.fromBufferAttribute(w,O),y.end.fromBufferAttribute(P,O),y.start.applyMatrix4(m),y.end.applyMatrix4(m);var W=new v.Vector3,K=new v.Vector3;t.distanceSqToSegment(y.start,y.end,K,W),n.push({point:K,pointOnLine:W,distance:t.origin.distanceTo(K),object:this,faceIndex:O})}}}},o})(v.Mesh);Object.assign(qt.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})(qt);Object.assign(Kt.prototype,{isLine2:!0});var Zt=(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})(St);Object.assign(Zt.prototype,{isLineGeometry:!0});var Hn=(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=z(z({},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 z({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(e,n){var t=this.state;this.state=z(z({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},o.prototype.load=function(e,n){return Fe(this,void 0,void 0,function(){var t,a=this;return Ie(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(),P=w.particles,T=w.particleGeometry,M=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),V=c.getLength();x.uniforms.totalLength.value=V;var R=new v.Mesh(O,x);R.visible=m,this.five.scene.add(R);var X={id:e.id,config:e,curve:c,lines:g,particles:P,particleGeometry:T,particleMaterial:M,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:R,subMeshGeometry:O,subMeshMaterial:x,subMeshColor:b,subMeshWidth:y,subMeshOpacity:A,animationId:null,enableSubMesh:m};this.paths.set(e.id,X);var Q=this.data,q=new Map;return this.paths.forEach(function(se,W){q.set(W,se.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?z({},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 P=w/s;t.push(l[h].x,l[h].y,l[h].z),a.push(P)}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,P=h.waveAmp,T=h.waveFreq,M=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,V=e.points.map(function(W,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 W.clone().addScaledVector(L,x+N).add(new v.Vector3(0,S+.02*(O%2===0?1:0),0))}),R=new v.CatmullRomCurve3(V),X=A.getPositions(R,w).positions,Q=new Zt;Q.setPositions(X);var q=new xt({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=P,q.waveFreq=T,Object.assign(q.uniforms,{time:{value:0},startOffset:{value:0},range:{value:M}});var se=new Kt(Q,q);se.computeLineDistances(),l.push(se),A.five.scene.add(se)},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=[],P=0,T=[0],M=1;M<l.length;M++)P+=l[M].distanceTo(l[M-1]),T.push(P);for(var S=P,M=0;M<l.length;M++){var C=l[M],b=M/(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[M]/S),w.push(T[M]/S);var x=C.clone().addScaledVector(A,m);h.push(x.x,x.y,x.z),c.push(1,T[M]/S),w.push(T[M]/S)}for(var M=0;M<l.length-1;M++){var V=M*2;g.push(V,V+1,V+2),g.push(V+1,V+3,V+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 P=w/a,T=Math.floor(P/c),M=(P-T*c)/c,S=0,C=M;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),P=(a-t.cycleStartTime)*l/w%1;if(t.isInitialAnimation){if(t.enableSubMesh&&P>=.2&&!t.subMeshUnfoldStarted&&(t.subMeshUnfoldStarted=!0),t.enableSubMesh&&t.subMeshUnfoldStarted&&t.subMeshUnfoldProgress<1){var T=a-t.lastUpdateTime,M=.5;t.subMeshUnfoldProgress=Math.min(1,t.subMeshUnfoldProgress+M*T),t.subMeshMaterial.uniforms.unfoldProgress.value=t.subMeshUnfoldProgress}P<t.lastAnimationProgress&&(!t.enableSubMesh||t.subMeshUnfoldProgress>=1)&&(t.isInitialAnimation=!1)}else t.enableSubMesh&&(t.subMeshMaterial.uniforms.unfoldProgress.value=1);if(t.lastAnimationProgress=P,t.lastUpdateTime=a,t.isInitialAnimation&&t.lines.forEach(function(R){R.material.uniforms.time.value=a,R.material.uniforms.animationProgress.value=P}),t.isInitialAnimation){var S=null,C=1/0;if(t.lines.forEach(function(R){for(var X=R.geometry,Q=X.attributes.instanceDistanceStart,q=X.attributes.instanceDistanceEnd,se=Q.count,W=0;W<se;W++){var K=Q.getX(W)/R.material.uniforms.totalLength.value,D=q.getX(W)/R.material.uniforms.totalLength.value;if(P>=K&&P<=D){var I=(P-K)/(D-K),L=new v.Vector3().fromBufferAttribute(X.attributes.instanceStart,W),N=new v.Vector3().fromBufferAttribute(X.attributes.instanceEnd,W),Y=new v.Vector3().lerpVectors(L,N,I),ae=Math.abs(P-(K+D)/2);ae<C&&(C=ae,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 V=y.age/y.life;V<.2?y.alpha=V/.2:V>.8?y.alpha=(1-V)/.2:y.alpha=1}}t.particleGeometry.attributes.position.needsUpdate=!0,t.particleMaterial.opacity=.6}t.enableSubMesh&&(t.subMeshMaterial.uniforms.animationProgress.value=P),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=Le.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})(At.BasePlugin.Controller),Wn=function(f,o){return new Hn(f,o)};exports.BackgroundPlugin=Bn;exports.CSS3DRenderer=Wt;exports.DynamicPathLinePlugin=Wn;exports.ItemMaskPlugin=Fn;exports.OrbitControls=ke;exports.OrientationPlugin=Nn;exports.PanoAnimePlugin=Yn;exports.RoundedBoxGeometry=Xt;exports.TrajectoryPlugin=Vn;
|