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