@realsee/five 6.7.0-alpha.22 → 6.7.0-alpha.24
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.AdaptiveLuminancePass.html +22 -0
- package/docs/classes/five.AnimationFrameLoop.html +1 -1
- package/docs/classes/five.BoundingMesh.html +1 -1
- package/docs/classes/five.EffectComposer.html +21 -0
- package/docs/classes/five.EyeDomeLightingPass.html +21 -0
- package/docs/classes/five.Five.html +78 -79
- package/docs/classes/five.FivePass.html +16 -18
- package/docs/classes/five.FiveRenderer.html +11 -0
- package/docs/classes/five.FullScreenQuad.html +3 -4
- package/docs/classes/five.Model.html +1 -1
- package/docs/classes/five.ModelScene.html +1 -1
- package/docs/classes/five.PBMContainer.html +1 -1
- package/docs/classes/five.PBMGroup.html +1 -1
- package/docs/classes/five.PBMMesh.html +1 -1
- package/docs/classes/five.PBMMeshMaterial.html +6 -7
- package/docs/classes/five.PBMPointCloud.html +1 -1
- package/docs/classes/five.PBMPointCloudMaterial.html +5 -6
- package/docs/classes/five.PBMSkinnedMesh.html +1 -1
- package/docs/classes/five.Parameter.html +44 -46
- package/docs/classes/five.Tile3D.html +1 -1
- package/docs/classes/five.TileNode.html +1 -1
- package/docs/classes/five.Tileset.html +1 -1
- package/docs/classes/five.TrajectoryNode.html +1 -1
- package/docs/classes/five.WorkResolvedObserver.html +1 -1
- 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/react.withFive.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/five.EventCallback.html +1 -1
- package/docs/interfaces/five.FiveInitArgs.html +3 -3
- package/docs/interfaces/five.LooseWorkWithExtrinsics.html +1 -1
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.PBMMaterial.html +1 -1
- package/docs/interfaces/five.PBMMeshMaterialParameters.html +2 -3
- package/docs/interfaces/five.PBMPointCloudMaterialParameters.html +2 -3
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ParameterMaterialValue.html +29 -31
- package/docs/interfaces/five.ParameterTilesetValue.html +15 -15
- package/docs/interfaces/five.ParameterValue.html +43 -45
- package/docs/interfaces/five.Pass.html +9 -0
- package/docs/interfaces/five.ResolvedParameterValue.html +43 -45
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ViewLayer.html +1 -1
- package/docs/interfaces/five.WorkCubeImage.html +1 -1
- package/docs/interfaces/five.WorkImage.html +1 -1
- package/docs/interfaces/five.WorkObserver.html +1 -1
- 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 +28 -27
- package/docs/interfaces/plugins.DynamicPathLinePluginType.Config.html +18 -18
- 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 +5 -3
- 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.ParseOptions.html +1 -1
- package/docs/types/five.PostProcessingType.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 +116 -59
- package/five/index.js +238 -184
- package/five/index.mjs +4035 -4413
- 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 +11 -4
- package/plugins/index.js +19 -17
- package/plugins/index.mjs +962 -922
- package/react/index.d.ts +1 -1
- package/react/index.js +2 -2
- package/react/index.mjs +2 -2
- package/shader-lib/index.js +3 -3
- package/shader-lib/index.mjs +3 -3
- 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 +19 -17
- package/umd/five-react.js +2 -2
- package/umd/five-shader-lib.js +3 -3
- 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 +238 -184
- package/vfx/index.js +2 -2
- package/vfx/index.mjs +2 -2
- package/vue/index.js +2 -2
- package/vue/index.mjs +2 -2
- package/work-downloader/index.js +2 -2
- package/work-downloader/index.mjs +2 -2
- package/docs/classes/five.Pass.html +0 -11
package/plugins/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated: 12/
|
|
5
|
-
* Version: 6.7.0-alpha.
|
|
4
|
+
* Generated: 12/8/2025
|
|
5
|
+
* Version: 6.7.0-alpha.24
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
* No amendment to or modification of this Agreement will be binding unless in
|
|
253
253
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
254
254
|
* Agreement and all related documents shall be drafted in English.
|
|
255
|
-
*/"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
255
|
+
*/"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Se=require("@realsee/five"),N=require("three"),At=require("@realsee/five/plugins");function yn(h){const s=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(s,e,n.get?n:{enumerable:!0,get:()=>h[e]})}}return s.default=h,Object.freeze(s)}const p=yn(N);function bn(h){return/^https?:\/\/|^\/\//.test(h)||/^data:/.test(h)}function wn(h,s){return bn(s)?s:"".concat(h).concat(s)}exports.BasePlugin=void 0;(function(h){var s=(function(){function e(n,t){this.hooks=new Se.Subscribe,this.staticPrefix="//vr-image-4.realsee-cdn.cn",this.five=n,t!=null&&t.staticPrefix&&(this.staticPrefix=t.staticPrefix)}return e.prototype.getCurrentState=function(){return this.state},e.prototype.absoluteUrl=function(n){return wn(this.staticPrefix,n)},e})();h.Controller=s})(exports.BasePlugin||(exports.BasePlugin={}));var Pt=function(h,s){return Pt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])},Pt(h,s)};function de(h,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");Pt(h,s);function e(){this.constructor=h}h.prototype=s===null?Object.create(s):(e.prototype=s.prototype,new e)}var j=function(){return j=Object.assign||function(s){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)&&(s[r]=e[r])}return s},j.apply(this,arguments)};function Fe(h,s,e,n){function t(r){return r instanceof e?r:new e(function(l){l(r)})}return new(e||(e=Promise))(function(r,l){function o(m){try{c(n.next(m))}catch(y){l(y)}}function d(m){try{c(n.throw(m))}catch(y){l(y)}}function c(m){m.done?r(m.value):t(m.value).then(o,d)}c((n=n.apply(h,s||[])).next())})}function Ie(h,s){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,t,r,l=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return l.next=o(0),l.throw=o(1),l.return=o(2),typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function o(c){return function(m){return d([c,m])}}function d(c){if(n)throw new TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(e=0)),e;)try{if(n=1,t&&(r=c[0]&2?t.return:c[0]?t.throw||((r=t.return)&&r.call(t),0):t.next)&&!(r=r.call(t,c[1])).done)return r;switch(t=0,r&&(c=[c[0]&2,r.value]),c[0]){case 0:case 1:r=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,t=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(r=e.trys,!(r=r.length>0&&r[r.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!r||c[1]>r[0]&&c[1]<r[3])){e.label=c[1];break}if(c[0]===6&&e.label<r[1]){e.label=r[1],r=c;break}if(r&&e.label<r[2]){e.label=r[2],e.ops.push(c);break}r[2]&&e.ops.pop(),e.trys.pop();continue}c=s.call(h,e)}catch(m){c=[6,m],t=0}finally{n=r=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function zt(h,s,e){if(e||arguments.length===2)for(var n=0,t=s.length,r;n<t;n++)(r||!(n in s))&&(r||(r=Array.prototype.slice.call(s,0,n)),r[n]=s[n]);return h.concat(r||Array.prototype.slice.call(s))}function En(h){return new Promise(function(s,e){var n=new Image;n.onload=function(){n.onload=n.onerror=function(){},s(n)},n.onerror=function(t){n.onload=n.onerror=function(){},e(t)},n.crossOrigin="",n.src=h})}var Tn=typeof performance!="undefined"&&typeof performance.timing!="undefined"?performance.timing.navigationStart:Date.now(),gt=typeof performance!="undefined"?(function(){return Tn+performance.now()}):(function(){return Date.now()});function at(h,s,e){return h+(s-h)*e}function Pn(h,s,e,n){var t=(s*e+2*h)/Math.pow(e,3),r=-(2*s*e+3*h)/Math.pow(e,2),l=s,o=h;return t*Math.pow(n,3)+r*Math.pow(n,2)+l*n+o}function Mn(h,s,e,n){var t=(s*e+2*h)/Math.pow(e,3),r=-(2*s*e+3*h)/Math.pow(e,2),l=s;return 3*t*Math.pow(n,2)+2*r*n+l}function An(h,s,e,n){var t=n[1]-n[0];return h=it(h,n),s=it(s,n),s-h>t/2?at(h+t,s,e):h-s>t/2?at(h-t,s,e):at(h,s,e)}function it(h,s){var e=s[1]-s[0];return h<s[0]?it(h+e,s):h>=s[1]?it(h-e,s):h}function Sn(h,s,e,n){return n?An(h,s,e,n):at(h,s,e)}var Gt=(function(){function h(s){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=gt(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(var e in s){var n=s[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:j({},this.value)},{progress:1,value:j({},this.value)}]}return h.prototype.getProgress=function(s){var e=s-this.startTime;return e<0?0:e>=this.duration?1:1-Pn(1,this.startVelocity,this.duration,e)},h.prototype.getValue=function(s){for(var e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>s){var n=this.keyframes[e-1],t=this.keyframes[e],r={};for(var l in this.config){var o=(s-n.progress)/(t.progress-n.progress);r[l]=Sn(n.value[l],t.value[l],o,this.config[l].circle)}return r}return j({},this.keyframes[this.keyframes.length-1].value)},h.prototype.getProgressVelocity=function(s){var e=s-this.startTime;return e>=this.duration?0:Mn(1,this.startVelocity,this.duration,e)},h.prototype.update=function(s){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(s))),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(s){for(var e=this.getProgress(s),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(s,e,n,t){var r;n===void 0&&(n=0),isNaN(e)&&(e=0),isNaN(n)&&(n=0),t=t!=null?t:gt();var l=this.getProgress(t),o=this.getValue(l),d={};for(var c in this.config)d[c]=(r=s[c])!==null&&r!==void 0?r:o[c];var m=[{progress:0,value:o},{progress:1,value:d}];return this.setKeyframes(m,e,n,t)},h.prototype.setKeyframes=function(s,e,n,t){var r=this;if(n===void 0&&(n=0),s.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(l,o){t=t!=null?t:gt(),r.progress=0,r.ended=!1,r.startTime=t,r.startVelocity=n,r.keyframes=s,r.duration=e,e===0?(r.progress=1,r.value=j({},s[s.length-1].value)):r.value=j({},s[0].value),r.callbacks=[l,o]})},h.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},h})(),xn=[{progress:0,value:{scale:0,opacity:0,shadow:2}},{progress:.2,value:{scale:.5,opacity:1,shadow:1}},{progress:.8,value:{scale:2,opacity:0,shadow:.5}},{progress:1,value:{scale:2,opacity:0,shadow:.5}}],On=[{progress:0,value:{scale:0,opacity:0,shadow:2}},{progress:.2,value:{scale:.4,opacity:1,shadow:2}},{progress:.8,value:{scale:1.6,opacity:.4,shadow:.5}},{progress:1,value:{scale:2,opacity:0,shadow:.5}}],_n=`
|
|
256
256
|
varying vec2 vUv;
|
|
257
257
|
void main() {
|
|
258
258
|
vUv = uv;
|
|
@@ -304,7 +304,7 @@ void main() {
|
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
`,Ln=(function(h){de(
|
|
307
|
+
`,Ln=(function(h){de(s,h);function s(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 o=new p.Mesh(new p.SphereBufferGeometry(1,60,40),new p.ShaderMaterial({vertexShader:_n,fragmentShader:Cn,uniforms:{map:{value:new p.Texture},color:{value:new p.Vector4}},depthWrite:!1,depthTest:!1,transparent:!0}));return o.renderOrder=-3,o.geometry.rotateY(-Math.PI/2),o.geometry.scale(-1,1,1),o})(),t.onFivePanoArrived=function(o){t.state.mode==="mask"&&t.loadPanoMask(o)},t.onFiveWantsMoveToPano=function(o){t.state.mode==="box"&&t.select()},t.loadPanoMask=function(o){return Fe(t,void 0,void 0,function(){var d,c,m,y,M,w,A,S,C,E;return Ie(this,function(b){switch(b.label){case 0:return d=this,c=d.five,m=d.canvas,y=d.itemMaskMesh,M=d.data,w=m.getContext("2d"),A=c.observers[o],S=(E=M==null?void 0:M.object_mask_list.find(function(T){return T.derived_id===String(A.derivedId)}))===null||E===void 0?void 0:E.object_mask_url,S?[4,En(S)]:[2];case 1:return C=b.sent(),m.width=C.width,m.height=C.height,w==null||w.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),c.scene.add(y),c.needsRender=!0,[2]}})})},t.onFiveMouseMove=function(o){var d;if(t.state.mode==="mask"&&t.five.state.mode==="Panorama"){var c=t,m=c.five,y=c.itemMaskMesh,M=m.observers[m.state.panoIndex],w=(d=o.pointers[0])===null||d===void 0?void 0:d.raycaster;if(w){var A=w.intersectObjects(t.group.children.filter(function(S){return S.userData.visible_viewpoint.includes(String(M.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(o){var d=t.five,c=d.observers[d.state.panoIndex];if(o){var m=o.intersectObjects(t.group.children.filter(function(w){return w.userData.visible_viewpoint.includes(String(c.derivedId))}),!0)[0];if(m){t.select(m.object.name),t.stopAnimation&&t.stopAnimation(),t.tapPosition=m.point,t.changeTapScreenPosition();var y=new Gt({opacity:0,scale:0,shadow:2}),M=new Gt({opacity:0,scale:0,shadow:2});return y.setKeyframes(xn,1e3),M.setKeyframes(On,1e3),t.stopAnimation=Se.AnimationFrameLoop.shared.add(function(w,A){var S,C=y.update(w),E=M.update(w);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(M.value.opacity),t.wrapper.lastChild.style.transform="scale(".concat(M.value.scale,")"),t.wrapper.lastChild.style.boxShadow="0 0 0 ".concat(M.value.shadow,"px #fff"),C&&E&&((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 o=t.tapPosition.clone().project(t.five.camera),d=(o.x+1)/2,c=-(o.y-1)/2;t.wrapper.style.opacity=o.z>0&&o.z<1?"1":"0",t.wrapper.style.transform="translate(".concat(d*100,"%, ").concat(c*100,"%)")}},t.onFiveCameraUpdate=function(o){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 l=j({},n==null?void 0:n.config);return t._config=l,t.group.rotateX(Math.PI),t.wrapper.className="ItemMaskPlugin",t.wrapper.innerHTML='<span class="ItemMaskPluginCircle"></span><span class="ItemMaskPluginCircle"></span>',t.style.innerHTML=`
|
|
308
308
|
.ItemMaskPlugin {
|
|
309
309
|
position: absolute;
|
|
310
310
|
top: 0;
|
|
@@ -322,7 +322,7 @@ void main() {
|
|
|
322
322
|
border-radius: 50%;
|
|
323
323
|
box-shadow: 0px 0px 0px 2px #fff;
|
|
324
324
|
}
|
|
325
|
-
`,t.state.enabled&&t._enable({userAction:!1}),t}return Object.defineProperty(
|
|
325
|
+
`,t.state.enabled&&t._enable({userAction:!1}),t}return Object.defineProperty(s.prototype,"config",{get:function(){return j({},this._config)},enumerable:!1,configurable:!0}),s.prototype.updateState=function(e,n){var t=this.state;this.state=j(j({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},s.prototype.load=function(e){return Fe(this,void 0,void 0,function(){var n,t,r=this;return Ie(this,function(l){return this.data=e,n=e.data_list.map(function(o){var d,c=o.position.end.map(function(_){return Number(_)}),m=o.position.start.map(function(_){return Number(_)}),y=Math.abs(c[0]-m[0]),M=Math.abs(c[1]-m[1]),w=Math.abs(c[2]-m[2]),A=c[0]/2+m[0]/2,S=c[1]/2+m[1]/2,C=c[2]/2+m[2]/2,E=new p.Vector3(A,S,C),b=new p.BoxBufferGeometry(y,M,w),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:p.DoubleSide,visible:r.state.selectedId==="".concat(
|
|
350
|
+
`,side:p.DoubleSide,visible:r.state.selectedId==="".concat(o.category_name).concat(o.index),uniforms:{opacity:{value:r.state.mode==="box"?1:0}},depthWrite:!1,depthTest:!1,transparent:!0}),f=new p.Mesh(b,T);return f.position.copy(E),f.name="".concat(o.category_name).concat(o.index),f.userData.color=new((d=p.Vector4).bind.apply(d,zt(zt([void 0],o.mask_color.map(function(_){return _/255}).reverse(),!1),[1],!1))),f.userData.visible_viewpoint=Object.keys(o.visible_viewpoint),f}),(t=this.group).add.apply(t,n),[2]})})},s.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 l={userAction:r};e.enabled?this._enable(l):this._disable(l)}},s.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)},s.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(l){l.material.visible=t.state.selectAll||l.name===e}),this.five.needsRender=!0},s.prototype.selectAll=function(e){e===void 0&&(e=!0),this.updateState({selectAll:!!e},!1),this.select()},s.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)},s.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)},s.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})}},s.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})}},s})(exports.BasePlugin.Controller),Fn=function(h,s){return new Ln(h,s)};/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
351
351
|
* http://hammerjs.github.io/
|
|
352
352
|
*
|
|
353
353
|
* Copyright (c) 2016 Jorik Tangelder;
|
|
354
|
-
* Licensed under the MIT license */var yt=(function(h,
|
|
354
|
+
* Licensed under the MIT license */var yt=(function(h,s,e,n){var t=["","webkit","Moz","MS","ms","o"],r=s.createElement?s.createElement("div"):n,l="function",o=Math.round,d=Math.abs,c=Date.now;function m(a,i,u){return setTimeout(b(a,u),i)}function y(a,i,u){return Array.isArray(a)?(M(a,u[i],u),!0):!1}function M(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 w(a,i,u){var g="DEPRECATED METHOD: "+i+`
|
|
355
355
|
`+u+` AT
|
|
356
|
-
`;return function(){var T=new Error("get-stack-trace"),O=T&&T.stack?T.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 M;typeof Object.assign!="function"?M=function(i){if(i===n||i===null)throw new TypeError("Cannot convert undefined or null to object");for(var u=Object(i),g=1;g<arguments.length;g++){var T=arguments[g];if(T!==n&&T!==null)for(var O in T)T.hasOwnProperty(O)&&(u[O]=T[O])}return u}:M=Object.assign;var S=E(function(i,u,g){for(var T=Object.keys(u),O=0;O<T.length;)(!g||g&&i[T[O]]===n)&&(i[T[O]]=u[T[O]]),O++;return i},"extend","Use `assign`."),C=E(function(i,u){return S(i,u,!0)},"merge","Use `assign`.");function w(a,i,u){var g=i.prototype,T;T=a.prototype=Object.create(g),T.constructor=a,T._super=g,u&&M(T,u)}function b(a,i){return function(){return a.apply(i,arguments)}}function P(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){A(W(i),function(g){a.addEventListener(g,u,!1)})}function x(a,i,u){A(W(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 X(a,i){return a.indexOf(i)>-1}function W(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 ee(a){return Array.prototype.slice.call(a,0)}function ie(a,i,u){for(var g=[],T=[],O=0;O<a.length;){var B=a[O][i];q(T,B)<0&&g.push(a[O]),T[O]=B,O++}return g=g.sort(function(fe,te){return fe[i]>te[i]}),g}function z(a,i){for(var u,g,T=i[0].toUpperCase()+i.slice(1),O=0;O<t.length;){if(u=t[O],g=u?u+T:i,g in a)return g;O++}return n}var K=1;function I(){return K++}function L(a){var i=a.ownerDocument||a;return i.defaultView||i.parentWindow||h}var F=/mobile|tablet|ip(ad|hone|od)|android/i,k="ontouchstart"in h,G=z(h,"PointerEvent")!==n,re=k&&F.test(navigator.userAgent),Z="touch",V="pen",ne="mouse",Y="kinect",H=25,U=1,le=2,Q=4,J=8,Se=1,Pe=2,xe=4,Oe=8,Me=16,ce=Pe|xe,ve=Oe|Me,Be=ce|ve,Ue=["x","y"],_e=["clientX","clientY"];function ue(a,i){var u=this;this.manager=a,this.callback=i,this.element=a.element,this.target=a.options.inputTarget,this.domHandler=function(g){P(a.options.enable,[a])&&u.handler(g)},this.init()}ue.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(L(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(L(this.element),this.evWin,this.domHandler)}};function We(a){var i,u=a.options.inputClass;return u?i=u:G?i=lt:re?i=Ze:k?i=ut:i=Ke,new i(a,Xe)}function Xe(a,i,u){var g=u.pointers.length,T=u.changedPointers.length,O=i&U&&g-T===0,B=i&(Q|J)&&g-T===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,T=g.length;u.firstInput||(u.firstInput=ae(i)),T>1&&!u.firstMultiple?u.firstMultiple=ae(i):T===1&&(u.firstMultiple=!1);var O=u.firstInput,B=u.firstMultiple,oe=B?B.center:O.center,fe=i.center=me(g);i.timeStamp=f(),i.deltaTime=i.timeStamp-O.timeStamp,i.angle=st(oe,fe),i.distance=qe(oe,fe),R(u,i),i.offsetDirection=be(i.deltaX,i.deltaY);var te=Ve(i.deltaTime,i.deltaX,i.deltaY);i.overallVelocityX=te.x,i.overallVelocityY=te.y,i.overallVelocity=d(te.x)>d(te.y)?te.x:te.y,i.scale=B?Jt(B.pointers,g):1,i.rotation=B?Qt(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 ye=a.element;D(i.srcEvent.target,ye)&&(ye=i.srcEvent.target),i.target=ye}function R(a,i){var u=i.center,g=a.offsetDelta||{},T=a.prevDelta||{},O=a.prevInput||{};(i.eventType===U||O.eventType===Q)&&(T=a.prevDelta={x:O.deltaX||0,y:O.deltaY||0},g=a.offsetDelta={x:u.x,y:u.y}),i.deltaX=T.x+(u.x-g.x),i.deltaY=T.y+(u.y-g.y)}function $(a,i){var u=a.lastInterval||i,g=i.timeStamp-u.timeStamp,T,O,B,oe;if(i.eventType!=J&&(g>H||u.velocity===n)){var fe=i.deltaX-u.deltaX,te=i.deltaY-u.deltaY,ye=Ve(g,fe,te);O=ye.x,B=ye.y,T=d(ye.x)>d(ye.y)?ye.x:ye.y,oe=be(fe,te),a.lastInterval=i}else T=u.velocity,O=u.velocityX,B=u.velocityY,oe=u.direction;i.velocity=T,i.velocityX=O,i.velocityY=B,i.direction=oe}function ae(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:me(i),deltaX:a.deltaX,deltaY:a.deltaY}}function me(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,T=0;T<i;)u+=a[T].clientX,g+=a[T].clientY,T++;return{x:l(u/i),y:l(g/i)}}function Ve(a,i,u){return{x:i/a||0,y:u/a||0}}function be(a,i){return a===i?Se:d(a)>=d(i)?a<0?Pe:xe:i<0?Oe:Me}function qe(a,i,u){u||(u=Ue);var g=i[u[0]]-a[u[0]],T=i[u[1]]-a[u[1]];return Math.sqrt(g*g+T*T)}function st(a,i,u){u||(u=Ue);var g=i[u[0]]-a[u[0]],T=i[u[1]]-a[u[1]];return Math.atan2(T,g)*180/Math.PI}function Qt(a,i){return st(i[1],i[0],_e)+st(a[1],a[0],_e)}function Jt(a,i){return qe(i[0],i[1],_e)/qe(a[0],a[1],_e)}var $t={mousedown:U,mousemove:le,mouseup:Q},en="mousedown",tn="mousemove mouseup";function Ke(){this.evEl=en,this.evWin=tn,this.pressed=!1,ue.apply(this,arguments)}w(Ke,ue,{handler:function(i){var u=$t[i.type];u&U&&(i.button===0||i.button===2)&&(this.pressed=!0),u&le&&i.which!==1&&(u=Q),this.pressed&&(u&Q&&(this.pressed=!1),this.callback(this.manager,u,{pointers:[i],changedPointers:[i],pointerType:ne,srcEvent:i}))}});var Ot={pointerdown:U,pointermove:le,pointerup:Q,pointercancel:J,pointerout:J},nn={2:Z,3:V,4:ne,5:Y},_t="pointerdown",Ct="pointermove pointerup pointercancel";h.MSPointerEvent&&!h.PointerEvent&&(_t="MSPointerDown",Ct="MSPointerMove MSPointerUp MSPointerCancel");function lt(){this.evEl=_t,this.evWin=Ct,ue.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}w(lt,ue,{handler:function(i){var u=this.store,g=!1,T=!1,O=i.type.toLowerCase().replace("ms",""),B=Ot[O],oe=nn[i.pointerType]||i.pointerType,fe=oe==Z,te=q(u,i.pointerId,"pointerId");B&U&&(i.button===0||i.button===2||fe)?te<0&&(u.push(i),te=u.length-1):B&(Q|J)?g=!0:!fe&&i.buttons===0&&(g=!0,T=!0,B=Ot.pointerup),!(te<0)&&(T||(u[te]=i),this.callback(this.manager,B,{pointers:u,changedPointers:[i],pointerType:oe,srcEvent:u[te]}),g&&u.splice(te,1))}});var rn={touchstart:U,touchmove:le,touchend:Q,touchcancel:J},an="touchstart",on="touchstart touchmove touchend touchcancel";function Lt(){this.evTarget=an,this.evWin=on,this.started=!1,ue.apply(this,arguments)}w(Lt,ue,{handler:function(i){var u=rn[i.type];if(u===U&&(this.started=!0),!!this.started){var g=sn.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 sn(a,i){var u=ee(a.touches),g=ee(a.changedTouches);return i&(Q|J)&&(u=ie(u.concat(g),"identifier")),[u,g]}var ln={touchstart:U,touchmove:le,touchend:Q,touchcancel:J},un="touchstart touchmove touchend touchcancel";function Ze(){this.evTarget=un,this.targetIds={},ue.apply(this,arguments)}w(Ze,ue,{handler:function(i){var u=ln[i.type],g=cn.call(this,i,u);g&&this.callback(this.manager,u,{pointers:g[0],changedPointers:g[1],pointerType:Z,srcEvent:i})}});function cn(a,i){var u=ee(a.touches),g=this.targetIds;if(i&(U|le)&&u.length===1)return g[u[0].identifier]=!0,[u,u];var T,O,B=ee(a.changedTouches),oe=[],fe=this.target;if(O=u.filter(function(te){return D(te.target,fe)}),i===U)for(T=0;T<O.length;)g[O[T].identifier]=!0,T++;for(T=0;T<B.length;)g[B[T].identifier]&&oe.push(B[T]),i&(Q|J)&&delete g[B[T].identifier],T++;if(oe.length)return[ie(O.concat(oe),"identifier"),oe]}var fn=2500,Ft=25;function ut(){ue.apply(this,arguments);var a=b(this.handler,this);this.touch=new Ze(this.manager,a),this.mouse=new Ke(this.manager,a),this.primaryTouch=null,this.lastTouches=[]}w(ut,ue,{handler:function(i,u,g){var T=g.pointerType==Z,O=g.pointerType==ne;if(!(O&&g.sourceCapabilities&&g.sourceCapabilities.firesTouchEvents)){if(T)hn.call(this,u,g);else if(O&&dn.call(this,g))return;this.callback(i,u,g)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function hn(a,i){a&U?(this.primaryTouch=i.changedPointers[0].identifier,It.call(this,i)):a&(Q|J)&&It.call(this,i)}function It(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,T=function(){var O=g.indexOf(u);O>-1&&g.splice(O,1)};setTimeout(T,fn)}}function dn(a){for(var i=a.srcEvent.clientX,u=a.srcEvent.clientY,g=0;g<this.lastTouches.length;g++){var T=this.lastTouches[g],O=Math.abs(i-T.x),B=Math.abs(u-T.y);if(O<=Ft&&B<=Ft)return!0}return!1}var Dt=r?z(r.style,"touchAction"):n,Nt=Dt!==n,kt="compute",Bt="auto",ct="manipulation",Ce="none",Re="pan-x",je="pan-y",Qe=pn();function ft(a,i){this.manager=a,this.set(i)}ft.prototype={set:function(a){a==kt&&(a=this.compute()),Nt&&this.manager.element.style&&Qe[a]&&(this.manager.element.style[Dt]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return A(this.manager.recognizers,function(i){P(i.options.enable,[i])&&(a=a.concat(i.getTouchAction()))}),vn(a.join(" "))},preventDefaults:function(a){var i=a.srcEvent,u=a.offsetDirection;if(this.manager.session.prevented){i.preventDefault();return}var g=this.actions,T=X(g,Ce)&&!Qe[Ce],O=X(g,je)&&!Qe[je],B=X(g,Re)&&!Qe[Re];if(T){var oe=a.pointers.length===1,fe=a.distance<2,te=a.deltaTime<250;if(oe&&fe&&te)return}if(!(B&&O)&&(T||O&&u&ce||B&&u&ve))return this.preventSrc(i)},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};function vn(a){if(X(a,Ce))return Ce;var i=X(a,Re),u=X(a,je);return i&&u?Ce:i||u?i?Re:je:X(a,ct)?ct:Bt}function pn(){if(!Nt)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 Je=1,he=2,De=4,Ae=8,we=Ae,ze=16,ge=32;function Ee(a){this.options=M({},this.defaults,a||{}),this.id=I(),this.manager=null,this.options.enable=c(this.options.enable,!0),this.state=Je,this.simultaneous={},this.requireFail=[]}Ee.prototype={defaults:{},set:function(a){return M(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=$e(a,this),i[a.id]||(i[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return y(a,"dropRecognizeWith",this)?this:(a=$e(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(y(a,"requireFailure",this))return this;var i=this.requireFail;return a=$e(a,this),q(i,a)===-1&&(i.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(y(a,"dropRequireFailure",this))return this;a=$e(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(T){i.manager.emit(T,a)}u<Ae&&g(i.options.event+Ut(u)),g(i.options.event),a.additionalEvent&&g(a.additionalEvent),u>=Ae&&g(i.options.event+Ut(u))},tryEmit:function(a){if(this.canEmit())return this.emit(a);this.state=ge},canEmit:function(){for(var a=0;a<this.requireFail.length;){if(!(this.requireFail[a].state&(ge|Je)))return!1;a++}return!0},recognize:function(a){var i=M({},a);if(!P(this.options.enable,[this,i])){this.reset(),this.state=ge;return}this.state&(we|ze|ge)&&(this.state=Je),this.state=this.process(i),this.state&(he|De|Ae|ze)&&this.tryEmit(i)},process:function(a){},getTouchAction:function(){},reset:function(){}};function Ut(a){return a&ze?"cancel":a&Ae?"end":a&De?"move":a&he?"start":""}function Vt(a){return a==Me?"down":a==Oe?"up":a==Pe?"left":a==xe?"right":""}function $e(a,i){var u=i.manager;return u?u.get(a):a}function pe(){Ee.apply(this,arguments)}w(pe,Ee,{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&(he|De),T=this.attrTest(a);return g&&(u&J||!T)?i|ze:g||T?u&Q?i|Ae:i&he?i|De:he:ge}});function et(){pe.apply(this,arguments),this.pX=null,this.pY=null}w(et,pe,{defaults:{event:"pan",threshold:10,pointers:1,direction:Be},getTouchAction:function(){var a=this.options.direction,i=[];return a&ce&&i.push(je),a&ve&&i.push(Re),i},directionTest:function(a){var i=this.options,u=!0,g=a.distance,T=a.direction,O=a.deltaX,B=a.deltaY;return T&i.direction||(i.direction&ce?(T=O===0?Se:O<0?Pe:xe,u=O!=this.pX,g=Math.abs(a.deltaX)):(T=B===0?Se:B<0?Oe:Me,u=B!=this.pY,g=Math.abs(a.deltaY))),a.direction=T,u&&g>i.threshold&&T&i.direction},attrTest:function(a){return pe.prototype.attrTest.call(this,a)&&(this.state&he||!(this.state&he)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var i=Vt(a.direction);i&&(a.additionalEvent=this.options.event+i),this._super.emit.call(this,a)}});function ht(){pe.apply(this,arguments)}w(ht,pe,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Ce]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&he)},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 dt(){Ee.apply(this,arguments),this._timer=null,this._input=null}w(dt,Ee,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Bt]},process:function(a){var i=this.options,u=a.pointers.length===i.pointers,g=a.distance<i.threshold,T=a.deltaTime>i.time;if(this._input=a,!g||!u||a.eventType&(Q|J)&&!T)this.reset();else if(a.eventType&U)this.reset(),this._timer=m(function(){this.state=we,this.tryEmit()},i.time,this);else if(a.eventType&Q)return we;return ge},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===we&&(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 vt(){pe.apply(this,arguments)}w(vt,pe,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Ce]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&he)}});function pt(){pe.apply(this,arguments)}w(pt,pe,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:ce|ve,pointers:1},getTouchAction:function(){return et.prototype.getTouchAction.call(this)},attrTest:function(a){var i=this.options.direction,u;return i&(ce|ve)?u=a.overallVelocity:i&ce?u=a.overallVelocityX:i&ve&&(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=Vt(a.offsetDirection);i&&this.manager.emit(this.options.event+i,a),this.manager.emit(this.options.event,a)}});function tt(){Ee.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}w(tt,Ee,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ct]},process:function(a){var i=this.options,u=a.pointers.length===i.pointers,g=a.distance<i.threshold,T=a.deltaTime<i.time;if(this.reset(),a.eventType&U&&this.count===0)return this.failTimeout();if(g&&T&&u){if(a.eventType!=Q)return this.failTimeout();var O=this.pTime?a.timeStamp-this.pTime<i.interval:!0,B=!this.pCenter||qe(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 oe=this.count%i.taps;if(oe===0)return this.hasRequireFailures()?(this._timer=m(function(){this.state=we,this.tryEmit()},i.interval,this),he):we}return ge},failTimeout:function(){return this._timer=m(function(){this.state=ge},this.options.interval,this),ge},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==we&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Ne(a,i){return i=i||{},i.recognizers=c(i.recognizers,Ne.defaults.preset),new mt(a,i)}Ne.VERSION="2.0.7",Ne.defaults={domEvents:!1,touchAction:kt,enable:!0,inputTarget:null,inputClass:null,preset:[[vt,{enable:!1}],[ht,{enable:!1},["rotate"]],[pt,{direction:ce}],[et,{direction:ce},["swipe"]],[tt],[tt,{event:"doubletap",taps:2},["tap"]],[dt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var mn=1,Rt=2;function mt(a,i){this.options=M({},Ne.defaults,i||{}),this.options.inputTarget=this.options.inputTarget||a,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=a,this.input=We(this),this.touchAction=new ft(this,this.options.touchAction),jt(this,!0),A(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)}mt.prototype={set:function(a){return M(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?Rt:mn},recognize:function(a){var i=this.session;if(!i.stopped){this.touchAction.preventDefaults(a);var u,g=this.recognizers,T=i.curRecognizer;(!T||T&&T.state&we)&&(T=i.curRecognizer=null);for(var O=0;O<g.length;)u=g[O],i.stopped!==Rt&&(!T||u==T||u.canRecognizeWith(T))?u.recognize(a):u.reset(),!T&&u.state&(he|De|Ae)&&(T=i.curRecognizer=u),O++}},get:function(a){if(a instanceof Ee)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 A(W(a),function(g){u[g]=u[g]||[],u[g].push(i)}),this}},off:function(a,i){if(a!==n){var u=this.handlers;return A(W(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&&gn(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&&jt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function jt(a,i){var u=a.element;if(u.style){var g;A(a.options.cssProps,function(T,O){g=z(u.style,O),i?(a.oldCssProps[g]=u.style[g],u.style[g]=T):u.style[g]=a.oldCssProps[g]||""}),i||(a.oldCssProps={})}}function gn(a,i){var u=o.createEvent("Event");u.initEvent(a,!0,!0),u.gesture=i,i.target.dispatchEvent(u)}return M(Ne,{INPUT_START:U,INPUT_MOVE:le,INPUT_END:Q,INPUT_CANCEL:J,STATE_POSSIBLE:Je,STATE_BEGAN:he,STATE_CHANGED:De,STATE_ENDED:Ae,STATE_RECOGNIZED:we,STATE_CANCELLED:ze,STATE_FAILED:ge,DIRECTION_NONE:Se,DIRECTION_LEFT:Pe,DIRECTION_RIGHT:xe,DIRECTION_UP:Oe,DIRECTION_DOWN:Me,DIRECTION_HORIZONTAL:ce,DIRECTION_VERTICAL:ve,DIRECTION_ALL:Be,Manager:mt,Input:ue,TouchAction:ft,TouchInput:Ze,MouseInput:Ke,PointerEventInput:lt,TouchMouseInput:ut,SingleTouchInput:Lt,Recognizer:Ee,AttrRecognizer:pe,Tap:tt,Pan:et,Swipe:pt,Pinch:ht,Rotate:vt,Press:dt,on:_,off:x,each:A,merge:C,extend:S,assign:M,inherit:w,bindFn:b,prefixed:z}),Ne})(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{}),ke=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,R=new N.Quaternion().setFromUnitVectors(h.up,new N.Vector3(0,1,0)),$=R.clone().inverse(),ae=new N.Vector3,me=new N.Quaternion;return function(){var be=e.object.position;return v.copy(be).sub(e.target),v.applyQuaternion(R),f.setFromVector3(v),e.autoRotate&&l===s.NONE&&W(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(A,e.dampingFactor):e.target.add(A),v.setFromSpherical(f),v.applyQuaternion($),be.copy(e.target).add(v),e.object.lookAt(e.target),e.enableDamping===!0?(m.theta*=1-e.dampingFactor,m.phi*=1-e.dampingFactor,A.multiplyScalar(1-e.dampingFactor)):(m.set(0,0,0),A.set(0,0,0)),y=1,E||ae.distanceToSquared(e.object.position)>d||8*(1-me.dot(e.object.quaternion))>d?(e.dispatchEvent(n),ae.copy(e.object.position),me.copy(e.object.quaternion),E=!1,!0):!1}})(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",Xe,!1),e.domElement.removeEventListener("mousedown",Me,!1),e.domElement.removeEventListener("wheel",Be,!1),e.domElement.removeEventListener("touchstart",_e,!1),e.domElement.removeEventListener("touchend",We,!1),e.domElement.removeEventListener("touchmove",ue,!1),document.removeEventListener("mousemove",ce,!1),document.removeEventListener("mouseup",ve,!1),e.domElement.removeEventListener("keydown",Ue,!1)};var e=this,n={type:"change"},t={type:"start"},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,A=new N.Vector3,E=!1,M=new N.Vector2,S=new N.Vector2,C=new N.Vector2,w=new N.Vector2,b=new N.Vector2,P=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 X(){return Math.pow(.95,e.zoomSpeed)}function W(v){m.theta-=v}function q(v){m.phi-=v}var ee=(function(){var v=new N.Vector3;return function($,ae){v.setFromMatrixColumn(ae,0),v.multiplyScalar(-$),A.add(v)}})(),ie=(function(){var v=new N.Vector3;return function($,ae){e.screenSpacePanning===!0?v.setFromMatrixColumn(ae,1):(v.setFromMatrixColumn(ae,0),v.crossVectors(e.object.up,v)),v.multiplyScalar($),A.add(v)}})(),z=(function(){var v=new N.Vector3;return function($,ae){var me=e.domElement;if(e.object.isPerspectiveCamera){var Ve=e.object.position;v.copy(Ve).sub(e.target);var be=v.length();be*=Math.tan(e.object.fov/2*Math.PI/180),ee(2*$*be/me.clientHeight,e.object.matrix),ie(2*ae*be/me.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(ee($*(e.object.right-e.object.left)/e.object.zoom/me.clientWidth,e.object.matrix),ie(ae*(e.object.top-e.object.bottom)/e.object.zoom/me.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}})();function K(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(),E=!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(),E=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function L(v){M.set(v.clientX,v.clientY)}function F(v){c.set(v.clientX,v.clientY)}function k(v){w.set(v.clientX,v.clientY)}function G(v){S.set(v.clientX,v.clientY),C.subVectors(S,M).multiplyScalar(e.rotateSpeed);var R=e.domElement;W(2*Math.PI*C.x/R.clientHeight),q(2*Math.PI*C.y/R.clientHeight),M.copy(S),e.update()}function re(v){_.set(v.clientX,v.clientY),x.subVectors(_,c),x.y>0?K(X()):x.y<0&&I(X()),c.copy(_),e.update()}function Z(v){b.set(v.clientX,v.clientY),P.subVectors(b,w).multiplyScalar(e.panSpeed),z(P.x,P.y),w.copy(b),e.update()}function V(v){v.deltaY<0?I(X()):v.deltaY>0&&K(X()),e.update()}function ne(v){var R=!1;switch(v.keyCode){case e.keys.UP:z(0,e.keyPanSpeed),R=!0;break;case e.keys.BOTTOM:z(0,-e.keyPanSpeed),R=!0;break;case e.keys.LEFT:z(e.keyPanSpeed,0),R=!0;break;case e.keys.RIGHT:z(-e.keyPanSpeed,0),R=!0;break}R&&(v.preventDefault(),e.update())}function Y(v){if(v.touches.length==1)M.set(v.touches[0].pageX,v.touches[0].pageY);else{var R=.5*(v.touches[0].pageX+v.touches[1].pageX),$=.5*(v.touches[0].pageY+v.touches[1].pageY);M.set(R,$)}}function H(v){if(v.touches.length==1)w.set(v.touches[0].pageX,v.touches[0].pageY);else{var R=.5*(v.touches[0].pageX+v.touches[1].pageX),$=.5*(v.touches[0].pageY+v.touches[1].pageY);w.set(R,$)}}function U(v){var R=v.touches[0].pageX-v.touches[1].pageX,$=v.touches[0].pageY-v.touches[1].pageY,ae=Math.sqrt(R*R+$*$);c.set(0,ae)}function le(v){e.enableZoom&&U(v),e.enablePan&&H(v)}function Q(v){e.enableZoom&&U(v),e.enableRotate&&Y(v)}function J(v){if(v.touches.length==1)S.set(v.touches[0].pageX,v.touches[0].pageY);else{var R=.5*(v.touches[0].pageX+v.touches[1].pageX),$=.5*(v.touches[0].pageY+v.touches[1].pageY);S.set(R,$)}C.subVectors(S,M).multiplyScalar(e.rotateSpeed);var ae=e.domElement;W(2*Math.PI*C.x/ae.clientHeight),q(2*Math.PI*C.y/ae.clientHeight),M.copy(S)}function Se(v){if(v.touches.length==1)b.set(v.touches[0].pageX,v.touches[0].pageY);else{var R=.5*(v.touches[0].pageX+v.touches[1].pageX),$=.5*(v.touches[0].pageY+v.touches[1].pageY);b.set(R,$)}P.subVectors(b,w).multiplyScalar(e.panSpeed),z(P.x,P.y),w.copy(b)}function Pe(v){var R=v.touches[0].pageX-v.touches[1].pageX,$=v.touches[0].pageY-v.touches[1].pageY,ae=Math.sqrt(R*R+$*$);_.set(0,ae),x.set(0,Math.pow(_.y/c.y,e.zoomSpeed)),K(x.y),c.copy(_)}function xe(v){e.enableZoom&&Pe(v),e.enablePan&&Se(v)}function Oe(v){e.enableZoom&&Pe(v),e.enableRotate&&J(v)}function Me(v){if(e.enabled!==!1){v.preventDefault(),e.domElement.focus?e.domElement.focus():window.focus();var R;switch(v.button){case 0:R=e.mouseButtons.LEFT;break;case 1:R=e.mouseButtons.MIDDLE;break;case 2:R=e.mouseButtons.RIGHT;break;default:R=-1}switch(R){case N.MOUSE.DOLLY:if(e.enableZoom===!1)return;F(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;L(v),l=s.ROTATE}break;case N.MOUSE.PAN:if(v.ctrlKey||v.metaKey||v.shiftKey){if(e.enableRotate===!1)return;L(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",ce,!1),document.addEventListener("mouseup",ve,!1),e.dispatchEvent(t))}}function ce(v){if(e.enabled!==!1)switch(v.preventDefault(),l){case s.ROTATE:if(e.enableRotate===!1)return;G(v);break;case s.DOLLY:if(e.enableZoom===!1)return;re(v);break;case s.PAN:if(e.enablePan===!1)return;Z(v);break}}function ve(v){e.enabled!==!1&&(document.removeEventListener("mousemove",ce,!1),document.removeEventListener("mouseup",ve,!1),e.dispatchEvent(r),l=s.NONE)}function Be(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 Ue(v){e.enabled===!1||e.enableKeys===!1||e.enablePan===!1||ne(v)}function _e(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;Y(v),l=s.TOUCH_ROTATE;break;case N.TOUCH.PAN:if(e.enablePan===!1)return;H(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;le(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 ue(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;Se(v),e.update();break;case s.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;xe(v),e.update();break;case s.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Oe(v),e.update();break;default:l=s.NONE}}function We(v){e.enabled!==!1&&(e.dispatchEvent(r),l=s.NONE)}function Xe(v){e.enabled!==!1&&v.preventDefault()}e.domElement.addEventListener("contextmenu",Xe,!1),e.domElement.addEventListener("mousedown",Me,!1),e.domElement.addEventListener("wheel",Be,!1),e.domElement.addEventListener("touchstart",_e,!1),e.domElement.addEventListener("touchend",We,!1),e.domElement.addEventListener("touchmove",ue,!1),e.domElement.addEventListener("keydown",Ue,!1),e.domElement.tabIndex===-1&&(e.domElement.tabIndex=0),this.update()};ke.prototype=Object.create(N.EventDispatcher.prototype);ke.prototype.constructor=ke;var Mt=function(h,o){ke.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};Mt.prototype=Object.create(N.EventDispatcher.prototype);Mt.prototype.constructor=Mt;var Te=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)})})};Te.prototype=Object.create(N.Object3D.prototype);Te.prototype.constructor=Te;var ot=function(h){Te.call(this,h)};ot.prototype=Object.create(Te.prototype);ot.prototype.constructor=ot;var Wt=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 A(w,b){var P=w.elements,c="matrix3d("+m(P[0])+","+m(P[1])+","+m(P[2])+","+m(P[3])+","+m(-P[4])+","+m(-P[5])+","+m(-P[6])+","+m(-P[7])+","+m(P[8])+","+m(P[9])+","+m(P[10])+","+m(P[11])+","+m(P[12])+","+m(P[13])+","+m(P[14])+","+m(P[15])+")";return f?"translate(-50%,-50%)translate("+n+"px,"+t+"px)"+b+c:"translate(-50%,-50%)"+c}function E(w,b,P,c){if(w instanceof Te){w.onBeforeRender(h,b,P);var _;w instanceof ot?(r.copy(P.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,_=A(r,c)):_=A(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 X={style:_};f&&(X.distanceToCameraSquared=M(P,w)),s.objects.set(w,X)}x.style.display=w.visible?"":"none",x.parentNode!==d&&d.appendChild(x),w.onAfterRender(h,b,P)}for(var W=0,q=w.children.length;W<q;W++)E(w.children[W],b,P,c)}var M=(function(){var w=new N.Vector3,b=new N.Vector3;return function(P,c){return w.setFromMatrixPosition(P.matrixWorld),b.setFromMatrixPosition(c.matrixWorld),w.distanceToSquared(b)}})();function S(w){var b=[];return w.traverse(function(P){P instanceof Te&&b.push(P)}),b}function C(w){for(var b=S(w).sort(function(x,D){var X=s.objects.get(x).distanceToCameraSquared,W=s.objects.get(D).distanceToCameraSquared;return X-W}),P=b.length,c=0,_=b.length;c<_;c++)b[c].element.style.zIndex=P-c}this.render=function(w,b){var P=b.projectionMatrix.elements[5]*t;if(s.camera.fov!==P&&(b.isPerspectiveCamera?(l.style.WebkitPerspective=P+"px",l.style.perspective=P+"px"):(l.style.WebkitPerspective="",l.style.perspective=""),s.camera.fov=P),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("+P+")translate("+m(c)+"px,"+m(_)+"px)"+y(b.matrixWorldInverse):"translateZ("+P+"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),E(w,w,b,x),f&&C(w)}};function Ht(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 Xt=(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,A=y*s+1<<3,E=new p.BufferAttribute(new Float32Array(A*3),3),M=new p.BufferAttribute(new Float32Array(A*3),3),S=[],C=[];new p.Vector3;var w=new p.Vector3,b=[],P=[],c=[],_=y*s,x=y*s+1;D(),W(),X(),q(),ie(),ee();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)],L=0;L<8;L++)S.push([]),C.push([]);for(var F=Math.PI/2,k=new p.Vector3(d,f,m),G=0;G<=s;G++){var re=G/s,Z=re*F,V=Math.cos(Z),ne=Math.sin(Z);if(G==s){w.set(0,1,0);var Y=w.clone().multiplyScalar(r).add(k);S[0].push(Y),b.push(Y);var H=w.clone();C[0].push(H),P.push(H);continue}for(var U=0;U<=s;U++){var le=U/s,Q=le*F;w.x=V*Math.cos(Q),w.y=ne,w.z=V*Math.sin(Q);var Y=w.clone().multiplyScalar(r).add(k);S[0].push(Y),b.push(Y);var H=w.clone().normalize();C[0].push(H),P.push(H)}}for(var J=1;J<8;J++)for(var L=0;L<S[0].length;L++){var Y=S[0][L].clone().multiply(I[J]);S[J].push(Y),b.push(Y);var H=C[0][L].clone().multiply(I[J]);C[J].push(H),P.push(H)}}function X(){for(var I=[!0,!1,!0,!1,!1,!0,!1,!0],L=y*(s-1),F=0;F<8;F++){for(var k=x*F,G=0;G<s-1;G++)for(var re=G*y,Z=(G+1)*y,V=0;V<s;V++){var ne=V+1,Y=k+re+V,H=k+re+ne,U=k+Z+V,le=k+Z+ne;I[F]?(c.push(Y),c.push(U),c.push(H),c.push(H),c.push(U),c.push(le)):(c.push(Y),c.push(H),c.push(U),c.push(H),c.push(le),c.push(U))}for(var V=0;V<s;V++){var Y=k+L+V,H=k+L+V+1,U=k+_;I[F]?(c.push(Y),c.push(U),c.push(H)):(c.push(Y),c.push(H),c.push(U))}}}function W(){var I=_,L=_+x,F=_+x*2,k=_+x*3;c.push(I),c.push(L),c.push(F),c.push(I),c.push(F),c.push(k),I=_+x*4,L=_+x*5,F=_+x*6,k=_+x*7,c.push(I),c.push(F),c.push(L),c.push(I),c.push(k),c.push(F),I=0,L=x,F=x*4,k=x*5,c.push(I),c.push(F),c.push(L),c.push(L),c.push(F),c.push(k),I=x*2,L=x*3,F=x*6,k=x*7,c.push(I),c.push(F),c.push(L),c.push(L),c.push(F),c.push(k),I=s,L=s+x*3,F=s+x*4,k=s+x*7,c.push(I),c.push(L),c.push(F),c.push(L),c.push(k),c.push(F),I=s+x,L=s+x*2,F=s+x*5,k=s+x*6,c.push(I),c.push(F),c.push(L),c.push(L),c.push(F),c.push(k)}function q(){for(var I=0;I<4;I++)for(var L=I*x,F=4*x+L,k=(I&1)===1,G=0;G<s;G++){var re=G+1,Z=L+G,V=L+re,ne=F+G,Y=F+re;k?(c.push(Z),c.push(ne),c.push(V),c.push(V),c.push(ne),c.push(Y)):(c.push(Z),c.push(V),c.push(ne),c.push(V),c.push(Y),c.push(ne))}}function ee(){for(var I=[0,2,4,6],L=[1,3,5,7],F=0;F<4;F++)for(var k=x*I[F],G=x*L[F],re=1>=F,Z=0;Z<s;Z++){var V=Z*y,ne=(Z+1)*y,Y=k+V,H=k+ne,U=G+V,le=G+ne;re?(c.push(Y),c.push(U),c.push(H),c.push(H),c.push(U),c.push(le)):(c.push(Y),c.push(H),c.push(U),c.push(H),c.push(le),c.push(U))}}function ie(){for(var I=s-1,L=[0,1,4,5],F=[3,2,7,6],k=[0,1,1,0],G=0;G<4;G++)for(var re=L[G]*x,Z=F[G]*x,V=0;V<=I;V++){var ne=re+s+V*y,Y=re+(V!=I?s+(V+1)*y:x-1),H=Z+s+V*y,U=Z+(V!=I?s+(V+1)*y:x-1);k[G]?(c.push(ne),c.push(H),c.push(Y),c.push(Y),c.push(H),c.push(U)):(c.push(ne),c.push(Y),c.push(H),c.push(Y),c.push(U),c.push(H))}}for(var z=0,K=0;K<b.length;K++)E.setXYZ(z,b[K].x,b[K].y,b[K].z),M.setXYZ(z,P[K].x,P[K].y,P[K].z),z++;return l.setIndex(new p.BufferAttribute(new Uint16Array(c),1)),l.setAttribute("position",E),l.setAttribute("normal",M),l}return o})(p.BufferGeometry);function Ge(h,o){return typeof h!="number"||typeof o!="number"?!1:Math.abs(h-o)<.001}function He(h,o,e,n){n===void 0&&(n=function(r){return r});var t=n(e);return h*(1-t)+o*t}var se=Number((Math.PI/2).toFixed(5));function In(h,o,e){var n=new p.Shape;return n.moveTo(e,0),n.lineTo(h-e,0),n.absarc(h-e,e,e,-se,0,!1),n.lineTo(h,o-e),n.absarc(h-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 Ye=function(h){var o=document.createElement("div");o.innerText=h;var e=new Te(o);return e.name=h,e.scale.set(.3,.3,.3),o.style.pointerEvents="none",o.style.backfaceVisibility="hidden",e},nt=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 Te(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(-se),n.add(r),n},Dn=(function(h){de(o,h);function o(e,n){var t=h.call(this,e)||this;t.camera=new Le.Camera(90),t.scene=new p.Scene,t.renderer=new p.WebGLRenderer({antialias:!0,alpha:!0}),t.css3drenderer=new Wt,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 Xt(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 A=t.camera.pose,E=A.longitude,M=A.latitude;t.five.setState({longitude:E,latitude:M},!0),t.updateArrows({longitude:E,latitude:M})}else if(t.spherical&&(!Ge(t.spherical.pi,(d=t.controls)===null||d===void 0?void 0:d.getPolarAngle())||!Ge(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,E=S.longitude,M=S.latitude;t.five.setState({longitude:E,latitude:M},!0),t.updateArrows({longitude:E,latitude:M})}else t.spherical=null},t.onTapGesture=function(l){var d=l.pointers[0].clientX,f=l.pointers[0].clientY,m=Ht({x:d,y:f},t.wrapper),y=new p.Raycaster;y.setFromCamera(m,t.camera);var A=y.intersectObjects(t.faces.children,!1)[0];if(A){var E=A.object.userData,M=E.longitude,S=E.latitude;t.orient({longitude:M,latitude:S})}},t.onFiveWantsGesture=function(){if(t.spherical)return!1},t.onFiveModeChange=function(l){t.controls&&(t.controls.maxPolarAngle=l==="Topview"?0:se)},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=Ht({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=j({fixedLongitude:0,orthoView:!0},n==null?void 0:n.config);return t._config=s,t.state.enabled&&t._enable({userAction:!1}),t.mc=new yt.Manager(t.wrapper),t.mc.add(new yt.Tap({interval:410})),t.mc.add(new yt.Pan({threshold:10,pointers:0})),t.camera.setFromPose({distance:20,offset:new p.Vector3(0,0,0),longitude:e.camera.pose.latitude,latitude:e.camera.pose.latitude}),t.cylinder=new p.Mesh(new p.CylinderGeometry(13.2,14,.01,50,1,!0),new p.ShaderMaterial({uniforms:{radiusTop:{value:13.2},radiusBottom:{value:14},opacity:{value:1}},vertexShader:`
|
|
356
|
+
`;return function(){var P=new Error("get-stack-trace"),O=P&&P.stack?P.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 P=arguments[g];if(P!==n&&P!==null)for(var O in P)P.hasOwnProperty(O)&&(u[O]=P[O])}return u}:A=Object.assign;var S=w(function(i,u,g){for(var P=Object.keys(u),O=0;O<P.length;)(!g||g&&i[P[O]]===n)&&(i[P[O]]=u[P[O]]),O++;return i},"extend","Use `assign`."),C=w(function(i,u){return S(i,u,!0)},"merge","Use `assign`.");function E(a,i,u){var g=i.prototype,P;P=a.prototype=Object.create(g),P.constructor=a,P._super=g,u&&A(P,u)}function b(a,i){return function(){return a.apply(i,arguments)}}function T(a,i){return typeof a==l?a.apply(i&&i[0]||n,i):a}function f(a,i){return a===n?i:a}function _(a,i,u){M(W(i),function(g){a.addEventListener(g,u,!1)})}function x(a,i,u){M(W(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 X(a,i){return a.indexOf(i)>-1}function W(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 ee(a){return Array.prototype.slice.call(a,0)}function ie(a,i,u){for(var g=[],P=[],O=0;O<a.length;){var B=a[O][i];q(P,B)<0&&g.push(a[O]),P[O]=B,O++}return g=g.sort(function(fe,te){return fe[i]>te[i]}),g}function z(a,i){for(var u,g,P=i[0].toUpperCase()+i.slice(1),O=0;O<t.length;){if(u=t[O],g=u?u+P:i,g in a)return g;O++}return n}var K=1;function I(){return K++}function L(a){var i=a.ownerDocument||a;return i.defaultView||i.parentWindow||h}var F=/mobile|tablet|ip(ad|hone|od)|android/i,k="ontouchstart"in h,G=z(h,"PointerEvent")!==n,re=k&&F.test(navigator.userAgent),Z="touch",V="pen",ne="mouse",Y="kinect",H=25,U=1,le=2,Q=4,J=8,xe=1,Pe=2,Oe=4,_e=8,Me=16,ce=Pe|Oe,ve=_e|Me,Be=ce|ve,Ue=["x","y"],Ce=["clientX","clientY"];function ue(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()}ue.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(L(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(L(this.element),this.evWin,this.domHandler)}};function We(a){var i,u=a.options.inputClass;return u?i=u:G?i=lt:re?i=Ze:k?i=ut:i=Ke,new i(a,Xe)}function Xe(a,i,u){var g=u.pointers.length,P=u.changedPointers.length,O=i&U&&g-P===0,B=i&(Q|J)&&g-P===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,P=g.length;u.firstInput||(u.firstInput=ae(i)),P>1&&!u.firstMultiple?u.firstMultiple=ae(i):P===1&&(u.firstMultiple=!1);var O=u.firstInput,B=u.firstMultiple,oe=B?B.center:O.center,fe=i.center=me(g);i.timeStamp=c(),i.deltaTime=i.timeStamp-O.timeStamp,i.angle=st(oe,fe),i.distance=qe(oe,fe),R(u,i),i.offsetDirection=be(i.deltaX,i.deltaY);var te=Ve(i.deltaTime,i.deltaX,i.deltaY);i.overallVelocityX=te.x,i.overallVelocityY=te.y,i.overallVelocity=d(te.x)>d(te.y)?te.x:te.y,i.scale=B?Jt(B.pointers,g):1,i.rotation=B?Qt(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 ye=a.element;D(i.srcEvent.target,ye)&&(ye=i.srcEvent.target),i.target=ye}function R(a,i){var u=i.center,g=a.offsetDelta||{},P=a.prevDelta||{},O=a.prevInput||{};(i.eventType===U||O.eventType===Q)&&(P=a.prevDelta={x:O.deltaX||0,y:O.deltaY||0},g=a.offsetDelta={x:u.x,y:u.y}),i.deltaX=P.x+(u.x-g.x),i.deltaY=P.y+(u.y-g.y)}function $(a,i){var u=a.lastInterval||i,g=i.timeStamp-u.timeStamp,P,O,B,oe;if(i.eventType!=J&&(g>H||u.velocity===n)){var fe=i.deltaX-u.deltaX,te=i.deltaY-u.deltaY,ye=Ve(g,fe,te);O=ye.x,B=ye.y,P=d(ye.x)>d(ye.y)?ye.x:ye.y,oe=be(fe,te),a.lastInterval=i}else P=u.velocity,O=u.velocityX,B=u.velocityY,oe=u.direction;i.velocity=P,i.velocityX=O,i.velocityY=B,i.direction=oe}function ae(a){for(var i=[],u=0;u<a.pointers.length;)i[u]={clientX:o(a.pointers[u].clientX),clientY:o(a.pointers[u].clientY)},u++;return{timeStamp:c(),pointers:i,center:me(i),deltaX:a.deltaX,deltaY:a.deltaY}}function me(a){var i=a.length;if(i===1)return{x:o(a[0].clientX),y:o(a[0].clientY)};for(var u=0,g=0,P=0;P<i;)u+=a[P].clientX,g+=a[P].clientY,P++;return{x:o(u/i),y:o(g/i)}}function Ve(a,i,u){return{x:i/a||0,y:u/a||0}}function be(a,i){return a===i?xe:d(a)>=d(i)?a<0?Pe:Oe:i<0?_e:Me}function qe(a,i,u){u||(u=Ue);var g=i[u[0]]-a[u[0]],P=i[u[1]]-a[u[1]];return Math.sqrt(g*g+P*P)}function st(a,i,u){u||(u=Ue);var g=i[u[0]]-a[u[0]],P=i[u[1]]-a[u[1]];return Math.atan2(P,g)*180/Math.PI}function Qt(a,i){return st(i[1],i[0],Ce)+st(a[1],a[0],Ce)}function Jt(a,i){return qe(i[0],i[1],Ce)/qe(a[0],a[1],Ce)}var $t={mousedown:U,mousemove:le,mouseup:Q},en="mousedown",tn="mousemove mouseup";function Ke(){this.evEl=en,this.evWin=tn,this.pressed=!1,ue.apply(this,arguments)}E(Ke,ue,{handler:function(i){var u=$t[i.type];u&U&&(i.button===0||i.button===2)&&(this.pressed=!0),u&le&&i.which!==1&&(u=Q),this.pressed&&(u&Q&&(this.pressed=!1),this.callback(this.manager,u,{pointers:[i],changedPointers:[i],pointerType:ne,srcEvent:i}))}});var Ot={pointerdown:U,pointermove:le,pointerup:Q,pointercancel:J,pointerout:J},nn={2:Z,3:V,4:ne,5:Y},_t="pointerdown",Ct="pointermove pointerup pointercancel";h.MSPointerEvent&&!h.PointerEvent&&(_t="MSPointerDown",Ct="MSPointerMove MSPointerUp MSPointerCancel");function lt(){this.evEl=_t,this.evWin=Ct,ue.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}E(lt,ue,{handler:function(i){var u=this.store,g=!1,P=!1,O=i.type.toLowerCase().replace("ms",""),B=Ot[O],oe=nn[i.pointerType]||i.pointerType,fe=oe==Z,te=q(u,i.pointerId,"pointerId");B&U&&(i.button===0||i.button===2||fe)?te<0&&(u.push(i),te=u.length-1):B&(Q|J)?g=!0:!fe&&i.buttons===0&&(g=!0,P=!0,B=Ot.pointerup),!(te<0)&&(P||(u[te]=i),this.callback(this.manager,B,{pointers:u,changedPointers:[i],pointerType:oe,srcEvent:u[te]}),g&&u.splice(te,1))}});var rn={touchstart:U,touchmove:le,touchend:Q,touchcancel:J},an="touchstart",on="touchstart touchmove touchend touchcancel";function Lt(){this.evTarget=an,this.evWin=on,this.started=!1,ue.apply(this,arguments)}E(Lt,ue,{handler:function(i){var u=rn[i.type];if(u===U&&(this.started=!0),!!this.started){var g=sn.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 sn(a,i){var u=ee(a.touches),g=ee(a.changedTouches);return i&(Q|J)&&(u=ie(u.concat(g),"identifier")),[u,g]}var ln={touchstart:U,touchmove:le,touchend:Q,touchcancel:J},un="touchstart touchmove touchend touchcancel";function Ze(){this.evTarget=un,this.targetIds={},ue.apply(this,arguments)}E(Ze,ue,{handler:function(i){var u=ln[i.type],g=cn.call(this,i,u);g&&this.callback(this.manager,u,{pointers:g[0],changedPointers:g[1],pointerType:Z,srcEvent:i})}});function cn(a,i){var u=ee(a.touches),g=this.targetIds;if(i&(U|le)&&u.length===1)return g[u[0].identifier]=!0,[u,u];var P,O,B=ee(a.changedTouches),oe=[],fe=this.target;if(O=u.filter(function(te){return D(te.target,fe)}),i===U)for(P=0;P<O.length;)g[O[P].identifier]=!0,P++;for(P=0;P<B.length;)g[B[P].identifier]&&oe.push(B[P]),i&(Q|J)&&delete g[B[P].identifier],P++;if(oe.length)return[ie(O.concat(oe),"identifier"),oe]}var fn=2500,Ft=25;function ut(){ue.apply(this,arguments);var a=b(this.handler,this);this.touch=new Ze(this.manager,a),this.mouse=new Ke(this.manager,a),this.primaryTouch=null,this.lastTouches=[]}E(ut,ue,{handler:function(i,u,g){var P=g.pointerType==Z,O=g.pointerType==ne;if(!(O&&g.sourceCapabilities&&g.sourceCapabilities.firesTouchEvents)){if(P)hn.call(this,u,g);else if(O&&dn.call(this,g))return;this.callback(i,u,g)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function hn(a,i){a&U?(this.primaryTouch=i.changedPointers[0].identifier,It.call(this,i)):a&(Q|J)&&It.call(this,i)}function It(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,P=function(){var O=g.indexOf(u);O>-1&&g.splice(O,1)};setTimeout(P,fn)}}function dn(a){for(var i=a.srcEvent.clientX,u=a.srcEvent.clientY,g=0;g<this.lastTouches.length;g++){var P=this.lastTouches[g],O=Math.abs(i-P.x),B=Math.abs(u-P.y);if(O<=Ft&&B<=Ft)return!0}return!1}var Dt=r?z(r.style,"touchAction"):n,Nt=Dt!==n,kt="compute",Bt="auto",ct="manipulation",Le="none",Re="pan-x",je="pan-y",Qe=pn();function ft(a,i){this.manager=a,this.set(i)}ft.prototype={set:function(a){a==kt&&(a=this.compute()),Nt&&this.manager.element.style&&Qe[a]&&(this.manager.element.style[Dt]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return M(this.manager.recognizers,function(i){T(i.options.enable,[i])&&(a=a.concat(i.getTouchAction()))}),vn(a.join(" "))},preventDefaults:function(a){var i=a.srcEvent,u=a.offsetDirection;if(this.manager.session.prevented){i.preventDefault();return}var g=this.actions,P=X(g,Le)&&!Qe[Le],O=X(g,je)&&!Qe[je],B=X(g,Re)&&!Qe[Re];if(P){var oe=a.pointers.length===1,fe=a.distance<2,te=a.deltaTime<250;if(oe&&fe&&te)return}if(!(B&&O)&&(P||O&&u&ce||B&&u&ve))return this.preventSrc(i)},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};function vn(a){if(X(a,Le))return Le;var i=X(a,Re),u=X(a,je);return i&&u?Le:i||u?i?Re:je:X(a,ct)?ct:Bt}function pn(){if(!Nt)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 Je=1,he=2,De=4,Ae=8,we=Ae,ze=16,ge=32;function Ee(a){this.options=A({},this.defaults,a||{}),this.id=I(),this.manager=null,this.options.enable=f(this.options.enable,!0),this.state=Je,this.simultaneous={},this.requireFail=[]}Ee.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=$e(a,this),i[a.id]||(i[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return y(a,"dropRecognizeWith",this)?this:(a=$e(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(y(a,"requireFailure",this))return this;var i=this.requireFail;return a=$e(a,this),q(i,a)===-1&&(i.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(y(a,"dropRequireFailure",this))return this;a=$e(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(P){i.manager.emit(P,a)}u<Ae&&g(i.options.event+Ut(u)),g(i.options.event),a.additionalEvent&&g(a.additionalEvent),u>=Ae&&g(i.options.event+Ut(u))},tryEmit:function(a){if(this.canEmit())return this.emit(a);this.state=ge},canEmit:function(){for(var a=0;a<this.requireFail.length;){if(!(this.requireFail[a].state&(ge|Je)))return!1;a++}return!0},recognize:function(a){var i=A({},a);if(!T(this.options.enable,[this,i])){this.reset(),this.state=ge;return}this.state&(we|ze|ge)&&(this.state=Je),this.state=this.process(i),this.state&(he|De|Ae|ze)&&this.tryEmit(i)},process:function(a){},getTouchAction:function(){},reset:function(){}};function Ut(a){return a&ze?"cancel":a&Ae?"end":a&De?"move":a&he?"start":""}function Vt(a){return a==Me?"down":a==_e?"up":a==Pe?"left":a==Oe?"right":""}function $e(a,i){var u=i.manager;return u?u.get(a):a}function pe(){Ee.apply(this,arguments)}E(pe,Ee,{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&(he|De),P=this.attrTest(a);return g&&(u&J||!P)?i|ze:g||P?u&Q?i|Ae:i&he?i|De:he:ge}});function et(){pe.apply(this,arguments),this.pX=null,this.pY=null}E(et,pe,{defaults:{event:"pan",threshold:10,pointers:1,direction:Be},getTouchAction:function(){var a=this.options.direction,i=[];return a&ce&&i.push(je),a&ve&&i.push(Re),i},directionTest:function(a){var i=this.options,u=!0,g=a.distance,P=a.direction,O=a.deltaX,B=a.deltaY;return P&i.direction||(i.direction&ce?(P=O===0?xe:O<0?Pe:Oe,u=O!=this.pX,g=Math.abs(a.deltaX)):(P=B===0?xe:B<0?_e:Me,u=B!=this.pY,g=Math.abs(a.deltaY))),a.direction=P,u&&g>i.threshold&&P&i.direction},attrTest:function(a){return pe.prototype.attrTest.call(this,a)&&(this.state&he||!(this.state&he)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var i=Vt(a.direction);i&&(a.additionalEvent=this.options.event+i),this._super.emit.call(this,a)}});function ht(){pe.apply(this,arguments)}E(ht,pe,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Le]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&he)},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 dt(){Ee.apply(this,arguments),this._timer=null,this._input=null}E(dt,Ee,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Bt]},process:function(a){var i=this.options,u=a.pointers.length===i.pointers,g=a.distance<i.threshold,P=a.deltaTime>i.time;if(this._input=a,!g||!u||a.eventType&(Q|J)&&!P)this.reset();else if(a.eventType&U)this.reset(),this._timer=m(function(){this.state=we,this.tryEmit()},i.time,this);else if(a.eventType&Q)return we;return ge},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===we&&(a&&a.eventType&Q?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=c(),this.manager.emit(this.options.event,this._input)))}});function vt(){pe.apply(this,arguments)}E(vt,pe,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Le]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&he)}});function pt(){pe.apply(this,arguments)}E(pt,pe,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:ce|ve,pointers:1},getTouchAction:function(){return et.prototype.getTouchAction.call(this)},attrTest:function(a){var i=this.options.direction,u;return i&(ce|ve)?u=a.overallVelocity:i&ce?u=a.overallVelocityX:i&ve&&(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=Vt(a.offsetDirection);i&&this.manager.emit(this.options.event+i,a),this.manager.emit(this.options.event,a)}});function tt(){Ee.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}E(tt,Ee,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ct]},process:function(a){var i=this.options,u=a.pointers.length===i.pointers,g=a.distance<i.threshold,P=a.deltaTime<i.time;if(this.reset(),a.eventType&U&&this.count===0)return this.failTimeout();if(g&&P&&u){if(a.eventType!=Q)return this.failTimeout();var O=this.pTime?a.timeStamp-this.pTime<i.interval:!0,B=!this.pCenter||qe(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 oe=this.count%i.taps;if(oe===0)return this.hasRequireFailures()?(this._timer=m(function(){this.state=we,this.tryEmit()},i.interval,this),he):we}return ge},failTimeout:function(){return this._timer=m(function(){this.state=ge},this.options.interval,this),ge},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==we&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Ne(a,i){return i=i||{},i.recognizers=f(i.recognizers,Ne.defaults.preset),new mt(a,i)}Ne.VERSION="2.0.7",Ne.defaults={domEvents:!1,touchAction:kt,enable:!0,inputTarget:null,inputClass:null,preset:[[vt,{enable:!1}],[ht,{enable:!1},["rotate"]],[pt,{direction:ce}],[et,{direction:ce},["swipe"]],[tt],[tt,{event:"doubletap",taps:2},["tap"]],[dt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var mn=1,Rt=2;function mt(a,i){this.options=A({},Ne.defaults,i||{}),this.options.inputTarget=this.options.inputTarget||a,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=a,this.input=We(this),this.touchAction=new ft(this,this.options.touchAction),jt(this,!0),M(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)}mt.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?Rt:mn},recognize:function(a){var i=this.session;if(!i.stopped){this.touchAction.preventDefaults(a);var u,g=this.recognizers,P=i.curRecognizer;(!P||P&&P.state&we)&&(P=i.curRecognizer=null);for(var O=0;O<g.length;)u=g[O],i.stopped!==Rt&&(!P||u==P||u.canRecognizeWith(P))?u.recognize(a):u.reset(),!P&&u.state&(he|De|Ae)&&(P=i.curRecognizer=u),O++}},get:function(a){if(a instanceof Ee)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 M(W(a),function(g){u[g]=u[g]||[],u[g].push(i)}),this}},off:function(a,i){if(a!==n){var u=this.handlers;return M(W(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&&gn(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&&jt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function jt(a,i){var u=a.element;if(u.style){var g;M(a.options.cssProps,function(P,O){g=z(u.style,O),i?(a.oldCssProps[g]=u.style[g],u.style[g]=P):u.style[g]=a.oldCssProps[g]||""}),i||(a.oldCssProps={})}}function gn(a,i){var u=s.createEvent("Event");u.initEvent(a,!0,!0),u.gesture=i,i.target.dispatchEvent(u)}return A(Ne,{INPUT_START:U,INPUT_MOVE:le,INPUT_END:Q,INPUT_CANCEL:J,STATE_POSSIBLE:Je,STATE_BEGAN:he,STATE_CHANGED:De,STATE_ENDED:Ae,STATE_RECOGNIZED:we,STATE_CANCELLED:ze,STATE_FAILED:ge,DIRECTION_NONE:xe,DIRECTION_LEFT:Pe,DIRECTION_RIGHT:Oe,DIRECTION_UP:_e,DIRECTION_DOWN:Me,DIRECTION_HORIZONTAL:ce,DIRECTION_VERTICAL:ve,DIRECTION_ALL:Be,Manager:mt,Input:ue,TouchAction:ft,TouchInput:Ze,MouseInput:Ke,PointerEventInput:lt,TouchMouseInput:ut,SingleTouchInput:Lt,Recognizer:Ee,AttrRecognizer:pe,Tap:tt,Pan:et,Swipe:pt,Pinch:ht,Rotate:vt,Press:dt,on:_,off:x,each:M,merge:C,extend:S,assign:A,inherit:E,bindFn:b,prefixed:z}),Ne})(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{}),ke=function(h,s){s===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),s===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=h,this.domElement=s,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 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(),o=l.NONE},this.update=(function(){var v=new N.Vector3,R=new N.Quaternion().setFromUnitVectors(h.up,new N.Vector3(0,1,0)),$=R.clone().inverse(),ae=new N.Vector3,me=new N.Quaternion;return function(){var be=e.object.position;return v.copy(be).sub(e.target),v.applyQuaternion(R),c.setFromVector3(v),e.autoRotate&&o===l.NONE&&W(D()),e.enableDamping?(c.theta+=m.theta*e.dampingFactor,c.phi+=m.phi*e.dampingFactor):(c.theta+=m.theta,c.phi+=m.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*=y,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),v.setFromSpherical(c),v.applyQuaternion($),be.copy(e.target).add(v),e.object.lookAt(e.target),e.enableDamping===!0?(m.theta*=1-e.dampingFactor,m.phi*=1-e.dampingFactor,M.multiplyScalar(1-e.dampingFactor)):(m.set(0,0,0),M.set(0,0,0)),y=1,w||ae.distanceToSquared(e.object.position)>d||8*(1-me.dot(e.object.quaternion))>d?(e.dispatchEvent(n),ae.copy(e.object.position),me.copy(e.object.quaternion),w=!1,!0):!1}})(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",Xe,!1),e.domElement.removeEventListener("mousedown",Me,!1),e.domElement.removeEventListener("wheel",Be,!1),e.domElement.removeEventListener("touchstart",Ce,!1),e.domElement.removeEventListener("touchend",We,!1),e.domElement.removeEventListener("touchmove",ue,!1),document.removeEventListener("mousemove",ce,!1),document.removeEventListener("mouseup",ve,!1),e.domElement.removeEventListener("keydown",Ue,!1)};var e=this,n={type:"change"},t={type:"start"},r={type:"end"},l={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=l.NONE,d=1e-6,c=new N.Spherical,m=new N.Spherical,y=1,M=new N.Vector3,w=!1,A=new N.Vector2,S=new N.Vector2,C=new N.Vector2,E=new N.Vector2,b=new N.Vector2,T=new N.Vector2,f=new N.Vector2,_=new N.Vector2,x=new N.Vector2;function D(){return 2*Math.PI/60/60*e.autoRotateSpeed}function X(){return Math.pow(.95,e.zoomSpeed)}function W(v){m.theta-=v}function q(v){m.phi-=v}var ee=(function(){var v=new N.Vector3;return function($,ae){v.setFromMatrixColumn(ae,0),v.multiplyScalar(-$),M.add(v)}})(),ie=(function(){var v=new N.Vector3;return function($,ae){e.screenSpacePanning===!0?v.setFromMatrixColumn(ae,1):(v.setFromMatrixColumn(ae,0),v.crossVectors(e.object.up,v)),v.multiplyScalar($),M.add(v)}})(),z=(function(){var v=new N.Vector3;return function($,ae){var me=e.domElement;if(e.object.isPerspectiveCamera){var Ve=e.object.position;v.copy(Ve).sub(e.target);var be=v.length();be*=Math.tan(e.object.fov/2*Math.PI/180),ee(2*$*be/me.clientHeight,e.object.matrix),ie(2*ae*be/me.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(ee($*(e.object.right-e.object.left)/e.object.zoom/me.clientWidth,e.object.matrix),ie(ae*(e.object.top-e.object.bottom)/e.object.zoom/me.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}})();function K(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(),w=!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(),w=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function L(v){A.set(v.clientX,v.clientY)}function F(v){f.set(v.clientX,v.clientY)}function k(v){E.set(v.clientX,v.clientY)}function G(v){S.set(v.clientX,v.clientY),C.subVectors(S,A).multiplyScalar(e.rotateSpeed);var R=e.domElement;W(2*Math.PI*C.x/R.clientHeight),q(2*Math.PI*C.y/R.clientHeight),A.copy(S),e.update()}function re(v){_.set(v.clientX,v.clientY),x.subVectors(_,f),x.y>0?K(X()):x.y<0&&I(X()),f.copy(_),e.update()}function Z(v){b.set(v.clientX,v.clientY),T.subVectors(b,E).multiplyScalar(e.panSpeed),z(T.x,T.y),E.copy(b),e.update()}function V(v){v.deltaY<0?I(X()):v.deltaY>0&&K(X()),e.update()}function ne(v){var R=!1;switch(v.keyCode){case e.keys.UP:z(0,e.keyPanSpeed),R=!0;break;case e.keys.BOTTOM:z(0,-e.keyPanSpeed),R=!0;break;case e.keys.LEFT:z(e.keyPanSpeed,0),R=!0;break;case e.keys.RIGHT:z(-e.keyPanSpeed,0),R=!0;break}R&&(v.preventDefault(),e.update())}function Y(v){if(v.touches.length==1)A.set(v.touches[0].pageX,v.touches[0].pageY);else{var R=.5*(v.touches[0].pageX+v.touches[1].pageX),$=.5*(v.touches[0].pageY+v.touches[1].pageY);A.set(R,$)}}function H(v){if(v.touches.length==1)E.set(v.touches[0].pageX,v.touches[0].pageY);else{var R=.5*(v.touches[0].pageX+v.touches[1].pageX),$=.5*(v.touches[0].pageY+v.touches[1].pageY);E.set(R,$)}}function U(v){var R=v.touches[0].pageX-v.touches[1].pageX,$=v.touches[0].pageY-v.touches[1].pageY,ae=Math.sqrt(R*R+$*$);f.set(0,ae)}function le(v){e.enableZoom&&U(v),e.enablePan&&H(v)}function Q(v){e.enableZoom&&U(v),e.enableRotate&&Y(v)}function J(v){if(v.touches.length==1)S.set(v.touches[0].pageX,v.touches[0].pageY);else{var R=.5*(v.touches[0].pageX+v.touches[1].pageX),$=.5*(v.touches[0].pageY+v.touches[1].pageY);S.set(R,$)}C.subVectors(S,A).multiplyScalar(e.rotateSpeed);var ae=e.domElement;W(2*Math.PI*C.x/ae.clientHeight),q(2*Math.PI*C.y/ae.clientHeight),A.copy(S)}function xe(v){if(v.touches.length==1)b.set(v.touches[0].pageX,v.touches[0].pageY);else{var R=.5*(v.touches[0].pageX+v.touches[1].pageX),$=.5*(v.touches[0].pageY+v.touches[1].pageY);b.set(R,$)}T.subVectors(b,E).multiplyScalar(e.panSpeed),z(T.x,T.y),E.copy(b)}function Pe(v){var R=v.touches[0].pageX-v.touches[1].pageX,$=v.touches[0].pageY-v.touches[1].pageY,ae=Math.sqrt(R*R+$*$);_.set(0,ae),x.set(0,Math.pow(_.y/f.y,e.zoomSpeed)),K(x.y),f.copy(_)}function Oe(v){e.enableZoom&&Pe(v),e.enablePan&&xe(v)}function _e(v){e.enableZoom&&Pe(v),e.enableRotate&&J(v)}function Me(v){if(e.enabled!==!1){v.preventDefault(),e.domElement.focus?e.domElement.focus():window.focus();var R;switch(v.button){case 0:R=e.mouseButtons.LEFT;break;case 1:R=e.mouseButtons.MIDDLE;break;case 2:R=e.mouseButtons.RIGHT;break;default:R=-1}switch(R){case N.MOUSE.DOLLY:if(e.enableZoom===!1)return;F(v),o=l.DOLLY;break;case N.MOUSE.ROTATE:if(v.ctrlKey||v.metaKey||v.shiftKey){if(e.enablePan===!1)return;k(v),o=l.PAN}else{if(e.enableRotate===!1)return;L(v),o=l.ROTATE}break;case N.MOUSE.PAN:if(v.ctrlKey||v.metaKey||v.shiftKey){if(e.enableRotate===!1)return;L(v),o=l.ROTATE}else{if(e.enablePan===!1)return;k(v),o=l.PAN}break;default:o=l.NONE}o!==l.NONE&&(document.addEventListener("mousemove",ce,!1),document.addEventListener("mouseup",ve,!1),e.dispatchEvent(t))}}function ce(v){if(e.enabled!==!1)switch(v.preventDefault(),o){case l.ROTATE:if(e.enableRotate===!1)return;G(v);break;case l.DOLLY:if(e.enableZoom===!1)return;re(v);break;case l.PAN:if(e.enablePan===!1)return;Z(v);break}}function ve(v){e.enabled!==!1&&(document.removeEventListener("mousemove",ce,!1),document.removeEventListener("mouseup",ve,!1),e.dispatchEvent(r),o=l.NONE)}function Be(v){e.enabled===!1||e.enableZoom===!1||o!==l.NONE&&o!==l.ROTATE||(v.preventDefault(),v.stopPropagation(),e.dispatchEvent(t),V(v),e.dispatchEvent(r))}function Ue(v){e.enabled===!1||e.enableKeys===!1||e.enablePan===!1||ne(v)}function Ce(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;Y(v),o=l.TOUCH_ROTATE;break;case N.TOUCH.PAN:if(e.enablePan===!1)return;H(v),o=l.TOUCH_PAN;break;default:o=l.NONE}break;case 2:switch(e.touches.TWO){case N.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;le(v),o=l.TOUCH_DOLLY_PAN;break;case N.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Q(v),o=l.TOUCH_DOLLY_ROTATE;break;default:o=l.NONE}break;default:o=l.NONE}o!==l.NONE&&e.dispatchEvent(t)}}function ue(v){if(e.enabled!==!1)switch(v.preventDefault(),v.stopPropagation(),o){case l.TOUCH_ROTATE:if(e.enableRotate===!1)return;J(v),e.update();break;case l.TOUCH_PAN:if(e.enablePan===!1)return;xe(v),e.update();break;case l.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Oe(v),e.update();break;case l.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;_e(v),e.update();break;default:o=l.NONE}}function We(v){e.enabled!==!1&&(e.dispatchEvent(r),o=l.NONE)}function Xe(v){e.enabled!==!1&&v.preventDefault()}e.domElement.addEventListener("contextmenu",Xe,!1),e.domElement.addEventListener("mousedown",Me,!1),e.domElement.addEventListener("wheel",Be,!1),e.domElement.addEventListener("touchstart",Ce,!1),e.domElement.addEventListener("touchend",We,!1),e.domElement.addEventListener("touchmove",ue,!1),e.domElement.addEventListener("keydown",Ue,!1),e.domElement.tabIndex===-1&&(e.domElement.tabIndex=0),this.update()};ke.prototype=Object.create(N.EventDispatcher.prototype);ke.prototype.constructor=ke;var Mt=function(h,s){ke.call(this,h,s),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};Mt.prototype=Object.create(N.EventDispatcher.prototype);Mt.prototype.constructor=Mt;var Te=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(s){s.element instanceof Element&&s.element.parentNode!==null&&s.element.parentNode.removeChild(s.element)})})};Te.prototype=Object.create(N.Object3D.prototype);Te.prototype.constructor=Te;var ot=function(h){Te.call(this,h)};ot.prototype=Object.create(Te.prototype);ot.prototype.constructor=ot;var Wt=function(){var h=this,s,e,n,t,r=new N.Matrix4,l={camera:{fov:0,style:""},objects:new WeakMap},o=document.createElement("div");o.style.overflow="hidden",this.domElement=o;var d=document.createElement("div");d.style.WebkitTransformStyle="preserve-3d",d.style.transformStyle="preserve-3d",d.style.pointerEvents="none",o.appendChild(d);var c=/Trident/i.test(navigator.userAgent);this.getSize=function(){return{width:s,height:e}},this.setSize=function(E,b){s=E,e=b,n=s/2,t=e/2,o.style.width=E+"px",o.style.height=b+"px",d.style.width=E+"px",d.style.height=b+"px"};function m(E){return Math.abs(E)<1e-10?0:E}function y(E){var b=E.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 M(E,b){var T=E.elements,f="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 c?"translate(-50%,-50%)translate("+n+"px,"+t+"px)"+b+f:"translate(-50%,-50%)"+f}function w(E,b,T,f){if(E instanceof Te){E.onBeforeRender(h,b,T);var _;E instanceof ot?(r.copy(T.matrixWorldInverse),r.transpose(),r.copyPosition(E.matrixWorld),r.scale(E.scale),r.elements[3]=0,r.elements[7]=0,r.elements[11]=0,r.elements[15]=1,_=M(r,f)):_=M(E.matrixWorld,f);var x=E.element,D=l.objects.get(E);if(D===void 0||D.style!==_){x.style.WebkitTransform=_,x.style.transform=_;var X={style:_};c&&(X.distanceToCameraSquared=A(T,E)),l.objects.set(E,X)}x.style.display=E.visible?"":"none",x.parentNode!==d&&d.appendChild(x),E.onAfterRender(h,b,T)}for(var W=0,q=E.children.length;W<q;W++)w(E.children[W],b,T,f)}var A=(function(){var E=new N.Vector3,b=new N.Vector3;return function(T,f){return E.setFromMatrixPosition(T.matrixWorld),b.setFromMatrixPosition(f.matrixWorld),E.distanceToSquared(b)}})();function S(E){var b=[];return E.traverse(function(T){T instanceof Te&&b.push(T)}),b}function C(E){for(var b=S(E).sort(function(x,D){var X=l.objects.get(x).distanceToCameraSquared,W=l.objects.get(D).distanceToCameraSquared;return X-W}),T=b.length,f=0,_=b.length;f<_;f++)b[f].element.style.zIndex=T-f}this.render=function(E,b){var T=b.projectionMatrix.elements[5]*t;if(l.camera.fov!==T&&(b.isPerspectiveCamera?(o.style.WebkitPerspective=T+"px",o.style.perspective=T+"px"):(o.style.WebkitPerspective="",o.style.perspective=""),l.camera.fov=T),E.autoUpdate===!0&&E.updateMatrixWorld(),b.parent===null&&b.updateMatrixWorld(),b.isOrthographicCamera)var f=-(b.right+b.left)/2,_=(b.top+b.bottom)/2;var x=b.isOrthographicCamera?"scale("+T+")translate("+m(f)+"px,"+m(_)+"px)"+y(b.matrixWorldInverse):"translateZ("+T+"px)"+y(b.matrixWorldInverse),D=x+"translate("+n+"px,"+t+"px)";l.camera.style!==D&&!c&&(d.style.WebkitTransform=D,d.style.transform=D,l.camera.style=D),w(E,E,b,x),c&&C(E)}};function Ht(h,s,e){var n=s.getBoundingClientRect(),t=n.top,r=n.left,l=n.width,o=n.height;return new p.Vector2((h.x-r)/l*2-1,-(h.y-t)/o*2+1)}var Xt=(function(h){de(s,h);function s(e,n,t,r,l){var o=h.call(this)||this;o.type="RoundedBoxGeometry",l=isNaN(l)?1:Math.max(1,Math.floor(l)),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,c=n/2-r,m=t/2-r;o.parameters={width:e,height:n,depth:t,radius:r,radiusSegments:l};var y=l+1,M=y*l+1<<3,w=new p.BufferAttribute(new Float32Array(M*3),3),A=new p.BufferAttribute(new Float32Array(M*3),3),S=[],C=[];new p.Vector3;var E=new p.Vector3,b=[],T=[],f=[],_=y*l,x=y*l+1;D(),W(),X(),q(),ie(),ee();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)],L=0;L<8;L++)S.push([]),C.push([]);for(var F=Math.PI/2,k=new p.Vector3(d,c,m),G=0;G<=l;G++){var re=G/l,Z=re*F,V=Math.cos(Z),ne=Math.sin(Z);if(G==l){E.set(0,1,0);var Y=E.clone().multiplyScalar(r).add(k);S[0].push(Y),b.push(Y);var H=E.clone();C[0].push(H),T.push(H);continue}for(var U=0;U<=l;U++){var le=U/l,Q=le*F;E.x=V*Math.cos(Q),E.y=ne,E.z=V*Math.sin(Q);var Y=E.clone().multiplyScalar(r).add(k);S[0].push(Y),b.push(Y);var H=E.clone().normalize();C[0].push(H),T.push(H)}}for(var J=1;J<8;J++)for(var L=0;L<S[0].length;L++){var Y=S[0][L].clone().multiply(I[J]);S[J].push(Y),b.push(Y);var H=C[0][L].clone().multiply(I[J]);C[J].push(H),T.push(H)}}function X(){for(var I=[!0,!1,!0,!1,!1,!0,!1,!0],L=y*(l-1),F=0;F<8;F++){for(var k=x*F,G=0;G<l-1;G++)for(var re=G*y,Z=(G+1)*y,V=0;V<l;V++){var ne=V+1,Y=k+re+V,H=k+re+ne,U=k+Z+V,le=k+Z+ne;I[F]?(f.push(Y),f.push(U),f.push(H),f.push(H),f.push(U),f.push(le)):(f.push(Y),f.push(H),f.push(U),f.push(H),f.push(le),f.push(U))}for(var V=0;V<l;V++){var Y=k+L+V,H=k+L+V+1,U=k+_;I[F]?(f.push(Y),f.push(U),f.push(H)):(f.push(Y),f.push(H),f.push(U))}}}function W(){var I=_,L=_+x,F=_+x*2,k=_+x*3;f.push(I),f.push(L),f.push(F),f.push(I),f.push(F),f.push(k),I=_+x*4,L=_+x*5,F=_+x*6,k=_+x*7,f.push(I),f.push(F),f.push(L),f.push(I),f.push(k),f.push(F),I=0,L=x,F=x*4,k=x*5,f.push(I),f.push(F),f.push(L),f.push(L),f.push(F),f.push(k),I=x*2,L=x*3,F=x*6,k=x*7,f.push(I),f.push(F),f.push(L),f.push(L),f.push(F),f.push(k),I=l,L=l+x*3,F=l+x*4,k=l+x*7,f.push(I),f.push(L),f.push(F),f.push(L),f.push(k),f.push(F),I=l+x,L=l+x*2,F=l+x*5,k=l+x*6,f.push(I),f.push(F),f.push(L),f.push(L),f.push(F),f.push(k)}function q(){for(var I=0;I<4;I++)for(var L=I*x,F=4*x+L,k=(I&1)===1,G=0;G<l;G++){var re=G+1,Z=L+G,V=L+re,ne=F+G,Y=F+re;k?(f.push(Z),f.push(ne),f.push(V),f.push(V),f.push(ne),f.push(Y)):(f.push(Z),f.push(V),f.push(ne),f.push(V),f.push(Y),f.push(ne))}}function ee(){for(var I=[0,2,4,6],L=[1,3,5,7],F=0;F<4;F++)for(var k=x*I[F],G=x*L[F],re=1>=F,Z=0;Z<l;Z++){var V=Z*y,ne=(Z+1)*y,Y=k+V,H=k+ne,U=G+V,le=G+ne;re?(f.push(Y),f.push(U),f.push(H),f.push(H),f.push(U),f.push(le)):(f.push(Y),f.push(H),f.push(U),f.push(H),f.push(le),f.push(U))}}function ie(){for(var I=l-1,L=[0,1,4,5],F=[3,2,7,6],k=[0,1,1,0],G=0;G<4;G++)for(var re=L[G]*x,Z=F[G]*x,V=0;V<=I;V++){var ne=re+l+V*y,Y=re+(V!=I?l+(V+1)*y:x-1),H=Z+l+V*y,U=Z+(V!=I?l+(V+1)*y:x-1);k[G]?(f.push(ne),f.push(H),f.push(Y),f.push(Y),f.push(H),f.push(U)):(f.push(ne),f.push(Y),f.push(H),f.push(Y),f.push(U),f.push(H))}}for(var z=0,K=0;K<b.length;K++)w.setXYZ(z,b[K].x,b[K].y,b[K].z),A.setXYZ(z,T[K].x,T[K].y,T[K].z),z++;return o.setIndex(new p.BufferAttribute(new Uint16Array(f),1)),o.setAttribute("position",w),o.setAttribute("normal",A),o}return s})(p.BufferGeometry);function Ge(h,s){return typeof h!="number"||typeof s!="number"?!1:Math.abs(h-s)<.001}function He(h,s,e,n){n===void 0&&(n=function(r){return r});var t=n(e);return h*(1-t)+s*t}var se=Number((Math.PI/2).toFixed(5));function In(h,s,e){var n=new p.Shape;return n.moveTo(e,0),n.lineTo(h-e,0),n.absarc(h-e,e,e,-se,0,!1),n.lineTo(h,s-e),n.absarc(h-e,s-e,e,0,se,!1),n.lineTo(e,s),n.absarc(e,s-e,e,se,Math.PI,!1),n.lineTo(0,e),n.absarc(e,e,e,Math.PI,Math.PI*1.5,!1),n}var Ye=function(h){var s=document.createElement("div");s.innerText=h;var e=new Te(s);return e.name=h,e.scale.set(.3,.3,.3),s.style.pointerEvents="none",s.style.backfaceVisibility="hidden",e},nt=function(h){var s=new p.PlaneGeometry(5,5),e=new p.MeshBasicMaterial({transparent:!0,opacity:0}),n=new p.Mesh(s,e),t=document.createElement("div");t.innerText=h;var r=new Te(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(-se),n.add(r),n},Dn=(function(h){de(s,h);function s(e,n){var t=h.call(this,e)||this;t.camera=new Se.Camera(90),t.scene=new p.Scene,t.renderer=new p.WebGLRenderer({antialias:!0,alpha:!0}),t.css3drenderer=new Wt,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 Xt(8,8,8,.5,20),new p.MeshPhongMaterial({color:16777215})),t.faces=new p.Group,t.orient=function(o){var d=o.longitude,c=o.latitude;t.dragging=!1,t.spherical=null,t.controls.enableDamping=!1,t.five.setState(Object.assign({latitude:c},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 o,d,c,m,y;if(t.renderer.render(t.scene,t.camera),t.css3drenderer.render(t.scene,t.camera),t.directionalLight.position.copy(t.camera.position),(o=t.controls)===null||o===void 0||o.update(),t.dragging){t.camera.computePose(),t.updateByCamera();var M=t.camera.pose,w=M.longitude,A=M.latitude;t.five.setState({longitude:w,latitude:A},!0),t.updateArrows({longitude:w,latitude:A})}else if(t.spherical&&(!Ge(t.spherical.pi,(d=t.controls)===null||d===void 0?void 0:d.getPolarAngle())||!Ge(t.spherical.theta,(c=t.controls)===null||c===void 0?void 0:c.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,w=S.longitude,A=S.latitude;t.five.setState({longitude:w,latitude:A},!0),t.updateArrows({longitude:w,latitude:A})}else t.spherical=null},t.onTapGesture=function(o){var d=o.pointers[0].clientX,c=o.pointers[0].clientY,m=Ht({x:d,y:c},t.wrapper),y=new p.Raycaster;y.setFromCamera(m,t.camera);var M=y.intersectObjects(t.faces.children,!1)[0];if(M){var w=M.object.userData,A=w.longitude,S=w.latitude;t.orient({longitude:A,latitude:S})}},t.onFiveWantsGesture=function(){if(t.spherical)return!1},t.onFiveModeChange=function(o){t.controls&&(t.controls.maxPolarAngle=o==="Topview"?0:se)},t.onCameraUpdate=function(o){var d=o.state;if(!t.dragging&&!t.spherical){var c=d.longitude,m=d.latitude;t.camera.pose.longitude===c&&t.camera.pose.latitude===m||(t.camera.setFromPose({longitude:c,latitude:m,distance:20,offset:new p.Vector3(0,0,0)}),t.updateByCamera(),t.updateArrows({longitude:c,latitude:m}))}},t.onPanStart=function(o){t.dragging=!0,t.spherical={}},t.onMouseMove=function(o){if(!t.dragging){var d=Ht({x:o.clientX,y:o.clientY},t.wrapper),c=new p.Raycaster;c.setFromCamera(d,t.camera);var m=c.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(o){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 l=j({fixedLongitude:0,orthoView:!0},n==null?void 0:n.config);return t._config=l,t.state.enabled&&t._enable({userAction:!1}),t.mc=new yt.Manager(t.wrapper),t.mc.add(new yt.Tap({interval:410})),t.mc.add(new yt.Pan({threshold:10,pointers:0})),t.camera.setFromPose({distance:20,offset:new 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(
|
|
386
|
+
`,transparent:!0})),t.init(),t}return Object.defineProperty(s.prototype,"config",{get:function(){return j({},this._config)},enumerable:!1,configurable:!0}),s.prototype.updateState=function(e,n){var t=this.state;this.state=j(j({},this.state),e),typeof e.arrowsVisible=="boolean"&&this.handleArrowsVisible(e.arrowsVisible),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},s.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)}},s.prototype.init=function(){this.renderer.setClearAlpha(0),this.renderer.domElement.style.outline="none",this.initDom(),this.initFaces(),this.initControls(),this.initLights();var e=this.cylinder;e.position.y=-3;var n=nt("西");n.position.set(-19,0,0),e.add(n);var t=nt("东");t.position.set(19,0,0),e.add(t);var r=nt("北");r.position.set(0,0,-19),e.add(r);var l=nt("南");l.position.set(0,0,19),e.add(l),this.updateByCamera(),this.scene.add(e,this.box,this.faces),this.scene.rotation.y=this.config.fixedLongitude},s.prototype.initDom=function(){this.style.innerHTML=`
|
|
387
387
|
.OrientationPlugin .OrientationArrows {
|
|
388
388
|
position: absolute;
|
|
389
389
|
top: 0;
|
|
@@ -483,7 +483,7 @@ void main() {
|
|
|
483
483
|
border-color: transparent transparent var(--color) transparent;
|
|
484
484
|
transform: translate(0, -15px);
|
|
485
485
|
}
|
|
486
|
-
`,this.wrapper.className="OrientationPlugin",this.arrows.className="OrientationArrows",this.wrapper.style.cssText="position: relative; width: 100%; height: 100%",this.wrapper.appendChild(this.arrows),this.arrowLeft.className=this.arrowRight.className=this.arrowTop.className=this.arrowBack.className=this.arrowFront.className="OrientationArrow",this.arrowBottom.className="OrientationArrow disabled",this.arrowBack.innerText="后",this.arrowFront.innerText="前",this.arrowLeft.innerText="左",this.arrowRight.innerText="右",this.arrowTop.innerText="上",this.arrowBottom.innerText="下",this.css3drenderer.domElement.style.cssText="position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; color: #00000090;"},
|
|
486
|
+
`,this.wrapper.className="OrientationPlugin",this.arrows.className="OrientationArrows",this.wrapper.style.cssText="position: relative; width: 100%; height: 100%",this.wrapper.appendChild(this.arrows),this.arrowLeft.className=this.arrowRight.className=this.arrowTop.className=this.arrowBack.className=this.arrowFront.className="OrientationArrow",this.arrowBottom.className="OrientationArrow disabled",this.arrowBack.innerText="后",this.arrowFront.innerText="前",this.arrowLeft.innerText="左",this.arrowRight.innerText="右",this.arrowTop.innerText="上",this.arrowBottom.innerText="下",this.css3drenderer.domElement.style.cssText="position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; color: #00000090;"},s.prototype.bindEvents=function(){var e=this;this.five.on("renderFrame",this.onRenderFrame),this.five.on("camera.update",this.onCameraUpdate),this.five.on("wantsGesture",this.onFiveWantsGesture),this.five.on("modeChange",this.onFiveModeChange),this.mc.on("tap",this.onTapGesture),this.mc.on("panstart",this.onPanStart),this.mc.on("panend",this.onPanEnd),this.wrapper.addEventListener("mousemove",this.onMouseMove),this.arrowTop.onclick=function(){return e.orient({longitude:0,latitude:se})},this.arrowLeft.onclick=function(){return e.orient({longitude:-se,latitude:0})},this.arrowRight.onclick=function(){return e.orient({longitude:se,latitude:0})},this.arrowFront.onclick=function(){return e.orient({longitude:0,latitude:0})},this.arrowBack.onclick=function(){return e.orient({longitude:Math.PI,latitude:0})}},s.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},s.prototype.updateByCamera=function(){var e=He(.2,1,this.camera.pose.latitude/Math.PI*2,function(o){return o*o}),n=He(11,13,this.camera.pose.latitude/Math.PI*2,function(o){return o*o}),t=He(12,15,this.camera.pose.latitude/Math.PI*2,function(o){return o*o}),r=He(13,19,this.camera.pose.latitude/Math.PI*2,function(o){return o*o}),l=He(-.2,.5,this.camera.pose.latitude/Math.PI*2,function(o){return o*o});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(o){o.position.normalize().multiplyScalar(r),o.scale.set(e,e,e);var d=o.children[0];d&&(d.element.style.opacity=l.toString())})},s.prototype.updateArrows=function(e){e.longitude;var n=e.latitude,t=se-n<.02;this.setState({arrowsVisible:t})},s.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,l=t.latitude;if(se-l<.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 Ge(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 Ge(se,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 Ge(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(o){o.children[0].element.className=""})},s.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 l={userAction:r};e.enabled?this._enable(l):this._disable(l)}},s.prototype.initLights=function(){this.directionalLight.target=this.box,this.scene.add(this.ambientLight,this.directionalLight)},s.prototype.initFaces=function(){var e=In(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(Ye("前"));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(Ye("后")),r.userData={longitude:Math.PI,latitude:0};var l=new p.Mesh(n,new p.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));l.rotateY(se),l.position.x=4.1,l.add(Ye("右")),l.userData={longitude:se,latitude:0};var o=new p.Mesh(n,new p.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));o.rotateY(-se),o.position.x=-4.1,o.add(Ye("左")),o.userData={longitude:-se,latitude:0};var d=new p.Mesh(n,new p.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));d.rotateX(-se),d.position.y=4.1,d.add(Ye("上")),d.userData={longitude:0,latitude:se},this.faces.add(t,r,o,l,d)},s.prototype.initControls=function(){var e=this.controls=new ke(this.camera,this.renderer.domElement);e.enableZoom=!1,e.enableDamping=!0,e.enablePan=!1,e.maxPolarAngle=se,e.dampingFactor=.15,e.rotateSpeed=.25},s.prototype.load=function(e){return Fe(this,void 0,void 0,function(){return Ie(this,function(n){return[2]})})},s.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()},s.prototype._disable=function(e){this.wrapper.removeChild(this.renderer.domElement),this.wrapper.removeChild(this.css3drenderer.domElement),this.unbindEvents()},s.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)}},s.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)}},s})(exports.BasePlugin.Controller),Nn=function(h,s){return new Dn(h,s)},kn=(function(h){de(s,h);function s(e,n){var t=h.call(this,e)||this;return t.data={},t.pluginName="BackgroundPlugin",t._onFiveCameraUpdate=function(r){var l=(Math.PI/2-Math.max(r.latitude,0))/(Math.PI/2),o=Math.max(.2-l,0)*10;t.gradientBg&&(t.gradientBg.style.transform="translateY(-".concat((1-l)*50,"%)")),t.groundBg&&(t.groundBg.style.backgroundImage="radial-gradient(circle, #2E303350 ".concat(o*100,"%, transparent ").concat(o*120,"%)"))},t._addEventListener=function(){t.five.on("cameraUpdate",t._onFiveCameraUpdate)},t._removeEventListener=function(){t.five.off("cameraUpdate",t._onFiveCameraUpdate)},t.load=function(){return Fe(t,void 0,void 0,function(){return Ie(this,function(r){return[2]})})},t.setState=function(r,l){},t.enable=function(){var r,l=(r=t.five.getElement())===null||r===void 0?void 0:r.parentNode;if(!l){t.five.ready().then(function(){return t.enable()});return}t.state.enabled||(t._onFiveCameraUpdate(t.five.getPose(),!1),t.gradientBg&&l.appendChild(t.gradientBg),t.groundBg&&l.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 l,o,d,c;t.state.enabled&&((o=(l=t.gradientBg)===null||l===void 0?void 0:l.parentNode)===null||o===void 0||o.removeChild(t.gradientBg),(c=(d=t.groundBg)===null||d===void 0?void 0:d.parentNode)===null||c===void 0||c.removeChild(t.groundBg),t.style&&document.head.removeChild(t.style),t._removeEventListener(),t.hooks.emit("disable",{userAction:!0}),t.state.enabled=!1)},t.dispose=function(){t._removeEventListener(),t.hooks.emit("disable",{userAction:!0}),t.state.enabled=!1},t.state={enabled:!1},typeof document=="undefined"||(t.gradientBg=document.createElement("div"),t.groundBg=document.createElement("div"),t.style=document.createElement("style"),t.gradientBg.className="BackgroundPluginBg",t.groundBg.className="BackgroundPluginGroundBg",t.style.innerHTML=`
|
|
487
487
|
.BackgroundPluginBg {
|
|
488
488
|
position: absolute;
|
|
489
489
|
top: 0;
|
|
@@ -504,7 +504,7 @@ void main() {
|
|
|
504
504
|
z-index: -1;
|
|
505
505
|
pointerEvents: none;
|
|
506
506
|
}
|
|
507
|
-
`,t.enable()),t}return
|
|
507
|
+
`,t.enable()),t}return s})(At.BasePlugin.Controller),Bn=function(h,s){return new kn(h,s)};new p.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);var bt=(function(){function h(s,e,n,t,r){this.R=s,this.Q=e,this.A=n,this.B=t,this.C=r,this.cov=NaN,this.x=NaN}return h.prototype.filter=function(s,e){if(e===void 0&&(e=0),isNaN(this.x))this.x=1/this.C*s,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*(s-this.C*n),this.cov=t-r*this.C*t}return this.x},h})(),Un=(function(h){de(s,h);function s(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 l=j({},n==null?void 0:n.config);return t._config=l,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(o){this._currentDistance=o}}}),t}return Object.defineProperty(s.prototype,"config",{get:function(){return j({},this._config)},enumerable:!1,configurable:!0}),s.prototype.updateState=function(e,n){var t=this.state;this.state=j(j({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},s.prototype.load=function(e){return Fe(this,void 0,void 0,function(){return Ie(this,function(n){return[2]})})},s.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,l=0,o=1,d=new bt(n,t,r,l,o),c=new bt(n,t,r,l,o),m=new bt(n,t,r,l,o);if(this.trajectory&&this.trajectory.content.loadState==="READY"){for(var y=this.trajectory.content.data.positionArray,M=new Float32Array(y.length/3),w=0;w<M.length;w++)if(w===0)M[w]=0;else{var A=new p.Vector3(y[w-3],y[w-2],y[w-1]),S=new p.Vector3(y[w],y[w+1],y[w+2]);M[w]=S.distanceTo(A)+M[w-1]}this.totalDistance=M[M.length-1];for(var w=0;w<M.length;w++){for(var C=new p.Vector3(0,0,0),E=0,b=w-5;b<w+6;b++)b>=0&&b<M.length&&(C.add(new p.Vector3(y[b*3],y[b*3+1],y[b*3+2])),E++);C.divideScalar(E).applyMatrix4(e.transform);var T=d.filter(C.x),f=c.filter(C.y),_=m.filter(C.z),x={position:new p.Vector3(T,f,_),location:M[w]};this.keyframes.push(x)}}else throw new Error("trajectory content is not ready")},s.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())},s.prototype._enable=function(e){},s.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(j({},this.virualCamera.pose)));var r=this.playingState.keyframeIndex,l=0;this.cancelAnimation=Se.AnimationFrameLoop.shared.add(function(o,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 c=e.currentKeyFrame.position.clone(),m=e.nextKeyframe.position.clone(),y=e.nextKeyframe.position.clone().sub(e.currentKeyFrame.position.clone()).normalize(),M=c.clone().add(y.clone().multiplyScalar(.01)),w=new p.Vector3;e.nextButOneKeyframe!==null?w=e.nextButOneKeyframe.position.clone().sub(e.nextKeyframe.position.clone()).normalize():w.copy(y);var A=m.clone().add(w.clone().multiplyScalar(.01));l+=d/1e3*e.rate;var S=l/c.distanceTo(m);S=S>=1?1:S,t.keyframeIndex!==null&&t.progress!==null&&(S=t.progress,t.keyframeIndex=null,t.progress=null);var C=c.clone().lerp(m,S),E=M.clone().lerp(A,S);e.virualCamera.position.copy(C),e.virualCamera.lookAt(E),e.virualCamera.updateMatrixWorld(),e.virualCamera.updateMatrix(),e.virualCamera.computePose(),e.five.setState(j({},e.virualCamera.pose)),e.location=e.keyframes[r].location+c.clone().distanceTo(C),S===1?(l=0,r++,e.playingState.keyframeIndex=r,e.playingState.progress=0):(e.playingState.keyframeIndex=r,e.playingState.progress=S)})},s.prototype.pause=function(){this.cancelAnimation&&this.cancelAnimation()},s.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}}},s.prototype.resetPlayingState=function(){this.playingState.keyframeIndex=null,this.playingState.progress=null},s.prototype._disable=function(e){},s.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})}},s.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})}},s})(exports.BasePlugin.Controller),Vn=function(h,s){return new Un(h,s)};function Yt(h,s,e){return h<s?s:h>e?e:h}var Rn=`
|
|
508
508
|
varying vec2 vUv;
|
|
509
509
|
varying vec3 vPosition;
|
|
510
510
|
void main() {
|
|
@@ -531,7 +531,7 @@ void main() {
|
|
|
531
531
|
}
|
|
532
532
|
gl_FragColor.a = gl_FragColor.a * opacity;
|
|
533
533
|
}
|
|
534
|
-
`,zn=[1,5,2,6,3,7,4,8,9,13,10,14,11,15,12,16],wt=512,Et=512,rt=128,Gn=(function(h){de(
|
|
534
|
+
`,zn=[1,5,2,6,3,7,4,8,9,13,10,14,11,15,12,16],wt=512,Et=512,rt=128,Gn=(function(h){de(s,h);function s(e,n){var t=h.call(this,e)||this;t.group=new p.Group,t.mesh=(function(){var o=new p.CylinderGeometry(.12,.12,1,32,1,!0);o.translate(0,.5,0);var d=new p.ShaderMaterial({vertexShader:Rn,fragmentShader:jn,uniforms:{map:{value:new p.Texture},progress:{value:0},opacity:{value:0}},transparent:!0,depthTest:!1}),c=new p.Mesh(o,d);return c})(),t.panoMesh=new Se.PanoCircleMesh({scale:1.5}),t.stop=function(){},t.drawLine=function(o,d){if(t.ctx){var c=(function(){var M,w=wt/16|0;return w*((M=zn[o])!==null&&M!==void 0?M:0)})(),m=(1-(d+o*150)%1200/1200)*(Et+rt),y=t.ctx.createLinearGradient(0,m-rt,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(c,m-rt,3,rt)}},t.anime=function(o){if(t.ctx&&t.startTime){t.ctx.clearRect(0,0,wt,Et);for(var d=0;d<16;d++)t.drawLine(d,o-t.startTime);var c=Yt((o-t.startTime)/1e3,0,1),m=Yt((o-t.startTime)/300,0,t.config.maxOpacity);t.panoMesh.setOpacity(m),t.mesh.material.uniforms.progress.value=c,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 l=j(j({},n==null?void 0:n.config),{maxOpacity:1});return t._config=l,typeof document=="undefined"||(t.canvas=document.createElement("canvas"),t.ctx=t.canvas.getContext("2d"),t.canvas.width=wt,t.canvas.height=Et,t.ctx.shadowColor="rgba(255,255,255,0.5)",t.ctx.shadowBlur=6,t.ctx.shadowOffsetX=0,t.ctx.shadowOffsetY=0,t.mesh.material.uniforms.map.value=new 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(s.prototype,"config",{get:function(){return j({},this._config)},enumerable:!1,configurable:!0}),s.prototype.updateState=function(e,n){var t=this.state;this.state=j(j({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},s.prototype.updateConfig=function(e,n){var t;n===void 0&&(n={});var r=this.config,l=j(j({},r),e);this._config=l,this.hooks.emit("configChange",{prevConfig:r,config:l,userAction:(t=n.userAction)!==null&&t!==void 0?t:!0})},s.prototype.load=function(e){return Fe(this,void 0,void 0,function(){return Ie(this,function(n){return[2]})})},s.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=Se.AnimationFrameLoop.shared.add(function(t,r){n.startTime||(n.startTime=t),n.panoMesh.updateTime(t,r),n.anime(t)})})},s.prototype._disable=function(e){this.five.scene.remove(this.group),this.panoMesh.setOpacity(0),this.startTime=void 0,this.stop(),this.five.needsRender=!0},s.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})}},s.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})}},s.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 l={userAction:r};e.enabled?this._enable(l):this._disable(l)}},s})(At.BasePlugin.Controller),Hn=function(h,s){return new Gn(h,s)},St=(function(h){de(s,h);function s(){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 s.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},s.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},s.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},s.prototype.fromWireframeGeometry=function(e){return this.setPositions(e.attributes.position.array),this},s.prototype.fromEdgesGeometry=function(e){return this.setPositions(e.attributes.position.array),this},s.prototype.fromMesh=function(e){return this.fromWireframeGeometry(new p.WireframeGeometry(e.geometry)),this},s.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},s.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)}},s.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,l=new p.Vector3,o=0,d=e.count;o<d;o++)l.fromBufferAttribute(e,o),r=Math.max(r,t.distanceToSquared(l)),l.fromBufferAttribute(n,o),r=Math.max(r,t.distanceToSquared(l));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)}},s.prototype.toJSON=function(){},s})(p.InstancedBufferGeometry);Object.assign(St.prototype,{isLineSegmentsGeometry:!0});var Tt={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>
|
|
@@ -696,7 +696,7 @@ void main() {
|
|
|
696
696
|
if (len2 > 1.0) discard;
|
|
697
697
|
}
|
|
698
698
|
|
|
699
|
-
vec4 diffuseColor = vec4(diffuse,
|
|
699
|
+
vec4 diffuseColor = vec4(diffuse, 1.0);
|
|
700
700
|
#include <logdepthbuf_fragment>
|
|
701
701
|
#include <color_fragment>
|
|
702
702
|
|
|
@@ -723,11 +723,12 @@ void main() {
|
|
|
723
723
|
if (vDistanceProgress > endFadeStart) {
|
|
724
724
|
gl_FragColor.a *= (1.0 - vDistanceProgress) / startFadeLength;
|
|
725
725
|
}
|
|
726
|
+
gl_FragColor.a *= opacity;
|
|
726
727
|
#include <tonemapping_fragment>
|
|
727
728
|
#include <fog_fragment>
|
|
728
729
|
#include <premultiplied_alpha_fragment>
|
|
729
730
|
}
|
|
730
|
-
`},xt=(function(h){de(o,h);function o(e){var n=h.call(this,{uniforms:p.UniformsUtils.clone(Tt.uniforms),vertexShader:Tt.vertexShader,fragmentShader:Tt.fragmentShader,clipping:!0})||this;return n.type="LineMaterial",n.dashed=!1,Object.defineProperties(n,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(t){this.uniforms.time.value=t}},waveAmp:{enumerable:!0,get:function(){return this.uniforms.waveAmp.value},set:function(t){this.uniforms.waveAmp.value=t}},waveFreq:{enumerable:!0,get:function(){return this.uniforms.waveFreq.value},set:function(t){this.uniforms.waveFreq.value=t}},waveDir:{enumerable:!0,get:function(){return this.uniforms.waveDir.value},set:function(t){this.uniforms.waveDir.value=t}},startOffset:{enumerable:!0,get:function(){return this.uniforms.startOffset.value},set:function(t){this.uniforms.startOffset.value=t}},endOffset:{enumerable:!0,get:function(){return this.uniforms.endOffset.value},set:function(t){this.uniforms.endOffset.value=t}},range:{enumerable:!0,get:function(){return this.uniforms.range.value},set:function(t){this.uniforms.range.value=t}},animationProgress:{enumerable:!0,get:function(){return this.uniforms.animationProgress.value},set:function(t){this.uniforms.animationProgress.value=t}}}),n.setValues(e),n}return o})(p.ShaderMaterial);Object.assign(xt.prototype,{isLineMaterial:!0});var qt=(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 St,t.material=n!==void 0?n:new xt({color:Math.random()*16777215}),t}return o.prototype.computeLineDistances=function(){for(var e=this.geometry,n=e.attributes.instanceStart,t=e.attributes.instanceEnd,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 A=s.distanceTo(l);r[y]=y===0?0:r[y-1],r[y+1]=r[y]+A}var E=new p.InstancedInterleavedBuffer(r,2,1);return e.setAttribute("instanceDistanceStart",new p.InterleavedBufferAttribute(E,1,0)),e.setAttribute("instanceDistanceEnd",new p.InterleavedBufferAttribute(E,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,A=l.attributes.instanceEnd,E=new p.Vector4,M=new p.Vector4,S=new p.Vector4,C=new p.Vector3,w=new p.Matrix4,b=new p.Line3,P=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;_++){E.fromBufferAttribute(y,_),M.fromBufferAttribute(A,_),E.w=1,M.w=1,E.applyMatrix4(w),M.applyMatrix4(w),E.applyMatrix4(s),M.applyMatrix4(s),E.multiplyScalar(1/E.w),M.multiplyScalar(1/M.w);var D=E.z<-1&&M.z<-1,X=E.z>1&&M.z>1;if(!(D||X)){E.x*=f.x/2,E.y*=f.y/2,M.x*=f.x/2,M.y*=f.y/2,b.start.copy(E),b.start.z=0,b.end.copy(M),b.end.z=0;var W=b.closestPointToPointParameter(C,!0);b.at(W,P);var q=p.MathUtils.lerp(E.z,M.z,W),ee=q>=-1&&q<=1,ie=C.distanceTo(P)<m*.5;if(ee&&ie){b.start.fromBufferAttribute(y,_),b.end.fromBufferAttribute(A,_),b.start.applyMatrix4(c),b.end.applyMatrix4(c);var z=new p.Vector3,K=new p.Vector3;t.distanceSqToSegment(b.start,b.end,K,z),n.push({point:K,pointOnLine:z,distance:t.origin.distanceTo(K),object:this,faceIndex:_})}}}},o})(p.Mesh);Object.assign(qt.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})(qt);Object.assign(Kt.prototype,{isLine2:!0});var Zt=(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})(St);Object.assign(Zt.prototype,{isLineGeometry:!0});var Yn=(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=j(j({},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 j({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(e,n){var t=this.state;this.state=j(j({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},o.prototype.load=function(e,n){return Fe(this,void 0,void 0,function(){var t,r=this;return Ie(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),A=(n=e.subMeshColor)!==null&&n!==void 0?n:this._config.subMeshColor,E=(t=e.subMeshWidth)!==null&&t!==void 0?t:this._config.subMeshWidth,M=(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),P=this.createParticles(),c=P.particles,_=P.particleGeometry,x=P.particleMaterial,D=P.particleInfos,X=P.particlePositions,W=this.createSubMeshGeometry(e,y,E),q=y.getLength(),ee=this.createSubMeshMaterial(A,M,q,w);ee.uniforms.totalLength.value=q;var ie=new p.Mesh(W,ee);ie.visible=S,this.five.scene.add(ie);var z={id:e.id,config:e,curve:y,lines:b,particles:c,particleGeometry:_,particleMaterial:x,particleInfos:D,particlePositions:X,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:ie,subMeshGeometry:W,subMeshMaterial:ee,subMeshColor:A,subMeshWidth:E,subMeshOpacity:M,speed:C,animationId:null,enableSubMesh:S};this.paths.set(e.id,z);var K=this.data,I=new Map;return this.paths.forEach(function(L,F){I.set(F,L.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?j({},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 A=y/s;t.push(l[d].x,l[d].y,l[d].z),r.push(A)}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,A=m.spacing,E=m.waveAmp,M=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(),P=t/b,c=function(D){var X=(D-(y-1)/2)*A,W=e.points.map(function(I,L){var F=L/(e.points.length-1),k=n.getTangent(F).normalize(),G=new p.Vector3().crossVectors(r.up,k).normalize(),re=X*Math.abs((L-e.points.length/2)/e.points.length-.5)*-1;return I.clone().addScaledVector(G,X+re).add(new p.Vector3(0,S+.02*(D%2===0?1:0),0))}),q=new p.CatmullRomCurve3(W),ee=_.getPositions(q,f).positions,ie=new Zt;ie.setPositions(ee);var z=new xt({color:w,linewidth:C*(D%2===0?1:.5),transparent:!0,opacity:1,depthWrite:!1});z.resolution.set(_.five.camera.resolution.x,_.five.camera.resolution.y),D===0?z.waveDir=1:D===1?z.waveDir=2:D===2?z.waveDir=0:D===3?z.waveDir=3:D===4&&(z.waveDir=1),z.waveAmp=E,z.waveFreq=M,Object.assign(z.uniforms,{time:{value:0},startOffset:{value:0},range:{value:P}});var K=new Kt(ie,z);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:`
|
|
731
|
+
`},xt=(function(h){de(s,h);function s(e){var n=h.call(this,{uniforms:p.UniformsUtils.clone(Tt.uniforms),vertexShader:Tt.vertexShader,fragmentShader:Tt.fragmentShader,clipping:!0})||this;return n.type="LineMaterial",n.dashed=!1,Object.defineProperties(n,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(t){this.uniforms.time.value=t}},waveAmp:{enumerable:!0,get:function(){return this.uniforms.waveAmp.value},set:function(t){this.uniforms.waveAmp.value=t}},waveFreq:{enumerable:!0,get:function(){return this.uniforms.waveFreq.value},set:function(t){this.uniforms.waveFreq.value=t}},waveDir:{enumerable:!0,get:function(){return this.uniforms.waveDir.value},set:function(t){this.uniforms.waveDir.value=t}},startOffset:{enumerable:!0,get:function(){return this.uniforms.startOffset.value},set:function(t){this.uniforms.startOffset.value=t}},endOffset:{enumerable:!0,get:function(){return this.uniforms.endOffset.value},set:function(t){this.uniforms.endOffset.value=t}},range:{enumerable:!0,get:function(){return this.uniforms.range.value},set:function(t){this.uniforms.range.value=t}},animationProgress:{enumerable:!0,get:function(){return this.uniforms.animationProgress.value},set:function(t){this.uniforms.animationProgress.value=t}}}),n.setValues(e),n}return s})(p.ShaderMaterial);Object.assign(xt.prototype,{isLineMaterial:!0});var qt=(function(h){de(s,h);function s(e,n){var t=h.call(this)||this;return t.type="LineSegments2",t.geometry=e!==void 0?e:new St,t.material=n!==void 0?n:new xt({color:Math.random()*16777215}),t}return s.prototype.computeLineDistances=function(){for(var e=this.geometry,n=e.attributes.instanceStart,t=e.attributes.instanceEnd,r=new Float32Array(2*n.count),l=new p.Vector3,o=new p.Vector3,d=0,c=0,m=n.count;c<m;c++)l.fromBufferAttribute(n,c),o.fromBufferAttribute(t,c),d+=l.distanceTo(o);this.material.uniforms.totalLength.value=d;for(var c=0,y=0,m=n.count;c<m;c++,y+=2){l.fromBufferAttribute(n,c),o.fromBufferAttribute(t,c);var M=l.distanceTo(o);r[y]=y===0?0:r[y-1],r[y+1]=r[y]+M}var w=new p.InstancedInterleavedBuffer(r,2,1);return e.setAttribute("instanceDistanceStart",new p.InterleavedBufferAttribute(w,1,0)),e.setAttribute("instanceDistanceEnd",new p.InterleavedBufferAttribute(w,1,1)),this},s.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,l=r.projectionMatrix,o=this.geometry,d=this.material,c=d.resolution,m=d.linewidth,y=o.attributes.instanceStart,M=o.attributes.instanceEnd,w=new p.Vector4,A=new p.Vector4,S=new p.Vector4,C=new p.Vector3,E=new p.Matrix4,b=new p.Line3,T=new p.Vector3;t.at(1,S),S.w=1,S.applyMatrix4(r.matrixWorldInverse),S.applyMatrix4(l),S.multiplyScalar(1/S.w),S.x*=c.x/2,S.y*=c.y/2,S.z=0,C.copy(S);var f=this.matrixWorld;E.multiplyMatrices(r.matrixWorldInverse,f);for(var _=0,x=y.count;_<x;_++){w.fromBufferAttribute(y,_),A.fromBufferAttribute(M,_),w.w=1,A.w=1,w.applyMatrix4(E),A.applyMatrix4(E),w.applyMatrix4(l),A.applyMatrix4(l),w.multiplyScalar(1/w.w),A.multiplyScalar(1/A.w);var D=w.z<-1&&A.z<-1,X=w.z>1&&A.z>1;if(!(D||X)){w.x*=c.x/2,w.y*=c.y/2,A.x*=c.x/2,A.y*=c.y/2,b.start.copy(w),b.start.z=0,b.end.copy(A),b.end.z=0;var W=b.closestPointToPointParameter(C,!0);b.at(W,T);var q=p.MathUtils.lerp(w.z,A.z,W),ee=q>=-1&&q<=1,ie=C.distanceTo(T)<m*.5;if(ee&&ie){b.start.fromBufferAttribute(y,_),b.end.fromBufferAttribute(M,_),b.start.applyMatrix4(f),b.end.applyMatrix4(f);var z=new p.Vector3,K=new p.Vector3;t.distanceSqToSegment(b.start,b.end,K,z),n.push({point:K,pointOnLine:z,distance:t.origin.distanceTo(K),object:this,faceIndex:_})}}}},s})(p.Mesh);Object.assign(qt.prototype,{isLineSegments2:!0});var Kt=(function(h){de(s,h);function s(e,n){var t=h.call(this,e,n)||this;return t.type="Line2",t}return s})(qt);Object.assign(Kt.prototype,{isLine2:!0});var Zt=(function(h){de(s,h);function s(){var e=h.call(this)||this;return e.type="LineGeometry",e}return s.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},s.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},s.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},s.prototype.copy=function(){return this},s})(St);Object.assign(Zt.prototype,{isLineGeometry:!0});var Yn=(function(h){de(s,h);function s(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 l={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=j(j({},l),n==null?void 0:n.config),n!=null&&n.paths&&n.paths.length>0&&n.paths.forEach(function(o){t.addPath(o)}),t.state.enabled&&t._enable({userAction:!1}),t}return Object.defineProperty(s.prototype,"config",{get:function(){return j({},this._config)},enumerable:!1,configurable:!0}),s.prototype.updateState=function(e,n){var t=this.state;this.state=j(j({},this.state),e),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:n})},s.prototype.load=function(e,n){return Fe(this,void 0,void 0,function(){var t,r=this;return Ie(this,function(l){return this.clearAllPaths(),e.paths.forEach(function(o){var d,c,m=o.points.map(function(y){return new p.Vector3(y.x,y.y,y.z)});r.addPath({id:o.id,points:m,enabled:(d=o.enabled)!==null&&d!==void 0?d:!0,visible:(c=o.visible)!==null&&c!==void 0?c:!0,color:o.color,lineWidth:o.lineWidth,speed:o.speed})}),t=new Map,this.paths.forEach(function(o,d){t.set(d,o.config)}),this.data={paths:t},this.hooks.emit("dataLoaded",this.data),n&&this.setState(n),[2]})})},s.prototype.addPath=function(e){var n,t,r,l,o,d,c,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),M=(n=e.subMeshColor)!==null&&n!==void 0?n:this._config.subMeshColor,w=(t=e.subMeshWidth)!==null&&t!==void 0?t:this._config.subMeshWidth,A=(r=e.subMeshOpacity)!==null&&r!==void 0?r:this._config.subMeshOpacity,S=(l=e.enableSubMesh)!==null&&l!==void 0?l:!0,C=(o=e.speed)!==null&&o!==void 0?o:this._config.speed,E=(d=e.range)!==null&&d!==void 0?d:this._config.range,b=this.createLines(e,y,E),T=this.createParticles(),f=T.particles,_=T.particleGeometry,x=T.particleMaterial,D=T.particleInfos,X=T.particlePositions,W=this.createSubMeshGeometry(e,y,w),q=y.getLength(),ee=this.createSubMeshMaterial(M,A,q,E);ee.uniforms.totalLength.value=q;var ie=new p.Mesh(W,ee);ie.visible=S,this.five.scene.add(ie);var z={id:e.id,config:e,curve:y,lines:b,particles:f,particleGeometry:_,particleMaterial:x,particleInfos:D,particlePositions:X,enabled:(c=e.enabled)!==null&&c!==void 0?c:!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:ie,subMeshGeometry:W,subMeshMaterial:ee,subMeshColor:M,subMeshWidth:w,subMeshOpacity:A,speed:C,animationId:null,enableSubMesh:S,isPaused:!1,pausedProgress:0,pausedTime:0};this.paths.set(e.id,z);var K=this.data,I=new Map;return this.paths.forEach(function(L,F){I.set(F,L.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},s.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(l,o){r.set(o,l.config)}),this.data={paths:r},this.hooks.emit("dataChange",this.data,t),this.hooks.emit("pathRemove",e),!0},s.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)},s.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)},s.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)},s.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)},s.prototype.getPathIds=function(){return Array.from(this.paths.keys())},s.prototype.getPathConfig=function(e){var n=this.paths.get(e);return n?j({},n.config):void 0},s.prototype.clearAllPaths=function(){var e=this;this.paths.forEach(function(r,l){e.stopPathAnimation(l),e.disposePathResources(r)}),this.paths.clear();var n=this.data,t=new Map;this.paths.forEach(function(r,l){t.set(l,r.config)}),this.data={paths:t},this.hooks.emit("dataChange",this.data,n)},s.prototype.getPositions=function(e,n){for(var t=[],r=[],l=0,o=[],d=0;d<=n;d++){var c=d/n,m=e.getPoint(c);o.push(m.clone()),d>0&&(l+=m.distanceTo(o[d-1]))}for(var y=0,d=0;d<n;d++){d>0&&(y+=o[d].distanceTo(o[d-1]));var M=y/l;t.push(o[d].x,o[d].y,o[d].z),r.push(M)}return{positions:t,distanceProgress:r}},s.prototype.createLines=function(e,n,t){for(var r=this,l,o,d=[],c=e.points.length*40,m=this._config,y=m.lineCount,M=m.spacing,w=m.waveAmp,A=m.waveFreq,S=m.lineYOffset,C=(l=e.lineWidth)!==null&&l!==void 0?l:this._config.lineWidth,E=(o=e.color)!==null&&o!==void 0?o:this._config.color,b=n.getLength(),T=t/b,f=function(D){var X=(D-(y-1)/2)*M,W=e.points.map(function(I,L){var F=L/(e.points.length-1),k=n.getTangent(F).normalize(),G=new p.Vector3().crossVectors(r.up,k).normalize(),re=X*Math.abs((L-e.points.length/2)/e.points.length-.5)*-1;return I.clone().addScaledVector(G,X+re).add(new p.Vector3(0,S+.02*(D%2===0?1:0),0))}),q=new p.CatmullRomCurve3(W),ee=_.getPositions(q,c).positions,ie=new Zt;ie.setPositions(ee);var z=new xt({color:E,linewidth:C*(D%2===0?1:.5),transparent:!0,opacity:1,depthWrite:!1});z.resolution.set(_.five.camera.resolution.x,_.five.camera.resolution.y),D===0?z.waveDir=1:D===1?z.waveDir=2:D===2?z.waveDir=0:D===3?z.waveDir=3:D===4&&(z.waveDir=1),z.waveAmp=w,z.waveFreq=A,Object.assign(z.uniforms,{time:{value:0},startOffset:{value:0},range:{value:T}});var K=new Kt(ie,z);K.computeLineDistances(),d.push(K),_.five.scene.add(K)},_=this,x=0;x<y;x++)f(x);return d},s.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:`
|
|
731
732
|
attribute float size;
|
|
732
733
|
varying vec2 vUv;
|
|
733
734
|
void main() {
|
|
@@ -742,7 +743,7 @@ void main() {
|
|
|
742
743
|
gl_FragColor = texture2D(pointTexture, gl_PointCoord);
|
|
743
744
|
gl_FragColor.a *= 0.15;
|
|
744
745
|
}
|
|
745
|
-
`})},
|
|
746
|
+
`})},s.prototype.createParticles=function(){for(var e=this._config.particleCount,n=new Float32Array(e*3),t=new p.BufferGeometry,r=this.createParticleMaterial(),l=new p.Points(t,r),o=new Float32Array(e),d=[],c=0;c<e;c++)n[c*3]=9999,n[c*3+1]=9999,n[c*3+2]=9999,o[c]=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(o,1)),l.frustumCulled=!1,this.five.scene.add(l),{particles:l,particleGeometry:t,particleMaterial:r,particleInfos:d,particlePositions:n}},s.prototype.createSubMeshGeometry=function(e,n,t){for(var r=e.points.length*40,l=new p.BufferGeometry,o=n.getPoints(r),d=[],c=[],m=[],y=[],M=0,w=[0],A=1;A<o.length;A++)M+=o[A].distanceTo(o[A-1]),w.push(M);for(var S=M,A=0;A<o.length;A++){var C=o[A],E=A/(o.length-1),b=n.getTangent(E).normalize(),T=new p.Vector3().crossVectors(this.up,b).normalize(),f=t/2,_=C.clone().addScaledVector(T,-f);d.push(_.x,_.y,_.z),c.push(0,w[A]/S),y.push(w[A]/S);var x=C.clone().addScaledVector(T,f);d.push(x.x,x.y,x.z),c.push(1,w[A]/S),y.push(w[A]/S)}for(var A=0;A<o.length-1;A++){var D=A*2;m.push(D,D+1,D+2),m.push(D+1,D+3,D+2)}return l.setAttribute("position",new p.Float32BufferAttribute(d,3)),l.setAttribute("uv",new p.Float32BufferAttribute(c,2)),l.setAttribute("distanceProgress",new p.Float32BufferAttribute(y,1)),l.setIndex(m),l.computeVertexNormals(),l},s.prototype.createAlphaMapTexture=function(e,n,t,r,l){for(var o=1024,d=1,c=o*d,m=new Uint8Array(c),y=1/e,M=t/e,w=n/M,A=w/2,S=0;S<o;S++){var C=S/o,E=Math.floor(C/y),b=(C-E*y)/y,T=0,f=b;if(f>.5&&(f=1-f),f<A){var _=1-f/A,x=_;T=r+(l-r)*x}else T=r;m[S]=Math.floor(T*255)}var D=new p.DataTexture(m,o,d,p.RedFormat);return D.needsUpdate=!0,D.wrapS=p.RepeatWrapping,D.wrapT=p.ClampToEdgeWrapping,D.minFilter=p.LinearFilter,D.magFilter=p.LinearFilter,D},s.prototype.createSubMeshMaterial=function(e,n,t,r){var l=this._config,o=l.subMeshSegmentInterval,d=l.subMeshHighlightWidth,c=l.subMeshMaxOpacity,m=Math.max(1,Math.round(t/o)),y=r/t,M=this.createAlphaMapTexture(m,d,t,n,c);return new p.ShaderMaterial({transparent:!0,side:p.BackSide,depthWrite:!1,uniforms:{baseColor:{value:new p.Color(e)},baseOpacity:{value:n},globalOpacity:{value:1},animationProgress:{value:0},range:{value:y},startOffset:{value:0},endOffset:{value:0},totalLength:{value:1},unfoldProgress:{value:0},alphaMap:{value:M}},vertexShader:`
|
|
746
747
|
attribute float distanceProgress;
|
|
747
748
|
varying vec2 vUv;
|
|
748
749
|
varying float vDistanceProgress;
|
|
@@ -755,6 +756,7 @@ void main() {
|
|
|
755
756
|
`,fragmentShader:`
|
|
756
757
|
uniform vec3 baseColor;
|
|
757
758
|
uniform float baseOpacity;
|
|
759
|
+
uniform float globalOpacity;
|
|
758
760
|
uniform float animationProgress;
|
|
759
761
|
uniform float range;
|
|
760
762
|
uniform float startOffset;
|
|
@@ -808,6 +810,6 @@ void main() {
|
|
|
808
810
|
sampledAlpha *= (1.0 - adjustedProgress) / fadeLength;
|
|
809
811
|
}
|
|
810
812
|
|
|
811
|
-
gl_FragColor = vec4(baseColor, sampledAlpha);
|
|
813
|
+
gl_FragColor = vec4(baseColor, sampledAlpha * globalOpacity);
|
|
812
814
|
}
|
|
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),A=r.speed,E=(s-r.cycleStartTime)*A/y%1;if(r.isInitialAnimation){var M=E*y;if(r.enableSubMesh&&M>=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*A/(y-2*S)),r.subMeshMaterial.uniforms.unfoldProgress.value=r.subMeshUnfoldProgress}E<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=E,r.lastUpdateTime=s,r.isPathlineInitialAnimation&&r.lines.forEach(function(q){q.material.uniforms.time.value=s,q.material.uniforms.animationProgress.value=E}),r.isPathlineInitialAnimation){var w=null,b=1/0;if(r.lines.forEach(function(q){for(var ee=q.geometry,ie=ee.attributes.instanceDistanceStart,z=ee.attributes.instanceDistanceEnd,K=ie.count,I=0;I<K;I++){var L=ie.getX(I)/q.material.uniforms.totalLength.value,F=z.getX(I)/q.material.uniforms.totalLength.value;if(E>=L&&E<=F){var k=(E-L)/(F-L),G=new p.Vector3().fromBufferAttribute(ee.attributes.instanceStart,I),re=new p.Vector3().fromBufferAttribute(ee.attributes.instanceEnd,I),Z=new p.Vector3().lerpVectors(G,re,k),V=Math.abs(E-(L+F)/2);V<b&&(b=V,w=Z)}}}),w)for(var P=0;P<d;P++){var c=r.particleInfos[P];!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[P*3]=w.x,r.particlePositions[P*3+1]=w.y,r.particlePositions[P*3+2]=w.z,c.startPos.copy(w),c.alpha=0)}for(var P=0;P<d;P++){var c=r.particleInfos[P];if(c.active){c.age+=.016;var _=r.particlePositions[P*3]-c.startPos.x,x=r.particlePositions[P*3+1]-c.startPos.y,D=r.particlePositions[P*3+2]-c.startPos.z,X=Math.sqrt(_*_+x*x+D*D);(X>=f||c.age>=c.life)&&(c.active=!1,r.particlePositions[P*3]=9999,r.particlePositions[P*3+1]=9999,r.particlePositions[P*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[P*3]+=c.velocity.x,r.particlePositions[P*3+1]+=c.velocity.y,r.particlePositions[P*3+2]+=c.velocity.z;var W=c.age/c.life;W<.2?c.alpha=W/.2:W>.8?c.alpha=(1-W)/.2:c.alpha=1}}r.particleGeometry.attributes.position.needsUpdate=!0,r.particleMaterial.opacity=.6}r.enableSubMesh&&(r.subMeshMaterial.uniforms.animationProgress.value=E),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=Le.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})(At.BasePlugin.Controller),Wn=function(h,o){return new Yn(h,o)};exports.BackgroundPlugin=Bn;exports.CSS3DRenderer=Wt;exports.DynamicPathLinePlugin=Wn;exports.ItemMaskPlugin=Fn;exports.OrbitControls=ke;exports.OrientationPlugin=Nn;exports.PanoAnimePlugin=Hn;exports.RoundedBoxGeometry=Xt;exports.TrajectoryPlugin=Vn;
|
|
815
|
+
`})},s.prototype.projectPointsToScreen=function(e,n){for(var t=[],r=0,l=0;l<e.length;l++){var o=e[l];l>0&&(r+=o.distanceTo(e[l-1]));var d=o.clone().project(n),c=d.x<-1||d.x>1||d.y<-1||d.y>1||d.z<-1||d.z>1;t.push({point:o.clone(),screenPos:new p.Vector2(d.x,d.y),distanceFromStart:r,isOffscreen:c})}return t},s.prototype.findNearestOffscreenPoint=function(e){for(var n=-1,t=0,r=-1,l=0;l<e.length;l++)if(!e[l].isOffscreen){r=l;break}if(r===-1)return null;for(var l=r-1;l>=0;l--)if(e[l].isOffscreen){n=l,t=e[l].distanceFromStart;break}return n===-1?{index:0,distance:0}:{index:n,distance:t}},s.prototype.findFarestOffscreenPoint=function(e){for(var n,t=((n=e[e.length-1])===null||n===void 0?void 0:n.distanceFromStart)||0,r=-1,l=e.length-1;l>=0;l--)if(!e[l].isOffscreen){r=l;break}if(r===-1)return null;var o=r+1;return o<e.length&&e[o].isOffscreen?{index:o,distance:e[o].distanceFromStart,totalLength:t}:{index:e.length-1,distance:t,totalLength:t}},s.prototype.updatePathAnimation=function(e){var n,t,r=this.paths.get(e);if(!(!r||!r.enabled)){var l=performance.now()/1e3,o=this._config,d=o.particleCount,c=o.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),M=r.speed,w=(l-r.cycleStartTime)*M/y%1;if(r.isInitialAnimation){var A=w*y;if(r.enableSubMesh&&A>=1&&!r.subMeshUnfoldStarted&&(r.subMeshUnfoldStarted=!0,r.subMeshUnfoldStartTime=l),r.enableSubMesh&&r.subMeshUnfoldStarted&&r.subMeshUnfoldProgress<1&&!r.isPaused){var S=(t=r.config.range)!==null&&t!==void 0?t:this._config.range,C=l-r.subMeshUnfoldStartTime;r.subMeshUnfoldProgress=Math.min(1,C*M/(y-2*S)),r.subMeshMaterial.uniforms.unfoldProgress.value=r.subMeshUnfoldProgress}w<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=w,r.lastUpdateTime=l,r.isPathlineInitialAnimation&&r.lines.forEach(function(q){q.material.uniforms.time.value=l,q.material.uniforms.animationProgress.value=w}),r.isPathlineInitialAnimation){var E=null,b=1/0;if(r.lines.forEach(function(q){for(var ee=q.geometry,ie=ee.attributes.instanceDistanceStart,z=ee.attributes.instanceDistanceEnd,K=ie.count,I=0;I<K;I++){var L=ie.getX(I)/q.material.uniforms.totalLength.value,F=z.getX(I)/q.material.uniforms.totalLength.value;if(w>=L&&w<=F){var k=(w-L)/(F-L),G=new p.Vector3().fromBufferAttribute(ee.attributes.instanceStart,I),re=new p.Vector3().fromBufferAttribute(ee.attributes.instanceEnd,I),Z=new p.Vector3().lerpVectors(G,re,k),V=Math.abs(w-(L+F)/2);V<b&&(b=V,E=Z)}}}),E)for(var T=0;T<d;T++){var f=r.particleInfos[T];!f.active&&Math.random()<.05&&(f.active=!0,f.age=0,f.life=3+Math.random()*2,f.velocity.set((Math.random()-.5)*1e-4,(Math.random()-.5)*1e-4,(Math.random()-.5)*1e-4),r.particlePositions[T*3]=E.x,r.particlePositions[T*3+1]=E.y,r.particlePositions[T*3+2]=E.z,f.startPos.copy(E),f.alpha=0)}for(var T=0;T<d;T++){var f=r.particleInfos[T];if(f.active){f.age+=.016;var _=r.particlePositions[T*3]-f.startPos.x,x=r.particlePositions[T*3+1]-f.startPos.y,D=r.particlePositions[T*3+2]-f.startPos.z,X=Math.sqrt(_*_+x*x+D*D);(X>=c||f.age>=f.life)&&(f.active=!1,r.particlePositions[T*3]=9999,r.particlePositions[T*3+1]=9999,r.particlePositions[T*3+2]=9999,f.alpha=0),f.velocity.x+=(Math.random()-.5)*1e-4,f.velocity.z+=(Math.random()-.5)*1e-4,f.velocity.y+=1e-4,f.velocity.multiplyScalar(.99),r.particlePositions[T*3]+=f.velocity.x,r.particlePositions[T*3+1]+=f.velocity.y,r.particlePositions[T*3+2]+=f.velocity.z;var W=f.age/f.life;W<.2?f.alpha=W/.2:W>.8?f.alpha=(1-W)/.2:f.alpha=1}}r.particleGeometry.attributes.position.needsUpdate=!0,r.particleMaterial.opacity=.6}r.enableSubMesh&&(r.subMeshMaterial.uniforms.animationProgress.value=w),this.five.needsRender=!0}},s.prototype.startPathAnimation=function(e,n){var t=this,r,l,o=this.paths.get(e);if(!o)return console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1;if(o.animationId!==null)return!1;var d=(r=n==null?void 0:n.startPointIndex)!==null&&r!==void 0?r:0,c=(l=n==null?void 0:n.fromStart)!==null&&l!==void 0?l:!1;if(!o.isPaused||c){var m=0,y=d;if(y>0){var M=o.config.points;y>=M.length&&(console.warn("DynamicPathLinePlugin: startPointIndex ".concat(y," 超出范围,路径只有 ").concat(M.length," 个点")),y=M.length-1);for(var w=0;w<y;w++)m+=M[w].distanceTo(M[w+1])}o.startOffset=m,o.lines.forEach(function(T){T.material.uniforms.startOffset.value=m}),o.enableSubMesh&&(o.subMeshMaterial.uniforms.startOffset.value=m)}var A=performance.now()/1e3;if(!c&&o.isPaused&&o.pausedProgress>0){var S=o.curve.getLength(),C=Math.max(.01,S-o.startOffset-o.endOffset),E=o.speed;if(o.cycleStartTime=A-o.pausedProgress*C/E,o.subMeshUnfoldStarted&&o.subMeshUnfoldProgress<1){var b=o.pausedTime-o.subMeshUnfoldStartTime;o.subMeshUnfoldStartTime=A-b}o.isPaused=!1}else o.cycleStartTime=A,o.isPaused=!1,o.pausedProgress=0;return o.lastUpdateTime=A,this.highlightPath(e,!0),o.animationId=Se.AnimationFrameLoop.shared.add(function(){t.updatePathAnimation(e)}),!0},s.prototype.stopPathAnimation=function(e,n){n===void 0&&(n=!1);var t=this.paths.get(e);if(!t)return console.warn("DynamicPathLinePlugin: 路径 ".concat(e," 不存在")),!1;if(this.highlightPath(e,!1),t.animationId!==null){if(n){var r=performance.now()/1e3,l=t.curve.getLength(),o=Math.max(.01,l-t.startOffset-t.endOffset),d=t.speed;if(t.pausedProgress=(r-t.cycleStartTime)*d/o%1,t.pausedTime=r,t.isPaused=!0,t.subMeshUnfoldStarted&&t.subMeshUnfoldProgress<1){var c=r-t.subMeshUnfoldStartTime;t.subMeshUnfoldStartTime=r-c}}else t.isPaused=!1,t.pausedProgress=0,t.pausedTime=0;t.animationId(),t.animationId=null}return!0},s.prototype._enable=function(e){this.paths.size>0&&this.state.playing&&this.play()},s.prototype._disable=function(e){this.pause()},s.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})}},s.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})}},s.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(l){return l.visible=!0}),r.particles.visible=!0,r.subMesh.visible=!0}),this.updateState({visible:!0},t)},s.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(l){return l.visible=!1}),r.particles.visible=!1,r.subMesh.visible=!1}),this.updateState({visible:!1},t)},s.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))},s.prototype.play=function(e){var n=this;e===void 0&&(e=!1),this.paths.forEach(function(t,r){n.startPathAnimation(r,{fromStart:e})}),this.updateState({playing:!0},!1),this.hooks.emit("animationStart")},s.prototype.pause=function(){var e=this;this.paths.forEach(function(n,t){e.stopPathAnimation(t,!0)}),this.updateState({playing:!1},!1),this.hooks.emit("animationStop")},s.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.isPaused=!1,n.pausedProgress=0,n.pausedTime=0,n.lines.forEach(function(o){o.visible=!0,o.material.uniforms.time.value=0,o.material.uniforms.animationProgress.value=0,o.material.uniforms.startOffset.value=0,o.material.uniforms.endOffset.value=0}),n.particles.visible=!0;for(var t=e._config.particleCount,r=0;r<t;r++){var l=n.particleInfos[r];l.active=!1,l.age=0,l.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)})},s.prototype.highlightPath=function(e,n){var t=this,r=this.paths.get(e);if(r)var l=r.lines,o=0,d=250,c=Se.AnimationFrameLoop.shared.add(function(m,y){o=Math.min(1,o+y/d),n?(l.forEach(function(M){M.material.uniforms.opacity.value=.3+o*.7}),r.particleMaterial.opacity=.3+o*.7,r.enableSubMesh&&(r.subMeshMaterial.uniforms.globalOpacity.value=.3+o*.7)):(l.forEach(function(M){M.material.uniforms.opacity.value=1-o*.7}),r.particleMaterial.opacity=.6*(1-o*.7),r.enableSubMesh&&(r.subMeshMaterial.uniforms.globalOpacity.value=1-o*.7)),t.five.needsRender=!0,o===1&&c()})},s.prototype.updateScreenProjection=function(e){var n=this,t=function(l){var o=n.projectPointsToScreen(l.config.points,n.five.camera),d=n.findNearestOffscreenPoint(o);d&&(l.startOffset=d.distance);var c=n.findFarestOffscreenPoint(o);c&&(l.endOffset=c.totalLength-c.distance),l.lines.forEach(function(m){m.material.uniforms.startOffset.value=l.startOffset,m.material.uniforms.endOffset.value=l.endOffset}),l.subMeshMaterial.uniforms.startOffset.value=l.startOffset,l.subMeshMaterial.uniforms.endOffset.value=l.endOffset,l.cycleStartTime=performance.now()/1e3,l.lastAnimationProgress=0};if(e){var r=this.paths.get(e);r&&t(r)}else this.paths.forEach(function(l){l.enabled&&t(l)})},s.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()},s.prototype.dispose=function(){this.pause(),this.clearAllPaths(),this.hooks.emit("dispose")},s})(At.BasePlugin.Controller),Wn=function(h,s){return new Yn(h,s)};exports.BackgroundPlugin=Bn;exports.CSS3DRenderer=Wt;exports.DynamicPathLinePlugin=Wn;exports.ItemMaskPlugin=Fn;exports.OrbitControls=ke;exports.OrientationPlugin=Nn;exports.PanoAnimePlugin=Hn;exports.RoundedBoxGeometry=Xt;exports.TrajectoryPlugin=Vn;
|