@realsee/five-webgpu 1.0.0-alpha.13 → 1.0.0-alpha.15
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 +9 -5
- package/docs/classes/index.PanoCircleMeshCustom.html +9 -5
- package/docs/classes/index.PanoCircleMeshSolid.html +9 -5
- 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.LooseWorkObserver.html +2 -2
- package/docs/interfaces/index.LooseWorkPanorama.html +2 -2
- 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 +8 -4
- package/docs/interfaces/index.PanoCircleMeshOptions.html +2 -2
- package/docs/interfaces/index.PanoCircleMeshSolidOptions.html +2 -2
- 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/controllers/panorama.d.ts +6 -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/meshes/panoCircleMesh.d.ts +1 -0
- package/five/meshes/panoCircleMeshCustom.d.ts +1 -0
- package/five/meshes/panoCircleMeshSolid.d.ts +1 -0
- package/five/meshes/panoSphereMesh.d.ts +1 -0
- 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/initTexture.d.ts +8 -0
- package/five/texture/videoTextureBridge.d.ts +124 -15
- package/five/thirdparty/sha256.d.ts +149 -0
- package/five/types/panoCircleMeshInterface.d.ts +6 -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/looseWorkType.d.ts +2 -2
- package/five/work/work.d.ts +1 -8
- package/five/work/workJsonType.d.ts +2 -4
- 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 +4 -4
- 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 +152 -190
- 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
|
@@ -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/4
|
|
5
|
+
* Version: 1.0.0-alpha.15
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +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
|
-
*/function
|
|
338
|
+
*/function nearlyEqual(x,y,precision=2){return Number(x.toFixed(precision))===Number(y.toFixed(precision))}function nearlyEqualRad(x,y,precision=2){let TWO_PI=Math.PI*2,normalize=rad=>(rad%TWO_PI+TWO_PI)%TWO_PI,nx=normalize(x),ny=normalize(y),diff=Math.min(Math.abs(nx-ny),TWO_PI-Math.abs(nx-ny));return Number(diff.toFixed(precision))===0}export{nearlyEqual,nearlyEqualRad};
|
|
@@ -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/4
|
|
5
|
+
* Version: 1.0.0-alpha.15
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +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
|
-
*/var
|
|
338
|
+
*/var Cell=class{constructor(x,y,h,polygon){this.x=x,this.y=y,this.h=h,this.d=pointToPolygonDist(x,y,polygon),this.max=this.d+this.h*Math.SQRT2}};function polylabel(polygon,precision=1){let minX=0,minY=0,maxX=0,maxY=0;for(let i=0;i<polygon[0].length;i++){let p=polygon[0][i];(!i||p[0]<minX)&&(minX=p[0]),(!i||p[1]<minY)&&(minY=p[1]),(!i||p[0]>maxX)&&(maxX=p[0]),(!i||p[1]>maxY)&&(maxY=p[1])}let width=maxX-minX,height=maxY-minY,cellSize=Math.min(width,height),h=cellSize/2;if(cellSize===0)return[minX,minY];let cellQueue=[];for(let x=minX;x<maxX;x+=cellSize)for(let y=minY;y<maxY;y+=cellSize)cellQueue.push(new Cell(x+h,y+h,h,polygon));let bestCell=getCentroidCell(polygon),bboxCell=new Cell(minX+width/2,minY+height/2,0,polygon);for(bboxCell.d>bestCell.d&&(bestCell=bboxCell);cellQueue.length;){cellQueue.sort((a,b)=>a.max-b.max);let cell=cellQueue.pop();cell.d>bestCell.d&&(bestCell=cell),!(cell.max-bestCell.d<=precision)&&(h=cell.h/2,cellQueue.push(new Cell(cell.x-h,cell.y-h,h,polygon)),cellQueue.push(new Cell(cell.x+h,cell.y-h,h,polygon)),cellQueue.push(new Cell(cell.x-h,cell.y+h,h,polygon)),cellQueue.push(new Cell(cell.x+h,cell.y+h,h,polygon)))}return[bestCell.x,bestCell.y]}function pointToPolygonDist(x,y,polygon){let inside=!1,minDistSq=1/0;for(let k=0;k<polygon.length;k++){let ring=polygon[k];for(let i=0,len=ring.length,j=len-1;i<len;j=i++){let a=ring[i],b=ring[j];a[1]>y!=b[1]>y&&x<(b[0]-a[0])*(y-a[1])/(b[1]-a[1])+a[0]&&(inside=!inside),minDistSq=Math.min(minDistSq,getSegDistSq(x,y,a,b))}}return(inside?1:-1)*Math.sqrt(minDistSq)}function getCentroidCell(polygon){let area=0,x=0,y=0,points=polygon[0];for(let i=0,len=points.length,j=len-1;i<len;j=i++){let a=points[i],b=points[j],f=a[0]*b[1]-b[0]*a[1];x+=(a[0]+b[0])*f,y+=(a[1]+b[1])*f,area+=f*3}return area===0?new Cell(points[0][0],points[0][1],0,polygon):new Cell(x/area,y/area,0,polygon)}function getSegDistSq(px,py,a,b){let x=a[0],y=a[1],dx=b[0]-x,dy=b[1]-y;if(dx!==0||dy!==0){let t=((px-x)*dx+(py-y)*dy)/(dx*dx+dy*dy);t>1?(x=b[0],y=b[1]):t>0&&(x+=dx*t,y+=dy*t)}return dx=px-x,dy=py-y,dx*dx+dy*dy}exports.polylabel=polylabel;
|
|
@@ -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/4
|
|
5
|
+
* Version: 1.0.0-alpha.15
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +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
|
-
*/var
|
|
338
|
+
*/var Cell=class{constructor(x,y,h,polygon){this.x=x,this.y=y,this.h=h,this.d=pointToPolygonDist(x,y,polygon),this.max=this.d+this.h*Math.SQRT2}};function polylabel(polygon,precision=1){let minX=0,minY=0,maxX=0,maxY=0;for(let i=0;i<polygon[0].length;i++){let p=polygon[0][i];(!i||p[0]<minX)&&(minX=p[0]),(!i||p[1]<minY)&&(minY=p[1]),(!i||p[0]>maxX)&&(maxX=p[0]),(!i||p[1]>maxY)&&(maxY=p[1])}let width=maxX-minX,height=maxY-minY,cellSize=Math.min(width,height),h=cellSize/2;if(cellSize===0)return[minX,minY];let cellQueue=[];for(let x=minX;x<maxX;x+=cellSize)for(let y=minY;y<maxY;y+=cellSize)cellQueue.push(new Cell(x+h,y+h,h,polygon));let bestCell=getCentroidCell(polygon),bboxCell=new Cell(minX+width/2,minY+height/2,0,polygon);for(bboxCell.d>bestCell.d&&(bestCell=bboxCell);cellQueue.length;){cellQueue.sort((a,b)=>a.max-b.max);let cell=cellQueue.pop();cell.d>bestCell.d&&(bestCell=cell),!(cell.max-bestCell.d<=precision)&&(h=cell.h/2,cellQueue.push(new Cell(cell.x-h,cell.y-h,h,polygon)),cellQueue.push(new Cell(cell.x+h,cell.y-h,h,polygon)),cellQueue.push(new Cell(cell.x-h,cell.y+h,h,polygon)),cellQueue.push(new Cell(cell.x+h,cell.y+h,h,polygon)))}return[bestCell.x,bestCell.y]}function pointToPolygonDist(x,y,polygon){let inside=!1,minDistSq=1/0;for(let k=0;k<polygon.length;k++){let ring=polygon[k];for(let i=0,len=ring.length,j=len-1;i<len;j=i++){let a=ring[i],b=ring[j];a[1]>y!=b[1]>y&&x<(b[0]-a[0])*(y-a[1])/(b[1]-a[1])+a[0]&&(inside=!inside),minDistSq=Math.min(minDistSq,getSegDistSq(x,y,a,b))}}return(inside?1:-1)*Math.sqrt(minDistSq)}function getCentroidCell(polygon){let area=0,x=0,y=0,points=polygon[0];for(let i=0,len=points.length,j=len-1;i<len;j=i++){let a=points[i],b=points[j],f=a[0]*b[1]-b[0]*a[1];x+=(a[0]+b[0])*f,y+=(a[1]+b[1])*f,area+=f*3}return area===0?new Cell(points[0][0],points[0][1],0,polygon):new Cell(x/area,y/area,0,polygon)}function getSegDistSq(px,py,a,b){let x=a[0],y=a[1],dx=b[0]-x,dy=b[1]-y;if(dx!==0||dy!==0){let t=((px-x)*dx+(py-y)*dy)/(dx*dx+dy*dy);t>1?(x=b[0],y=b[1]):t>0&&(x+=dx*t,y+=dy*t)}return dx=px-x,dy=py-y,dx*dx+dy*dy}export{polylabel};
|
|
@@ -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/4
|
|
5
|
+
* Version: 1.0.0-alpha.15
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +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
|
-
*/let
|
|
338
|
+
*/let tslib=require("tslib");function to(promise){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){try{return[null,yield promise]}catch(error){return error instanceof Error?[error,null]:[Error(String(error)),null]}})}exports.default=to,exports.to=to;
|
|
@@ -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/4
|
|
5
|
+
* Version: 1.0.0-alpha.15
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +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{__awaiter
|
|
338
|
+
*/import{__awaiter}from"tslib";function to(promise){return __awaiter(this,void 0,void 0,function*(){try{return[null,yield promise]}catch(error){return error instanceof Error?[error,null]:[Error(String(error)),null]}})}export{to as default,to};
|
|
@@ -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/4
|
|
5
|
+
* Version: 1.0.0-alpha.15
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +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
|
-
*/const e=require("../../_virtual/_rolldown/runtime.js"),t=require("../BasePlugin/index.js");let n=require("tslib"),r=require("@realsee/five-webgpu"),i=require("three/webgpu");i=e.__toESM(i,1);var a=class{constructor(e,t,n,r,i){this.R=e,this.Q=t,this.A=n,this.B=r,this.C=i,this.cov=NaN,this.x=NaN}filter(e,t=0){if(isNaN(this.x))this.x=1/this.C*e,this.cov=1/this.C*this.Q*(1/this.C);else{let n=this.A*this.x+this.B*t,r=this.A*this.cov*this.A+this.R,i=r*this.C*(1/(this.C*r*this.C+this.Q));this.x=n+i*(e-this.C*n),this.cov=r-i*this.C*r}return this.x}},o=class extends t.BasePlugin.Controller{updateState(e,t){let n=this.state;this.state=Object.assign(Object.assign({},this.state),e),this.hooks.emit(`stateChange`,{state:this.state,prevState:n,userAction:t})}constructor(e,t){var n,r,i;super(e),this.boundingAABB=null,this.cancelAnimation=null,this.boundsSet=!1,this.keyframes=[],this.five=e,this.state={enabled:!0,visible:!0},this.duration=(n=t==null?void 0:t.duration)==null?5e3:n,this.curveHeight=(r=t==null?void 0:t.curveHeight)==null?1.5:r,this.pointDuration=(i=t==null?void 0:t.pointDuration)==null?3e3:i}load(){return(0,n.__awaiter)(this,void 0,void 0,function*(){})}enable(e){var t;if(this.state.enabled)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n)}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n)}dispose(){this.disable(),this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null);try{let e=this.findRenderMesh();e&&(e.material.aggregationEnabled=!1,e.material.aggregationProgress=1)}catch(e){}}extractKeyframes(e){let t=[];if(!e.content.data)throw Error(`轨迹数据未加载`);let n=e.content.data.positionArray,r=n.length/3,o=.01,s=.1,c=new a(o,s,1,0,1),l=new a(o,s,1,0,1),u=new a(o,s,1,0,1),d=new Float32Array(r);for(let e=0;e<r;e++)if(e===0)d[e]=0;else{let t=new i.Vector3(n[(e-1)*3],n[(e-1)*3+1],n[(e-1)*3+2]);d[e]=new i.Vector3(n[e*3],n[e*3+1],n[e*3+2]).distanceTo(t)+d[e-1]}for(let a=0;a<r;a++){let o=new i.Vector3(0,0,0),s=0;for(let e=a-5;e<a+6;e++)e>=0&&e<r&&(o.add(new i.Vector3(n[e*3],n[e*3+1],n[e*3+2])),s++);o.divideScalar(s).applyMatrix4(e.transform);let f=c.filter(o.x),p=l.filter(o.y),m=u.filter(o.z);t.push({position:new i.Vector3(f,p,m),location:d[a]})}return t}computeAABB2D(e){let t=1/0,n=-1/0,r=1/0,a=-1/0;for(let i of e)i.position.x<t&&(t=i.position.x),i.position.x>n&&(n=i.position.x),i.position.z<r&&(r=i.position.z),i.position.z>a&&(a=i.position.z);return{min:new i.Vector2(t,r),max:new i.Vector2(n,a)}}findClosestKeyframeToRay(e,t){let n=1/0,r=t[0].position.clone(),a=new i.Vector3;for(let i of t){e.closestPointToPoint(i.position,a);let t=a.distanceTo(i.position);t<n&&(n=t,r=i.position.clone())}return r}isInitAnimationEnabled(){return this.five.modelScene.parameter.resolveValue(`enableGaussianSplattingInitAnimation`)===!0}findRenderMesh(){let e=null;if(this.five.scene.traverse(t=>{if(e)return;let n=t,r=n.material;r&&r.isPBMGaussianSplattingMaterial&&(e=n)}),!e)throw Error(`未找到 GaussianSplatting 渲染网格`);return e}loadTrajectoryDataIfNeeded(e){return(0,n.__awaiter)(this,void 0,void 0,function*(){var t,n,i,a,o,s,c,l;if((t=e.content)!=null&&t.data)return;if(((n=e.content)==null?void 0:n.loadState)===`LOADING`){yield new Promise(t=>{let n=r.AnimationFrameLoop.shared.add(()=>{var r;let i=(r=e.content)==null?void 0:r.loadState;(i===`READY`||i===`FAILED`||i===`UNLOADED`)&&(n(),t())})});return}let u=(i=this.five.model.viewLayers)==null?void 0:i[0],d=u==null?void 0:u.fetcher,f=u==null?void 0:u.search,p=(a=e.content)==null?void 0:a.uri;if(!d||!p)return;let m=f?p.includes(`?`)?`${p}&${f.replace(/^\?/,``)}`:`${p}${f.startsWith(`?`)?f:`?${f}`}`:p;e.content.loadState=`LOADING`;try{let t=yield(0,r.loadPly)(m,{type:`geometry`,customPropertyMapping:{time:{itemType:`uint32`,itemNames:[`time_milisec`]}},fetcher:d}),n=t.scene,i=n.getAttribute(`position`),a=n.getAttribute(`time`),u=(o=i==null?void 0:i.array)==null?new Float32Array:o,f=(s=a==null?void 0:a.array)==null?new Uint32Array:s;e.content.data={uri:m,byteLength:(c=t.byteLength)==null?0:c,memoryUsage:(l=t.memoryUsage)==null?0:l,positionArray:u,timeArray:f,object:null},e.content.loadState=`READY`}catch(t){console.warn(`[GaussianSplattingEntranceAnimationPlugin] trajectory ply 加载失败,将使用 3DGS AABB 回退`,t),e.content.data=void 0,e.content.loadState=`FAILED`}})}computeGSSceneBounds(){let e=new i.Box3,t=new i.Box3;return this.five.scene.traverse(n=>{let r=n;(r==null?void 0:r.boundingBox)instanceof i.Box3&&!r.boundingBox.isEmpty()&&(t.copy(r.boundingBox),r.matrixWorld&&t.applyMatrix4(r.matrixWorld),e.union(t))}),e.isEmpty()?null:e}getCameraCurve(){return(0,n.__awaiter)(this,void 0,void 0,function*(){var e,t,n,r,a,o,s,c,l,u;let d=(r=(n=(t=(e=this.five.model.viewLayers)==null?void 0:e[0])==null?void 0:t.trajectories)==null?void 0:n[0])==null?(c=(s=(o=(a=this.five.model.viewLayers)==null?void 0:a[0])==null?void 0:o.scene)==null?void 0:s.trajectories)==null?void 0:c[0]:r,f=null,p=null;if(d&&(yield this.loadTrajectoryDataIfNeeded(d),(l=d.content)!=null&&l.data&&((u=d.content.data.positionArray)==null?void 0:u.length)>=6&&(f=this.extractKeyframes(d),f.length>=2?p=this.computeAABB2D(f):f=null)),!f||!p){let e=this.computeGSSceneBounds();if(!e)throw Error(`未找到可用于计算入场曲线的 3DGS 边界或轨迹`);p={min:new i.Vector2(e.min.x,e.min.z),max:new i.Vector2(e.max.x,e.max.z)};let t=(p.min.x+p.max.x)/2,n=(p.min.y+p.max.y)/2,r=(e.min.y+e.max.y)/2,a=Math.max(p.max.x-p.min.x,p.max.y-p.min.y)*.5;f=[];let o=0,s=null;for(let e=0;e<16;e++){let c=e/16*Math.PI*2,l=new i.Vector3(t+Math.cos(c)*a,r,n+Math.sin(c)*a);s&&(o+=l.distanceTo(s)),f.push({position:l,location:o}),s=l}}this.keyframes=f,this.boundingAABB=p;let m=this.curveHeight,h=new i.Vector3((p.min.x+p.max.x)/2,m,(p.min.y+p.max.y)/2),g=(p.max.x-p.min.x)/2,_=(p.max.y-p.min.y)/2,v=Math.sqrt(g*g+_*_),y=e=>{let t=new i.Vector3().subVectors(e,h);return t.length()<.001&&t.set(1,0,0),h.clone().add(t.normalize().multiplyScalar(v))},b=new i.Vector3(f[0].position.x,m,f[0].position.z),x=y(b),S=new i.Vector3().subVectors(h,b).normalize(),C=new i.Ray(b,S),w=new i.Vector3(-S.z,0,S.x).normalize(),T=new i.Ray(h,w),E=this.findClosestKeyframeToRay(T,f),D=y(new i.Vector3(E.x,m,E.z)),O=this.findClosestKeyframeToRay(C,f),k=y(new i.Vector3(O.x,m,O.z));return new i.CatmullRomCurve3([x,D,k],!1,`centripetal`,.5)})}setBounding(e,t,n){let r=this.findRenderMesh();r.material.aggregationBoundsMin.copy(e),r.material.aggregationBoundsMax.copy(t),this.boundsSet=!0}setBounds(){if(!this.boundingAABB)throw Error(`请先调用 getCameraCurve 计算轨迹边界`);let e=this.boundingAABB,t=this.findRenderMesh(),n=new i.Vector3(e.min.x,0,e.min.y),r=new i.Vector3(e.max.x,3,e.max.y);t.material.aggregationBoundsMin.copy(n),t.material.aggregationBoundsMax.copy(r),this.boundsSet=!0}normalizedPointDuration(){let e=this.pointDuration;return e<=0?.01:Math.min(e<=1?e:e/this.duration,1)}resetToPointCloud(){return(0,n.__awaiter)(this,void 0,void 0,function*(){if(!this.isInitAnimationEnabled())return;this.boundingAABB||(yield this.getCameraCurve()),this.setBounds();let e=this.findRenderMesh().material;e.aggregationEnabled=!0,e.aggregationProgress=0,e.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0})}startAggregation(){if(!this.isInitAnimationEnabled()){console.warn(`[GaussianSplattingEntranceAnimationPlugin] modelScene.enableGaussianSplattingInitAnimation 为 false,已跳过聚合动画`);return}if(!this.boundsSet)throw Error(`请先调用 setBounds 设置聚合边界`);let e=this.findRenderMesh().material;e.aggregationEnabled=!0,e.aggregationProgress=0,e.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let t=performance.now(),n=this.duration;this.cancelAnimation=r.AnimationFrameLoop.shared.add(()=>{let r=performance.now()-t,i=Math.min(r/n,1);e.aggregationProgress=i*i*(3-2*i),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0,i>=1&&(e.aggregationEnabled=!1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null))})}playEntrance(){return(0,n.__awaiter)(this,void 0,void 0,function*(){if(!this.isInitAnimationEnabled()){console.warn(`[GaussianSplattingEntranceAnimationPlugin] modelScene.enableGaussianSplattingInitAnimation 为 false,已跳过入场动画`);return}let e=yield this.getCameraCurve(),t=this.boundingAABB,n=new i.Vector3((t.min.x+t.max.x)/2,this.curveHeight,(t.min.y+t.max.y)/2),a=e.getPointAt(0),o=new r.Camera(90).copy(this.five.camera);o.position.copy(a),o.lookAt(n),o.computePose(0),this.five.setState(Object.assign({},o.pose)),this.setBounds();let s=this.findRenderMesh().material;s.aggregationEnabled=!0,s.aggregationProgress=0,s.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let c=this.duration,l=performance.now();return new Promise(t=>{this.cancelAnimation=r.AnimationFrameLoop.shared.add(()=>{let r=performance.now()-l,i=Math.min(r/c,1),a=i*i*(3-2*i);s.aggregationProgress=a,this.five.modelSceneNeedsRender=!0;let u=e.getPointAt(a);o.position.copy(u),o.lookAt(n),o.computePose(0),this.five.setState(Object.assign({},o.pose)),this.five.needsRender=!0,i>=1&&(s.aggregationEnabled=!1,s.aggregationProgress=1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null),t())})})})}};exports.Controller=o;
|
|
338
|
+
*/const require_runtime=require("../../_virtual/_rolldown/runtime.js"),require_index=require("../BasePlugin/index.js");let tslib=require("tslib"),_realsee_five_webgpu=require("@realsee/five-webgpu"),three_webgpu=require("three/webgpu");three_webgpu=require_runtime.__toESM(three_webgpu,1);var KalmanFilter=class{constructor(R,Q,A,B,C){this.R=R,this.Q=Q,this.A=A,this.B=B,this.C=C,this.cov=NaN,this.x=NaN}filter(z,u=0){if(isNaN(this.x))this.x=1/this.C*z,this.cov=1/this.C*this.Q*(1/this.C);else{let predX=this.A*this.x+this.B*u,predCov=this.A*this.cov*this.A+this.R,K=predCov*this.C*(1/(this.C*predCov*this.C+this.Q));this.x=predX+K*(z-this.C*predX),this.cov=predCov-K*this.C*predCov}return this.x}},Controller=class extends require_index.BasePlugin.Controller{updateState(state,userAction){let prevState=this.state;this.state=Object.assign(Object.assign({},this.state),state),this.hooks.emit(`stateChange`,{state:this.state,prevState,userAction})}constructor(five,config){var _a,_b,_c;super(five),this.boundingAABB=null,this.cancelAnimation=null,this.boundsSet=!1,this.keyframes=[],this.five=five,this.state={enabled:!0,visible:!0},this.duration=(_a=config==null?void 0:config.duration)==null?5e3:_a,this.curveHeight=(_b=config==null?void 0:config.curveHeight)==null?1.5:_b,this.pointDuration=(_c=config==null?void 0:config.pointDuration)==null?3e3:_c}load(){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){})}enable(options){var _a;if(this.state.enabled)return;let userAction=(_a=options==null?void 0:options.userAction)==null?!0:_a;this.updateState({enabled:!0},userAction)}disable(options){var _a;if(this.state.enabled===!1)return;let userAction=(_a=options==null?void 0:options.userAction)==null?!0:_a;this.updateState({enabled:!1},userAction)}dispose(){this.disable(),this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null);try{let renderMesh=this.findRenderMesh();renderMesh&&(renderMesh.material.aggregationEnabled=!1,renderMesh.material.aggregationProgress=1)}catch(_){}}extractKeyframes(trajectory){let keyframes=[];if(!trajectory.content.data)throw Error(`轨迹数据未加载`);let points=trajectory.content.data.positionArray,numPoints=points.length/3,R=.01,Q=.1,kfX=new KalmanFilter(R,Q,1,0,1),kfY=new KalmanFilter(R,Q,1,0,1),kfZ=new KalmanFilter(R,Q,1,0,1),lineDistances=new Float32Array(numPoints);for(let i=0;i<numPoints;i++)if(i===0)lineDistances[i]=0;else{let prev=new three_webgpu.Vector3(points[(i-1)*3],points[(i-1)*3+1],points[(i-1)*3+2]);lineDistances[i]=new three_webgpu.Vector3(points[i*3],points[i*3+1],points[i*3+2]).distanceTo(prev)+lineDistances[i-1]}for(let i=0;i<numPoints;i++){let smoothPosition=new three_webgpu.Vector3(0,0,0),count=0;for(let j=i-5;j<i+6;j++)j>=0&&j<numPoints&&(smoothPosition.add(new three_webgpu.Vector3(points[j*3],points[j*3+1],points[j*3+2])),count++);smoothPosition.divideScalar(count).applyMatrix4(trajectory.transform);let x=kfX.filter(smoothPosition.x),y=kfY.filter(smoothPosition.y),z=kfZ.filter(smoothPosition.z);keyframes.push({position:new three_webgpu.Vector3(x,y,z),location:lineDistances[i]})}return keyframes}computeAABB2D(keyframes){let minX=1/0,maxX=-1/0,minZ=1/0,maxZ=-1/0;for(let kf of keyframes)kf.position.x<minX&&(minX=kf.position.x),kf.position.x>maxX&&(maxX=kf.position.x),kf.position.z<minZ&&(minZ=kf.position.z),kf.position.z>maxZ&&(maxZ=kf.position.z);return{min:new three_webgpu.Vector2(minX,minZ),max:new three_webgpu.Vector2(maxX,maxZ)}}findClosestKeyframeToRay(ray,keyframes){let closestDist=1/0,closestPos=keyframes[0].position.clone(),tmpVec=new three_webgpu.Vector3;for(let kf of keyframes){ray.closestPointToPoint(kf.position,tmpVec);let dist=tmpVec.distanceTo(kf.position);dist<closestDist&&(closestDist=dist,closestPos=kf.position.clone())}return closestPos}isInitAnimationEnabled(){return this.five.modelScene.parameter.resolveValue(`enableGaussianSplattingInitAnimation`)===!0}findRenderMesh(){let found=null;if(this.five.scene.traverse(object=>{if(found)return;let mesh=object,material=mesh.material;material&&material.isPBMGaussianSplattingMaterial&&(found=mesh)}),!found)throw Error(`未找到 GaussianSplatting 渲染网格`);return found}loadTrajectoryDataIfNeeded(trajectory){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){var _a,_b,_c,_d,_e,_f,_g,_h;if((_a=trajectory.content)!=null&&_a.data)return;if(((_b=trajectory.content)==null?void 0:_b.loadState)===`LOADING`){yield new Promise(resolve=>{let cancel=_realsee_five_webgpu.AnimationFrameLoop.shared.add(()=>{var _a;let s=(_a=trajectory.content)==null?void 0:_a.loadState;(s===`READY`||s===`FAILED`||s===`UNLOADED`)&&(cancel(),resolve())})});return}let viewLayer=(_c=this.five.model.viewLayers)==null?void 0:_c[0],fetcher=viewLayer==null?void 0:viewLayer.fetcher,search=viewLayer==null?void 0:viewLayer.search,uri=(_d=trajectory.content)==null?void 0:_d.uri;if(!fetcher||!uri)return;let url=search?uri.includes(`?`)?`${uri}&${search.replace(/^\?/,``)}`:`${uri}${search.startsWith(`?`)?search:`?${search}`}`:uri;trajectory.content.loadState=`LOADING`;try{let plyResult=yield(0,_realsee_five_webgpu.loadPly)(url,{type:`geometry`,customPropertyMapping:{time:{itemType:`uint32`,itemNames:[`time_milisec`]}},fetcher}),geometry=plyResult.scene,positionAttr=geometry.getAttribute(`position`),timeAttr=geometry.getAttribute(`time`),positionArray=(_e=positionAttr==null?void 0:positionAttr.array)==null?new Float32Array:_e,timeArray=(_f=timeAttr==null?void 0:timeAttr.array)==null?new Uint32Array:_f;trajectory.content.data={uri:url,byteLength:(_g=plyResult.byteLength)==null?0:_g,memoryUsage:(_h=plyResult.memoryUsage)==null?0:_h,positionArray,timeArray,object:null},trajectory.content.loadState=`READY`}catch(err){console.warn(`[GaussianSplattingEntranceAnimationPlugin] trajectory ply 加载失败,将使用 3DGS AABB 回退`,err),trajectory.content.data=void 0,trajectory.content.loadState=`FAILED`}})}computeGSSceneBounds(){let bounds=new three_webgpu.Box3,tmpBox=new three_webgpu.Box3;return this.five.scene.traverse(object=>{let anyObj=object;(anyObj==null?void 0:anyObj.boundingBox)instanceof three_webgpu.Box3&&!anyObj.boundingBox.isEmpty()&&(tmpBox.copy(anyObj.boundingBox),anyObj.matrixWorld&&tmpBox.applyMatrix4(anyObj.matrixWorld),bounds.union(tmpBox))}),bounds.isEmpty()?null:bounds}getCameraCurve(){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k;let trajectory=(_d=(_c=(_b=(_a=this.five.model.viewLayers)==null?void 0:_a[0])==null?void 0:_b.trajectories)==null?void 0:_c[0])==null?(_h=(_g=(_f=(_e=this.five.model.viewLayers)==null?void 0:_e[0])==null?void 0:_f.scene)==null?void 0:_g.trajectories)==null?void 0:_h[0]:_d,keyframes=null,aabb=null;if(trajectory&&(yield this.loadTrajectoryDataIfNeeded(trajectory),(_j=trajectory.content)!=null&&_j.data&&((_k=trajectory.content.data.positionArray)==null?void 0:_k.length)>=6&&(keyframes=this.extractKeyframes(trajectory),keyframes.length>=2?aabb=this.computeAABB2D(keyframes):keyframes=null)),!keyframes||!aabb){let sceneBounds=this.computeGSSceneBounds();if(!sceneBounds)throw Error(`未找到可用于计算入场曲线的 3DGS 边界或轨迹`);aabb={min:new three_webgpu.Vector2(sceneBounds.min.x,sceneBounds.min.z),max:new three_webgpu.Vector2(sceneBounds.max.x,sceneBounds.max.z)};let cx=(aabb.min.x+aabb.max.x)/2,cz=(aabb.min.y+aabb.max.y)/2,y=(sceneBounds.min.y+sceneBounds.max.y)/2,r=Math.max(aabb.max.x-aabb.min.x,aabb.max.y-aabb.min.y)*.5;keyframes=[];let acc=0,prev=null;for(let i=0;i<16;i++){let t=i/16*Math.PI*2,p=new three_webgpu.Vector3(cx+Math.cos(t)*r,y,cz+Math.sin(t)*r);prev&&(acc+=p.distanceTo(prev)),keyframes.push({position:p,location:acc}),prev=p}}this.keyframes=keyframes,this.boundingAABB=aabb;let curveHeight=this.curveHeight,aabbCenter=new three_webgpu.Vector3((aabb.min.x+aabb.max.x)/2,curveHeight,(aabb.min.y+aabb.max.y)/2),halfW=(aabb.max.x-aabb.min.x)/2,halfH=(aabb.max.y-aabb.min.y)/2,boundingRadius=Math.sqrt(halfW*halfW+halfH*halfH),projectToSphere=pt=>{let dir=new three_webgpu.Vector3().subVectors(pt,aabbCenter);return dir.length()<.001&&dir.set(1,0,0),aabbCenter.clone().add(dir.normalize().multiplyScalar(boundingRadius))},startRaw=new three_webgpu.Vector3(keyframes[0].position.x,curveHeight,keyframes[0].position.z),startPoint=projectToSphere(startRaw),primaryDir=new three_webgpu.Vector3().subVectors(aabbCenter,startRaw).normalize(),primaryRay=new three_webgpu.Ray(startRaw,primaryDir),secondaryDir=new three_webgpu.Vector3(-primaryDir.z,0,primaryDir.x).normalize(),secondaryRay=new three_webgpu.Ray(aabbCenter,secondaryDir),p1Raw=this.findClosestKeyframeToRay(secondaryRay,keyframes),p1=projectToSphere(new three_webgpu.Vector3(p1Raw.x,curveHeight,p1Raw.z)),p2Raw=this.findClosestKeyframeToRay(primaryRay,keyframes),p2=projectToSphere(new three_webgpu.Vector3(p2Raw.x,curveHeight,p2Raw.z));return new three_webgpu.CatmullRomCurve3([startPoint,p1,p2],!1,`centripetal`,.5)})}setBounding(boundsMin,boundsMax,_center){let renderMesh=this.findRenderMesh();renderMesh.material.aggregationBoundsMin.copy(boundsMin),renderMesh.material.aggregationBoundsMax.copy(boundsMax),this.boundsSet=!0}setBounds(){if(!this.boundingAABB)throw Error(`请先调用 getCameraCurve 计算轨迹边界`);let aabb=this.boundingAABB,renderMesh=this.findRenderMesh(),boundsMin=new three_webgpu.Vector3(aabb.min.x,0,aabb.min.y),boundsMax=new three_webgpu.Vector3(aabb.max.x,3,aabb.max.y);renderMesh.material.aggregationBoundsMin.copy(boundsMin),renderMesh.material.aggregationBoundsMax.copy(boundsMax),this.boundsSet=!0}normalizedPointDuration(){let pd=this.pointDuration;return pd<=0?.01:Math.min(pd<=1?pd:pd/this.duration,1)}resetToPointCloud(){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){if(!this.isInitAnimationEnabled())return;this.boundingAABB||(yield this.getCameraCurve()),this.setBounds();let material=this.findRenderMesh().material;material.aggregationEnabled=!0,material.aggregationProgress=0,material.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0})}startAggregation(){if(!this.isInitAnimationEnabled()){console.warn(`[GaussianSplattingEntranceAnimationPlugin] modelScene.enableGaussianSplattingInitAnimation 为 false,已跳过聚合动画`);return}if(!this.boundsSet)throw Error(`请先调用 setBounds 设置聚合边界`);let material=this.findRenderMesh().material;material.aggregationEnabled=!0,material.aggregationProgress=0,material.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let startTime=performance.now(),duration=this.duration;this.cancelAnimation=_realsee_five_webgpu.AnimationFrameLoop.shared.add(()=>{let elapsed=performance.now()-startTime,progress=Math.min(elapsed/duration,1);material.aggregationProgress=progress*progress*(3-2*progress),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0,progress>=1&&(material.aggregationEnabled=!1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null))})}playEntrance(){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){if(!this.isInitAnimationEnabled()){console.warn(`[GaussianSplattingEntranceAnimationPlugin] modelScene.enableGaussianSplattingInitAnimation 为 false,已跳过入场动画`);return}let curve=yield this.getCameraCurve(),aabb=this.boundingAABB,boundingCenter=new three_webgpu.Vector3((aabb.min.x+aabb.max.x)/2,this.curveHeight,(aabb.min.y+aabb.max.y)/2),startPoint=curve.getPointAt(0),visualCamera=new _realsee_five_webgpu.Camera(90).copy(this.five.camera);visualCamera.position.copy(startPoint),visualCamera.lookAt(boundingCenter),visualCamera.computePose(0),this.five.setState(Object.assign({},visualCamera.pose)),this.setBounds();let material=this.findRenderMesh().material;material.aggregationEnabled=!0,material.aggregationProgress=0,material.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let duration=this.duration,startTime=performance.now();return new Promise(resolve=>{this.cancelAnimation=_realsee_five_webgpu.AnimationFrameLoop.shared.add(()=>{let elapsed=performance.now()-startTime,t=Math.min(elapsed/duration,1),eased=t*t*(3-2*t);material.aggregationProgress=eased,this.five.modelSceneNeedsRender=!0;let point=curve.getPointAt(eased);visualCamera.position.copy(point),visualCamera.lookAt(boundingCenter),visualCamera.computePose(0),this.five.setState(Object.assign({},visualCamera.pose)),this.five.needsRender=!0,t>=1&&(material.aggregationEnabled=!1,material.aggregationProgress=1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null),resolve())})})})}};exports.Controller=Controller;
|
|
@@ -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/4
|
|
5
|
+
* Version: 1.0.0-alpha.15
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +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{BasePlugin as e}from"../BasePlugin/index.mjs";import{__awaiter as t}from"tslib";import{AnimationFrameLoop as n,Camera as r,loadPly as i}from"@realsee/five-webgpu";import*as a from"three/webgpu";var o=class{constructor(e,t,n,r,i){this.R=e,this.Q=t,this.A=n,this.B=r,this.C=i,this.cov=NaN,this.x=NaN}filter(e,t=0){if(isNaN(this.x))this.x=1/this.C*e,this.cov=1/this.C*this.Q*(1/this.C);else{let n=this.A*this.x+this.B*t,r=this.A*this.cov*this.A+this.R,i=r*this.C*(1/(this.C*r*this.C+this.Q));this.x=n+i*(e-this.C*n),this.cov=r-i*this.C*r}return this.x}},s=class extends e.Controller{updateState(e,t){let n=this.state;this.state=Object.assign(Object.assign({},this.state),e),this.hooks.emit(`stateChange`,{state:this.state,prevState:n,userAction:t})}constructor(e,t){var n,r,i;super(e),this.boundingAABB=null,this.cancelAnimation=null,this.boundsSet=!1,this.keyframes=[],this.five=e,this.state={enabled:!0,visible:!0},this.duration=(n=t==null?void 0:t.duration)==null?5e3:n,this.curveHeight=(r=t==null?void 0:t.curveHeight)==null?1.5:r,this.pointDuration=(i=t==null?void 0:t.pointDuration)==null?3e3:i}load(){return t(this,void 0,void 0,function*(){})}enable(e){var t;if(this.state.enabled)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n)}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n)}dispose(){this.disable(),this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null);try{let e=this.findRenderMesh();e&&(e.material.aggregationEnabled=!1,e.material.aggregationProgress=1)}catch(e){}}extractKeyframes(e){let t=[];if(!e.content.data)throw Error(`轨迹数据未加载`);let n=e.content.data.positionArray,r=n.length/3,i=.01,s=.1,c=new o(i,s,1,0,1),l=new o(i,s,1,0,1),u=new o(i,s,1,0,1),d=new Float32Array(r);for(let e=0;e<r;e++)if(e===0)d[e]=0;else{let t=new a.Vector3(n[(e-1)*3],n[(e-1)*3+1],n[(e-1)*3+2]);d[e]=new a.Vector3(n[e*3],n[e*3+1],n[e*3+2]).distanceTo(t)+d[e-1]}for(let i=0;i<r;i++){let o=new a.Vector3(0,0,0),s=0;for(let e=i-5;e<i+6;e++)e>=0&&e<r&&(o.add(new a.Vector3(n[e*3],n[e*3+1],n[e*3+2])),s++);o.divideScalar(s).applyMatrix4(e.transform);let f=c.filter(o.x),p=l.filter(o.y),m=u.filter(o.z);t.push({position:new a.Vector3(f,p,m),location:d[i]})}return t}computeAABB2D(e){let t=1/0,n=-1/0,r=1/0,i=-1/0;for(let a of e)a.position.x<t&&(t=a.position.x),a.position.x>n&&(n=a.position.x),a.position.z<r&&(r=a.position.z),a.position.z>i&&(i=a.position.z);return{min:new a.Vector2(t,r),max:new a.Vector2(n,i)}}findClosestKeyframeToRay(e,t){let n=1/0,r=t[0].position.clone(),i=new a.Vector3;for(let a of t){e.closestPointToPoint(a.position,i);let t=i.distanceTo(a.position);t<n&&(n=t,r=a.position.clone())}return r}isInitAnimationEnabled(){return this.five.modelScene.parameter.resolveValue(`enableGaussianSplattingInitAnimation`)===!0}findRenderMesh(){let e=null;if(this.five.scene.traverse(t=>{if(e)return;let n=t,r=n.material;r&&r.isPBMGaussianSplattingMaterial&&(e=n)}),!e)throw Error(`未找到 GaussianSplatting 渲染网格`);return e}loadTrajectoryDataIfNeeded(e){return t(this,void 0,void 0,function*(){var t,r,a,o,s,c,l,u;if((t=e.content)!=null&&t.data)return;if(((r=e.content)==null?void 0:r.loadState)===`LOADING`){yield new Promise(t=>{let r=n.shared.add(()=>{var n;let i=(n=e.content)==null?void 0:n.loadState;(i===`READY`||i===`FAILED`||i===`UNLOADED`)&&(r(),t())})});return}let d=(a=this.five.model.viewLayers)==null?void 0:a[0],f=d==null?void 0:d.fetcher,p=d==null?void 0:d.search,m=(o=e.content)==null?void 0:o.uri;if(!f||!m)return;let h=p?m.includes(`?`)?`${m}&${p.replace(/^\?/,``)}`:`${m}${p.startsWith(`?`)?p:`?${p}`}`:m;e.content.loadState=`LOADING`;try{let t=yield i(h,{type:`geometry`,customPropertyMapping:{time:{itemType:`uint32`,itemNames:[`time_milisec`]}},fetcher:f}),n=t.scene,r=n.getAttribute(`position`),a=n.getAttribute(`time`),o=(s=r==null?void 0:r.array)==null?new Float32Array:s,d=(c=a==null?void 0:a.array)==null?new Uint32Array:c;e.content.data={uri:h,byteLength:(l=t.byteLength)==null?0:l,memoryUsage:(u=t.memoryUsage)==null?0:u,positionArray:o,timeArray:d,object:null},e.content.loadState=`READY`}catch(t){console.warn(`[GaussianSplattingEntranceAnimationPlugin] trajectory ply 加载失败,将使用 3DGS AABB 回退`,t),e.content.data=void 0,e.content.loadState=`FAILED`}})}computeGSSceneBounds(){let e=new a.Box3,t=new a.Box3;return this.five.scene.traverse(n=>{let r=n;(r==null?void 0:r.boundingBox)instanceof a.Box3&&!r.boundingBox.isEmpty()&&(t.copy(r.boundingBox),r.matrixWorld&&t.applyMatrix4(r.matrixWorld),e.union(t))}),e.isEmpty()?null:e}getCameraCurve(){return t(this,void 0,void 0,function*(){var e,t,n,r,i,o,s,c,l,u;let d=(r=(n=(t=(e=this.five.model.viewLayers)==null?void 0:e[0])==null?void 0:t.trajectories)==null?void 0:n[0])==null?(c=(s=(o=(i=this.five.model.viewLayers)==null?void 0:i[0])==null?void 0:o.scene)==null?void 0:s.trajectories)==null?void 0:c[0]:r,f=null,p=null;if(d&&(yield this.loadTrajectoryDataIfNeeded(d),(l=d.content)!=null&&l.data&&((u=d.content.data.positionArray)==null?void 0:u.length)>=6&&(f=this.extractKeyframes(d),f.length>=2?p=this.computeAABB2D(f):f=null)),!f||!p){let e=this.computeGSSceneBounds();if(!e)throw Error(`未找到可用于计算入场曲线的 3DGS 边界或轨迹`);p={min:new a.Vector2(e.min.x,e.min.z),max:new a.Vector2(e.max.x,e.max.z)};let t=(p.min.x+p.max.x)/2,n=(p.min.y+p.max.y)/2,r=(e.min.y+e.max.y)/2,i=Math.max(p.max.x-p.min.x,p.max.y-p.min.y)*.5;f=[];let o=0,s=null;for(let e=0;e<16;e++){let c=e/16*Math.PI*2,l=new a.Vector3(t+Math.cos(c)*i,r,n+Math.sin(c)*i);s&&(o+=l.distanceTo(s)),f.push({position:l,location:o}),s=l}}this.keyframes=f,this.boundingAABB=p;let m=this.curveHeight,h=new a.Vector3((p.min.x+p.max.x)/2,m,(p.min.y+p.max.y)/2),g=(p.max.x-p.min.x)/2,_=(p.max.y-p.min.y)/2,v=Math.sqrt(g*g+_*_),y=e=>{let t=new a.Vector3().subVectors(e,h);return t.length()<.001&&t.set(1,0,0),h.clone().add(t.normalize().multiplyScalar(v))},b=new a.Vector3(f[0].position.x,m,f[0].position.z),x=y(b),S=new a.Vector3().subVectors(h,b).normalize(),C=new a.Ray(b,S),w=new a.Vector3(-S.z,0,S.x).normalize(),T=new a.Ray(h,w),E=this.findClosestKeyframeToRay(T,f),D=y(new a.Vector3(E.x,m,E.z)),O=this.findClosestKeyframeToRay(C,f),k=y(new a.Vector3(O.x,m,O.z));return new a.CatmullRomCurve3([x,D,k],!1,`centripetal`,.5)})}setBounding(e,t,n){let r=this.findRenderMesh();r.material.aggregationBoundsMin.copy(e),r.material.aggregationBoundsMax.copy(t),this.boundsSet=!0}setBounds(){if(!this.boundingAABB)throw Error(`请先调用 getCameraCurve 计算轨迹边界`);let e=this.boundingAABB,t=this.findRenderMesh(),n=new a.Vector3(e.min.x,0,e.min.y),r=new a.Vector3(e.max.x,3,e.max.y);t.material.aggregationBoundsMin.copy(n),t.material.aggregationBoundsMax.copy(r),this.boundsSet=!0}normalizedPointDuration(){let e=this.pointDuration;return e<=0?.01:Math.min(e<=1?e:e/this.duration,1)}resetToPointCloud(){return t(this,void 0,void 0,function*(){if(!this.isInitAnimationEnabled())return;this.boundingAABB||(yield this.getCameraCurve()),this.setBounds();let e=this.findRenderMesh().material;e.aggregationEnabled=!0,e.aggregationProgress=0,e.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0})}startAggregation(){if(!this.isInitAnimationEnabled()){console.warn(`[GaussianSplattingEntranceAnimationPlugin] modelScene.enableGaussianSplattingInitAnimation 为 false,已跳过聚合动画`);return}if(!this.boundsSet)throw Error(`请先调用 setBounds 设置聚合边界`);let e=this.findRenderMesh().material;e.aggregationEnabled=!0,e.aggregationProgress=0,e.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let t=performance.now(),r=this.duration;this.cancelAnimation=n.shared.add(()=>{let n=performance.now()-t,i=Math.min(n/r,1);e.aggregationProgress=i*i*(3-2*i),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0,i>=1&&(e.aggregationEnabled=!1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null))})}playEntrance(){return t(this,void 0,void 0,function*(){if(!this.isInitAnimationEnabled()){console.warn(`[GaussianSplattingEntranceAnimationPlugin] modelScene.enableGaussianSplattingInitAnimation 为 false,已跳过入场动画`);return}let e=yield this.getCameraCurve(),t=this.boundingAABB,i=new a.Vector3((t.min.x+t.max.x)/2,this.curveHeight,(t.min.y+t.max.y)/2),o=e.getPointAt(0),s=new r(90).copy(this.five.camera);s.position.copy(o),s.lookAt(i),s.computePose(0),this.five.setState(Object.assign({},s.pose)),this.setBounds();let c=this.findRenderMesh().material;c.aggregationEnabled=!0,c.aggregationProgress=0,c.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let l=this.duration,u=performance.now();return new Promise(t=>{this.cancelAnimation=n.shared.add(()=>{let n=performance.now()-u,r=Math.min(n/l,1),a=r*r*(3-2*r);c.aggregationProgress=a,this.five.modelSceneNeedsRender=!0;let o=e.getPointAt(a);s.position.copy(o),s.lookAt(i),s.computePose(0),this.five.setState(Object.assign({},s.pose)),this.five.needsRender=!0,r>=1&&(c.aggregationEnabled=!1,c.aggregationProgress=1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null),t())})})})}};export{s as Controller};
|
|
338
|
+
*/import{BasePlugin}from"../BasePlugin/index.mjs";import{__awaiter}from"tslib";import{AnimationFrameLoop,Camera,loadPly}from"@realsee/five-webgpu";import*as THREE from"three/webgpu";var KalmanFilter=class{constructor(R,Q,A,B,C){this.R=R,this.Q=Q,this.A=A,this.B=B,this.C=C,this.cov=NaN,this.x=NaN}filter(z,u=0){if(isNaN(this.x))this.x=1/this.C*z,this.cov=1/this.C*this.Q*(1/this.C);else{let predX=this.A*this.x+this.B*u,predCov=this.A*this.cov*this.A+this.R,K=predCov*this.C*(1/(this.C*predCov*this.C+this.Q));this.x=predX+K*(z-this.C*predX),this.cov=predCov-K*this.C*predCov}return this.x}},Controller=class extends BasePlugin.Controller{updateState(state,userAction){let prevState=this.state;this.state=Object.assign(Object.assign({},this.state),state),this.hooks.emit(`stateChange`,{state:this.state,prevState,userAction})}constructor(five,config){var _a,_b,_c;super(five),this.boundingAABB=null,this.cancelAnimation=null,this.boundsSet=!1,this.keyframes=[],this.five=five,this.state={enabled:!0,visible:!0},this.duration=(_a=config==null?void 0:config.duration)==null?5e3:_a,this.curveHeight=(_b=config==null?void 0:config.curveHeight)==null?1.5:_b,this.pointDuration=(_c=config==null?void 0:config.pointDuration)==null?3e3:_c}load(){return __awaiter(this,void 0,void 0,function*(){})}enable(options){var _a;if(this.state.enabled)return;let userAction=(_a=options==null?void 0:options.userAction)==null?!0:_a;this.updateState({enabled:!0},userAction)}disable(options){var _a;if(this.state.enabled===!1)return;let userAction=(_a=options==null?void 0:options.userAction)==null?!0:_a;this.updateState({enabled:!1},userAction)}dispose(){this.disable(),this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null);try{let renderMesh=this.findRenderMesh();renderMesh&&(renderMesh.material.aggregationEnabled=!1,renderMesh.material.aggregationProgress=1)}catch(_){}}extractKeyframes(trajectory){let keyframes=[];if(!trajectory.content.data)throw Error(`轨迹数据未加载`);let points=trajectory.content.data.positionArray,numPoints=points.length/3,R=.01,Q=.1,kfX=new KalmanFilter(R,Q,1,0,1),kfY=new KalmanFilter(R,Q,1,0,1),kfZ=new KalmanFilter(R,Q,1,0,1),lineDistances=new Float32Array(numPoints);for(let i=0;i<numPoints;i++)if(i===0)lineDistances[i]=0;else{let prev=new THREE.Vector3(points[(i-1)*3],points[(i-1)*3+1],points[(i-1)*3+2]);lineDistances[i]=new THREE.Vector3(points[i*3],points[i*3+1],points[i*3+2]).distanceTo(prev)+lineDistances[i-1]}for(let i=0;i<numPoints;i++){let smoothPosition=new THREE.Vector3(0,0,0),count=0;for(let j=i-5;j<i+6;j++)j>=0&&j<numPoints&&(smoothPosition.add(new THREE.Vector3(points[j*3],points[j*3+1],points[j*3+2])),count++);smoothPosition.divideScalar(count).applyMatrix4(trajectory.transform);let x=kfX.filter(smoothPosition.x),y=kfY.filter(smoothPosition.y),z=kfZ.filter(smoothPosition.z);keyframes.push({position:new THREE.Vector3(x,y,z),location:lineDistances[i]})}return keyframes}computeAABB2D(keyframes){let minX=1/0,maxX=-1/0,minZ=1/0,maxZ=-1/0;for(let kf of keyframes)kf.position.x<minX&&(minX=kf.position.x),kf.position.x>maxX&&(maxX=kf.position.x),kf.position.z<minZ&&(minZ=kf.position.z),kf.position.z>maxZ&&(maxZ=kf.position.z);return{min:new THREE.Vector2(minX,minZ),max:new THREE.Vector2(maxX,maxZ)}}findClosestKeyframeToRay(ray,keyframes){let closestDist=1/0,closestPos=keyframes[0].position.clone(),tmpVec=new THREE.Vector3;for(let kf of keyframes){ray.closestPointToPoint(kf.position,tmpVec);let dist=tmpVec.distanceTo(kf.position);dist<closestDist&&(closestDist=dist,closestPos=kf.position.clone())}return closestPos}isInitAnimationEnabled(){return this.five.modelScene.parameter.resolveValue(`enableGaussianSplattingInitAnimation`)===!0}findRenderMesh(){let found=null;if(this.five.scene.traverse(object=>{if(found)return;let mesh=object,material=mesh.material;material&&material.isPBMGaussianSplattingMaterial&&(found=mesh)}),!found)throw Error(`未找到 GaussianSplatting 渲染网格`);return found}loadTrajectoryDataIfNeeded(trajectory){return __awaiter(this,void 0,void 0,function*(){var _a,_b,_c,_d,_e,_f,_g,_h;if((_a=trajectory.content)!=null&&_a.data)return;if(((_b=trajectory.content)==null?void 0:_b.loadState)===`LOADING`){yield new Promise(resolve=>{let cancel=AnimationFrameLoop.shared.add(()=>{var _a;let s=(_a=trajectory.content)==null?void 0:_a.loadState;(s===`READY`||s===`FAILED`||s===`UNLOADED`)&&(cancel(),resolve())})});return}let viewLayer=(_c=this.five.model.viewLayers)==null?void 0:_c[0],fetcher=viewLayer==null?void 0:viewLayer.fetcher,search=viewLayer==null?void 0:viewLayer.search,uri=(_d=trajectory.content)==null?void 0:_d.uri;if(!fetcher||!uri)return;let url=search?uri.includes(`?`)?`${uri}&${search.replace(/^\?/,``)}`:`${uri}${search.startsWith(`?`)?search:`?${search}`}`:uri;trajectory.content.loadState=`LOADING`;try{let plyResult=yield loadPly(url,{type:`geometry`,customPropertyMapping:{time:{itemType:`uint32`,itemNames:[`time_milisec`]}},fetcher}),geometry=plyResult.scene,positionAttr=geometry.getAttribute(`position`),timeAttr=geometry.getAttribute(`time`),positionArray=(_e=positionAttr==null?void 0:positionAttr.array)==null?new Float32Array:_e,timeArray=(_f=timeAttr==null?void 0:timeAttr.array)==null?new Uint32Array:_f;trajectory.content.data={uri:url,byteLength:(_g=plyResult.byteLength)==null?0:_g,memoryUsage:(_h=plyResult.memoryUsage)==null?0:_h,positionArray,timeArray,object:null},trajectory.content.loadState=`READY`}catch(err){console.warn(`[GaussianSplattingEntranceAnimationPlugin] trajectory ply 加载失败,将使用 3DGS AABB 回退`,err),trajectory.content.data=void 0,trajectory.content.loadState=`FAILED`}})}computeGSSceneBounds(){let bounds=new THREE.Box3,tmpBox=new THREE.Box3;return this.five.scene.traverse(object=>{let anyObj=object;(anyObj==null?void 0:anyObj.boundingBox)instanceof THREE.Box3&&!anyObj.boundingBox.isEmpty()&&(tmpBox.copy(anyObj.boundingBox),anyObj.matrixWorld&&tmpBox.applyMatrix4(anyObj.matrixWorld),bounds.union(tmpBox))}),bounds.isEmpty()?null:bounds}getCameraCurve(){return __awaiter(this,void 0,void 0,function*(){var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k;let trajectory=(_d=(_c=(_b=(_a=this.five.model.viewLayers)==null?void 0:_a[0])==null?void 0:_b.trajectories)==null?void 0:_c[0])==null?(_h=(_g=(_f=(_e=this.five.model.viewLayers)==null?void 0:_e[0])==null?void 0:_f.scene)==null?void 0:_g.trajectories)==null?void 0:_h[0]:_d,keyframes=null,aabb=null;if(trajectory&&(yield this.loadTrajectoryDataIfNeeded(trajectory),(_j=trajectory.content)!=null&&_j.data&&((_k=trajectory.content.data.positionArray)==null?void 0:_k.length)>=6&&(keyframes=this.extractKeyframes(trajectory),keyframes.length>=2?aabb=this.computeAABB2D(keyframes):keyframes=null)),!keyframes||!aabb){let sceneBounds=this.computeGSSceneBounds();if(!sceneBounds)throw Error(`未找到可用于计算入场曲线的 3DGS 边界或轨迹`);aabb={min:new THREE.Vector2(sceneBounds.min.x,sceneBounds.min.z),max:new THREE.Vector2(sceneBounds.max.x,sceneBounds.max.z)};let cx=(aabb.min.x+aabb.max.x)/2,cz=(aabb.min.y+aabb.max.y)/2,y=(sceneBounds.min.y+sceneBounds.max.y)/2,r=Math.max(aabb.max.x-aabb.min.x,aabb.max.y-aabb.min.y)*.5;keyframes=[];let acc=0,prev=null;for(let i=0;i<16;i++){let t=i/16*Math.PI*2,p=new THREE.Vector3(cx+Math.cos(t)*r,y,cz+Math.sin(t)*r);prev&&(acc+=p.distanceTo(prev)),keyframes.push({position:p,location:acc}),prev=p}}this.keyframes=keyframes,this.boundingAABB=aabb;let curveHeight=this.curveHeight,aabbCenter=new THREE.Vector3((aabb.min.x+aabb.max.x)/2,curveHeight,(aabb.min.y+aabb.max.y)/2),halfW=(aabb.max.x-aabb.min.x)/2,halfH=(aabb.max.y-aabb.min.y)/2,boundingRadius=Math.sqrt(halfW*halfW+halfH*halfH),projectToSphere=pt=>{let dir=new THREE.Vector3().subVectors(pt,aabbCenter);return dir.length()<.001&&dir.set(1,0,0),aabbCenter.clone().add(dir.normalize().multiplyScalar(boundingRadius))},startRaw=new THREE.Vector3(keyframes[0].position.x,curveHeight,keyframes[0].position.z),startPoint=projectToSphere(startRaw),primaryDir=new THREE.Vector3().subVectors(aabbCenter,startRaw).normalize(),primaryRay=new THREE.Ray(startRaw,primaryDir),secondaryDir=new THREE.Vector3(-primaryDir.z,0,primaryDir.x).normalize(),secondaryRay=new THREE.Ray(aabbCenter,secondaryDir),p1Raw=this.findClosestKeyframeToRay(secondaryRay,keyframes),p1=projectToSphere(new THREE.Vector3(p1Raw.x,curveHeight,p1Raw.z)),p2Raw=this.findClosestKeyframeToRay(primaryRay,keyframes),p2=projectToSphere(new THREE.Vector3(p2Raw.x,curveHeight,p2Raw.z));return new THREE.CatmullRomCurve3([startPoint,p1,p2],!1,`centripetal`,.5)})}setBounding(boundsMin,boundsMax,_center){let renderMesh=this.findRenderMesh();renderMesh.material.aggregationBoundsMin.copy(boundsMin),renderMesh.material.aggregationBoundsMax.copy(boundsMax),this.boundsSet=!0}setBounds(){if(!this.boundingAABB)throw Error(`请先调用 getCameraCurve 计算轨迹边界`);let aabb=this.boundingAABB,renderMesh=this.findRenderMesh(),boundsMin=new THREE.Vector3(aabb.min.x,0,aabb.min.y),boundsMax=new THREE.Vector3(aabb.max.x,3,aabb.max.y);renderMesh.material.aggregationBoundsMin.copy(boundsMin),renderMesh.material.aggregationBoundsMax.copy(boundsMax),this.boundsSet=!0}normalizedPointDuration(){let pd=this.pointDuration;return pd<=0?.01:Math.min(pd<=1?pd:pd/this.duration,1)}resetToPointCloud(){return __awaiter(this,void 0,void 0,function*(){if(!this.isInitAnimationEnabled())return;this.boundingAABB||(yield this.getCameraCurve()),this.setBounds();let material=this.findRenderMesh().material;material.aggregationEnabled=!0,material.aggregationProgress=0,material.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0})}startAggregation(){if(!this.isInitAnimationEnabled()){console.warn(`[GaussianSplattingEntranceAnimationPlugin] modelScene.enableGaussianSplattingInitAnimation 为 false,已跳过聚合动画`);return}if(!this.boundsSet)throw Error(`请先调用 setBounds 设置聚合边界`);let material=this.findRenderMesh().material;material.aggregationEnabled=!0,material.aggregationProgress=0,material.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let startTime=performance.now(),duration=this.duration;this.cancelAnimation=AnimationFrameLoop.shared.add(()=>{let elapsed=performance.now()-startTime,progress=Math.min(elapsed/duration,1);material.aggregationProgress=progress*progress*(3-2*progress),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0,progress>=1&&(material.aggregationEnabled=!1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null))})}playEntrance(){return __awaiter(this,void 0,void 0,function*(){if(!this.isInitAnimationEnabled()){console.warn(`[GaussianSplattingEntranceAnimationPlugin] modelScene.enableGaussianSplattingInitAnimation 为 false,已跳过入场动画`);return}let curve=yield this.getCameraCurve(),aabb=this.boundingAABB,boundingCenter=new THREE.Vector3((aabb.min.x+aabb.max.x)/2,this.curveHeight,(aabb.min.y+aabb.max.y)/2),startPoint=curve.getPointAt(0),visualCamera=new Camera(90).copy(this.five.camera);visualCamera.position.copy(startPoint),visualCamera.lookAt(boundingCenter),visualCamera.computePose(0),this.five.setState(Object.assign({},visualCamera.pose)),this.setBounds();let material=this.findRenderMesh().material;material.aggregationEnabled=!0,material.aggregationProgress=0,material.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let duration=this.duration,startTime=performance.now();return new Promise(resolve=>{this.cancelAnimation=AnimationFrameLoop.shared.add(()=>{let elapsed=performance.now()-startTime,t=Math.min(elapsed/duration,1),eased=t*t*(3-2*t);material.aggregationProgress=eased,this.five.modelSceneNeedsRender=!0;let point=curve.getPointAt(eased);visualCamera.position.copy(point),visualCamera.lookAt(boundingCenter),visualCamera.computePose(0),this.five.setState(Object.assign({},visualCamera.pose)),this.five.needsRender=!0,t>=1&&(material.aggregationEnabled=!1,material.aggregationProgress=1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null),resolve())})})})}};export{Controller};
|
|
@@ -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/4
|
|
5
|
+
* Version: 1.0.0-alpha.15
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +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
|
-
*/const
|
|
338
|
+
*/const require_Controller=require("./Controller.js");var GaussianSplattingEntranceAnimationPlugin=(five,config)=>new require_Controller.Controller(five,config);exports.GaussianSplattingEntranceAnimationPlugin=GaussianSplattingEntranceAnimationPlugin;
|
|
@@ -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/4
|
|
5
|
+
* Version: 1.0.0-alpha.15
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +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{Controller
|
|
338
|
+
*/import{Controller}from"./Controller.mjs";var GaussianSplattingEntranceAnimationPlugin=(five,config)=>new Controller(five,config);export{GaussianSplattingEntranceAnimationPlugin};
|
|
@@ -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/4
|
|
5
|
+
* Version: 1.0.0-alpha.15
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +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
|
-
*/const
|
|
338
|
+
*/const require_runtime=require("../../_virtual/_rolldown/runtime.js"),require_index=require("../BasePlugin/index.js"),require_MoveHelper=require("./Helper/MoveHelper.js"),require_RotateHelper=require("./Helper/RotateHelper.js"),require_BoundingBoxHelper=require("./Helper/BoundingBoxHelper.js"),require_MoveController=require("./Controllers/MoveController.js"),require_FiveControllerWrapper=require("./FiveControllerWrapper.js"),require_RotateController=require("./Controllers/RotateController.js"),require_BoundingBoxController=require("./Controllers/BoundingBoxController.js"),require_domevents=require("../thirdParty/domevents.js");let tslib=require("tslib"),_realsee_five_webgpu=require("@realsee/five-webgpu"),three_webgpu=require("three/webgpu");three_webgpu=require_runtime.__toESM(three_webgpu,1);var PLUGIN_NAME=`Object3DHelperPlugin`,PLUGIN=PLUGIN_NAME,disposedErrorLog=()=>{console.error(`${PLUGIN} is disposed`)},disableWarnLog=()=>{console.warn(`${PLUGIN} is disabled`)},disableErrorLog=()=>{console.error(`${PLUGIN} is disabled`)},Object3DHelper=class{constructor(controllers){this.controllers={},this.state={visible:!0,enabled:!0,disposed:!1},this.hooks=new _realsee_five_webgpu.Subscribe,controllers&&this.addControllers(controllers),this.setState(this.state)}show(options){this.setState({visible:!0},options)}hide(options){this.setState({visible:!1},options)}enable(options){this.setState({enabled:!0},options)}disable(options){this.setState({enabled:!1},options)}dispose(){this.setState({disposed:!0})}setState(state,_options){if(this.state.disposed||!this.state.enabled&&state.enabled!==!0&&state.disposed!==!0)return;let prevState=Object.assign({},this.state);this.state=Object.assign(Object.assign({},this.state),state),state.disposed!==void 0&&state.disposed!==prevState.disposed&&state.disposed&&this.handleDispose(),state.visible!==void 0&&this.handleVisible(state.visible),state.enabled!==void 0&&this.handleEnable(state.enabled),this.hooks.emit(`stateChange`,{state:this.state,prevState})}addControllers(controllers){this.controllers=Object.assign(Object.assign({},this.controllers),controllers),this.setState(this.state)}initialHelperMatrix(){this.everyControllerDo(controller=>{controller.initialHelperPosition(),controller.initialHelperQuaternion()})}handleEnable(enabled,userAction=!0){enabled?(this.everyControllerDo(c=>c.enable()),this.hooks.emit(`enable`,{userAction})):(this.everyControllerDo(c=>c.disable()),this.hooks.emit(`disable`,{userAction}))}handleVisible(visible,userAction=!0){visible?(this.everyControllerDo(c=>c.show()),this.state.enabled&&this.hooks.emit(`show`,{userAction})):(this.everyControllerDo(c=>c.hide()),this.state.enabled&&this.hooks.emit(`hide`,{userAction}))}handleDispose(){Object.values(this.controllers).forEach(controller=>{controller==null||controller.dispose()})}everyControllerDo(func){Object.values(this.controllers).forEach(controller=>{controller&&func(controller)})}},Controller=class extends require_index.BasePlugin.Controller{constructor(five){super(five),this.name=PLUGIN_NAME,this.state={visible:!0,enabled:!0,disposed:!1},this.objectHelperMap=new Map,this.five=five}show(options){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){this.setState({visible:!0},options)})}hide(options){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){this.setState({visible:!1},options)})}enable(options){this.setState({enabled:!0},options)}disable(options){this.setState({enabled:!1},options)}dispose(){this.setState({disposed:!0})}load(_data){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){})}setState(state,options){var _a;if(this.state.disposed)return disposedErrorLog();if(!this.state.enabled&&state.enabled!==!0&&state.disposed!==!0)return disableErrorLog();let prevState=Object.assign({},this.state);this.state=Object.assign(Object.assign({},this.state),state),state.disposed!==void 0&&state.disposed!==prevState.disposed&&state.disposed&&this.handleDispose(),state.visible!==void 0&&state.visible!==prevState.visible&&this.handleVisible(state.visible),state.enabled!==void 0&&state.enabled!==prevState.enabled&&this.handleEnable(state.enabled),this.hooks.emit(`stateChange`,{state:this.state,prevState,userAction:(_a=options==null?void 0:options.userAction)==null?!0:_a})}getObject3DHelper(object3D){return this.objectHelperMap.get(object3D)}addObject3DHelper(object3D,paramsConfig={}){var _a,_b;if(!object3D){console.error(`Object3D is undefined`);return}if(this.objectHelperMap.has(object3D)){console.warn(`Object3DHelperPlugin: object3D ${object3D.name} already has helper`);return}let helper=new Object3DHelper,disposers=[],container=(_a=this.five.getElement())==null?void 0:_a.parentElement;this.five.camera;let config=Object.assign(Object.assign({},{moveHelper:!0,rotateHelper:!0,boundingBoxHelper:!1,moveHelperTips:!1,positionFrom:`objectPosition`}),paramsConfig),{moveHelper,rotateHelper,boundingBoxHelper}=config,helperGroup=new three_webgpu.Group;config.helperOffset&&helperGroup.position.copy(config.helperOffset),this.five.scene.add(helperGroup);let hooks=helper.hooks,internalHooks=new _realsee_five_webgpu.Subscribe,donEvents=new require_domevents.default(this.five.camera,this.five.getElement()),helperEnable=helper=>{if(helper)return typeof helper==`boolean`?helper:helper.enable},controllers={};if(helperEnable(moveHelper)){let c=Object.assign(Object.assign({},this.getConfig(config.moveHelper)),config),moveHelperObj=new require_MoveHelper.MoveHelper(object3D,Object.assign({container:container==null?void 0:container,moveTipsEnable:(_b=config.moveHelperTips)==null?!1:_b},c)),controllerWrapper=new require_FiveControllerWrapper.ControllerWrapper(this.five,donEvents,require_MoveController.MoveController,object3D,moveHelperObj,c,hooks,internalHooks,helperGroup);controllers.moveController=controllerWrapper.helperController,disposers.push(()=>controllerWrapper.dispose())}if(helperEnable(rotateHelper)){let c=Object.assign(Object.assign({},this.getConfig(config.rotateHelper)),config),rotateHelperObj=new require_RotateHelper.RotateHelper(object3D,Object.assign({container:container==null?void 0:container},c)),controllerWrapper=new require_FiveControllerWrapper.ControllerWrapper(this.five,donEvents,require_RotateController.RotateController,object3D,rotateHelperObj,c,hooks,internalHooks,helperGroup);controllers.rotateController=controllerWrapper.helperController,disposers.push(()=>controllerWrapper.dispose())}if(helperEnable(boundingBoxHelper)){let boundingBoxHelperObj=new require_BoundingBoxHelper.BoundingBoxHelper(object3D),controllerWrapper=new require_FiveControllerWrapper.ControllerWrapper(this.five,donEvents,require_BoundingBoxController.BoundingBoxController,object3D,boundingBoxHelperObj,void 0,hooks,internalHooks,helperGroup);controllers.boundingBoxController=controllerWrapper.helperController,disposers.push(()=>controllerWrapper.dispose())}return Object.values(controllers).forEach(controller=>{controller&&typeof controller.updateOtherControllers==`function`&&controller.updateOtherControllers(controllers)}),helper.addControllers(controllers),this.objectHelperMap.set(object3D,{helper,disposers,helperGroup}),helper.controllers}removeObject3DHelper(object3D){if(!this.objectHelperMap.has(object3D))return;let{helper,disposers,helperGroup}=this.objectHelperMap.get(object3D);this.objectHelperMap.delete(object3D),helper.dispose(),disposers==null||disposers.forEach(d=>d==null?void 0:d()),helperGroup.parent&&helperGroup.parent.remove(helperGroup)}handleEnable(enabled,userAction=!0){enabled?(this.everyHelperDo(helper=>helper.enable()),this.hooks.emit(`enable`,{userAction})):(this.everyHelperDo(helper=>helper.disable()),this.hooks.emit(`disable`,{userAction})),this.state.enabled=enabled}handleVisible(visible,userAction=!0){visible?(this.everyHelperDo(helper=>helper.show()),this.actionIfStateIsEnabled(()=>this.hooks.emit(`show`,{userAction}))):(this.everyHelperDo(helper=>helper.hide()),this.actionIfStateIsEnabled(()=>this.hooks.emit(`hide`,{userAction}))),this.state.visible=visible}handleDispose(){this.objectHelperMap.forEach(({helper,disposers,helperGroup})=>{helper.dispose(),disposers==null||disposers.forEach(d=>d==null?void 0:d()),helperGroup.parent&&helperGroup.parent.remove(helperGroup)}),this.objectHelperMap.clear()}everyHelperDo(func){this.objectHelperMap.forEach(({helper,disposers})=>{helper&&func(helper,disposers)})}actionIfStateIsEnabled(func,options){if(this.state.enabled)return func();options!=null&&options.warnLog&&disableWarnLog()}getConfig(config){if(config&&typeof config!=`boolean`&&config.enable)return config}};exports.Controller=Controller,exports.Object3DHelper=Object3DHelper,exports.PLUGIN=PLUGIN;
|
|
@@ -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/4
|
|
5
|
+
* Version: 1.0.0-alpha.15
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +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{BasePlugin
|
|
338
|
+
*/import{BasePlugin}from"../BasePlugin/index.mjs";import{MoveHelper}from"./Helper/MoveHelper.mjs";import{RotateHelper}from"./Helper/RotateHelper.mjs";import{BoundingBoxHelper}from"./Helper/BoundingBoxHelper.mjs";import{MoveController}from"./Controllers/MoveController.mjs";import{ControllerWrapper}from"./FiveControllerWrapper.mjs";import{RotateController}from"./Controllers/RotateController.mjs";import{BoundingBoxController}from"./Controllers/BoundingBoxController.mjs";import DomEvents from"../thirdParty/domevents.mjs";import{__awaiter}from"tslib";import{Subscribe}from"@realsee/five-webgpu";import*as THREE from"three/webgpu";var PLUGIN_NAME=`Object3DHelperPlugin`,PLUGIN=PLUGIN_NAME,disposedErrorLog=()=>{console.error(`${PLUGIN} is disposed`)},disableWarnLog=()=>{console.warn(`${PLUGIN} is disabled`)},disableErrorLog=()=>{console.error(`${PLUGIN} is disabled`)},Object3DHelper=class{constructor(controllers){this.controllers={},this.state={visible:!0,enabled:!0,disposed:!1},this.hooks=new Subscribe,controllers&&this.addControllers(controllers),this.setState(this.state)}show(options){this.setState({visible:!0},options)}hide(options){this.setState({visible:!1},options)}enable(options){this.setState({enabled:!0},options)}disable(options){this.setState({enabled:!1},options)}dispose(){this.setState({disposed:!0})}setState(state,_options){if(this.state.disposed||!this.state.enabled&&state.enabled!==!0&&state.disposed!==!0)return;let prevState=Object.assign({},this.state);this.state=Object.assign(Object.assign({},this.state),state),state.disposed!==void 0&&state.disposed!==prevState.disposed&&state.disposed&&this.handleDispose(),state.visible!==void 0&&this.handleVisible(state.visible),state.enabled!==void 0&&this.handleEnable(state.enabled),this.hooks.emit(`stateChange`,{state:this.state,prevState})}addControllers(controllers){this.controllers=Object.assign(Object.assign({},this.controllers),controllers),this.setState(this.state)}initialHelperMatrix(){this.everyControllerDo(controller=>{controller.initialHelperPosition(),controller.initialHelperQuaternion()})}handleEnable(enabled,userAction=!0){enabled?(this.everyControllerDo(c=>c.enable()),this.hooks.emit(`enable`,{userAction})):(this.everyControllerDo(c=>c.disable()),this.hooks.emit(`disable`,{userAction}))}handleVisible(visible,userAction=!0){visible?(this.everyControllerDo(c=>c.show()),this.state.enabled&&this.hooks.emit(`show`,{userAction})):(this.everyControllerDo(c=>c.hide()),this.state.enabled&&this.hooks.emit(`hide`,{userAction}))}handleDispose(){Object.values(this.controllers).forEach(controller=>{controller==null||controller.dispose()})}everyControllerDo(func){Object.values(this.controllers).forEach(controller=>{controller&&func(controller)})}},Controller=class extends BasePlugin.Controller{constructor(five){super(five),this.name=PLUGIN_NAME,this.state={visible:!0,enabled:!0,disposed:!1},this.objectHelperMap=new Map,this.five=five}show(options){return __awaiter(this,void 0,void 0,function*(){this.setState({visible:!0},options)})}hide(options){return __awaiter(this,void 0,void 0,function*(){this.setState({visible:!1},options)})}enable(options){this.setState({enabled:!0},options)}disable(options){this.setState({enabled:!1},options)}dispose(){this.setState({disposed:!0})}load(_data){return __awaiter(this,void 0,void 0,function*(){})}setState(state,options){var _a;if(this.state.disposed)return disposedErrorLog();if(!this.state.enabled&&state.enabled!==!0&&state.disposed!==!0)return disableErrorLog();let prevState=Object.assign({},this.state);this.state=Object.assign(Object.assign({},this.state),state),state.disposed!==void 0&&state.disposed!==prevState.disposed&&state.disposed&&this.handleDispose(),state.visible!==void 0&&state.visible!==prevState.visible&&this.handleVisible(state.visible),state.enabled!==void 0&&state.enabled!==prevState.enabled&&this.handleEnable(state.enabled),this.hooks.emit(`stateChange`,{state:this.state,prevState,userAction:(_a=options==null?void 0:options.userAction)==null?!0:_a})}getObject3DHelper(object3D){return this.objectHelperMap.get(object3D)}addObject3DHelper(object3D,paramsConfig={}){var _a,_b;if(!object3D){console.error(`Object3D is undefined`);return}if(this.objectHelperMap.has(object3D)){console.warn(`Object3DHelperPlugin: object3D ${object3D.name} already has helper`);return}let helper=new Object3DHelper,disposers=[],container=(_a=this.five.getElement())==null?void 0:_a.parentElement;this.five.camera;let config=Object.assign(Object.assign({},{moveHelper:!0,rotateHelper:!0,boundingBoxHelper:!1,moveHelperTips:!1,positionFrom:`objectPosition`}),paramsConfig),{moveHelper,rotateHelper,boundingBoxHelper}=config,helperGroup=new THREE.Group;config.helperOffset&&helperGroup.position.copy(config.helperOffset),this.five.scene.add(helperGroup);let hooks=helper.hooks,internalHooks=new Subscribe,donEvents=new DomEvents(this.five.camera,this.five.getElement()),helperEnable=helper=>{if(helper)return typeof helper==`boolean`?helper:helper.enable},controllers={};if(helperEnable(moveHelper)){let c=Object.assign(Object.assign({},this.getConfig(config.moveHelper)),config),moveHelperObj=new MoveHelper(object3D,Object.assign({container:container==null?void 0:container,moveTipsEnable:(_b=config.moveHelperTips)==null?!1:_b},c)),controllerWrapper=new ControllerWrapper(this.five,donEvents,MoveController,object3D,moveHelperObj,c,hooks,internalHooks,helperGroup);controllers.moveController=controllerWrapper.helperController,disposers.push(()=>controllerWrapper.dispose())}if(helperEnable(rotateHelper)){let c=Object.assign(Object.assign({},this.getConfig(config.rotateHelper)),config),rotateHelperObj=new RotateHelper(object3D,Object.assign({container:container==null?void 0:container},c)),controllerWrapper=new ControllerWrapper(this.five,donEvents,RotateController,object3D,rotateHelperObj,c,hooks,internalHooks,helperGroup);controllers.rotateController=controllerWrapper.helperController,disposers.push(()=>controllerWrapper.dispose())}if(helperEnable(boundingBoxHelper)){let boundingBoxHelperObj=new BoundingBoxHelper(object3D),controllerWrapper=new ControllerWrapper(this.five,donEvents,BoundingBoxController,object3D,boundingBoxHelperObj,void 0,hooks,internalHooks,helperGroup);controllers.boundingBoxController=controllerWrapper.helperController,disposers.push(()=>controllerWrapper.dispose())}return Object.values(controllers).forEach(controller=>{controller&&typeof controller.updateOtherControllers==`function`&&controller.updateOtherControllers(controllers)}),helper.addControllers(controllers),this.objectHelperMap.set(object3D,{helper,disposers,helperGroup}),helper.controllers}removeObject3DHelper(object3D){if(!this.objectHelperMap.has(object3D))return;let{helper,disposers,helperGroup}=this.objectHelperMap.get(object3D);this.objectHelperMap.delete(object3D),helper.dispose(),disposers==null||disposers.forEach(d=>d==null?void 0:d()),helperGroup.parent&&helperGroup.parent.remove(helperGroup)}handleEnable(enabled,userAction=!0){enabled?(this.everyHelperDo(helper=>helper.enable()),this.hooks.emit(`enable`,{userAction})):(this.everyHelperDo(helper=>helper.disable()),this.hooks.emit(`disable`,{userAction})),this.state.enabled=enabled}handleVisible(visible,userAction=!0){visible?(this.everyHelperDo(helper=>helper.show()),this.actionIfStateIsEnabled(()=>this.hooks.emit(`show`,{userAction}))):(this.everyHelperDo(helper=>helper.hide()),this.actionIfStateIsEnabled(()=>this.hooks.emit(`hide`,{userAction}))),this.state.visible=visible}handleDispose(){this.objectHelperMap.forEach(({helper,disposers,helperGroup})=>{helper.dispose(),disposers==null||disposers.forEach(d=>d==null?void 0:d()),helperGroup.parent&&helperGroup.parent.remove(helperGroup)}),this.objectHelperMap.clear()}everyHelperDo(func){this.objectHelperMap.forEach(({helper,disposers})=>{helper&&func(helper,disposers)})}actionIfStateIsEnabled(func,options){if(this.state.enabled)return func();options!=null&&options.warnLog&&disableWarnLog()}getConfig(config){if(config&&typeof config!=`boolean`&&config.enable)return config}};export{Controller,Object3DHelper,PLUGIN};
|
|
@@ -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/4
|
|
5
|
+
* Version: 1.0.0-alpha.15
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +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
|
-
*/const
|
|
338
|
+
*/const require_runtime=require("../../../_virtual/_rolldown/runtime.js"),require_isNil=require("../../../five/utils/isNil.js"),require_cameraHooks=require("../utils/cameraHooks.js");let _realsee_five_webgpu=require("@realsee/five-webgpu"),three_webgpu=require("three/webgpu");three_webgpu=require_runtime.__toESM(three_webgpu,1);function toArray(value){return arguments.length===0?[]:Array.isArray(value)?value:[value]}var BaseController=class{updateOtherControllers(otherControllers){this.otherControllers=otherControllers}getIsDragging(){return this.isDragging}constructor(params,config){var _a,_b,_c;this.preventTapDefaultEvent=!1,this.disposers=[],this.isDragging=!1,this.enabled=!1,this.name=`BaseController`,this.onWantsTapGesture=raycaster=>{if(this.getIntersectObject(raycaster))return!1},this.updateHelperScale=()=>{`update`in this.helperObject3D&&typeof this.helperObject3D.update==`function`&&this.helperObject3D.update(this.camera),this.helperObject3D.setScaleByCamera(this.camera)},this.getBox=()=>(this.boundingBox||(this.boundingBox=new three_webgpu.Box3().expandByObject(this.originObject3D)),this.boundingBox),this.hooks=(_a=params.sharedHooks)==null?new _realsee_five_webgpu.Subscribe:_a,this.internalHooks=(_b=params.sharedInternalHooks)==null?new _realsee_five_webgpu.Subscribe:_b,this.camera=params.camera,this.model=params.model,this.originObject3D=params.originObject3D,this.helperObject3D=params.helperObject3D,this.container=params.container,this.scene=params.scene,this.domEvents=params.domEvents,this.onRender=(_c=params.onRender)==null?(()=>{}):_c,this.config=config==null?{}:config,this.otherControllers=params.otherControllers,this.initialHelperPosition(),this.initialHelperQuaternion(),this.updateHelperScale(),this.cameraHooks=require_cameraHooks.cameraHooks(this.camera),this.enable();let handleSetObjectScale=this.onSetOriginObjectScale.bind(this),handleSetObjectRotate=this.onSetOriginObjectRotate.bind(this),handleSetObjectPosition=this.onSetOriginObjectPosition.bind(this),handleApplyObjectScale=this.onApplyOriginObjectScale.bind(this),handleApplyObjectRotate=this.onApplyOriginObjectRotate.bind(this),handleApplyObjectPosition=this.onApplyOriginObjectPosition.bind(this),initialHelperPosition=this.initialHelperPosition.bind(this);this.cameraHooks.on(`cameraUpdate`,this.updateHelperScale),this.internalHooks.on(`initialHelperPosition`,initialHelperPosition),this.internalHooks.on(`setObjectScale`,handleSetObjectScale),this.internalHooks.on(`setObjectRotate`,handleSetObjectRotate),this.internalHooks.on(`setObjectPosition`,handleSetObjectPosition),this.internalHooks.on(`applyObjectPosition`,handleApplyObjectPosition),this.internalHooks.on(`applyObjectRotate`,handleApplyObjectRotate),this.internalHooks.on(`applyObjectScale`,handleApplyObjectScale),this.hooks.on(`moveEnd`,this.updateHelperScale),this.internalHooks.on(`setObjectPosition`,this.updateHelperScale),this.internalHooks.on(`initialHelperPosition`,this.updateHelperScale),this.disposers.push(()=>{this.cameraHooks.off(`cameraUpdate`,this.updateHelperScale),this.internalHooks.off(`initialHelperPosition`,initialHelperPosition),this.internalHooks.off(`setObjectScale`,handleSetObjectScale),this.internalHooks.off(`setObjectRotate`,handleSetObjectRotate),this.internalHooks.off(`setObjectPosition`,handleSetObjectPosition),this.internalHooks.off(`applyObjectPosition`,handleApplyObjectPosition),this.internalHooks.off(`applyObjectRotate`,handleApplyObjectRotate),this.internalHooks.off(`applyObjectScale`,handleApplyObjectScale),this.hooks.off(`moveEnd`,this.updateHelperScale),this.internalHooks.off(`setObjectPosition`,this.updateHelperScale),this.internalHooks.off(`initialHelperPosition`,this.updateHelperScale)})}initialHelperPosition(){this.helperObject3D.initialPosition(this.calculateOffset(this.config.offset))}initialHelperQuaternion(){this.helperObject3D.initQuaternion(this.config)}enable(){this.enabled||(this.enabled=!0,this.scene.add(this.helperObject3D),this.helperObject3D.enable(),this.render())}disable(){this.enabled&&(this.enabled=!1,this.helperObject3D.disable(),this.render())}show(){this.helperObject3D.show(),this.render()}hide(){this.helperObject3D.hide(),this.render()}dispose(){var _a;(_a=this.disposers)==null||_a.forEach(d=>d==null?void 0:d()),this.helperObject3D.dispose(),this.render()}applyHelperMatrix4(matrix){this.helperObject3D.applyMatrix4(matrix)}applyHelperQuaternion(quaternion,origin){this.helperObject3D.applyHelperQuaternion(quaternion,origin)}applyHelperScaleMatrix4(matrix,origin){this.helperObject3D.applyHelperScaleMatrix4(matrix,origin)}onWantsGesture(type,pointers,final){if(this.isDragging)return!1}onIntersectionOnModelUpdate(intersection){}onApplyOriginObjectScale(params){this.applyHelperScaleMatrix4(params.matrix,params.origin)}onApplyOriginObjectRotate(params){let origin=params.origin;if(origin){let v=new three_webgpu.Vector3().subVectors(this.helperObject3D.position,origin).applyQuaternion(params.quaternion).add(origin);this.helperObject3D.position.copy(v)}}onApplyOriginObjectPosition(params){this.applyHelperMatrix4(params.matrix)}onSetOriginObjectScale(scale){this.helperObject3D.scale.copy(scale),this.updateOffsetByScale(scale)}onSetOriginObjectRotate(_quaternion,_origin){}onSetOriginObjectPosition(position){this.helperObject3D.position.copy(position.clone().add(this.calculateOffset(this.config.offset)))}render(){this.onRender()}updateOffsetByScale(scale){if(this.boundingBox&&this.config.offset){let origin=this.originObject3D.position,max=new three_webgpu.Vector3().subVectors(this.boundingBox.max,origin).multiply(scale).add(origin),min=new three_webgpu.Vector3().subVectors(this.boundingBox.min,origin).multiply(scale).add(origin),offset=this.calculateOffset(this.config.offset,{min,max});this.helperObject3D.initialPosition(offset)}}hoverListener(object3D,hoverColor=16777215,hoverOpacity=1){let objects=toArray(object3D).filter(object=>!require_isNil.isNil(object)),disposers=[];for(let object of objects)if(object.material||object instanceof three_webgpu.Group){let meshes=object instanceof three_webgpu.Group?object.children.filter(child=>child instanceof three_webgpu.Mesh):[object];meshes.forEach(mesh=>{var _a,_b,_c,_d;let mat=mesh.material;Array.isArray(mat)?(mesh.__originalColor__=(_a=mesh.__originalColor__)==null?mat.map(m=>m.color.clone()):_a,mesh.__originalOpacity__=(_b=mesh.__originalOpacity__)==null?mat.map(m=>m.opacity):_b):(mesh.__originalColor__=(_c=mesh.__originalColor__)==null?mat.color.clone():_c,mesh.__originalOpacity__=(_d=mesh.__originalOpacity__)==null?mat.opacity:_d)});let setHoverColor=()=>{meshes.forEach(mesh=>{if(mesh.name===`ScaleHelperTransparentGroup`){if(mesh.children[0]){let childMat=mesh.children[0].material;childMat.color.set(hoverColor),childMat.opacity=hoverOpacity}}else{let mat=mesh.material;Array.isArray(mat)?mat.forEach(m=>{m.color.set(hoverColor),m.opacity=hoverOpacity}):(mat.color.set(hoverColor),mat.opacity=hoverOpacity)}}),this.render()},resetColor=()=>{meshes.forEach(mesh=>{if(mesh.name===`ScaleHelperTransparentGroup`){if(mesh.children[0]){let childMat=mesh.children[0].material;childMat.color.set(16776960),childMat.opacity=1}}else{let mat=mesh.material;if(Array.isArray(mat)){let originalColors=mesh.__originalColor__,originalOpacities=mesh.__originalOpacity__;mat.forEach((m,index)=>{originalColors&&originalColors[index]&&m.color.copy(originalColors[index]),originalOpacities&&originalOpacities[index]!==void 0&&(m.opacity=originalOpacities[index])})}else mat.color.copy(mesh.__originalColor__),mat.opacity=mesh.__originalOpacity__}}),this.render()},handleMouseover=_e=>{this.isDragging||setHoverColor()},handleMouseout=_e=>{this.isDragging||resetColor()};for(let mesh of meshes)this.domEvents.addEventListener(mesh,`mouseover`,handleMouseover),this.domEvents.addEventListener(mesh,`mouseout`,handleMouseout),this.hooks.on(`moveStart`,setHoverColor),this.hooks.on(`moveEnd`,resetColor),this.hooks.on(`rotateEnd`,resetColor),this.hooks.on(`scaleEnd`,resetColor),disposers.push(()=>{this.domEvents.removeEventListener(mesh,`mouseover`,handleMouseover),this.domEvents.removeEventListener(mesh,`mouseout`,handleMouseout),this.hooks.off(`moveStart`,setHoverColor),this.hooks.off(`moveEnd`,resetColor),this.hooks.off(`rotateEnd`,resetColor),this.hooks.off(`scaleEnd`,resetColor)})}return()=>disposers.forEach(disposer=>disposer==null?void 0:disposer())}getIntersectObject(raycaster){let cameraPosition=this.camera.position,object=this.helperObject3D;if(!object)return;let intersection=this.helperObject3D.raycasterIntersectObject(raycaster)[0];if(!intersection)return;let objectIntersection=intersection;if(objectIntersection.object=object,this.model.intersectRaycaster){let modelIntersection=this.model.intersectRaycaster(raycaster)[0];if(modelIntersection&&modelIntersection.point.distanceTo(cameraPosition)<objectIntersection.point.distanceTo(cameraPosition))return}return objectIntersection.object}calculateOffset(offset,box3){let result=new three_webgpu.Vector3(0,0,0);if(!offset)return result;let getBox=()=>box3||this.getBox();if(typeof offset.x==`number`)result.setX(offset.x);else if(typeof offset.x==`object`){let box=getBox();result.setX((box.max.x-box.min.x)*offset.x.percents)}if(typeof offset.y==`number`)result.setY(offset.y);else if(typeof offset.y==`object`){let box=getBox();result.setY((box.max.y-box.min.y)*offset.y.percents)}if(typeof offset.z==`number`)result.setZ(offset.z);else if(typeof offset.z==`object`){let box=getBox();result.setZ((box.max.z-box.min.z)*offset.z.percents)}return result}};exports.BaseController=BaseController;
|
|
@@ -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/4
|
|
5
|
+
* Version: 1.0.0-alpha.15
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +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{isNil
|
|
338
|
+
*/import{isNil}from"../../../five/utils/isNil.mjs";import{cameraHooks}from"../utils/cameraHooks.mjs";import{Subscribe}from"@realsee/five-webgpu";import*as THREE from"three/webgpu";function toArray(value){return arguments.length===0?[]:Array.isArray(value)?value:[value]}var BaseController=class{updateOtherControllers(otherControllers){this.otherControllers=otherControllers}getIsDragging(){return this.isDragging}constructor(params,config){var _a,_b,_c;this.preventTapDefaultEvent=!1,this.disposers=[],this.isDragging=!1,this.enabled=!1,this.name=`BaseController`,this.onWantsTapGesture=raycaster=>{if(this.getIntersectObject(raycaster))return!1},this.updateHelperScale=()=>{`update`in this.helperObject3D&&typeof this.helperObject3D.update==`function`&&this.helperObject3D.update(this.camera),this.helperObject3D.setScaleByCamera(this.camera)},this.getBox=()=>(this.boundingBox||(this.boundingBox=new THREE.Box3().expandByObject(this.originObject3D)),this.boundingBox),this.hooks=(_a=params.sharedHooks)==null?new Subscribe:_a,this.internalHooks=(_b=params.sharedInternalHooks)==null?new Subscribe:_b,this.camera=params.camera,this.model=params.model,this.originObject3D=params.originObject3D,this.helperObject3D=params.helperObject3D,this.container=params.container,this.scene=params.scene,this.domEvents=params.domEvents,this.onRender=(_c=params.onRender)==null?(()=>{}):_c,this.config=config==null?{}:config,this.otherControllers=params.otherControllers,this.initialHelperPosition(),this.initialHelperQuaternion(),this.updateHelperScale(),this.cameraHooks=cameraHooks(this.camera),this.enable();let handleSetObjectScale=this.onSetOriginObjectScale.bind(this),handleSetObjectRotate=this.onSetOriginObjectRotate.bind(this),handleSetObjectPosition=this.onSetOriginObjectPosition.bind(this),handleApplyObjectScale=this.onApplyOriginObjectScale.bind(this),handleApplyObjectRotate=this.onApplyOriginObjectRotate.bind(this),handleApplyObjectPosition=this.onApplyOriginObjectPosition.bind(this),initialHelperPosition=this.initialHelperPosition.bind(this);this.cameraHooks.on(`cameraUpdate`,this.updateHelperScale),this.internalHooks.on(`initialHelperPosition`,initialHelperPosition),this.internalHooks.on(`setObjectScale`,handleSetObjectScale),this.internalHooks.on(`setObjectRotate`,handleSetObjectRotate),this.internalHooks.on(`setObjectPosition`,handleSetObjectPosition),this.internalHooks.on(`applyObjectPosition`,handleApplyObjectPosition),this.internalHooks.on(`applyObjectRotate`,handleApplyObjectRotate),this.internalHooks.on(`applyObjectScale`,handleApplyObjectScale),this.hooks.on(`moveEnd`,this.updateHelperScale),this.internalHooks.on(`setObjectPosition`,this.updateHelperScale),this.internalHooks.on(`initialHelperPosition`,this.updateHelperScale),this.disposers.push(()=>{this.cameraHooks.off(`cameraUpdate`,this.updateHelperScale),this.internalHooks.off(`initialHelperPosition`,initialHelperPosition),this.internalHooks.off(`setObjectScale`,handleSetObjectScale),this.internalHooks.off(`setObjectRotate`,handleSetObjectRotate),this.internalHooks.off(`setObjectPosition`,handleSetObjectPosition),this.internalHooks.off(`applyObjectPosition`,handleApplyObjectPosition),this.internalHooks.off(`applyObjectRotate`,handleApplyObjectRotate),this.internalHooks.off(`applyObjectScale`,handleApplyObjectScale),this.hooks.off(`moveEnd`,this.updateHelperScale),this.internalHooks.off(`setObjectPosition`,this.updateHelperScale),this.internalHooks.off(`initialHelperPosition`,this.updateHelperScale)})}initialHelperPosition(){this.helperObject3D.initialPosition(this.calculateOffset(this.config.offset))}initialHelperQuaternion(){this.helperObject3D.initQuaternion(this.config)}enable(){this.enabled||(this.enabled=!0,this.scene.add(this.helperObject3D),this.helperObject3D.enable(),this.render())}disable(){this.enabled&&(this.enabled=!1,this.helperObject3D.disable(),this.render())}show(){this.helperObject3D.show(),this.render()}hide(){this.helperObject3D.hide(),this.render()}dispose(){var _a;(_a=this.disposers)==null||_a.forEach(d=>d==null?void 0:d()),this.helperObject3D.dispose(),this.render()}applyHelperMatrix4(matrix){this.helperObject3D.applyMatrix4(matrix)}applyHelperQuaternion(quaternion,origin){this.helperObject3D.applyHelperQuaternion(quaternion,origin)}applyHelperScaleMatrix4(matrix,origin){this.helperObject3D.applyHelperScaleMatrix4(matrix,origin)}onWantsGesture(type,pointers,final){if(this.isDragging)return!1}onIntersectionOnModelUpdate(intersection){}onApplyOriginObjectScale(params){this.applyHelperScaleMatrix4(params.matrix,params.origin)}onApplyOriginObjectRotate(params){let origin=params.origin;if(origin){let v=new THREE.Vector3().subVectors(this.helperObject3D.position,origin).applyQuaternion(params.quaternion).add(origin);this.helperObject3D.position.copy(v)}}onApplyOriginObjectPosition(params){this.applyHelperMatrix4(params.matrix)}onSetOriginObjectScale(scale){this.helperObject3D.scale.copy(scale),this.updateOffsetByScale(scale)}onSetOriginObjectRotate(_quaternion,_origin){}onSetOriginObjectPosition(position){this.helperObject3D.position.copy(position.clone().add(this.calculateOffset(this.config.offset)))}render(){this.onRender()}updateOffsetByScale(scale){if(this.boundingBox&&this.config.offset){let origin=this.originObject3D.position,max=new THREE.Vector3().subVectors(this.boundingBox.max,origin).multiply(scale).add(origin),min=new THREE.Vector3().subVectors(this.boundingBox.min,origin).multiply(scale).add(origin),offset=this.calculateOffset(this.config.offset,{min,max});this.helperObject3D.initialPosition(offset)}}hoverListener(object3D,hoverColor=16777215,hoverOpacity=1){let objects=toArray(object3D).filter(object=>!isNil(object)),disposers=[];for(let object of objects)if(object.material||object instanceof THREE.Group){let meshes=object instanceof THREE.Group?object.children.filter(child=>child instanceof THREE.Mesh):[object];meshes.forEach(mesh=>{var _a,_b,_c,_d;let mat=mesh.material;Array.isArray(mat)?(mesh.__originalColor__=(_a=mesh.__originalColor__)==null?mat.map(m=>m.color.clone()):_a,mesh.__originalOpacity__=(_b=mesh.__originalOpacity__)==null?mat.map(m=>m.opacity):_b):(mesh.__originalColor__=(_c=mesh.__originalColor__)==null?mat.color.clone():_c,mesh.__originalOpacity__=(_d=mesh.__originalOpacity__)==null?mat.opacity:_d)});let setHoverColor=()=>{meshes.forEach(mesh=>{if(mesh.name===`ScaleHelperTransparentGroup`){if(mesh.children[0]){let childMat=mesh.children[0].material;childMat.color.set(hoverColor),childMat.opacity=hoverOpacity}}else{let mat=mesh.material;Array.isArray(mat)?mat.forEach(m=>{m.color.set(hoverColor),m.opacity=hoverOpacity}):(mat.color.set(hoverColor),mat.opacity=hoverOpacity)}}),this.render()},resetColor=()=>{meshes.forEach(mesh=>{if(mesh.name===`ScaleHelperTransparentGroup`){if(mesh.children[0]){let childMat=mesh.children[0].material;childMat.color.set(16776960),childMat.opacity=1}}else{let mat=mesh.material;if(Array.isArray(mat)){let originalColors=mesh.__originalColor__,originalOpacities=mesh.__originalOpacity__;mat.forEach((m,index)=>{originalColors&&originalColors[index]&&m.color.copy(originalColors[index]),originalOpacities&&originalOpacities[index]!==void 0&&(m.opacity=originalOpacities[index])})}else mat.color.copy(mesh.__originalColor__),mat.opacity=mesh.__originalOpacity__}}),this.render()},handleMouseover=_e=>{this.isDragging||setHoverColor()},handleMouseout=_e=>{this.isDragging||resetColor()};for(let mesh of meshes)this.domEvents.addEventListener(mesh,`mouseover`,handleMouseover),this.domEvents.addEventListener(mesh,`mouseout`,handleMouseout),this.hooks.on(`moveStart`,setHoverColor),this.hooks.on(`moveEnd`,resetColor),this.hooks.on(`rotateEnd`,resetColor),this.hooks.on(`scaleEnd`,resetColor),disposers.push(()=>{this.domEvents.removeEventListener(mesh,`mouseover`,handleMouseover),this.domEvents.removeEventListener(mesh,`mouseout`,handleMouseout),this.hooks.off(`moveStart`,setHoverColor),this.hooks.off(`moveEnd`,resetColor),this.hooks.off(`rotateEnd`,resetColor),this.hooks.off(`scaleEnd`,resetColor)})}return()=>disposers.forEach(disposer=>disposer==null?void 0:disposer())}getIntersectObject(raycaster){let cameraPosition=this.camera.position,object=this.helperObject3D;if(!object)return;let intersection=this.helperObject3D.raycasterIntersectObject(raycaster)[0];if(!intersection)return;let objectIntersection=intersection;if(objectIntersection.object=object,this.model.intersectRaycaster){let modelIntersection=this.model.intersectRaycaster(raycaster)[0];if(modelIntersection&&modelIntersection.point.distanceTo(cameraPosition)<objectIntersection.point.distanceTo(cameraPosition))return}return objectIntersection.object}calculateOffset(offset,box3){let result=new THREE.Vector3(0,0,0);if(!offset)return result;let getBox=()=>box3||this.getBox();if(typeof offset.x==`number`)result.setX(offset.x);else if(typeof offset.x==`object`){let box=getBox();result.setX((box.max.x-box.min.x)*offset.x.percents)}if(typeof offset.y==`number`)result.setY(offset.y);else if(typeof offset.y==`object`){let box=getBox();result.setY((box.max.y-box.min.y)*offset.y.percents)}if(typeof offset.z==`number`)result.setZ(offset.z);else if(typeof offset.z==`object`){let box=getBox();result.setZ((box.max.z-box.min.z)*offset.z.percents)}return result}};export{BaseController};
|