@realsee/five 5.0.0-alpha.98 → 6.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/assets/highlight.css +1 -1
- package/docs/assets/main.js +2 -2
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +28 -2
- package/docs/classes/five.AnimationFrameLoop.html +5 -5
- package/docs/classes/five.BVH.html +2 -2
- package/docs/classes/five.BVHIntersect.html +1 -1
- package/docs/classes/five.BVHNode.html +2 -2
- package/docs/classes/five.BVHVector3.html +1 -1
- package/docs/classes/five.BoxBoundingVolume.html +1 -0
- package/docs/classes/five.Camera.html +6 -6
- package/docs/classes/five.Clipper.html +1 -0
- package/docs/classes/five.CullingVolume.html +1 -0
- package/docs/classes/five.Five.html +116 -83
- package/docs/classes/five.InternalWebGLRenderer.html +1 -1
- package/docs/classes/five.IntersectMesh.html +1 -1
- package/docs/classes/five.Model.html +37 -37
- package/docs/classes/five.NetworkSubscribe.html +22 -15
- package/docs/classes/five.PBMContainer.html +9 -11
- package/docs/classes/five.PBMGroup.html +2 -18
- package/docs/classes/five.PBMMaterialReferenceCache.html +1 -0
- package/docs/classes/five.PBMMesh.html +3 -5
- package/docs/classes/five.PBMMeshMaterial.html +41 -0
- package/docs/classes/five.PanoCircleMesh.html +4 -4
- package/docs/classes/five.PanoCircleMeshCustom.html +7 -0
- package/docs/classes/five.PanoCircleMeshSolid.html +7 -0
- package/docs/classes/five.RegionBoundingVolume.html +1 -0
- package/docs/classes/five.RequestScheduler.html +16 -0
- package/docs/classes/five.Scene.html +2 -2
- package/docs/classes/five.SphereBoundingVolume.html +1 -0
- package/docs/classes/five.Subscribe.html +24 -17
- package/docs/classes/five.TextureLoader.html +1 -0
- package/docs/classes/five.Tile.html +1 -0
- package/docs/classes/five.Tile3DModel.html +1 -0
- package/docs/classes/five.TileCubeTextureTarget.html +1 -0
- package/docs/classes/five.TileNode.html +1 -0
- package/docs/classes/five.Tileset.html +5 -0
- package/docs/classes/five.TilesetCache.html +1 -0
- package/docs/classes/five.TilesetTraverser.html +1 -0
- package/docs/classes/five.Work.html +21 -10
- 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 +8 -8
- package/docs/classes/gltf_loader.GLTFObject.html +3 -3
- 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 -1
- package/docs/classes/line.LineGeometry.html +1 -1
- package/docs/classes/line.LineMaterial.html +1 -1
- package/docs/classes/line.LineSegmentsGeometry.html +1 -1
- package/docs/classes/line.THREE_Line2.html +1 -1
- package/docs/classes/line.THREE_LineSegments2.html +1 -1
- package/docs/classes/react.Store.html +13 -13
- package/docs/classes/sticker.Sticker.html +9 -9
- 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/enums/five.PBMPointColorType.html +1 -0
- package/docs/enums/five.PBMPointShapeType.html +1 -0
- package/docs/enums/five.PBMPointSizeType.html +1 -0
- package/docs/enums/five.VolumePlaneIntersect.html +1 -0
- package/docs/index.html +2 -2
- package/docs/interfaces/five.AddableObject.html +9 -1
- package/docs/interfaces/five.AnimationFrame.html +1 -1
- package/docs/interfaces/five.BoundingVolume.html +1 -0
- package/docs/interfaces/five.CameraPose.html +1 -1
- package/docs/interfaces/five.ClipperParameter.html +1 -0
- package/docs/interfaces/five.DepthPanoramaControllerCustomInitArgs.html +12 -14
- package/docs/interfaces/five.EventCallback.html +107 -113
- package/docs/interfaces/five.FiveInitArgs.html +39 -32
- package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +9 -9
- package/docs/interfaces/five.ImageOptions.html +8 -6
- package/docs/interfaces/five.ImageURLMappings.html +1 -0
- package/docs/interfaces/five.ImageURLOptions.html +15 -1
- package/docs/interfaces/five.IntersectMeshInterface.html +2 -2
- package/docs/interfaces/five.Intersection.html +4 -4
- package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +11 -0
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +9 -11
- package/docs/interfaces/five.ModelEventCallback.html +7 -13
- package/docs/interfaces/five.ModelLodOptions.html +1 -0
- package/docs/interfaces/five.MotionKeyframe.html +1 -0
- package/docs/interfaces/five.MovePanoOptions.html +17 -14
- package/docs/interfaces/five.NetworkOptions.html +9 -0
- package/docs/interfaces/five.PBMPanoPicture.html +4 -4
- package/docs/interfaces/five.PBMParameters.html +32 -8
- package/docs/interfaces/five.PanoCircleMeshCustomOptions.html +1 -0
- package/docs/interfaces/five.PanoCircleMeshInterface.html +15 -5
- package/docs/interfaces/five.PanoCircleMeshOptions.html +1 -0
- package/docs/interfaces/five.PanoCircleMeshSolidOptions.html +1 -0
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +19 -14
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +9 -11
- package/docs/interfaces/five.Pose.html +9 -7
- package/docs/interfaces/five.Scissor.html +6 -6
- package/docs/interfaces/five.State.html +13 -9
- package/docs/interfaces/five.SubscribeMixinType.emit.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.hasListener.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.off.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.on.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.once.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.waitUnitl.html +1 -0
- package/docs/interfaces/five.TextureOptions.html +9 -7
- package/docs/interfaces/five.Tile3DModelLoaderOptions.html +3 -0
- package/docs/interfaces/five.TileCubeNode.html +1 -0
- package/docs/interfaces/five.TileCubeTree.html +1 -0
- package/docs/interfaces/five.TileHeader.html +1 -0
- package/docs/interfaces/five.TilesetHeader.html +1 -0
- package/docs/interfaces/five.TilesetOptions.html +1 -0
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +6 -4
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +17 -15
- package/docs/interfaces/five.WebXRControllerParams.html +1 -0
- package/docs/interfaces/five.WorkCubeImage.html +7 -7
- package/docs/interfaces/five.WorkImage.html +11 -11
- package/docs/interfaces/five.WorkInitial.html +13 -9
- package/docs/interfaces/five.WorkModel.html +7 -7
- package/docs/interfaces/five.WorkObserver.html +21 -15
- package/docs/interfaces/five.WorkOptions.html +15 -0
- package/docs/interfaces/five.WorkTile.html +1 -1
- package/docs/interfaces/five.WorkVideo.html +5 -5
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +29 -0
- package/docs/interfaces/gltf_loader.DDS.html +1 -0
- package/docs/interfaces/gltf_loader.GLTF.html +2 -2
- package/docs/interfaces/gltf_loader.GLTFReference.html +1 -0
- package/docs/interfaces/gltf_loader.THREEGLTF.html +1 -0
- package/docs/interfaces/react.FiveActionReactCallbacks.html +11 -21
- package/docs/interfaces/react.FiveInjectionTypes.html +40 -43
- package/docs/interfaces/react.PropTypeOfFiveFeatures.html +1 -1
- package/docs/interfaces/sticker.IntersectionLike.html +4 -4
- 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 -1
- package/docs/modules/five.html +130 -113
- package/docs/modules/gltf_loader.html +1 -1
- package/docs/modules/line.html +1 -1
- package/docs/modules/react.html +36 -36
- package/docs/modules/sticker.html +1 -1
- package/docs/modules/vfx.html +1 -0
- package/docs/modules/vue.html +115 -0
- package/docs/modules.html +1 -1
- package/exporters/staticify.js +14 -7
- package/five/index.d.ts +1208 -252
- package/five/index.js +9 -98
- package/gltf-loader/index.d.ts +90 -5
- package/gltf-loader/index.js +3 -3
- package/line/index.d.ts +1 -0
- package/line/index.js +3 -3
- package/package.json +10 -6
- package/react/index.d.ts +61 -69
- package/react/index.js +3 -3
- package/resource/basis/1.16/basis_transcoder.js +22 -0
- package/resource/basis/{basis_transcoder.wasm → 1.16/basis_transcoder.wasm} +0 -0
- package/resource/basis/README.md +5 -0
- package/resource/draco/1.5.6/draco_decoder.js +34 -0
- package/resource/draco/1.5.6/draco_decoder.wasm +0 -0
- package/resource/draco/1.5.6/draco_decoder_gltf.js +33 -0
- package/resource/draco/1.5.6/draco_decoder_gltf.wasm +0 -0
- package/resource/draco/1.5.6/draco_encoder.js +35 -0
- package/resource/draco/1.5.6/draco_encoder.wasm +0 -0
- package/resource/draco/1.5.6/draco_encoder_wrapper.js +97 -0
- package/resource/draco/1.5.6/draco_wasm_wrapper.js +117 -0
- package/resource/draco/1.5.6/draco_wasm_wrapper_gltf.js +116 -0
- package/resource/draco/README.md +5 -0
- package/scripts/five-staticify.js +6 -1
- package/sticker/index.d.ts +2 -1
- package/sticker/index.js +3 -3
- 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 +5 -202
- package/vfx/index.d.ts +264 -0
- package/vfx/index.js +260 -0
- package/vue/index.d.ts +443 -0
- package/vue/index.js +260 -0
- package/docs/classes/five.LegacyPanoCircleMesh.html +0 -5
- package/docs/classes/five.PBMMaterial.html +0 -15
- package/docs/classes/server.BVH.html +0 -10
- package/docs/classes/server.BVHIntersect.html +0 -1
- package/docs/classes/server.BVHNode.html +0 -7
- package/docs/classes/server.BVHVector3.html +0 -1
- package/docs/classes/server.Model.html +0 -63
- package/docs/classes/server.PBMGroup.html +0 -9
- package/docs/classes/server.PBMMesh.html +0 -7
- package/docs/interfaces/server.Intersection.html +0 -7
- package/docs/interfaces/server.ModelEventCallback.html +0 -18
- package/docs/modules/server.html +0 -18
- package/resource/basis/basis_transcoder.js +0 -22
- package/resource/gltf/draco_decoder.js +0 -31
- package/resource/gltf/draco_decoder.wasm +0 -0
- package/resource/gltf/draco_wasm_wrapper.js +0 -119
- package/server/index.d.ts +0 -556
- package/server/index.js +0 -367
package/line/index.d.ts
CHANGED
package/line/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @realsee/five
|
|
3
3
|
*
|
|
4
|
-
* Generated:
|
|
5
|
-
* Version:
|
|
4
|
+
* Generated: 2023-09-07
|
|
5
|
+
* Version: 6.0.0-alpha.0
|
|
6
6
|
*
|
|
7
7
|
* Terms:
|
|
8
8
|
* Realsee SDK License Agreement
|
|
@@ -257,4 +257,4 @@
|
|
|
257
257
|
* Agreement and all related documents shall be drafted in English.
|
|
258
258
|
*/
|
|
259
259
|
|
|
260
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib");function e(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var n=e(require("three")),i=function(e){function i(){var t=e.call(this)||this;t.type="LineSegmentsGeometry";return t.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),t.setAttribute("position",new n.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)),t.setAttribute("uv",new n.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),t}return t.__extends(i,e),i.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},i.prototype.setPositions=function(t){var e;e=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var i=new n.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceStart",new n.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new n.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},i.prototype.setColors=function(t){var e;e=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var i=new n.InstancedInterleavedBuffer(e,6,1);return this.setAttribute("instanceColorStart",new n.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new n.InterleavedBufferAttribute(i,3,3)),this},i.prototype.fromWireframeGeometry=function(t){return this.setPositions(t.attributes.position.array),this},i.prototype.fromEdgesGeometry=function(t){return this.setPositions(t.attributes.position.array),this},i.prototype.fromMesh=function(t){return this.fromWireframeGeometry(new n.WireframeGeometry(t.geometry)),this},i.prototype.fromLineSegments=function(t){var e=t.geometry;if(e instanceof n.Geometry){var i=(new n.BufferGeometry).fromGeometry(e);this.setPositions(i.attributes.position.array)}else e instanceof n.BufferGeometry&&this.setPositions(e.attributes.position.array);return this},i.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new n.Box3);var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var i=new n.Box3;this.boundingBox.setFromBufferAttribute(t),i.setFromBufferAttribute(e),this.boundingBox.union(i)}},i.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new n.Sphere),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var r=0,o=new n.Vector3,a=0,s=t.count;a<s;a++)o.fromBufferAttribute(t,a),r=Math.max(r,i.distanceToSquared(o)),o.fromBufferAttribute(e,a),r=Math.max(r,i.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},i.prototype.toJSON=function(){},i}(n.InstancedBufferGeometry);Object.assign(i.prototype,{isLineSegmentsGeometry:!0});var r={uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new n.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"},o=function(e){function i(t){var i=e.call(this,{uniforms:n.UniformsUtils.clone(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,clipping:!0})||this;return i.type="LineMaterial",i.dashed=!1,Object.defineProperties(i,{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)}}}),i.setValues(t),i}return t.__extends(i,e),i}(n.ShaderMaterial);Object.assign(o.prototype,{isLineMaterial:!0});var a=function(e){function r(t,n){var r=e.call(this)||this;return r.type="LineSegments2",r.geometry=void 0!==t?t:new i,r.material=void 0!==n?n:new o({color:16777215*Math.random()}),r}return t.__extends(r,e),r.prototype.computeLineDistances=function(){for(var t=this.geometry,e=t.attributes.instanceStart,i=t.attributes.instanceEnd,r=new Float32Array(2*e.count),o=new n.Vector3,a=new n.Vector3,s=0,u=0,c=e.count;s<c;s++,u+=2)o.fromBufferAttribute(e,s),a.fromBufferAttribute(i,s),r[u]=0===u?0:r[u-1],r[u+1]=r[u]+o.distanceTo(a);var l=new n.InstancedInterleavedBuffer(r,2,1);return t.setAttribute("instanceDistanceStart",new n.InterleavedBufferAttribute(l,1,0)),t.setAttribute("instanceDistanceEnd",new n.InterleavedBufferAttribute(l,1,1)),this},r.prototype.raycast=function(t,e){null===t.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var i=t.ray,r=t.camera,o=r.projectionMatrix,a=this.geometry,s=this.material,u=s.resolution,c=s.linewidth,l=a.attributes.instanceStart,f=a.attributes.instanceEnd,d=new n.Vector4,p=new n.Vector4,m=new n.Vector4,h=new n.Vector3,v=new n.Matrix4,y=new n.Line3,A=new n.Vector3;i.at(1,m),m.w=1,m.applyMatrix4(r.matrixWorldInverse),m.applyMatrix4(o),m.multiplyScalar(1/m.w),m.x*=u.x/2,m.y*=u.y/2,m.z=0,h.copy(m);var g=this.matrixWorld;v.multiplyMatrices(r.matrixWorldInverse,g);for(var b=0,S=l.count;b<S;b++){d.fromBufferAttribute(l,b),p.fromBufferAttribute(f,b),d.w=1,p.w=1,d.applyMatrix4(v),p.applyMatrix4(v),d.applyMatrix4(o),p.applyMatrix4(o),d.multiplyScalar(1/d.w),p.multiplyScalar(1/p.w);var w=d.z<-1&&p.z<-1,x=d.z>1&&p.z>1;if(!w&&!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 B=y.closestPointToPointParameter(h,!0);y.at(B,A);var E=n.MathUtils.lerp(d.z,p.z,B),z=E>=-1&&E<=1,M=h.distanceTo(A)<.5*c;if(z&&M){y.start.fromBufferAttribute(l,b),y.end.fromBufferAttribute(f,b),y.start.applyMatrix4(g),y.end.applyMatrix4(g);var C=new n.Vector3,L=new n.Vector3;i.distanceSqToSegment(y.start,y.end,L,C),e.push({point:L,pointOnLine:C,distance:i.origin.distanceTo(L),object:this,faceIndex:b})}}}},r}(n.Mesh);Object.assign(a.prototype,{isLineSegments2:!0});var s=function(e){function n(t,n){var i=e.call(this,t,n)||this;return i.type="Line2",i}return t.__extends(n,e),n}(a);Object.assign(s.prototype,{isLine2:!0});var u=function(e){function i(){var t=e.call(this)||this;return t.type="LineGeometry",t}return t.__extends(i,e),i.prototype.setPositions=function(t){for(var n=t.length-3,i=new Float32Array(2*n),r=0;r<n;r+=3)i[2*r]=t[r],i[2*r+1]=t[r+1],i[2*r+2]=t[r+2],i[2*r+3]=t[r+3],i[2*r+4]=t[r+4],i[2*r+5]=t[r+5];return e.prototype.setPositions.call(this,i),this},i.prototype.setColors=function(t){for(var n=t.length-3,i=new Float32Array(2*n),r=0;r<n;r+=3)i[2*r]=t[r],i[2*r+1]=t[r+1],i[2*r+2]=t[r+2],i[2*r+3]=t[r+3],i[2*r+4]=t[r+4],i[2*r+5]=t[r+5];return e.prototype.setColors.call(this,i),this},i.prototype.fromLine=function(t){var e=t.geometry;if(e instanceof n.Geometry){var i=(new n.BufferGeometry).fromGeometry(e);this.setPositions(i.attributes.position.array)}else e instanceof n.BufferGeometry&&this.setPositions(e.attributes.position.array);return this},i.prototype.copy=function(){return this},i}(i);Object.assign(u.prototype,{isLineGeometry:!0});var c=null,l=function(e){function i(t,i){void 0===t&&(t=new n.Vector3),void 0===i&&(i=new n.Vector3);var r=e.call(this)||this;r.type="FiveLine",r.needsRender=!0;var a=new u,l=new o({color:14467195,linewidth:2,dashScale:20,dashed:!1});r.line=new s(a,l);var f=new n.BufferGeometry,d=new n.PointsMaterial({color:14467195,size:8,map:c||(c=(new n.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 r.points=new n.Points(f,d),r.points.renderOrder=11,r.points.frustumCulled=!1,r.setPoints(t,i),r.add(r.line,r.points),r}return t.__extends(i,e),i.prototype.setPoints=function(t,e){var i=[].concat(t.toArray(),e.toArray());this.points.geometry.setAttribute("position",new n.BufferAttribute(new Float32Array(i),3)),this.line.geometry.setPositions(i),this.line.computeLineDistances(),this.needsRender=!0},i.prototype.getPoints=function(){var t=this.points.geometry.attributes.position.array;return[new n.Vector3(t[0],t[1],t[2]),new n.Vector3(t[3],t[4],t[5])]},i.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},i.prototype.setResolution=function(t,e){var n=this.line.material.resolution;n.x===t&&n.y===e||(n.set(t,e),this.needsRender=!0)},i}(n.Object3D);Object.assign(l.prototype,{isFiveLine:!0}),exports.Line=l,exports.LineGeometry=u,exports.LineMaterial=o,exports.LineSegmentsGeometry=i,exports.THREE_Line2=s,exports.THREE_LineSegments2=a;
|
|
260
|
+
"use strict";function t(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("three")),n=function(t,e){return n=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])},n(t,e)};function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var r=function(t){function n(){var n=t.call(this)||this;n.type="LineSegmentsGeometry";return n.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),n.setAttribute("position",new e.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)),n.setAttribute("uv",new e.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),n}return i(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 n;n=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var i=new e.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceStart",new e.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new e.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},n.prototype.setColors=function(t){var n;n=t instanceof Float32Array?t:Array.isArray(t)?new Float32Array(t):new Float32Array;var i=new e.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceColorStart",new e.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new e.InterleavedBufferAttribute(i,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 e.WireframeGeometry(t.geometry)),this},n.prototype.fromLineSegments=function(t){var n=t.geometry;if(n instanceof e.Geometry){var i=(new e.BufferGeometry).fromGeometry(n);this.setPositions(i.attributes.position.array)}else n instanceof e.BufferGeometry&&this.setPositions(n.attributes.position.array);return this},n.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new e.Box3);var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(void 0!==t&&void 0!==n){var i=new e.Box3;this.boundingBox.setFromBufferAttribute(t),i.setFromBufferAttribute(n),this.boundingBox.union(i)}},n.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new e.Sphere),null===this.boundingBox&&this.computeBoundingBox();var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(void 0!==t&&void 0!==n){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var r=0,o=new e.Vector3,a=0,s=t.count;a<s;a++)o.fromBufferAttribute(t,a),r=Math.max(r,i.distanceToSquared(o)),o.fromBufferAttribute(n,a),r=Math.max(r,i.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}},n.prototype.toJSON=function(){},n}(e.InstancedBufferGeometry);Object.assign(r.prototype,{isLineSegmentsGeometry:!0});var o={uniforms:e.UniformsUtils.merge([e.UniformsLib.common,e.UniformsLib.fog,{linewidth:{value:1},resolution:{value:new e.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"},a=function(t){function n(n){var i=t.call(this,{uniforms:e.UniformsUtils.clone(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,clipping:!0})||this;return i.type="LineMaterial",i.dashed=!1,Object.defineProperties(i,{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)}}}),i.setValues(n),i}return i(n,t),n}(e.ShaderMaterial);Object.assign(a.prototype,{isLineMaterial:!0});var s=function(t){function n(e,n){var i=t.call(this)||this;return i.type="LineSegments2",i.geometry=void 0!==e?e:new r,i.material=void 0!==n?n:new a({color:16777215*Math.random()}),i}return i(n,t),n.prototype.computeLineDistances=function(){for(var t=this.geometry,n=t.attributes.instanceStart,i=t.attributes.instanceEnd,r=new Float32Array(2*n.count),o=new e.Vector3,a=new e.Vector3,s=0,u=0,c=n.count;s<c;s++,u+=2)o.fromBufferAttribute(n,s),a.fromBufferAttribute(i,s),r[u]=0===u?0:r[u-1],r[u+1]=r[u]+o.distanceTo(a);var l=new e.InstancedInterleavedBuffer(r,2,1);return t.setAttribute("instanceDistanceStart",new e.InterleavedBufferAttribute(l,1,0)),t.setAttribute("instanceDistanceEnd",new e.InterleavedBufferAttribute(l,1,1)),this},n.prototype.raycast=function(t,n){null===t.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var i=t.ray,r=t.camera,o=r.projectionMatrix,a=this.geometry,s=this.material,u=s.resolution,c=s.linewidth,l=a.attributes.instanceStart,f=a.attributes.instanceEnd,p=new e.Vector4,d=new e.Vector4,m=new e.Vector4,h=new e.Vector3,v=new e.Matrix4,y=new e.Line3,A=new e.Vector3;i.at(1,m),m.w=1,m.applyMatrix4(r.matrixWorldInverse),m.applyMatrix4(o),m.multiplyScalar(1/m.w),m.x*=u.x/2,m.y*=u.y/2,m.z=0,h.copy(m);var g=this.matrixWorld;v.multiplyMatrices(r.matrixWorldInverse,g);for(var b=0,w=l.count;b<w;b++){p.fromBufferAttribute(l,b),d.fromBufferAttribute(f,b),p.w=1,d.w=1,p.applyMatrix4(v),d.applyMatrix4(v),p.applyMatrix4(o),d.applyMatrix4(o),p.multiplyScalar(1/p.w),d.multiplyScalar(1/d.w);var S=p.z<-1&&d.z<-1,x=p.z>1&&d.z>1;if(!S&&!x){p.x*=u.x/2,p.y*=u.y/2,d.x*=u.x/2,d.y*=u.y/2,y.start.copy(p),y.start.z=0,y.end.copy(d),y.end.z=0;var B=y.closestPointToPointParameter(h,!0);y.at(B,A);var E=e.MathUtils.lerp(p.z,d.z,B),z=E>=-1&&E<=1,M=h.distanceTo(A)<.5*c;if(z&&M){y.start.fromBufferAttribute(l,b),y.end.fromBufferAttribute(f,b),y.start.applyMatrix4(g),y.end.applyMatrix4(g);var P=new e.Vector3,C=new e.Vector3;i.distanceSqToSegment(y.start,y.end,C,P),n.push({point:C,pointOnLine:P,distance:i.origin.distanceTo(C),object:this,faceIndex:b})}}}},n}(e.Mesh);Object.assign(s.prototype,{isLineSegments2:!0});var u=function(t){function e(e,n){var i=t.call(this,e,n)||this;return i.type="Line2",i}return i(e,t),e}(s);Object.assign(u.prototype,{isLine2:!0});var c=function(t){function n(){var e=t.call(this)||this;return e.type="LineGeometry",e}return i(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 n=t.geometry;if(n instanceof e.Geometry){var i=(new e.BufferGeometry).fromGeometry(n);this.setPositions(i.attributes.position.array)}else n instanceof e.BufferGeometry&&this.setPositions(n.attributes.position.array);return this},n.prototype.copy=function(){return this},n}(r);Object.assign(c.prototype,{isLineGeometry:!0});var l=14467195,f=null,p=function(t){function n(n,i){void 0===n&&(n=new e.Vector3),void 0===i&&(i=new e.Vector3);var r=t.call(this)||this;r.type="FiveLine",r.needsRender=!0;var o=new c,s=new a({color:l,linewidth:2,dashScale:20,dashed:!1});r.line=new u(o,s);var p=new e.BufferGeometry,d=new e.PointsMaterial({color:l,size:8,map:f||(f=(new e.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 r.points=new e.Points(p,d),r.points.renderOrder=11,r.points.frustumCulled=!1,r.setPoints(n,i),r.add(r.line,r.points),r}return i(n,t),Object.defineProperty(n,"version",{get:function(){return"6.0.0-alpha.0"},enumerable:!1,configurable:!0}),n.prototype.setPoints=function(t,n){var i=[].concat(t.toArray(),n.toArray());this.points.geometry.setAttribute("position",new e.BufferAttribute(new Float32Array(i),3)),this.line.geometry.setPositions(i),this.line.computeLineDistances(),this.needsRender=!0},n.prototype.getPoints=function(){var t=this.points.geometry.attributes.position.array;return[new e.Vector3(t[0],t[1],t[2]),new e.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}(e.Object3D);Object.assign(p.prototype,{isFiveLine:!0}),exports.Line=p,exports.LineGeometry=c,exports.LineMaterial=a,exports.LineSegmentsGeometry=r,exports.THREE_Line2=u,exports.THREE_LineSegments2=s;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@realsee/five",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-alpha.0",
|
|
4
4
|
"description": "Realsee Renderer SDK",
|
|
5
5
|
"bin": {
|
|
6
6
|
"five-plugin-init": "./scripts/five-plugin-init.js",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"author": "BEIKE REALSEE TECHNOLOGY (HK) LIMITED",
|
|
12
12
|
"license": "SEE LICENSE IN TERMS.txt",
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@types/react": "^16.0.0",
|
|
15
14
|
"react": "^16.0.0",
|
|
16
|
-
"three": "^0.117.1"
|
|
15
|
+
"three": "^0.117.1",
|
|
16
|
+
"vue": "^3.0.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependenciesMeta": {
|
|
19
19
|
"react": {
|
|
@@ -21,15 +21,19 @@
|
|
|
21
21
|
},
|
|
22
22
|
"@types/react": {
|
|
23
23
|
"optional": true
|
|
24
|
+
},
|
|
25
|
+
"vue": {
|
|
26
|
+
"optional": true
|
|
24
27
|
}
|
|
25
28
|
},
|
|
26
29
|
"dependencies": {
|
|
27
30
|
"archiver": "^5.3.0",
|
|
28
|
-
"commander": "^
|
|
31
|
+
"commander": "^9.0.0",
|
|
29
32
|
"copyfiles": "^2.4.1",
|
|
30
|
-
"
|
|
33
|
+
"ejs": "^3.1.6",
|
|
34
|
+
"glob": "^7.2.0",
|
|
31
35
|
"protobufjs": "^6.8.8",
|
|
32
|
-
"
|
|
36
|
+
"url": "^0.11.0"
|
|
33
37
|
},
|
|
34
38
|
"main": "five/index.js",
|
|
35
39
|
"types": "five/index.d.ts"
|
package/react/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ import { State } from '@realsee/five';
|
|
|
10
10
|
import * as THREE_2 from 'three';
|
|
11
11
|
import { Vector2 } from 'three';
|
|
12
12
|
import { Work } from '@realsee/five';
|
|
13
|
+
import { WorkPanoId } from '@realsee/five';
|
|
14
|
+
import { Works } from '@realsee/five';
|
|
13
15
|
|
|
14
16
|
export declare function createFiveFeature<T extends FiveInjectionFeature>(...features: T[]): T[];
|
|
15
17
|
|
|
@@ -32,16 +34,55 @@ export declare function createFiveFeature<T extends FiveInjectionFeature>(...fea
|
|
|
32
34
|
* ```
|
|
33
35
|
*/
|
|
34
36
|
export declare function createFiveProvider(fiveInitArgs?: Omit<FiveInitArgs, "renderer" | "scissor">): {
|
|
35
|
-
new (props: FiveProviderPropTypes): {
|
|
37
|
+
new (props: FiveProviderPropTypes | Readonly<FiveProviderPropTypes>): {
|
|
36
38
|
/**
|
|
37
39
|
* five 实例,可以通过 FiveProvider 的 ref.five 获取得到
|
|
38
40
|
* 在一些外部调用方面可以尝试使用
|
|
39
41
|
*/
|
|
40
42
|
five?: Five;
|
|
41
|
-
|
|
43
|
+
unmout: boolean;
|
|
44
|
+
loadWork(works: Work | Work[], state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean): Promise<void>;
|
|
42
45
|
shouldComponentUpdate(nextProps: FiveProviderPropTypes): boolean;
|
|
43
46
|
componentWillUnmount(): void;
|
|
44
|
-
render():
|
|
47
|
+
render(): React_2.FunctionComponentElement<React_2.ProviderProps<{
|
|
48
|
+
five: Five;
|
|
49
|
+
loadWork: (works: Work | Work[], state?: "initial" | "inherit" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean) => Promise<void>;
|
|
50
|
+
}>>;
|
|
51
|
+
context: any;
|
|
52
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<FiveProviderPropTypes>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void;
|
|
53
|
+
forceUpdate(callback?: () => void): void;
|
|
54
|
+
readonly props: Readonly<FiveProviderPropTypes> & Readonly<{
|
|
55
|
+
children?: React_2.ReactNode;
|
|
56
|
+
}>;
|
|
57
|
+
state: Readonly<{}>;
|
|
58
|
+
refs: {
|
|
59
|
+
[key: string]: React_2.ReactInstance;
|
|
60
|
+
};
|
|
61
|
+
componentDidMount?(): void;
|
|
62
|
+
componentDidCatch?(error: Error, errorInfo: React_2.ErrorInfo): void;
|
|
63
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<FiveProviderPropTypes>, prevState: Readonly<{}>): any;
|
|
64
|
+
componentDidUpdate?(prevProps: Readonly<FiveProviderPropTypes>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
65
|
+
componentWillMount?(): void;
|
|
66
|
+
UNSAFE_componentWillMount?(): void;
|
|
67
|
+
componentWillReceiveProps?(nextProps: Readonly<FiveProviderPropTypes>, nextContext: any): void;
|
|
68
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<FiveProviderPropTypes>, nextContext: any): void;
|
|
69
|
+
componentWillUpdate?(nextProps: Readonly<FiveProviderPropTypes>, nextState: Readonly<{}>, nextContext: any): void;
|
|
70
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<FiveProviderPropTypes>, nextState: Readonly<{}>, nextContext: any): void;
|
|
71
|
+
};
|
|
72
|
+
new (props: FiveProviderPropTypes, context: any): {
|
|
73
|
+
/**
|
|
74
|
+
* five 实例,可以通过 FiveProvider 的 ref.five 获取得到
|
|
75
|
+
* 在一些外部调用方面可以尝试使用
|
|
76
|
+
*/
|
|
77
|
+
five?: Five;
|
|
78
|
+
unmout: boolean;
|
|
79
|
+
loadWork(works: Work | Work[], state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean): Promise<void>;
|
|
80
|
+
shouldComponentUpdate(nextProps: FiveProviderPropTypes): boolean;
|
|
81
|
+
componentWillUnmount(): void;
|
|
82
|
+
render(): React_2.FunctionComponentElement<React_2.ProviderProps<{
|
|
83
|
+
five: Five;
|
|
84
|
+
loadWork: (works: Work | Work[], state?: "initial" | "inherit" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean) => Promise<void>;
|
|
85
|
+
}>>;
|
|
45
86
|
context: any;
|
|
46
87
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<FiveProviderPropTypes>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void;
|
|
47
88
|
forceUpdate(callback?: () => void): void;
|
|
@@ -103,7 +144,7 @@ export declare function createStore<T extends StoreValueMapType, A extends Store
|
|
|
103
144
|
onValuesChange?: (value: T, prevValue: T) => void;
|
|
104
145
|
children: React_2.ReactNode;
|
|
105
146
|
}): boolean;
|
|
106
|
-
render():
|
|
147
|
+
render(): React_2.FunctionComponentElement<React_2.ProviderProps<Store<T>>>;
|
|
107
148
|
context: any;
|
|
108
149
|
setState<K_3 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{
|
|
109
150
|
initialValue: T;
|
|
@@ -176,26 +217,6 @@ export declare interface FiveActionReactCallbacks {
|
|
|
176
217
|
* @returns Promise 是否移动成功
|
|
177
218
|
*/
|
|
178
219
|
updateCamera(pose: Pose, duration: number): Promise<void>;
|
|
179
|
-
/**
|
|
180
|
-
* 初始化 initBasisLoader
|
|
181
|
-
* @description
|
|
182
|
-
* 同初始化的 initBasisLoader 参数。用于初始化 basisLoader。
|
|
183
|
-
* basisLoader 只会初始化一次,一旦初始化则不会再修改。
|
|
184
|
-
*
|
|
185
|
-
* @param transcoderResourcePath - basis 解析器路径
|
|
186
|
-
* 如果不设置,使用默认解析器 basis 解析器。
|
|
187
|
-
* 可以传入解析器的 `resourcePath`, 则使用指定的解析器
|
|
188
|
-
* @example
|
|
189
|
-
* ```
|
|
190
|
-
* // 使用默认解析器
|
|
191
|
-
* initialBasisLoader();
|
|
192
|
-
*
|
|
193
|
-
* // 使用指定解析器
|
|
194
|
-
* // 会调用这个目录下的 basis_transcoder.js basis_transcoder.wasm 文件作为解析器
|
|
195
|
-
* initialBasisLoader("https://vrlab-public.ljcdn.com/release/static/image/release/five/basis/");
|
|
196
|
-
* ```
|
|
197
|
-
*/
|
|
198
|
-
initBasisLoader(transcoderResourcePath?: string): void;
|
|
199
220
|
/**
|
|
200
221
|
* 获取画面中的像素颜色
|
|
201
222
|
* @param x - 获取像素区域的起始坐标 x
|
|
@@ -230,11 +251,11 @@ export declare interface FiveActionReactCallbacks {
|
|
|
230
251
|
needsRender(): void;
|
|
231
252
|
/**
|
|
232
253
|
* 预加载点位图片资源
|
|
233
|
-
* @param
|
|
254
|
+
* @param panoId - 观察点
|
|
234
255
|
* @param callback - 加载完成回调, 并传递加载用时。
|
|
235
256
|
* @returns 加载完成的 Promise 参数同 callback
|
|
236
257
|
*/
|
|
237
|
-
preloadPano(
|
|
258
|
+
preloadPano(panoId: WorkPanoId, callback?: (costs: number) => void): Promise<number>;
|
|
238
259
|
}
|
|
239
260
|
|
|
240
261
|
/**
|
|
@@ -257,7 +278,7 @@ export declare const FiveCanvas: React_2.FC<{
|
|
|
257
278
|
|
|
258
279
|
export declare type FiveInjectionActionFeature = "loadWork" | "setState" | "on" | "off" | "intersectRaycaster" | "project2d" | "updateCamera" | "initBasisLoader" | "getPixels" | "render" | "needsRender" | "preloadPano" | "showFloor" | "toggleHelperVisible";
|
|
259
280
|
|
|
260
|
-
export declare type FiveInjectionDataFeature = "unsafe__fiveInstance" | "currentState" | "currentObserver" | "state" | "
|
|
281
|
+
export declare type FiveInjectionDataFeature = "unsafe__fiveInstance" | "currentState" | "currentObserver" | "state" | "works" | "model" | "scene" | "cameraDirection" | "cameraRaycaster" | "modelReadyState" | "shownFloor" | "totalFloorLength" | "helperVisible";
|
|
261
282
|
|
|
262
283
|
export declare type FiveInjectionFeature = FiveInjectionDataFeature | FiveInjectionActionFeature;
|
|
263
284
|
|
|
@@ -275,6 +296,7 @@ export declare interface FiveInjectionTypes extends Record<FiveInjectionFeature,
|
|
|
275
296
|
* five 设置了以下状态
|
|
276
297
|
*
|
|
277
298
|
* - mode: Mode
|
|
299
|
+
* - panoId: string
|
|
278
300
|
* - panoIndex: number
|
|
279
301
|
* - longitude: number
|
|
280
302
|
* - latitude: number
|
|
@@ -294,6 +316,7 @@ export declare interface FiveInjectionTypes extends Record<FiveInjectionFeature,
|
|
|
294
316
|
* five 设置了以下状态
|
|
295
317
|
*
|
|
296
318
|
* - mode: Mode
|
|
319
|
+
* - panoId: string
|
|
297
320
|
* - panoIndex: number
|
|
298
321
|
* - longitude: number
|
|
299
322
|
* - latitude: number
|
|
@@ -309,7 +332,7 @@ export declare interface FiveInjectionTypes extends Record<FiveInjectionFeature,
|
|
|
309
332
|
/**
|
|
310
333
|
* Five React Inject: Five Work
|
|
311
334
|
*/
|
|
312
|
-
|
|
335
|
+
works: Works;
|
|
313
336
|
/**
|
|
314
337
|
* 设置 State
|
|
315
338
|
* @description
|
|
@@ -317,6 +340,7 @@ export declare interface FiveInjectionTypes extends Record<FiveInjectionFeature,
|
|
|
317
340
|
* five 设置了以下状态
|
|
318
341
|
*
|
|
319
342
|
* - mode: Mode
|
|
343
|
+
* - panoId: string
|
|
320
344
|
* - panoIndex: number
|
|
321
345
|
* - longitude: number
|
|
322
346
|
* - latitude: number
|
|
@@ -400,26 +424,6 @@ export declare interface FiveInjectionTypes extends Record<FiveInjectionFeature,
|
|
|
400
424
|
* @returns Promise 是否移动成功
|
|
401
425
|
*/
|
|
402
426
|
updateCamera: Five["updateCamera"];
|
|
403
|
-
/**
|
|
404
|
-
* 初始化 initBasisLoader
|
|
405
|
-
* @description
|
|
406
|
-
* 同初始化的 initBasisLoader 参数。用于初始化 basisLoader。
|
|
407
|
-
* basisLoader 只会初始化一次,一旦初始化则不会再修改。
|
|
408
|
-
*
|
|
409
|
-
* @param transcoderResourcePath - basis 解析器路径
|
|
410
|
-
* 如果不设置,使用默认解析器 basis 解析器。
|
|
411
|
-
* 可以传入解析器的 `resourcePath`, 则使用指定的解析器
|
|
412
|
-
* @example
|
|
413
|
-
* ```
|
|
414
|
-
* // 使用默认解析器
|
|
415
|
-
* five.initialBasisLoader();
|
|
416
|
-
*
|
|
417
|
-
* // 使用指定解析器
|
|
418
|
-
* // 会调用这个目录下的 basis_transcoder.js basis_transcoder.wasm 文件作为解析器
|
|
419
|
-
* five.initialBasisLoader("https://vrlab-public.ljcdn.com/release/static/image/release/five/basis/");
|
|
420
|
-
* ```
|
|
421
|
-
*/
|
|
422
|
-
initBasisLoader: Five["initBasisLoader"];
|
|
423
427
|
/**
|
|
424
428
|
* 获取画面中的像素颜色
|
|
425
429
|
* @param x - 获取像素区域的起始坐标 x
|
|
@@ -455,7 +459,7 @@ export declare interface FiveInjectionTypes extends Record<FiveInjectionFeature,
|
|
|
455
459
|
needsRender: () => void;
|
|
456
460
|
/**
|
|
457
461
|
* 预加载点位图片资源
|
|
458
|
-
* @param
|
|
462
|
+
* @param panoId - 观察点
|
|
459
463
|
* @param callback - 加载完成回调, 并传递加载用时。
|
|
460
464
|
* @returns 加载完成的 Promise 参数同 callback
|
|
461
465
|
*/
|
|
@@ -473,11 +477,11 @@ export declare interface FiveInjectionTypes extends Record<FiveInjectionFeature,
|
|
|
473
477
|
}
|
|
474
478
|
|
|
475
479
|
export declare type FiveProviderPropTypes = {
|
|
476
|
-
work?: Work;
|
|
477
|
-
initialWork?: Work |
|
|
480
|
+
work?: Work | Work[];
|
|
481
|
+
initialWork?: Work | Work[];
|
|
478
482
|
initialState?: "inherit" | "initial" | Partial<Omit<State, "offset">>;
|
|
479
483
|
initialUserAction?: boolean;
|
|
480
|
-
|
|
484
|
+
onWorksChange?: (works: Works) => void;
|
|
481
485
|
onStateChange?: (state: State, userAction: boolean) => void;
|
|
482
486
|
onCurrentStateChange?: (state: State, userAction: boolean) => void;
|
|
483
487
|
onError?: (error: Error) => void;
|
|
@@ -567,18 +571,6 @@ export declare function unsafe__useFiveInstance(): Five;
|
|
|
567
571
|
* updateCamera(pose: Pose, duration: number): Promise<void>
|
|
568
572
|
* ```
|
|
569
573
|
*
|
|
570
|
-
* @function initBasisLoader
|
|
571
|
-
* ```
|
|
572
|
-
* 初始化 initBasisLoader
|
|
573
|
-
* 同初始化的 initBasisLoader 参数。用于初始化 basisLoader。
|
|
574
|
-
* basisLoader 只会初始化一次,一旦初始化则不会再修改。
|
|
575
|
-
*
|
|
576
|
-
* // param transcoderResourcePath
|
|
577
|
-
* // 如果不设置,使用默认解析器 basis 解析器。
|
|
578
|
-
* // 可以传入解析器的 `resourcePath`, 则使用指定的解析器
|
|
579
|
-
* initBasisLoader(transcoderResourcePath?: string): void,
|
|
580
|
-
* ```
|
|
581
|
-
*
|
|
582
574
|
* @function getPixels
|
|
583
575
|
* ```
|
|
584
576
|
* 获取画面中的像素颜色
|
|
@@ -645,13 +637,13 @@ export declare function useFiveCameraRaycaster(): THREE_2.Raycaster;
|
|
|
645
637
|
|
|
646
638
|
/**
|
|
647
639
|
* Five React Hooks: Five 的当前观测点
|
|
648
|
-
* @returns Work.observers[number] 当前观测点, 如果 work 未加载则为
|
|
640
|
+
* @returns Work.observers[number] 当前观测点, 如果 work 未加载则为 undefined
|
|
649
641
|
* @example
|
|
650
642
|
* ```
|
|
651
643
|
* const observer = useFiveCurrentObserver();
|
|
652
644
|
* ```
|
|
653
645
|
*/
|
|
654
|
-
export declare function useFiveCurrentObserver(): Work["observers"][number] |
|
|
646
|
+
export declare function useFiveCurrentObserver(): Work["observers"][number] | undefined;
|
|
655
647
|
|
|
656
648
|
/**
|
|
657
649
|
* Five React Hooks: Five 的实时状态
|
|
@@ -683,7 +675,7 @@ export declare function useFiveEventCallback<T extends keyof EventCallback>(name
|
|
|
683
675
|
* [ shownFloor: Five 当前显示的楼层, null 为都显示, showFloor: 设置显示楼层,不传参数为都显示 ]
|
|
684
676
|
* @example
|
|
685
677
|
* ```
|
|
686
|
-
* const [ shownFloor, showFloor ] =
|
|
678
|
+
* const [ shownFloor, showFloor ] = useFiveFloor;
|
|
687
679
|
* ```
|
|
688
680
|
*/
|
|
689
681
|
export declare function useFiveFloor(): [
|
|
@@ -803,8 +795,8 @@ setState: (state: Partial<State> | ((prevState: State) => Partial<State>), immed
|
|
|
803
795
|
* ```
|
|
804
796
|
*/
|
|
805
797
|
export declare function useFiveWork(): [
|
|
806
|
-
|
|
807
|
-
loadWork: (work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean) => Promise<void>
|
|
798
|
+
works: Works,
|
|
799
|
+
loadWork: (work: Work | Work[], state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean) => Promise<void>
|
|
808
800
|
];
|
|
809
801
|
|
|
810
802
|
export declare function withFive<F extends FiveInjectionFeature[]>(features: F): <P extends PropTypeOfFiveFeatures<F>, C extends React_2.ComponentClass<P, any>>(Component: C & React_2.ComponentClass<P, any>) => React_2.ForwardRefExoticComponent<React_2.PropsWithoutRef<Omit<P, "$five">> & React_2.RefAttributes<Omit<InstanceType<C>, "state" | "setState" | "render" | "componentDidMount" | "shouldComponentUpdate" | "componentWillUnmount" | "componentDidCatch" | "getSnapshotBeforeUpdate" | "componentDidUpdate" | "componentWillMount" | "UNSAFE_componentWillMount" | "componentWillReceiveProps" | "UNSAFE_componentWillReceiveProps" | "componentWillUpdate" | "UNSAFE_componentWillUpdate" | "context" | "forceUpdate" | "props" | "refs">>>;
|
package/react/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @realsee/five
|
|
3
3
|
*
|
|
4
|
-
* Generated:
|
|
5
|
-
* Version:
|
|
4
|
+
* Generated: 2023-09-07
|
|
5
|
+
* Version: 6.0.0-alpha.0
|
|
6
6
|
*
|
|
7
7
|
* Terms:
|
|
8
8
|
* Realsee SDK License Agreement
|
|
@@ -257,4 +257,4 @@
|
|
|
257
257
|
* Agreement and all related documents shall be drafted in English.
|
|
258
258
|
*/
|
|
259
259
|
|
|
260
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react"),n=require("three"),r=require("@realsee/five");function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var u=o(t),i=o(n),a=[];var f=u.createContext(null);function s(){var e=u.useContext(f);if(!e)throw new Error("FiveProvider never found.");return e.five}function c(){var e=u.useContext(f);if(!e)throw new Error("FiveProvider never found.");return e.loadWork}var l={display:"inline-block",overflow:"hidden"};function d(e,t){var n=s(),r=[n];void 0!==t&&(r=r.concat(t)),u.useLayoutEffect((function(){return e(n.scene)}),r)}var v=d;function p(t){return e.__assign({},t.state)}function h(e){var t=e.camera.getWorldDirection(new i.Vector3);return new i.Raycaster(e.camera.position,t)}function m(e){return e.camera.getWorldDirection(new i.Vector3)}function y(e){return e.model.empty?"Empty":"Loaded"}function S(e,t){return t.indexOf(e)>=0}function g(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 C(e,t){if(S("loadWork",t))return e}function b(e,t){if(S("setState",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.setState.apply(e,t)}}function w(e,t){if(S("on",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.on.apply(e,t)}}function E(e,t){if(S("on",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.once.apply(e,t)}}function k(e,t){if(S("off",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.off.apply(e,t)}}function x(e,t){if(S("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 L(e,t){if(S("project2d",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.project2d.apply(e,t)}}function F(e,t){if(S("updateCamera",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.updateCamera.apply(e,t)}}function _(e,t){if(S("initBasisLoader",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.initBasisLoader.apply(e,t)}}function P(e,t){if(S("getPixels",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.getPixels.apply(e,t)}}function R(e,t){if(S("render",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.render.apply(e,t)}}function V(e,t){if(S("needsRender",t))return function(){e.needsRender=!0}}function M(e,t){if(S("preloadPano",t))return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.preloadPano.apply(e,t)}}function W(e,t){if(S("showFloor",t))return function(t){"number"==typeof t?e.model.show(t):e.model.show()}}function O(e,t){if(S("toggleHelperVisible",t))return function(t){e.helperVisible=t}}function j(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 N(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 A=function(){function t(e,t){this.values=e,this.listeners=[],this.onValuesChange=t}return t.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)}},t.prototype.getValues=function(e){return j(this.values,e)},t.prototype.setValues=function(t,n){var r,o,u=[];for(var i in n)t.indexOf(i)>=0&&(r=n[i],o=this.values[i],!("number"==typeof r&&"number"==typeof o&&isNaN(r)&&isNaN(o)||r===o))&&u.push(i);if(0!==u.length){for(var a=e.__assign({},this.values),f=0,s=u;f<s.length;f++){var c=s[f];this.values[c]=n[c]}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(N(p,u)){var m=j(a,p);h(j(this.values,p),m)}}}},t}();exports.FiveCanvas=function(t){var n=t.width,r=t.height,o=s(),i=u.createRef(),a=e.__assign({width:n,height:r},l);return u.useLayoutEffect((function(){if(i.current&&o.renderer){if(null!==o.renderer.domElement.parentNode&&o.renderer.domElement.parentNode!==i.current)throw new Error("There are more than 2 fiveCanvas in this context.");o.renderer.domElement.parentNode!==i.current&&i.current.appendChild(o.renderer.domElement),o.camera.aspect=n/r,o.camera.updateProjectionMatrix(),o.renderer.setSize(n,r),o.needsRender=!0}}),[n,r,i.current]),u.createElement("div",{ref:i,style:a})},exports.INJECTION_PROPNAME="$five",exports.Store=A,exports.createFiveFeature=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e},exports.createFiveProvider=function(t){return void 0===t&&(t={}),function(n){function o(o){var u,f=n.call(this,o)||this,s=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,f=t.pixelRatio,s=void 0===f?1:f;if("undefined"!=typeof window){var c=a.shift();return c||((c=new i.WebGLRenderer({antialias:!1,alpha:!0})).outputEncoding=i.sRGBEncoding),c.setPixelRatio(s),c.setClearColor(r,u),c.autoClear=!0,c}}({pixelRatio:1===r.getViewportScale()?window.devicePixelRatio:1});return f.five=new r.Five(e.__assign({renderer:s},t)),(o.work||o.initialWork)&&f.five.load(o.work||o.initialWork,o.initialState,void 0,null===(u=o.initialUserAction)||void 0===u||u),f.five.on("load",(function(){var e;f.props.onWorkChange&&f.props.onWorkChange(null===(e=f.five)||void 0===e?void 0:e.work)})),f.five.on("stateChange",(function(e,t){f.props.onStateChange&&f.props.onStateChange(e,t)})),f.five.on("currentStateChange",(function(e,t){f.props.onCurrentStateChange&&f.props.onCurrentStateChange(e,t)})),f.five.on("error",(function(e){f.props.onError?f.props.onError(e):console.warn(e.message)})),f}return e.__extends(o,n),o.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)},o.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},o.prototype.componentWillUnmount=function(){var e;this.five&&(this.five.dispose(),(e=this.five.renderer)&&-1===a.indexOf(e)&&a.push(e),delete this.five)},o.prototype.render=function(){var e=this;return u.createElement(f.Provider,{value:{five:this.five,loadWork:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.loadWork.apply(e,t)}}},this.props.children)},o}(u.Component)},exports.createStore=function(t){var n=u.createContext(null);return{useStore:function(t){var r=u.useContext(n);if(null===r)throw new Error("StoreProvider never found.");var o=u.useRef(!0),i=u.useState(r.getValues(t)),a=i[0],f=i[1],s=e.__spreadArray([r],t,!0);return u.useLayoutEffect((function(){return o.current?o.current=!1:f(r.getValues(t)),r.on(t,(function(e){return f(e)}))}),s),[a,u.useCallback((function(e){return r.setValues(t,e)}),s)]},useStoreSetter:function(t){var r=u.useContext(n);if(null===r)throw new Error("StoreProvider never found.");return u.useCallback((function(e){return r.setValues(t,e)}),e.__spreadArray([r],t,!0))},watchStore:function(t,r,o){var i=u.useContext(n);if(null===i)throw new Error("StoreProvider never found.");var a=e.__spreadArray([i],t,!0);void 0!==o&&(a=a.concat(o)),u.useLayoutEffect((function(){return i.on(t,r)}),a)},useStoreAction:function(r){var o=u.useContext(n);if(null===o)throw new Error("StoreProvider never found.");return u.useCallback((function(){for(var n=[],u=0;u<arguments.length;u++)n[u]=arguments[u];var i=t[r],a=i[0],f=i.slice(1),s=function(){return o.getValues(f)},c=function(e){return o.setValues(f,e)};return a.apply(void 0,e.__spreadArray([s,c],n,!1))}),[])},StoreProvider:function(t){function r(e){var n=t.call(this,e)||this;return n.store=new A(e.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 e.__extends(r,t),r.prototype.shouldComponentUpdate=function(e){return e.children!==this.props.children},r.prototype.render=function(){return u.createElement(n.Provider,{value:this.store},this.props.children)},r}(u.Component)}},exports.unsafe__useFiveInstance=function(){return s()},exports.useFiveAction=function(){var e=s();return{updateCamera:u.useCallback((function(t,n){return e.updateCamera(t,n)}),[e]),initBasisLoader:u.useCallback((function(t){return e.initBasisLoader(t)}),[e]),getPixels:u.useCallback((function(t,n,r,o,u){return e.getPixels(t,n,r,o,u)}),[e]),render:u.useCallback((function(t){return e.render(t)}),[e]),needsRender:u.useCallback((function(){return e.needsRender=!0}),[e]),preloadPano:u.useCallback((function(t,n){return e.preloadPano(t,n)}),[e])}},exports.useFiveCameraDirection=function(){var e=s(),t=u.useState((function(){return m(e)})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return r(m(e))}))}),[e]),n},exports.useFiveCameraRaycaster=function(){var e=s(),t=u.useState((function(){return h(e)})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return r(h(e))}))}),[e]),n},exports.useFiveCurrentObserver=function(){var e=s(),t=u.useState((function(){return e.getCurrentState()})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return r(e.getCurrentState())}))}),[e]),e.work?e.work.observers[n.panoIndex]:null},exports.useFiveCurrentState=function(){var e=s(),t=u.useState((function(){return e.getCurrentState()})),n=t[0],r=t[1],o=u.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 u.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return r(e.getCurrentState())}))}),[e]),[n,o]},exports.useFiveEventCallback=function(e,t,n){var r=s(),o=[r,e];void 0!==n&&(o=o.concat(n)),u.useLayoutEffect((function(){return r.on(e,t)}),o)},exports.useFiveFloor=function(){var e=s(),t=u.useState(e.model.shownFloor),n=t[0],r=t[1],o=u.useState(e.model.floorLength),i=o[0],a=o[1],f=u.useCallback((function(t){"number"==typeof t?e.model.show(t):e.model.show()}),[e]);return u.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,i,f]},exports.useFiveHelper=function(){var e=s(),t=u.useState(e.helperVisible),n=t[0],r=t[1],o=u.useCallback((function(t){e.helperVisible=t}),[e]);return u.useLayoutEffect((function(){return e.on("helpersVisibleChange",(function(e){return r(e)}))}),[e]),[n,o]},exports.useFiveModelIntersectRaycaster=function(){var e=s();return u.useCallback((function(t){return e.model.intersectRaycaster(t)}),[e])},exports.useFiveModelReadyState=function(){var e=s(),t=u.useState((function(){return y(e)})),n=t[0],r=t[1];return u.useLayoutEffect((function(){return e.on("modelLoaded",(function(){return r(y(e))}))}),[e]),n},exports.useFiveProject2d=function(){var e=s(),t=u.useState((function(){return Symbol()}));t[0];var n=t[1];return u.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return n(Symbol())}))}),[e]),u.useCallback((function(t,n){return e.project2d(t,n)}),[e])},exports.useFiveScene=v,exports.useFiveSceneEffect=d,exports.useFiveState=function(){var e=s(),t=u.useState((function(){return p(e)})),n=t[0],r=t[1],o=u.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 u.useLayoutEffect((function(){return e.on("stateChange",(function(){return r(p(e))}))}),[e]),[n,o]},exports.useFiveWork=function(){var e=s(),t=c(),n=u.useState((function(){return e.work})),r=n[0],o=n[1];return u.useLayoutEffect((function(){return e.on("load",(function(){return o(e.work)}))}),[e]),[r,t]},exports.withFive=function(t){return function(n){return u.forwardRef((function(r,o){var a=s(),f=c(),l=function(e,t){return[S("unsafe__fiveInstance",t)?e:void 0]}(a,t)[0],d=function(t,n){var r=S("state",n),o=u.useState(Symbol()),i=o[0],a=o[1],f=u.useMemo((function(){if(r)return e.__assign({},t.state)}),[t,i]);return u.useLayoutEffect((function(){if(r)return t.on("stateChange",(function(){return a(Symbol())}))}),[t]),[f,i]}(a,t),v=d[0],p=d[1],h=function(e,t){var n=S("currentState",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.getCurrentState()}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("currentStateChange",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),m=h[0],y=h[1],j=function(e,t){var n=S("currentObserver",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.getCurrentState()}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("currentStateChange",(function(){return i(Symbol())}))}),[e]),[a?e.work?e.work.observers[a.panoIndex]:null:void 0,o]}(a,t),N=j[0],A=j[1],U=function(e,t){var n=S("work",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.work}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("load",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),D=U[0],I=U[1],B=function(e,t){var n=S("model",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),q=B[0],H=B[1],z=function(e,t){return[S("scene",t)?e.scene:void 0]}(a,t)[0],G=function(e,t){var n=S("cameraDirection",t),r=u.useState(Symbol()),o=r[0],a=r[1],f=u.useMemo((function(){if(n)return e.camera.getWorldDirection(new i.Vector3)}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,o]}(a,t),T=G[0],$=G[1],J=function(e,t){var n=S("cameraRaycaster",t),r=u.useState(Symbol()),o=r[0],a=r[1],f=u.useMemo((function(){if(n){var t=e.camera.getWorldDirection(new i.Vector3);return new i.Raycaster(e.camera.position,t)}}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,o]}(a,t),K=J[0],Q=J[1],X=function(e,t){var n=S("modelReadyState",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model.empty?"Empty":"Loaded"}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),Y=X[0],Z=X[1],ee=function(e,t){var n=S("shownFloor",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model.shownFloor}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelShownFloorChange",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),te=ee[0],ne=ee[1],re=function(e,t){var n=S("totalFloorLength",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.model.hasFloors()}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),oe=re[0],ue=re[1],ie=function(e,t){var n=S("helperVisible",t),r=u.useState(Symbol()),o=r[0],i=r[1],a=u.useMemo((function(){if(n)return e.helperVisible}),[e,o]);return u.useLayoutEffect((function(){if(n)return e.on("helpersVisibleChange",(function(){return i(Symbol())}))}),[e]),[a,o]}(a,t),ae=ie[0],fe=ie[1],se=u.useMemo((function(){var e={};return g(e,{setState:b(a,t),loadWork:C(f,t),on:w(a,t),once:E(a,t),off:k(a,t),intersectRaycaster:x(a,t),project2d:L(a,t),updateCamera:F(a,t),initBasisLoader:_(a,t),getPixels:P(a,t),render:R(a,t),needsRender:V(a,t),preloadPano:M(a,t),showFloor:W(a,t),toggleHelperVisible:O(a,t)}),e}),[a,f]),ce=u.useMemo((function(){var t=e.__assign({},se);return g(t,{unsafe__fiveInstance:l,state:v,currentState:m,currentObserver:N,work:D,model:q,scene:z,cameraDirection:T,cameraRaycaster:K,modelReadyState:Y,shownFloor:te,totalFloorLength:oe,helperVisible:ae}),t}),[a,se,p,y,A,I,H,$,Q,Z,ne,ue,fe]);return u.createElement(n,e.__assign({ref:o,$five:ce},r))}))}};
|
|
260
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("three"),r=require("@realsee/five");function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=n(e),u=n(t),i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},i(e,t)};function a(e,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=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var f=function(){return f=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},f.apply(this,arguments)};function c(e,t,r){if(r||2===arguments.length)for(var n,o=0,u=t.length;o<u;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}var s=[],l=[];var v=o.createContext(null);function p(){var e=o.useContext(v);if(!e)throw new Error("FiveProvider never found.");return e.five}function d(){var e=o.useContext(v);if(!e)throw new Error("FiveProvider never found.");return e.loadWork}var h={display:"inline-block",overflow:"hidden"};function y(e,t){var r=p(),n=[r];void 0!==t&&(n=n.concat(t)),o.useLayoutEffect((function(){return e(r.scene)}),n)}var m=y;function g(e){return f({},e.state)}function S(e){var t=e.camera.getWorldDirection(new u.Vector3);return new u.Raycaster(e.camera.position,t)}function b(e){return e.camera.getWorldDirection(new u.Vector3)}function w(e){return e.model.empty?"Empty":"Loaded"}function C(e,t){return t.indexOf(e)>=0}function E(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];void 0!==t[o]&&(e[o]=t[o])}}function x(e,t){if(C("loadWork",t))return e}function k(e,t){if(C("setState",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.setState.apply(e,t)}}function L(e,t){if(C("on",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.on.apply(e,t)}}function F(e,t){if(C("on",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.once.apply(e,t)}}function P(e,t){if(C("off",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.off.apply(e,t)}}function R(e,t){if(C("intersectRaycaster",t))return function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return(t=e.model).intersectRaycaster.apply(t,r)}}function V(e,t){if(C("project2d",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.project2d.apply(e,t)}}function O(e,t){if(C("updateCamera",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.updateCamera.apply(e,t)}}function W(e,t){if(C("getPixels",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.getPixels.apply(e,t)}}function _(e,t){if(C("render",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.render.apply(e,t)}}function j(e,t){if(C("needsRender",t))return function(){e.needsRender=!0}}function M(e,t){if(C("preloadPano",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.preloadPano.apply(e,t)}}function A(e,t){if(C("showFloor",t))return function(t){"number"==typeof t?e.model.show(t):e.model.show()}}function N(e,t){if(C("toggleHelperVisible",t))return function(t){e.helperVisible=t}}function U(e,t){for(var r={},n=t.length,o=-1;++o<n;){var u=t[o];u in e&&(r[u]=e[u])}return r}function D(e,t){for(var r=0;r<e.length;r++)for(var n=0;n<t.length;n++)if(e[r]===t[n])return!0;return!1}var I=function(){function e(e,t){this.values=e,this.listeners=[],this.onValuesChange=t}return e.prototype.on=function(e,t){var r=this,n=[e,t];return this.listeners.push(n),function(){var e=r.listeners.indexOf(n);e>=0&&r.listeners.splice(e,1)}},e.prototype.getValues=function(e){return U(this.values,e)},e.prototype.setValues=function(e,t){var r,n,o=[];for(var u in t)e.indexOf(u)>=0&&(r=t[u],n=this.values[u],!("number"==typeof r&&"number"==typeof n&&isNaN(r)&&isNaN(n)||r===n))&&o.push(u);if(0!==o.length){for(var i=f({},this.values),a=0,c=o;a<c.length;a++){var s=c[a];this.values[s]=t[s]}this.onValuesChange&&this.onValuesChange(this.values,i);for(var l=0,v=this.listeners;l<v.length;l++){var p=v[l],d=p[0],h=p[1];if(D(d,o)){var y=U(i,d);h(U(this.values,d),y)}}}},e}();exports.FiveCanvas=function(e){var t=e.width,r=e.height,n=p(),u=o.createRef(),i=f({width:t,height:r},h);return o.useLayoutEffect((function(){if(u.current&&n.renderer){if(null!==n.renderer.domElement.parentNode&&n.renderer.domElement.parentNode!==u.current)throw new Error("There are more than 2 fiveCanvas in this context.");n.renderer.domElement.parentNode!==u.current&&u.current.appendChild(n.renderer.domElement),n.camera.aspect=t/r,n.camera.updateProjectionMatrix(),n.renderer.setSize(t,r),n.needsRender=!0}}),[t,r,u.current]),o.createElement("div",{ref:u,style:i})},exports.INJECTION_PROPNAME="$five",exports.Store=I,exports.createFiveFeature=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e},exports.createFiveProvider=function(e){return void 0===e&&(e={}),function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.unmout=!1,e}return a(n,t),n.prototype.loadWork=function(e,t,r,n){if(void 0===n&&(n=!0),this.props.work)throw new Error("props 'works' is set in fiveProvider, if you need modify work internal, use 'initialWork' instead.");return this.five.load(e,t,r,n)},n.prototype.shouldComponentUpdate=function(e){return this.five&&e.work&&function(e,t){var r=Array.isArray(e)?e:[e],n=Array.isArray(t)?t:[t];if(r.length!==n.length)return!1;for(var o=0;o<r.length;o++)if(r[o]!==n[o])return!1;return!0}(e.work,this.five.works)&&this.five.load(e.work,e.initialState),!0},n.prototype.componentWillUnmount=function(){var e;this.unmout=!0,this.five&&(this.five.dispose(),(e=this.five.renderer)&&(e.capabilities.isWebGL2?-1===l.indexOf(e)&&l.push(e):-1===s.indexOf(e)&&s.push(e)),delete this.five)},n.prototype.render=function(){var t,n=this;if(this.unmout)return null;if(!this.five){var i=function(e){var t=void 0===e?{}:e,r=t.backgroundColor,n=void 0===r?1579548:r,o=t.backgroundAlpha,i=void 0===o?1:o,a=t.pixelRatio,f=void 0===a?1:a,c=t.webgl2,v=void 0!==c&&c;if("undefined"!=typeof window){var p=null;if(!(p=v?s.shift():l.shift())){if(v){var d=document.createElement("canvas"),h=d.getContext("webgl2");if(null===h)throw new Error("error occurred when getting webgl2 canvas context");p=new u.WebGLRenderer({antialias:!1,alpha:!0,canvas:d,context:h})}else p=new u.WebGLRenderer({antialias:!1,alpha:!0});p.outputEncoding=u.sRGBEncoding}return p.setPixelRatio(f),p.setClearColor(n,i),p.autoClear=!0,p}}({pixelRatio:1===r.getViewportScale()?window.devicePixelRatio:1,backgroundAlpha:e.backgroundAlpha,backgroundColor:e.backgroundColor,webgl2:null==e?void 0:e.webgl2});this.five=new r.Five(f({renderer:i},e));var a=this.props.work||this.props.initialWork;a&&this.five.load(a,this.props.initialState,void 0,null===(t=this.props.initialUserAction)||void 0===t||t),this.five.on("load",(function(){n.props.onWorksChange&&n.props.onWorksChange(n.five.works)})),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 o.createElement(v.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)},n}(o.Component)},exports.createStore=function(e){var t=o.createContext(null);return{useStore:function(e){var r=o.useContext(t);if(null===r)throw new Error("StoreProvider never found.");var n=o.useRef(!0),u=o.useState(r.getValues(e)),i=u[0],a=u[1],f=c([r],e,!0);o.useLayoutEffect((function(){return n.current?n.current=!1:a(r.getValues(e)),r.on(e,(function(e){return a(e)}))}),f);var s=o.useCallback((function(t){return r.setValues(e,t)}),f);return[i,s]},useStoreSetter:function(e){var r=o.useContext(t);if(null===r)throw new Error("StoreProvider never found.");return o.useCallback((function(t){return r.setValues(e,t)}),c([r],e,!0))},watchStore:function(e,r,n){var u=o.useContext(t);if(null===u)throw new Error("StoreProvider never found.");var i=c([u],e,!0);void 0!==n&&(i=i.concat(n)),o.useLayoutEffect((function(){return u.on(e,r)}),i)},useStoreAction:function(r){var n=o.useContext(t);if(null===n)throw new Error("StoreProvider never found.");var u=o.useCallback((function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];var u=e[r],i=u[0],a=u.slice(1);return i.apply(void 0,c([function(){return n.getValues(a)},function(e){return n.setValues(a,e)}],t,!1))}),[]);return u},StoreProvider:function(e){function r(t){var r=e.call(this,t)||this;return r.store=new I(t.initialValue,(function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];r.props.onValuesChange&&(e=r.props).onValuesChange.apply(e,t)})),r}return a(r,e),r.prototype.shouldComponentUpdate=function(e){return e.children!==this.props.children},r.prototype.render=function(){return o.createElement(t.Provider,{value:this.store},this.props.children)},r}(o.Component)}},exports.unsafe__useFiveInstance=function(){return p()},exports.useFiveAction=function(){var e=p();return{updateCamera:o.useCallback((function(t,r){return e.updateCamera(t,r)}),[e]),getPixels:o.useCallback((function(t,r,n,o,u){return e.getPixels(t,r,n,o,u)}),[e]),render:o.useCallback((function(t){return e.render(t)}),[e]),needsRender:o.useCallback((function(){return e.needsRender=!0}),[e]),preloadPano:o.useCallback((function(t,r){return e.preloadPano(t,r)}),[e])}},exports.useFiveCameraDirection=function(){var e=p(),t=o.useState((function(){return b(e)})),r=t[0],n=t[1];return o.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return n(b(e))}))}),[e]),r},exports.useFiveCameraRaycaster=function(){var e=p(),t=o.useState((function(){return S(e)})),r=t[0],n=t[1];return o.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return n(S(e))}))}),[e]),r},exports.useFiveCurrentObserver=function(){var e=p(),t=o.useState((function(){return e.getCurrentState()})),r=t[0],n=t[1];return o.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return n(e.getCurrentState())}))}),[e]),e.works.getResolvedObserver(r.panoId)},exports.useFiveCurrentState=function(){var e=p(),t=o.useState((function(){return e.getCurrentState()})),r=t[0],n=t[1],u=o.useCallback((function(t,r,n){void 0===r&&(r=!1),void 0===n&&(n=!0);var o="function"==typeof t?t(e.getCurrentState()):t;e.setState(o,r,n)}),[e]);return o.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return n(e.getCurrentState())}))}),[e]),[r,u]},exports.useFiveEventCallback=function(e,t,r){var n=p(),u=[n,e];void 0!==r&&(u=u.concat(r)),o.useLayoutEffect((function(){return n.on(e,t)}),u)},exports.useFiveFloor=function(){var e=p(),t=o.useState(e.model.shownFloor),r=t[0],n=t[1],u=o.useState(e.model.floorLength),i=u[0],a=u[1],f=o.useCallback((function(t){"number"==typeof t?e.model.show(t):e.model.show()}),[e]);return o.useLayoutEffect((function(){var t=[];return t.push(e.on("modelShownFloorChange",(function(){return n(e.model.shownFloor)}))),t.push(e.on("modelLoaded",(function(){return a(e.model.floorLength)}))),function(){for(var e;e=t.shift();)e()}}),[e]),[r,i,f]},exports.useFiveHelper=function(){var e=p(),t=o.useState(e.helperVisible),r=t[0],n=t[1],u=o.useCallback((function(t){e.helperVisible=t}),[e]);return o.useLayoutEffect((function(){return e.on("helpersVisibleChange",(function(e){return n(e)}))}),[e]),[r,u]},exports.useFiveModelIntersectRaycaster=function(){var e=p();return o.useCallback((function(t){return e.model.intersectRaycaster(t)}),[e])},exports.useFiveModelReadyState=function(){var e=p(),t=o.useState((function(){return w(e)})),r=t[0],n=t[1];return o.useLayoutEffect((function(){return e.on("modelLoaded",(function(){return n(w(e))}))}),[e]),r},exports.useFiveProject2d=function(){var e=p(),t=o.useState((function(){return Symbol()}));t[0];var r=t[1];return o.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return r(Symbol())}))}),[e]),o.useCallback((function(t,r){return e.project2d(t,r)}),[e])},exports.useFiveScene=m,exports.useFiveSceneEffect=y,exports.useFiveState=function(){var e=p(),t=o.useState((function(){return g(e)})),r=t[0],n=t[1],u=o.useCallback((function(t,r,n){void 0===r&&(r=!1),void 0===n&&(n=!0);var o="function"==typeof t?t(e.getCurrentState()):t;e.setState(o,r,n)}),[e]);return o.useLayoutEffect((function(){return e.on("stateChange",(function(){return n(g(e))}))}),[e]),[r,u]},exports.useFiveWork=function(){var e=p(),t=d(),r=o.useState((function(){return e.works})),n=r[0],u=r[1];return o.useLayoutEffect((function(){return e.on("load",(function(){return u(e.works)}))}),[e]),[n,t]},exports.withFive=function(e){return function(t){return o.forwardRef((function(r,n){var i=p(),a=d(),c=function(e,t){return[C("unsafe__fiveInstance",t)?e:void 0]}(i,e)[0],s=function(e,t){var r=C("state",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return f({},e.state)}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("stateChange",(function(){return i(Symbol())}))}),[e]),[a,u]}(i,e),l=s[0],v=s[1],h=function(e,t){var r=C("currentState",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return e.getCurrentState()}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("currentStateChange",(function(){return i(Symbol())}))}),[e]),[a,u]}(i,e),y=h[0],m=h[1],g=function(e,t){var r=C("currentObserver",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return e.getCurrentState()}),[e,u]);o.useLayoutEffect((function(){if(r)return e.on("currentStateChange",(function(){return i(Symbol())}))}),[e]);var f=void 0;return a&&(f=e.works.getResolvedObserver(a.panoId)),[f,u]}(i,e),S=g[0],b=g[1],w=function(e,t){var r=C("works",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return e.works}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("load",(function(){return i(Symbol())}))}),[e]),[a,u]}(i,e),U=w[0],D=w[1],I=function(e,t){var r=C("model",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return e.model}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,u]}(i,e),G=I[0],q=I[1],H=function(e,t){return[C("scene",t)?e.scene:void 0]}(i,e)[0],T=function(e,t){var r=C("cameraDirection",t),n=o.useState(Symbol()),i=n[0],a=n[1],f=o.useMemo((function(){if(r)return e.camera.getWorldDirection(new u.Vector3)}),[e,i]);return o.useLayoutEffect((function(){if(r)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,i]}(i,e),z=T[0],$=T[1],B=function(e,t){var r=C("cameraRaycaster",t),n=o.useState(Symbol()),i=n[0],a=n[1],f=o.useMemo((function(){if(r){var t=e.camera.getWorldDirection(new u.Vector3);return new u.Raycaster(e.camera.position,t)}}),[e,i]);return o.useLayoutEffect((function(){if(r)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,i]}(i,e),J=B[0],K=B[1],Q=function(e,t){var r=C("modelReadyState",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return e.model.empty?"Empty":"Loaded"}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,u]}(i,e),X=Q[0],Y=Q[1],Z=function(e,t){var r=C("shownFloor",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return e.model.shownFloor}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("modelShownFloorChange",(function(){return i(Symbol())}))}),[e]),[a,u]}(i,e),ee=Z[0],te=Z[1],re=function(e,t){var r=C("helperVisible",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return e.helperVisible}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("helpersVisibleChange",(function(){return i(Symbol())}))}),[e]),[a,u]}(i,e),ne=re[0],oe=re[1],ue=o.useMemo((function(){var t={};return E(t,{setState:k(i,e),loadWork:x(a,e),on:L(i,e),once:F(i,e),off:P(i,e),intersectRaycaster:R(i,e),project2d:V(i,e),updateCamera:O(i,e),getPixels:W(i,e),render:_(i,e),needsRender:j(i,e),preloadPano:M(i,e),showFloor:A(i,e),toggleHelperVisible:N(i,e)}),t}),[i,a]),ie=o.useMemo((function(){var e=f({},ue);return E(e,{unsafe__fiveInstance:c,state:l,currentState:y,currentObserver:S,work:U,model:G,scene:H,cameraDirection:z,cameraRaycaster:J,modelReadyState:X,shownFloor:ee,helperVisible:ne}),e}),[i,ue,v,m,b,D,q,$,K,Y,te,oe]);return o.createElement(t,f({ref:n,$five:ie},r))}))}};
|