@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
|
-
*/const
|
|
338
|
+
*/const require_BaseController=require("./BaseController.js");var BoundingBoxController=class extends require_BaseController.BaseController{constructor(...params){super(...params),this.name=`BoundingBoxController`;let syncAndUpdate=()=>{this.syncWithObject(),this.render()};this.hooks.on(`moveEnd`,syncAndUpdate),this.hooks.on(`rotateEnd`,syncAndUpdate),this.hooks.on(`scaleEnd`,syncAndUpdate),this.disposers.push(()=>{this.hooks.off(`moveEnd`,syncAndUpdate),this.hooks.off(`rotateEnd`,syncAndUpdate),this.hooks.off(`scaleEnd`,syncAndUpdate)})}onApplyOriginObjectRotate(params){this.helperObject3D.applyHelperQuaternion(params.quaternion,params.origin)}onSetOriginObjectRotate(quaternion,origin){this.helperObject3D.setHelperQuaternion(quaternion,origin)}syncWithObject(){this.helperObject3D.position.copy(this.originObject3D.position),this.helperObject3D.quaternion.copy(this.originObject3D.quaternion),this.helperObject3D.scale.copy(this.originObject3D.scale);let helper=this.helperObject3D;helper.update&&helper.update()}};exports.BoundingBoxController=BoundingBoxController;
|
|
@@ -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{BaseController
|
|
338
|
+
*/import{BaseController}from"./BaseController.mjs";var BoundingBoxController=class extends BaseController{constructor(...params){super(...params),this.name=`BoundingBoxController`;let syncAndUpdate=()=>{this.syncWithObject(),this.render()};this.hooks.on(`moveEnd`,syncAndUpdate),this.hooks.on(`rotateEnd`,syncAndUpdate),this.hooks.on(`scaleEnd`,syncAndUpdate),this.disposers.push(()=>{this.hooks.off(`moveEnd`,syncAndUpdate),this.hooks.off(`rotateEnd`,syncAndUpdate),this.hooks.off(`scaleEnd`,syncAndUpdate)})}onApplyOriginObjectRotate(params){this.helperObject3D.applyHelperQuaternion(params.quaternion,params.origin)}onSetOriginObjectRotate(quaternion,origin){this.helperObject3D.setHelperQuaternion(quaternion,origin)}syncWithObject(){this.helperObject3D.position.copy(this.originObject3D.position),this.helperObject3D.quaternion.copy(this.originObject3D.quaternion),this.helperObject3D.scale.copy(this.originObject3D.scale);let helper=this.helperObject3D;helper.update&&helper.update()}};export{BoundingBoxController};
|
|
@@ -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("../constant.js"),n=require("../utils/CenterHandle.js"),r=require("./BaseController.js"),i=require("../utils/solidGuide.js"),a=require("../utils/getMouseRaycaster.js");let o=require("three/webgpu");o=e.__toESM(o,1);function s(e){let{raycaster:t,line:n,clampToLine:r=!0}=e,i=new o.Plane().setFromNormalAndCoplanarPoint(t.ray.direction.clone().normalize(),new o.Vector3),a=i.projectPoint(n.start,new o.Vector3),s=i.projectPoint(n.end,new o.Vector3),c=new o.Line3(a,s),l=c.closestPointToPoint(t.ray.origin,r,new o.Vector3),u=l.distanceTo(s),d=l.distanceTo(a),f=c.distance();if(u>d&&u>f){let e=-l.distanceTo(a)/f,t=n.start.clone().sub(n.end).normalize();return n.start.clone().sub(t.clone().multiplyScalar(e*n.distance()))}else{let e=l.distanceTo(a)/f;return new o.Vector3().lerpVectors(n.start,n.end,e)}}var c=class extends r.BaseController{get moveByMouseEnable(){return this._moveByMouse.enabled}constructor(...e){var r,s,c,l,u;super(...e),this.name=`MoveController`,this.solidGuide=new i.SolidGuideLine(this.camera,this.container,(s=(r=this.config)==null?void 0:r.solidGuide)==null?{}:s),this._moveByMouse={enabled:!1},this.dragStart=e=>{if(this.moveByMouseEnable||this.isDragging)return;let n=e==null?void 0:e.intersect;if(!n)return this.dragEnd();let r=(n==null?void 0:n.object).direction;if(!r)return this.dragEnd();let i=new o.Vector3(1,0,0),a=new o.Vector3(0,1,0),s=new o.Vector3(0,0,1),c=(()=>{switch(r){case`x`:return i;case`y`:return a;case`z`:return s;case`xy`:case`xz`:case`yz`:case`plane`:return}})(),l=n.point.clone();if(r===`xy`||r===`xz`||r===`yz`){let e=(()=>{switch(r){case`xy`:return s;case`xz`:return a;case`yz`:return i}})(),t=new o.Plane().setFromNormalAndCoplanarPoint(e,l),n=l.clone();this.startInfo={draggingDirection:r,startVectorProject:n,line:new o.Line3(n.clone(),n.clone()),plane:t}}else if(r===`plane`){let e=this.camera.position.clone(),t=l.clone(),n=t.clone().sub(e).normalize(),i=new o.Plane().setFromNormalAndCoplanarPoint(n,t),a=t.clone();this.startInfo={draggingDirection:r,startVectorProject:a,line:new o.Line3(a.clone(),a.clone()),plane:i}}else{if(!c)return this.dragEnd();let e=new o.Line3(l.clone().sub(c.normalize()),l.clone().add(c.normalize()));this.startInfo={draggingDirection:r,startVectorProject:l,line:e};try{let e=c.clone().normalize(),n=this.helperObject3D.getWorldPosition(new o.Vector3),r=this.solidGuide.createSolidLine(n,e,{color:16777215,renderOrder:t.RENDER_ORDER.DRAG_GUIDE_LINE});this.scene.add(r),this.dragGuideLine=r}catch(e){}}let u=(()=>{switch(r){case`plane`:return[];case`xy`:return[`x`,`y`,`xy`];case`xz`:return[`x`,`z`,`xz`];case`yz`:return[`y`,`z`,`yz`];default:return[r]}})();this.helperObject3D.showDraggingHelper(u),this.hooks.emit(`moveStart`,r),this.isDragging=!0,this.setTipsText(this.originObject3D.position),this.setTipsPosition(l)},this.dragging=e=>{if(!this.isDragging||!this.startInfo)return;let t=`touches`in e?e.touches[0].clientX:e.x,n=`touches`in e?e.touches[0].clientY:e.y,r=a.getMouseRaycaster(this.camera,{x:t,y:n},this.container);return r?(this.move(r),!1):this.dragEnd()},this.dragEnd=()=>{if(this.isDragging){if(this.startInfo=void 0,this.isDragging=!1,this.dragGuideLine){this.scene.remove(this.dragGuideLine),this.dragGuideLine.geometry.dispose();let e=this.dragGuideLine.material;Array.isArray(e)?e.forEach(e=>e.dispose()):e.dispose(),this.dragGuideLine=void 0}this.helperObject3D.show(),this.hooks.emit(`moveEnd`)}};let d=this.helperObject3D;if(this.hoverListener([d.xArrow,d.yArrow,d.zArrow,(c=d.xyPlane)==null?void 0:c.handle,(l=d.xzPlane)==null?void 0:l.handle,(u=d.yzPlane)==null?void 0:u.handle]),d.centerHandle&&d.centerHandle instanceof n.CenterHandle){let e=d.centerHandle,t=e.cube;this.domEvents.addEventListener(t,`mouseover`,()=>{this.isDragging||(Array.isArray(t.material)&&t.material.forEach(e=>{e.color.set(16777215)}),this.render())}),this.domEvents.addEventListener(t,`mouseout`,()=>{this.isDragging||(e.update(this.camera),this.render())})}let f=this.show.bind(this),p=this.hide.bind(this),m=()=>{this.helperObject3D.update(this.camera),this.isDragging&&this.updateDragGuideLineScale(),this.render()};m(),this.domEvents.addEventListener(this.helperObject3D,`mousedown`,this.dragStart),document.addEventListener(`mousemove`,this.dragging),document.addEventListener(`mouseup`,this.dragEnd),this.domEvents.addEventListener(this.helperObject3D,`touchstart`,this.dragStart),document.addEventListener(`touchmove`,this.dragging),document.addEventListener(`touchend`,this.dragEnd),this.hooks.on(`rotateStart`,p),this.hooks.on(`rotateEnd`,f),this.hooks.on(`scaleStart`,p),this.hooks.on(`scaleEnd`,f),this.hooks.on(`moveByMouseEnable`,p),this.hooks.on(`moveByMouseDisable`,f),this.hooks.on(`updateOtherHelpers`,e=>{this.helperObject3D.update(e.camera),this.render()}),this.cameraHooks.on(`cameraUpdate`,m),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,`mousedown`,this.dragStart),document.removeEventListener(`mousemove`,this.dragging),document.removeEventListener(`mouseup`,this.dragEnd),this.domEvents.removeEventListener(this.helperObject3D,`touchstart`,this.dragStart),document.removeEventListener(`touchmove`,this.dragging),document.removeEventListener(`touchend`,this.dragEnd),this.hooks.off(`rotateStart`,p),this.hooks.off(`rotateEnd`,f),this.hooks.off(`scaleStart`,p),this.hooks.off(`scaleEnd`,f),this.hooks.off(`moveByMouseEnable`,p),this.hooks.off(`moveByMouseDisable`,f),this.hooks.off(`updateOtherHelpers`),this.cameraHooks.off(`cameraUpdate`,m)}),this.moveByMouseEnable&&this.moveByMouse()}dispose(){var e;super.dispose(),(e=this.disposers)==null||e.forEach(e=>e==null?void 0:e())}moveByMouse(e){this._moveByMouse={enabled:!0,useFaceNormal:e==null?void 0:e.useFaceNormal},this.preventTapDefaultEvent=!0;let t=this.handleMouseDown.bind(this),n=this.handleMouseUp.bind(this);this.hooks.emit(`moveByMouseEnable`),setTimeout(()=>{this.container.addEventListener(`mousedown`,t),this.container.addEventListener(`mouseup`,n)}),this.mousedownEventListenerDisposer=()=>{this.container.removeEventListener(`mousedown`,t),this.container.removeEventListener(`mouseup`,n)}}disableMoveByMouse(){var e;this._moveByMouse={enabled:!1},this.preventTapDefaultEvent=!1,this.hooks.emit(`moveByMouseDisable`),(e=this.mousedownEventListenerDisposer)==null||e.call(this)}onIntersectionOnModelUpdate(e){var t,n,r;if(!this.moveByMouseEnable)return;let{point:i,face:a}=e;if(!this.hooks.emit(`wantToMove`,i)){if(this.originObject3D.position.copy(i),(this._moveByMouse.useFaceNormal===!0||typeof this._moveByMouse.useFaceNormal==`object`&&this._moveByMouse.useFaceNormal.enable!==!1)&&a!=null&&a.normal){let e=typeof this._moveByMouse.useFaceNormal==`object`&&this._moveByMouse.useFaceNormal.alignmentVector?this._moveByMouse.useFaceNormal.alignmentVector:{x:0,y:1,z:0},i=new o.Vector3((t=e.x)==null?0:t,(n=e.y)==null?0:n,(r=e.z)==null?0:r),s=typeof this._moveByMouse.useFaceNormal==`object`&&this._moveByMouse.useFaceNormal.fixedFaceNormal?this._moveByMouse.useFaceNormal.fixedFaceNormal(a.normal):a.normal;this.originObject3D.quaternion.setFromUnitVectors(i,s),this.internalHooks.emit(`setObjectRotate`,this.originObject3D.quaternion.clone(),new o.Vector3)}this.internalHooks.emit(`setObjectPosition`,i),this.hooks.emit(`move`,i)}}handleMouseDown(e){let{x:t,y:n}=e;this.mouseInfo={x:t,y:n,mouseDownTimestamp:Date.now()}}handleMouseUp(e){if(!this.mouseInfo)return;let{x:t,y:n}=e;this.mouseInfo.x===t&&this.mouseInfo.y===n&&Date.now()-this.mouseInfo.mouseDownTimestamp<500&&(this.disableMoveByMouse(),this.mouseInfo=void 0)}updateDragGuideLineScale(){if(!this.dragGuideLine||!this.startInfo)return;let{line:e}=this.startInfo,t=e.end.clone().sub(e.start).normalize();if(t.lengthSq()<1e-6)return;let n=this.helperObject3D.getWorldPosition(new o.Vector3);this.solidGuide.updateSolidLine(this.dragGuideLine,n,t)}move(e){if(!this.startInfo)return this.dragEnd();let{line:t,startVectorProject:n}=this.startInfo,r=this.originObject3D,i=this.startInfo.draggingDirection===`plane`||this.startInfo.draggingDirection===`xy`||this.startInfo.draggingDirection===`xz`||this.startInfo.draggingDirection===`yz`,a;if(i){let t=this.startInfo.plane;if(!t)return;let n=new o.Vector3,r=t.normal.dot(e.ray.direction);if(Math.abs(r)<1e-6)return;let i=-(t.normal.dot(e.ray.origin)+t.constant)/r;if(i<0)return;n.copy(e.ray.origin.clone().add(e.ray.direction.clone().multiplyScalar(i))),a=n}else a=s({raycaster:e,line:t,clampToLine:!1});let c=r.position.clone(),l=a.clone().sub(n),u=new o.Matrix4;u.setPosition(l);let d=r.position.clone().applyMatrix4(u);if(this.hooks.emit(`wantToMove`,d))return;let f=d.clone();this.hooks.emit(`moveBefore`,f);let p=new o.Matrix4;p.setPosition(f.clone().sub(c)),r.position.copy(f),this.setTipsText(f),this.setTipsPosition(f),n.copy(a),this.internalHooks.emit(`applyObjectPosition`,{matrix:p}),this.hooks.emit(`move`,f)}setTipsText(e){var t;let n=(t=this.helperObject3D.moveTips)==null?void 0:t.element;if(!n||!this.startInfo)return;let r=this.startInfo.draggingDirection,i=e=>e.toFixed(3);switch(r){case`x`:n.innerText=`x: ${i(e.x)}`;break;case`y`:n.innerText=`y: ${i(e.y)}`;break;case`z`:n.innerText=`z: ${i(e.z)}`;break;case`xy`:n.innerText=`x: ${i(e.x)} y: ${i(e.y)}`;break;case`xz`:n.innerText=`x: ${i(e.x)} z: ${i(e.z)}`;break;case`yz`:n.innerText=`y: ${i(e.y)} z: ${i(e.z)}`;break;case`plane`:n.innerText=`x: ${i(e.x)} y: ${i(e.y)} z: ${i(e.z)}`;break}}setTipsPosition(e){let t=this.helperObject3D.moveTips;if(!t)return;let{x:n,y:r,z:i}=this.helperObject3D.getWorldPosition(new o.Vector3).clone().project(this.camera);if(i>1){t.hide();return}let a=this.container.getBoundingClientRect(),s=(n+1)/2*a.width,c=(-r+1)/2*a.height;t.setLeftTop(s+`px`,c+`px`)}};exports.MoveController=c,exports.rayOnLine=s;
|
|
338
|
+
*/const require_runtime=require("../../../_virtual/_rolldown/runtime.js"),require_constant=require("../constant.js"),require_CenterHandle=require("../utils/CenterHandle.js"),require_BaseController=require("./BaseController.js"),require_solidGuide=require("../utils/solidGuide.js"),require_getMouseRaycaster=require("../utils/getMouseRaycaster.js");let three_webgpu=require("three/webgpu");three_webgpu=require_runtime.__toESM(three_webgpu,1);function rayOnLine(params){let{raycaster,line,clampToLine=!0}=params,cameraPlane=new three_webgpu.Plane().setFromNormalAndCoplanarPoint(raycaster.ray.direction.clone().normalize(),new three_webgpu.Vector3),lineStartPointOnPlane=cameraPlane.projectPoint(line.start,new three_webgpu.Vector3),lineEndPointOnPlane=cameraPlane.projectPoint(line.end,new three_webgpu.Vector3),lineOnPlane=new three_webgpu.Line3(lineStartPointOnPlane,lineEndPointOnPlane),intersectionPointOnLineOnPlane=lineOnPlane.closestPointToPoint(raycaster.ray.origin,clampToLine,new three_webgpu.Vector3),pointToEndDistance=intersectionPointOnLineOnPlane.distanceTo(lineEndPointOnPlane),pointToStartDistance=intersectionPointOnLineOnPlane.distanceTo(lineStartPointOnPlane),lineOnPlaneDistance=lineOnPlane.distance();if(pointToEndDistance>pointToStartDistance&&pointToEndDistance>lineOnPlaneDistance){let distanceScale=-intersectionPointOnLineOnPlane.distanceTo(lineStartPointOnPlane)/lineOnPlaneDistance,lineVector=line.start.clone().sub(line.end).normalize();return line.start.clone().sub(lineVector.clone().multiplyScalar(distanceScale*line.distance()))}else{let distanceScale=intersectionPointOnLineOnPlane.distanceTo(lineStartPointOnPlane)/lineOnPlaneDistance;return new three_webgpu.Vector3().lerpVectors(line.start,line.end,distanceScale)}}var MoveController=class extends require_BaseController.BaseController{get moveByMouseEnable(){return this._moveByMouse.enabled}constructor(...params){var _a,_b,_c,_d,_e;super(...params),this.name=`MoveController`,this.solidGuide=new require_solidGuide.SolidGuideLine(this.camera,this.container,(_b=(_a=this.config)==null?void 0:_a.solidGuide)==null?{}:_b),this._moveByMouse={enabled:!1},this.dragStart=params=>{if(this.moveByMouseEnable||this.isDragging)return;let intersect=params==null?void 0:params.intersect;if(!intersect)return this.dragEnd();let draggingDirection=(intersect==null?void 0:intersect.object).direction;if(!draggingDirection)return this.dragEnd();let directionX=new three_webgpu.Vector3(1,0,0),directionY=new three_webgpu.Vector3(0,1,0),directionZ=new three_webgpu.Vector3(0,0,1),directionVector=(()=>{switch(draggingDirection){case`x`:return directionX;case`y`:return directionY;case`z`:return directionZ;case`xy`:case`xz`:case`yz`:case`plane`:return}})(),startIntersect=intersect.point.clone();if(draggingDirection===`xy`||draggingDirection===`xz`||draggingDirection===`yz`){let planeNormal=(()=>{switch(draggingDirection){case`xy`:return directionZ;case`xz`:return directionY;case`yz`:return directionX}})(),plane=new three_webgpu.Plane().setFromNormalAndCoplanarPoint(planeNormal,startIntersect),startProject=startIntersect.clone();this.startInfo={draggingDirection,startVectorProject:startProject,line:new three_webgpu.Line3(startProject.clone(),startProject.clone()),plane}}else if(draggingDirection===`plane`){let cameraPosition=this.camera.position.clone(),clickPoint=startIntersect.clone(),viewDirection=clickPoint.clone().sub(cameraPosition).normalize(),plane=new three_webgpu.Plane().setFromNormalAndCoplanarPoint(viewDirection,clickPoint),startProject=clickPoint.clone();this.startInfo={draggingDirection,startVectorProject:startProject,line:new three_webgpu.Line3(startProject.clone(),startProject.clone()),plane}}else{if(!directionVector)return this.dragEnd();let line=new three_webgpu.Line3(startIntersect.clone().sub(directionVector.normalize()),startIntersect.clone().add(directionVector.normalize()));this.startInfo={draggingDirection,startVectorProject:startIntersect,line};try{let dirNormalized=directionVector.clone().normalize(),center=this.helperObject3D.getWorldPosition(new three_webgpu.Vector3),line=this.solidGuide.createSolidLine(center,dirNormalized,{color:16777215,renderOrder:require_constant.RENDER_ORDER.DRAG_GUIDE_LINE});this.scene.add(line),this.dragGuideLine=line}catch(_a){}}let directionsToShow=(()=>{switch(draggingDirection){case`plane`:return[];case`xy`:return[`x`,`y`,`xy`];case`xz`:return[`x`,`z`,`xz`];case`yz`:return[`y`,`z`,`yz`];default:return[draggingDirection]}})();this.helperObject3D.showDraggingHelper(directionsToShow),this.hooks.emit(`moveStart`,draggingDirection),this.isDragging=!0,this.setTipsText(this.originObject3D.position),this.setTipsPosition(startIntersect)},this.dragging=point=>{if(!this.isDragging||!this.startInfo)return;let x=`touches`in point?point.touches[0].clientX:point.x,y=`touches`in point?point.touches[0].clientY:point.y,ray=require_getMouseRaycaster.getMouseRaycaster(this.camera,{x,y},this.container);return ray?(this.move(ray),!1):this.dragEnd()},this.dragEnd=()=>{if(this.isDragging){if(this.startInfo=void 0,this.isDragging=!1,this.dragGuideLine){this.scene.remove(this.dragGuideLine),this.dragGuideLine.geometry.dispose();let material=this.dragGuideLine.material;Array.isArray(material)?material.forEach(m=>m.dispose()):material.dispose(),this.dragGuideLine=void 0}this.helperObject3D.show(),this.hooks.emit(`moveEnd`)}};let helper=this.helperObject3D;if(this.hoverListener([helper.xArrow,helper.yArrow,helper.zArrow,(_c=helper.xyPlane)==null?void 0:_c.handle,(_d=helper.xzPlane)==null?void 0:_d.handle,(_e=helper.yzPlane)==null?void 0:_e.handle]),helper.centerHandle&&helper.centerHandle instanceof require_CenterHandle.CenterHandle){let centerHandle=helper.centerHandle,centerHandleMesh=centerHandle.cube;this.domEvents.addEventListener(centerHandleMesh,`mouseover`,()=>{this.isDragging||(Array.isArray(centerHandleMesh.material)&¢erHandleMesh.material.forEach(mat=>{mat.color.set(16777215)}),this.render())}),this.domEvents.addEventListener(centerHandleMesh,`mouseout`,()=>{this.isDragging||(centerHandle.update(this.camera),this.render())})}let show=this.show.bind(this),hide=this.hide.bind(this),updateHelperByCamera=()=>{this.helperObject3D.update(this.camera),this.isDragging&&this.updateDragGuideLineScale(),this.render()};updateHelperByCamera(),this.domEvents.addEventListener(this.helperObject3D,`mousedown`,this.dragStart),document.addEventListener(`mousemove`,this.dragging),document.addEventListener(`mouseup`,this.dragEnd),this.domEvents.addEventListener(this.helperObject3D,`touchstart`,this.dragStart),document.addEventListener(`touchmove`,this.dragging),document.addEventListener(`touchend`,this.dragEnd),this.hooks.on(`rotateStart`,hide),this.hooks.on(`rotateEnd`,show),this.hooks.on(`scaleStart`,hide),this.hooks.on(`scaleEnd`,show),this.hooks.on(`moveByMouseEnable`,hide),this.hooks.on(`moveByMouseDisable`,show),this.hooks.on(`updateOtherHelpers`,params=>{this.helperObject3D.update(params.camera),this.render()}),this.cameraHooks.on(`cameraUpdate`,updateHelperByCamera),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,`mousedown`,this.dragStart),document.removeEventListener(`mousemove`,this.dragging),document.removeEventListener(`mouseup`,this.dragEnd),this.domEvents.removeEventListener(this.helperObject3D,`touchstart`,this.dragStart),document.removeEventListener(`touchmove`,this.dragging),document.removeEventListener(`touchend`,this.dragEnd),this.hooks.off(`rotateStart`,hide),this.hooks.off(`rotateEnd`,show),this.hooks.off(`scaleStart`,hide),this.hooks.off(`scaleEnd`,show),this.hooks.off(`moveByMouseEnable`,hide),this.hooks.off(`moveByMouseDisable`,show),this.hooks.off(`updateOtherHelpers`),this.cameraHooks.off(`cameraUpdate`,updateHelperByCamera)}),this.moveByMouseEnable&&this.moveByMouse()}dispose(){var _a;super.dispose(),(_a=this.disposers)==null||_a.forEach(d=>d==null?void 0:d())}moveByMouse(params){this._moveByMouse={enabled:!0,useFaceNormal:params==null?void 0:params.useFaceNormal},this.preventTapDefaultEvent=!0;let mousedownListener=this.handleMouseDown.bind(this),mouseupListener=this.handleMouseUp.bind(this);this.hooks.emit(`moveByMouseEnable`),setTimeout(()=>{this.container.addEventListener(`mousedown`,mousedownListener),this.container.addEventListener(`mouseup`,mouseupListener)}),this.mousedownEventListenerDisposer=()=>{this.container.removeEventListener(`mousedown`,mousedownListener),this.container.removeEventListener(`mouseup`,mouseupListener)}}disableMoveByMouse(){var _a;this._moveByMouse={enabled:!1},this.preventTapDefaultEvent=!1,this.hooks.emit(`moveByMouseDisable`),(_a=this.mousedownEventListenerDisposer)==null||_a.call(this)}onIntersectionOnModelUpdate(intersection){var _a,_b,_c;if(!this.moveByMouseEnable)return;let{point,face}=intersection;if(!this.hooks.emit(`wantToMove`,point)){if(this.originObject3D.position.copy(point),(this._moveByMouse.useFaceNormal===!0||typeof this._moveByMouse.useFaceNormal==`object`&&this._moveByMouse.useFaceNormal.enable!==!1)&&face!=null&&face.normal){let alignment=typeof this._moveByMouse.useFaceNormal==`object`&&this._moveByMouse.useFaceNormal.alignmentVector?this._moveByMouse.useFaceNormal.alignmentVector:{x:0,y:1,z:0},alignmentVector3=new three_webgpu.Vector3((_a=alignment.x)==null?0:_a,(_b=alignment.y)==null?0:_b,(_c=alignment.z)==null?0:_c),faceNormal=typeof this._moveByMouse.useFaceNormal==`object`&&this._moveByMouse.useFaceNormal.fixedFaceNormal?this._moveByMouse.useFaceNormal.fixedFaceNormal(face.normal):face.normal;this.originObject3D.quaternion.setFromUnitVectors(alignmentVector3,faceNormal),this.internalHooks.emit(`setObjectRotate`,this.originObject3D.quaternion.clone(),new three_webgpu.Vector3)}this.internalHooks.emit(`setObjectPosition`,point),this.hooks.emit(`move`,point)}}handleMouseDown(event){let{x,y}=event;this.mouseInfo={x,y,mouseDownTimestamp:Date.now()}}handleMouseUp(event){if(!this.mouseInfo)return;let{x,y}=event;this.mouseInfo.x===x&&this.mouseInfo.y===y&&Date.now()-this.mouseInfo.mouseDownTimestamp<500&&(this.disableMoveByMouse(),this.mouseInfo=void 0)}updateDragGuideLineScale(){if(!this.dragGuideLine||!this.startInfo)return;let{line}=this.startInfo,dirNormalized=line.end.clone().sub(line.start).normalize();if(dirNormalized.lengthSq()<1e-6)return;let center=this.helperObject3D.getWorldPosition(new three_webgpu.Vector3);this.solidGuide.updateSolidLine(this.dragGuideLine,center,dirNormalized)}move(raycaster){if(!this.startInfo)return this.dragEnd();let{line,startVectorProject}=this.startInfo,object=this.originObject3D,isPlane=this.startInfo.draggingDirection===`plane`||this.startInfo.draggingDirection===`xy`||this.startInfo.draggingDirection===`xz`||this.startInfo.draggingDirection===`yz`,currentVectorProject;if(isPlane){let plane=this.startInfo.plane;if(!plane)return;let projected=new three_webgpu.Vector3,denom=plane.normal.dot(raycaster.ray.direction);if(Math.abs(denom)<1e-6)return;let t=-(plane.normal.dot(raycaster.ray.origin)+plane.constant)/denom;if(t<0)return;projected.copy(raycaster.ray.origin.clone().add(raycaster.ray.direction.clone().multiplyScalar(t))),currentVectorProject=projected}else currentVectorProject=rayOnLine({raycaster,line,clampToLine:!1});let beforePosition=object.position.clone(),offsetVector=currentVectorProject.clone().sub(startVectorProject),transform=new three_webgpu.Matrix4;transform.setPosition(offsetVector);let newPosition=object.position.clone().applyMatrix4(transform);if(this.hooks.emit(`wantToMove`,newPosition))return;let finalPosition=newPosition.clone();this.hooks.emit(`moveBefore`,finalPosition);let finalTransform=new three_webgpu.Matrix4;finalTransform.setPosition(finalPosition.clone().sub(beforePosition)),object.position.copy(finalPosition),this.setTipsText(finalPosition),this.setTipsPosition(finalPosition),startVectorProject.copy(currentVectorProject),this.internalHooks.emit(`applyObjectPosition`,{matrix:finalTransform}),this.hooks.emit(`move`,finalPosition)}setTipsText(position){var _a;let element=(_a=this.helperObject3D.moveTips)==null?void 0:_a.element;if(!element||!this.startInfo)return;let dir=this.startInfo.draggingDirection,fmt=n=>n.toFixed(3);switch(dir){case`x`:element.innerText=`x: ${fmt(position.x)}`;break;case`y`:element.innerText=`y: ${fmt(position.y)}`;break;case`z`:element.innerText=`z: ${fmt(position.z)}`;break;case`xy`:element.innerText=`x: ${fmt(position.x)} y: ${fmt(position.y)}`;break;case`xz`:element.innerText=`x: ${fmt(position.x)} z: ${fmt(position.z)}`;break;case`yz`:element.innerText=`y: ${fmt(position.y)} z: ${fmt(position.z)}`;break;case`plane`:element.innerText=`x: ${fmt(position.x)} y: ${fmt(position.y)} z: ${fmt(position.z)}`;break}}setTipsPosition(position){let moveTips=this.helperObject3D.moveTips;if(!moveTips)return;let{x,y,z}=this.helperObject3D.getWorldPosition(new three_webgpu.Vector3).clone().project(this.camera);if(z>1){moveTips.hide();return}let rect=this.container.getBoundingClientRect(),px=(x+1)/2*rect.width,py=(-y+1)/2*rect.height;moveTips.setLeftTop(px+`px`,py+`px`)}};exports.MoveController=MoveController,exports.rayOnLine=rayOnLine;
|
|
@@ -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{RENDER_ORDER as e}from"../constant.mjs";import{CenterHandle as t}from"../utils/CenterHandle.mjs";import{BaseController as n}from"./BaseController.mjs";import{SolidGuideLine as r}from"../utils/solidGuide.mjs";import{getMouseRaycaster as i}from"../utils/getMouseRaycaster.mjs";import*as a from"three/webgpu";function o(e){let{raycaster:t,line:n,clampToLine:r=!0}=e,i=new a.Plane().setFromNormalAndCoplanarPoint(t.ray.direction.clone().normalize(),new a.Vector3),o=i.projectPoint(n.start,new a.Vector3),s=i.projectPoint(n.end,new a.Vector3),c=new a.Line3(o,s),l=c.closestPointToPoint(t.ray.origin,r,new a.Vector3),u=l.distanceTo(s),d=l.distanceTo(o),f=c.distance();if(u>d&&u>f){let e=-l.distanceTo(o)/f,t=n.start.clone().sub(n.end).normalize();return n.start.clone().sub(t.clone().multiplyScalar(e*n.distance()))}else{let e=l.distanceTo(o)/f;return new a.Vector3().lerpVectors(n.start,n.end,e)}}var s=class extends n{get moveByMouseEnable(){return this._moveByMouse.enabled}constructor(...n){var o,s,c,l,u;super(...n),this.name=`MoveController`,this.solidGuide=new r(this.camera,this.container,(s=(o=this.config)==null?void 0:o.solidGuide)==null?{}:s),this._moveByMouse={enabled:!1},this.dragStart=t=>{if(this.moveByMouseEnable||this.isDragging)return;let n=t==null?void 0:t.intersect;if(!n)return this.dragEnd();let r=(n==null?void 0:n.object).direction;if(!r)return this.dragEnd();let i=new a.Vector3(1,0,0),o=new a.Vector3(0,1,0),s=new a.Vector3(0,0,1),c=(()=>{switch(r){case`x`:return i;case`y`:return o;case`z`:return s;case`xy`:case`xz`:case`yz`:case`plane`:return}})(),l=n.point.clone();if(r===`xy`||r===`xz`||r===`yz`){let e=(()=>{switch(r){case`xy`:return s;case`xz`:return o;case`yz`:return i}})(),t=new a.Plane().setFromNormalAndCoplanarPoint(e,l),n=l.clone();this.startInfo={draggingDirection:r,startVectorProject:n,line:new a.Line3(n.clone(),n.clone()),plane:t}}else if(r===`plane`){let e=this.camera.position.clone(),t=l.clone(),n=t.clone().sub(e).normalize(),i=new a.Plane().setFromNormalAndCoplanarPoint(n,t),o=t.clone();this.startInfo={draggingDirection:r,startVectorProject:o,line:new a.Line3(o.clone(),o.clone()),plane:i}}else{if(!c)return this.dragEnd();let t=new a.Line3(l.clone().sub(c.normalize()),l.clone().add(c.normalize()));this.startInfo={draggingDirection:r,startVectorProject:l,line:t};try{let t=c.clone().normalize(),n=this.helperObject3D.getWorldPosition(new a.Vector3),r=this.solidGuide.createSolidLine(n,t,{color:16777215,renderOrder:e.DRAG_GUIDE_LINE});this.scene.add(r),this.dragGuideLine=r}catch(e){}}let u=(()=>{switch(r){case`plane`:return[];case`xy`:return[`x`,`y`,`xy`];case`xz`:return[`x`,`z`,`xz`];case`yz`:return[`y`,`z`,`yz`];default:return[r]}})();this.helperObject3D.showDraggingHelper(u),this.hooks.emit(`moveStart`,r),this.isDragging=!0,this.setTipsText(this.originObject3D.position),this.setTipsPosition(l)},this.dragging=e=>{if(!this.isDragging||!this.startInfo)return;let t=`touches`in e?e.touches[0].clientX:e.x,n=`touches`in e?e.touches[0].clientY:e.y,r=i(this.camera,{x:t,y:n},this.container);return r?(this.move(r),!1):this.dragEnd()},this.dragEnd=()=>{if(this.isDragging){if(this.startInfo=void 0,this.isDragging=!1,this.dragGuideLine){this.scene.remove(this.dragGuideLine),this.dragGuideLine.geometry.dispose();let e=this.dragGuideLine.material;Array.isArray(e)?e.forEach(e=>e.dispose()):e.dispose(),this.dragGuideLine=void 0}this.helperObject3D.show(),this.hooks.emit(`moveEnd`)}};let d=this.helperObject3D;if(this.hoverListener([d.xArrow,d.yArrow,d.zArrow,(c=d.xyPlane)==null?void 0:c.handle,(l=d.xzPlane)==null?void 0:l.handle,(u=d.yzPlane)==null?void 0:u.handle]),d.centerHandle&&d.centerHandle instanceof t){let e=d.centerHandle,t=e.cube;this.domEvents.addEventListener(t,`mouseover`,()=>{this.isDragging||(Array.isArray(t.material)&&t.material.forEach(e=>{e.color.set(16777215)}),this.render())}),this.domEvents.addEventListener(t,`mouseout`,()=>{this.isDragging||(e.update(this.camera),this.render())})}let f=this.show.bind(this),p=this.hide.bind(this),m=()=>{this.helperObject3D.update(this.camera),this.isDragging&&this.updateDragGuideLineScale(),this.render()};m(),this.domEvents.addEventListener(this.helperObject3D,`mousedown`,this.dragStart),document.addEventListener(`mousemove`,this.dragging),document.addEventListener(`mouseup`,this.dragEnd),this.domEvents.addEventListener(this.helperObject3D,`touchstart`,this.dragStart),document.addEventListener(`touchmove`,this.dragging),document.addEventListener(`touchend`,this.dragEnd),this.hooks.on(`rotateStart`,p),this.hooks.on(`rotateEnd`,f),this.hooks.on(`scaleStart`,p),this.hooks.on(`scaleEnd`,f),this.hooks.on(`moveByMouseEnable`,p),this.hooks.on(`moveByMouseDisable`,f),this.hooks.on(`updateOtherHelpers`,e=>{this.helperObject3D.update(e.camera),this.render()}),this.cameraHooks.on(`cameraUpdate`,m),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,`mousedown`,this.dragStart),document.removeEventListener(`mousemove`,this.dragging),document.removeEventListener(`mouseup`,this.dragEnd),this.domEvents.removeEventListener(this.helperObject3D,`touchstart`,this.dragStart),document.removeEventListener(`touchmove`,this.dragging),document.removeEventListener(`touchend`,this.dragEnd),this.hooks.off(`rotateStart`,p),this.hooks.off(`rotateEnd`,f),this.hooks.off(`scaleStart`,p),this.hooks.off(`scaleEnd`,f),this.hooks.off(`moveByMouseEnable`,p),this.hooks.off(`moveByMouseDisable`,f),this.hooks.off(`updateOtherHelpers`),this.cameraHooks.off(`cameraUpdate`,m)}),this.moveByMouseEnable&&this.moveByMouse()}dispose(){var e;super.dispose(),(e=this.disposers)==null||e.forEach(e=>e==null?void 0:e())}moveByMouse(e){this._moveByMouse={enabled:!0,useFaceNormal:e==null?void 0:e.useFaceNormal},this.preventTapDefaultEvent=!0;let t=this.handleMouseDown.bind(this),n=this.handleMouseUp.bind(this);this.hooks.emit(`moveByMouseEnable`),setTimeout(()=>{this.container.addEventListener(`mousedown`,t),this.container.addEventListener(`mouseup`,n)}),this.mousedownEventListenerDisposer=()=>{this.container.removeEventListener(`mousedown`,t),this.container.removeEventListener(`mouseup`,n)}}disableMoveByMouse(){var e;this._moveByMouse={enabled:!1},this.preventTapDefaultEvent=!1,this.hooks.emit(`moveByMouseDisable`),(e=this.mousedownEventListenerDisposer)==null||e.call(this)}onIntersectionOnModelUpdate(e){var t,n,r;if(!this.moveByMouseEnable)return;let{point:i,face:o}=e;if(!this.hooks.emit(`wantToMove`,i)){if(this.originObject3D.position.copy(i),(this._moveByMouse.useFaceNormal===!0||typeof this._moveByMouse.useFaceNormal==`object`&&this._moveByMouse.useFaceNormal.enable!==!1)&&o!=null&&o.normal){let e=typeof this._moveByMouse.useFaceNormal==`object`&&this._moveByMouse.useFaceNormal.alignmentVector?this._moveByMouse.useFaceNormal.alignmentVector:{x:0,y:1,z:0},i=new a.Vector3((t=e.x)==null?0:t,(n=e.y)==null?0:n,(r=e.z)==null?0:r),s=typeof this._moveByMouse.useFaceNormal==`object`&&this._moveByMouse.useFaceNormal.fixedFaceNormal?this._moveByMouse.useFaceNormal.fixedFaceNormal(o.normal):o.normal;this.originObject3D.quaternion.setFromUnitVectors(i,s),this.internalHooks.emit(`setObjectRotate`,this.originObject3D.quaternion.clone(),new a.Vector3)}this.internalHooks.emit(`setObjectPosition`,i),this.hooks.emit(`move`,i)}}handleMouseDown(e){let{x:t,y:n}=e;this.mouseInfo={x:t,y:n,mouseDownTimestamp:Date.now()}}handleMouseUp(e){if(!this.mouseInfo)return;let{x:t,y:n}=e;this.mouseInfo.x===t&&this.mouseInfo.y===n&&Date.now()-this.mouseInfo.mouseDownTimestamp<500&&(this.disableMoveByMouse(),this.mouseInfo=void 0)}updateDragGuideLineScale(){if(!this.dragGuideLine||!this.startInfo)return;let{line:e}=this.startInfo,t=e.end.clone().sub(e.start).normalize();if(t.lengthSq()<1e-6)return;let n=this.helperObject3D.getWorldPosition(new a.Vector3);this.solidGuide.updateSolidLine(this.dragGuideLine,n,t)}move(e){if(!this.startInfo)return this.dragEnd();let{line:t,startVectorProject:n}=this.startInfo,r=this.originObject3D,i=this.startInfo.draggingDirection===`plane`||this.startInfo.draggingDirection===`xy`||this.startInfo.draggingDirection===`xz`||this.startInfo.draggingDirection===`yz`,s;if(i){let t=this.startInfo.plane;if(!t)return;let n=new a.Vector3,r=t.normal.dot(e.ray.direction);if(Math.abs(r)<1e-6)return;let i=-(t.normal.dot(e.ray.origin)+t.constant)/r;if(i<0)return;n.copy(e.ray.origin.clone().add(e.ray.direction.clone().multiplyScalar(i))),s=n}else s=o({raycaster:e,line:t,clampToLine:!1});let c=r.position.clone(),l=s.clone().sub(n),u=new a.Matrix4;u.setPosition(l);let d=r.position.clone().applyMatrix4(u);if(this.hooks.emit(`wantToMove`,d))return;let f=d.clone();this.hooks.emit(`moveBefore`,f);let p=new a.Matrix4;p.setPosition(f.clone().sub(c)),r.position.copy(f),this.setTipsText(f),this.setTipsPosition(f),n.copy(s),this.internalHooks.emit(`applyObjectPosition`,{matrix:p}),this.hooks.emit(`move`,f)}setTipsText(e){var t;let n=(t=this.helperObject3D.moveTips)==null?void 0:t.element;if(!n||!this.startInfo)return;let r=this.startInfo.draggingDirection,i=e=>e.toFixed(3);switch(r){case`x`:n.innerText=`x: ${i(e.x)}`;break;case`y`:n.innerText=`y: ${i(e.y)}`;break;case`z`:n.innerText=`z: ${i(e.z)}`;break;case`xy`:n.innerText=`x: ${i(e.x)} y: ${i(e.y)}`;break;case`xz`:n.innerText=`x: ${i(e.x)} z: ${i(e.z)}`;break;case`yz`:n.innerText=`y: ${i(e.y)} z: ${i(e.z)}`;break;case`plane`:n.innerText=`x: ${i(e.x)} y: ${i(e.y)} z: ${i(e.z)}`;break}}setTipsPosition(e){let t=this.helperObject3D.moveTips;if(!t)return;let{x:n,y:r,z:i}=this.helperObject3D.getWorldPosition(new a.Vector3).clone().project(this.camera);if(i>1){t.hide();return}let o=this.container.getBoundingClientRect(),s=(n+1)/2*o.width,c=(-r+1)/2*o.height;t.setLeftTop(s+`px`,c+`px`)}};export{s as MoveController,o as rayOnLine};
|
|
338
|
+
*/import{RENDER_ORDER}from"../constant.mjs";import{CenterHandle}from"../utils/CenterHandle.mjs";import{BaseController}from"./BaseController.mjs";import{SolidGuideLine}from"../utils/solidGuide.mjs";import{getMouseRaycaster}from"../utils/getMouseRaycaster.mjs";import*as THREE from"three/webgpu";function rayOnLine(params){let{raycaster,line,clampToLine=!0}=params,cameraPlane=new THREE.Plane().setFromNormalAndCoplanarPoint(raycaster.ray.direction.clone().normalize(),new THREE.Vector3),lineStartPointOnPlane=cameraPlane.projectPoint(line.start,new THREE.Vector3),lineEndPointOnPlane=cameraPlane.projectPoint(line.end,new THREE.Vector3),lineOnPlane=new THREE.Line3(lineStartPointOnPlane,lineEndPointOnPlane),intersectionPointOnLineOnPlane=lineOnPlane.closestPointToPoint(raycaster.ray.origin,clampToLine,new THREE.Vector3),pointToEndDistance=intersectionPointOnLineOnPlane.distanceTo(lineEndPointOnPlane),pointToStartDistance=intersectionPointOnLineOnPlane.distanceTo(lineStartPointOnPlane),lineOnPlaneDistance=lineOnPlane.distance();if(pointToEndDistance>pointToStartDistance&&pointToEndDistance>lineOnPlaneDistance){let distanceScale=-intersectionPointOnLineOnPlane.distanceTo(lineStartPointOnPlane)/lineOnPlaneDistance,lineVector=line.start.clone().sub(line.end).normalize();return line.start.clone().sub(lineVector.clone().multiplyScalar(distanceScale*line.distance()))}else{let distanceScale=intersectionPointOnLineOnPlane.distanceTo(lineStartPointOnPlane)/lineOnPlaneDistance;return new THREE.Vector3().lerpVectors(line.start,line.end,distanceScale)}}var MoveController=class extends BaseController{get moveByMouseEnable(){return this._moveByMouse.enabled}constructor(...params){var _a,_b,_c,_d,_e;super(...params),this.name=`MoveController`,this.solidGuide=new SolidGuideLine(this.camera,this.container,(_b=(_a=this.config)==null?void 0:_a.solidGuide)==null?{}:_b),this._moveByMouse={enabled:!1},this.dragStart=params=>{if(this.moveByMouseEnable||this.isDragging)return;let intersect=params==null?void 0:params.intersect;if(!intersect)return this.dragEnd();let draggingDirection=(intersect==null?void 0:intersect.object).direction;if(!draggingDirection)return this.dragEnd();let directionX=new THREE.Vector3(1,0,0),directionY=new THREE.Vector3(0,1,0),directionZ=new THREE.Vector3(0,0,1),directionVector=(()=>{switch(draggingDirection){case`x`:return directionX;case`y`:return directionY;case`z`:return directionZ;case`xy`:case`xz`:case`yz`:case`plane`:return}})(),startIntersect=intersect.point.clone();if(draggingDirection===`xy`||draggingDirection===`xz`||draggingDirection===`yz`){let planeNormal=(()=>{switch(draggingDirection){case`xy`:return directionZ;case`xz`:return directionY;case`yz`:return directionX}})(),plane=new THREE.Plane().setFromNormalAndCoplanarPoint(planeNormal,startIntersect),startProject=startIntersect.clone();this.startInfo={draggingDirection,startVectorProject:startProject,line:new THREE.Line3(startProject.clone(),startProject.clone()),plane}}else if(draggingDirection===`plane`){let cameraPosition=this.camera.position.clone(),clickPoint=startIntersect.clone(),viewDirection=clickPoint.clone().sub(cameraPosition).normalize(),plane=new THREE.Plane().setFromNormalAndCoplanarPoint(viewDirection,clickPoint),startProject=clickPoint.clone();this.startInfo={draggingDirection,startVectorProject:startProject,line:new THREE.Line3(startProject.clone(),startProject.clone()),plane}}else{if(!directionVector)return this.dragEnd();let line=new THREE.Line3(startIntersect.clone().sub(directionVector.normalize()),startIntersect.clone().add(directionVector.normalize()));this.startInfo={draggingDirection,startVectorProject:startIntersect,line};try{let dirNormalized=directionVector.clone().normalize(),center=this.helperObject3D.getWorldPosition(new THREE.Vector3),line=this.solidGuide.createSolidLine(center,dirNormalized,{color:16777215,renderOrder:RENDER_ORDER.DRAG_GUIDE_LINE});this.scene.add(line),this.dragGuideLine=line}catch(_a){}}let directionsToShow=(()=>{switch(draggingDirection){case`plane`:return[];case`xy`:return[`x`,`y`,`xy`];case`xz`:return[`x`,`z`,`xz`];case`yz`:return[`y`,`z`,`yz`];default:return[draggingDirection]}})();this.helperObject3D.showDraggingHelper(directionsToShow),this.hooks.emit(`moveStart`,draggingDirection),this.isDragging=!0,this.setTipsText(this.originObject3D.position),this.setTipsPosition(startIntersect)},this.dragging=point=>{if(!this.isDragging||!this.startInfo)return;let x=`touches`in point?point.touches[0].clientX:point.x,y=`touches`in point?point.touches[0].clientY:point.y,ray=getMouseRaycaster(this.camera,{x,y},this.container);return ray?(this.move(ray),!1):this.dragEnd()},this.dragEnd=()=>{if(this.isDragging){if(this.startInfo=void 0,this.isDragging=!1,this.dragGuideLine){this.scene.remove(this.dragGuideLine),this.dragGuideLine.geometry.dispose();let material=this.dragGuideLine.material;Array.isArray(material)?material.forEach(m=>m.dispose()):material.dispose(),this.dragGuideLine=void 0}this.helperObject3D.show(),this.hooks.emit(`moveEnd`)}};let helper=this.helperObject3D;if(this.hoverListener([helper.xArrow,helper.yArrow,helper.zArrow,(_c=helper.xyPlane)==null?void 0:_c.handle,(_d=helper.xzPlane)==null?void 0:_d.handle,(_e=helper.yzPlane)==null?void 0:_e.handle]),helper.centerHandle&&helper.centerHandle instanceof CenterHandle){let centerHandle=helper.centerHandle,centerHandleMesh=centerHandle.cube;this.domEvents.addEventListener(centerHandleMesh,`mouseover`,()=>{this.isDragging||(Array.isArray(centerHandleMesh.material)&¢erHandleMesh.material.forEach(mat=>{mat.color.set(16777215)}),this.render())}),this.domEvents.addEventListener(centerHandleMesh,`mouseout`,()=>{this.isDragging||(centerHandle.update(this.camera),this.render())})}let show=this.show.bind(this),hide=this.hide.bind(this),updateHelperByCamera=()=>{this.helperObject3D.update(this.camera),this.isDragging&&this.updateDragGuideLineScale(),this.render()};updateHelperByCamera(),this.domEvents.addEventListener(this.helperObject3D,`mousedown`,this.dragStart),document.addEventListener(`mousemove`,this.dragging),document.addEventListener(`mouseup`,this.dragEnd),this.domEvents.addEventListener(this.helperObject3D,`touchstart`,this.dragStart),document.addEventListener(`touchmove`,this.dragging),document.addEventListener(`touchend`,this.dragEnd),this.hooks.on(`rotateStart`,hide),this.hooks.on(`rotateEnd`,show),this.hooks.on(`scaleStart`,hide),this.hooks.on(`scaleEnd`,show),this.hooks.on(`moveByMouseEnable`,hide),this.hooks.on(`moveByMouseDisable`,show),this.hooks.on(`updateOtherHelpers`,params=>{this.helperObject3D.update(params.camera),this.render()}),this.cameraHooks.on(`cameraUpdate`,updateHelperByCamera),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,`mousedown`,this.dragStart),document.removeEventListener(`mousemove`,this.dragging),document.removeEventListener(`mouseup`,this.dragEnd),this.domEvents.removeEventListener(this.helperObject3D,`touchstart`,this.dragStart),document.removeEventListener(`touchmove`,this.dragging),document.removeEventListener(`touchend`,this.dragEnd),this.hooks.off(`rotateStart`,hide),this.hooks.off(`rotateEnd`,show),this.hooks.off(`scaleStart`,hide),this.hooks.off(`scaleEnd`,show),this.hooks.off(`moveByMouseEnable`,hide),this.hooks.off(`moveByMouseDisable`,show),this.hooks.off(`updateOtherHelpers`),this.cameraHooks.off(`cameraUpdate`,updateHelperByCamera)}),this.moveByMouseEnable&&this.moveByMouse()}dispose(){var _a;super.dispose(),(_a=this.disposers)==null||_a.forEach(d=>d==null?void 0:d())}moveByMouse(params){this._moveByMouse={enabled:!0,useFaceNormal:params==null?void 0:params.useFaceNormal},this.preventTapDefaultEvent=!0;let mousedownListener=this.handleMouseDown.bind(this),mouseupListener=this.handleMouseUp.bind(this);this.hooks.emit(`moveByMouseEnable`),setTimeout(()=>{this.container.addEventListener(`mousedown`,mousedownListener),this.container.addEventListener(`mouseup`,mouseupListener)}),this.mousedownEventListenerDisposer=()=>{this.container.removeEventListener(`mousedown`,mousedownListener),this.container.removeEventListener(`mouseup`,mouseupListener)}}disableMoveByMouse(){var _a;this._moveByMouse={enabled:!1},this.preventTapDefaultEvent=!1,this.hooks.emit(`moveByMouseDisable`),(_a=this.mousedownEventListenerDisposer)==null||_a.call(this)}onIntersectionOnModelUpdate(intersection){var _a,_b,_c;if(!this.moveByMouseEnable)return;let{point,face}=intersection;if(!this.hooks.emit(`wantToMove`,point)){if(this.originObject3D.position.copy(point),(this._moveByMouse.useFaceNormal===!0||typeof this._moveByMouse.useFaceNormal==`object`&&this._moveByMouse.useFaceNormal.enable!==!1)&&face!=null&&face.normal){let alignment=typeof this._moveByMouse.useFaceNormal==`object`&&this._moveByMouse.useFaceNormal.alignmentVector?this._moveByMouse.useFaceNormal.alignmentVector:{x:0,y:1,z:0},alignmentVector3=new THREE.Vector3((_a=alignment.x)==null?0:_a,(_b=alignment.y)==null?0:_b,(_c=alignment.z)==null?0:_c),faceNormal=typeof this._moveByMouse.useFaceNormal==`object`&&this._moveByMouse.useFaceNormal.fixedFaceNormal?this._moveByMouse.useFaceNormal.fixedFaceNormal(face.normal):face.normal;this.originObject3D.quaternion.setFromUnitVectors(alignmentVector3,faceNormal),this.internalHooks.emit(`setObjectRotate`,this.originObject3D.quaternion.clone(),new THREE.Vector3)}this.internalHooks.emit(`setObjectPosition`,point),this.hooks.emit(`move`,point)}}handleMouseDown(event){let{x,y}=event;this.mouseInfo={x,y,mouseDownTimestamp:Date.now()}}handleMouseUp(event){if(!this.mouseInfo)return;let{x,y}=event;this.mouseInfo.x===x&&this.mouseInfo.y===y&&Date.now()-this.mouseInfo.mouseDownTimestamp<500&&(this.disableMoveByMouse(),this.mouseInfo=void 0)}updateDragGuideLineScale(){if(!this.dragGuideLine||!this.startInfo)return;let{line}=this.startInfo,dirNormalized=line.end.clone().sub(line.start).normalize();if(dirNormalized.lengthSq()<1e-6)return;let center=this.helperObject3D.getWorldPosition(new THREE.Vector3);this.solidGuide.updateSolidLine(this.dragGuideLine,center,dirNormalized)}move(raycaster){if(!this.startInfo)return this.dragEnd();let{line,startVectorProject}=this.startInfo,object=this.originObject3D,isPlane=this.startInfo.draggingDirection===`plane`||this.startInfo.draggingDirection===`xy`||this.startInfo.draggingDirection===`xz`||this.startInfo.draggingDirection===`yz`,currentVectorProject;if(isPlane){let plane=this.startInfo.plane;if(!plane)return;let projected=new THREE.Vector3,denom=plane.normal.dot(raycaster.ray.direction);if(Math.abs(denom)<1e-6)return;let t=-(plane.normal.dot(raycaster.ray.origin)+plane.constant)/denom;if(t<0)return;projected.copy(raycaster.ray.origin.clone().add(raycaster.ray.direction.clone().multiplyScalar(t))),currentVectorProject=projected}else currentVectorProject=rayOnLine({raycaster,line,clampToLine:!1});let beforePosition=object.position.clone(),offsetVector=currentVectorProject.clone().sub(startVectorProject),transform=new THREE.Matrix4;transform.setPosition(offsetVector);let newPosition=object.position.clone().applyMatrix4(transform);if(this.hooks.emit(`wantToMove`,newPosition))return;let finalPosition=newPosition.clone();this.hooks.emit(`moveBefore`,finalPosition);let finalTransform=new THREE.Matrix4;finalTransform.setPosition(finalPosition.clone().sub(beforePosition)),object.position.copy(finalPosition),this.setTipsText(finalPosition),this.setTipsPosition(finalPosition),startVectorProject.copy(currentVectorProject),this.internalHooks.emit(`applyObjectPosition`,{matrix:finalTransform}),this.hooks.emit(`move`,finalPosition)}setTipsText(position){var _a;let element=(_a=this.helperObject3D.moveTips)==null?void 0:_a.element;if(!element||!this.startInfo)return;let dir=this.startInfo.draggingDirection,fmt=n=>n.toFixed(3);switch(dir){case`x`:element.innerText=`x: ${fmt(position.x)}`;break;case`y`:element.innerText=`y: ${fmt(position.y)}`;break;case`z`:element.innerText=`z: ${fmt(position.z)}`;break;case`xy`:element.innerText=`x: ${fmt(position.x)} y: ${fmt(position.y)}`;break;case`xz`:element.innerText=`x: ${fmt(position.x)} z: ${fmt(position.z)}`;break;case`yz`:element.innerText=`y: ${fmt(position.y)} z: ${fmt(position.z)}`;break;case`plane`:element.innerText=`x: ${fmt(position.x)} y: ${fmt(position.y)} z: ${fmt(position.z)}`;break}}setTipsPosition(position){let moveTips=this.helperObject3D.moveTips;if(!moveTips)return;let{x,y,z}=this.helperObject3D.getWorldPosition(new THREE.Vector3).clone().project(this.camera);if(z>1){moveTips.hide();return}let rect=this.container.getBoundingClientRect(),px=(x+1)/2*rect.width,py=(-y+1)/2*rect.height;moveTips.setLeftTop(px+`px`,py+`px`)}};export{MoveController,rayOnLine};
|
|
@@ -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("../utils/setObjectQuaternion.js"),n=require("../constant.js"),r=require("./BaseController.js"),i=require("../utils/solidGuide.js"),a=require("../utils/getMouseRaycaster.js");let o=require("three/webgpu");o=e.__toESM(o,1);var s=new o.Quaternion,c=class extends r.BaseController{get rotateCenter(){return this.helperObject3D.position.clone()}constructor(...e){var t,n,r;super(...e),this.name=`RotateController`,this.solidGuide=new i.SolidGuideLine(this.camera,this.container),this.snapGuideLines=[];let a=this.helperObject3D;this.hoverListener([(t=a.xCircle)==null?void 0:t.circle,(n=a.yCircle)==null?void 0:n.circle,(r=a.zCircle)==null?void 0:r.circle].filter(Boolean));let o=this.dragStart.bind(this),s=this.dragging.bind(this),c=this.dragEnd.bind(this),l=this.show.bind(this),u=this.hide.bind(this),d=()=>{this.helperObject3D.update(this.camera),this.render()};d(),this.domEvents.addEventListener(this.helperObject3D,`mousedown`,o),document.addEventListener(`mousemove`,s),document.addEventListener(`mouseup`,c),this.domEvents.addEventListener(this.helperObject3D,`touchstart`,o),document.addEventListener(`touchmove`,s),document.addEventListener(`touchend`,c),this.hooks.on(`moveStart`,u),this.hooks.on(`moveEnd`,l),this.hooks.on(`scaleStart`,u),this.hooks.on(`scaleEnd`,l),this.hooks.on(`moveByMouseEnable`,u),this.hooks.on(`moveByMouseDisable`,l),this.hooks.on(`updateOtherHelpers`,e=>{this.helperObject3D.update(e.camera),this.render()}),this.cameraHooks.on(`cameraUpdate`,d),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,`mousedown`,o),document.removeEventListener(`mousemove`,s),document.removeEventListener(`mouseup`,c),this.domEvents.removeEventListener(this.helperObject3D,`touchstart`,o),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),this.hooks.off(`moveStart`,u),this.hooks.off(`moveEnd`,l),this.hooks.off(`scaleStart`,u),this.hooks.off(`scaleEnd`,l),this.hooks.off(`moveByMouseEnable`,u),this.hooks.off(`moveByMouseDisable`,l),this.hooks.off(`updateOtherHelpers`),this.cameraHooks.off(`cameraUpdate`,d)})}setRotateAngle(e){let{x:n=0,y:r=0,z:i=0}=e,a=new o.Euler(o.MathUtils.degToRad(n),o.MathUtils.degToRad(r),o.MathUtils.degToRad(i)),s=new o.Quaternion().setFromEuler(a);if(this.hooks.emit(`wantToRotate`,s))return;let{originObject3D:c,rotateCenter:l}=this;t.default(c,s,l),this.internalHooks.emit(`setObjectRotate`,s,l),this.hooks.emit(`rotate`,s),this.render()}getEulerAngle(e,t){let{originObject3D:n}=this,r=new o.Euler().setFromQuaternion(n.quaternion),i={x:o.MathUtils.radToDeg(r.x),y:o.MathUtils.radToDeg(r.y),z:o.MathUtils.radToDeg(r.z)},a={x:e===`x`?t:i.x,y:e===`y`?t:i.y,z:e===`z`?t:i.z},s=new o.Euler(o.MathUtils.degToRad(a.x),o.MathUtils.degToRad(a.y),o.MathUtils.degToRad(a.z));return new o.Quaternion().setFromEuler(s)}onApplyOriginObjectRotate(e){this.isDragging||super.onApplyOriginObjectRotate(e)}onApplyOriginObjectScale(e){}dragStart(e){if(this.isDragging)return;this.helperObject3D.update(this.camera);let t=e==null?void 0:e.intersect;if(!t)return this.dragEnd();let n=(t==null?void 0:t.object).direction;if(!n)return this.dragEnd();let r=t.point;this.setTipsAngle(0);let i=r.clone();i.y+=.2,this.setTipsPosition(i);let a=new o.Quaternion,c=n===`x`?new o.Vector3(1,0,0):n===`y`?new o.Vector3(0,1,0):n===`z`?new o.Vector3(0,0,1):new o.Vector3(0,1,0),l=new o.Plane().setFromNormalAndCoplanarPoint(c,r),u=l.projectPoint(r.clone(),new o.Vector3).clone().sub(this.rotateCenter),d=this.getAngleHelper(n);if(!d)return this.dragEnd();let f=u.angleTo(d.baseAxes.clone().applyQuaternion(a)),p=d.offsetAngle(f);this.setAngleHelperStart(n,p),this.setAngleHelperLength(n,0),this.startInfo={direction:n,startVector:u,directionVector:c,plane:l,angleHelper:d,angle:0,helperQuaternion:a.clone(),startQuaternion:this.originObject3D.quaternion.clone()},s=new o.Quaternion,this.helperObject3D.showDraggingHelper([n]),this.hooks.emit(`rotateStart`,n),this.isDragging=!0}getMatrix(){var e,t;return(t=(e=this.originObject3D)==null?void 0:e.ext)==null?void 0:t.matrix}getMatrixAngle(e,t){let n;if(e&&e.isMatrix4){n=new o.Quaternion,e.decompose(new o.Vector3,n,new o.Vector3);let r=new o.Euler().setFromQuaternion(n);if(t===`x`)return Math.round(o.MathUtils.radToDeg(r.z));if(t===`y`)return Math.round(o.MathUtils.radToDeg(r.y));if(t===`z`)return Math.round(o.MathUtils.radToDeg(r.x))}}parseAngleByDirection(e){var t,n;let r=(n=(t=this.originObject3D)==null?void 0:t.ext)==null?void 0:n.matrix,i;if(r&&r.isMatrix4){i=new o.Quaternion,r.decompose(new o.Vector3,i,new o.Vector3);let t=new o.Euler().setFromQuaternion(i);if(e===`x`)return Math.round(o.MathUtils.radToDeg(t.z));if(e===`y`)return Math.round(o.MathUtils.radToDeg(t.y));if(e===`z`)return Math.round(o.MathUtils.radToDeg(t.x))}}dragging(e){if(!this.isDragging)return;let t=`touches`in e?e.touches[0].clientX:e.x,n=`touches`in e?e.touches[0].clientY:e.y,r=a.getMouseRaycaster(this.camera,{x:t,y:n},this.container);return r?(this.rotate(r),!1):this.dragEnd()}rotate(e){if(!this.startInfo)return this.dragEnd();let{startVector:t,plane:n,angleHelper:r,direction:i,helperQuaternion:a}=this.startInfo,{originObject3D:c}=this,l=e.ray.intersectPlane(n,new o.Vector3);if(!l)return;let u=this.rotateCenter.clone(),d=n.projectPoint(l.clone(),new o.Vector3).clone().sub(u),f=this.startInfo.directionVector.clone().normalize();d=d.clone().projectOnPlane(f).normalize().multiplyScalar(d.length());let p=new o.Quaternion().setFromUnitVectors(t.clone().normalize(),d.clone().normalize()),m=c.quaternion.clone().premultiply(p);if(t.angleTo(d)===0||this.hooks.emit(`wantToRotate`,m))return;let h=new o.Euler().setFromQuaternion(new o.Quaternion().setFromUnitVectors(t.clone().normalize().applyQuaternion(a.clone().invert()),d.clone().normalize().applyQuaternion(a.clone().invert())),`${i.toUpperCase()}${`XZY`.replace(i.toUpperCase(),``)}`)[i]*r.angleDirection,g=this.startInfo.angle,_=g+h,v=Math.PI/2,y=o.MathUtils.degToRad(5),b=o.MathUtils.degToRad(10),x=new o.Quaternion().setFromAxisAngle(f,_),S=this.startInfo.startQuaternion.clone().premultiply(x),C=this.extractAxisAngle(S,f),w=Math.round(C/v)*v,T=Math.abs(C-w);if(Math.abs(_)>b&&T<y){let e=w-C;_+=e}let E=_-g;this.startInfo.angle=_;let D=Math.abs(E)<1e-6&&Math.abs(h)>1e-6,O=this.snapGuideLines.length>0;D&&!O?this.showSnapGuideLines(i,u):!D&&O&&this.removeSnapGuideLines(),this.setAngleHelperLength(i,this.startInfo.angle),this.setTipsAngle(o.MathUtils.radToDeg(this.startInfo.angle));let k=new o.Quaternion().setFromAxisAngle(f,E);if(u){let e=new o.Vector3().subVectors(c.position,u).applyQuaternion(k).add(u);c.position.copy(e)}c.applyQuaternion(k),s.premultiply(k),this.internalHooks.emit(`applyObjectRotate`,{quaternion:k,origin:u}),this.hooks.emit(`rotate`,c.quaternion),D||(this.startInfo.startVector=d)}dragEnd(){var e;this.isDragging&&(this.removeSnapGuideLines(),(e=this.startInfo)!=null&&e.lineMeshes&&this.startInfo.lineMeshes.forEach(e=>{this.scene.remove(e),e.geometry.dispose(),e.material instanceof o.Material&&e.material.dispose()}),this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.updateOtherHelpers(),this.hooks.emit(`rotateEnd`))}updateOtherHelpers(){this.hooks.emit(`updateOtherHelpers`,{camera:this.camera})}getAngleHelper(e){var t,n,r;switch(e){case`x`:return(t=this.helperObject3D.xCircle)==null?void 0:t.angleSector;case`y`:return(n=this.helperObject3D.yCircle)==null?void 0:n.angleSector;case`z`:return(r=this.helperObject3D.zCircle)==null?void 0:r.angleSector}}setAngleHelperStart(e,t){let n=this.getAngleHelper(e);if(!n){console.warn(`angleHelper is undefined`);return}if(n instanceof o.Mesh&&n.geometry instanceof o.CircleGeometry){let{radius:e,segments:r,thetaLength:i}=n.geometry.parameters;n.geometry=new o.CircleGeometry(e,r,t,i)}else console.warn(`only support THREE.CircleGeometry`)}setAngleHelperLength(e,t){let n=e===`x`||e===`y`?-t:t,r=n>=0?Math.max(n,.001):Math.min(n,-.001),i=this.getAngleHelper(e);if(i instanceof o.Mesh&&i.geometry instanceof o.CircleGeometry){let{radius:e,thetaStart:t}=i.geometry.parameters,n=Math.ceil(Math.abs(r)*(40/(2*Math.PI)));i.geometry=new o.CircleGeometry(e,n,t,r)}else console.warn(`only support THREE.CircleGeometry`)}setTipsAngle(e){var t;let n=(t=this.helperObject3D.angleTips)==null?void 0:t.element;n&&(n.innerText=`${e.toFixed(0)}°`)}setTipsPosition(e){let t=this.helperObject3D.angleTips;if(!t)return;let{x:n,y:r,z:i}=this.helperObject3D.getWorldPosition(new o.Vector3).clone().project(this.camera);if(i>1){t.hide();return}let a=this.container.getBoundingClientRect(),s=(n+1)/2*a.width,c=(-r+1)/2*a.height;t.setLeftTop(s+`px`,c+`px`)}extractAxisAngle(e,t){let n=t.clone().normalize(),r=e.x*n.x+e.y*n.y+e.z*n.z,i=e.w,a=2*Math.atan2(r,i);return Math.atan2(Math.sin(a),Math.cos(a))}showSnapGuideLines(e,t){this.removeSnapGuideLines();let r=(()=>{switch(e){case`x`:return[new o.Vector3(0,1,0),new o.Vector3(0,0,1)];case`y`:return[new o.Vector3(1,0,0),new o.Vector3(0,0,1)];case`z`:return[new o.Vector3(1,0,0),new o.Vector3(0,1,0)];default:return[]}})();for(let e of r){let r=this.solidGuide.createSolidLine(t,e,{color:16777215,renderOrder:n.RENDER_ORDER.DRAG_GUIDE_LINE});this.scene.add(r),this.snapGuideLines.push(r)}this.render()}removeSnapGuideLines(){for(let e of this.snapGuideLines)this.scene.remove(e),this.solidGuide.dispose(e);this.snapGuideLines=[]}};exports.RotateController=c;
|
|
338
|
+
*/const require_runtime=require("../../../_virtual/_rolldown/runtime.js"),require_setObjectQuaternion=require("../utils/setObjectQuaternion.js"),require_constant=require("../constant.js"),require_BaseController=require("./BaseController.js"),require_solidGuide=require("../utils/solidGuide.js"),require_getMouseRaycaster=require("../utils/getMouseRaycaster.js");let three_webgpu=require("three/webgpu");three_webgpu=require_runtime.__toESM(three_webgpu,1);var helperQuaternionOffset=new three_webgpu.Quaternion,RotateController=class extends require_BaseController.BaseController{get rotateCenter(){return this.helperObject3D.position.clone()}constructor(...params){var _a,_b,_c;super(...params),this.name=`RotateController`,this.solidGuide=new require_solidGuide.SolidGuideLine(this.camera,this.container),this.snapGuideLines=[];let helper=this.helperObject3D;this.hoverListener([(_a=helper.xCircle)==null?void 0:_a.circle,(_b=helper.yCircle)==null?void 0:_b.circle,(_c=helper.zCircle)==null?void 0:_c.circle].filter(Boolean));let dragStart=this.dragStart.bind(this),dragging=this.dragging.bind(this),dragEnd=this.dragEnd.bind(this),show=this.show.bind(this),hide=this.hide.bind(this),updateHelperByCamera=()=>{this.helperObject3D.update(this.camera),this.render()};updateHelperByCamera(),this.domEvents.addEventListener(this.helperObject3D,`mousedown`,dragStart),document.addEventListener(`mousemove`,dragging),document.addEventListener(`mouseup`,dragEnd),this.domEvents.addEventListener(this.helperObject3D,`touchstart`,dragStart),document.addEventListener(`touchmove`,dragging),document.addEventListener(`touchend`,dragEnd),this.hooks.on(`moveStart`,hide),this.hooks.on(`moveEnd`,show),this.hooks.on(`scaleStart`,hide),this.hooks.on(`scaleEnd`,show),this.hooks.on(`moveByMouseEnable`,hide),this.hooks.on(`moveByMouseDisable`,show),this.hooks.on(`updateOtherHelpers`,params=>{this.helperObject3D.update(params.camera),this.render()}),this.cameraHooks.on(`cameraUpdate`,updateHelperByCamera),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,`mousedown`,dragStart),document.removeEventListener(`mousemove`,dragging),document.removeEventListener(`mouseup`,dragEnd),this.domEvents.removeEventListener(this.helperObject3D,`touchstart`,dragStart),document.removeEventListener(`touchmove`,dragging),document.removeEventListener(`touchend`,dragEnd),this.hooks.off(`moveStart`,hide),this.hooks.off(`moveEnd`,show),this.hooks.off(`scaleStart`,hide),this.hooks.off(`scaleEnd`,show),this.hooks.off(`moveByMouseEnable`,hide),this.hooks.off(`moveByMouseDisable`,show),this.hooks.off(`updateOtherHelpers`),this.cameraHooks.off(`cameraUpdate`,updateHelperByCamera)})}setRotateAngle(angle){let{x=0,y=0,z=0}=angle,euler=new three_webgpu.Euler(three_webgpu.MathUtils.degToRad(x),three_webgpu.MathUtils.degToRad(y),three_webgpu.MathUtils.degToRad(z)),quaternion=new three_webgpu.Quaternion().setFromEuler(euler);if(this.hooks.emit(`wantToRotate`,quaternion))return;let{originObject3D,rotateCenter}=this;require_setObjectQuaternion.default(originObject3D,quaternion,rotateCenter),this.internalHooks.emit(`setObjectRotate`,quaternion,rotateCenter),this.hooks.emit(`rotate`,quaternion),this.render()}getEulerAngle(axis,angle){let{originObject3D}=this,currentEuler=new three_webgpu.Euler().setFromQuaternion(originObject3D.quaternion),currentAngles={x:three_webgpu.MathUtils.radToDeg(currentEuler.x),y:three_webgpu.MathUtils.radToDeg(currentEuler.y),z:three_webgpu.MathUtils.radToDeg(currentEuler.z)},newAngles={x:axis===`x`?angle:currentAngles.x,y:axis===`y`?angle:currentAngles.y,z:axis===`z`?angle:currentAngles.z},newEuler=new three_webgpu.Euler(three_webgpu.MathUtils.degToRad(newAngles.x),three_webgpu.MathUtils.degToRad(newAngles.y),three_webgpu.MathUtils.degToRad(newAngles.z));return new three_webgpu.Quaternion().setFromEuler(newEuler)}onApplyOriginObjectRotate(params){this.isDragging||super.onApplyOriginObjectRotate(params)}onApplyOriginObjectScale(params){}dragStart(params){if(this.isDragging)return;this.helperObject3D.update(this.camera);let intersect=params==null?void 0:params.intersect;if(!intersect)return this.dragEnd();let direction=(intersect==null?void 0:intersect.object).direction;if(!direction)return this.dragEnd();let startIntersect=intersect.point;this.setTipsAngle(0);let tipsPosition=startIntersect.clone();tipsPosition.y+=.2,this.setTipsPosition(tipsPosition);let helperQuaternion=new three_webgpu.Quaternion,directionVector=direction===`x`?new three_webgpu.Vector3(1,0,0):direction===`y`?new three_webgpu.Vector3(0,1,0):direction===`z`?new three_webgpu.Vector3(0,0,1):new three_webgpu.Vector3(0,1,0),plane=new three_webgpu.Plane().setFromNormalAndCoplanarPoint(directionVector,startIntersect),startVector=plane.projectPoint(startIntersect.clone(),new three_webgpu.Vector3).clone().sub(this.rotateCenter),angleHelper=this.getAngleHelper(direction);if(!angleHelper)return this.dragEnd();let startAngle=startVector.angleTo(angleHelper.baseAxes.clone().applyQuaternion(helperQuaternion)),processedAngle=angleHelper.offsetAngle(startAngle);this.setAngleHelperStart(direction,processedAngle),this.setAngleHelperLength(direction,0),this.startInfo={direction,startVector,directionVector,plane,angleHelper,angle:0,helperQuaternion:helperQuaternion.clone(),startQuaternion:this.originObject3D.quaternion.clone()},helperQuaternionOffset=new three_webgpu.Quaternion,this.helperObject3D.showDraggingHelper([direction]),this.hooks.emit(`rotateStart`,direction),this.isDragging=!0}getMatrix(){var _a,_b;return(_b=(_a=this.originObject3D)==null?void 0:_a.ext)==null?void 0:_b.matrix}getMatrixAngle(matrix,direction){let matrixQuaternion;if(matrix&&matrix.isMatrix4){matrixQuaternion=new three_webgpu.Quaternion,matrix.decompose(new three_webgpu.Vector3,matrixQuaternion,new three_webgpu.Vector3);let euler=new three_webgpu.Euler().setFromQuaternion(matrixQuaternion);if(direction===`x`)return Math.round(three_webgpu.MathUtils.radToDeg(euler.z));if(direction===`y`)return Math.round(three_webgpu.MathUtils.radToDeg(euler.y));if(direction===`z`)return Math.round(three_webgpu.MathUtils.radToDeg(euler.x))}}parseAngleByDirection(direction){var _a,_b;let matrix=(_b=(_a=this.originObject3D)==null?void 0:_a.ext)==null?void 0:_b.matrix,matrixQuaternion;if(matrix&&matrix.isMatrix4){matrixQuaternion=new three_webgpu.Quaternion,matrix.decompose(new three_webgpu.Vector3,matrixQuaternion,new three_webgpu.Vector3);let euler=new three_webgpu.Euler().setFromQuaternion(matrixQuaternion);if(direction===`x`)return Math.round(three_webgpu.MathUtils.radToDeg(euler.z));if(direction===`y`)return Math.round(three_webgpu.MathUtils.radToDeg(euler.y));if(direction===`z`)return Math.round(three_webgpu.MathUtils.radToDeg(euler.x))}}dragging(point){if(!this.isDragging)return;let x=`touches`in point?point.touches[0].clientX:point.x,y=`touches`in point?point.touches[0].clientY:point.y,ray=require_getMouseRaycaster.getMouseRaycaster(this.camera,{x,y},this.container);return ray?(this.rotate(ray),!1):this.dragEnd()}rotate(raycaster){if(!this.startInfo)return this.dragEnd();let{startVector,plane,angleHelper,direction,helperQuaternion}=this.startInfo,{originObject3D}=this,currentIntersectPoint=raycaster.ray.intersectPlane(plane,new three_webgpu.Vector3);if(!currentIntersectPoint)return;let rotateCenter=this.rotateCenter.clone(),currentVector=plane.projectPoint(currentIntersectPoint.clone(),new three_webgpu.Vector3).clone().sub(rotateCenter),rotationAxis=this.startInfo.directionVector.clone().normalize();currentVector=currentVector.clone().projectOnPlane(rotationAxis).normalize().multiplyScalar(currentVector.length());let quaternion=new three_webgpu.Quaternion().setFromUnitVectors(startVector.clone().normalize(),currentVector.clone().normalize()),newQuaternion=originObject3D.quaternion.clone().premultiply(quaternion);if(startVector.angleTo(currentVector)===0||this.hooks.emit(`wantToRotate`,newQuaternion))return;let rawAngle=new three_webgpu.Euler().setFromQuaternion(new three_webgpu.Quaternion().setFromUnitVectors(startVector.clone().normalize().applyQuaternion(helperQuaternion.clone().invert()),currentVector.clone().normalize().applyQuaternion(helperQuaternion.clone().invert())),`${direction.toUpperCase()}${`XZY`.replace(direction.toUpperCase(),``)}`)[direction]*angleHelper.angleDirection,prevTotalAngle=this.startInfo.angle,totalAngle=prevTotalAngle+rawAngle,SNAP_ANGLE=Math.PI/2,SNAP_THRESHOLD=three_webgpu.MathUtils.degToRad(5),MIN_DRAG_FOR_SNAP=three_webgpu.MathUtils.degToRad(10),trialQ=new three_webgpu.Quaternion().setFromAxisAngle(rotationAxis,totalAngle),trialObjectQ=this.startInfo.startQuaternion.clone().premultiply(trialQ),absAngle=this.extractAxisAngle(trialObjectQ,rotationAxis),nearestSnap=Math.round(absAngle/SNAP_ANGLE)*SNAP_ANGLE,distToSnap=Math.abs(absAngle-nearestSnap);if(Math.abs(totalAngle)>MIN_DRAG_FOR_SNAP&&distToSnap<SNAP_THRESHOLD){let correction=nearestSnap-absAngle;totalAngle+=correction}let frameAngle=totalAngle-prevTotalAngle;this.startInfo.angle=totalAngle;let isSnapped=Math.abs(frameAngle)<1e-6&&Math.abs(rawAngle)>1e-6,wasSnapping=this.snapGuideLines.length>0;isSnapped&&!wasSnapping?this.showSnapGuideLines(direction,rotateCenter):!isSnapped&&wasSnapping&&this.removeSnapGuideLines(),this.setAngleHelperLength(direction,this.startInfo.angle),this.setTipsAngle(three_webgpu.MathUtils.radToDeg(this.startInfo.angle));let frameQuaternion=new three_webgpu.Quaternion().setFromAxisAngle(rotationAxis,frameAngle);if(rotateCenter){let v=new three_webgpu.Vector3().subVectors(originObject3D.position,rotateCenter).applyQuaternion(frameQuaternion).add(rotateCenter);originObject3D.position.copy(v)}originObject3D.applyQuaternion(frameQuaternion),helperQuaternionOffset.premultiply(frameQuaternion),this.internalHooks.emit(`applyObjectRotate`,{quaternion:frameQuaternion,origin:rotateCenter}),this.hooks.emit(`rotate`,originObject3D.quaternion),isSnapped||(this.startInfo.startVector=currentVector)}dragEnd(){var _a;this.isDragging&&(this.removeSnapGuideLines(),(_a=this.startInfo)!=null&&_a.lineMeshes&&this.startInfo.lineMeshes.forEach(mesh=>{this.scene.remove(mesh),mesh.geometry.dispose(),mesh.material instanceof three_webgpu.Material&&mesh.material.dispose()}),this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.updateOtherHelpers(),this.hooks.emit(`rotateEnd`))}updateOtherHelpers(){this.hooks.emit(`updateOtherHelpers`,{camera:this.camera})}getAngleHelper(direction){var _a,_b,_c;switch(direction){case`x`:return(_a=this.helperObject3D.xCircle)==null?void 0:_a.angleSector;case`y`:return(_b=this.helperObject3D.yCircle)==null?void 0:_b.angleSector;case`z`:return(_c=this.helperObject3D.zCircle)==null?void 0:_c.angleSector}}setAngleHelperStart(direction,start){let angleHelper=this.getAngleHelper(direction);if(!angleHelper){console.warn(`angleHelper is undefined`);return}if(angleHelper instanceof three_webgpu.Mesh&&angleHelper.geometry instanceof three_webgpu.CircleGeometry){let{radius,segments,thetaLength}=angleHelper.geometry.parameters;angleHelper.geometry=new three_webgpu.CircleGeometry(radius,segments,start,thetaLength)}else console.warn(`only support THREE.CircleGeometry`)}setAngleHelperLength(direction,length){let adjustedLength=direction===`x`||direction===`y`?-length:length,thetaLength=adjustedLength>=0?Math.max(adjustedLength,.001):Math.min(adjustedLength,-.001),angleHelper=this.getAngleHelper(direction);if(angleHelper instanceof three_webgpu.Mesh&&angleHelper.geometry instanceof three_webgpu.CircleGeometry){let{radius,thetaStart}=angleHelper.geometry.parameters,segments=Math.ceil(Math.abs(thetaLength)*(40/(2*Math.PI)));angleHelper.geometry=new three_webgpu.CircleGeometry(radius,segments,thetaStart,thetaLength)}else console.warn(`only support THREE.CircleGeometry`)}setTipsAngle(angle){var _a;let element=(_a=this.helperObject3D.angleTips)==null?void 0:_a.element;element&&(element.innerText=`${angle.toFixed(0)}°`)}setTipsPosition(position){let angleTips=this.helperObject3D.angleTips;if(!angleTips)return;let{x,y,z}=this.helperObject3D.getWorldPosition(new three_webgpu.Vector3).clone().project(this.camera);if(z>1){angleTips.hide();return}let rect=this.container.getBoundingClientRect(),px=(x+1)/2*rect.width,py=(-y+1)/2*rect.height;angleTips.setLeftTop(px+`px`,py+`px`)}extractAxisAngle(q,axis){let a=axis.clone().normalize(),sinHalf=q.x*a.x+q.y*a.y+q.z*a.z,cosHalf=q.w,angle=2*Math.atan2(sinHalf,cosHalf);return Math.atan2(Math.sin(angle),Math.cos(angle))}showSnapGuideLines(direction,center){this.removeSnapGuideLines();let axes=(()=>{switch(direction){case`x`:return[new three_webgpu.Vector3(0,1,0),new three_webgpu.Vector3(0,0,1)];case`y`:return[new three_webgpu.Vector3(1,0,0),new three_webgpu.Vector3(0,0,1)];case`z`:return[new three_webgpu.Vector3(1,0,0),new three_webgpu.Vector3(0,1,0)];default:return[]}})();for(let axis of axes){let line=this.solidGuide.createSolidLine(center,axis,{color:16777215,renderOrder:require_constant.RENDER_ORDER.DRAG_GUIDE_LINE});this.scene.add(line),this.snapGuideLines.push(line)}this.render()}removeSnapGuideLines(){for(let line of this.snapGuideLines)this.scene.remove(line),this.solidGuide.dispose(line);this.snapGuideLines=[]}};exports.RotateController=RotateController;
|
|
@@ -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 e from"../utils/setObjectQuaternion.mjs";import{RENDER_ORDER as t}from"../constant.mjs";import{BaseController as n}from"./BaseController.mjs";import{SolidGuideLine as r}from"../utils/solidGuide.mjs";import{getMouseRaycaster as i}from"../utils/getMouseRaycaster.mjs";import*as a from"three/webgpu";var o=new a.Quaternion,s=class extends n{get rotateCenter(){return this.helperObject3D.position.clone()}constructor(...e){var t,n,i;super(...e),this.name=`RotateController`,this.solidGuide=new r(this.camera,this.container),this.snapGuideLines=[];let a=this.helperObject3D;this.hoverListener([(t=a.xCircle)==null?void 0:t.circle,(n=a.yCircle)==null?void 0:n.circle,(i=a.zCircle)==null?void 0:i.circle].filter(Boolean));let o=this.dragStart.bind(this),s=this.dragging.bind(this),c=this.dragEnd.bind(this),l=this.show.bind(this),u=this.hide.bind(this),d=()=>{this.helperObject3D.update(this.camera),this.render()};d(),this.domEvents.addEventListener(this.helperObject3D,`mousedown`,o),document.addEventListener(`mousemove`,s),document.addEventListener(`mouseup`,c),this.domEvents.addEventListener(this.helperObject3D,`touchstart`,o),document.addEventListener(`touchmove`,s),document.addEventListener(`touchend`,c),this.hooks.on(`moveStart`,u),this.hooks.on(`moveEnd`,l),this.hooks.on(`scaleStart`,u),this.hooks.on(`scaleEnd`,l),this.hooks.on(`moveByMouseEnable`,u),this.hooks.on(`moveByMouseDisable`,l),this.hooks.on(`updateOtherHelpers`,e=>{this.helperObject3D.update(e.camera),this.render()}),this.cameraHooks.on(`cameraUpdate`,d),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,`mousedown`,o),document.removeEventListener(`mousemove`,s),document.removeEventListener(`mouseup`,c),this.domEvents.removeEventListener(this.helperObject3D,`touchstart`,o),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),this.hooks.off(`moveStart`,u),this.hooks.off(`moveEnd`,l),this.hooks.off(`scaleStart`,u),this.hooks.off(`scaleEnd`,l),this.hooks.off(`moveByMouseEnable`,u),this.hooks.off(`moveByMouseDisable`,l),this.hooks.off(`updateOtherHelpers`),this.cameraHooks.off(`cameraUpdate`,d)})}setRotateAngle(t){let{x:n=0,y:r=0,z:i=0}=t,o=new a.Euler(a.MathUtils.degToRad(n),a.MathUtils.degToRad(r),a.MathUtils.degToRad(i)),s=new a.Quaternion().setFromEuler(o);if(this.hooks.emit(`wantToRotate`,s))return;let{originObject3D:c,rotateCenter:l}=this;e(c,s,l),this.internalHooks.emit(`setObjectRotate`,s,l),this.hooks.emit(`rotate`,s),this.render()}getEulerAngle(e,t){let{originObject3D:n}=this,r=new a.Euler().setFromQuaternion(n.quaternion),i={x:a.MathUtils.radToDeg(r.x),y:a.MathUtils.radToDeg(r.y),z:a.MathUtils.radToDeg(r.z)},o={x:e===`x`?t:i.x,y:e===`y`?t:i.y,z:e===`z`?t:i.z},s=new a.Euler(a.MathUtils.degToRad(o.x),a.MathUtils.degToRad(o.y),a.MathUtils.degToRad(o.z));return new a.Quaternion().setFromEuler(s)}onApplyOriginObjectRotate(e){this.isDragging||super.onApplyOriginObjectRotate(e)}onApplyOriginObjectScale(e){}dragStart(e){if(this.isDragging)return;this.helperObject3D.update(this.camera);let t=e==null?void 0:e.intersect;if(!t)return this.dragEnd();let n=(t==null?void 0:t.object).direction;if(!n)return this.dragEnd();let r=t.point;this.setTipsAngle(0);let i=r.clone();i.y+=.2,this.setTipsPosition(i);let s=new a.Quaternion,c=n===`x`?new a.Vector3(1,0,0):n===`y`?new a.Vector3(0,1,0):n===`z`?new a.Vector3(0,0,1):new a.Vector3(0,1,0),l=new a.Plane().setFromNormalAndCoplanarPoint(c,r),u=l.projectPoint(r.clone(),new a.Vector3).clone().sub(this.rotateCenter),d=this.getAngleHelper(n);if(!d)return this.dragEnd();let f=u.angleTo(d.baseAxes.clone().applyQuaternion(s)),p=d.offsetAngle(f);this.setAngleHelperStart(n,p),this.setAngleHelperLength(n,0),this.startInfo={direction:n,startVector:u,directionVector:c,plane:l,angleHelper:d,angle:0,helperQuaternion:s.clone(),startQuaternion:this.originObject3D.quaternion.clone()},o=new a.Quaternion,this.helperObject3D.showDraggingHelper([n]),this.hooks.emit(`rotateStart`,n),this.isDragging=!0}getMatrix(){var e,t;return(t=(e=this.originObject3D)==null?void 0:e.ext)==null?void 0:t.matrix}getMatrixAngle(e,t){let n;if(e&&e.isMatrix4){n=new a.Quaternion,e.decompose(new a.Vector3,n,new a.Vector3);let r=new a.Euler().setFromQuaternion(n);if(t===`x`)return Math.round(a.MathUtils.radToDeg(r.z));if(t===`y`)return Math.round(a.MathUtils.radToDeg(r.y));if(t===`z`)return Math.round(a.MathUtils.radToDeg(r.x))}}parseAngleByDirection(e){var t,n;let r=(n=(t=this.originObject3D)==null?void 0:t.ext)==null?void 0:n.matrix,i;if(r&&r.isMatrix4){i=new a.Quaternion,r.decompose(new a.Vector3,i,new a.Vector3);let t=new a.Euler().setFromQuaternion(i);if(e===`x`)return Math.round(a.MathUtils.radToDeg(t.z));if(e===`y`)return Math.round(a.MathUtils.radToDeg(t.y));if(e===`z`)return Math.round(a.MathUtils.radToDeg(t.x))}}dragging(e){if(!this.isDragging)return;let t=`touches`in e?e.touches[0].clientX:e.x,n=`touches`in e?e.touches[0].clientY:e.y,r=i(this.camera,{x:t,y:n},this.container);return r?(this.rotate(r),!1):this.dragEnd()}rotate(e){if(!this.startInfo)return this.dragEnd();let{startVector:t,plane:n,angleHelper:r,direction:i,helperQuaternion:s}=this.startInfo,{originObject3D:c}=this,l=e.ray.intersectPlane(n,new a.Vector3);if(!l)return;let u=this.rotateCenter.clone(),d=n.projectPoint(l.clone(),new a.Vector3).clone().sub(u),f=this.startInfo.directionVector.clone().normalize();d=d.clone().projectOnPlane(f).normalize().multiplyScalar(d.length());let p=new a.Quaternion().setFromUnitVectors(t.clone().normalize(),d.clone().normalize()),m=c.quaternion.clone().premultiply(p);if(t.angleTo(d)===0||this.hooks.emit(`wantToRotate`,m))return;let h=new a.Euler().setFromQuaternion(new a.Quaternion().setFromUnitVectors(t.clone().normalize().applyQuaternion(s.clone().invert()),d.clone().normalize().applyQuaternion(s.clone().invert())),`${i.toUpperCase()}${`XZY`.replace(i.toUpperCase(),``)}`)[i]*r.angleDirection,g=this.startInfo.angle,_=g+h,v=Math.PI/2,y=a.MathUtils.degToRad(5),b=a.MathUtils.degToRad(10),x=new a.Quaternion().setFromAxisAngle(f,_),S=this.startInfo.startQuaternion.clone().premultiply(x),C=this.extractAxisAngle(S,f),w=Math.round(C/v)*v,T=Math.abs(C-w);if(Math.abs(_)>b&&T<y){let e=w-C;_+=e}let E=_-g;this.startInfo.angle=_;let D=Math.abs(E)<1e-6&&Math.abs(h)>1e-6,O=this.snapGuideLines.length>0;D&&!O?this.showSnapGuideLines(i,u):!D&&O&&this.removeSnapGuideLines(),this.setAngleHelperLength(i,this.startInfo.angle),this.setTipsAngle(a.MathUtils.radToDeg(this.startInfo.angle));let k=new a.Quaternion().setFromAxisAngle(f,E);if(u){let e=new a.Vector3().subVectors(c.position,u).applyQuaternion(k).add(u);c.position.copy(e)}c.applyQuaternion(k),o.premultiply(k),this.internalHooks.emit(`applyObjectRotate`,{quaternion:k,origin:u}),this.hooks.emit(`rotate`,c.quaternion),D||(this.startInfo.startVector=d)}dragEnd(){var e;this.isDragging&&(this.removeSnapGuideLines(),(e=this.startInfo)!=null&&e.lineMeshes&&this.startInfo.lineMeshes.forEach(e=>{this.scene.remove(e),e.geometry.dispose(),e.material instanceof a.Material&&e.material.dispose()}),this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.updateOtherHelpers(),this.hooks.emit(`rotateEnd`))}updateOtherHelpers(){this.hooks.emit(`updateOtherHelpers`,{camera:this.camera})}getAngleHelper(e){var t,n,r;switch(e){case`x`:return(t=this.helperObject3D.xCircle)==null?void 0:t.angleSector;case`y`:return(n=this.helperObject3D.yCircle)==null?void 0:n.angleSector;case`z`:return(r=this.helperObject3D.zCircle)==null?void 0:r.angleSector}}setAngleHelperStart(e,t){let n=this.getAngleHelper(e);if(!n){console.warn(`angleHelper is undefined`);return}if(n instanceof a.Mesh&&n.geometry instanceof a.CircleGeometry){let{radius:e,segments:r,thetaLength:i}=n.geometry.parameters;n.geometry=new a.CircleGeometry(e,r,t,i)}else console.warn(`only support THREE.CircleGeometry`)}setAngleHelperLength(e,t){let n=e===`x`||e===`y`?-t:t,r=n>=0?Math.max(n,.001):Math.min(n,-.001),i=this.getAngleHelper(e);if(i instanceof a.Mesh&&i.geometry instanceof a.CircleGeometry){let{radius:e,thetaStart:t}=i.geometry.parameters,n=Math.ceil(Math.abs(r)*(40/(2*Math.PI)));i.geometry=new a.CircleGeometry(e,n,t,r)}else console.warn(`only support THREE.CircleGeometry`)}setTipsAngle(e){var t;let n=(t=this.helperObject3D.angleTips)==null?void 0:t.element;n&&(n.innerText=`${e.toFixed(0)}°`)}setTipsPosition(e){let t=this.helperObject3D.angleTips;if(!t)return;let{x:n,y:r,z:i}=this.helperObject3D.getWorldPosition(new a.Vector3).clone().project(this.camera);if(i>1){t.hide();return}let o=this.container.getBoundingClientRect(),s=(n+1)/2*o.width,c=(-r+1)/2*o.height;t.setLeftTop(s+`px`,c+`px`)}extractAxisAngle(e,t){let n=t.clone().normalize(),r=e.x*n.x+e.y*n.y+e.z*n.z,i=e.w,a=2*Math.atan2(r,i);return Math.atan2(Math.sin(a),Math.cos(a))}showSnapGuideLines(e,n){this.removeSnapGuideLines();let r=(()=>{switch(e){case`x`:return[new a.Vector3(0,1,0),new a.Vector3(0,0,1)];case`y`:return[new a.Vector3(1,0,0),new a.Vector3(0,0,1)];case`z`:return[new a.Vector3(1,0,0),new a.Vector3(0,1,0)];default:return[]}})();for(let e of r){let r=this.solidGuide.createSolidLine(n,e,{color:16777215,renderOrder:t.DRAG_GUIDE_LINE});this.scene.add(r),this.snapGuideLines.push(r)}this.render()}removeSnapGuideLines(){for(let e of this.snapGuideLines)this.scene.remove(e),this.solidGuide.dispose(e);this.snapGuideLines=[]}};export{s as RotateController};
|
|
338
|
+
*/import setObjectQuaternion from"../utils/setObjectQuaternion.mjs";import{RENDER_ORDER}from"../constant.mjs";import{BaseController}from"./BaseController.mjs";import{SolidGuideLine}from"../utils/solidGuide.mjs";import{getMouseRaycaster}from"../utils/getMouseRaycaster.mjs";import*as THREE from"three/webgpu";var helperQuaternionOffset=new THREE.Quaternion,RotateController=class extends BaseController{get rotateCenter(){return this.helperObject3D.position.clone()}constructor(...params){var _a,_b,_c;super(...params),this.name=`RotateController`,this.solidGuide=new SolidGuideLine(this.camera,this.container),this.snapGuideLines=[];let helper=this.helperObject3D;this.hoverListener([(_a=helper.xCircle)==null?void 0:_a.circle,(_b=helper.yCircle)==null?void 0:_b.circle,(_c=helper.zCircle)==null?void 0:_c.circle].filter(Boolean));let dragStart=this.dragStart.bind(this),dragging=this.dragging.bind(this),dragEnd=this.dragEnd.bind(this),show=this.show.bind(this),hide=this.hide.bind(this),updateHelperByCamera=()=>{this.helperObject3D.update(this.camera),this.render()};updateHelperByCamera(),this.domEvents.addEventListener(this.helperObject3D,`mousedown`,dragStart),document.addEventListener(`mousemove`,dragging),document.addEventListener(`mouseup`,dragEnd),this.domEvents.addEventListener(this.helperObject3D,`touchstart`,dragStart),document.addEventListener(`touchmove`,dragging),document.addEventListener(`touchend`,dragEnd),this.hooks.on(`moveStart`,hide),this.hooks.on(`moveEnd`,show),this.hooks.on(`scaleStart`,hide),this.hooks.on(`scaleEnd`,show),this.hooks.on(`moveByMouseEnable`,hide),this.hooks.on(`moveByMouseDisable`,show),this.hooks.on(`updateOtherHelpers`,params=>{this.helperObject3D.update(params.camera),this.render()}),this.cameraHooks.on(`cameraUpdate`,updateHelperByCamera),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,`mousedown`,dragStart),document.removeEventListener(`mousemove`,dragging),document.removeEventListener(`mouseup`,dragEnd),this.domEvents.removeEventListener(this.helperObject3D,`touchstart`,dragStart),document.removeEventListener(`touchmove`,dragging),document.removeEventListener(`touchend`,dragEnd),this.hooks.off(`moveStart`,hide),this.hooks.off(`moveEnd`,show),this.hooks.off(`scaleStart`,hide),this.hooks.off(`scaleEnd`,show),this.hooks.off(`moveByMouseEnable`,hide),this.hooks.off(`moveByMouseDisable`,show),this.hooks.off(`updateOtherHelpers`),this.cameraHooks.off(`cameraUpdate`,updateHelperByCamera)})}setRotateAngle(angle){let{x=0,y=0,z=0}=angle,euler=new THREE.Euler(THREE.MathUtils.degToRad(x),THREE.MathUtils.degToRad(y),THREE.MathUtils.degToRad(z)),quaternion=new THREE.Quaternion().setFromEuler(euler);if(this.hooks.emit(`wantToRotate`,quaternion))return;let{originObject3D,rotateCenter}=this;setObjectQuaternion(originObject3D,quaternion,rotateCenter),this.internalHooks.emit(`setObjectRotate`,quaternion,rotateCenter),this.hooks.emit(`rotate`,quaternion),this.render()}getEulerAngle(axis,angle){let{originObject3D}=this,currentEuler=new THREE.Euler().setFromQuaternion(originObject3D.quaternion),currentAngles={x:THREE.MathUtils.radToDeg(currentEuler.x),y:THREE.MathUtils.radToDeg(currentEuler.y),z:THREE.MathUtils.radToDeg(currentEuler.z)},newAngles={x:axis===`x`?angle:currentAngles.x,y:axis===`y`?angle:currentAngles.y,z:axis===`z`?angle:currentAngles.z},newEuler=new THREE.Euler(THREE.MathUtils.degToRad(newAngles.x),THREE.MathUtils.degToRad(newAngles.y),THREE.MathUtils.degToRad(newAngles.z));return new THREE.Quaternion().setFromEuler(newEuler)}onApplyOriginObjectRotate(params){this.isDragging||super.onApplyOriginObjectRotate(params)}onApplyOriginObjectScale(params){}dragStart(params){if(this.isDragging)return;this.helperObject3D.update(this.camera);let intersect=params==null?void 0:params.intersect;if(!intersect)return this.dragEnd();let direction=(intersect==null?void 0:intersect.object).direction;if(!direction)return this.dragEnd();let startIntersect=intersect.point;this.setTipsAngle(0);let tipsPosition=startIntersect.clone();tipsPosition.y+=.2,this.setTipsPosition(tipsPosition);let helperQuaternion=new THREE.Quaternion,directionVector=direction===`x`?new THREE.Vector3(1,0,0):direction===`y`?new THREE.Vector3(0,1,0):direction===`z`?new THREE.Vector3(0,0,1):new THREE.Vector3(0,1,0),plane=new THREE.Plane().setFromNormalAndCoplanarPoint(directionVector,startIntersect),startVector=plane.projectPoint(startIntersect.clone(),new THREE.Vector3).clone().sub(this.rotateCenter),angleHelper=this.getAngleHelper(direction);if(!angleHelper)return this.dragEnd();let startAngle=startVector.angleTo(angleHelper.baseAxes.clone().applyQuaternion(helperQuaternion)),processedAngle=angleHelper.offsetAngle(startAngle);this.setAngleHelperStart(direction,processedAngle),this.setAngleHelperLength(direction,0),this.startInfo={direction,startVector,directionVector,plane,angleHelper,angle:0,helperQuaternion:helperQuaternion.clone(),startQuaternion:this.originObject3D.quaternion.clone()},helperQuaternionOffset=new THREE.Quaternion,this.helperObject3D.showDraggingHelper([direction]),this.hooks.emit(`rotateStart`,direction),this.isDragging=!0}getMatrix(){var _a,_b;return(_b=(_a=this.originObject3D)==null?void 0:_a.ext)==null?void 0:_b.matrix}getMatrixAngle(matrix,direction){let matrixQuaternion;if(matrix&&matrix.isMatrix4){matrixQuaternion=new THREE.Quaternion,matrix.decompose(new THREE.Vector3,matrixQuaternion,new THREE.Vector3);let euler=new THREE.Euler().setFromQuaternion(matrixQuaternion);if(direction===`x`)return Math.round(THREE.MathUtils.radToDeg(euler.z));if(direction===`y`)return Math.round(THREE.MathUtils.radToDeg(euler.y));if(direction===`z`)return Math.round(THREE.MathUtils.radToDeg(euler.x))}}parseAngleByDirection(direction){var _a,_b;let matrix=(_b=(_a=this.originObject3D)==null?void 0:_a.ext)==null?void 0:_b.matrix,matrixQuaternion;if(matrix&&matrix.isMatrix4){matrixQuaternion=new THREE.Quaternion,matrix.decompose(new THREE.Vector3,matrixQuaternion,new THREE.Vector3);let euler=new THREE.Euler().setFromQuaternion(matrixQuaternion);if(direction===`x`)return Math.round(THREE.MathUtils.radToDeg(euler.z));if(direction===`y`)return Math.round(THREE.MathUtils.radToDeg(euler.y));if(direction===`z`)return Math.round(THREE.MathUtils.radToDeg(euler.x))}}dragging(point){if(!this.isDragging)return;let x=`touches`in point?point.touches[0].clientX:point.x,y=`touches`in point?point.touches[0].clientY:point.y,ray=getMouseRaycaster(this.camera,{x,y},this.container);return ray?(this.rotate(ray),!1):this.dragEnd()}rotate(raycaster){if(!this.startInfo)return this.dragEnd();let{startVector,plane,angleHelper,direction,helperQuaternion}=this.startInfo,{originObject3D}=this,currentIntersectPoint=raycaster.ray.intersectPlane(plane,new THREE.Vector3);if(!currentIntersectPoint)return;let rotateCenter=this.rotateCenter.clone(),currentVector=plane.projectPoint(currentIntersectPoint.clone(),new THREE.Vector3).clone().sub(rotateCenter),rotationAxis=this.startInfo.directionVector.clone().normalize();currentVector=currentVector.clone().projectOnPlane(rotationAxis).normalize().multiplyScalar(currentVector.length());let quaternion=new THREE.Quaternion().setFromUnitVectors(startVector.clone().normalize(),currentVector.clone().normalize()),newQuaternion=originObject3D.quaternion.clone().premultiply(quaternion);if(startVector.angleTo(currentVector)===0||this.hooks.emit(`wantToRotate`,newQuaternion))return;let rawAngle=new THREE.Euler().setFromQuaternion(new THREE.Quaternion().setFromUnitVectors(startVector.clone().normalize().applyQuaternion(helperQuaternion.clone().invert()),currentVector.clone().normalize().applyQuaternion(helperQuaternion.clone().invert())),`${direction.toUpperCase()}${`XZY`.replace(direction.toUpperCase(),``)}`)[direction]*angleHelper.angleDirection,prevTotalAngle=this.startInfo.angle,totalAngle=prevTotalAngle+rawAngle,SNAP_ANGLE=Math.PI/2,SNAP_THRESHOLD=THREE.MathUtils.degToRad(5),MIN_DRAG_FOR_SNAP=THREE.MathUtils.degToRad(10),trialQ=new THREE.Quaternion().setFromAxisAngle(rotationAxis,totalAngle),trialObjectQ=this.startInfo.startQuaternion.clone().premultiply(trialQ),absAngle=this.extractAxisAngle(trialObjectQ,rotationAxis),nearestSnap=Math.round(absAngle/SNAP_ANGLE)*SNAP_ANGLE,distToSnap=Math.abs(absAngle-nearestSnap);if(Math.abs(totalAngle)>MIN_DRAG_FOR_SNAP&&distToSnap<SNAP_THRESHOLD){let correction=nearestSnap-absAngle;totalAngle+=correction}let frameAngle=totalAngle-prevTotalAngle;this.startInfo.angle=totalAngle;let isSnapped=Math.abs(frameAngle)<1e-6&&Math.abs(rawAngle)>1e-6,wasSnapping=this.snapGuideLines.length>0;isSnapped&&!wasSnapping?this.showSnapGuideLines(direction,rotateCenter):!isSnapped&&wasSnapping&&this.removeSnapGuideLines(),this.setAngleHelperLength(direction,this.startInfo.angle),this.setTipsAngle(THREE.MathUtils.radToDeg(this.startInfo.angle));let frameQuaternion=new THREE.Quaternion().setFromAxisAngle(rotationAxis,frameAngle);if(rotateCenter){let v=new THREE.Vector3().subVectors(originObject3D.position,rotateCenter).applyQuaternion(frameQuaternion).add(rotateCenter);originObject3D.position.copy(v)}originObject3D.applyQuaternion(frameQuaternion),helperQuaternionOffset.premultiply(frameQuaternion),this.internalHooks.emit(`applyObjectRotate`,{quaternion:frameQuaternion,origin:rotateCenter}),this.hooks.emit(`rotate`,originObject3D.quaternion),isSnapped||(this.startInfo.startVector=currentVector)}dragEnd(){var _a;this.isDragging&&(this.removeSnapGuideLines(),(_a=this.startInfo)!=null&&_a.lineMeshes&&this.startInfo.lineMeshes.forEach(mesh=>{this.scene.remove(mesh),mesh.geometry.dispose(),mesh.material instanceof THREE.Material&&mesh.material.dispose()}),this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.updateOtherHelpers(),this.hooks.emit(`rotateEnd`))}updateOtherHelpers(){this.hooks.emit(`updateOtherHelpers`,{camera:this.camera})}getAngleHelper(direction){var _a,_b,_c;switch(direction){case`x`:return(_a=this.helperObject3D.xCircle)==null?void 0:_a.angleSector;case`y`:return(_b=this.helperObject3D.yCircle)==null?void 0:_b.angleSector;case`z`:return(_c=this.helperObject3D.zCircle)==null?void 0:_c.angleSector}}setAngleHelperStart(direction,start){let angleHelper=this.getAngleHelper(direction);if(!angleHelper){console.warn(`angleHelper is undefined`);return}if(angleHelper instanceof THREE.Mesh&&angleHelper.geometry instanceof THREE.CircleGeometry){let{radius,segments,thetaLength}=angleHelper.geometry.parameters;angleHelper.geometry=new THREE.CircleGeometry(radius,segments,start,thetaLength)}else console.warn(`only support THREE.CircleGeometry`)}setAngleHelperLength(direction,length){let adjustedLength=direction===`x`||direction===`y`?-length:length,thetaLength=adjustedLength>=0?Math.max(adjustedLength,.001):Math.min(adjustedLength,-.001),angleHelper=this.getAngleHelper(direction);if(angleHelper instanceof THREE.Mesh&&angleHelper.geometry instanceof THREE.CircleGeometry){let{radius,thetaStart}=angleHelper.geometry.parameters,segments=Math.ceil(Math.abs(thetaLength)*(40/(2*Math.PI)));angleHelper.geometry=new THREE.CircleGeometry(radius,segments,thetaStart,thetaLength)}else console.warn(`only support THREE.CircleGeometry`)}setTipsAngle(angle){var _a;let element=(_a=this.helperObject3D.angleTips)==null?void 0:_a.element;element&&(element.innerText=`${angle.toFixed(0)}°`)}setTipsPosition(position){let angleTips=this.helperObject3D.angleTips;if(!angleTips)return;let{x,y,z}=this.helperObject3D.getWorldPosition(new THREE.Vector3).clone().project(this.camera);if(z>1){angleTips.hide();return}let rect=this.container.getBoundingClientRect(),px=(x+1)/2*rect.width,py=(-y+1)/2*rect.height;angleTips.setLeftTop(px+`px`,py+`px`)}extractAxisAngle(q,axis){let a=axis.clone().normalize(),sinHalf=q.x*a.x+q.y*a.y+q.z*a.z,cosHalf=q.w,angle=2*Math.atan2(sinHalf,cosHalf);return Math.atan2(Math.sin(angle),Math.cos(angle))}showSnapGuideLines(direction,center){this.removeSnapGuideLines();let axes=(()=>{switch(direction){case`x`:return[new THREE.Vector3(0,1,0),new THREE.Vector3(0,0,1)];case`y`:return[new THREE.Vector3(1,0,0),new THREE.Vector3(0,0,1)];case`z`:return[new THREE.Vector3(1,0,0),new THREE.Vector3(0,1,0)];default:return[]}})();for(let axis of axes){let line=this.solidGuide.createSolidLine(center,axis,{color:16777215,renderOrder:RENDER_ORDER.DRAG_GUIDE_LINE});this.scene.add(line),this.snapGuideLines.push(line)}this.render()}removeSnapGuideLines(){for(let line of this.snapGuideLines)this.scene.remove(line),this.solidGuide.dispose(line);this.snapGuideLines=[]}};export{RotateController};
|
|
@@ -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 ControllerWrapper=class{constructor(five,donEvents,HelperController,object,helperObject3D,HelperControllerConfig,hooks,internalHooks,helperGroup){this.onFiveWantsTapGesture=params=>{if(!this.helperController)return;if(this.helperController.preventTapDefaultEvent)return!1;let result=this.helperController.onWantsTapGesture(params);return this.five.needsRender=!0,result},this.onFiveWantsGesture=(...params)=>{if(!this.helperController)return;let result=this.helperController.onWantsGesture(...params);return this.five.needsRender=!0,result},this.onFiveIntersectionOnModelUpdate=(...params)=>{this.helperController&&this.helperController.onIntersectionOnModelUpdate(...params)};let{camera,model,scene}=five,container=five.getElement();if(this.five=five,!camera||!model||!container||!scene)return;let targetScene=helperGroup==null?scene:helperGroup,onRender=()=>{five.needsRender=!0};this.helperController=new HelperController({camera,model,domEvents:donEvents,originObject3D:object,helperObject3D,container,scene:targetScene,onRender,sharedHooks:hooks,sharedInternalHooks:internalHooks},HelperControllerConfig),five.on(`wantsTapGesture`,this.onFiveWantsTapGesture),five.on(`wantsGesture`,this.onFiveWantsGesture),five.on(`intersectionOnModelUpdate`,this.onFiveIntersectionOnModelUpdate)}dispose(){var _a;this.five.off(`wantsTapGesture`,this.onFiveWantsTapGesture),this.five.off(`wantsGesture`,this.onFiveWantsGesture),this.five.off(`intersectionOnModelUpdate`,this.onFiveIntersectionOnModelUpdate),(_a=this.helperController)==null||_a.dispose()}};exports.ControllerWrapper=ControllerWrapper,exports.FiveControllerWrapper=ControllerWrapper;
|
|
@@ -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 ControllerWrapper=class{constructor(five,donEvents,HelperController,object,helperObject3D,HelperControllerConfig,hooks,internalHooks,helperGroup){this.onFiveWantsTapGesture=params=>{if(!this.helperController)return;if(this.helperController.preventTapDefaultEvent)return!1;let result=this.helperController.onWantsTapGesture(params);return this.five.needsRender=!0,result},this.onFiveWantsGesture=(...params)=>{if(!this.helperController)return;let result=this.helperController.onWantsGesture(...params);return this.five.needsRender=!0,result},this.onFiveIntersectionOnModelUpdate=(...params)=>{this.helperController&&this.helperController.onIntersectionOnModelUpdate(...params)};let{camera,model,scene}=five,container=five.getElement();if(this.five=five,!camera||!model||!container||!scene)return;let targetScene=helperGroup==null?scene:helperGroup,onRender=()=>{five.needsRender=!0};this.helperController=new HelperController({camera,model,domEvents:donEvents,originObject3D:object,helperObject3D,container,scene:targetScene,onRender,sharedHooks:hooks,sharedInternalHooks:internalHooks},HelperControllerConfig),five.on(`wantsTapGesture`,this.onFiveWantsTapGesture),five.on(`wantsGesture`,this.onFiveWantsGesture),five.on(`intersectionOnModelUpdate`,this.onFiveIntersectionOnModelUpdate)}dispose(){var _a;this.five.off(`wantsTapGesture`,this.onFiveWantsTapGesture),this.five.off(`wantsGesture`,this.onFiveWantsGesture),this.five.off(`intersectionOnModelUpdate`,this.onFiveIntersectionOnModelUpdate),(_a=this.helperController)==null||_a.dispose()}};export{ControllerWrapper,ControllerWrapper as FiveControllerWrapper};
|
|
@@ -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_setObjectQuaternion=require("../utils/setObjectQuaternion.js"),require_isNil=require("../../../five/utils/isNil.js");let three_webgpu=require("three/webgpu");three_webgpu=require_runtime.__toESM(three_webgpu,1);var BaseHelper=class extends three_webgpu.Object3D{removeChildren(){for(;this.children.length>0;)this.remove(this.children[0]);return this}add(...objects){let notNilObjects=objects.filter(Boolean);return notNilObjects.length===0?this:super.add(...notNilObjects)}addIfNotExists(...objects){return objects.forEach(object=>{this.children.includes(object)||this.add(object)}),this}remove(...objects){if(objects.length===0)return this;let notNilObjects=objects.filter(Boolean);return super.remove(...notNilObjects)}removeFromParent(){let parent=this.parent;return parent!==null&&parent.remove(this),this}get helperObject(){return this}constructor(originObject3D,config){var _a,_b;super(),this.originObject3D=originObject3D,this.onRender=(_a=config==null?void 0:config.onRender)==null?(()=>{}):_a,this.positionFrom=(_b=config==null?void 0:config.positionFrom)==null?`objectPosition`:_b}render(){this.onRender()}enable(){this.parent&&(this.parent.children.includes(this)||this.parent.add(this))}disable(){this.removeFromParent()}show(){this.visible=!0,this.render()}hide(){this.visible=!1,this.render()}raycasterIntersectObject(raycaster,intersection=[]){return raycaster.intersectObject(this,!0,intersection)}initialPosition(offset){this.positionFrom===`objectPosition`?this.position.copy(this.originObject3D.position):this.positionFrom===`boundingBox`||this.positionFrom===`boundingSphere`?this.position.copy(new three_webgpu.Box3().expandByObject(this.originObject3D).getCenter(new three_webgpu.Vector3)):this.positionFrom instanceof three_webgpu.Vector3?this.position.copy(this.positionFrom):this.positionFrom instanceof Function&&this.position.copy(this.positionFrom(this.originObject3D)),offset&&this.position.add(offset)}setScaleByCamera(camera){}initQuaternion(config){if(this.quaternion.set(0,0,0,1),config&&(config.xAxis||config.yAxis||config.zAxis)){let xAxis=config.xAxis instanceof Function?config.xAxis():config.xAxis,yAxis=config.yAxis instanceof Function?config.yAxis():config.yAxis,zAxis=config.zAxis instanceof Function?config.zAxis():config.zAxis,newX=xAxis==null?void 0:xAxis.clone(),newY=yAxis==null?void 0:yAxis.clone(),newZ=zAxis==null?void 0:zAxis.clone();if(newX&&!newY&&!newY){let quaternionX=new three_webgpu.Quaternion().setFromUnitVectors(new three_webgpu.Vector3(1,0,0),newX.normalize());this.applyQuaternion(quaternionX)}if(newY&&!newX&&!newZ){let quaternionY=new three_webgpu.Quaternion().setFromUnitVectors(new three_webgpu.Vector3(0,1,0),newY.normalize());this.applyQuaternion(quaternionY)}if(newZ&&!newX&&!newY){let quaternionZ=new three_webgpu.Quaternion().setFromUnitVectors(new three_webgpu.Vector3(0,0,1),newZ.normalize());this.applyQuaternion(quaternionZ)}if([newX,newY,newZ].filter(v=>!require_isNil.isNil(v)).length>=2){newX||(newX=new three_webgpu.Vector3().crossVectors(newY,newZ).normalize()),newY||(newY=new three_webgpu.Vector3().crossVectors(newX,newZ).normalize()),newZ||(newZ=new three_webgpu.Vector3().crossVectors(newX,newY).normalize()),newX.applyQuaternion(this.quaternion),newY.applyQuaternion(this.quaternion),newZ.applyQuaternion(this.quaternion);let newMatrix=new three_webgpu.Matrix4().makeBasis(newX,newY,newZ),quaternion=new three_webgpu.Quaternion().setFromRotationMatrix(newMatrix);this.quaternion.copy(quaternion)}}}applyHelperScaleMatrix4(matrix,origin){this.scale.applyMatrix4(matrix)}setHelperQuaternion(quaternion,origin){this.initQuaternion(),origin?require_setObjectQuaternion.default(this,this.quaternion.clone().premultiply(quaternion),origin):this.quaternion.premultiply(quaternion)}applyHelperQuaternion(quaternion,origin){if(origin){let v=new three_webgpu.Vector3().subVectors(this.position,origin).applyQuaternion(quaternion).add(origin);this.position.copy(v)}this.applyQuaternion(quaternion)}dispose(){this.removeFromParent()}},MoveHelperAbstract=class extends BaseHelper{},BoundingBoxHelperAbstract=class extends BaseHelper{},RotateHelperAbstract=class extends BaseHelper{};exports.BaseHelper=BaseHelper,exports.BoundingBoxHelperAbstract=BoundingBoxHelperAbstract,exports.MoveHelperAbstract=MoveHelperAbstract,exports.RotateHelperAbstract=RotateHelperAbstract;
|
|
@@ -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
|
|
338
|
+
*/import setObjectQuaternion from"../utils/setObjectQuaternion.mjs";import{isNil}from"../../../five/utils/isNil.mjs";import*as THREE from"three/webgpu";import{Vector3}from"three/webgpu";var BaseHelper=class extends THREE.Object3D{removeChildren(){for(;this.children.length>0;)this.remove(this.children[0]);return this}add(...objects){let notNilObjects=objects.filter(Boolean);return notNilObjects.length===0?this:super.add(...notNilObjects)}addIfNotExists(...objects){return objects.forEach(object=>{this.children.includes(object)||this.add(object)}),this}remove(...objects){if(objects.length===0)return this;let notNilObjects=objects.filter(Boolean);return super.remove(...notNilObjects)}removeFromParent(){let parent=this.parent;return parent!==null&&parent.remove(this),this}get helperObject(){return this}constructor(originObject3D,config){var _a,_b;super(),this.originObject3D=originObject3D,this.onRender=(_a=config==null?void 0:config.onRender)==null?(()=>{}):_a,this.positionFrom=(_b=config==null?void 0:config.positionFrom)==null?`objectPosition`:_b}render(){this.onRender()}enable(){this.parent&&(this.parent.children.includes(this)||this.parent.add(this))}disable(){this.removeFromParent()}show(){this.visible=!0,this.render()}hide(){this.visible=!1,this.render()}raycasterIntersectObject(raycaster,intersection=[]){return raycaster.intersectObject(this,!0,intersection)}initialPosition(offset){this.positionFrom===`objectPosition`?this.position.copy(this.originObject3D.position):this.positionFrom===`boundingBox`||this.positionFrom===`boundingSphere`?this.position.copy(new THREE.Box3().expandByObject(this.originObject3D).getCenter(new THREE.Vector3)):this.positionFrom instanceof Vector3?this.position.copy(this.positionFrom):this.positionFrom instanceof Function&&this.position.copy(this.positionFrom(this.originObject3D)),offset&&this.position.add(offset)}setScaleByCamera(camera){}initQuaternion(config){if(this.quaternion.set(0,0,0,1),config&&(config.xAxis||config.yAxis||config.zAxis)){let xAxis=config.xAxis instanceof Function?config.xAxis():config.xAxis,yAxis=config.yAxis instanceof Function?config.yAxis():config.yAxis,zAxis=config.zAxis instanceof Function?config.zAxis():config.zAxis,newX=xAxis==null?void 0:xAxis.clone(),newY=yAxis==null?void 0:yAxis.clone(),newZ=zAxis==null?void 0:zAxis.clone();if(newX&&!newY&&!newY){let quaternionX=new THREE.Quaternion().setFromUnitVectors(new THREE.Vector3(1,0,0),newX.normalize());this.applyQuaternion(quaternionX)}if(newY&&!newX&&!newZ){let quaternionY=new THREE.Quaternion().setFromUnitVectors(new THREE.Vector3(0,1,0),newY.normalize());this.applyQuaternion(quaternionY)}if(newZ&&!newX&&!newY){let quaternionZ=new THREE.Quaternion().setFromUnitVectors(new THREE.Vector3(0,0,1),newZ.normalize());this.applyQuaternion(quaternionZ)}if([newX,newY,newZ].filter(v=>!isNil(v)).length>=2){newX||(newX=new THREE.Vector3().crossVectors(newY,newZ).normalize()),newY||(newY=new THREE.Vector3().crossVectors(newX,newZ).normalize()),newZ||(newZ=new THREE.Vector3().crossVectors(newX,newY).normalize()),newX.applyQuaternion(this.quaternion),newY.applyQuaternion(this.quaternion),newZ.applyQuaternion(this.quaternion);let newMatrix=new THREE.Matrix4().makeBasis(newX,newY,newZ),quaternion=new THREE.Quaternion().setFromRotationMatrix(newMatrix);this.quaternion.copy(quaternion)}}}applyHelperScaleMatrix4(matrix,origin){this.scale.applyMatrix4(matrix)}setHelperQuaternion(quaternion,origin){this.initQuaternion(),origin?setObjectQuaternion(this,this.quaternion.clone().premultiply(quaternion),origin):this.quaternion.premultiply(quaternion)}applyHelperQuaternion(quaternion,origin){if(origin){let v=new Vector3().subVectors(this.position,origin).applyQuaternion(quaternion).add(origin);this.position.copy(v)}this.applyQuaternion(quaternion)}dispose(){this.removeFromParent()}},MoveHelperAbstract=class extends BaseHelper{},BoundingBoxHelperAbstract=class extends BaseHelper{},RotateHelperAbstract=class extends BaseHelper{};export{BaseHelper,BoundingBoxHelperAbstract,MoveHelperAbstract,RotateHelperAbstract};
|
|
@@ -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_setObjectQuaternion=require("../utils/setObjectQuaternion.js"),require_BaseHelper=require("./BaseHelper.js");let three_webgpu=require("three/webgpu");three_webgpu=require_runtime.__toESM(three_webgpu,1);var BoundingBoxHelper=class extends require_BaseHelper.BoundingBoxHelperAbstract{constructor(originObject){super(originObject),this.name=`BoundingBoxHelper`,this.positionAttribute=new three_webgpu.BufferAttribute(new Float32Array(24),3),this.box=this.createBox(),this.outline=this.createOutline(),this.add(this.box,this.outline),this.update()}initQuaternion(){this.quaternion.copy(this.originObject3D.quaternion),this.scale.copy(this.originObject3D.scale)}setHelperQuaternion(quaternion,origin){require_setObjectQuaternion.default(this,quaternion,origin)}raycasterIntersectObject(raycaster,intersection){return raycaster.intersectObject(this,!1,intersection)}raycast(raycaster,intersects){this.box.raycast(raycaster,intersects)}update(){let localBox=new three_webgpu.Box3,inverseMatrix=new three_webgpu.Matrix4().copy(this.originObject3D.matrixWorld).invert(),vertex=new three_webgpu.Vector3;if(this.originObject3D.updateMatrixWorld(!0),this.originObject3D.traverse(child=>{let geometry=child.geometry;if(!geometry)return;child.updateMatrixWorld(!0);let toLocal=new three_webgpu.Matrix4().multiplyMatrices(inverseMatrix,child.matrixWorld);if(geometry.isBufferGeometry){let bufGeom=geometry,position=bufGeom.attributes.position;if(position)for(let i=0,l=position.count;i<l;i++)vertex.fromBufferAttribute(position,i).applyMatrix4(toLocal),localBox.expandByPoint(vertex);let instanceStart=bufGeom.attributes.instanceStart,instanceEnd=bufGeom.attributes.instanceEnd;if(instanceStart)for(let i=0,l=instanceStart.count;i<l;i++)vertex.fromBufferAttribute(instanceStart,i).applyMatrix4(toLocal),localBox.expandByPoint(vertex);if(instanceEnd)for(let i=0,l=instanceEnd.count;i<l;i++)vertex.fromBufferAttribute(instanceEnd,i).applyMatrix4(toLocal),localBox.expandByPoint(vertex)}else if(geometry.vertices){let vertices=geometry.vertices;for(let v of vertices)vertex.copy(v).applyMatrix4(toLocal),localBox.expandByPoint(vertex)}}),localBox.isEmpty())return;let{min,max}=localBox;this.positionAttribute.setXYZ(0,max.x,max.y,max.z),this.positionAttribute.setXYZ(1,min.x,max.y,max.z),this.positionAttribute.setXYZ(2,min.x,min.y,max.z),this.positionAttribute.setXYZ(3,max.x,min.y,max.z),this.positionAttribute.setXYZ(4,max.x,max.y,min.z),this.positionAttribute.setXYZ(5,min.x,max.y,min.z),this.positionAttribute.setXYZ(6,min.x,min.y,min.z),this.positionAttribute.setXYZ(7,max.x,min.y,min.z),this.positionAttribute.needsUpdate=!0}createOutline(){let lineIndices=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),lineGeometry=new three_webgpu.BufferGeometry;lineGeometry.setIndex(new three_webgpu.BufferAttribute(lineIndices,1)),lineGeometry.setAttribute(`position`,this.positionAttribute);let lineMaterial=new three_webgpu.LineBasicMaterial({color:64767,linewidth:1,opacity:1,toneMapped:!1}),lineSegments=new three_webgpu.LineSegments(lineGeometry,lineMaterial);return lineSegments.matrixAutoUpdate=!1,lineSegments}createBox(){let boxIndices=new Uint16Array([0,1,2,0,2,3,0,3,7,0,7,4,0,4,5,0,5,1,6,1,5,6,2,1,6,5,4,6,4,7,6,3,2,6,7,3]),boxGeometry=new three_webgpu.BufferGeometry;boxGeometry.setIndex(new three_webgpu.BufferAttribute(boxIndices,1)),boxGeometry.setAttribute(`position`,this.positionAttribute);let boxMaterial=new three_webgpu.MeshBasicMaterial({color:64767,opacity:.1,depthTest:!1,transparent:!0});return new three_webgpu.Mesh(boxGeometry,boxMaterial)}};exports.BoundingBoxHelper=BoundingBoxHelper;
|
|
@@ -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
|
|
338
|
+
*/import setObjectQuaternion from"../utils/setObjectQuaternion.mjs";import{BoundingBoxHelperAbstract}from"./BaseHelper.mjs";import*as THREE from"three/webgpu";var BoundingBoxHelper=class extends BoundingBoxHelperAbstract{constructor(originObject){super(originObject),this.name=`BoundingBoxHelper`,this.positionAttribute=new THREE.BufferAttribute(new Float32Array(24),3),this.box=this.createBox(),this.outline=this.createOutline(),this.add(this.box,this.outline),this.update()}initQuaternion(){this.quaternion.copy(this.originObject3D.quaternion),this.scale.copy(this.originObject3D.scale)}setHelperQuaternion(quaternion,origin){setObjectQuaternion(this,quaternion,origin)}raycasterIntersectObject(raycaster,intersection){return raycaster.intersectObject(this,!1,intersection)}raycast(raycaster,intersects){this.box.raycast(raycaster,intersects)}update(){let localBox=new THREE.Box3,inverseMatrix=new THREE.Matrix4().copy(this.originObject3D.matrixWorld).invert(),vertex=new THREE.Vector3;if(this.originObject3D.updateMatrixWorld(!0),this.originObject3D.traverse(child=>{let geometry=child.geometry;if(!geometry)return;child.updateMatrixWorld(!0);let toLocal=new THREE.Matrix4().multiplyMatrices(inverseMatrix,child.matrixWorld);if(geometry.isBufferGeometry){let bufGeom=geometry,position=bufGeom.attributes.position;if(position)for(let i=0,l=position.count;i<l;i++)vertex.fromBufferAttribute(position,i).applyMatrix4(toLocal),localBox.expandByPoint(vertex);let instanceStart=bufGeom.attributes.instanceStart,instanceEnd=bufGeom.attributes.instanceEnd;if(instanceStart)for(let i=0,l=instanceStart.count;i<l;i++)vertex.fromBufferAttribute(instanceStart,i).applyMatrix4(toLocal),localBox.expandByPoint(vertex);if(instanceEnd)for(let i=0,l=instanceEnd.count;i<l;i++)vertex.fromBufferAttribute(instanceEnd,i).applyMatrix4(toLocal),localBox.expandByPoint(vertex)}else if(geometry.vertices){let vertices=geometry.vertices;for(let v of vertices)vertex.copy(v).applyMatrix4(toLocal),localBox.expandByPoint(vertex)}}),localBox.isEmpty())return;let{min,max}=localBox;this.positionAttribute.setXYZ(0,max.x,max.y,max.z),this.positionAttribute.setXYZ(1,min.x,max.y,max.z),this.positionAttribute.setXYZ(2,min.x,min.y,max.z),this.positionAttribute.setXYZ(3,max.x,min.y,max.z),this.positionAttribute.setXYZ(4,max.x,max.y,min.z),this.positionAttribute.setXYZ(5,min.x,max.y,min.z),this.positionAttribute.setXYZ(6,min.x,min.y,min.z),this.positionAttribute.setXYZ(7,max.x,min.y,min.z),this.positionAttribute.needsUpdate=!0}createOutline(){let lineIndices=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),lineGeometry=new THREE.BufferGeometry;lineGeometry.setIndex(new THREE.BufferAttribute(lineIndices,1)),lineGeometry.setAttribute(`position`,this.positionAttribute);let lineMaterial=new THREE.LineBasicMaterial({color:64767,linewidth:1,opacity:1,toneMapped:!1}),lineSegments=new THREE.LineSegments(lineGeometry,lineMaterial);return lineSegments.matrixAutoUpdate=!1,lineSegments}createBox(){let boxIndices=new Uint16Array([0,1,2,0,2,3,0,3,7,0,7,4,0,4,5,0,5,1,6,1,5,6,2,1,6,5,4,6,4,7,6,3,2,6,7,3]),boxGeometry=new THREE.BufferGeometry;boxGeometry.setIndex(new THREE.BufferAttribute(boxIndices,1)),boxGeometry.setAttribute(`position`,this.positionAttribute);let boxMaterial=new THREE.MeshBasicMaterial({color:64767,opacity:.1,depthTest:!1,transparent:!0});return new THREE.Mesh(boxGeometry,boxMaterial)}};export{BoundingBoxHelper};
|
|
@@ -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_BaseHelper=require("./BaseHelper.js"),require_constant=require("../constant.js"),require_ArrowGroup=require("../utils/ArrowGroup.js"),require_CenterHandle=require("../utils/CenterHandle.js"),require_PlaneHandle=require("../utils/PlaneHandle.js"),require_calculateScaleByCamera=require("../utils/calculateScaleByCamera.js"),require_getOrthographicCameraDirection=require("../utils/getOrthographicCameraDirection.js"),require_tipsDom=require("../utils/tipsDom.js");let three_webgpu=require("three/webgpu");three_webgpu=require_runtime.__toESM(three_webgpu,1);var MoveHelper=class extends require_BaseHelper.MoveHelperAbstract{constructor(originObject3D,config){super(originObject3D,config),this.name=`MoveHelper`,(config==null?void 0:config.xArrowEnable)!==!1&&(this.xArrow=new require_ArrowGroup.ArrowGroup({direction:`x`,color:require_constant.AXES_THREE_COLOR.X})),(config==null?void 0:config.yArrowEnable)!==!1&&(this.yArrow=new require_ArrowGroup.ArrowGroup({direction:`y`,color:require_constant.AXES_THREE_COLOR.Y})),(config==null?void 0:config.zArrowEnable)!==!1&&(this.zArrow=new require_ArrowGroup.ArrowGroup({direction:`z`,color:require_constant.AXES_THREE_COLOR.Z})),(config==null?void 0:config.centerHandleEnable)!==!1&&(this.centerHandle=new require_CenterHandle.CenterHandle),(config==null?void 0:config.xyPlaneEnable)!==!1&&(this.xyPlane=new require_PlaneHandle.PlaneHandle({direction:`xy`,color:require_constant.AXES_THREE_COLOR.Z})),(config==null?void 0:config.xzPlaneEnable)!==!1&&(this.xzPlane=new require_PlaneHandle.PlaneHandle({direction:`xz`,color:require_constant.AXES_THREE_COLOR.Y})),(config==null?void 0:config.yzPlaneEnable)!==!1&&(this.yzPlane=new require_PlaneHandle.PlaneHandle({direction:`yz`,color:require_constant.AXES_THREE_COLOR.X})),config!=null&&config.container&&(config==null?void 0:config.moveTipsEnable)!==!1&&(this.container=config.container,this.moveTips=require_tipsDom.tipsDom({display:`none`}),this.container.appendChild(this.moveTips.element)),this.add(...[this.xArrow,this.yArrow,this.zArrow,this.centerHandle,this.xyPlane,this.xzPlane,this.yzPlane].filter(Boolean))}update(camera){if(this.xArrow&&(this.xArrow.visible=!0),this.yArrow&&(this.yArrow.visible=!0),this.zArrow&&(this.zArrow.visible=!0),this.centerHandle&&this.centerHandle.update(camera),camera.type===`OrthographicCamera`){let worldDirectionX=new three_webgpu.Vector3(1,0,0).applyQuaternion(this.quaternion),worldDirectionY=new three_webgpu.Vector3(0,1,0).applyQuaternion(this.quaternion),worldDirectionZ=new three_webgpu.Vector3(0,0,1).applyQuaternion(this.quaternion),pose=camera.pose,orthographicCameraDirection=require_getOrthographicCameraDirection.getOrthographicCameraDirection(pose),hideThreshold=.0872665;Math.abs(worldDirectionX.angleTo(orthographicCameraDirection)-0)<hideThreshold||Math.abs(worldDirectionX.angleTo(orthographicCameraDirection)-Math.PI)<hideThreshold?this.xArrow&&(this.xArrow.visible=!1):Math.abs(worldDirectionY.angleTo(orthographicCameraDirection)-0)<hideThreshold||Math.abs(worldDirectionY.angleTo(orthographicCameraDirection)-Math.PI)<hideThreshold?this.yArrow&&(this.yArrow.visible=!1):(Math.abs(worldDirectionZ.angleTo(orthographicCameraDirection)-0)<hideThreshold||Math.abs(worldDirectionZ.angleTo(orthographicCameraDirection)-Math.PI)<hideThreshold)&&this.zArrow&&(this.zArrow.visible=!1)}}show(){var _a;super.show(),this.xArrow&&this.add(this.xArrow),this.yArrow&&this.add(this.yArrow),this.zArrow&&this.add(this.zArrow),this.centerHandle&&this.add(this.centerHandle),this.xyPlane&&this.add(this.xyPlane),this.xzPlane&&this.add(this.xzPlane),this.yzPlane&&this.add(this.yzPlane),(_a=this.moveTips)==null||_a.hide()}setScaleByCamera(camera){this.scale.setScalar(require_calculateScaleByCamera.default(camera,this.position))}showDraggingHelper(directions){this.xArrow&&(directions.includes(`x`)?this.add(this.xArrow):this.remove(this.xArrow)),this.yArrow&&(directions.includes(`y`)?this.add(this.yArrow):this.remove(this.yArrow)),this.zArrow&&(directions.includes(`z`)?this.add(this.zArrow):this.remove(this.zArrow)),this.centerHandle&&(directions.includes(`plane`)?this.add(this.centerHandle):this.remove(this.centerHandle)),this.xyPlane&&(directions.includes(`xy`)?this.add(this.xyPlane):this.remove(this.xyPlane)),this.xzPlane&&(directions.includes(`xz`)?this.add(this.xzPlane):this.remove(this.xzPlane)),this.yzPlane&&(directions.includes(`yz`)?this.add(this.yzPlane):this.remove(this.yzPlane))}dispose(){var _a,_b;this.remove(...[this.xArrow,this.yArrow,this.zArrow,this.centerHandle,this.xyPlane,this.xzPlane,this.yzPlane].filter(Boolean)),(_b=(_a=this.moveTips)==null?void 0:_a.element)==null||_b.remove(),super.dispose()}};exports.MoveHelper=MoveHelper;
|