@realsee/five 5.0.0-alpha.21 → 5.0.0-alpha.211
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/README.md +18 -8
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +134 -0
- package/docs/assets/icons.css +1043 -0
- package/docs/assets/main.js +52 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1414 -0
- package/docs/classes/five.AnimationFrameLoop.html +15 -0
- package/docs/classes/five.BVH.html +10 -0
- package/docs/classes/five.BVHIntersect.html +1 -0
- package/docs/classes/five.BVHNode.html +7 -0
- package/docs/classes/five.BVHVector3.html +1 -0
- package/docs/classes/five.Camera.html +11 -0
- package/docs/classes/five.Clipper.html +1 -0
- package/docs/classes/five.Five.html +335 -0
- package/docs/classes/five.InternalWebGLRenderer.html +1 -0
- package/docs/classes/five.IntersectMesh.html +1 -0
- package/docs/classes/five.Model.html +99 -0
- package/docs/classes/five.NetworkSubscribe.html +50 -0
- package/docs/classes/five.PBMContainer.html +17 -0
- package/docs/classes/five.PBMGroup.html +19 -0
- package/docs/classes/five.PBMMaterial.html +29 -0
- package/docs/classes/five.PBMMesh.html +7 -0
- package/docs/classes/five.PanoCircleMesh.html +7 -0
- package/docs/classes/five.PanoCircleMeshCustom.html +7 -0
- package/docs/classes/five.PanoCircleMeshSolid.html +7 -0
- package/docs/classes/five.Scene.html +3 -0
- package/docs/classes/five.Subscribe.html +56 -0
- package/docs/classes/five.TextureLoader.html +1 -0
- package/docs/classes/five.Tile3D.html +34 -0
- package/docs/classes/five.Tile3DModel.html +15 -0
- package/docs/classes/five.TileBoundingSphere.html +1 -0
- package/docs/classes/five.TileCacheNode.html +1 -0
- package/docs/classes/five.TileCubeTextureTarget.html +1 -0
- package/docs/classes/five.TileCullingVolume.html +1 -0
- package/docs/classes/five.TileOrientedBoundingBox.html +1 -0
- package/docs/classes/five.TileRequestScheduler.html +16 -0
- package/docs/classes/five.Tileset3D.html +11 -0
- package/docs/classes/five.Tileset3DTraverser.html +1 -0
- package/docs/classes/five.TilesetCache.html +1 -0
- package/docs/classes/five.Work.html +32 -0
- package/docs/classes/five.XRButton.html +1 -0
- package/docs/classes/gltf_loader.DDSLoader.html +1 -0
- package/docs/classes/gltf_loader.DRACOLoader.html +1 -0
- package/docs/classes/gltf_loader.GLTFLoader.html +17 -0
- package/docs/classes/gltf_loader.GLTFObject.html +7 -0
- package/docs/classes/gltf_loader.GLTFParser.html +1 -0
- package/docs/classes/gltf_loader.THREEGLTFLoader.html +1 -0
- package/docs/classes/line.Line.html +1 -0
- package/docs/classes/line.LineGeometry.html +1 -0
- package/docs/classes/line.LineMaterial.html +1 -0
- package/docs/classes/line.LineSegmentsGeometry.html +1 -0
- package/docs/classes/line.THREE_Line2.html +1 -0
- package/docs/classes/line.THREE_LineSegments2.html +1 -0
- package/docs/classes/react.Store.html +29 -0
- package/docs/classes/server.BVH.html +10 -0
- package/docs/classes/server.BVHIntersect.html +1 -0
- package/docs/classes/server.BVHNode.html +7 -0
- package/docs/classes/server.BVHVector3.html +1 -0
- package/docs/classes/server.Model.html +70 -0
- package/docs/classes/server.PBMContainer.html +7 -0
- package/docs/classes/server.PBMGroup.html +9 -0
- package/docs/classes/server.PBMMesh.html +7 -0
- package/docs/classes/sticker.Sticker.html +32 -0
- package/docs/classes/vfx.Airflow.html +1 -0
- package/docs/classes/vfx.Flame.html +1 -0
- package/docs/classes/vfx.Particle.html +89 -0
- package/docs/classes/vfx.SpotLight.html +1 -0
- package/docs/index.html +166 -434
- package/docs/interfaces/five.AddableObject.html +9 -0
- package/docs/interfaces/five.AnimationFrame.html +1 -0
- package/docs/interfaces/five.CameraPose.html +1 -0
- package/docs/interfaces/five.ClipperParameter.html +1 -0
- package/docs/interfaces/five.DepthPanoramaControllerCustomInitArgs.html +28 -0
- package/docs/interfaces/five.EventCallback.html +405 -0
- package/docs/interfaces/five.FiveInitArgs.html +111 -0
- package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +17 -0
- package/docs/interfaces/five.ImageOptions.html +18 -0
- package/docs/interfaces/five.ImageURLMappings.html +1 -0
- package/docs/interfaces/five.ImageURLOptions.html +15 -0
- package/docs/interfaces/five.IntersectMeshInterface.html +3 -0
- package/docs/interfaces/five.Intersection.html +7 -0
- package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +15 -0
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +20 -0
- package/docs/interfaces/five.ModelEventCallback.html +26 -0
- package/docs/interfaces/five.ModelLodOptions.html +1 -0
- package/docs/interfaces/five.MotionKeyframe.html +1 -0
- package/docs/interfaces/five.MovePanoOptions.html +42 -0
- package/docs/interfaces/five.NetworkOptions.html +9 -0
- package/docs/interfaces/five.PBMPanoPicture.html +7 -0
- package/docs/interfaces/five.PBMParameters.html +29 -0
- package/docs/interfaces/five.PanoCircleMeshCustomOptions.html +1 -0
- package/docs/interfaces/five.PanoCircleMeshInterface.html +19 -0
- package/docs/interfaces/five.PanoCircleMeshOptions.html +1 -0
- package/docs/interfaces/five.PanoCircleMeshSolidOptions.html +1 -0
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +35 -0
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +20 -0
- package/docs/interfaces/five.Pose.html +37 -0
- package/docs/interfaces/five.Scissor.html +14 -0
- package/docs/interfaces/five.State.html +21 -0
- package/docs/interfaces/five.SubscribeMixinType.emit.html +1 -0
- package/docs/interfaces/five.SubscribeMixinType.hasListener.html +1 -0
- package/docs/interfaces/five.SubscribeMixinType.off.html +1 -0
- package/docs/interfaces/five.SubscribeMixinType.on.html +1 -0
- package/docs/interfaces/five.SubscribeMixinType.once.html +1 -0
- package/docs/interfaces/five.TextureOptions.html +20 -0
- package/docs/interfaces/five.Tile3DModelLoaderOptions.html +3 -0
- package/docs/interfaces/five.TileBoundingVolume.html +19 -0
- package/docs/interfaces/five.TileContent.html +1 -0
- package/docs/interfaces/five.TileCubeNode.html +1 -0
- package/docs/interfaces/five.TileCubeTree.html +1 -0
- package/docs/interfaces/five.Tileset3dOptions.html +1 -0
- package/docs/interfaces/five.TilesetJSON.html +1 -0
- package/docs/interfaces/five.TilesetJSONNode.html +1 -0
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +9 -0
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +31 -0
- package/docs/interfaces/five.WebXRAxesParams.html +1 -0
- package/docs/interfaces/five.WebXRControllerParams.html +1 -0
- package/docs/interfaces/five.WorkCubeImage.html +13 -0
- package/docs/interfaces/five.WorkImage.html +21 -0
- package/docs/interfaces/five.WorkInitial.html +13 -0
- package/docs/interfaces/five.WorkModel.html +11 -0
- package/docs/interfaces/five.WorkModelTiles.html +3 -0
- package/docs/interfaces/five.WorkObserver.html +27 -0
- package/docs/interfaces/five.WorkTile.html +1 -0
- package/docs/interfaces/five.WorkVideo.html +9 -0
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +31 -0
- package/docs/interfaces/gltf_loader.DDS.html +1 -0
- package/docs/interfaces/gltf_loader.GLTF.html +7 -0
- package/docs/interfaces/gltf_loader.GLTFReference.html +1 -0
- package/docs/interfaces/gltf_loader.THREEGLTF.html +1 -0
- package/docs/interfaces/react.FiveActionReactCallbacks.html +52 -0
- package/docs/interfaces/react.FiveInjectionTypes.html +181 -0
- package/docs/interfaces/react.PropTypeOfFiveFeatures.html +1 -0
- package/docs/interfaces/server.Intersection.html +7 -0
- package/docs/interfaces/server.ModelEventCallback.html +18 -0
- package/docs/interfaces/sticker.IntersectionLike.html +8 -0
- package/docs/interfaces/vfx.ParticleArgs.html +75 -0
- package/docs/interfaces/vfx.ParticleTweenKeyframe.html +1 -0
- package/docs/interfaces/vue.FiveActionVueCallbacks.html +60 -0
- package/docs/modules/five.SubscribeMixinType.html +1 -0
- package/docs/modules/five.html +470 -3006
- package/docs/modules/gltf_loader.html +1 -155
- package/docs/modules/line.html +1 -210
- package/docs/modules/react.html +130 -1507
- package/docs/modules/server.html +18 -526
- package/docs/modules/sticker.html +1 -151
- package/docs/modules/vfx.html +1 -0
- package/docs/modules/vue.html +115 -0
- package/docs/modules.html +1 -136
- package/exporters/staticify.js +210 -0
- package/five/index.d.ts +1506 -283
- package/five/index.js +362 -1
- package/gltf-loader/index.d.ts +90 -5
- package/gltf-loader/index.js +260 -1
- package/line/index.d.ts +1 -0
- package/line/index.js +260 -1
- package/package.json +12 -11
- package/react/index.d.ts +73 -72
- package/react/index.js +260 -1
- package/scripts/five-staticify.js +26 -0
- package/server/index.d.ts +222 -27
- package/server/index.js +357 -1
- package/sticker/index.d.ts +2 -1
- package/sticker/index.js +260 -1
- package/templates/quick-start/package.json +1 -1
- package/umd/five-gltf-loader.js +1 -2
- package/umd/five-line.js +1 -2
- package/umd/five-react.js +1 -2
- package/umd/five-sticker.js +1 -2
- package/umd/five-vfx.js +1 -0
- package/umd/five-vue.js +1 -0
- package/umd/five.js +1 -1
- package/umd/five.js.LICENSE.txt +58 -118
- package/vfx/index.d.ts +264 -0
- package/vfx/index.js +260 -0
- package/vue/index.d.ts +441 -0
- package/vue/index.js +260 -0
- package/docs/assets/css/main.css +0 -2660
- package/docs/assets/js/main.js +0 -248
- package/docs/assets/js/search.js +0 -1
- package/docs/classes/five.camera.html +0 -323
- package/docs/classes/five.five-1.html +0 -2670
- package/docs/classes/five.hashcubetexture.html +0 -252
- package/docs/classes/five.internalwebglrenderer.html +0 -212
- package/docs/classes/five.model.html +0 -962
- package/docs/classes/five.pbmcontainer.html +0 -411
- package/docs/classes/five.pbmgroup.html +0 -430
- package/docs/classes/five.pbmmaterial.html +0 -533
- package/docs/classes/five.pbmmesh.html +0 -254
- package/docs/classes/five.scene.html +0 -263
- package/docs/classes/five.subscribe.html +0 -569
- package/docs/classes/gltf_loader.gltfloader.html +0 -412
- package/docs/classes/gltf_loader.gltfobject.html +0 -287
- package/docs/classes/line.line-1.html +0 -384
- package/docs/classes/line.linegeometry.html +0 -530
- package/docs/classes/line.linematerial.html +0 -306
- package/docs/classes/line.linesegmentsgeometry.html +0 -477
- package/docs/classes/line.three_line2.html +0 -280
- package/docs/classes/line.three_linesegments2.html +0 -282
- package/docs/classes/react.store.html +0 -605
- package/docs/classes/server.model.html +0 -823
- package/docs/classes/server.pbmgroup.html +0 -366
- package/docs/classes/server.pbmmesh.html +0 -335
- package/docs/classes/sticker.sticker-1.html +0 -465
- package/docs/interfaces/five.addableobject.html +0 -234
- package/docs/interfaces/five.depthpanoramacontrollercustominitargs.html +0 -420
- package/docs/interfaces/five.eventcallback.html +0 -2548
- package/docs/interfaces/five.fiveinitargs.html +0 -707
- package/docs/interfaces/five.floorplancontrollercustominitargs.html +0 -295
- package/docs/interfaces/five.imageoptions.html +0 -332
- package/docs/interfaces/five.intersection.html +0 -227
- package/docs/interfaces/five.intersectmeshinterface.html +0 -188
- package/docs/interfaces/five.modelcontrollercustominitargs.html +0 -366
- package/docs/interfaces/five.modeleventcallback.html +0 -367
- package/docs/interfaces/five.movepanooptions.html +0 -469
- package/docs/interfaces/five.panocirclemeshinterface.html +0 -361
- package/docs/interfaces/five.panoramacontrollercustominitargs.html +0 -464
- package/docs/interfaces/five.panoramalikecontrollercustominitargs.html +0 -364
- package/docs/interfaces/five.pbmparameters.html +0 -474
- package/docs/interfaces/five.pose.html +0 -270
- package/docs/interfaces/five.scissor.html +0 -252
- package/docs/interfaces/five.state.html +0 -300
- package/docs/interfaces/five.subscribemixintype.emit.html +0 -180
- package/docs/interfaces/five.subscribemixintype.haslistener.html +0 -171
- package/docs/interfaces/five.subscribemixintype.off.html +0 -198
- package/docs/interfaces/five.subscribemixintype.on.html +0 -213
- package/docs/interfaces/five.subscribemixintype.once.html +0 -210
- package/docs/interfaces/five.topviewcontrollercustominitargs.html +0 -226
- package/docs/interfaces/five.vrpanoramacontrollercustominitargs.html +0 -452
- package/docs/interfaces/gltf_loader.gltf.html +0 -304
- package/docs/interfaces/react.fiveactionreactcallbacks.html +0 -580
- package/docs/interfaces/react.fiveinjectiontypes.html +0 -1625
- package/docs/interfaces/react.injectfivetoprops.html +0 -280
- package/docs/interfaces/server.intersection.html +0 -308
- package/docs/interfaces/server.modeleventcallback.html +0 -409
- package/docs/interfaces/sticker.intersectionlike.html +0 -223
- package/docs/modules/five.subscribemixintype.html +0 -143
- package/scripts/export-five-resource/chfs.exe +0 -0
- package/scripts/export-five-resource/fileify.js +0 -192
- package/scripts/export-five-resource/format-work.js +0 -71
- package/scripts/export-five-resource/staticify.js +0 -327
- package/scripts/transcode-model/BufferGeometryUtils.js +0 -832
- package/scripts/transcode-model/LoaderSupport.js +0 -1545
- package/scripts/transcode-model/MTLLoader.js +0 -602
- package/scripts/transcode-model/OBJLoader2.js +0 -1470
- package/scripts/transcode-model/obj2pbm.js +0 -65
- /package/docs/assets/{images/icons.png → icons.png} +0 -0
- /package/docs/assets/{images/icons@2x.png → icons@2x.png} +0 -0
- /package/docs/assets/{images/widgets.png → widgets.png} +0 -0
- /package/docs/assets/{images/widgets@2x.png → widgets@2x.png} +0 -0
- /package/resource/{basis_transcoder.js → basis/basis_transcoder.js} +0 -0
- /package/resource/{basis_transcoder.wasm → basis/basis_transcoder.wasm} +0 -0
- /package/resource/{draco_decoder.js → gltf/draco_decoder.js} +0 -0
- /package/resource/{draco_decoder.wasm → gltf/draco_decoder.wasm} +0 -0
- /package/resource/{draco_wasm_wrapper.js → gltf/draco_wasm_wrapper.js} +0 -0
package/umd/five-line.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
/*! For license information please see five-line.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.FiveSDK_Line=e():t.FiveSDK_Line=e()}(self,(function(){return(()=>{var t={438:t=>{if(!("THREE"in window))throw new Error('"THREE" is not available. Please include "three.js" in your HTML.');const e=Number(THREE.REVISION);if(e<115||e>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');t.exports=window.THREE}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var o=e[i]={exports:{}};return t[i](o,o.exports,n),o.exports}n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";n.r(i),n.d(i,{Line:()=>p,LineGeometry:()=>l,LineMaterial:()=>s,LineSegmentsGeometry:()=>o,THREE_Line2:()=>c,THREE_LineSegments2:()=>u});var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}Object.create,Object.create;var r=n(438),o=function(t){function n(){var e=t.call(this)||this;return e.type="LineSegmentsGeometry",e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new r.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new r.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return e(n,t),n.prototype.applyMatrix4=function(t){var e=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),n.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},n.prototype.setPositions=function(t){var e;e=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var n=new r.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceStart",new r.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new r.InterleavedBufferAttribute(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},n.prototype.setColors=function(t){var e;e=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var n=new r.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceColorStart",new r.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceColorEnd",new r.InterleavedBufferAttribute(n,3,3)),this},n.prototype.fromWireframeGeometry=function(t){return this.setPositions(t.attributes.position.array),this},n.prototype.fromEdgesGeometry=function(t){return this.setPositions(t.attributes.position.array),this},n.prototype.fromMesh=function(t){return this.fromWireframeGeometry(new r.WireframeGeometry(t.geometry)),this},n.prototype.fromLineSegments=function(t){var e=t.geometry;if(e instanceof r.Geometry){var n=(new r.BufferGeometry).fromGeometry(e);this.setPositions(n.attributes.position.array)}else e instanceof r.BufferGeometry&&this.setPositions(e.attributes.position.array);return this},n.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new r.Box3);var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var n=new r.Box3;this.boundingBox.setFromBufferAttribute(t),n.setFromBufferAttribute(e),this.boundingBox.union(n)}},n.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new r.Sphere),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var n=this.boundingSphere.center;this.boundingBox.getCenter(n);for(var i=0,o=new r.Vector3,a=0,s=t.count;a<s;a++)o.fromBufferAttribute(t,a),i=Math.max(i,n.distanceToSquared(o)),o.fromBufferAttribute(e,a),i=Math.max(i,n.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},n.prototype.toJSON=function(){},n}(r.InstancedBufferGeometry);Object.assign(o.prototype,{isLineSegmentsGeometry:!0});var a={uniforms:r.UniformsUtils.merge([r.UniformsLib.common,r.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new r.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"},s=function(t){function n(e){var n=t.call(this,{uniforms:r.UniformsUtils.clone(a.uniforms),vertexShader:a.vertexShader,fragmentShader:a.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)}}}),n.setValues(e),n}return e(n,t),n}(r.ShaderMaterial);Object.assign(s.prototype,{isLineMaterial:!0});var u=function(t){function n(e,n){var i=t.call(this)||this;return i.type="LineSegments2",i.geometry=void 0!==e?e:new o,i.material=void 0!==n?n:new s({color:16777215*Math.random()}),i}return e(n,t),n.prototype.computeLineDistances=function(){for(var t=this.geometry,e=t.attributes.instanceStart,n=t.attributes.instanceEnd,i=new Float32Array(2*e.count),o=new r.Vector3,a=new r.Vector3,s=0,u=0,c=e.count;s<c;s++,u+=2)o.fromBufferAttribute(e,s),a.fromBufferAttribute(n,s),i[u]=0===u?0:i[u-1],i[u+1]=i[u]+o.distanceTo(a);var l=new r.InstancedInterleavedBuffer(i,2,1);return t.setAttribute("instanceDistanceStart",new r.InterleavedBufferAttribute(l,1,0)),t.setAttribute("instanceDistanceEnd",new r.InterleavedBufferAttribute(l,1,1)),this},n.prototype.raycast=function(t,e){null===t.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var n=t.ray,i=t.camera,o=i.projectionMatrix,a=this.geometry,s=this.material,u=s.resolution,c=s.linewidth,l=a.attributes.instanceStart,f=a.attributes.instanceEnd,d=new r.Vector4,p=new r.Vector4,m=new r.Vector4,v=new r.Vector3,h=new r.Matrix4,y=new r.Line3,A=new r.Vector3;n.at(1,m),m.w=1,m.applyMatrix4(i.matrixWorldInverse),m.applyMatrix4(o),m.multiplyScalar(1/m.w),m.x*=u.x/2,m.y*=u.y/2,m.z=0,v.copy(m);var g=this.matrixWorld;h.multiplyMatrices(i.matrixWorldInverse,g);for(var b=0,w=l.count;b<w;b++){d.fromBufferAttribute(l,b),p.fromBufferAttribute(f,b),d.w=1,p.w=1,d.applyMatrix4(h),p.applyMatrix4(h),d.applyMatrix4(o),p.applyMatrix4(o),d.multiplyScalar(1/d.w),p.multiplyScalar(1/p.w);var S=d.z<-1&&p.z<-1,x=d.z>1&&p.z>1;if(!S&&!x){d.x*=u.x/2,d.y*=u.y/2,p.x*=u.x/2,p.y*=u.y/2,y.start.copy(d),y.start.z=0,y.end.copy(p),y.end.z=0;var E=y.closestPointToPointParameter(v,!0);y.at(E,A);var B=r.MathUtils.lerp(d.z,p.z,E),M=B>=-1&&B<=1,P=v.distanceTo(A)<.5*c;if(M&&P){y.start.fromBufferAttribute(l,b),y.end.fromBufferAttribute(f,b),y.start.applyMatrix4(g),y.end.applyMatrix4(g);var z=new r.Vector3,L=new r.Vector3;n.distanceSqToSegment(y.start,y.end,L,z),e.push({point:L,pointOnLine:z,distance:n.origin.distanceTo(L),object:this,faceIndex:b})}}}},n}(r.Mesh);Object.assign(u.prototype,{isLineSegments2:!0});var c=function(t){function n(e,n){var i=t.call(this,e,n)||this;return i.type="Line2",i}return e(n,t),n}(u);Object.assign(c.prototype,{isLine2:!0});var l=function(t){function n(){var e=t.call(this)||this;return e.type="LineGeometry",e}return e(n,t),n.prototype.setPositions=function(e){for(var n=e.length-3,i=new Float32Array(2*n),r=0;r<n;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return t.prototype.setPositions.call(this,i),this},n.prototype.setColors=function(e){for(var n=e.length-3,i=new Float32Array(2*n),r=0;r<n;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return t.prototype.setColors.call(this,i),this},n.prototype.fromLine=function(t){var e=t.geometry;if(e instanceof r.Geometry){var n=(new r.BufferGeometry).fromGeometry(e);this.setPositions(n.attributes.position.array)}else e instanceof r.BufferGeometry&&this.setPositions(e.attributes.position.array);return this},n.prototype.copy=function(){return this},n}(o);Object.assign(l.prototype,{isLineGeometry:!0});var f=14467195,d=null,p=function(t){function n(e,n){void 0===e&&(e=new r.Vector3),void 0===n&&(n=new r.Vector3);var i=t.call(this)||this;i.type="FiveLine",i.needsRender=!0;var o=new l,a=new s({color:f,linewidth:2,dashScale:20,dashed:!1});i.line=new c(o,a);var u=new r.BufferGeometry,p=new r.PointsMaterial({color:f,size:8,map:d||(d=(new r.TextureLoader).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==")),sizeAttenuation:!1,transparent:!0});return i.points=new r.Points(u,p),i.points.renderOrder=11,i.points.frustumCulled=!1,i.setPoints(e,n),i.add(i.line,i.points),i}return e(n,t),n.prototype.setPoints=function(t,e){var n=[].concat(t.toArray(),e.toArray());this.points.geometry.setAttribute("position",new r.BufferAttribute(new Float32Array(n),3)),this.line.geometry.setPositions(n),this.line.computeLineDistances(),this.needsRender=!0},n.prototype.getPoints=function(){var t=this.points.geometry.attributes.position.array;return[new r.Vector3(t[0],t[1],t[2]),new r.Vector3(t[3],t[4],t[5])]},n.prototype.setMaterial=function(t){var e=this.line.material;for(var n in t)if(t.hasOwnProperty(n)){var i=t[n];"dashed"===n?(e.dashed=i,i?e.defines.USE_DASH="":delete e.defines.USE_DASH,e.needsUpdate=!0):e[n]=t[n]}this.needsRender=!0},n.prototype.setResolution=function(t,e){var n=this.line.material.resolution;n.x===t&&n.y===e||(n.set(t,e),this.needsRender=!0)},n}(r.Object3D);Object.assign(p.prototype,{isFiveLine:!0})})(),i})()}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.FiveSDK_Line=e():t.FiveSDK_Line=e()}(self,(()=>(()=>{var t={438:t=>{if(!("THREE"in window))throw new Error('"THREE" is not available. Please include "three.js" in your HTML.');const e=Number(THREE.REVISION);if(e<115||e>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');t.exports=window.THREE}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var o=e[i]={exports:{}};return t[i](o,o.exports,n),o.exports}n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";n.r(i),n.d(i,{Line:()=>p,LineGeometry:()=>l,LineMaterial:()=>s,LineSegmentsGeometry:()=>o,THREE_Line2:()=>c,THREE_LineSegments2:()=>u});var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}Object.create,Object.create;var r=n(438),o=function(t){function n(){var e=t.call(this)||this;return e.type="LineSegmentsGeometry",e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new r.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new r.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return e(n,t),n.prototype.applyMatrix4=function(t){var e=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),n.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},n.prototype.setPositions=function(t){var e;e=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var n=new r.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceStart",new r.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new r.InterleavedBufferAttribute(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},n.prototype.setColors=function(t){var e;e=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var n=new r.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceColorStart",new r.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceColorEnd",new r.InterleavedBufferAttribute(n,3,3)),this},n.prototype.fromWireframeGeometry=function(t){return this.setPositions(t.attributes.position.array),this},n.prototype.fromEdgesGeometry=function(t){return this.setPositions(t.attributes.position.array),this},n.prototype.fromMesh=function(t){return this.fromWireframeGeometry(new r.WireframeGeometry(t.geometry)),this},n.prototype.fromLineSegments=function(t){var e=t.geometry;if(e instanceof r.Geometry){var n=(new r.BufferGeometry).fromGeometry(e);this.setPositions(n.attributes.position.array)}else e instanceof r.BufferGeometry&&this.setPositions(e.attributes.position.array);return this},n.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new r.Box3);var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var n=new r.Box3;this.boundingBox.setFromBufferAttribute(t),n.setFromBufferAttribute(e),this.boundingBox.union(n)}},n.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new r.Sphere),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var n=this.boundingSphere.center;this.boundingBox.getCenter(n);for(var i=0,o=new r.Vector3,a=0,s=t.count;a<s;a++)o.fromBufferAttribute(t,a),i=Math.max(i,n.distanceToSquared(o)),o.fromBufferAttribute(e,a),i=Math.max(i,n.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},n.prototype.toJSON=function(){},n}(r.InstancedBufferGeometry);Object.assign(o.prototype,{isLineSegmentsGeometry:!0});var a={uniforms:r.UniformsUtils.merge([r.UniformsLib.common,r.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new r.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1},opacity:{value:1}}]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"},s=function(t){function n(e){var n=t.call(this,{uniforms:r.UniformsUtils.clone(a.uniforms),vertexShader:a.vertexShader,fragmentShader:a.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)}}}),n.setValues(e),n}return e(n,t),n}(r.ShaderMaterial);Object.assign(s.prototype,{isLineMaterial:!0});var u=function(t){function n(e,n){var i=t.call(this)||this;return i.type="LineSegments2",i.geometry=void 0!==e?e:new o,i.material=void 0!==n?n:new s({color:16777215*Math.random()}),i}return e(n,t),n.prototype.computeLineDistances=function(){for(var t=this.geometry,e=t.attributes.instanceStart,n=t.attributes.instanceEnd,i=new Float32Array(2*e.count),o=new r.Vector3,a=new r.Vector3,s=0,u=0,c=e.count;s<c;s++,u+=2)o.fromBufferAttribute(e,s),a.fromBufferAttribute(n,s),i[u]=0===u?0:i[u-1],i[u+1]=i[u]+o.distanceTo(a);var l=new r.InstancedInterleavedBuffer(i,2,1);return t.setAttribute("instanceDistanceStart",new r.InterleavedBufferAttribute(l,1,0)),t.setAttribute("instanceDistanceEnd",new r.InterleavedBufferAttribute(l,1,1)),this},n.prototype.raycast=function(t,e){null===t.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var n=t.ray,i=t.camera,o=i.projectionMatrix,a=this.geometry,s=this.material,u=s.resolution,c=s.linewidth,l=a.attributes.instanceStart,f=a.attributes.instanceEnd,d=new r.Vector4,p=new r.Vector4,m=new r.Vector4,v=new r.Vector3,h=new r.Matrix4,y=new r.Line3,A=new r.Vector3;n.at(1,m),m.w=1,m.applyMatrix4(i.matrixWorldInverse),m.applyMatrix4(o),m.multiplyScalar(1/m.w),m.x*=u.x/2,m.y*=u.y/2,m.z=0,v.copy(m);var g=this.matrixWorld;h.multiplyMatrices(i.matrixWorldInverse,g);for(var b=0,w=l.count;b<w;b++){d.fromBufferAttribute(l,b),p.fromBufferAttribute(f,b),d.w=1,p.w=1,d.applyMatrix4(h),p.applyMatrix4(h),d.applyMatrix4(o),p.applyMatrix4(o),d.multiplyScalar(1/d.w),p.multiplyScalar(1/p.w);var S=d.z<-1&&p.z<-1,x=d.z>1&&p.z>1;if(!S&&!x){d.x*=u.x/2,d.y*=u.y/2,p.x*=u.x/2,p.y*=u.y/2,y.start.copy(d),y.start.z=0,y.end.copy(p),y.end.z=0;var E=y.closestPointToPointParameter(v,!0);y.at(E,A);var B=r.MathUtils.lerp(d.z,p.z,E),P=B>=-1&&B<=1,M=v.distanceTo(A)<.5*c;if(P&&M){y.start.fromBufferAttribute(l,b),y.end.fromBufferAttribute(f,b),y.start.applyMatrix4(g),y.end.applyMatrix4(g);var z=new r.Vector3,L=new r.Vector3;n.distanceSqToSegment(y.start,y.end,L,z),e.push({point:L,pointOnLine:z,distance:n.origin.distanceTo(L),object:this,faceIndex:b})}}}},n}(r.Mesh);Object.assign(u.prototype,{isLineSegments2:!0});var c=function(t){function n(e,n){var i=t.call(this,e,n)||this;return i.type="Line2",i}return e(n,t),n}(u);Object.assign(c.prototype,{isLine2:!0});var l=function(t){function n(){var e=t.call(this)||this;return e.type="LineGeometry",e}return e(n,t),n.prototype.setPositions=function(e){for(var n=e.length-3,i=new Float32Array(2*n),r=0;r<n;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return t.prototype.setPositions.call(this,i),this},n.prototype.setColors=function(e){for(var n=e.length-3,i=new Float32Array(2*n),r=0;r<n;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return t.prototype.setColors.call(this,i),this},n.prototype.fromLine=function(t){var e=t.geometry;if(e instanceof r.Geometry){var n=(new r.BufferGeometry).fromGeometry(e);this.setPositions(n.attributes.position.array)}else e instanceof r.BufferGeometry&&this.setPositions(e.attributes.position.array);return this},n.prototype.copy=function(){return this},n}(o);Object.assign(l.prototype,{isLineGeometry:!0});var f=14467195,d=null,p=function(t){function n(e,n){void 0===e&&(e=new r.Vector3),void 0===n&&(n=new r.Vector3);var i=t.call(this)||this;i.type="FiveLine",i.needsRender=!0;var o=new l,a=new s({color:f,linewidth:2,dashScale:20,dashed:!1});i.line=new c(o,a);var u=new r.BufferGeometry,p=new r.PointsMaterial({color:f,size:8,map:d||(d=(new r.TextureLoader).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==")),sizeAttenuation:!1,transparent:!0});return i.points=new r.Points(u,p),i.points.renderOrder=11,i.points.frustumCulled=!1,i.setPoints(e,n),i.add(i.line,i.points),i}return e(n,t),Object.defineProperty(n,"version",{get:function(){return"5.0.0-alpha.211"},enumerable:!1,configurable:!0}),n.prototype.setPoints=function(t,e){var n=[].concat(t.toArray(),e.toArray());this.points.geometry.setAttribute("position",new r.BufferAttribute(new Float32Array(n),3)),this.line.geometry.setPositions(n),this.line.computeLineDistances(),this.needsRender=!0},n.prototype.getPoints=function(){var t=this.points.geometry.attributes.position.array;return[new r.Vector3(t[0],t[1],t[2]),new r.Vector3(t[3],t[4],t[5])]},n.prototype.setMaterial=function(t){var e=this.line.material;for(var n in t)if(t.hasOwnProperty(n)){var i=t[n];"dashed"===n?(e.dashed=i,i?e.defines.USE_DASH="":delete e.defines.USE_DASH,e.needsUpdate=!0):e[n]=t[n]}this.needsRender=!0},n.prototype.setResolution=function(t,e){var n=this.line.material.resolution;n.x===t&&n.y===e||(n.set(t,e),this.needsRender=!0)},n}(r.Object3D);Object.assign(p.prototype,{isFiveLine:!0})})(),i})()));
|
package/umd/five-react.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
/*! For license information please see five-react.js.LICENSE.txt */
|
|
2
|
-
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.FiveSDK_React=n():e.FiveSDK_React=n()}(self,(function(){return(()=>{var e={348:e=>{if(!("FiveSDK"in window))throw new Error('"FiveSDK" is not available. Please include "five" in your HTML.');e.exports=window.FiveSDK},751:e=>{if(!("React"in window))throw new Error('"React" is not available. Please include "react" in your HTML.');e.exports=window.React},438:e=>{if(!("THREE"in window))throw new Error('"THREE" is not available. Please include "three.js" in your HTML.');const n=Number(THREE.REVISION);if(n<115||n>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');e.exports=window.THREE}},n={};function t(r){var o=n[r];if(void 0!==o)return o.exports;var u=n[r]={exports:{}};return e[r](u,u.exports,t),u.exports}t.d=(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";t.r(r),t.d(r,{FiveCanvas:()=>h,INJECTION_PROPNAME:()=>_,Store:()=>ve,createFiveProvider:()=>v,createStore:()=>pe,unsafe__useFiveInstance:()=>y,useFiveAction:()=>k,useFiveCameraDirection:()=>x,useFiveCameraRaycaster:()=>R,useFiveCurrentState:()=>C,useFiveEventCallback:()=>E,useFiveFloor:()=>M,useFiveHelper:()=>W,useFiveModelIntersectRaycaster:()=>V,useFiveModelReadyState:()=>O,useFiveProject2d:()=>L,useFiveScene:()=>w,useFiveSceneEffect:()=>m,useFiveState:()=>b,useFiveWork:()=>S,withFive:()=>se});var e=function(n,t){return(e=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])})(n,t)};function n(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return(o=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function u(e,n,t){if(t||2===arguments.length)for(var r,o=0,u=n.length;o<u;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||n)}Object.create,Object.create;var i=t(751),a=t(438),f=[],c=i.createContext(null);function s(){var e=i.useContext(c);if(!e)throw new Error("FiveProvider never found.");return e.five}function l(){var e=i.useContext(c);if(!e)throw new Error("FiveProvider never found.");return e.loadWork}var d=t(348);function v(e){return function(t){function r(n){var r=t.call(this,n)||this;if(!n.work&&!n.initialWork)throw new Error("props 'work' or 'initialWork' is never set.");var u=function(e){var n=void 0===e?{}:e,t=n.backgroundColor,r=void 0===t?1579548:t,o=n.backgroundAlpha,u=void 0===o?1:o,i=n.pixelRatio,c=void 0===i?1:i,s=f.shift();return s||((s=new a.WebGLRenderer({antialias:!1,alpha:!0})).outputEncoding=a.sRGBEncoding),s.setPixelRatio(c),s.setClearColor(r,u),s.autoClear=!0,s}({pixelRatio:1===(0,d.getViewportScale)()?window.devicePixelRatio:1});return r.five=new d.Five(o({renderer:u},e)),r.five.load(n.work||n.initialWork,n.initialState),r.five.on("load",(function(){var e;r.props.onWorkChange&&r.props.onWorkChange(null===(e=r.five)||void 0===e?void 0:e.work)})),r.five.on("stateChange",(function(e,n){r.props.onStateChange&&r.props.onStateChange(e,n)})),r.five.on("currentStateChange",(function(e,n){r.props.onCurrentStateChange&&r.props.onCurrentStateChange(e,n)})),r}return n(r,t),r.prototype.loadWork=function(e,n,t){var r;if(this.props.work)throw new Error("props 'work' is set in fiveProvider, if you need modify work internal, use 'initialWork' instead.");null===(r=this.five)||void 0===r||r.load(e,n,t)},r.prototype.shouldComponentUpdate=function(e){var n,t;return e.work&&e.work!==(null===(n=this.five)||void 0===n?void 0:n.work)&&(null===(t=this.five)||void 0===t||t.load(e.work,e.initialState)),e.children!==this.props.children},r.prototype.componentWillUnmount=function(){var e;this.five&&(this.five.dispose(),e=this.five.renderer,-1===f.indexOf(e)&&f.push(e),delete this.five)},r.prototype.render=function(){var e=this;return i.createElement(c.Provider,{value:{five:this.five,loadWork:function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.loadWork.apply(e,n)}}},this.props.children)},r}(i.Component)}var p={display:"inline-block",overflow:"hidden"},h=function(e){var n=e.width,t=e.height,r=s(),u=i.createRef(),a=o({width:n,height:t},p);return i.useLayoutEffect((function(){if(u.current){if(null!==r.renderer.domElement.parentNode&&r.renderer.domElement.parentNode!==u.current)throw new Error("There are more than 2 fiveCanvas in this context.");r.renderer.domElement.parentNode!==u.current&&u.current.appendChild(r.renderer.domElement),r.camera.aspect=n/t,r.camera.updateProjectionMatrix(),r.renderer.setSize(n,t),r.needsRender=!0}}),[n,t,u.current]),i.createElement("div",{ref:u,style:a})};function y(){return s()}function m(e,n){var t=s(),r=[t];void 0!==n&&(r=r.concat(n)),i.useLayoutEffect((function(){return e(t.scene)}),r)}var w=m;function S(){var e=s(),n=l(),t=i.useState((function(){return e.work})),r=t[0],o=t[1];return i.useLayoutEffect((function(){return e.on("load",(function(){return o(e.work)}))}),[e]),[r,n]}function g(e){return o({},e.state)}function b(){var e=s(),n=i.useState((function(){return g(e)})),t=n[0],r=n[1],o=i.useCallback((function(n,t){void 0===t&&(t=!1),e.setState(n,t)}),[e]);return i.useLayoutEffect((function(){return e.on("stateChange",(function(){return r(g(e))}))}),[e]),[t,o]}function C(){var e=s(),n=i.useState((function(){return e.getCurrentState()})),t=n[0],r=n[1],o=i.useCallback((function(n,t){void 0===t&&(t=!1),e.setState(n,t)}),[e]);return i.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return r(e.getCurrentState())}))}),[e]),[t,o]}function E(e,n,t){var r=i.useState({}),o=(r[0],r[1],s());if(!o)throw new Error("fiveProvider never found.");var u=[o,e];void 0!==t&&(u=u.concat(t)),i.useLayoutEffect((function(){return o.on(e,n)}),u)}function k(){var e=s();return{updateCamera:i.useCallback((function(n,t){return e.updateCamera(n,t)}),[e]),initBasisLoader:i.useCallback((function(n){return e.initBasisLoader(n)}),[e]),getPixels:i.useCallback((function(n,t,r,o,u){return e.getPixels(n,t,r,o,u)}),[e]),render:i.useCallback((function(n){return e.render(n)}),[e]),needsRender:i.useCallback((function(){return e.needsRender=!0}),[e]),preloadPano:i.useCallback((function(n,t){return e.preloadPano(n,t)}),[e])}}function L(){var e=s();return i.useCallback((function(n,t){return e.project2d(n,t)}),[e])}function F(e){var n=e.camera.getWorldDirection(new a.Vector3);return new a.Raycaster(e.camera.position,n)}function R(){var e=s(),n=i.useState((function(){return F(e)})),t=n[0],r=n[1];return i.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return r(F(e))}))}),[e]),t}function P(e){return e.camera.getWorldDirection(new a.Vector3)}function x(){var e=s(),n=i.useState((function(){return P(e)})),t=n[0],r=n[1];return i.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return r(P(e))}))}),[e]),t}function V(){var e=s();return i.useCallback((function(n){return e.model.intersectRaycaster(n)}),[e])}function j(e){return e.model.empty?"Empty":"Loaded"}function O(){var e=s(),n=i.useState((function(){return j(e)})),t=n[0],r=n[1];return i.useLayoutEffect((function(){return e.on("modelLoaded",(function(){return r(j(e))}))}),[e]),t}function M(){var e=s(),n=i.useState(e.model.shownFloor),t=n[0],r=n[1],o=i.useState(e.model.floorLength),u=o[0],a=o[1],f=i.useCallback((function(n){"number"==typeof n?e.model.show(n):e.model.show()}),[e]);return i.useLayoutEffect((function(){var n=[];return n.push(e.on("modelShownFloorChange",(function(){return r(e.model.shownFloor)}))),n.push(e.on("modelLoaded",(function(){return a(e.model.floorLength)}))),function(){for(var e;e=n.shift();)e()}}),[e]),[t,u,f]}function W(){var e=s(),n=i.useState(e.helperVisible),t=n[0],r=n[1],o=i.useCallback((function(n){e.helperVisible=n}),[e]);return i.useLayoutEffect((function(){return e.on("helpersVisibleChange",(function(e){return r(e)}))}),[e]),[t,o]}var _="$five";function T(e,n){return n.indexOf(e)>=0}function D(e,n){for(var t=0,r=Object.keys(n);t<r.length;t++){var o=r[t];void 0!==n[o]&&(e[o]=n[o])}}function N(e,n){var t=T("state",n),r=i.useState(Symbol()),u=r[0],a=r[1],f=i.useMemo((function(){if(t)return o({},e.state)}),[e,u]);return i.useLayoutEffect((function(){if(t)return e.on("stateChange",(function(){return a(Symbol())}))}),[e]),[f,u]}function H(e,n){var t=T("currentState",n),r=i.useState(Symbol()),o=r[0],u=r[1],a=i.useMemo((function(){if(t)return e.getCurrentState()}),[e,o]);return i.useLayoutEffect((function(){if(t)return e.on("currentStateChange",(function(){return u(Symbol())}))}),[e]),[a,o]}function I(e,n){return[T("unsafe__fiveInstance",n)?e:void 0]}function U(e,n){var t=T("work",n),r=i.useState(Symbol()),o=r[0],u=r[1],a=i.useMemo((function(){if(t)return e.work}),[e,o]);return i.useLayoutEffect((function(){if(t)return e.on("load",(function(){return u(Symbol())}))}),[e]),[a,o]}function A(e,n){return[T("scene",n)?e.scene:void 0]}function B(e,n){var t=T("cameraDirection",n),r=i.useState(Symbol()),o=r[0],u=r[1],f=i.useMemo((function(){if(t)return e.camera.getWorldDirection(new a.Vector3)}),[e,o]);return i.useLayoutEffect((function(){if(t)return e.on("cameraUpdate",(function(){return u(Symbol())}))}),[e]),[f,o]}function K(e,n){var t=T("cameraRaycaster",n),r=i.useState(Symbol()),o=r[0],u=r[1],f=i.useMemo((function(){if(t){var n=e.camera.getWorldDirection(new a.Vector3);return new a.Raycaster(e.camera.position,n)}}),[e,o]);return i.useLayoutEffect((function(){if(t)return e.on("cameraUpdate",(function(){return u(Symbol())}))}),[e]),[f,o]}function G(e,n){var t=T("modelReadyState",n),r=i.useState(Symbol()),o=r[0],u=r[1],a=i.useMemo((function(){if(t)return e.model.empty?"Empty":"Loaded"}),[e,o]);return i.useLayoutEffect((function(){if(t)return e.on("modelLoaded",(function(){return u(Symbol())}))}),[e]),[a,o]}function $(e,n){var t=T("shownFloor",n),r=i.useState(Symbol()),o=r[0],u=r[1],a=i.useMemo((function(){if(t)return e.model.shownFloor}),[e,o]);return i.useLayoutEffect((function(){if(t)return e.on("modelShownFloorChange",(function(){return u(Symbol())}))}),[e]),[a,o]}function z(e,n){var t=T("totalFloorLength",n),r=i.useState(Symbol()),o=r[0],u=r[1],a=i.useMemo((function(){if(t)return e.model.hasFloors()}),[e,o]);return i.useLayoutEffect((function(){if(t)return e.on("modelLoaded",(function(){return u(Symbol())}))}),[e]),[a,o]}function J(e,n){var t=T("helperVisible",n),r=i.useState(Symbol()),o=r[0],u=r[1],a=i.useMemo((function(){if(t)return e.helperVisible}),[e,o]);return i.useLayoutEffect((function(){if(t)return e.on("helpersVisibleChange",(function(){return u(Symbol())}))}),[e]),[a,o]}function q(e,n){if(T("loadWork",n))return e}function Q(e,n){if(T("setState",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.setState.apply(e,n)}}function X(e,n){if(T("on",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.on.apply(e,n)}}function Y(e,n){if(T("on",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.once.apply(e,n)}}function Z(e,n){if(T("off",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.off.apply(e,n)}}function ee(e,n){if(T("intersectRaycaster",n))return function(){for(var n,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(n=e.model).intersectRaycaster.apply(n,t)}}function ne(e,n){if(T("project2d",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.project2d.apply(e,n)}}function te(e,n){if(T("updateCamera",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.updateCamera.apply(e,n)}}function re(e,n){if(T("initBasisLoader",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.initBasisLoader.apply(e,n)}}function oe(e,n){if(T("getPixels",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.getPixels.apply(e,n)}}function ue(e,n){if(T("render",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.render.apply(e,n)}}function ie(e,n){if(T("needsRender",n))return function(){e.needsRender=!0}}function ae(e,n){if(T("preloadPano",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.preloadPano.apply(e,n)}}function fe(e,n){if(T("showFloor",n))return function(n){"number"==typeof n?e.model.show(n):e.model.show()}}function ce(e,n){if(T("toggleHelperVisible",n))return function(n){e.helperVisible=n}}function se(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return function(n){return i.forwardRef((function(t,r){var u=s(),a=l(),f=I(u,e)[0],c=N(u,e),d=c[0],v=c[1],p=H(u,e),h=p[0],y=p[1],m=U(u,e),w=m[0],S=m[1],g=A(u,e)[0],b=B(u,e),C=b[0],E=b[1],k=K(u,e),L=k[0],F=k[1],R=G(u,e),P=R[0],x=R[1],V=$(u,e),j=V[0],O=V[1],M=z(u,e),W=M[0],_=M[1],T=J(u,e),se=T[0],le=T[1],de=i.useMemo((function(){var n={};return D(n,{setState:Q(u,e),loadWork:q(a,e),on:X(u,e),once:Y(u,e),off:Z(u,e),intersectRaycaster:ee(u,e),project2d:ne(u,e),updateCamera:te(u,e),initBasisLoader:re(u,e),getPixels:oe(u,e),render:ue(u,e),needsRender:ie(u,e),preloadPano:ae(u,e),showFloor:fe(u,e),toggleHelperVisible:ce(u,e)}),n}),[u,a]),ve=i.useMemo((function(){var e=o({},de);return D(e,{unsafe__fiveInstance:f,state:d,currentState:h,work:w,scene:g,cameraDirection:C,cameraRaycaster:L,modelReadyState:P,shownFloor:j,totalFloorLength:W,helperVisible:se}),e}),[u,de,v,y,S,E,F,x,O,_,le]);return i.createElement(n,o({ref:r,$five:ve},t))}))}}function le(e,n){for(var t={},r=n.length,o=-1;++o<r;){var u=n[o];u in e&&(t[u]=e[u])}return t}function de(e,n){for(var t=0;t<e.length;t++)for(var r=0;t<n.length;r++)if(e[t]===n[r])return!0;return!1}var ve=function(){function e(e,n){this.values=e,this.listeners=[],this.onValuesChange=n}return e.prototype.on=function(e,n){var t=this,r=[e,n];return this.listeners.push(r),function(){var e=t.listeners.indexOf(r);e>=0&&t.listeners.splice(e,1)}},e.prototype.getValues=function(e){return le(this.values,e)},e.prototype.setValues=function(e,n){var t,r,u=[];for(var i in n)e.indexOf(i)>=0&&(t=n[i],r=this.values[i],!("number"==typeof t&&"number"==typeof r&&isNaN(t)&&isNaN(r)||t===r))&&u.push(i);if(0!==u.length){for(var a=o({},this.values),f=0,c=u;f<c.length;f++){var s=c[f];this.values[s]=n[s]}this.onValuesChange&&this.onValuesChange(this.values,a);for(var l=0,d=this.listeners;l<d.length;l++){var v=d[l],p=v[0],h=v[1];if(de(p,u)){var y=le(a,p);h(le(this.values,p),y)}}}},e}();function pe(e){var t=i.createContext(null);return{useStore:function(e){var n=i.useContext(t);if(null===n)throw new Error("StoreProvider never found.");var r=i.useRef(!0),o=i.useState(n.getValues(e)),a=o[0],f=o[1],c=u([n],e);return i.useLayoutEffect((function(){return r.current?r.current=!1:f(n.getValues(e)),n.on(e,(function(e){return f(e)}))}),c),[a,i.useCallback((function(t){return n.setValues(e,t)}),c)]},useStoreSetter:function(e){var n=i.useContext(t);if(null===n)throw new Error("StoreProvider never found.");return i.useCallback((function(t){return n.setValues(e,t)}),u([n],e))},watchStore:function(e,n,r){var o=i.useContext(t);if(null===o)throw new Error("StoreProvider never found.");var a=u([o],e);void 0!==r&&(a=a.concat(r)),i.useLayoutEffect((function(){return o.on(e,n)}),a)},useStoreAction:function(n){var r=i.useContext(t);if(null===r)throw new Error("StoreProvider never found.");return i.useCallback((function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];var i=e[n],a=i[0],f=i.slice(1),c=function(){return r.getValues(f)},s=function(e){return r.setValues(f,e)};return a.apply(void 0,u([c,s],t))}),[])},StoreProvider:function(e){function r(n){var t=e.call(this,n)||this;return t.store=new ve(n.initialValue,(function(){for(var e,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];t.props.onValuesChange&&(e=t.props).onValuesChange.apply(e,n)})),t}return n(r,e),r.prototype.shouldComponentUpdate=function(e){return e.children!==this.props.children},r.prototype.render=function(){return i.createElement(t.Provider,{value:this.store},this.props.children)},r}(i.Component)}}})(),r})()}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FiveSDK_React=t():e.FiveSDK_React=t()}(self,(()=>(()=>{var e={348:e=>{if(!("FiveSDK"in window))throw new Error('"FiveSDK" is not available. Please include "five" in your HTML.');e.exports=window.FiveSDK},751:e=>{if(!("React"in window))throw new Error('"React" is not available. Please include "react" in your HTML.');e.exports=window.React},438:e=>{if(!("THREE"in window))throw new Error('"THREE" is not available. Please include "three.js" in your HTML.');const t=Number(THREE.REVISION);if(t<115||t>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');e.exports=window.THREE}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var u=t[r]={exports:{}};return e[r](u,u.exports,n),u.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{FiveCanvas:()=>y,INJECTION_PROPNAME:()=>D,Store:()=>oe,createFiveFeature:()=>te,createFiveProvider:()=>p,createStore:()=>ue,unsafe__useFiveInstance:()=>m,useFiveAction:()=>L,useFiveCameraDirection:()=>O,useFiveCameraRaycaster:()=>P,useFiveCurrentObserver:()=>k,useFiveCurrentState:()=>E,useFiveEventCallback:()=>F,useFiveFloor:()=>_,useFiveHelper:()=>T,useFiveModelIntersectRaycaster:()=>j,useFiveModelReadyState:()=>W,useFiveProject2d:()=>x,useFiveScene:()=>w,useFiveSceneEffect:()=>S,useFiveState:()=>C,useFiveWork:()=>g,withFive:()=>ee});var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};function u(e,t,n){if(n||2===arguments.length)for(var r,o=0,u=t.length;o<u;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}Object.create,Object.create;var i=n(751),a=n(438),f=[],c=[],s=i.createContext(null);function l(){var e=i.useContext(s);if(!e)throw new Error("FiveProvider never found.");return e.five}function d(){var e=i.useContext(s);if(!e)throw new Error("FiveProvider never found.");return e.loadWork}var v=n(348);function p(e){return void 0===e&&(e={}),function(n){function r(){var e=null!==n&&n.apply(this,arguments)||this;return e.unmout=!1,e}return t(r,n),r.prototype.loadWork=function(e,t,n,r){if(void 0===r&&(r=!0),this.props.work)throw new Error("props 'work' is set in fiveProvider, if you need modify work internal, use 'initialWork' instead.");return this.five.load(e,t,n,r)},r.prototype.shouldComponentUpdate=function(e){var t,n;return e.work&&e.work!==(null===(t=this.five)||void 0===t?void 0:t.work)&&(null===(n=this.five)||void 0===n||n.load(e.work,e.initialState)),!0},r.prototype.componentWillUnmount=function(){var e;this.unmout=!0,this.five&&(this.five.dispose(),(e=this.five.renderer)&&(e.capabilities.isWebGL2?-1===c.indexOf(e)&&c.push(e):-1===f.indexOf(e)&&f.push(e)),delete this.five)},r.prototype.render=function(){var t,n=this;if(this.unmout)return null;if(!this.five){var r=function(e){var t=void 0===e?{}:e,n=t.backgroundColor,r=void 0===n?1579548:n,o=t.backgroundAlpha,u=void 0===o?1:o,i=t.pixelRatio,s=void 0===i?1:i,l=t.webgl2,d=void 0!==l&&l;if("undefined"!=typeof window){var v=null;if(!(v=d?f.shift():c.shift())){if(d){var p=document.createElement("canvas"),h=p.getContext("webgl2");if(null===h)throw new Error("error occurred when getting webgl2 canvas context");v=new a.WebGLRenderer({antialias:!1,alpha:!0,canvas:p,context:h})}else v=new a.WebGLRenderer({antialias:!1,alpha:!0});v.outputEncoding=a.sRGBEncoding}return v.setPixelRatio(s),v.setClearColor(r,u),v.autoClear=!0,v}}({pixelRatio:1===(0,v.getViewportScale)()?window.devicePixelRatio:1,backgroundAlpha:e.backgroundAlpha,backgroundColor:e.backgroundColor,webgl2:null==e?void 0:e.webgl2});this.five=new v.Five(o({renderer:r},e)),(this.props.work||this.props.initialWork)&&this.five.load(this.props.work||this.props.initialWork,this.props.initialState,void 0,null===(t=this.props.initialUserAction)||void 0===t||t),this.five.on("load",(function(){var e;n.props.onWorkChange&&n.props.onWorkChange(null===(e=n.five)||void 0===e?void 0:e.work)})),this.five.on("stateChange",(function(e,t){n.props.onStateChange&&n.props.onStateChange(e,t)})),this.five.on("currentStateChange",(function(e,t){n.props.onCurrentStateChange&&n.props.onCurrentStateChange(e,t)})),this.five.on("error",(function(e){n.props.onError?n.props.onError(e):console.warn(e.message)}))}return i.createElement(s.Provider,{value:{five:this.five,loadWork:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.loadWork.apply(n,e)}}},this.props.children)},r}(i.Component)}var h={display:"inline-block",overflow:"hidden"},y=function(e){var t=e.width,n=e.height,r=l(),u=i.createRef(),a=o({width:t,height:n},h);return i.useLayoutEffect((function(){if(u.current&&r.renderer){if(null!==r.renderer.domElement.parentNode&&r.renderer.domElement.parentNode!==u.current)throw new Error("There are more than 2 fiveCanvas in this context.");r.renderer.domElement.parentNode!==u.current&&u.current.appendChild(r.renderer.domElement),r.camera.aspect=t/n,r.camera.updateProjectionMatrix(),r.renderer.setSize(t,n),r.needsRender=!0}}),[t,n,u.current]),i.createElement("div",{ref:u,style:a})};function m(){return l()}function S(e,t){var n=l(),r=[n];void 0!==t&&(r=r.concat(t)),i.useLayoutEffect((function(){return e(n.scene)}),r)}var w=S;function g(){var e=l(),t=d(),n=i.useState((function(){return e.work})),r=n[0],o=n[1];return i.useLayoutEffect((function(){return e.on("load",(function(){return o(e.work)}))}),[e]),[r,t]}function b(e){return o({},e.state)}function C(){var e=l(),t=i.useState((function(){return b(e)})),n=t[0],r=t[1],o=i.useCallback((function(t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!0);var o="function"==typeof t?t(e.getCurrentState()):t;e.setState(o,n,r)}),[e]);return i.useLayoutEffect((function(){return e.on("stateChange",(function(){return r(b(e))}))}),[e]),[n,o]}function E(){var e=l(),t=i.useState((function(){return e.getCurrentState()})),n=t[0],r=t[1],o=i.useCallback((function(t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!0);var o="function"==typeof t?t(e.getCurrentState()):t;e.setState(o,n,r)}),[e]);return i.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return r(e.getCurrentState())}))}),[e]),[n,o]}function k(){var e=l(),t=i.useState((function(){return e.getCurrentState()})),n=t[0],r=t[1];return i.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return r(e.getCurrentState())}))}),[e]),e.work?e.work.observers[n.panoIndex]:null}function F(e,t,n){var r=l(),o=[r,e];void 0!==n&&(o=o.concat(n)),i.useLayoutEffect((function(){return r.on(e,t)}),o)}function L(){var e=l();return{updateCamera:i.useCallback((function(t,n){return e.updateCamera(t,n)}),[e]),getPixels:i.useCallback((function(t,n,r,o,u){return e.getPixels(t,n,r,o,u)}),[e]),render:i.useCallback((function(t){return e.render(t)}),[e]),needsRender:i.useCallback((function(){return e.needsRender=!0}),[e]),preloadPano:i.useCallback((function(t,n){return e.preloadPano(t,n)}),[e])}}function x(){var e=l(),t=i.useState((function(){return Symbol()})),n=(t[0],t[1]);return i.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return n(Symbol())}))}),[e]),i.useCallback((function(t,n){return e.project2d(t,n)}),[e])}function R(e){var t=e.camera.getWorldDirection(new a.Vector3);return new a.Raycaster(e.camera.position,t)}function P(){var e=l(),t=i.useState((function(){return R(e)})),n=t[0],r=t[1];return i.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return r(R(e))}))}),[e]),n}function V(e){return e.camera.getWorldDirection(new a.Vector3)}function O(){var e=l(),t=i.useState((function(){return V(e)})),n=t[0],r=t[1];return i.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return r(V(e))}))}),[e]),n}function j(){var e=l();return i.useCallback((function(t){return e.model.intersectRaycaster(t)}),[e])}function M(e){return e.model.empty?"Empty":"Loaded"}function W(){var e=l(),t=i.useState((function(){return M(e)})),n=t[0],r=t[1];return i.useLayoutEffect((function(){return e.on("modelLoaded",(function(){return r(M(e))}))}),[e]),n}function _(){var e=l(),t=i.useState(e.model.shownFloor),n=t[0],r=t[1],o=i.useState(e.model.floorLength),u=o[0],a=o[1],f=i.useCallback((function(t){"number"==typeof t?e.model.show(t):e.model.show()}),[e]);return i.useLayoutEffect((function(){var t=[];return t.push(e.on("modelShownFloorChange",(function(){return r(e.model.shownFloor)}))),t.push(e.on("modelLoaded",(function(){return a(e.model.floorLength)}))),function(){for(var e;e=t.shift();)e()}}),[e]),[n,u,f]}function T(){var e=l(),t=i.useState(e.helperVisible),n=t[0],r=t[1],o=i.useCallback((function(t){e.helperVisible=t}),[e]);return i.useLayoutEffect((function(){return e.on("helpersVisibleChange",(function(e){return r(e)}))}),[e]),[n,o]}var D="$five";function N(e,t){return t.indexOf(e)>=0}function H(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];void 0!==t[o]&&(e[o]=t[o])}}function A(e,t){if(N("loadWork",t))return e}function I(e,t){if(N("setState",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.setState.apply(e,t)}}function U(e,t){if(N("on",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.on.apply(e,t)}}function K(e,t){if(N("on",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.once.apply(e,t)}}function G(e,t){if(N("off",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.off.apply(e,t)}}function $(e,t){if(N("intersectRaycaster",t))return function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return(t=e.model).intersectRaycaster.apply(t,n)}}function z(e,t){if(N("project2d",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.project2d.apply(e,t)}}function B(e,t){if(N("updateCamera",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.updateCamera.apply(e,t)}}function J(e,t){if(N("getPixels",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.getPixels.apply(e,t)}}function q(e,t){if(N("render",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.render.apply(e,t)}}function Q(e,t){if(N("needsRender",t))return function(){e.needsRender=!0}}function X(e,t){if(N("preloadPano",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.preloadPano.apply(e,t)}}function Y(e,t){if(N("showFloor",t))return function(t){"number"==typeof t?e.model.show(t):e.model.show()}}function Z(e,t){if(N("toggleHelperVisible",t))return function(t){e.helperVisible=t}}function ee(e){return function(t){return i.forwardRef((function(n,r){var u=l(),f=d(),c=function(e,t){return[N("unsafe__fiveInstance",t)?e:void 0]}(u,e)[0],s=function(e,t){var n=N("state",t),r=i.useState(Symbol()),u=r[0],a=r[1],f=i.useMemo((function(){if(n)return o({},e.state)}),[e,u]);return i.useLayoutEffect((function(){if(n)return e.on("stateChange",(function(){return a(Symbol())}))}),[e]),[f,u]}(u,e),v=s[0],p=s[1],h=function(e,t){var n=N("currentState",t),r=i.useState(Symbol()),o=r[0],u=r[1],a=i.useMemo((function(){if(n)return e.getCurrentState()}),[e,o]);return i.useLayoutEffect((function(){if(n)return e.on("currentStateChange",(function(){return u(Symbol())}))}),[e]),[a,o]}(u,e),y=h[0],m=h[1],S=function(e,t){var n=N("currentObserver",t),r=i.useState(Symbol()),o=r[0],u=r[1],a=i.useMemo((function(){if(n)return e.getCurrentState()}),[e,o]);return i.useLayoutEffect((function(){if(n)return e.on("currentStateChange",(function(){return u(Symbol())}))}),[e]),[a?e.work?e.work.observers[a.panoIndex]:null:void 0,o]}(u,e),w=S[0],g=S[1],b=function(e,t){var n=N("work",t),r=i.useState(Symbol()),o=r[0],u=r[1],a=i.useMemo((function(){if(n)return e.work}),[e,o]);return i.useLayoutEffect((function(){if(n)return e.on("load",(function(){return u(Symbol())}))}),[e]),[a,o]}(u,e),C=b[0],E=b[1],k=function(e,t){var n=N("model",t),r=i.useState(Symbol()),o=r[0],u=r[1],a=i.useMemo((function(){if(n)return e.model}),[e,o]);return i.useLayoutEffect((function(){if(n)return e.on("modelLoaded",(function(){return u(Symbol())}))}),[e]),[a,o]}(u,e),F=k[0],L=k[1],x=function(e,t){return[N("scene",t)?e.scene:void 0]}(u,e)[0],R=function(e,t){var n=N("cameraDirection",t),r=i.useState(Symbol()),o=r[0],u=r[1],f=i.useMemo((function(){if(n)return e.camera.getWorldDirection(new a.Vector3)}),[e,o]);return i.useLayoutEffect((function(){if(n)return e.on("cameraUpdate",(function(){return u(Symbol())}))}),[e]),[f,o]}(u,e),P=R[0],V=R[1],O=function(e,t){var n=N("cameraRaycaster",t),r=i.useState(Symbol()),o=r[0],u=r[1],f=i.useMemo((function(){if(n){var t=e.camera.getWorldDirection(new a.Vector3);return new a.Raycaster(e.camera.position,t)}}),[e,o]);return i.useLayoutEffect((function(){if(n)return e.on("cameraUpdate",(function(){return u(Symbol())}))}),[e]),[f,o]}(u,e),j=O[0],M=O[1],W=function(e,t){var n=N("modelReadyState",t),r=i.useState(Symbol()),o=r[0],u=r[1],a=i.useMemo((function(){if(n)return e.model.empty?"Empty":"Loaded"}),[e,o]);return i.useLayoutEffect((function(){if(n)return e.on("modelLoaded",(function(){return u(Symbol())}))}),[e]),[a,o]}(u,e),_=W[0],T=W[1],D=function(e,t){var n=N("shownFloor",t),r=i.useState(Symbol()),o=r[0],u=r[1],a=i.useMemo((function(){if(n)return e.model.shownFloor}),[e,o]);return i.useLayoutEffect((function(){if(n)return e.on("modelShownFloorChange",(function(){return u(Symbol())}))}),[e]),[a,o]}(u,e),ee=D[0],te=D[1],ne=function(e,t){var n=N("totalFloorLength",t),r=i.useState(Symbol()),o=r[0],u=r[1],a=i.useMemo((function(){if(n)return e.model.hasFloors()}),[e,o]);return i.useLayoutEffect((function(){if(n)return e.on("modelLoaded",(function(){return u(Symbol())}))}),[e]),[a,o]}(u,e),re=ne[0],oe=ne[1],ue=function(e,t){var n=N("helperVisible",t),r=i.useState(Symbol()),o=r[0],u=r[1],a=i.useMemo((function(){if(n)return e.helperVisible}),[e,o]);return i.useLayoutEffect((function(){if(n)return e.on("helpersVisibleChange",(function(){return u(Symbol())}))}),[e]),[a,o]}(u,e),ie=ue[0],ae=ue[1],fe=i.useMemo((function(){var t={};return H(t,{setState:I(u,e),loadWork:A(f,e),on:U(u,e),once:K(u,e),off:G(u,e),intersectRaycaster:$(u,e),project2d:z(u,e),updateCamera:B(u,e),getPixels:J(u,e),render:q(u,e),needsRender:Q(u,e),preloadPano:X(u,e),showFloor:Y(u,e),toggleHelperVisible:Z(u,e)}),t}),[u,f]),ce=i.useMemo((function(){var e=o({},fe);return H(e,{unsafe__fiveInstance:c,state:v,currentState:y,currentObserver:w,work:C,model:F,scene:x,cameraDirection:P,cameraRaycaster:j,modelReadyState:_,shownFloor:ee,totalFloorLength:re,helperVisible:ie}),e}),[u,fe,p,m,g,E,L,V,M,T,te,oe,ae]);return i.createElement(t,o({ref:r,$five:ce},n))}))}}function te(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e}function ne(e,t){for(var n={},r=t.length,o=-1;++o<r;){var u=t[o];u in e&&(n[u]=e[u])}return n}function re(e,t){for(var n=0;n<e.length;n++)for(var r=0;r<t.length;r++)if(e[n]===t[r])return!0;return!1}var oe=function(){function e(e,t){this.values=e,this.listeners=[],this.onValuesChange=t}return e.prototype.on=function(e,t){var n=this,r=[e,t];return this.listeners.push(r),function(){var e=n.listeners.indexOf(r);e>=0&&n.listeners.splice(e,1)}},e.prototype.getValues=function(e){return ne(this.values,e)},e.prototype.setValues=function(e,t){var n,r,u=[];for(var i in t)e.indexOf(i)>=0&&(n=t[i],r=this.values[i],!("number"==typeof n&&"number"==typeof r&&isNaN(n)&&isNaN(r)||n===r))&&u.push(i);if(0!==u.length){for(var a=o({},this.values),f=0,c=u;f<c.length;f++){var s=c[f];this.values[s]=t[s]}this.onValuesChange&&this.onValuesChange(this.values,a);for(var l=0,d=this.listeners;l<d.length;l++){var v=d[l],p=v[0],h=v[1];if(re(p,u)){var y=ne(a,p);h(ne(this.values,p),y)}}}},e}();function ue(e){var n=i.createContext(null);return{useStore:function(e){var t=i.useContext(n);if(null===t)throw new Error("StoreProvider never found.");var r=i.useRef(!0),o=i.useState(t.getValues(e)),a=o[0],f=o[1],c=u([t],e,!0);i.useLayoutEffect((function(){return r.current?r.current=!1:f(t.getValues(e)),t.on(e,(function(e){return f(e)}))}),c);var s=i.useCallback((function(n){return t.setValues(e,n)}),c);return[a,s]},useStoreSetter:function(e){var t=i.useContext(n);if(null===t)throw new Error("StoreProvider never found.");return i.useCallback((function(n){return t.setValues(e,n)}),u([t],e,!0))},watchStore:function(e,t,r){var o=i.useContext(n);if(null===o)throw new Error("StoreProvider never found.");var a=u([o],e,!0);void 0!==r&&(a=a.concat(r)),i.useLayoutEffect((function(){return o.on(e,t)}),a)},useStoreAction:function(t){var r=i.useContext(n);if(null===r)throw new Error("StoreProvider never found.");var o=i.useCallback((function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=e[t],a=i[0],f=i.slice(1);return a.apply(void 0,u([function(){return r.getValues(f)},function(e){return r.setValues(f,e)}],n,!1))}),[]);return o},StoreProvider:function(e){function r(t){var n=e.call(this,t)||this;return n.store=new oe(t.initialValue,(function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];n.props.onValuesChange&&(e=n.props).onValuesChange.apply(e,t)})),n}return t(r,e),r.prototype.shouldComponentUpdate=function(e){return e.children!==this.props.children},r.prototype.render=function(){return i.createElement(n.Provider,{value:this.store},this.props.children)},r}(i.Component)}}})(),r})()));
|
package/umd/five-sticker.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FiveSDK_Sticker=t():e.FiveSDK_Sticker=t()}(self,(function(){return(()=>{var e={438:e=>{if(!("THREE"in window))throw new Error('"THREE" is not available. Please include "three.js" in your HTML.');const t=Number(THREE.REVISION);if(t<115||t>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');e.exports=window.THREE}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{Sticker:()=>l});var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};Object.create,Object.create;var t=n(438),o=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),i=new Float32Array([0,0,1,0,0,1,1,1]),a=new Uint8Array([0,1,2,1,3,2]),s=new t.BufferGeometry;s.setAttribute("position",new t.BufferAttribute(o,3)),s.setAttribute("uv",new t.BufferAttribute(i,2)),s.setIndex(new t.BufferAttribute(a,1));var p=window,u=p.requestAnimationFrame||p.mozRequestAnimationFrame||p.webkitRequestAnimationFrame||p.msRequestAnimationFrame||function(e){return setTimeout(e,16)},c="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),f="undefined"!=typeof performance?function(){return c+performance.now()}:function(){return Date.now()};function d(e,t){var n=e.dispose;e.dispose=function(){t(),n.call(e)}}var l=function(n){function r(e,r,o){var i,a,p,c,l,m,v=this,y=new t.MeshBasicMaterial;if((v=n.call(this,s,y)||this)._needsRender=!1,v.scale.set(e,r,1),"string"==typeof o){y.transparent=/\.png$/.test(o);var w=new Image;w.src=o,w.crossOrigin="",o=w}if(o instanceof HTMLImageElement){var g=y.map=new t.Texture;g.wrapS=t.ClampToEdgeWrapping,g.wrapT=t.ClampToEdgeWrapping,g.minFilter=t.LinearFilter,g.encoding=t.sRGBEncoding,d(g,function(e,t){e.naturalWidth>0&&u((function(){return t()}));var n=function(){return t()};return e.addEventListener("load",n,!1),function(){return e.removeEventListener("load",n,!1)}}(o,(function(){g.image=o,g.needsUpdate=!0,v._needsRender=!0})))}else if(o instanceof HTMLCanvasElement)y.map=new t.CanvasTexture(o);else if(o instanceof HTMLVideoElement){var h=y.map=new t.VideoTexture(o);h.wrapS=t.ClampToEdgeWrapping,h.wrapT=t.ClampToEdgeWrapping,h.minFilter=t.LinearFilter,h.encoding=t.sRGBEncoding,d(h,(i=o,a=function(){v._needsRender=!0},p=f(),c=!1,l=function(){c=!0,a(),f()-p<3e3?u(l):c=!1},m=function(){p=f(),!1===c&&l()},i.addEventListener("timeupdate",m,!1),function(){i.removeEventListener("timeupdate",m,!1),c=!1}))}return v}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(r,n),Object.defineProperty(r.prototype,"needsRender",{get:function(){return this._needsRender},set:function(e){this._needsRender=e,!0===e&&this.material.map&&(this.material.map.needsUpdate=!0)},enumerable:!1,configurable:!0}),r.prototype.setSize=function(e,t){this.scale.set(e,t,1),this._needsRender=!0},r.prototype.setTransparent=function(e){this.material.transparent=e,this._needsRender=!0},r.prototype.locationWithIntersection=function(e,t){void 0===t&&(t=.005);var n=e.point,r=e.face;this.position.copy(n),r&&(this.position.add(r.normal.clone().setLength(t)),this.lookAt(n.clone().add(r.normal))),this._needsRender=!0},r.prototype.dispose=function(){var e;null===(e=this.material.map)||void 0===e||e.dispose(),this.material.dispose()},r}(t.Mesh)})(),r})()}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FiveSDK_Sticker=t():e.FiveSDK_Sticker=t()}(self,(()=>(()=>{var e={438:e=>{if(!("THREE"in window))throw new Error('"THREE" is not available. Please include "three.js" in your HTML.');const t=Number(THREE.REVISION);if(t<115||t>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');e.exports=window.THREE}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{Sticker:()=>l});var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};Object.create,Object.create;var t=n(438),o=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),i=new Float32Array([0,0,1,0,0,1,1,1]),a=new Uint8Array([0,1,2,1,3,2]),s=new t.BufferGeometry;s.setAttribute("position",new t.BufferAttribute(o,3)),s.setAttribute("uv",new t.BufferAttribute(i,2)),s.setIndex(new t.BufferAttribute(a,1));var p=window,u=p.requestAnimationFrame||p.mozRequestAnimationFrame||p.webkitRequestAnimationFrame||p.msRequestAnimationFrame||function(e){return setTimeout(e,16)},c="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),f="undefined"!=typeof performance?function(){return c+performance.now()}:function(){return Date.now()};function d(e,t){var n=e.dispose;e.dispose=function(){t(),n.call(e)}}var l=function(n){function r(e,r,o){var i,a,p,c,l,m,v=this,y=new t.MeshBasicMaterial;if((v=n.call(this,s,y)||this)._needsRender=!1,v.scale.set(e,r,1),"string"==typeof o){y.transparent=/\.png$/.test(o);var w=new Image;w.src=o,w.crossOrigin="",o=w}if(o instanceof HTMLImageElement){var g=y.map=new t.Texture;g.wrapS=t.ClampToEdgeWrapping,g.wrapT=t.ClampToEdgeWrapping,g.minFilter=t.LinearFilter,g.encoding=t.sRGBEncoding,d(g,function(e,t){e.naturalWidth>0&&u((function(){return t()}));var n=function(){return t()};return e.addEventListener("load",n,!1),function(){return e.removeEventListener("load",n,!1)}}(o,(function(){g.image=o,g.needsUpdate=!0,v._needsRender=!0})))}else if(o instanceof HTMLCanvasElement)y.map=new t.CanvasTexture(o);else if(o instanceof HTMLVideoElement){var b=y.map=new t.VideoTexture(o);b.wrapS=t.ClampToEdgeWrapping,b.wrapT=t.ClampToEdgeWrapping,b.minFilter=t.LinearFilter,b.encoding=t.sRGBEncoding,d(b,(i=o,a=function(){v._needsRender=!0},p=f(),c=!1,l=function(){c=!0,a(),f()-p<3e3?u(l):c=!1},m=function(){p=f(),!1===c&&l()},i.addEventListener("timeupdate",m,!1),function(){i.removeEventListener("timeupdate",m,!1),c=!1}))}return v}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(r,n),Object.defineProperty(r,"version",{get:function(){return"5.0.0-alpha.211"},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"needsRender",{get:function(){return this._needsRender},set:function(e){this._needsRender=e,!0===e&&this.material.map&&(this.material.map.needsUpdate=!0)},enumerable:!1,configurable:!0}),r.prototype.setSize=function(e,t){this.scale.set(e,t,1),this._needsRender=!0},r.prototype.setTransparent=function(e){this.material.transparent=e,this._needsRender=!0},r.prototype.locationWithIntersection=function(e,t){void 0===t&&(t=.005);var n=e.point,r=e.face;this.position.copy(n),r&&(this.position.add(r.normal.clone().setLength(t)),this.lookAt(n.clone().add(r.normal))),this._needsRender=!0},r.prototype.dispose=function(){var e;null===(e=this.material.map)||void 0===e||e.dispose(),this.material.dispose()},r}(t.Mesh)})(),r})()));
|
package/umd/five-vfx.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FiveSDK_VFX=t():e.FiveSDK_VFX=t()}(self,(()=>(()=>{var e={438:e=>{if(!("THREE"in window))throw new Error('"THREE" is not available. Please include "three.js" in your HTML.');const t=Number(THREE.REVISION);if(t<115||t>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');e.exports=window.THREE}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={exports:{}};return e[i](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";n.r(i),n.d(i,{Airflow:()=>b,Flame:()=>v,Particle:()=>T,SpotLight:()=>h});var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}Object.create,Object.create;for(var o=n(438),r="\nuniform vec3 uColor1;\nuniform vec3 uColor2;\nuniform float uOpacity;\n\nvarying vec3 vPosition;\nvarying float vNoise;\n\nvoid main() {\n float alpha = 1.0;\n float gradient = mix(0.0, 1.0, -vPosition.y + 1.75);\n if(vNoise > 0.3 * gradient) {\n alpha = 0.0;\n }\n float mask = mix(0.3, 1.0, -vPosition.y + 0.5);\n alpha = clamp(alpha * (mask * 10.0), 0.0, 1.0);\n vec3 color = mix(uColor1, uColor2, -vPosition.y + 0.5);\n color.g = color.g * (1.0 + gradient * vNoise);\n gl_FragColor = vec4(color, alpha * uOpacity);\n}\n",a="\n// Simplex 4D Noise\n// by Ian McEwan, Ashima Arts\n//\nvec4 permute(vec4 x) {\n return mod((x * 34.0 + 1.0) * x, 289.0);\n}\nfloat permute(float x) {\n return floor( mod((x * 34.0 + 1.0) * x, 289.0) );\n}\nvec4 taylorInvSqrt(vec4 r) {\n return 1.79284291400159 - 0.85373472095314 * r;\n}\nfloat taylorInvSqrt(float r) {\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n\nvec4 grad4(float j, vec4 ip) {\n const vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);\n vec4 p,s;\n\n p.xyz = floor( fract (vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;\n p.w = 1.5 - dot(abs(p.xyz), ones.xyz);\n s = vec4(lessThan(p, vec4(0.0)));\n p.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;\n\n return p;\n}\n\nfloat simplexNoise(vec4 v) {\n const vec2 C = vec2( 0.138196601125010504, // (5 - sqrt(5))/20 G4\n 0.309016994374947451); // (sqrt(5) - 1)/4 F4\n // First corner\n vec4 i = floor(v + dot(v, C.yyyy) );\n vec4 x0 = v - i + dot(i, C.xxxx);\n\n // Other corners\n\n // Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI)\n vec4 i0;\n\n vec3 isX = step( x0.yzw, x0.xxx );\n vec3 isYZ = step( x0.zww, x0.yyz );\n\n // i0.x = dot( isX, vec3( 1.0 ) );\n i0.x = isX.x + isX.y + isX.z;\n i0.yzw = 1.0 - isX;\n\n // i0.y += dot( isYZ.xy, vec2( 1.0 ) );\n i0.y += isYZ.x + isYZ.y;\n i0.zw += 1.0 - isYZ.xy;\n\n i0.z += isYZ.z;\n i0.w += 1.0 - isYZ.z;\n\n // i0 now contains the unique values 0,1,2,3 in each channel\n vec4 i3 = clamp( i0, 0.0, 1.0 );\n vec4 i2 = clamp( i0-1.0, 0.0, 1.0 );\n vec4 i1 = clamp( i0-2.0, 0.0, 1.0 );\n\n // x0 = x0 - 0.0 + 0.0 * C\n vec4 x1 = x0 - i1 + 1.0 * C.xxxx;\n vec4 x2 = x0 - i2 + 2.0 * C.xxxx;\n vec4 x3 = x0 - i3 + 3.0 * C.xxxx;\n vec4 x4 = x0 - 1.0 + 4.0 * C.xxxx;\n\n // Permutations\n i = mod(i, 289.0);\n float j0 = permute( permute( permute( permute(i.w) + i.z) + i.y) + i.x);\n vec4 j1 = permute( permute( permute( permute (\n i.w + vec4(i1.w, i2.w, i3.w, 1.0 ))\n + i.z + vec4(i1.z, i2.z, i3.z, 1.0 ))\n + i.y + vec4(i1.y, i2.y, i3.y, 1.0 ))\n + i.x + vec4(i1.x, i2.x, i3.x, 1.0 ));\n\n // Gradients\n // ( 7*7*6 points uniformly over a cube, mapped onto a 4-octahedron.)\n // 7*7*6 = 294, which is close to the ring size 17*17 = 289.\n\n vec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0) ;\n\n vec4 p0 = grad4(j0, ip);\n vec4 p1 = grad4(j1.x, ip);\n vec4 p2 = grad4(j1.y, ip);\n vec4 p3 = grad4(j1.z, ip);\n vec4 p4 = grad4(j1.w, ip);\n\n // Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n p4 *= taylorInvSqrt(dot(p4,p4));\n\n // Mix contributions from the five corners\n vec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0);\n vec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4) ), 0.0);\n m0 = m0 * m0;\n m1 = m1 * m1;\n return 49.0 * ( dot(m0*m0, vec3( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 )))\n + dot(m1*m1, vec2( dot( p3, x3 ), dot( p4, x4 ) ) ) ) ;\n\n}\n",s="\nfloat scale(float value, float fromMin, float fromMax, float toMin, float toMax) {\n return toMin + (value - fromMin) * (toMax - toMin) / (fromMax - fromMin);\n}\n",l="\nuniform float uTime;\nuniform float uNoise;\nuniform float uSpeed;\n\nvarying vec3 vPosition;\nvarying float vNoise;\n\n".concat(a,"\n").concat(s,"\n\nfloat fbm(vec4 x) {\n float v = 0.0;\n float a = 0.5;\n vec4 shift = vec4(100.0);\n #pragma unroll_loop_start\n for ( int i = 0; i < FRAGMENTATION_DEGREE; i ++ ) {\n v += a * simplexNoise(x);\n x = x * 2.0 + shift;\n a *= 0.5;\n }\n #pragma unroll_loop_end\n return v;\n}\n\nvoid main() {\n vPosition = position;\n vNoise = fbm(vec4((position / uNoise) - vec3(0.0, uTime * uSpeed, 0.0), 0.0));\n vNoise = scale(vNoise, -1.0, 1.0, 0.0, 1.0);\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4(vPosition, 1.0);\n}\n"),u=new o.SphereBufferGeometry(1,300,300),c=[],d=0;d<2;d++)c.push(new o.Vector2(Math.sin(d)/2+1,2*d-.8));var p=new o.LatheBufferGeometry(c,300),v=function(e){function n(t){var n,i=e.call(this)||this;i.needsRender=!0,n=t instanceof o.BufferGeometry?t:"ring"===t?p:u,i.uniforms={uTime:{value:0},uColor1:{value:new o.Color("rgb(255, 177, 20)")},uColor2:{value:new o.Color("rgb(255, 0, 0)")},uNoise:{value:1.2},uSpeed:{value:1},uOpacity:{value:1}},i.defines={FRAGMENTATION_DEGREE:2};var a=new o.Mesh(n,new o.ShaderMaterial({uniforms:i.uniforms,defines:i.defines,vertexShader:l,fragmentShader:r,transparent:!0,depthWrite:!1,side:o.BackSide})),s=new o.Mesh(n,new o.ShaderMaterial({uniforms:i.uniforms,defines:i.defines,vertexShader:l,fragmentShader:r,transparent:!0,depthWrite:!1,side:o.FrontSide}));return a.scale.setScalar(.1),s.scale.setScalar(.1),i.add(a),i.add(s),i}return t(n,e),n.prototype.setTime=function(e){void 0===this.startTime&&(this.startTime=e),this.uniforms.uTime.value=(e-this.startTime)/1e3,this.needsRender=!0},Object.defineProperty(n.prototype,"color1",{get:function(){return this.uniforms.uColor1.value},set:function(e){this.uniforms.uColor1.value=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"color2",{get:function(){return this.uniforms.uColor2.value},set:function(e){this.uniforms.uColor2.value=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"speed",{get:function(){return this.uniforms.uSpeed.value},set:function(e){this.uniforms.uSpeed.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"noise",{get:function(){return this.uniforms.uSpeed.value},set:function(e){this.uniforms.uSpeed.value=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"opacity",{get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.uOpacity.value=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"fragmentationDegree",{get:function(){return this.defines.FRAGMENTATION_DEGREE},set:function(e){this.defines.FRAGMENTATION_DEGREE=e,this.traverse((function(e){e instanceof o.Mesh&&e.material instanceof o.ShaderMaterial&&(e.material.needsUpdate=!0)})),this.needsRender=!0},enumerable:!1,configurable:!0}),n}(o.Group),f="\n\nuniform float uTime;\n\nvarying vec3 vNormal;\nvarying vec3 vWorldPosition;\nvarying float vNoise;\n\n".concat(a,"\n").concat(s,"\n\nvoid main(){\n\n vNormal = normalize( normalMatrix * normal );\n vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n vWorldPosition = worldPosition.xyz;\n vNoise = simplexNoise(vec4(position - vec3(0.0, uTime * 0.4, 0.0), 0));\n vNoise = scale(vNoise, -1.0, 1.0, 0.5, 1.0);\n\n gl_Position\t= projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n"),h=function(e){function n(t,n,i){void 0===t&&(t=1),void 0===n&&(n=.1),void 0===i&&(i=.2);var r=e.call(this)||this;r.needsRender=!0,r.uniforms={uTime:{value:0},uAttenuation:{value:.9*t},uAnglePower:{value:2},uSpotPosition:{value:r.position},uLightColor:{value:new o.Color(16777215)}};var a=new o.CylinderBufferGeometry(n,i,t,64,20,!0);a.applyMatrix4((new o.Matrix4).makeTranslation(0,-t/2,0)),a.applyMatrix4((new o.Matrix4).makeRotationX(-Math.PI/2));var s=new o.Mesh(a,new o.ShaderMaterial({uniforms:r.uniforms,vertexShader:f,fragmentShader:"\nuniform vec3 uLightColor;\nuniform vec3 uSpotPosition;\nuniform float uAttenuation;\nuniform float uAnglePower;\n\nvarying vec3 vNormal;\nvarying vec3 vWorldPosition;\nvarying float vNoise;\n\nvoid main() {\n float intensity;\n intensity\t= distance(vWorldPosition, uSpotPosition) / uAttenuation;\n intensity\t= 1.0 - clamp(intensity, 0.1, 1.0);\n\n vec3 normal = vec3(vNormal.x, vNormal.y, abs(vNormal.z));\n float angleIntensity = pow( dot(normal, vec3(0.0, 0.0, 1.0)), uAnglePower * vNoise );\n intensity\t= intensity * angleIntensity * vNoise;\n gl_FragColor = vec4( uLightColor, intensity );\n}\n",transparent:!0,side:o.FrontSide,depthWrite:!1}));return r.add(s),r}return t(n,e),n.prototype.setTime=function(e){void 0===this.startTime&&(this.startTime=e),this.uniforms.uTime.value=(e-this.startTime)/1e3,this.needsRender=!0},Object.defineProperty(n.prototype,"attenuation",{get:function(){return this.uniforms.uAttenuation.value},set:function(e){this.uniforms.uAttenuation.value=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"anglePower",{get:function(){return this.uniforms.uAnglePower.value},set:function(e){this.uniforms.uAnglePower.value=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"color",{get:function(){return this.uniforms.uLightColor.value},set:function(e){this.uniforms.uLightColor.value=e,this.needsRender=!0},enumerable:!1,configurable:!0}),n}(o.Group),m="\nuniform vec3 uColor;\nuniform float uOpacity;\nvarying vec3 vPosition;\nvarying float vNoise;\n\nvoid main() {\n float gradient = mix(0.0, 1.0, 1.0 + vPosition.y);\n gl_FragColor = vec4(uColor, vNoise * gradient * uOpacity);\n}\n",y="\n\nuniform float uTime;\nuniform float uSpeed;\nuniform float uScale;\nuniform float uExpand;\nvarying float vNoise;\nvarying vec3 vPosition;\n\n".concat(a,"\n").concat(s,"\n\nvoid main(){\n\n vPosition = position;\n vNoise = simplexNoise(vec4(position.x * uScale, position.y + uTime * uSpeed, 0.0, 0.0));\n vNoise = scale(vNoise, 0.0, 1.0, 0.5, 1.0);\n\n vec4 transformed = vec4( position, 1.0 );\n transformed.x = transformed.x * scale(abs(transformed.y), 0.0, 1.0, 1.0, uExpand);\n\n gl_Position\t= projectionMatrix * modelViewMatrix * transformed;\n}\n"),g=new o.PlaneBufferGeometry(1,1,200,200);g.translate(0,-.5,0);var b=function(e){function n(){var t=e.call(this)||this;t.needsRender=!0;var n=t.outer=new o.Mesh(g,new o.ShaderMaterial({uniforms:{uTime:{value:0},uSpeed:{value:.75},uScale:{value:2},uExpand:{value:1.2},uColor:{value:new o.Color(.5,.5,.9)},uOpacity:{value:1}},vertexShader:y,fragmentShader:m,transparent:!0,side:o.DoubleSide,depthWrite:!1})),i=t.inner=new o.Mesh(g,new o.ShaderMaterial({uniforms:{uTime:{value:0},uSpeed:{value:2},uScale:{value:20},uExpand:{value:1.2},uColor:{value:new o.Color(1,1,1)},uOpacity:{value:.1}},vertexShader:y,fragmentShader:m,transparent:!0,side:o.DoubleSide,depthWrite:!1}));return n.rotateX(-Math.PI/2),i.rotateX(-Math.PI/2),t.add(n),t.add(i),t}return t(n,e),n.prototype.setTime=function(e){void 0===this.startTime&&(this.startTime=e);var t=(e-this.startTime)/1e3;this.inner.material.uniforms.uTime.value=t,this.outer.material.uniforms.uTime.value=t,this.needsRender=!0},Object.defineProperty(n.prototype,"expand",{get:function(){return this.outer.material.uniforms.uExpand.value},set:function(e){this.outer.material.uniforms.uExpand.value=e,this.inner.material.uniforms.uExpand.value=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"speed",{get:function(){return this.inner.material.uniforms.speed.value},set:function(e){this.inner.material.uniforms.speed.value=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"color",{get:function(){return this.outer.material.uniforms.color.value},set:function(e){this.outer.material.uniforms.color.value=e,this.needsRender=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"flowColor",{get:function(){return this.inner.material.uniforms.color.value},set:function(e){this.inner.material.uniforms.color.value=e,this.needsRender=!0},enumerable:!1,configurable:!0}),n}(o.Group);function x(e,t){return e+t*(Math.random()-.5)}function w(e,t){var n=new o.Vector3(Math.random()-.5,Math.random()-.5,Math.random()-.5);return(new o.Vector3).addVectors(e,(new o.Vector3).multiplyVectors(t,n))}function S(e,t,n){return e*n+t*n*n/2}function A(e,t){for(var n=e.times.length,i=0;i<n&&t>e.times[i];)i++;if(0==i)return e.values[0];if(i==n)return e.values[n-1];var o=(t-e.times[i-1])/(e.times[i]-e.times[i-1]),r=e.values[i-1],a=e.values[i];return"number"==typeof e.values[0]?r+o*(a-r):r.clone().lerp(a,o)}var P=function(){function e(e,t,n,i,o,r,a,s,l,u,c,d,p,v){this.birthTime=e,this.deathAge=t,this.position=n.clone(),this.velocity=i.clone(),this.acceleration=o.clone(),this.angle=r,this.angleVelocity=a,this.angleAcceleration=s,this.color=l,this.colorTween=u,this.size=c,this.sizeTween=d,this.opacity=p,this.opacityTween=v}return e.prototype.getAlive=function(e){return this.deathAge>e-this.birthTime},e.prototype.getState=function(e){var t=this.getAlive(e),n=Math.min(this.deathAge,e-this.birthTime),i=function(e,t,n){return new o.Vector3(S(e.x,t.x,n),S(e.y,t.y,n),S(e.z,t.z,n))}(this.velocity,this.acceleration,n).add(this.position),r=S(this.angleVelocity,this.angleAcceleration,n)+this.angle,a=(this.sizeTween?A(this.sizeTween,n):0)+this.size,s=(this.colorTween?A(this.colorTween,n):new o.Vector3).add(this.color);return{alive:t,age:n,position:i,angle:r,size:a,color:(new o.Color).setHSL(s.x,s.y,s.z),opacity:(this.opacityTween?A(this.opacityTween,n):0)+this.opacity}},e}(),T=function(e){function n(t){var n,i,r,a,s,l,u,c,d,p,v,f,h,m,y,g,b,x,w,S,A,P,T,M,C,B,z,E,N,_,j,O,V,R,F,U,D,I,G=this,X=new o.BufferGeometry;X.setAttribute("position",new o.BufferAttribute(new Float32Array,3)),X.setAttribute("alive",new o.BufferAttribute(new Float32Array,1)),X.setAttribute("color",new o.BufferAttribute(new Float32Array,3)),X.setAttribute("opacity",new o.BufferAttribute(new Float32Array,1)),X.setAttribute("size",new o.BufferAttribute(new Float32Array,1)),X.setAttribute("angle",new o.BufferAttribute(new Float32Array,1));var L=new o.ShaderMaterial({uniforms:{map:{value:null!==(n=t.texture)&&void 0!==n?n:null}},defines:{USE_MAP:!!t.texture},vertexShader:"\nattribute vec3 color;\nattribute float opacity;\nattribute float size;\nattribute float alive; // float used as boolean (0 = false, 1 = true)\n\nvarying vec4 vColor;\n\n#if defined(USE_MAP)\n attribute float angle;\n varying float vAngle;\n#endif\n\nvoid main() {\n if (alive > 0.5) {\n vColor = vec4(color, opacity);\n } else {\n vColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n #if defined(USE_MAP)\n vAngle = angle;\n #endif\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_PointSize = size * ( 300.0 / length( mvPosition.xyz ) );\n gl_Position = projectionMatrix * mvPosition;\n}\n",fragmentShader:"\nvarying vec4 vColor;\n\n#if defined(USE_MAP)\n uniform sampler2D map;\n varying float vAngle;\n#endif\n\nvoid main() {\n gl_FragColor = vColor;\n\n #if defined(USE_MAP)\n float c = cos(vAngle);\n float s = sin(vAngle);\n\n // rotate UV coordinates to rotate texture\n vec2 rotatedUV = vec2(\n c * (gl_PointCoord.x - 0.5) + s * (gl_PointCoord.y - 0.5) + 0.5,\n c * (gl_PointCoord.y - 0.5) - s * (gl_PointCoord.x - 0.5) + 0.5\n );\n vec4 rotatedTexture = texture2D(map, rotatedUV);\n gl_FragColor = vColor * rotatedTexture;\n #endif\n}\n",transparent:!0,blending:null!==(i=t.blending)&&void 0!==i?i:o.NormalBlending,depthWrite:!1});return(G=e.call(this,X,L)||this).instances=[],G.needsRender=!0,G.birthTime=Date.now()/1e3,G.disposed=!1,G.paused=!1,G.positionBase=null!==(a=null===(r=t.positionBase)||void 0===r?void 0:r.clone())&&void 0!==a?a:new o.Vector3,G.positionStyle=null!==(s=t.positionStyle)&&void 0!==s?s:"CUBE",G.positionCubeSpread=null!==(u=null===(l=t.positionCubeSpread)||void 0===l?void 0:l.clone())&&void 0!==u?u:new o.Vector3,G.positionSphereSpread=null!==(c=t.positionSphereSpread)&&void 0!==c?c:0,G.velocityStyle=null!==(d=t.velocityStyle)&&void 0!==d?d:"CUBE",G.velocityCubeBase=null!==(v=null===(p=t.velocityCubeBase)||void 0===p?void 0:p.clone())&&void 0!==v?v:new o.Vector3,G.velocityCubeSpread=null!==(h=null===(f=t.velocityCubeSpread)||void 0===f?void 0:f.clone())&&void 0!==h?h:new o.Vector3,G.velocitySphereBase=null!==(m=t.velocitySphereBase)&&void 0!==m?m:0,G.velocitySphereSpread=null!==(y=t.velocitySphereSpread)&&void 0!==y?y:0,G.accelerationBase=null!==(b=null===(g=t.accelerationBase)||void 0===g?void 0:g.clone())&&void 0!==b?b:new o.Vector3,G.accelerationSpread=null!==(w=null===(x=t.accelerationSpread)||void 0===x?void 0:x.clone())&&void 0!==w?w:new o.Vector3,G.angleBase=null!==(S=t.angleBase)&&void 0!==S?S:0,G.angleSpread=null!==(A=t.angleSpread)&&void 0!==A?A:0,G.angleVelocityBase=null!==(P=t.angleVelocityBase)&&void 0!==P?P:0,G.angleVelocitySpread=null!==(T=t.angleVelocitySpread)&&void 0!==T?T:0,G.angleAccelerationBase=null!==(M=t.angleAccelerationBase)&&void 0!==M?M:0,G.angleAccelerationSpread=null!==(C=t.angleAccelerationSpread)&&void 0!==C?C:0,G.sizeBase=null!==(B=t.sizeBase)&&void 0!==B?B:.1,G.sizeSpread=null!==(z=t.sizeSpread)&&void 0!==z?z:0,G.sizeTween=null!==(E=t.sizeTween)&&void 0!==E?E:null,G.colorBase=null!==(_=null===(N=t.colorBase)||void 0===N?void 0:N.clone())&&void 0!==_?_:new o.Vector3,G.colorSpread=null!==(O=null===(j=t.colorSpread)||void 0===j?void 0:j.clone())&&void 0!==O?O:new o.Vector3,G.colorTween=null!==(V=t.colorTween)&&void 0!==V?V:null,G.opacityBase=(null!==(R=t.opacityBase)&&void 0!==R?R:t.opacityTween)?0:1,G.opacitySpread=null!==(F=t.opacitySpread)&&void 0!==F?F:0,G.opacityTween=null!==(U=t.opacityTween)&&void 0!==U?U:null,G.particlesPerSecond=null!==(D=t.particlesPerSecond)&&void 0!==D?D:60,G.particleDeathAge=null!==(I=t.particleDeathAge)&&void 0!==I?I:1,G}return t(n,e),Object.defineProperty(n.prototype,"texture",{get:function(){return this.material.uniforms.map.value},set:function(e){this.material.uniforms.map.value=e,null===e?!1!==this.material.defines.USE_MAP&&(this.material.defines.USE_MAP=!1,this.material.needsUpdate=!0):!0!==this.material.defines.USE_MAP&&(this.material.defines.USE_MAP=!0,this.material.needsUpdate=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blending",{get:function(){return this.material.blending},set:function(e){this.material.blending=e},enumerable:!1,configurable:!0}),n.prototype.createInstance=function(e){var t=this.positionBase.clone();switch(this.positionStyle){case"CUBE":t=w(this.positionBase,this.positionCubeSpread);break;case"SPHERE":var n=2*Math.random()-1,i=2*Math.PI*Math.random(),r=Math.sqrt(1-n*n),a=new o.Vector3(r*Math.cos(i),r*Math.sin(i),n);t=(new o.Vector3).addVectors(this.positionBase,a.multiplyScalar(this.positionSphereSpread))}var s=new o.Vector3;switch(this.velocityStyle){case"CUBE":s=w(this.velocityCubeBase,this.velocityCubeSpread);break;case"SPHERE":var l=(new o.Vector3).subVectors(t,this.positionBase),u=x(this.velocitySphereBase,this.velocitySphereSpread);s=l.normalize().multiplyScalar(u)}return new P(e,this.particleDeathAge,t,s,w(this.accelerationBase,this.accelerationSpread),x(this.angleBase,this.angleSpread),x(this.angleVelocityBase,this.angleVelocitySpread),x(this.angleAccelerationBase,this.angleAccelerationSpread),w(this.colorBase,this.colorSpread),this.colorTween,x(this.sizeBase,this.sizeSpread),this.sizeTween,x(this.opacityBase,this.opacitySpread),this.opacityTween)},n.prototype.pause=function(){!0!==this.paused&&(this.paused=!0,this.birthTime=Date.now()/1e3)},n.prototype.play=function(){!1!==this.paused&&(this.paused=!1,this.birthTime=Date.now()/1e3)},n.prototype.setTime=function(e){if(!this.disposed){var t,n=(e/=1e3)-this.birthTime,i=Math.ceil(this.particlesPerSecond*this.particleDeathAge);this.geometry.attributes.position.count<i&&((c=new Float32Array(3*i)).set(this.geometry.attributes.position.array,0),(t=new o.BufferAttribute(c,3)).needsUpdate=!0,this.geometry.setAttribute("position",t)),this.geometry.attributes.alive.count<i&&((d=new Float32Array(i)).set(this.geometry.attributes.alive.array,0),(t=new o.BufferAttribute(d,1)).needsUpdate=!0,this.geometry.setAttribute("alive",t)),this.geometry.attributes.color.count<i&&((p=new Float32Array(3*i)).set(this.geometry.attributes.color.array,0),(t=new o.BufferAttribute(p,3)).needsUpdate=!0,this.geometry.setAttribute("color",t)),this.geometry.attributes.opacity.count<i&&((v=new Float32Array(i)).set(this.geometry.attributes.opacity.array,0),(t=new o.BufferAttribute(v,1)).needsUpdate=!0,this.geometry.setAttribute("opacity",t)),this.geometry.attributes.size.count<i&&((f=new Float32Array(i)).set(this.geometry.attributes.size.array,0),(t=new o.BufferAttribute(f,1)).needsUpdate=!0,this.geometry.setAttribute("size",t)),this.geometry.attributes.angle.count<i&&((h=new Float32Array(i)).set(this.geometry.attributes.angle.array,0),(t=new o.BufferAttribute(h,1)).needsUpdate=!0,this.geometry.setAttribute("angle",t)),this.instances.length<i&&(this.instances.length=i);for(var r=0;r<this.instances.length;r++){var a=this.instances[r];if(r<i&&!1===this.paused&&(void 0===a||!1===a.getAlive(e))){var s=this.particleDeathAge/i*r;if(n>s){var l=e-(n-s)%this.particleDeathAge;this.instances[r]=a=this.createInstance(l)}}if(a){var u=a.getState(e),c=u.position,d=u.alive,p=u.color,v=u.opacity,f=u.size,h=u.angle;this.geometry.attributes.position.setXYZ(r,c.x,c.y,c.z),this.geometry.attributes.position.needsUpdate=!0,this.geometry.attributes.alive.setX(r,d?1:0),this.geometry.attributes.alive.needsUpdate=!0,this.geometry.attributes.color.setXYZ(r,p.r,p.g,p.b),this.geometry.attributes.color.needsUpdate=!0,this.geometry.attributes.opacity.setX(r,v),this.geometry.attributes.opacity.needsUpdate=!0,this.geometry.attributes.size.setX(r,f),this.geometry.attributes.size.needsUpdate=!0,this.geometry.attributes.angle.setX(r,h),this.geometry.attributes.angle.needsUpdate=!0}}this.geometry.computeBoundingBox(),this.geometry.boundingSphere||(this.geometry.boundingSphere=new o.Sphere),this.geometry.boundingBox.getBoundingSphere(this.geometry.boundingSphere),this.needsRender=!0}},n.prototype.dispose=function(){var e;this.disposed=!0,this.geometry.dispose(),null===(e=this.texture)||void 0===e||e.dispose(),this.material.dispose()},n}(o.Points)})(),i})()));
|
package/umd/five-vue.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.FiveSDK_Vue=n():e.FiveSDK_Vue=n()}(self,(()=>(()=>{var e={348:e=>{if(!("FiveSDK"in window))throw new Error('"FiveSDK" is not available. Please include "five" in your HTML.');e.exports=window.FiveSDK},438:e=>{if(!("THREE"in window))throw new Error('"THREE" is not available. Please include "three.js" in your HTML.');const n=Number(THREE.REVISION);if(n<115||n>117)throw new Error('"Five" needs "THREE.js" version between 125 - 117.');e.exports=window.THREE},928:e=>{if(!("Vue"in window))throw new Error('"Vue" is not available. Please include "vue" in your HTML.');e.exports=window.Vue}},n={};function o(t){var r=n[t];if(void 0!==r)return r.exports;var i=n[t]={exports:{}};return e[t](i,i.exports,o),i.exports}o.d=(e,n)=>{for(var t in n)o.o(n,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},o.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};return(()=>{"use strict";o.r(t),o.d(t,{FiveCanvas:()=>l,FiveProvider:()=>s,unsafe__useFiveInject:()=>P,useFiveAction:()=>g,useFiveCameraDirection:()=>R,useFiveCameraRaycaster:()=>S,useFiveCurrentObserver:()=>h,useFiveCurrentState:()=>w,useFiveEventCallback:()=>m,useFiveFloor:()=>O,useFiveHelper:()=>U,useFiveModel:()=>T,useFiveModelBounding:()=>V,useFiveModelIntersectRaycaster:()=>E,useFiveModelReadyState:()=>x,useFiveProject2d:()=>y,useFiveScene:()=>L,useFiveState:()=>p,useFiveWork:()=>v});var e=function(){return e=Object.assign||function(e){for(var n,o=1,t=arguments.length;o<t;o++)for(var r in n=arguments[o])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},e.apply(this,arguments)};Object.create,Object.create;var n=o(928),r=!1,i=Symbol();function u(){var e=(0,n.inject)(i);if(!e)throw new Error("Inject five error!");return e}var a={display:"inline-block",overflow:"hidden"},l=(0,n.defineComponent)({props:{width:{type:Number,required:!0},height:{type:Number,required:!0}},setup:function(o){var t=(0,n.toRef)(o,"width"),r=(0,n.toRef)(o,"height"),i=u(),l=(0,n.ref)(null);return(0,n.watch)([t,r,l],(function(){if(i.renderer&&l.value){if(null!==i.renderer.domElement.parentNode&&i.renderer.domElement.parentNode!==l.value)throw new Error("There are more than 2 fiveCanvas in this context.");i.renderer.domElement.parentNode!==l.value&&l.value.appendChild(i.renderer.domElement),i.camera.aspect=t.value/r.value,i.camera.updateProjectionMatrix(),i.renderer.setSize(t.value,r.value),i.needsRender=!0}})),function(){return(0,n.h)("div",{id:"five",style:e({width:"".concat(t.value,"px"),height:"".concat(r.value,"px")},a),ref:l})}}}),c=o(348),f=o(438),d=[],s=(0,n.defineComponent)({props:{work:Object,initialWork:Object,initialState:Object,initialUserAction:Boolean,onWorkChange:Function,onStateChange:Function,onCurrentStateChange:Function,onError:Function,fiveInitArgs:{type:Object,default:function(){return{}}},style:Object},setup:function(o){var t,u,a=(0,n.toRefs)(o).work,l=function(e){var n=void 0===e?{}:e,o=n.backgroundColor,t=void 0===o?1579548:o,r=n.backgroundAlpha,i=void 0===r?1:r,u=n.pixelRatio,a=void 0===u?1:u;if("undefined"!=typeof window){var l=d.shift();return l||((l=new f.WebGLRenderer({antialias:!1,alpha:!0})).outputEncoding=f.sRGBEncoding),l.setPixelRatio(a),l.setClearColor(t,i),l.autoClear=!0,l}}({pixelRatio:1===(0,c.getViewportScale)()?window.devicePixelRatio:1}),s=new c.Five(e({renderer:l},o.fiveInitArgs));return(o.work||o.initialWork)&&s.load(o.work||o.initialWork,o.initialState,void 0,null===(t=o.initialUserAction)||void 0===t||t),u=!!o.work,r=u,a&&(0,n.watch)(a,(function(e,n){e&&e!==(null==s?void 0:s.work)&&(null==s||s.load(e,o.initialState))})),(0,n.onBeforeUnmount)((function(){s&&(s.dispose(),function(e){e&&-1===d.indexOf(e)&&d.push(e)}(s.renderer))})),s.on("load",(function(){o.onWorkChange&&s.work&&o.onWorkChange(null==s?void 0:s.work)})),s.on("stateChange",(function(e,n){o.onStateChange&&o.onStateChange(e,n)})),s.on("currentStateChange",(function(e,n){o.onCurrentStateChange&&o.onCurrentStateChange(e,n)})),s.on("error",(function(e){o.onError?o.onError(e):console.warn(e.message)})),(0,n.provide)(i,s),{five:(0,n.shallowReadonly)(s)}},render:function(){return(0,n.h)("div",{style:this.$props.style},this.$slots)}});function v(){var e=u(),o=(0,n.ref)(e.work),t=(0,n.readonly)(o),i=e.on("load",(function(){o.value=e.work}));return(0,n.onBeforeUnmount)((function(){i()})),[t,function(n,o,t,i){if(r)throw new Error("props 'work' is set in fiveProvider, if you need modify work internal, use 'initialWork' instead.");return e.load(n,o,t,i)}]}function p(){var o=u(),t=(0,n.ref)(e({},o.state)),r=o.on("stateChange",(function(n){Object.assign(t.value,e({},n))}));return(0,n.onBeforeUnmount)((function(){r()})),[t,function(e,n,t){void 0===n&&(n=!1),void 0===t&&(t=!0);var r="function"==typeof e?e(o.getCurrentState()):e;o.setState(r,n,t)}]}function w(){var e=u(),o=(0,n.ref)(e.getCurrentState()),t=e.on("currentStateChange",(function(){Object.assign(o.value,e.getCurrentState())}));return(0,n.onBeforeUnmount)((function(){t()})),[o,function(n,o,t){var r="function"==typeof n?n(e.getCurrentState()):n;e.setState(r,o,t)}]}function h(){var e=u(),o=(0,n.reactive)(e.getCurrentState()),t=(0,n.ref)(e.work?e.work.observers[o.panoIndex]:null),r=e.on("currentStateChange",(function(){Object.assign(o,e.getCurrentState()),e.work&&(t.value=e.work.observers[o.panoIndex])}));return(0,n.onBeforeUnmount)((function(){r()})),t}function m(e,o){var t=u().on(e,o);(0,n.onBeforeUnmount)((function(){t()}))}function g(){var e=u();return{updateCamera:function(n,o){return e.updateCamera(n,o)},getPixels:function(n,o,t,r,i){return e.getPixels(n,o,t,r,i)},render:function(n){return e.render(n)},needsRender:function(){return e.needsRender=!0},preloadPano:function(n,o){return e.preloadPano(n,o)},project2d:function(n,o){return void 0===o&&(o=!1),e.project2d(n,o)}}}function b(e,o){void 0===o&&(o=!1);var t=u(),r=(0,n.ref)(Symbol()),i=(0,n.shallowRef)(e?t.project2d((0,n.isRef)(e)?e.value:e,o):null),a=t.on("cameraUpdate",(function(){r.value=Symbol()}));return(0,n.onBeforeUnmount)((function(){a()})),(0,n.watch)([r,e],(function(){i.value=t.project2d((0,n.isRef)(e)?e.value:e,o)})),i}function y(){return b}function C(e){var n=e.camera.getWorldDirection(new f.Vector3);return new f.Raycaster(e.camera.position,n)}function S(){var e=u(),o=(0,n.shallowRef)(C(e)),t=e.on("cameraUpdate",(function(){o.value=C(e)}));return(0,n.onBeforeUnmount)((function(){t()})),o}function F(e){return e.camera.getWorldDirection(new f.Vector3)}function R(){var e=u(),o=(0,n.shallowRef)(F(e)),t=e.on("cameraUpdate",(function(){o.value=F(e)}));return(0,n.onBeforeUnmount)((function(){t()})),o}function j(e){var o=u(),t=(0,n.shallowRef)([]);return(0,n.watch)(e,(function(){t.value=o.model.intersectRaycaster((0,n.isRef)(e)?e.value:e)})),t}function E(){return j}function k(e){return e.model.empty?"Empty":"Loaded"}function x(){var e=u(),o=(0,n.ref)(k(e)),t=e.on("modelLoaded",(function(){o.value=k(e)}));return(0,n.onBeforeUnmount)((function(){t()})),o}function O(){var e=u(),o=(0,n.ref)(e.model.shownFloor),t=(0,n.ref)(e.model.floorLength),r=[];return r.push(e.on("modelShownFloorChange",(function(){o.value=e.model.shownFloor}))),r.push(e.on("modelLoaded",(function(){t.value=e.model.floorLength}))),(0,n.onBeforeUnmount)((function(){for(var e;e=r.shift();)e()})),[o,t,function(n){"number"==typeof n?e.model.show(n):e.model.show()}]}function U(){var e=u(),o=(0,n.ref)(e.helperVisible),t=e.on("helpersVisibleChange",(function(e){o.value=e}));return(0,n.onBeforeUnmount)((function(){t()})),[o,function(n){e.helperVisible=n}]}function P(){return u()}function B(e){return e.model.bounding.clone()}function V(){var e=u(),o=(0,n.shallowRef)(B(e)),t=e.on("modelLoaded",(function(){o.value=B(e)}));return(0,n.onBeforeUnmount)((function(){t()})),o}function L(){return u().scene}function T(){var e=u(),o=(0,n.shallowRef)(e.model),t=e.on("modelLoaded",(function(){o.value=e.model}));return(0,n.onBeforeUnmount)((function(){t()})),o}})(),t})()));
|