@realsee/five-webgpu 1.0.0-alpha.13 → 1.0.0-alpha.14
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/_virtual/_rolldown/runtime.js +3 -3
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/index.AdaptiveLuminancePass.html +1 -1
- package/docs/classes/index.BoundingMesh.html +1 -1
- package/docs/classes/index.Camera.html +1 -1
- package/docs/classes/index.EyeDomeLightingPass.html +1 -1
- package/docs/classes/index.Five.html +65 -64
- package/docs/classes/index.FivePass.html +1 -1
- package/docs/classes/index.FiveRenderer.html +4 -4
- package/docs/classes/index.FlowingFireworks3DPass.html +1 -1
- package/docs/classes/index.FlowingLight2DPass.html +1 -1
- package/docs/classes/index.FlowingLight3DPass.html +1 -1
- package/docs/classes/index.GaussianBlurPass.html +1 -1
- package/docs/classes/index.InternalWebGPURenderer.html +4 -4
- package/docs/classes/index.Model.html +1 -1
- package/docs/classes/index.ModelScene.html +1 -1
- package/docs/classes/index.NetworkSubscribe.html +1 -1
- package/docs/classes/index.PBMCustomNode.html +1 -1
- package/docs/classes/index.PBMGaussianSplattingNodeMaterial.html +1 -1
- package/docs/classes/index.PBMGaussianSplattingObject.html +1 -1
- package/docs/classes/index.PBMGaussianSplattingRenderMesh.html +1 -1
- package/docs/classes/index.PBMGroup.html +1 -1
- package/docs/classes/index.PBMMesh.html +1 -1
- package/docs/classes/index.PBMMeshBasicMaterial.html +1 -1
- package/docs/classes/index.PBMMeshBasicNodeMaterial.html +1 -1
- package/docs/classes/index.PBMMeshPanoOnlyMaterial.html +1 -1
- package/docs/classes/index.PBMMeshPanoOnlyNodeMaterial.html +1 -1
- package/docs/classes/index.PBMMeshPhongMaterial.html +1 -1
- package/docs/classes/index.PBMMeshPhongNodeMaterial.html +1 -1
- package/docs/classes/index.PBMMeshPhysicalMaterial.html +1 -1
- package/docs/classes/index.PBMMeshPhysicalNodeMaterial.html +1 -1
- package/docs/classes/index.PBMPanoFilter.html +1 -1
- package/docs/classes/index.PBMPointCloud.html +1 -1
- package/docs/classes/index.PBMPointCloudMaterial.html +1 -1
- package/docs/classes/index.PBMSkinnedMesh.html +1 -1
- package/docs/classes/index.PBMUpdateable.html +1 -1
- package/docs/classes/index.PanoCircleMesh.html +1 -1
- package/docs/classes/index.PanoCircleMeshCustom.html +1 -1
- package/docs/classes/index.PanoCircleMeshSolid.html +1 -1
- package/docs/classes/index.Parameter.html +1 -1
- package/docs/classes/index.Scene.html +1 -1
- package/docs/classes/index.Subscribe.html +1 -1
- package/docs/classes/index.Tile3D.html +1 -1
- package/docs/classes/index.TileNode.html +1 -1
- package/docs/classes/index.TrajectoryNode.html +1 -1
- package/docs/classes/index.Work.html +15 -22
- package/docs/classes/index.WorkResolvedObserver.html +22 -22
- package/docs/functions/index.createWorks.html +1 -1
- package/docs/functions/index.parseWork.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/index.AddableObject.html +1 -1
- package/docs/interfaces/index.AjaxOptions.html +1 -1
- package/docs/interfaces/index.BaseEvent.html +1 -1
- package/docs/interfaces/index.Clock.html +1 -1
- package/docs/interfaces/index.EventCallback.html +3 -3
- package/docs/interfaces/index.GestureEvent.html +1 -1
- package/docs/interfaces/index.IPBMMaterial.html +1 -1
- package/docs/interfaces/index.ImageOptions.html +1 -1
- package/docs/interfaces/index.IntersectEvent.html +1 -1
- package/docs/interfaces/index.IntersectMesh.html +1 -1
- package/docs/interfaces/index.IntersectMeshInterface.html +1 -1
- package/docs/interfaces/index.Intersection.html +1 -1
- package/docs/interfaces/index.LooseWorkWithExtrinsics.html +8 -8
- package/docs/interfaces/index.ModeChangeEvent.html +1 -1
- package/docs/interfaces/index.ModelControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.ModelEvent.html +1 -1
- package/docs/interfaces/index.ModelSceneEvent.html +1 -1
- package/docs/interfaces/index.ModelTileEvent.html +1 -1
- package/docs/interfaces/index.MovePanoOptions.html +1 -1
- package/docs/interfaces/index.NetworkAbortError.html +1 -1
- package/docs/interfaces/index.NetworkFirbiddenError.html +1 -1
- package/docs/interfaces/index.NetworkOptions.html +1 -1
- package/docs/interfaces/index.NetworkProxyError.html +1 -1
- package/docs/interfaces/index.NetworkResourceEvent.html +1 -1
- package/docs/interfaces/index.NetworkResponseError.html +1 -1
- package/docs/interfaces/index.NetworkTimeoutError.html +1 -1
- package/docs/interfaces/index.ObjectEvent.html +1 -1
- package/docs/interfaces/index.PanoCircleMeshInterface.html +1 -1
- package/docs/interfaces/index.PanoEvent.html +1 -1
- package/docs/interfaces/index.PanoPrepareEvent.html +1 -1
- package/docs/interfaces/index.PanoTextureEvent.html +1 -1
- package/docs/interfaces/index.PanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.PanoramaLikeControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.ParameterMaterialValue.html +1 -1
- package/docs/interfaces/index.ParameterTilesetValue.html +1 -1
- package/docs/interfaces/index.ParameterValue.html +1 -1
- package/docs/interfaces/index.Pose.html +1 -1
- package/docs/interfaces/index.RenderEvent.html +1 -1
- package/docs/interfaces/index.ResolvedParameterValue.html +1 -1
- package/docs/interfaces/index.State.html +1 -1
- package/docs/interfaces/index.StateEvent.html +1 -1
- package/docs/interfaces/index.TextureOptions.html +1 -1
- package/docs/interfaces/index.TopviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.VRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.ViewLayer.html +1 -1
- package/docs/interfaces/index.WorkCubeHdrGainmapImage.html +2 -2
- package/docs/interfaces/index.WorkCubeImage.html +2 -2
- package/docs/interfaces/index.WorkImage.html +5 -5
- package/docs/interfaces/index.WorkInitial.html +8 -8
- package/docs/interfaces/index.WorkInitialJson.html +2 -2
- package/docs/interfaces/index.WorkJson.html +2 -4
- package/docs/interfaces/index.WorkModel.html +8 -8
- package/docs/interfaces/index.WorkModelJson.html +2 -2
- package/docs/interfaces/index.WorkModelLayer.html +6 -6
- package/docs/interfaces/index.WorkModelLayerJson.html +2 -2
- package/docs/interfaces/index.WorkObserver.html +23 -23
- package/docs/interfaces/index.WorkObserverJson.html +2 -2
- package/docs/interfaces/index.WorkPanoramaJson.html +2 -2
- package/docs/interfaces/index.WorkPanoramasJson.html +2 -2
- package/docs/interfaces/index.WorkTile.html +5 -5
- package/docs/interfaces/index.WorkVideo.html +4 -4
- package/docs/interfaces/index.WorksEvent.html +1 -1
- package/docs/interfaces/index.XRControllerEvent.html +1 -1
- package/docs/interfaces/index.XRGestureEvent.html +2 -2
- package/docs/interfaces/index.XRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.XRSessionEvent.html +1 -1
- package/docs/modules/index.html +1 -1
- package/docs/types/index.LegacyEventType.html +3 -3
- package/docs/types/index.OutputTextureDataType.html +1 -1
- package/docs/types/index.ParseOptions.html +8 -8
- package/docs/types/index.PointCloudTransparencyMode.html +2 -0
- package/docs/types/index.Works.html +1 -1
- package/docs/variables/index.loadAt3d.html +2 -0
- package/docs/variables/index.loadDome.html +2 -0
- package/docs/variables/index.loadDomez.html +2 -0
- package/docs/variables/index.loadGltf.html +2 -0
- package/docs/variables/index.loadPbm.html +2 -0
- package/docs/variables/index.loadPly.html +2 -0
- package/five/application/five.d.ts +3 -2
- package/five/chunks/at3d.js +338 -0
- package/five/chunks/at3d.mjs +338 -0
- package/five/chunks/dome.js +338 -0
- package/five/chunks/dome.mjs +338 -0
- package/five/chunks/domez.js +338 -0
- package/five/chunks/domez.mjs +338 -0
- package/five/chunks/fbx.js +338 -0
- package/five/chunks/fbx.mjs +338 -0
- package/five/chunks/fflate.js +338 -0
- package/five/chunks/fflate.mjs +338 -0
- package/five/chunks/glTF-helpers.js +804 -0
- package/five/chunks/glTF-helpers.mjs +804 -0
- package/five/chunks/gltf.js +338 -0
- package/five/chunks/gltf.mjs +338 -0
- package/five/chunks/imageBitmap.js +338 -0
- package/five/chunks/imageBitmap.mjs +338 -0
- package/five/chunks/imageSupport.js +338 -0
- package/five/chunks/imageSupport.mjs +338 -0
- package/five/chunks/lzma.js +383 -0
- package/five/chunks/lzma.mjs +383 -0
- package/five/chunks/memoryUsage.js +339 -0
- package/five/chunks/memoryUsage.mjs +339 -0
- package/five/chunks/minimal.js +338 -0
- package/five/chunks/minimal.mjs +338 -0
- package/five/chunks/pbm.js +338 -0
- package/five/chunks/pbm.mjs +338 -0
- package/five/chunks/pbmGaussianSplattingObject.js +338 -0
- package/five/chunks/pbmGaussianSplattingObject.mjs +338 -0
- package/five/chunks/pbmMeshMaterial.js +338 -0
- package/five/chunks/pbmMeshMaterial.mjs +338 -0
- package/five/chunks/pick.js +338 -0
- package/five/chunks/pick.mjs +338 -0
- package/five/chunks/ply.js +339 -0
- package/five/chunks/ply.mjs +339 -0
- package/five/chunks/spz.js +364 -0
- package/five/chunks/spz.mjs +364 -0
- package/five/core/webglBlendEquationFix.d.ts +41 -0
- package/five/index.d.ts +0 -1
- package/five/index.js +49 -626
- package/five/index.mjs +229 -32052
- package/five/model/index.d.ts +18 -6
- package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting_compression_spz.d.ts +1 -1
- package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting_compression_spz_2.d.ts +1 -1
- package/five/model/loaders/spz.d.ts +1 -2
- package/five/model/loaders/spz.worker.d.ts +37 -0
- package/five/renderer/five-renderer.d.ts +1 -1
- package/five/renderer/index.d.ts +1 -1
- package/five/renderer/postprocessing/passes/pass.js +3 -3
- package/five/renderer/postprocessing/passes/pass.mjs +3 -3
- package/five/renderer/tools/full-screen-quad.js +3 -3
- package/five/renderer/tools/full-screen-quad.mjs +3 -3
- package/five/texture/videoTextureBridge.d.ts +124 -15
- package/five/thirdparty/sha256.d.ts +149 -0
- package/five/utils/calculateThreeMouse.js +3 -3
- package/five/utils/calculateThreeMouse.mjs +3 -3
- package/five/utils/distance.js +3 -3
- package/five/utils/distance.mjs +3 -3
- package/five/utils/isNil.js +3 -3
- package/five/utils/isNil.mjs +3 -3
- package/five/utils/memoryUsage.d.ts +1 -1
- package/five/utils/uuid.js +3 -3
- package/five/utils/uuid.mjs +3 -3
- package/five/work/work.d.ts +0 -7
- package/five/work/workJsonType.d.ts +0 -2
- package/gltf-loader/index.js +3 -3
- package/gltf-loader/index.mjs +3 -50
- package/line/index.js +3 -3
- package/line/index.mjs +3 -88
- package/package.json +1 -1
- package/plugins/BackgroundPlugin/Controller.js +4 -4
- package/plugins/BackgroundPlugin/Controller.mjs +4 -4
- package/plugins/BackgroundPlugin/index.js +3 -3
- package/plugins/BackgroundPlugin/index.mjs +3 -3
- package/plugins/BasePlugin/index.js +3 -3
- package/plugins/BasePlugin/index.mjs +3 -3
- package/plugins/CSS2DPlugin/Controller.js +3 -3
- package/plugins/CSS2DPlugin/Controller.mjs +3 -3
- package/plugins/CSS2DPlugin/index.js +3 -3
- package/plugins/CSS2DPlugin/index.mjs +3 -3
- package/plugins/CSS2DPlugin/style.css_raw.js +4 -4
- package/plugins/CSS2DPlugin/style.css_raw.mjs +4 -4
- package/plugins/CSS3DPlugin/Controller.js +3 -3
- package/plugins/CSS3DPlugin/Controller.mjs +3 -3
- package/plugins/CSS3DPlugin/index.js +3 -3
- package/plugins/CSS3DPlugin/index.mjs +3 -3
- package/plugins/CSS3DPlugin/style.css_raw.js +4 -4
- package/plugins/CSS3DPlugin/style.css_raw.mjs +4 -4
- package/plugins/FloorplanPlugin/Controller.js +3 -3
- package/plugins/FloorplanPlugin/Controller.mjs +3 -3
- package/plugins/FloorplanPlugin/index.js +3 -3
- package/plugins/FloorplanPlugin/index.mjs +3 -3
- package/plugins/FloorplanPlugin/render/assets.js +3 -3
- package/plugins/FloorplanPlugin/render/assets.mjs +3 -3
- package/plugins/FloorplanPlugin/render/index.js +3 -3
- package/plugins/FloorplanPlugin/render/index.mjs +3 -3
- package/plugins/FloorplanPlugin/render/isPointInPolygon.js +3 -3
- package/plugins/FloorplanPlugin/render/isPointInPolygon.mjs +3 -3
- package/plugins/FloorplanPlugin/render/renderFloor.js +3 -3
- package/plugins/FloorplanPlugin/render/renderFloor.mjs +3 -3
- package/plugins/FloorplanPlugin/render/roomLabelVisibility.js +3 -3
- package/plugins/FloorplanPlugin/render/roomLabelVisibility.mjs +3 -3
- package/plugins/FloorplanPlugin/render/style.css_raw.js +4 -4
- package/plugins/FloorplanPlugin/render/style.css_raw.mjs +4 -4
- package/plugins/FloorplanPlugin/utils/changeMode.js +3 -3
- package/plugins/FloorplanPlugin/utils/changeMode.mjs +3 -3
- package/plugins/FloorplanPlugin/utils/changeModelCanvasOpacity.js +3 -3
- package/plugins/FloorplanPlugin/utils/changeModelCanvasOpacity.mjs +3 -3
- package/plugins/FloorplanPlugin/utils/correctFiveState.js +3 -3
- package/plugins/FloorplanPlugin/utils/correctFiveState.mjs +3 -3
- package/plugins/FloorplanPlugin/utils/equal.js +3 -3
- package/plugins/FloorplanPlugin/utils/equal.mjs +3 -3
- package/plugins/FloorplanPlugin/utils/filter.js +3 -3
- package/plugins/FloorplanPlugin/utils/filter.mjs +3 -3
- package/plugins/FloorplanPlugin/utils/fiveModelLoad.js +3 -3
- package/plugins/FloorplanPlugin/utils/fiveModelLoad.mjs +3 -3
- package/plugins/FloorplanPlugin/utils/formatData.js +3 -3
- package/plugins/FloorplanPlugin/utils/formatData.mjs +3 -3
- package/plugins/FloorplanPlugin/utils/formatFloorplanJson.js +3 -3
- package/plugins/FloorplanPlugin/utils/formatFloorplanJson.mjs +3 -3
- package/plugins/FloorplanPlugin/utils/formatPosition.js +3 -3
- package/plugins/FloorplanPlugin/utils/formatPosition.mjs +3 -3
- package/plugins/FloorplanPlugin/utils/getDistanceFromModel.js +3 -3
- package/plugins/FloorplanPlugin/utils/getDistanceFromModel.mjs +3 -3
- package/plugins/FloorplanPlugin/utils/getPxmm.js +3 -3
- package/plugins/FloorplanPlugin/utils/getPxmm.mjs +3 -3
- package/plugins/FloorplanPlugin/utils/isTruelyObject.js +3 -3
- package/plugins/FloorplanPlugin/utils/isTruelyObject.mjs +3 -3
- package/plugins/FloorplanPlugin/utils/nearlyEqual.js +3 -3
- package/plugins/FloorplanPlugin/utils/nearlyEqual.mjs +3 -3
- package/plugins/FloorplanPlugin/utils/polylabel.js +3 -3
- package/plugins/FloorplanPlugin/utils/polylabel.mjs +3 -3
- package/plugins/FloorplanPlugin/utils/to.js +3 -3
- package/plugins/FloorplanPlugin/utils/to.mjs +3 -3
- package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.js +3 -3
- package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.mjs +3 -3
- package/plugins/GaussianSplattingEntranceAnimationPlugin/index.js +3 -3
- package/plugins/GaussianSplattingEntranceAnimationPlugin/index.mjs +3 -3
- package/plugins/Object3DHelperPlugin/Controller.js +3 -3
- package/plugins/Object3DHelperPlugin/Controller.mjs +3 -3
- package/plugins/Object3DHelperPlugin/Controllers/BaseController.js +3 -3
- package/plugins/Object3DHelperPlugin/Controllers/BaseController.mjs +3 -3
- package/plugins/Object3DHelperPlugin/Controllers/BoundingBoxController.js +3 -3
- package/plugins/Object3DHelperPlugin/Controllers/BoundingBoxController.mjs +3 -3
- package/plugins/Object3DHelperPlugin/Controllers/MoveController.js +3 -3
- package/plugins/Object3DHelperPlugin/Controllers/MoveController.mjs +3 -3
- package/plugins/Object3DHelperPlugin/Controllers/RotateController.js +3 -3
- package/plugins/Object3DHelperPlugin/Controllers/RotateController.mjs +3 -3
- package/plugins/Object3DHelperPlugin/FiveControllerWrapper.js +3 -3
- package/plugins/Object3DHelperPlugin/FiveControllerWrapper.mjs +3 -3
- package/plugins/Object3DHelperPlugin/Helper/BaseHelper.js +3 -3
- package/plugins/Object3DHelperPlugin/Helper/BaseHelper.mjs +3 -3
- package/plugins/Object3DHelperPlugin/Helper/BoundingBoxHelper.js +3 -3
- package/plugins/Object3DHelperPlugin/Helper/BoundingBoxHelper.mjs +3 -3
- package/plugins/Object3DHelperPlugin/Helper/MoveHelper.js +3 -3
- package/plugins/Object3DHelperPlugin/Helper/MoveHelper.mjs +3 -3
- package/plugins/Object3DHelperPlugin/Helper/RotateHelper.js +3 -3
- package/plugins/Object3DHelperPlugin/Helper/RotateHelper.mjs +3 -3
- package/plugins/Object3DHelperPlugin/constant.js +3 -3
- package/plugins/Object3DHelperPlugin/constant.mjs +3 -3
- package/plugins/Object3DHelperPlugin/index.js +3 -3
- package/plugins/Object3DHelperPlugin/index.mjs +3 -3
- package/plugins/Object3DHelperPlugin/utils/ArrowGroup.js +3 -3
- package/plugins/Object3DHelperPlugin/utils/ArrowGroup.mjs +3 -3
- package/plugins/Object3DHelperPlugin/utils/CenterHandle.js +3 -3
- package/plugins/Object3DHelperPlugin/utils/CenterHandle.mjs +3 -3
- package/plugins/Object3DHelperPlugin/utils/PlaneHandle.js +3 -3
- package/plugins/Object3DHelperPlugin/utils/PlaneHandle.mjs +3 -3
- package/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.js +3 -3
- package/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.mjs +3 -3
- package/plugins/Object3DHelperPlugin/utils/cameraHooks.js +3 -3
- package/plugins/Object3DHelperPlugin/utils/cameraHooks.mjs +3 -3
- package/plugins/Object3DHelperPlugin/utils/direction.js +3 -3
- package/plugins/Object3DHelperPlugin/utils/direction.mjs +3 -3
- package/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.js +3 -3
- package/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.mjs +3 -3
- package/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.js +3 -3
- package/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.mjs +3 -3
- package/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.js +3 -3
- package/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.mjs +3 -3
- package/plugins/Object3DHelperPlugin/utils/solidGuide.js +3 -3
- package/plugins/Object3DHelperPlugin/utils/solidGuide.mjs +3 -3
- package/plugins/Object3DHelperPlugin/utils/tipsDom.js +3 -3
- package/plugins/Object3DHelperPlugin/utils/tipsDom.mjs +3 -3
- package/plugins/PanoAnimePlugin/Controller.js +3 -3
- package/plugins/PanoAnimePlugin/Controller.mjs +3 -3
- package/plugins/PanoAnimePlugin/index.js +3 -3
- package/plugins/PanoAnimePlugin/index.mjs +3 -3
- package/plugins/WordPassPlugin/Controller.js +3 -3
- package/plugins/WordPassPlugin/Controller.mjs +3 -3
- package/plugins/WordPassPlugin/hersheyFont.js +3 -3
- package/plugins/WordPassPlugin/hersheyFont.mjs +3 -3
- package/plugins/WordPassPlugin/index.js +3 -3
- package/plugins/WordPassPlugin/index.mjs +3 -3
- package/plugins/WordPassPlugin/textToStrokeOrderStrokes.js +4 -4
- package/plugins/WordPassPlugin/textToStrokeOrderStrokes.mjs +4 -4
- package/plugins/WordPassPlugin/word-pass.js +3 -3
- package/plugins/WordPassPlugin/word-pass.mjs +3 -3
- package/plugins/index.js +3 -3
- package/plugins/index.mjs +3 -3
- package/plugins/thirdParty/CSS2DRenderer.js +3 -3
- package/plugins/thirdParty/CSS2DRenderer.mjs +3 -3
- package/plugins/thirdParty/CSS3DRenderer.js +3 -3
- package/plugins/thirdParty/CSS3DRenderer.mjs +3 -3
- package/plugins/thirdParty/doctorstrange-model.js +75 -75
- package/plugins/thirdParty/doctorstrange-model.mjs +75 -75
- package/plugins/thirdParty/domevents.js +3 -3
- package/plugins/thirdParty/domevents.mjs +3 -3
- package/plugins/utils/absoluteUrl.js +3 -3
- package/plugins/utils/absoluteUrl.mjs +3 -3
- package/plugins/utils/calculatePath.js +3 -3
- package/plugins/utils/calculatePath.mjs +3 -3
- package/plugins/utils/clamp.js +3 -3
- package/plugins/utils/clamp.mjs +3 -3
- package/plugins/utils/uuid.js +3 -3
- package/plugins/utils/uuid.mjs +3 -3
- package/react/hooks/useFiveModelReadyState.d.ts +1 -1
- package/react/index.js +3 -3
- package/react/index.mjs +3 -644
- package/sticker/index.js +13 -4
- package/sticker/index.mjs +43 -260
- package/umd/five-gltf-loader.js +3 -3
- package/umd/five-line.js +3 -3
- package/umd/five-plugins.js +2 -2
- package/umd/five-react.js +2 -2
- package/umd/five-sticker.js +13 -4
- package/umd/five-vfx.js +2 -2
- package/umd/five.js +154 -192
- package/vfx/index.js +3 -3
- package/vfx/index.mjs +3 -486
- package/work-downloader/index.js +3 -3
- package/work-downloader/index.mjs +3 -315
- package/docs/functions/index.loadAt3d.html +0 -1
- package/docs/functions/index.loadDome.html +0 -1
- package/docs/functions/index.loadDomez.html +0 -1
- package/docs/functions/index.loadGltf.html +0 -1
- package/docs/functions/index.loadPbm.html +0 -1
- package/docs/functions/index.loadPly.html +0 -10
- package/five/certificates/hardware.d.ts +0 -1
- package/five/thirdparty/jsrsasign.d.ts +0 -753
- package/five/work/_ALLOW_HOST.d.ts +0 -2
- package/five/work/keychain.d.ts +0 -5
- package/five/work/verify.d.ts +0 -7
- package/five/work/workVerify.d.ts +0 -2
package/react/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five-webgpu
|
|
4
|
-
* Generated: 2026/
|
|
5
|
-
* Version: 1.0.0-alpha.
|
|
4
|
+
* Generated: 2026/11/3
|
|
5
|
+
* Version: 1.0.0-alpha.14
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,645 +335,4 @@
|
|
|
335
335
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
336
336
|
* Agreement and all related documents shall be drafted in English.
|
|
337
337
|
|
|
338
|
-
*/import * as e from "react";
|
|
339
|
-
import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
|
|
340
|
-
import { Five as a } from "@realsee/five-webgpu";
|
|
341
|
-
import * as o from "three/webgpu";
|
|
342
|
-
//#region build/react/context.js
|
|
343
|
-
var s = e.createContext(null);
|
|
344
|
-
function c() {
|
|
345
|
-
let t = e.useContext(s);
|
|
346
|
-
if (!t) throw Error("FiveProvider never found.");
|
|
347
|
-
return t.five;
|
|
348
|
-
}
|
|
349
|
-
function l() {
|
|
350
|
-
let t = e.useContext(s);
|
|
351
|
-
if (!t) throw Error("FiveProvider never found.");
|
|
352
|
-
return t.loadWork;
|
|
353
|
-
}
|
|
354
|
-
//#endregion
|
|
355
|
-
//#region build/react/createProvider.js
|
|
356
|
-
function u(e, t) {
|
|
357
|
-
let n = Array.isArray(e) ? e : [e], r = Array.isArray(t) ? t : [t];
|
|
358
|
-
if (n.length !== r.length) return !1;
|
|
359
|
-
for (let e = 0; e < n.length; e++) if (n[e].workCode !== r[e].workCode) return !1;
|
|
360
|
-
return !0;
|
|
361
|
-
}
|
|
362
|
-
function d(t = {}) {
|
|
363
|
-
return class extends e.Component {
|
|
364
|
-
constructor(e) {
|
|
365
|
-
super(e), this.__fiveEventDisposers = [], this.__fiveDisposeTimer = null, this.five = new a(Object.assign({}, t)), this.loadWork = this.loadWork.bind(this), this.state = { renderer: this.five.renderer };
|
|
366
|
-
}
|
|
367
|
-
loadWork(e, t, n, r = !0) {
|
|
368
|
-
if (this.props.work) throw Error("props 'works' is set in fiveProvider, if you need modify work internal, use 'initialWork' instead.");
|
|
369
|
-
return this.five.load(e, t, n, r);
|
|
370
|
-
}
|
|
371
|
-
shouldComponentUpdate(e) {
|
|
372
|
-
return this.five.renderer && this.five && e.work && !u(e.work, this.five.works) && this.five.load(e.work, e.initialState, e.initialOptions), !0;
|
|
373
|
-
}
|
|
374
|
-
componentDidMount() {
|
|
375
|
-
var e;
|
|
376
|
-
clearTimeout(this.__fiveDisposeTimer), this.__fiveDisposeTimer = null, this.state.renderer !== this.five.renderer && this.setState({ renderer: this.five.renderer }), this.__fiveEventDisposers.push(this.five.on("load", () => {
|
|
377
|
-
this.props.onWorksChange && this.props.onWorksChange(this.five.works);
|
|
378
|
-
})), this.__fiveEventDisposers.push(this.five.on("stateChange", (e, t) => {
|
|
379
|
-
this.props.onStateChange && this.props.onStateChange(e, t);
|
|
380
|
-
})), this.__fiveEventDisposers.push(this.five.on("currentStateChange", (e, t) => {
|
|
381
|
-
this.props.onCurrentStateChange && this.props.onCurrentStateChange(e, t);
|
|
382
|
-
})), this.__fiveEventDisposers.push(this.five.on("error", (e) => {
|
|
383
|
-
this.props.onError ? this.props.onError(e) : console.warn(e.message);
|
|
384
|
-
}));
|
|
385
|
-
let t = this.props.work || this.props.initialWork;
|
|
386
|
-
t && this.five.load(t, this.props.initialState, this.props.initialOptions, (e = this.props.initialUserAction) == null ? !0 : e);
|
|
387
|
-
}
|
|
388
|
-
componentWillUnmount() {
|
|
389
|
-
var e;
|
|
390
|
-
for (let e of this.__fiveEventDisposers) e();
|
|
391
|
-
this.__fiveEventDisposers = [], (e = this.five.controller) == null || e.destroy(), this.__fiveDisposeTimer = setTimeout(() => {
|
|
392
|
-
this.__fiveDisposeTimer = null, this.five.dispose();
|
|
393
|
-
}, 1e3);
|
|
394
|
-
}
|
|
395
|
-
render() {
|
|
396
|
-
let t = this.five, n = this.loadWork, r = this.state.renderer;
|
|
397
|
-
return e.createElement(s.Provider, { value: {
|
|
398
|
-
renderer: r,
|
|
399
|
-
five: t,
|
|
400
|
-
loadWork: n
|
|
401
|
-
} }, this.props.children);
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
//#endregion
|
|
406
|
-
//#region build/react/canvas.js
|
|
407
|
-
var f = typeof window < "u" ? e.useLayoutEffect : e.useEffect, p = {
|
|
408
|
-
display: "inline-block",
|
|
409
|
-
overflow: "hidden"
|
|
410
|
-
}, m = ({ width: t, height: n }) => {
|
|
411
|
-
let r = c(), i = e.createRef(), a = Object.assign({
|
|
412
|
-
width: t,
|
|
413
|
-
height: n
|
|
414
|
-
}, p);
|
|
415
|
-
return f(() => {
|
|
416
|
-
let e = i.current;
|
|
417
|
-
if (!e || !r.renderer) return;
|
|
418
|
-
let a = r.renderer.domElement;
|
|
419
|
-
if (a.parentNode !== null && a.parentNode !== e) throw Error("There are more than 2 fiveCanvas in this context.");
|
|
420
|
-
return a.parentNode !== e && e.appendChild(a), r.camera.aspect = t / n, r.camera.updateProjectionMatrix(), r.renderer.setSize(t, n), r.refresh({
|
|
421
|
-
width: t,
|
|
422
|
-
height: n
|
|
423
|
-
}), r.needsRender = !0, () => {
|
|
424
|
-
a.parentNode === e && e.removeChild(a);
|
|
425
|
-
};
|
|
426
|
-
}, [
|
|
427
|
-
r,
|
|
428
|
-
r.renderer,
|
|
429
|
-
t,
|
|
430
|
-
n,
|
|
431
|
-
i.current
|
|
432
|
-
]), e.createElement("div", {
|
|
433
|
-
ref: i,
|
|
434
|
-
style: a
|
|
435
|
-
});
|
|
436
|
-
}, h = ({ children: t }) => {
|
|
437
|
-
let n = c(), r = e.useRef(null);
|
|
438
|
-
return e.useEffect(() => {
|
|
439
|
-
let e = r.current;
|
|
440
|
-
if (!e || !n.renderer) return;
|
|
441
|
-
let t = n.renderer.domElement;
|
|
442
|
-
e.appendChild(t);
|
|
443
|
-
let i = () => {
|
|
444
|
-
var t;
|
|
445
|
-
let { width: r, height: i } = e.getBoundingClientRect();
|
|
446
|
-
r === 0 || i === 0 || (n.camera.aspect = r / i, n.camera.updateProjectionMatrix(), (t = n.renderer) == null || t.setSize(r, i), n.refresh({
|
|
447
|
-
width: r,
|
|
448
|
-
height: i
|
|
449
|
-
}), n.needsRender = !0);
|
|
450
|
-
}, a = new ResizeObserver(i);
|
|
451
|
-
return a.observe(e), i(), () => {
|
|
452
|
-
t.parentNode === e && e.removeChild(t), a.unobserve(e), a.disconnect();
|
|
453
|
-
};
|
|
454
|
-
}, []), e.createElement("div", {
|
|
455
|
-
ref: r,
|
|
456
|
-
style: {
|
|
457
|
-
position: "absolute",
|
|
458
|
-
top: 0,
|
|
459
|
-
left: 0,
|
|
460
|
-
right: 0,
|
|
461
|
-
bottom: 0
|
|
462
|
-
}
|
|
463
|
-
}, t);
|
|
464
|
-
}, g = ({ renderChildren: t, load: n, children: r, fallback: i }) => {
|
|
465
|
-
let a = e.useContext(s), o = a == null ? void 0 : a.five, [c, l] = e.useState(!!t), [u, d] = e.useState(!1);
|
|
466
|
-
return e.useEffect(() => {
|
|
467
|
-
o && o.getElement() && (l(!0), n && n(o).then((e) => {
|
|
468
|
-
o.load(...e);
|
|
469
|
-
}));
|
|
470
|
-
}, [o]), e.useEffect(() => {
|
|
471
|
-
if (!o) return;
|
|
472
|
-
let e = () => d(!0);
|
|
473
|
-
return o.on("works.load", e), o.works && o.works.length > 0 && d(!0), () => {
|
|
474
|
-
o.off("works.load", e);
|
|
475
|
-
};
|
|
476
|
-
}, [o]), !o || !u && !t || !c ? i == null ? null : e.createElement(e.Fragment, null, i) : e.createElement(e.Fragment, null, r);
|
|
477
|
-
}, _ = {
|
|
478
|
-
position: "relative",
|
|
479
|
-
width: "100vw",
|
|
480
|
-
height: "100vh",
|
|
481
|
-
overflow: "hidden"
|
|
482
|
-
}, v = {
|
|
483
|
-
backgroundAlpha: 1,
|
|
484
|
-
backgroundColor: 0,
|
|
485
|
-
imageOptions: { size: 512 },
|
|
486
|
-
textureOptions: { autoResize: !1 },
|
|
487
|
-
preserveDrawingBuffer: !0
|
|
488
|
-
}, y = ({ fiveInitArgs: t = v, renderChildren: n, plugins: r, load: i, children: a, fullscreen: o, autoCanvas: s = !0, fallback: c }) => {
|
|
489
|
-
let [l] = e.useState(() => d(Object.assign(Object.assign({}, t), { plugins: r }))), u = [];
|
|
490
|
-
s && u.push(e.createElement(h, { key: "auto-canvas" })), a && u.push(a);
|
|
491
|
-
let f = e.createElement(l, null, e.createElement(g, {
|
|
492
|
-
load: i,
|
|
493
|
-
renderChildren: n,
|
|
494
|
-
fallback: c
|
|
495
|
-
}, ...u));
|
|
496
|
-
return o ? e.createElement("div", { style: _ }, f) : f;
|
|
497
|
-
};
|
|
498
|
-
//#endregion
|
|
499
|
-
//#region build/react/hooks/unsafe__useFiveInstance.js
|
|
500
|
-
function b() {
|
|
501
|
-
return c();
|
|
502
|
-
}
|
|
503
|
-
//#endregion
|
|
504
|
-
//#region build/react/hooks/useFiveSceneEffect.js
|
|
505
|
-
function x(t, n) {
|
|
506
|
-
let r = c(), i = [r];
|
|
507
|
-
n !== void 0 && (i = i.concat(n)), e.useLayoutEffect(() => t(r.scene), i);
|
|
508
|
-
}
|
|
509
|
-
var S = x;
|
|
510
|
-
//#endregion
|
|
511
|
-
//#region build/react/hooks/useFiveWork.js
|
|
512
|
-
function C() {
|
|
513
|
-
let t = c(), n = l(), [r, i] = e.useState(() => t.works);
|
|
514
|
-
return e.useLayoutEffect(() => t.on("load", () => i(t.works)), [t]), [r, n];
|
|
515
|
-
}
|
|
516
|
-
//#endregion
|
|
517
|
-
//#region build/react/hooks/useFiveState.js
|
|
518
|
-
function w(e) {
|
|
519
|
-
return Object.assign({}, e.state);
|
|
520
|
-
}
|
|
521
|
-
function T() {
|
|
522
|
-
let t = c(), [n, r] = e.useState(() => w(t)), i = e.useCallback((e, n = !1, r = !0) => {
|
|
523
|
-
let i = typeof e == "function" ? e(t.getCurrentState()) : e;
|
|
524
|
-
t.setState(i, n, r);
|
|
525
|
-
}, [t]);
|
|
526
|
-
return e.useLayoutEffect(() => t.on("stateChange", () => r(w(t))), [t]), [n, i];
|
|
527
|
-
}
|
|
528
|
-
//#endregion
|
|
529
|
-
//#region build/react/hooks/useFiveCurrentState.js
|
|
530
|
-
function E() {
|
|
531
|
-
let t = c(), [n, r] = e.useState(() => t.getCurrentState()), i = e.useCallback((e, n = !1, r = !0) => {
|
|
532
|
-
let i = typeof e == "function" ? e(t.getCurrentState()) : e;
|
|
533
|
-
t.setState(i, n, r);
|
|
534
|
-
}, [t]);
|
|
535
|
-
return e.useLayoutEffect(() => t.on("currentStateChange", () => r(t.getCurrentState())), [t]), [n, i];
|
|
536
|
-
}
|
|
537
|
-
//#endregion
|
|
538
|
-
//#region build/react/hooks/useFiveCurrentObserver.js
|
|
539
|
-
function D() {
|
|
540
|
-
let t = c(), [n, r] = e.useState(() => t.getCurrentState());
|
|
541
|
-
return e.useLayoutEffect(() => t.on("currentStateChange", () => r(t.getCurrentState())), [t]), t.works.getObserver(n);
|
|
542
|
-
}
|
|
543
|
-
//#endregion
|
|
544
|
-
//#region build/react/hooks/useFiveEventCallback.js
|
|
545
|
-
function O(t, n, r) {
|
|
546
|
-
let i = c(), a = [i, t];
|
|
547
|
-
r !== void 0 && (a = a.concat(r)), e.useLayoutEffect(() => i.on(t, n), a);
|
|
548
|
-
}
|
|
549
|
-
//#endregion
|
|
550
|
-
//#region build/react/hooks/useFiveAction.js
|
|
551
|
-
function k() {
|
|
552
|
-
let t = c();
|
|
553
|
-
return {
|
|
554
|
-
updateCamera: e.useCallback((e, n) => t.updateCamera(e, n), [t]),
|
|
555
|
-
getPixels: e.useCallback(t.getPixels.bind(t), [t]),
|
|
556
|
-
render: e.useCallback((e) => t.render(e), [t]),
|
|
557
|
-
needsRender: e.useCallback(() => t.needsRender = !0, [t]),
|
|
558
|
-
preloadPano: e.useCallback((e, n) => t.preloadPano(e, n), [t])
|
|
559
|
-
};
|
|
560
|
-
}
|
|
561
|
-
//#endregion
|
|
562
|
-
//#region build/react/hooks/useFiveProject2d.js
|
|
563
|
-
function A() {
|
|
564
|
-
let t = c(), [n, r] = e.useState(() => Symbol());
|
|
565
|
-
return e.useLayoutEffect(() => t.on("cameraUpdate", () => r(Symbol())), [t]), e.useCallback((e, n) => t.project2d(e, n), [t]);
|
|
566
|
-
}
|
|
567
|
-
//#endregion
|
|
568
|
-
//#region build/react/hooks/useFiveCameraRaycaster.js
|
|
569
|
-
function j(e) {
|
|
570
|
-
let t = e.camera.getWorldDirection(new o.Vector3());
|
|
571
|
-
return new o.Raycaster(e.camera.position, t);
|
|
572
|
-
}
|
|
573
|
-
function M() {
|
|
574
|
-
let t = c(), [n, r] = e.useState(() => j(t));
|
|
575
|
-
return e.useLayoutEffect(() => t.on("cameraUpdate", () => r(j(t))), [t]), n;
|
|
576
|
-
}
|
|
577
|
-
//#endregion
|
|
578
|
-
//#region build/react/hooks/useFiveCameraDirection.js
|
|
579
|
-
function N(e) {
|
|
580
|
-
return e.camera.getWorldDirection(new o.Vector3());
|
|
581
|
-
}
|
|
582
|
-
function P() {
|
|
583
|
-
let t = c(), [n, r] = e.useState(() => N(t));
|
|
584
|
-
return e.useLayoutEffect(() => t.on("cameraUpdate", () => r(N(t))), [t]), n;
|
|
585
|
-
}
|
|
586
|
-
//#endregion
|
|
587
|
-
//#region build/react/hooks/useFiveModelIntersectRaycaster.js
|
|
588
|
-
function ee() {
|
|
589
|
-
let t = c();
|
|
590
|
-
return e.useCallback((e) => t.model.intersectRaycaster(e), [t]);
|
|
591
|
-
}
|
|
592
|
-
//#endregion
|
|
593
|
-
//#region build/react/hooks/useFiveModelReadyState.js
|
|
594
|
-
function F(e) {
|
|
595
|
-
return e.model.empty ? "Empty" : "Loaded";
|
|
596
|
-
}
|
|
597
|
-
function I() {
|
|
598
|
-
let t = c(), [n, r] = e.useState(() => F(t));
|
|
599
|
-
return e.useLayoutEffect(() => t.on("modelLoaded", () => r(F(t))), [t]), n;
|
|
600
|
-
}
|
|
601
|
-
//#endregion
|
|
602
|
-
//#region build/react/hooks/useFivePlugin.js
|
|
603
|
-
var L = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map();
|
|
604
|
-
function z(e) {
|
|
605
|
-
let t = R.get(e);
|
|
606
|
-
t && t.forEach((e) => e());
|
|
607
|
-
}
|
|
608
|
-
function te(e, t) {
|
|
609
|
-
return R.has(e) || R.set(e, /* @__PURE__ */ new Set()), R.get(e).add(t), () => {
|
|
610
|
-
let n = R.get(e);
|
|
611
|
-
n && (n.delete(t), n.size === 0 && R.delete(e));
|
|
612
|
-
};
|
|
613
|
-
}
|
|
614
|
-
function B(e, t) {
|
|
615
|
-
return `${e}:${t}`;
|
|
616
|
-
}
|
|
617
|
-
function ne(e, t) {
|
|
618
|
-
var n;
|
|
619
|
-
return (n = L.get(B(e, t))) == null ? void 0 : n.plugin;
|
|
620
|
-
}
|
|
621
|
-
function re(e, t, n) {
|
|
622
|
-
L.set(B(e, t), { plugin: n }), z(e);
|
|
623
|
-
}
|
|
624
|
-
function V(e, a) {
|
|
625
|
-
var o, s;
|
|
626
|
-
let l = c(), u = (s = (o = l.work) == null ? void 0 : o.workCode) == null ? "" : s, d = B(u, e), f = r(l), [, p] = i(0);
|
|
627
|
-
return n(() => {
|
|
628
|
-
if (u) return te(u, () => p((e) => e + 1));
|
|
629
|
-
}, [u]), n(() => {
|
|
630
|
-
if (f.current === l) return;
|
|
631
|
-
f.current = l;
|
|
632
|
-
let t = L.get(d);
|
|
633
|
-
if (!t) return;
|
|
634
|
-
let n = t.plugin;
|
|
635
|
-
if (a != null && a.reCreateOnFiveChange && a.createPlugin) {
|
|
636
|
-
typeof n.dispose == "function" && n.dispose();
|
|
637
|
-
let t = a.createPlugin(l);
|
|
638
|
-
L.set(d, { plugin: t }), l.plugins[e] = t, z(u);
|
|
639
|
-
} else n && (typeof n.updateFive == "function" ? n.updateFive(l) : "five" in n && (n.five = l));
|
|
640
|
-
}, [l]), t(() => {
|
|
641
|
-
let t = L.get(d);
|
|
642
|
-
if (t) return l.plugins[e] = t.plugin, t.plugin;
|
|
643
|
-
let n = l.plugins[e];
|
|
644
|
-
if (n) return L.set(d, { plugin: n }), n;
|
|
645
|
-
if (a != null && a.createPlugin) {
|
|
646
|
-
let t = a.createPlugin(l);
|
|
647
|
-
return L.set(d, { plugin: t }), l.plugins[e] = t, z(u), t;
|
|
648
|
-
}
|
|
649
|
-
}, [
|
|
650
|
-
d,
|
|
651
|
-
l,
|
|
652
|
-
a == null ? void 0 : a.createPlugin
|
|
653
|
-
])();
|
|
654
|
-
}
|
|
655
|
-
//#endregion
|
|
656
|
-
//#region build/react/hooks/useFiveFloor.js
|
|
657
|
-
function H() {
|
|
658
|
-
let t = c(), [n, r] = e.useState(t.model.shownFloor), [i, a] = e.useState(t.model.floorLength), o = e.useCallback((e) => {
|
|
659
|
-
typeof e == "number" ? t.model.show(e) : t.model.show();
|
|
660
|
-
}, [t]);
|
|
661
|
-
return e.useLayoutEffect(() => {
|
|
662
|
-
let e = [];
|
|
663
|
-
return e.push(t.on("modelShownFloorChange", () => r(t.model.shownFloor))), e.push(t.on("modelLoaded", () => a(t.model.floorLength))), () => {
|
|
664
|
-
let t;
|
|
665
|
-
for (; t = e.shift();) t();
|
|
666
|
-
};
|
|
667
|
-
}, [t]), [
|
|
668
|
-
n,
|
|
669
|
-
i,
|
|
670
|
-
o
|
|
671
|
-
];
|
|
672
|
-
}
|
|
673
|
-
//#endregion
|
|
674
|
-
//#region build/react/hooks/useFiveHelper.js
|
|
675
|
-
function U() {
|
|
676
|
-
let t = c(), [n, r] = e.useState(t.helperVisible), i = e.useCallback((e) => {
|
|
677
|
-
t.helperVisible = e;
|
|
678
|
-
}, [t]);
|
|
679
|
-
return e.useLayoutEffect(() => t.on("helpersVisibleChange", (e) => r(e)), [t]), [n, i];
|
|
680
|
-
}
|
|
681
|
-
//#endregion
|
|
682
|
-
//#region build/react/withFive.js
|
|
683
|
-
var W = "$five";
|
|
684
|
-
function G(e, t) {
|
|
685
|
-
return t.indexOf(e) >= 0;
|
|
686
|
-
}
|
|
687
|
-
function K(e, t) {
|
|
688
|
-
for (let n of Object.keys(t)) t[n] !== void 0 && (e[n] = t[n]);
|
|
689
|
-
}
|
|
690
|
-
function q(t, n) {
|
|
691
|
-
let r = G("state", n), [i, a] = e.useState(Symbol()), o = e.useMemo(() => {
|
|
692
|
-
if (r) return Object.assign({}, t.state);
|
|
693
|
-
}, [t, i]);
|
|
694
|
-
return e.useLayoutEffect(() => {
|
|
695
|
-
if (r) return t.on("stateChange", () => a(Symbol()));
|
|
696
|
-
}, [t]), [o, i];
|
|
697
|
-
}
|
|
698
|
-
function J(t, n) {
|
|
699
|
-
let r = G("currentState", n), [i, a] = e.useState(Symbol()), o = e.useMemo(() => {
|
|
700
|
-
if (r) return t.getCurrentState();
|
|
701
|
-
}, [t, i]);
|
|
702
|
-
return e.useLayoutEffect(() => {
|
|
703
|
-
if (r) return t.on("currentStateChange", () => a(Symbol()));
|
|
704
|
-
}, [t]), [o, i];
|
|
705
|
-
}
|
|
706
|
-
function Y(t, n) {
|
|
707
|
-
let r = G("currentObserver", n), [i, a] = e.useState(Symbol()), o = e.useMemo(() => {
|
|
708
|
-
if (r) return t.getCurrentState();
|
|
709
|
-
}, [t, i]);
|
|
710
|
-
e.useLayoutEffect(() => {
|
|
711
|
-
if (r) return t.on("currentStateChange", () => a(Symbol()));
|
|
712
|
-
}, [t]);
|
|
713
|
-
let s;
|
|
714
|
-
return o && (s = t.works.getObserver(o)), [s, i];
|
|
715
|
-
}
|
|
716
|
-
function X(e, t) {
|
|
717
|
-
return [G("unsafe__fiveInstance", t) ? e : void 0];
|
|
718
|
-
}
|
|
719
|
-
function ie(t, n) {
|
|
720
|
-
let r = G("works", n), [i, a] = e.useState(Symbol()), o = e.useMemo(() => {
|
|
721
|
-
if (r) return t.works;
|
|
722
|
-
}, [t, i]);
|
|
723
|
-
return e.useLayoutEffect(() => {
|
|
724
|
-
if (r) return t.on("load", () => a(Symbol()));
|
|
725
|
-
}, [t]), [o, i];
|
|
726
|
-
}
|
|
727
|
-
function ae(t, n) {
|
|
728
|
-
let r = G("model", n), [i, a] = e.useState(Symbol()), o = e.useMemo(() => {
|
|
729
|
-
if (r) return t.model;
|
|
730
|
-
}, [t, i]);
|
|
731
|
-
return e.useLayoutEffect(() => {
|
|
732
|
-
if (r) return t.on("modelLoaded", () => a(Symbol()));
|
|
733
|
-
}, [t]), [o, i];
|
|
734
|
-
}
|
|
735
|
-
function oe(e, t) {
|
|
736
|
-
return [G("scene", t) ? e.scene : void 0];
|
|
737
|
-
}
|
|
738
|
-
function se(t, n) {
|
|
739
|
-
let r = G("cameraDirection", n), [i, a] = e.useState(Symbol()), s = e.useMemo(() => {
|
|
740
|
-
if (r) return t.camera.getWorldDirection(new o.Vector3());
|
|
741
|
-
}, [t, i]);
|
|
742
|
-
return e.useLayoutEffect(() => {
|
|
743
|
-
if (r) return t.on("cameraUpdate", () => a(Symbol()));
|
|
744
|
-
}, [t]), [s, i];
|
|
745
|
-
}
|
|
746
|
-
function ce(t, n) {
|
|
747
|
-
let r = G("cameraRaycaster", n), [i, a] = e.useState(Symbol()), s = e.useMemo(() => {
|
|
748
|
-
if (r) {
|
|
749
|
-
let e = t.camera.getWorldDirection(new o.Vector3());
|
|
750
|
-
return new o.Raycaster(t.camera.position, e);
|
|
751
|
-
}
|
|
752
|
-
}, [t, i]);
|
|
753
|
-
return e.useLayoutEffect(() => {
|
|
754
|
-
if (r) return t.on("cameraUpdate", () => a(Symbol()));
|
|
755
|
-
}, [t]), [s, i];
|
|
756
|
-
}
|
|
757
|
-
function le(t, n) {
|
|
758
|
-
let r = G("modelReadyState", n), [i, a] = e.useState(Symbol()), o = e.useMemo(() => {
|
|
759
|
-
if (r) return t.model.empty ? "Empty" : "Loaded";
|
|
760
|
-
}, [t, i]);
|
|
761
|
-
return e.useLayoutEffect(() => {
|
|
762
|
-
if (r) return t.on("modelLoaded", () => a(Symbol()));
|
|
763
|
-
}, [t]), [o, i];
|
|
764
|
-
}
|
|
765
|
-
function ue(t, n) {
|
|
766
|
-
let r = G("shownFloor", n), [i, a] = e.useState(Symbol()), o = e.useMemo(() => {
|
|
767
|
-
if (r) return t.model.shownFloor;
|
|
768
|
-
}, [t, i]);
|
|
769
|
-
return e.useLayoutEffect(() => {
|
|
770
|
-
if (r) return t.on("modelShownFloorChange", () => a(Symbol()));
|
|
771
|
-
}, [t]), [o, i];
|
|
772
|
-
}
|
|
773
|
-
function de(t, n) {
|
|
774
|
-
let r = G("helperVisible", n), [i, a] = e.useState(Symbol()), o = e.useMemo(() => {
|
|
775
|
-
if (r) return t.helperVisible;
|
|
776
|
-
}, [t, i]);
|
|
777
|
-
return e.useLayoutEffect(() => {
|
|
778
|
-
if (r) return t.on("helpersVisibleChange", () => a(Symbol()));
|
|
779
|
-
}, [t]), [o, i];
|
|
780
|
-
}
|
|
781
|
-
function fe(e, t) {
|
|
782
|
-
if (G("loadWork", t)) return e;
|
|
783
|
-
}
|
|
784
|
-
function pe(e, t) {
|
|
785
|
-
if (G("setState", t)) return (...t) => e.setState(...t);
|
|
786
|
-
}
|
|
787
|
-
function me(e, t) {
|
|
788
|
-
if (G("on", t)) return (...t) => e.on(...t);
|
|
789
|
-
}
|
|
790
|
-
function he(e, t) {
|
|
791
|
-
if (G("on", t)) return (...t) => e.once(...t);
|
|
792
|
-
}
|
|
793
|
-
function ge(e, t) {
|
|
794
|
-
if (G("off", t)) return (...t) => e.off(...t);
|
|
795
|
-
}
|
|
796
|
-
function _e(e, t) {
|
|
797
|
-
if (G("intersectRaycaster", t)) return (...t) => e.model.intersectRaycaster(...t);
|
|
798
|
-
}
|
|
799
|
-
function ve(e, t) {
|
|
800
|
-
if (G("project2d", t)) return (...t) => e.project2d(...t);
|
|
801
|
-
}
|
|
802
|
-
function ye(e, t) {
|
|
803
|
-
if (G("updateCamera", t)) return (...t) => e.updateCamera(...t);
|
|
804
|
-
}
|
|
805
|
-
function be(e, t) {
|
|
806
|
-
if (G("getPixels", t)) return e.getPixels.bind(e);
|
|
807
|
-
}
|
|
808
|
-
function xe(e, t) {
|
|
809
|
-
if (G("render", t)) return (...t) => e.render(...t);
|
|
810
|
-
}
|
|
811
|
-
function Se(e, t) {
|
|
812
|
-
if (G("needsRender", t)) return () => {
|
|
813
|
-
e.needsRender = !0;
|
|
814
|
-
};
|
|
815
|
-
}
|
|
816
|
-
function Z(e, t) {
|
|
817
|
-
if (G("preloadPano", t)) return (...t) => e.preloadPano(...t);
|
|
818
|
-
}
|
|
819
|
-
function Ce(e, t) {
|
|
820
|
-
if (G("showFloor", t)) return (t) => {
|
|
821
|
-
typeof t == "number" ? e.model.show(t) : e.model.show();
|
|
822
|
-
};
|
|
823
|
-
}
|
|
824
|
-
function we(e, t) {
|
|
825
|
-
if (G("toggleHelperVisible", t)) return (t) => {
|
|
826
|
-
e.helperVisible = t;
|
|
827
|
-
};
|
|
828
|
-
}
|
|
829
|
-
function Te(t) {
|
|
830
|
-
return function(n) {
|
|
831
|
-
return e.forwardRef((r, i) => {
|
|
832
|
-
let a = c(), o = l(), [s] = X(a, t), [u, d] = q(a, t), [f, p] = J(a, t), [m, h] = Y(a, t), [g, _] = ie(a, t), [v, y] = ae(a, t), [b] = oe(a, t), [x, S] = se(a, t), [C, w] = ce(a, t), [T, E] = le(a, t), [D, O] = ue(a, t), [k, A] = de(a, t), j = e.useMemo(() => {
|
|
833
|
-
let e = {};
|
|
834
|
-
return K(e, {
|
|
835
|
-
setState: pe(a, t),
|
|
836
|
-
loadWork: fe(o, t),
|
|
837
|
-
on: me(a, t),
|
|
838
|
-
once: he(a, t),
|
|
839
|
-
off: ge(a, t),
|
|
840
|
-
intersectRaycaster: _e(a, t),
|
|
841
|
-
project2d: ve(a, t),
|
|
842
|
-
updateCamera: ye(a, t),
|
|
843
|
-
getPixels: be(a, t),
|
|
844
|
-
render: xe(a, t),
|
|
845
|
-
needsRender: Se(a, t),
|
|
846
|
-
preloadPano: Z(a, t),
|
|
847
|
-
showFloor: Ce(a, t),
|
|
848
|
-
toggleHelperVisible: we(a, t)
|
|
849
|
-
}), e;
|
|
850
|
-
}, [a, o]), M = e.useMemo(() => {
|
|
851
|
-
let e = Object.assign({}, j);
|
|
852
|
-
return K(e, {
|
|
853
|
-
unsafe__fiveInstance: s,
|
|
854
|
-
state: u,
|
|
855
|
-
currentState: f,
|
|
856
|
-
currentObserver: m,
|
|
857
|
-
work: g,
|
|
858
|
-
model: v,
|
|
859
|
-
scene: b,
|
|
860
|
-
cameraDirection: x,
|
|
861
|
-
cameraRaycaster: C,
|
|
862
|
-
modelReadyState: T,
|
|
863
|
-
shownFloor: D,
|
|
864
|
-
helperVisible: k
|
|
865
|
-
}), e;
|
|
866
|
-
}, [
|
|
867
|
-
a,
|
|
868
|
-
j,
|
|
869
|
-
d,
|
|
870
|
-
p,
|
|
871
|
-
h,
|
|
872
|
-
_,
|
|
873
|
-
y,
|
|
874
|
-
S,
|
|
875
|
-
w,
|
|
876
|
-
E,
|
|
877
|
-
O,
|
|
878
|
-
A
|
|
879
|
-
]);
|
|
880
|
-
return e.createElement(n, Object.assign({
|
|
881
|
-
ref: i,
|
|
882
|
-
$five: M
|
|
883
|
-
}, r));
|
|
884
|
-
});
|
|
885
|
-
};
|
|
886
|
-
}
|
|
887
|
-
function Ee(...e) {
|
|
888
|
-
return e;
|
|
889
|
-
}
|
|
890
|
-
//#endregion
|
|
891
|
-
//#region build/react/createStore.js
|
|
892
|
-
function Q(e, t) {
|
|
893
|
-
let n = {}, r = t.length, i = -1;
|
|
894
|
-
for (; ++i < r;) {
|
|
895
|
-
let r = t[i];
|
|
896
|
-
r in e && (n[r] = e[r]);
|
|
897
|
-
}
|
|
898
|
-
return n;
|
|
899
|
-
}
|
|
900
|
-
function De(e, t) {
|
|
901
|
-
return typeof e == "number" && typeof t == "number" && isNaN(e) && isNaN(t) ? !0 : e === t;
|
|
902
|
-
}
|
|
903
|
-
function Oe(e, t) {
|
|
904
|
-
for (let n = 0; n < e.length; n++) for (let r = 0; r < t.length; r++) if (e[n] === t[r]) return !0;
|
|
905
|
-
return !1;
|
|
906
|
-
}
|
|
907
|
-
var $ = class {
|
|
908
|
-
constructor(e, t) {
|
|
909
|
-
this.values = e, this.listeners = [], this.onValuesChange = t;
|
|
910
|
-
}
|
|
911
|
-
on(e, t) {
|
|
912
|
-
let n = [e, t];
|
|
913
|
-
return this.listeners.push(n), () => {
|
|
914
|
-
let e = this.listeners.indexOf(n);
|
|
915
|
-
e >= 0 && this.listeners.splice(e, 1);
|
|
916
|
-
};
|
|
917
|
-
}
|
|
918
|
-
getValues(e) {
|
|
919
|
-
return Q(this.values, e);
|
|
920
|
-
}
|
|
921
|
-
setValues(e, t) {
|
|
922
|
-
let n = [];
|
|
923
|
-
for (let r in t) e.indexOf(r) >= 0 && !De(t[r], this.values[r]) && n.push(r);
|
|
924
|
-
if (n.length === 0) return;
|
|
925
|
-
let r = Object.assign({}, this.values);
|
|
926
|
-
for (let e of n) this.values[e] = t[e];
|
|
927
|
-
this.onValuesChange && this.onValuesChange(this.values, r);
|
|
928
|
-
for (let [e, t] of this.listeners) {
|
|
929
|
-
if (!Oe(e, n)) continue;
|
|
930
|
-
let i = Q(r, e);
|
|
931
|
-
t(Q(this.values, e), i);
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
};
|
|
935
|
-
function ke(t) {
|
|
936
|
-
let n = e.createContext(null);
|
|
937
|
-
return {
|
|
938
|
-
useStore(t) {
|
|
939
|
-
let r = e.useContext(n);
|
|
940
|
-
if (r === null) throw Error("StoreProvider never found.");
|
|
941
|
-
let i = e.useRef(!0), [a, o] = e.useState(r.getValues(t)), s = [r, ...t];
|
|
942
|
-
return e.useLayoutEffect(() => (i.current ? i.current = !1 : o(r.getValues(t)), r.on(t, (e) => o(e))), s), [a, e.useCallback((e) => r.setValues(t, e), s)];
|
|
943
|
-
},
|
|
944
|
-
useStoreSetter(t) {
|
|
945
|
-
let r = e.useContext(n);
|
|
946
|
-
if (r === null) throw Error("StoreProvider never found.");
|
|
947
|
-
return e.useCallback((e) => r.setValues(t, e), [r, ...t]);
|
|
948
|
-
},
|
|
949
|
-
watchStore(t, r, i) {
|
|
950
|
-
let a = e.useContext(n);
|
|
951
|
-
if (a === null) throw Error("StoreProvider never found.");
|
|
952
|
-
let o = [a, ...t];
|
|
953
|
-
i !== void 0 && (o = o.concat(i)), e.useLayoutEffect(() => a.on(t, r), o);
|
|
954
|
-
},
|
|
955
|
-
useStoreAction(r) {
|
|
956
|
-
let i = e.useContext(n);
|
|
957
|
-
if (i === null) throw Error("StoreProvider never found.");
|
|
958
|
-
return e.useCallback((...e) => {
|
|
959
|
-
let [n, ...a] = t[r];
|
|
960
|
-
return n(() => i.getValues(a), (e) => i.setValues(a, e), ...e);
|
|
961
|
-
}, []);
|
|
962
|
-
},
|
|
963
|
-
StoreProvider: class extends e.Component {
|
|
964
|
-
constructor(e) {
|
|
965
|
-
super(e), this.store = new $(e.initialValue, (...e) => {
|
|
966
|
-
this.props.onValuesChange && this.props.onValuesChange(...e);
|
|
967
|
-
});
|
|
968
|
-
}
|
|
969
|
-
shouldComponentUpdate(e) {
|
|
970
|
-
return e.children !== this.props.children;
|
|
971
|
-
}
|
|
972
|
-
render() {
|
|
973
|
-
return e.createElement(n.Provider, { value: this.store }, this.props.children);
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
};
|
|
977
|
-
}
|
|
978
|
-
//#endregion
|
|
979
|
-
export { y as FiveApp, h as FiveAutoCanvas, m as FiveCanvas, W as INJECTION_PROPNAME, $ as Store, Ee as createFiveFeature, d as createFiveProvider, ke as createStore, ne as getPlugin, re as setPlugin, b as unsafe__useFiveInstance, k as useFiveAction, P as useFiveCameraDirection, M as useFiveCameraRaycaster, D as useFiveCurrentObserver, E as useFiveCurrentState, O as useFiveEventCallback, H as useFiveFloor, U as useFiveHelper, ee as useFiveModelIntersectRaycaster, I as useFiveModelReadyState, V as useFivePlugin, A as useFiveProject2d, S as useFiveScene, x as useFiveSceneEffect, T as useFiveState, C as useFiveWork, Te as withFive };
|
|
338
|
+
*/import*as React from"react";import{useCallback,useEffect,useRef,useState}from"react";import{Five}from"@realsee/five-webgpu";import*as THREE from"three/webgpu";var FiveContext=React.createContext(null);function useFiveInstance(){let context=React.useContext(FiveContext);if(!context)throw Error(`FiveProvider never found.`);return context.five}function useFiveWorkLoader(){let context=React.useContext(FiveContext);if(!context)throw Error(`FiveProvider never found.`);return context.loadWork}function workEqual(work1,work2){let work1Array=Array.isArray(work1)?work1:[work1],work2Array=Array.isArray(work2)?work2:[work2];if(work1Array.length!==work2Array.length)return!1;for(let i=0;i<work1Array.length;i++)if(work1Array[i].workCode!==work2Array[i].workCode)return!1;return!0}function createFiveProvider(fiveInitArgs={}){return class extends React.Component{constructor(props){super(props),this.__fiveEventDisposers=[],this.__fiveDisposeTimer=null,this.five=new Five(Object.assign({},fiveInitArgs)),this.loadWork=this.loadWork.bind(this),this.state={renderer:this.five.renderer}}loadWork(works,state,options,userAction=!0){if(this.props.work)throw Error(`props 'works' is set in fiveProvider, if you need modify work internal, use 'initialWork' instead.`);return this.five.load(works,state,options,userAction)}shouldComponentUpdate(nextProps){return this.five.renderer&&this.five&&nextProps.work&&!workEqual(nextProps.work,this.five.works)&&this.five.load(nextProps.work,nextProps.initialState,nextProps.initialOptions),!0}componentDidMount(){var _a;clearTimeout(this.__fiveDisposeTimer),this.__fiveDisposeTimer=null,this.state.renderer!==this.five.renderer&&this.setState({renderer:this.five.renderer}),this.__fiveEventDisposers.push(this.five.on(`load`,()=>{this.props.onWorksChange&&this.props.onWorksChange(this.five.works)})),this.__fiveEventDisposers.push(this.five.on(`stateChange`,(state,userAction)=>{this.props.onStateChange&&this.props.onStateChange(state,userAction)})),this.__fiveEventDisposers.push(this.five.on(`currentStateChange`,(state,userAction)=>{this.props.onCurrentStateChange&&this.props.onCurrentStateChange(state,userAction)})),this.__fiveEventDisposers.push(this.five.on(`error`,error=>{this.props.onError?this.props.onError(error):console.warn(error.message)}));let inputWork=this.props.work||this.props.initialWork;inputWork&&this.five.load(inputWork,this.props.initialState,this.props.initialOptions,(_a=this.props.initialUserAction)==null?!0:_a)}componentWillUnmount(){var _a;for(let dispose of this.__fiveEventDisposers)dispose();this.__fiveEventDisposers=[],(_a=this.five.controller)==null||_a.destroy(),this.__fiveDisposeTimer=setTimeout(()=>{this.__fiveDisposeTimer=null,this.five.dispose()},1e3)}render(){let five=this.five,loadWork=this.loadWork,renderer=this.state.renderer;return React.createElement(FiveContext.Provider,{value:{renderer,five,loadWork}},this.props.children)}}}var useIsomorphicLayoutEffect=typeof window<`u`?React.useLayoutEffect:React.useEffect,baseStyle={display:`inline-block`,overflow:`hidden`},FiveCanvas=({width,height})=>{let five=useFiveInstance(),containerRef=React.createRef(),style=Object.assign({width,height},baseStyle);return useIsomorphicLayoutEffect(()=>{let node=containerRef.current;if(!node||!five.renderer)return;let canvas=five.renderer.domElement;if(canvas.parentNode!==null&&canvas.parentNode!==node)throw Error(`There are more than 2 fiveCanvas in this context.`);return canvas.parentNode!==node&&node.appendChild(canvas),five.camera.aspect=width/height,five.camera.updateProjectionMatrix(),five.renderer.setSize(width,height),five.refresh({width,height}),five.needsRender=!0,()=>{canvas.parentNode===node&&node.removeChild(canvas)}},[five,five.renderer,width,height,containerRef.current]),React.createElement(`div`,{ref:containerRef,style})},FiveAutoCanvas=({children})=>{let five=useFiveInstance(),containerRef=React.useRef(null);return React.useEffect(()=>{let node=containerRef.current;if(!node||!five.renderer)return;let canvas=five.renderer.domElement;node.appendChild(canvas);let onResize=()=>{var _a;let{width,height}=node.getBoundingClientRect();width===0||height===0||(five.camera.aspect=width/height,five.camera.updateProjectionMatrix(),(_a=five.renderer)==null||_a.setSize(width,height),five.refresh({width,height}),five.needsRender=!0)},sizeObserver=new ResizeObserver(onResize);return sizeObserver.observe(node),onResize(),()=>{canvas.parentNode===node&&node.removeChild(canvas),sizeObserver.unobserve(node),sizeObserver.disconnect()}},[]),React.createElement(`div`,{ref:containerRef,style:{position:`absolute`,top:0,left:0,right:0,bottom:0}},children)},FiveInstanceWrapper=({renderChildren,load,children,fallback})=>{let context=React.useContext(FiveContext),five=context==null?void 0:context.five,[ready,setReady]=React.useState(!!renderChildren),[worksLoaded,setWorksLoaded]=React.useState(!1);return React.useEffect(()=>{five&&five.getElement()&&(setReady(!0),load&&load(five).then(loadArgs=>{five.load(...loadArgs)}))},[five]),React.useEffect(()=>{if(!five)return;let onLoad=()=>setWorksLoaded(!0);return five.on(`works.load`,onLoad),five.works&&five.works.length>0&&setWorksLoaded(!0),()=>{five.off(`works.load`,onLoad)}},[five]),!five||!worksLoaded&&!renderChildren||!ready?fallback==null?null:React.createElement(React.Fragment,null,fallback):React.createElement(React.Fragment,null,children)},fullscreenStyle={position:`relative`,width:`100vw`,height:`100vh`,overflow:`hidden`},defaultFiveInitArgs={backgroundAlpha:1,backgroundColor:0,imageOptions:{size:512},textureOptions:{autoResize:!1},preserveDrawingBuffer:!0},FiveApp=({fiveInitArgs=defaultFiveInitArgs,renderChildren,plugins,load,children,fullscreen,autoCanvas=!0,fallback})=>{let[Provider]=React.useState(()=>createFiveProvider(Object.assign(Object.assign({},fiveInitArgs),{plugins}))),innerChildren=[];autoCanvas&&innerChildren.push(React.createElement(FiveAutoCanvas,{key:`auto-canvas`})),children&&innerChildren.push(children);let content=React.createElement(Provider,null,React.createElement(FiveInstanceWrapper,{load,renderChildren,fallback},...innerChildren));return fullscreen?React.createElement(`div`,{style:fullscreenStyle},content):content};function unsafe__useFiveInstance(){return useFiveInstance()}function useFiveSceneEffect(callback,deps){let five=useFiveInstance(),dependencyList=[five];deps!==void 0&&(dependencyList=dependencyList.concat(deps)),React.useLayoutEffect(()=>callback(five.scene),dependencyList)}var useFiveScene=useFiveSceneEffect;function useFiveWork(){let five=useFiveInstance(),loadWork=useFiveWorkLoader(),[works,updateWorks]=React.useState(()=>five.works);return React.useLayoutEffect(()=>five.on(`load`,()=>updateWorks(five.works)),[five]),[works,loadWork]}function getState(five){return Object.assign({},five.state)}function useFiveState(){let five=useFiveInstance(),[state,updateState]=React.useState(()=>getState(five)),setState=React.useCallback((state,immediately=!1,userAction=!0)=>{let nextState=typeof state==`function`?state(five.getCurrentState()):state;five.setState(nextState,immediately,userAction)},[five]);return React.useLayoutEffect(()=>five.on(`stateChange`,()=>updateState(getState(five))),[five]),[state,setState]}function useFiveCurrentState(){let five=useFiveInstance(),[currentState,updateCurrentState]=React.useState(()=>five.getCurrentState()),setState=React.useCallback((state,immediately=!1,userAction=!0)=>{let nextState=typeof state==`function`?state(five.getCurrentState()):state;five.setState(nextState,immediately,userAction)},[five]);return React.useLayoutEffect(()=>five.on(`currentStateChange`,()=>updateCurrentState(five.getCurrentState())),[five]),[currentState,setState]}function useFiveCurrentObserver(){let five=useFiveInstance(),[currentState,updateCurrentState]=React.useState(()=>five.getCurrentState());return React.useLayoutEffect(()=>five.on(`currentStateChange`,()=>updateCurrentState(five.getCurrentState())),[five]),five.works.getObserver(currentState)}function useFiveEventCallback(name,callback,deps){let five=useFiveInstance(),dependencyList=[five,name];deps!==void 0&&(dependencyList=dependencyList.concat(deps)),React.useLayoutEffect(()=>five.on(name,callback),dependencyList)}function useFiveAction(){let five=useFiveInstance();return{updateCamera:React.useCallback((pose,duration)=>five.updateCamera(pose,duration),[five]),getPixels:React.useCallback(five.getPixels.bind(five),[five]),render:React.useCallback(callback=>five.render(callback),[five]),needsRender:React.useCallback(()=>five.needsRender=!0,[five]),preloadPano:React.useCallback((pano,callback)=>five.preloadPano(pano,callback),[five])}}function useFiveProject2d(){let five=useFiveInstance(),[_,upadte]=React.useState(()=>Symbol());return React.useLayoutEffect(()=>five.on(`cameraUpdate`,()=>upadte(Symbol())),[five]),React.useCallback((vector,testModel)=>five.project2d(vector,testModel),[five])}function getRaycaster(five){let direction=five.camera.getWorldDirection(new THREE.Vector3);return new THREE.Raycaster(five.camera.position,direction)}function useFiveCameraRaycaster(){let five=useFiveInstance(),[raycaster,updateRaycaster]=React.useState(()=>getRaycaster(five));return React.useLayoutEffect(()=>five.on(`cameraUpdate`,()=>updateRaycaster(getRaycaster(five))),[five]),raycaster}function getDirection(five){return five.camera.getWorldDirection(new THREE.Vector3)}function useFiveCameraDirection(){let five=useFiveInstance(),[direction,updateDirection]=React.useState(()=>getDirection(five));return React.useLayoutEffect(()=>five.on(`cameraUpdate`,()=>updateDirection(getDirection(five))),[five]),direction}function useFiveModelIntersectRaycaster(){let five=useFiveInstance();return React.useCallback(raycaster=>five.model.intersectRaycaster(raycaster),[five])}function getReadyState(five){return five.model.empty?`Empty`:`Loaded`}function useFiveModelReadyState(){let five=useFiveInstance(),[readyState,updateReadyState]=React.useState(()=>getReadyState(five));return React.useLayoutEffect(()=>five.on(`modelLoaded`,()=>updateReadyState(getReadyState(five))),[five]),readyState}var pluginMap=new Map,listeners=new Map;function notify(workCode){let set=listeners.get(workCode);set&&set.forEach(fn=>fn())}function subscribe(workCode,fn){return listeners.has(workCode)||listeners.set(workCode,new Set),listeners.get(workCode).add(fn),()=>{let set=listeners.get(workCode);set&&(set.delete(fn),set.size===0&&listeners.delete(workCode))}}function getCacheKey(workCode,pluginName){return`${workCode}:${pluginName}`}function getPlugin(workCode,pluginName){var _a;return(_a=pluginMap.get(getCacheKey(workCode,pluginName)))==null?void 0:_a.plugin}function setPlugin(workCode,pluginName,plugin){pluginMap.set(getCacheKey(workCode,pluginName),{plugin}),notify(workCode)}function useFivePlugin(pluginName,options){var _a,_b;let five=useFiveInstance(),workCode=(_b=(_a=five.work)==null?void 0:_a.workCode)==null?``:_b,cacheKey=getCacheKey(workCode,pluginName),prevFiveRef=useRef(five),[,forceUpdate]=useState(0);return useEffect(()=>{if(workCode)return subscribe(workCode,()=>forceUpdate(n=>n+1))},[workCode]),useEffect(()=>{if(prevFiveRef.current===five)return;prevFiveRef.current=five;let cached=pluginMap.get(cacheKey);if(!cached)return;let plugin=cached.plugin;if(options!=null&&options.reCreateOnFiveChange&&options.createPlugin){typeof plugin.dispose==`function`&&plugin.dispose();let newPlugin=options.createPlugin(five);pluginMap.set(cacheKey,{plugin:newPlugin}),five.plugins[pluginName]=newPlugin,notify(workCode)}else plugin&&(typeof plugin.updateFive==`function`?plugin.updateFive(five):`five`in plugin&&(plugin.five=five))},[five]),useCallback(()=>{let cached=pluginMap.get(cacheKey);if(cached)return five.plugins[pluginName]=cached.plugin,cached.plugin;let existing=five.plugins[pluginName];if(existing)return pluginMap.set(cacheKey,{plugin:existing}),existing;if(options!=null&&options.createPlugin){let plugin=options.createPlugin(five);return pluginMap.set(cacheKey,{plugin}),five.plugins[pluginName]=plugin,notify(workCode),plugin}},[cacheKey,five,options==null?void 0:options.createPlugin])()}function useFiveFloor(){let five=useFiveInstance(),[shownFloor,updateShownFloor]=React.useState(five.model.shownFloor),[totalFloorLength,updateTotalFloorLength]=React.useState(five.model.floorLength),showFloor=React.useCallback(floorIndex=>{typeof floorIndex==`number`?five.model.show(floorIndex):five.model.show()},[five]);return React.useLayoutEffect(()=>{let off=[];return off.push(five.on(`modelShownFloorChange`,()=>updateShownFloor(five.model.shownFloor))),off.push(five.on(`modelLoaded`,()=>updateTotalFloorLength(five.model.floorLength))),()=>{let callback;for(;callback=off.shift();)callback()}},[five]),[shownFloor,totalFloorLength,showFloor]}function useFiveHelper(){let five=useFiveInstance(),[helperVisible,updateHelperVisible]=React.useState(five.helperVisible),toggleHelperVisible=React.useCallback(visible=>{five.helperVisible=visible},[five]);return React.useLayoutEffect(()=>five.on(`helpersVisibleChange`,visible=>updateHelperVisible(visible)),[five]),[helperVisible,toggleHelperVisible]}var INJECTION_PROPNAME=`$five`;function hasFeature(feature,features){return features.indexOf(feature)>=0}function injectObject(object,assign){for(let name of Object.keys(assign))assign[name]!==void 0&&(object[name]=assign[name])}function useFiveState$1(five,features){let enable=hasFeature(`state`,features),[updated,update]=React.useState(Symbol()),state=React.useMemo(()=>{if(enable)return Object.assign({},five.state)},[five,updated]);return React.useLayoutEffect(()=>{if(enable)return five.on(`stateChange`,()=>update(Symbol()))},[five]),[state,updated]}function useFiveCurrentState$1(five,features){let enable=hasFeature(`currentState`,features),[updated,update]=React.useState(Symbol()),currentState=React.useMemo(()=>{if(enable)return five.getCurrentState()},[five,updated]);return React.useLayoutEffect(()=>{if(enable)return five.on(`currentStateChange`,()=>update(Symbol()))},[five]),[currentState,updated]}function useFivecurrentObserver(five,features){let enable=hasFeature(`currentObserver`,features),[updated,update]=React.useState(Symbol()),currentState=React.useMemo(()=>{if(enable)return five.getCurrentState()},[five,updated]);React.useLayoutEffect(()=>{if(enable)return five.on(`currentStateChange`,()=>update(Symbol()))},[five]);let observer;return currentState&&(observer=five.works.getObserver(currentState)),[observer,updated]}function useUnsafe__fiveInstance(five,features){return[hasFeature(`unsafe__fiveInstance`,features)?five:void 0]}function useFiveWork$1(five,features){let enable=hasFeature(`works`,features),[updated,update]=React.useState(Symbol()),work=React.useMemo(()=>{if(enable)return five.works},[five,updated]);return React.useLayoutEffect(()=>{if(enable)return five.on(`load`,()=>update(Symbol()))},[five]),[work,updated]}function useFiveModel(five,features){let enable=hasFeature(`model`,features),[updated,update]=React.useState(Symbol()),model=React.useMemo(()=>{if(enable)return five.model},[five,updated]);return React.useLayoutEffect(()=>{if(enable)return five.on(`modelLoaded`,()=>update(Symbol()))},[five]),[model,updated]}function useFiveScene$1(five,features){return[hasFeature(`scene`,features)?five.scene:void 0]}function useFiveCameraDirection$1(five,features){let enable=hasFeature(`cameraDirection`,features),[updated,update]=React.useState(Symbol()),cameraDirection=React.useMemo(()=>{if(enable)return five.camera.getWorldDirection(new THREE.Vector3)},[five,updated]);return React.useLayoutEffect(()=>{if(enable)return five.on(`cameraUpdate`,()=>update(Symbol()))},[five]),[cameraDirection,updated]}function useFiveCameraRaycaster$1(five,features){let enable=hasFeature(`cameraRaycaster`,features),[updated,update]=React.useState(Symbol()),cameraRaycaster=React.useMemo(()=>{if(enable){let direction=five.camera.getWorldDirection(new THREE.Vector3);return new THREE.Raycaster(five.camera.position,direction)}},[five,updated]);return React.useLayoutEffect(()=>{if(enable)return five.on(`cameraUpdate`,()=>update(Symbol()))},[five]),[cameraRaycaster,updated]}function useFiveModelReadyState$1(five,features){let enable=hasFeature(`modelReadyState`,features),[updated,update]=React.useState(Symbol()),modelReadyState=React.useMemo(()=>{if(enable)return five.model.empty?`Empty`:`Loaded`},[five,updated]);return React.useLayoutEffect(()=>{if(enable)return five.on(`modelLoaded`,()=>update(Symbol()))},[five]),[modelReadyState,updated]}function useFiveShownFloor(five,features){let enable=hasFeature(`shownFloor`,features),[updated,update]=React.useState(Symbol()),shownFloor=React.useMemo(()=>{if(enable)return five.model.shownFloor},[five,updated]);return React.useLayoutEffect(()=>{if(enable)return five.on(`modelShownFloorChange`,()=>update(Symbol()))},[five]),[shownFloor,updated]}function useHelperVisible(five,features){let enable=hasFeature(`helperVisible`,features),[updated,update]=React.useState(Symbol()),helperVisible=React.useMemo(()=>{if(enable)return five.helperVisible},[five,updated]);return React.useLayoutEffect(()=>{if(enable)return five.on(`helpersVisibleChange`,()=>update(Symbol()))},[five]),[helperVisible,updated]}function useFiveLoadWork(loadWork,features){if(hasFeature(`loadWork`,features))return loadWork}function useFiveSetState(five,features){if(hasFeature(`setState`,features))return(...args)=>five.setState(...args)}function useFiveOn(five,features){if(hasFeature(`on`,features))return(...args)=>five.on(...args)}function useFiveOnce(five,features){if(hasFeature(`on`,features))return(...args)=>five.once(...args)}function useFiveOff(five,features){if(hasFeature(`off`,features))return(...args)=>five.off(...args)}function useFiveModelIntersectRaycaster$1(five,features){if(hasFeature(`intersectRaycaster`,features))return(...args)=>five.model.intersectRaycaster(...args)}function useFiveProject2d$1(five,features){if(hasFeature(`project2d`,features))return(...args)=>five.project2d(...args)}function useFiveUpdateCamera(five,features){if(hasFeature(`updateCamera`,features))return(...args)=>five.updateCamera(...args)}function useFiveGetPixels(five,features){if(hasFeature(`getPixels`,features))return five.getPixels.bind(five)}function useFiveRender(five,features){if(hasFeature(`render`,features))return(...args)=>five.render(...args)}function useFiveNeedsRender(five,features){if(hasFeature(`needsRender`,features))return()=>{five.needsRender=!0}}function useFivePreloadPano(five,features){if(hasFeature(`preloadPano`,features))return(...args)=>five.preloadPano(...args)}function useFiveShowFloor(five,features){if(hasFeature(`showFloor`,features))return floorIndex=>{typeof floorIndex==`number`?five.model.show(floorIndex):five.model.show()}}function useFiveToggleHelperVisible(five,features){if(hasFeature(`toggleHelperVisible`,features))return visible=>{five.helperVisible=visible}}function withFive(features){return function(Component){return React.forwardRef((props,ref)=>{let five=useFiveInstance(),loadWork=useFiveWorkLoader(),[unsafe__fiveInstance]=useUnsafe__fiveInstance(five,features),[state,stateUpdated]=useFiveState$1(five,features),[currentState,currentStateUpdated]=useFiveCurrentState$1(five,features),[currentObserver,currentObserverUpdated]=useFivecurrentObserver(five,features),[work,workUpdated]=useFiveWork$1(five,features),[model,modelUpdated]=useFiveModel(five,features),[scene]=useFiveScene$1(five,features),[cameraDirection,cameraDirectionUpdated]=useFiveCameraDirection$1(five,features),[cameraRaycaster,cameraRaycasterUpdated]=useFiveCameraRaycaster$1(five,features),[modelReadyState,modelReadyStateUpdated]=useFiveModelReadyState$1(five,features),[shownFloor,shownFloorUpdated]=useFiveShownFloor(five,features),[helperVisible,helperVisibleUpdated]=useHelperVisible(five,features),actions=React.useMemo(()=>{let injection={};return injectObject(injection,{setState:useFiveSetState(five,features),loadWork:useFiveLoadWork(loadWork,features),on:useFiveOn(five,features),once:useFiveOnce(five,features),off:useFiveOff(five,features),intersectRaycaster:useFiveModelIntersectRaycaster$1(five,features),project2d:useFiveProject2d$1(five,features),updateCamera:useFiveUpdateCamera(five,features),getPixels:useFiveGetPixels(five,features),render:useFiveRender(five,features),needsRender:useFiveNeedsRender(five,features),preloadPano:useFivePreloadPano(five,features),showFloor:useFiveShowFloor(five,features),toggleHelperVisible:useFiveToggleHelperVisible(five,features)}),injection},[five,loadWork]),injection=React.useMemo(()=>{let injection=Object.assign({},actions);return injectObject(injection,{unsafe__fiveInstance,state,currentState,currentObserver,work,model,scene,cameraDirection,cameraRaycaster,modelReadyState,shownFloor,helperVisible}),injection},[five,actions,stateUpdated,currentStateUpdated,currentObserverUpdated,workUpdated,modelUpdated,cameraDirectionUpdated,cameraRaycasterUpdated,modelReadyStateUpdated,shownFloorUpdated,helperVisibleUpdated]);return React.createElement(Component,Object.assign({ref,$five:injection},props))})}}function createFiveFeature(...features){return features}function pick(obj,keys){let res={},len=keys.length,idx=-1;for(;++idx<len;){let key=keys[idx];key in obj&&(res[key]=obj[key])}return res}function valueEquals(value1,value2){return typeof value1==`number`&&typeof value2==`number`&&isNaN(value1)&&isNaN(value2)?!0:value1===value2}function hasSameItemInBothStringArray(array1,array2){for(let i=0;i<array1.length;i++)for(let j=0;j<array2.length;j++)if(array1[i]===array2[j])return!0;return!1}var Store=class{constructor(initialValue,onValuesChange){this.values=initialValue,this.listeners=[],this.onValuesChange=onValuesChange}on(names,callback){let listener=[names,callback];return this.listeners.push(listener),()=>{let index=this.listeners.indexOf(listener);index>=0&&this.listeners.splice(index,1)}}getValues(names){return pick(this.values,names)}setValues(names,values){let modifyNames=[];for(let name in values)names.indexOf(name)>=0&&!valueEquals(values[name],this.values[name])&&modifyNames.push(name);if(modifyNames.length===0)return;let prevValue=Object.assign({},this.values);for(let name of modifyNames)this.values[name]=values[name];this.onValuesChange&&this.onValuesChange(this.values,prevValue);for(let[names,callback]of this.listeners){if(!hasSameItemInBothStringArray(names,modifyNames))continue;let prevValue_=pick(prevValue,names);callback(pick(this.values,names),prevValue_)}}};function createStore(actionHandler){let StoreContext=React.createContext(null);return{useStore(names){let store=React.useContext(StoreContext);if(store===null)throw Error(`StoreProvider never found.`);let firstUpdate=React.useRef(!0),[values,setValues_]=React.useState(store.getValues(names)),dependencyList=[store,...names];return React.useLayoutEffect(()=>(firstUpdate.current?firstUpdate.current=!1:setValues_(store.getValues(names)),store.on(names,value=>setValues_(value))),dependencyList),[values,React.useCallback(values=>store.setValues(names,values),dependencyList)]},useStoreSetter(names){let store=React.useContext(StoreContext);if(store===null)throw Error(`StoreProvider never found.`);return React.useCallback(values=>store.setValues(names,values),[store,...names])},watchStore(names,callback,deps){let store=React.useContext(StoreContext);if(store===null)throw Error(`StoreProvider never found.`);let dependencyList=[store,...names];deps!==void 0&&(dependencyList=dependencyList.concat(deps)),React.useLayoutEffect(()=>store.on(names,callback),dependencyList)},useStoreAction(actionName){let store=React.useContext(StoreContext);if(store===null)throw Error(`StoreProvider never found.`);return React.useCallback((...args)=>{let[callback,...deps]=actionHandler[actionName];return callback(()=>store.getValues(deps),values=>store.setValues(deps,values),...args)},[])},StoreProvider:class extends React.Component{constructor(props){super(props),this.store=new Store(props.initialValue,(...args)=>{this.props.onValuesChange&&this.props.onValuesChange(...args)})}shouldComponentUpdate(nextProps){return nextProps.children!==this.props.children}render(){return React.createElement(StoreContext.Provider,{value:this.store},this.props.children)}}}}export{FiveApp,FiveAutoCanvas,FiveCanvas,INJECTION_PROPNAME,Store,createFiveFeature,createFiveProvider,createStore,getPlugin,setPlugin,unsafe__useFiveInstance,useFiveAction,useFiveCameraDirection,useFiveCameraRaycaster,useFiveCurrentObserver,useFiveCurrentState,useFiveEventCallback,useFiveFloor,useFiveHelper,useFiveModelIntersectRaycaster,useFiveModelReadyState,useFivePlugin,useFiveProject2d,useFiveScene,useFiveSceneEffect,useFiveState,useFiveWork,withFive};
|