@realsee/five-webgpu 1.0.0-alpha.12 → 1.0.0-alpha.13
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 +2 -2
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/index.AdaptiveLuminancePass.html +1 -1
- package/docs/classes/index.EyeDomeLightingPass.html +1 -1
- package/docs/classes/index.Five.html +77 -69
- package/docs/classes/index.FivePass.html +1 -1
- package/docs/classes/index.FiveRenderer.html +7 -2
- 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 -5
- package/docs/classes/index.Model.html +1 -1
- package/docs/classes/index.ModelScene.html +1 -1
- package/docs/classes/index.PBMCustomNode.html +1 -1
- package/docs/classes/index.PBMGaussianSplattingNodeMaterial.html +9 -9
- package/docs/classes/index.PBMGaussianSplattingObject.html +49 -11
- package/docs/classes/index.PBMGaussianSplattingRenderMesh.html +71 -16
- 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.Parameter.html +24 -22
- package/docs/classes/index.Tile3D.html +22 -22
- package/docs/classes/index.TileNode.html +2 -2
- package/docs/classes/index.TrajectoryNode.html +1 -1
- package/docs/classes/index.WorkResolvedObserver.html +1 -1
- package/docs/functions/index.loadPly.html +10 -1
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/index.DeviceProfile.html +2 -2
- package/docs/interfaces/index.EventCallback.html +1 -1
- package/docs/interfaces/index.IPBMMaterial.html +1 -1
- package/docs/interfaces/index.LooseWorkWithExtrinsics.html +1 -1
- package/docs/interfaces/index.ModelControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.PBMGaussianSplattingNodeMaterialOptions.html +3 -3
- package/docs/interfaces/index.PanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.PanoramaLikeControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.ParameterMaterialValue.html +8 -6
- package/docs/interfaces/index.ParameterTilesetValue.html +15 -15
- package/docs/interfaces/index.ParameterValue.html +21 -19
- package/docs/interfaces/index.ResolvedParameterValue.html +22 -20
- package/docs/interfaces/index.SplatData.html +10 -6
- package/docs/interfaces/index.Tile3DOptions.html +2 -2
- package/docs/interfaces/index.TopviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.VRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.ViewLayer.html +22 -22
- package/docs/interfaces/index.WorkCubeHdrGainmapImage.html +1 -1
- package/docs/interfaces/index.WorkCubeImage.html +1 -1
- package/docs/interfaces/index.WorkImage.html +1 -1
- package/docs/interfaces/index.WorkModelLayer.html +2 -2
- package/docs/interfaces/index.WorkObserver.html +1 -1
- package/docs/interfaces/index.WorkTile.html +1 -1
- package/docs/interfaces/index.XRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/types/index.ParseOptions.html +1 -1
- package/five/application/five.d.ts +12 -0
- package/five/controllers/xrPanorama.d.ts +13 -0
- package/five/core/internalWebGPURenderer.d.ts +0 -3
- package/five/core/panoVideo.d.ts +2 -0
- package/five/gaussian-splatting/arena/splatArena.d.ts +227 -0
- package/five/gaussian-splatting/cullConstants.d.ts +68 -0
- package/five/gaussian-splatting/hybridConstants.d.ts +60 -0
- package/five/gaussian-splatting/instancePacking.d.ts +46 -0
- package/five/gaussian-splatting/mirrors/layoutMirror.d.ts +44 -0
- package/five/gaussian-splatting/mirrors/mirrorBuffer.d.ts +72 -0
- package/five/gaussian-splatting/mirrors/mirrorSet.d.ts +17 -0
- package/five/gaussian-splatting/mirrors/objectParamsMirror.d.ts +35 -0
- package/five/gaussian-splatting/mirrors/transformMirror.d.ts +26 -0
- package/five/gaussian-splatting/pipelines/gpuSortPipeline.d.ts +5 -31
- package/five/gaussian-splatting/pipelines/pipelineMode.d.ts +1 -2
- package/five/gaussian-splatting/sh-core/codec.d.ts +13 -0
- package/five/gaussian-splatting/sh-core/constants.d.ts +29 -0
- package/five/gaussian-splatting/sh-core/index.d.ts +4 -0
- package/five/gaussian-splatting/sh-core/rebakePolicy.d.ts +20 -0
- package/five/gaussian-splatting/sh-core/texelRange.d.ts +18 -0
- package/five/gaussian-splatting/shAssembler.d.ts +14 -0
- package/five/gaussian-splatting/shBakeScheduler.d.ts +26 -0
- package/five/gaussian-splatting/shBaker.d.ts +44 -0
- package/five/gaussian-splatting/shTileResource.d.ts +22 -0
- package/five/gaussian-splatting/splatAssembler.d.ts +1 -1
- package/five/gaussian-splatting/transformStore.d.ts +2 -2
- package/five/gaussian-splatting/worker/decodeWorker.d.ts +72 -0
- package/five/index.js +172 -97
- package/five/index.mjs +11754 -8963
- package/five/model/loaders/ply.d.ts +22 -6
- package/five/model/loaders/spz.d.ts +9 -48
- package/five/model/materials/pbmGaussianSplattingNodeMaterial.d.ts +6 -12
- package/five/model/objects/pbmGaussianSplattingObject.d.ts +91 -6
- package/five/model/objects/pbmGaussianSplattingRenderMesh.d.ts +357 -15
- package/five/model/parameter.d.ts +4 -0
- package/five/renderer/compute-renderers/binned/binned-core.d.ts +45 -2
- package/five/renderer/compute-renderers/binned/binned-pipelines.d.ts +82 -1
- package/five/renderer/compute-renderers/color-space.d.ts +13 -0
- package/five/renderer/compute-renderers/composite-pipelines.d.ts +36 -0
- package/five/renderer/compute-renderers/frame-plan.d.ts +166 -0
- package/five/renderer/compute-renderers/gsplat-hybrid-renderer.d.ts +386 -0
- package/five/renderer/compute-renderers/pointcloud-compute-renderer.d.ts +101 -16
- package/five/renderer/compute-renderers/shaders/composite-additive.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/composite-blend.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/gsplatHybridIndirect.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/gsplatProjector.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/gsplatQuad.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/lib/write-additive.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/lib/write-blend.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/lib/write-opaque.d.ts +2 -0
- package/five/renderer/compute-renderers/tile-uniform-writer.d.ts +70 -0
- package/five/renderer/compute-renderers/transparency-buffers.d.ts +59 -0
- package/five/renderer/compute-renderers/transparency-math.d.ts +70 -0
- package/five/renderer/compute-renderers/transparency-settings.d.ts +24 -0
- package/five/renderer/compute-renderers/uniform-layout.d.ts +11 -2
- package/five/renderer/five-renderer.d.ts +28 -3
- package/five/renderer/postprocessing/passes/pass.js +2 -2
- package/five/renderer/postprocessing/passes/pass.mjs +2 -2
- package/five/renderer/tools/full-screen-quad.js +2 -2
- package/five/renderer/tools/full-screen-quad.mjs +2 -2
- package/five/texture/videoTextureBridge.d.ts +43 -0
- package/five/utils/calculateThreeMouse.js +2 -2
- package/five/utils/calculateThreeMouse.mjs +2 -2
- package/five/utils/distance.js +2 -2
- package/five/utils/distance.mjs +2 -2
- package/five/utils/isNil.js +2 -2
- package/five/utils/isNil.mjs +2 -2
- package/five/utils/uuid.js +2 -2
- package/five/utils/uuid.mjs +2 -2
- package/gltf-loader/index.js +3 -3
- package/gltf-loader/index.mjs +3 -3
- package/line/index.js +3 -3
- package/line/index.mjs +3 -3
- package/package.json +1 -1
- package/plugins/BackgroundPlugin/Controller.js +2 -2
- package/plugins/BackgroundPlugin/Controller.mjs +2 -2
- package/plugins/BackgroundPlugin/index.js +2 -2
- package/plugins/BackgroundPlugin/index.mjs +2 -2
- package/plugins/BasePlugin/index.js +2 -2
- package/plugins/BasePlugin/index.mjs +2 -2
- package/plugins/CSS2DPlugin/Controller.js +2 -2
- package/plugins/CSS2DPlugin/Controller.mjs +2 -2
- package/plugins/CSS2DPlugin/index.js +2 -2
- package/plugins/CSS2DPlugin/index.mjs +2 -2
- package/plugins/CSS2DPlugin/style.css_raw.js +2 -2
- package/plugins/CSS2DPlugin/style.css_raw.mjs +2 -2
- package/plugins/CSS3DPlugin/Controller.js +2 -2
- package/plugins/CSS3DPlugin/Controller.mjs +2 -2
- package/plugins/CSS3DPlugin/index.js +2 -2
- package/plugins/CSS3DPlugin/index.mjs +2 -2
- package/plugins/CSS3DPlugin/style.css_raw.js +2 -2
- package/plugins/CSS3DPlugin/style.css_raw.mjs +2 -2
- package/plugins/FloorplanPlugin/Controller.js +2 -2
- package/plugins/FloorplanPlugin/Controller.mjs +2 -2
- package/plugins/FloorplanPlugin/index.js +2 -2
- package/plugins/FloorplanPlugin/index.mjs +2 -2
- package/plugins/FloorplanPlugin/render/assets.js +2 -2
- package/plugins/FloorplanPlugin/render/assets.mjs +2 -2
- package/plugins/FloorplanPlugin/render/index.js +2 -2
- package/plugins/FloorplanPlugin/render/index.mjs +2 -2
- package/plugins/FloorplanPlugin/render/isPointInPolygon.js +2 -2
- package/plugins/FloorplanPlugin/render/isPointInPolygon.mjs +2 -2
- package/plugins/FloorplanPlugin/render/renderFloor.js +2 -2
- package/plugins/FloorplanPlugin/render/renderFloor.mjs +2 -2
- package/plugins/FloorplanPlugin/render/roomLabelVisibility.js +2 -2
- package/plugins/FloorplanPlugin/render/roomLabelVisibility.mjs +2 -2
- package/plugins/FloorplanPlugin/render/style.css_raw.js +2 -2
- package/plugins/FloorplanPlugin/render/style.css_raw.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/changeMode.js +2 -2
- package/plugins/FloorplanPlugin/utils/changeMode.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/changeModelCanvasOpacity.js +2 -2
- package/plugins/FloorplanPlugin/utils/changeModelCanvasOpacity.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/correctFiveState.js +2 -2
- package/plugins/FloorplanPlugin/utils/correctFiveState.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/equal.js +2 -2
- package/plugins/FloorplanPlugin/utils/equal.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/filter.js +2 -2
- package/plugins/FloorplanPlugin/utils/filter.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/fiveModelLoad.js +2 -2
- package/plugins/FloorplanPlugin/utils/fiveModelLoad.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/formatData.js +2 -2
- package/plugins/FloorplanPlugin/utils/formatData.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/formatFloorplanJson.js +2 -2
- package/plugins/FloorplanPlugin/utils/formatFloorplanJson.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/formatPosition.js +2 -2
- package/plugins/FloorplanPlugin/utils/formatPosition.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/getDistanceFromModel.js +2 -2
- package/plugins/FloorplanPlugin/utils/getDistanceFromModel.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/getPxmm.js +2 -2
- package/plugins/FloorplanPlugin/utils/getPxmm.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/isTruelyObject.js +2 -2
- package/plugins/FloorplanPlugin/utils/isTruelyObject.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/nearlyEqual.js +2 -2
- package/plugins/FloorplanPlugin/utils/nearlyEqual.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/polylabel.js +2 -2
- package/plugins/FloorplanPlugin/utils/polylabel.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/to.js +2 -2
- package/plugins/FloorplanPlugin/utils/to.mjs +2 -2
- package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.d.ts +6 -0
- package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.js +3 -3
- package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.mjs +3 -3
- package/plugins/GaussianSplattingEntranceAnimationPlugin/index.js +2 -2
- package/plugins/GaussianSplattingEntranceAnimationPlugin/index.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Controller.js +2 -2
- package/plugins/Object3DHelperPlugin/Controller.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/BaseController.js +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/BaseController.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/BoundingBoxController.js +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/BoundingBoxController.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/MoveController.js +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/MoveController.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/RotateController.js +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/RotateController.mjs +2 -2
- package/plugins/Object3DHelperPlugin/FiveControllerWrapper.js +2 -2
- package/plugins/Object3DHelperPlugin/FiveControllerWrapper.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Helper/BaseHelper.js +2 -2
- package/plugins/Object3DHelperPlugin/Helper/BaseHelper.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Helper/BoundingBoxHelper.js +2 -2
- package/plugins/Object3DHelperPlugin/Helper/BoundingBoxHelper.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Helper/MoveHelper.js +2 -2
- package/plugins/Object3DHelperPlugin/Helper/MoveHelper.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Helper/RotateHelper.js +2 -2
- package/plugins/Object3DHelperPlugin/Helper/RotateHelper.mjs +2 -2
- package/plugins/Object3DHelperPlugin/constant.js +2 -2
- package/plugins/Object3DHelperPlugin/constant.mjs +2 -2
- package/plugins/Object3DHelperPlugin/index.js +2 -2
- package/plugins/Object3DHelperPlugin/index.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/ArrowGroup.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/ArrowGroup.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/CenterHandle.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/CenterHandle.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/PlaneHandle.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/PlaneHandle.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/cameraHooks.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/cameraHooks.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/direction.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/direction.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/solidGuide.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/solidGuide.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/tipsDom.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/tipsDom.mjs +2 -2
- package/plugins/PanoAnimePlugin/Controller.js +2 -2
- package/plugins/PanoAnimePlugin/Controller.mjs +2 -2
- package/plugins/PanoAnimePlugin/index.js +2 -2
- package/plugins/PanoAnimePlugin/index.mjs +2 -2
- package/plugins/WordPassPlugin/Controller.js +2 -2
- package/plugins/WordPassPlugin/Controller.mjs +2 -2
- package/plugins/WordPassPlugin/hersheyFont.js +2 -2
- package/plugins/WordPassPlugin/hersheyFont.mjs +2 -2
- package/plugins/WordPassPlugin/index.js +2 -2
- package/plugins/WordPassPlugin/index.mjs +2 -2
- package/plugins/WordPassPlugin/textToStrokeOrderStrokes.js +2 -2
- package/plugins/WordPassPlugin/textToStrokeOrderStrokes.mjs +2 -2
- package/plugins/WordPassPlugin/word-pass.js +2 -2
- package/plugins/WordPassPlugin/word-pass.mjs +2 -2
- package/plugins/index.js +2 -2
- package/plugins/index.mjs +2 -2
- package/plugins/thirdParty/CSS2DRenderer.js +2 -2
- package/plugins/thirdParty/CSS2DRenderer.mjs +2 -2
- package/plugins/thirdParty/CSS3DRenderer.js +2 -2
- package/plugins/thirdParty/CSS3DRenderer.mjs +2 -2
- package/plugins/thirdParty/doctorstrange-model.js +2 -2
- package/plugins/thirdParty/doctorstrange-model.mjs +2 -2
- package/plugins/thirdParty/domevents.js +2 -2
- package/plugins/thirdParty/domevents.mjs +2 -2
- package/plugins/utils/absoluteUrl.js +2 -2
- package/plugins/utils/absoluteUrl.mjs +2 -2
- package/plugins/utils/calculatePath.js +2 -2
- package/plugins/utils/calculatePath.mjs +2 -2
- package/plugins/utils/clamp.js +2 -2
- package/plugins/utils/clamp.mjs +2 -2
- package/plugins/utils/uuid.js +2 -2
- package/plugins/utils/uuid.mjs +2 -2
- package/react/index.js +2 -2
- package/react/index.mjs +2 -2
- package/sticker/index.d.ts +7 -0
- package/sticker/index.js +37 -3
- package/sticker/index.mjs +175 -18
- package/umd/five-gltf-loader.js +3 -3
- package/umd/five-line.js +3 -3
- package/umd/five-plugins.js +3 -3
- package/umd/five-react.js +2 -2
- package/umd/five-sticker.js +37 -3
- package/umd/five-vfx.js +2 -2
- package/umd/five.js +203 -128
- package/vfx/index.js +2 -2
- package/vfx/index.mjs +2 -2
- package/work-downloader/index.js +2 -2
- package/work-downloader/index.mjs +2 -2
- package/five/gaussian-splatting/shStore.d.ts +0 -22
|
@@ -21,6 +21,12 @@ export declare class Controller extends BasePlugin.Controller<PluginType.State,
|
|
|
21
21
|
private extractKeyframes;
|
|
22
22
|
private computeAABB2D;
|
|
23
23
|
private findClosestKeyframeToRay;
|
|
24
|
+
/**
|
|
25
|
+
* 是否允许播放入场动画。
|
|
26
|
+
* 受 parameter.enableGaussianSplattingInitAnimation 控制(默认 false),
|
|
27
|
+
* 为 false 时不激活动画(高斯点按正常原始尺寸渲染)。
|
|
28
|
+
*/
|
|
29
|
+
private isInitAnimationEnabled;
|
|
24
30
|
/**
|
|
25
31
|
* 查找 PBMGaussianSplatting 渲染网格。
|
|
26
32
|
* 通过 `isPBMGaussianSplattingMaterial` 标记识别 NodeMaterial(参见 PBMGaussianSplattingNodeMaterial)。
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five-webgpu
|
|
4
|
-
* Generated: 2026/10/
|
|
5
|
-
* Version: 1.0.0-alpha.
|
|
4
|
+
* Generated: 2026/10/30
|
|
5
|
+
* Version: 1.0.0-alpha.13
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +335,4 @@
|
|
|
335
335
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
336
336
|
* Agreement and all related documents shall be drafted in English.
|
|
337
337
|
|
|
338
|
-
*/const e=require("../../_virtual/_rolldown/runtime.js"),t=require("../BasePlugin/index.js");let n=require("tslib"),r=require("@realsee/five-webgpu"),i=require("three/webgpu");i=e.__toESM(i,1);var a=class{constructor(e,t,n,r,i){this.R=e,this.Q=t,this.A=n,this.B=r,this.C=i,this.cov=NaN,this.x=NaN}filter(e,t=0){if(isNaN(this.x))this.x=1/this.C*e,this.cov=1/this.C*this.Q*(1/this.C);else{let n=this.A*this.x+this.B*t,r=this.A*this.cov*this.A+this.R,i=r*this.C*(1/(this.C*r*this.C+this.Q));this.x=n+i*(e-this.C*n),this.cov=r-i*this.C*r}return this.x}},o=class extends t.BasePlugin.Controller{updateState(e,t){let n=this.state;this.state=Object.assign(Object.assign({},this.state),e),this.hooks.emit(`stateChange`,{state:this.state,prevState:n,userAction:t})}constructor(e,t){var n,r,i;super(e),this.boundingAABB=null,this.cancelAnimation=null,this.boundsSet=!1,this.keyframes=[],this.five=e,this.state={enabled:!0,visible:!0},this.duration=(n=t==null?void 0:t.duration)==null?5e3:n,this.curveHeight=(r=t==null?void 0:t.curveHeight)==null?1.5:r,this.pointDuration=(i=t==null?void 0:t.pointDuration)==null?3e3:i}load(){return(0,n.__awaiter)(this,void 0,void 0,function*(){})}enable(e){var t;if(this.state.enabled)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n)}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n)}dispose(){this.disable(),this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null);try{let e=this.findRenderMesh();e&&(e.material.aggregationEnabled=!1,e.material.aggregationProgress=1)}catch(e){}}extractKeyframes(e){let t=[];if(!e.content.data)throw Error(`轨迹数据未加载`);let n=e.content.data.positionArray,r=n.length/3,o=.01,s=.1,c=new a(o,s,1,0,1),l=new a(o,s,1,0,1),u=new a(o,s,1,0,1),d=new Float32Array(r);for(let e=0;e<r;e++)if(e===0)d[e]=0;else{let t=new i.Vector3(n[(e-1)*3],n[(e-1)*3+1],n[(e-1)*3+2]);d[e]=new i.Vector3(n[e*3],n[e*3+1],n[e*3+2]).distanceTo(t)+d[e-1]}for(let a=0;a<r;a++){let o=new i.Vector3(0,0,0),s=0;for(let e=a-5;e<a+6;e++)e>=0&&e<r&&(o.add(new i.Vector3(n[e*3],n[e*3+1],n[e*3+2])),s++);o.divideScalar(s).applyMatrix4(e.transform);let f=c.filter(o.x),p=l.filter(o.y),m=u.filter(o.z);t.push({position:new i.Vector3(f,p,m),location:d[a]})}return t}computeAABB2D(e){let t=1/0,n=-1/0,r=1/0,a=-1/0;for(let i of e)i.position.x<t&&(t=i.position.x),i.position.x>n&&(n=i.position.x),i.position.z<r&&(r=i.position.z),i.position.z>a&&(a=i.position.z);return{min:new i.Vector2(t,r),max:new i.Vector2(n,a)}}findClosestKeyframeToRay(e,t){let n=1/0,r=t[0].position.clone(),a=new i.Vector3;for(let i of t){e.closestPointToPoint(i.position,a);let t=a.distanceTo(i.position);t<n&&(n=t,r=i.position.clone())}return r}findRenderMesh(){let e=null;if(this.five.scene.traverse(t=>{if(e)return;let n=t,r=n.material;r&&r.isPBMGaussianSplattingMaterial&&(e=n)}),!e)throw Error(`未找到 GaussianSplatting 渲染网格`);return e}loadTrajectoryDataIfNeeded(e){return(0,n.__awaiter)(this,void 0,void 0,function*(){var t,n,i,a,o,s,c,l;if((t=e.content)!=null&&t.data)return;if(((n=e.content)==null?void 0:n.loadState)===`LOADING`){yield new Promise(t=>{let n=r.AnimationFrameLoop.shared.add(()=>{var r;let i=(r=e.content)==null?void 0:r.loadState;(i===`READY`||i===`FAILED`||i===`UNLOADED`)&&(n(),t())})});return}let u=(i=this.five.model.viewLayers)==null?void 0:i[0],d=u==null?void 0:u.fetcher,f=u==null?void 0:u.search,p=(a=e.content)==null?void 0:a.uri;if(!d||!p)return;let m=f?p.includes(`?`)?`${p}&${f.replace(/^\?/,``)}`:`${p}${f.startsWith(`?`)?f:`?${f}`}`:p;e.content.loadState=`LOADING`;try{let t=yield(0,r.loadPly)(m,{type:`geometry`,customPropertyMapping:{time:{itemType:`uint32`,itemNames:[`time_milisec`]}},fetcher:d}),n=t.scene,i=n.getAttribute(`position`),a=n.getAttribute(`time`),u=(o=i==null?void 0:i.array)==null?new Float32Array:o,f=(s=a==null?void 0:a.array)==null?new Uint32Array:s;e.content.data={uri:m,byteLength:(c=t.byteLength)==null?0:c,memoryUsage:(l=t.memoryUsage)==null?0:l,positionArray:u,timeArray:f,object:null},e.content.loadState=`READY`}catch(t){console.warn(`[GaussianSplattingEntranceAnimationPlugin] trajectory ply 加载失败,将使用 3DGS AABB 回退`,t),e.content.data=void 0,e.content.loadState=`FAILED`}})}computeGSSceneBounds(){let e=new i.Box3,t=new i.Box3;return this.five.scene.traverse(n=>{let r=n;(r==null?void 0:r.boundingBox)instanceof i.Box3&&!r.boundingBox.isEmpty()&&(t.copy(r.boundingBox),r.matrixWorld&&t.applyMatrix4(r.matrixWorld),e.union(t))}),e.isEmpty()?null:e}getCameraCurve(){return(0,n.__awaiter)(this,void 0,void 0,function*(){var e,t,n,r,a,o,s,c,l,u;let d=(r=(n=(t=(e=this.five.model.viewLayers)==null?void 0:e[0])==null?void 0:t.trajectories)==null?void 0:n[0])==null?(c=(s=(o=(a=this.five.model.viewLayers)==null?void 0:a[0])==null?void 0:o.scene)==null?void 0:s.trajectories)==null?void 0:c[0]:r,f=null,p=null;if(d&&(yield this.loadTrajectoryDataIfNeeded(d),(l=d.content)!=null&&l.data&&((u=d.content.data.positionArray)==null?void 0:u.length)>=6&&(f=this.extractKeyframes(d),f.length>=2?p=this.computeAABB2D(f):f=null)),!f||!p){let e=this.computeGSSceneBounds();if(!e)throw Error(`未找到可用于计算入场曲线的 3DGS 边界或轨迹`);p={min:new i.Vector2(e.min.x,e.min.z),max:new i.Vector2(e.max.x,e.max.z)};let t=(p.min.x+p.max.x)/2,n=(p.min.y+p.max.y)/2,r=(e.min.y+e.max.y)/2,a=Math.max(p.max.x-p.min.x,p.max.y-p.min.y)*.5;f=[];let o=0,s=null;for(let e=0;e<16;e++){let c=e/16*Math.PI*2,l=new i.Vector3(t+Math.cos(c)*a,r,n+Math.sin(c)*a);s&&(o+=l.distanceTo(s)),f.push({position:l,location:o}),s=l}}this.keyframes=f,this.boundingAABB=p;let m=this.curveHeight,h=new i.Vector3((p.min.x+p.max.x)/2,m,(p.min.y+p.max.y)/2),g=(p.max.x-p.min.x)/2,_=(p.max.y-p.min.y)/2,v=Math.sqrt(g*g+_*_),y=e=>{let t=new i.Vector3().subVectors(e,h);return t.length()<.001&&t.set(1,0,0),h.clone().add(t.normalize().multiplyScalar(v))},b=new i.Vector3(f[0].position.x,m,f[0].position.z),x=y(b),S=new i.Vector3().subVectors(h,b).normalize(),C=new i.Ray(b,S),w=new i.Vector3(-S.z,0,S.x).normalize(),T=new i.Ray(h,w),E=this.findClosestKeyframeToRay(T,f),D=y(new i.Vector3(E.x,m,E.z)),O=this.findClosestKeyframeToRay(C,f),k=y(new i.Vector3(O.x,m,O.z));return new i.CatmullRomCurve3([x,D,k],!1,`centripetal`,.5)})}setBounding(e,t,n){let r=this.findRenderMesh();r.material.aggregationBoundsMin.copy(e),r.material.aggregationBoundsMax.copy(t),this.boundsSet=!0}setBounds(){if(!this.boundingAABB)throw Error(`请先调用 getCameraCurve 计算轨迹边界`);let e=this.boundingAABB,t=this.findRenderMesh(),n=new i.Vector3(e.min.x,0,e.min.y),r=new i.Vector3(e.max.x,3,e.max.y);t.material.aggregationBoundsMin.copy(n),t.material.aggregationBoundsMax.copy(r),this.boundsSet=!0}normalizedPointDuration(){let e=this.pointDuration;return e<=0?.01:Math.min(e<=1?e:e/this.duration,1)}resetToPointCloud(){return(0,n.__awaiter)(this,void 0,void 0,function*(){this.boundingAABB||(yield this.getCameraCurve()),this.setBounds();let e=this.findRenderMesh().material;e.aggregationEnabled=!0,e.aggregationProgress=0,e.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0})}startAggregation(){if(!this.boundsSet)throw Error(`请先调用 setBounds 设置聚合边界`);let e=this.findRenderMesh().material;e.aggregationEnabled=!0,e.aggregationProgress=0,e.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let t=performance.now(),n=this.duration;this.cancelAnimation=r.AnimationFrameLoop.shared.add(()=>{let r=performance.now()-t,i=Math.min(r/n,1);e.aggregationProgress=i*i*(3-2*i),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0,i>=1&&(e.aggregationEnabled=!1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null))})}playEntrance(){return(0,n.__awaiter)(this,void 0,void 0,function*(){let e=yield this.getCameraCurve(),t=this.boundingAABB,n=new i.Vector3((t.min.x+t.max.x)/2,this.curveHeight,(t.min.y+t.max.y)/2),a=e.getPointAt(0),o=new r.Camera(90).copy(this.five.camera);o.position.copy(a),o.lookAt(n),o.computePose(0),this.five.setState(Object.assign({},o.pose)),this.setBounds();let s=this.findRenderMesh().material;s.aggregationEnabled=!0,s.aggregationProgress=0,s.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let c=this.duration,l=performance.now();return new Promise(t=>{this.cancelAnimation=r.AnimationFrameLoop.shared.add(()=>{let r=performance.now()-l,i=Math.min(r/c,1),a=i*i*(3-2*i);s.aggregationProgress=a,this.five.modelSceneNeedsRender=!0;let u=e.getPointAt(a);o.position.copy(u),o.lookAt(n),o.computePose(0),this.five.setState(Object.assign({},o.pose)),this.five.needsRender=!0,i>=1&&(s.aggregationEnabled=!1,s.aggregationProgress=1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null),t())})})})}};exports.Controller=o;
|
|
338
|
+
*/const e=require("../../_virtual/_rolldown/runtime.js"),t=require("../BasePlugin/index.js");let n=require("tslib"),r=require("@realsee/five-webgpu"),i=require("three/webgpu");i=e.__toESM(i,1);var a=class{constructor(e,t,n,r,i){this.R=e,this.Q=t,this.A=n,this.B=r,this.C=i,this.cov=NaN,this.x=NaN}filter(e,t=0){if(isNaN(this.x))this.x=1/this.C*e,this.cov=1/this.C*this.Q*(1/this.C);else{let n=this.A*this.x+this.B*t,r=this.A*this.cov*this.A+this.R,i=r*this.C*(1/(this.C*r*this.C+this.Q));this.x=n+i*(e-this.C*n),this.cov=r-i*this.C*r}return this.x}},o=class extends t.BasePlugin.Controller{updateState(e,t){let n=this.state;this.state=Object.assign(Object.assign({},this.state),e),this.hooks.emit(`stateChange`,{state:this.state,prevState:n,userAction:t})}constructor(e,t){var n,r,i;super(e),this.boundingAABB=null,this.cancelAnimation=null,this.boundsSet=!1,this.keyframes=[],this.five=e,this.state={enabled:!0,visible:!0},this.duration=(n=t==null?void 0:t.duration)==null?5e3:n,this.curveHeight=(r=t==null?void 0:t.curveHeight)==null?1.5:r,this.pointDuration=(i=t==null?void 0:t.pointDuration)==null?3e3:i}load(){return(0,n.__awaiter)(this,void 0,void 0,function*(){})}enable(e){var t;if(this.state.enabled)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n)}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n)}dispose(){this.disable(),this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null);try{let e=this.findRenderMesh();e&&(e.material.aggregationEnabled=!1,e.material.aggregationProgress=1)}catch(e){}}extractKeyframes(e){let t=[];if(!e.content.data)throw Error(`轨迹数据未加载`);let n=e.content.data.positionArray,r=n.length/3,o=.01,s=.1,c=new a(o,s,1,0,1),l=new a(o,s,1,0,1),u=new a(o,s,1,0,1),d=new Float32Array(r);for(let e=0;e<r;e++)if(e===0)d[e]=0;else{let t=new i.Vector3(n[(e-1)*3],n[(e-1)*3+1],n[(e-1)*3+2]);d[e]=new i.Vector3(n[e*3],n[e*3+1],n[e*3+2]).distanceTo(t)+d[e-1]}for(let a=0;a<r;a++){let o=new i.Vector3(0,0,0),s=0;for(let e=a-5;e<a+6;e++)e>=0&&e<r&&(o.add(new i.Vector3(n[e*3],n[e*3+1],n[e*3+2])),s++);o.divideScalar(s).applyMatrix4(e.transform);let f=c.filter(o.x),p=l.filter(o.y),m=u.filter(o.z);t.push({position:new i.Vector3(f,p,m),location:d[a]})}return t}computeAABB2D(e){let t=1/0,n=-1/0,r=1/0,a=-1/0;for(let i of e)i.position.x<t&&(t=i.position.x),i.position.x>n&&(n=i.position.x),i.position.z<r&&(r=i.position.z),i.position.z>a&&(a=i.position.z);return{min:new i.Vector2(t,r),max:new i.Vector2(n,a)}}findClosestKeyframeToRay(e,t){let n=1/0,r=t[0].position.clone(),a=new i.Vector3;for(let i of t){e.closestPointToPoint(i.position,a);let t=a.distanceTo(i.position);t<n&&(n=t,r=i.position.clone())}return r}isInitAnimationEnabled(){return this.five.modelScene.parameter.resolveValue(`enableGaussianSplattingInitAnimation`)===!0}findRenderMesh(){let e=null;if(this.five.scene.traverse(t=>{if(e)return;let n=t,r=n.material;r&&r.isPBMGaussianSplattingMaterial&&(e=n)}),!e)throw Error(`未找到 GaussianSplatting 渲染网格`);return e}loadTrajectoryDataIfNeeded(e){return(0,n.__awaiter)(this,void 0,void 0,function*(){var t,n,i,a,o,s,c,l;if((t=e.content)!=null&&t.data)return;if(((n=e.content)==null?void 0:n.loadState)===`LOADING`){yield new Promise(t=>{let n=r.AnimationFrameLoop.shared.add(()=>{var r;let i=(r=e.content)==null?void 0:r.loadState;(i===`READY`||i===`FAILED`||i===`UNLOADED`)&&(n(),t())})});return}let u=(i=this.five.model.viewLayers)==null?void 0:i[0],d=u==null?void 0:u.fetcher,f=u==null?void 0:u.search,p=(a=e.content)==null?void 0:a.uri;if(!d||!p)return;let m=f?p.includes(`?`)?`${p}&${f.replace(/^\?/,``)}`:`${p}${f.startsWith(`?`)?f:`?${f}`}`:p;e.content.loadState=`LOADING`;try{let t=yield(0,r.loadPly)(m,{type:`geometry`,customPropertyMapping:{time:{itemType:`uint32`,itemNames:[`time_milisec`]}},fetcher:d}),n=t.scene,i=n.getAttribute(`position`),a=n.getAttribute(`time`),u=(o=i==null?void 0:i.array)==null?new Float32Array:o,f=(s=a==null?void 0:a.array)==null?new Uint32Array:s;e.content.data={uri:m,byteLength:(c=t.byteLength)==null?0:c,memoryUsage:(l=t.memoryUsage)==null?0:l,positionArray:u,timeArray:f,object:null},e.content.loadState=`READY`}catch(t){console.warn(`[GaussianSplattingEntranceAnimationPlugin] trajectory ply 加载失败,将使用 3DGS AABB 回退`,t),e.content.data=void 0,e.content.loadState=`FAILED`}})}computeGSSceneBounds(){let e=new i.Box3,t=new i.Box3;return this.five.scene.traverse(n=>{let r=n;(r==null?void 0:r.boundingBox)instanceof i.Box3&&!r.boundingBox.isEmpty()&&(t.copy(r.boundingBox),r.matrixWorld&&t.applyMatrix4(r.matrixWorld),e.union(t))}),e.isEmpty()?null:e}getCameraCurve(){return(0,n.__awaiter)(this,void 0,void 0,function*(){var e,t,n,r,a,o,s,c,l,u;let d=(r=(n=(t=(e=this.five.model.viewLayers)==null?void 0:e[0])==null?void 0:t.trajectories)==null?void 0:n[0])==null?(c=(s=(o=(a=this.five.model.viewLayers)==null?void 0:a[0])==null?void 0:o.scene)==null?void 0:s.trajectories)==null?void 0:c[0]:r,f=null,p=null;if(d&&(yield this.loadTrajectoryDataIfNeeded(d),(l=d.content)!=null&&l.data&&((u=d.content.data.positionArray)==null?void 0:u.length)>=6&&(f=this.extractKeyframes(d),f.length>=2?p=this.computeAABB2D(f):f=null)),!f||!p){let e=this.computeGSSceneBounds();if(!e)throw Error(`未找到可用于计算入场曲线的 3DGS 边界或轨迹`);p={min:new i.Vector2(e.min.x,e.min.z),max:new i.Vector2(e.max.x,e.max.z)};let t=(p.min.x+p.max.x)/2,n=(p.min.y+p.max.y)/2,r=(e.min.y+e.max.y)/2,a=Math.max(p.max.x-p.min.x,p.max.y-p.min.y)*.5;f=[];let o=0,s=null;for(let e=0;e<16;e++){let c=e/16*Math.PI*2,l=new i.Vector3(t+Math.cos(c)*a,r,n+Math.sin(c)*a);s&&(o+=l.distanceTo(s)),f.push({position:l,location:o}),s=l}}this.keyframes=f,this.boundingAABB=p;let m=this.curveHeight,h=new i.Vector3((p.min.x+p.max.x)/2,m,(p.min.y+p.max.y)/2),g=(p.max.x-p.min.x)/2,_=(p.max.y-p.min.y)/2,v=Math.sqrt(g*g+_*_),y=e=>{let t=new i.Vector3().subVectors(e,h);return t.length()<.001&&t.set(1,0,0),h.clone().add(t.normalize().multiplyScalar(v))},b=new i.Vector3(f[0].position.x,m,f[0].position.z),x=y(b),S=new i.Vector3().subVectors(h,b).normalize(),C=new i.Ray(b,S),w=new i.Vector3(-S.z,0,S.x).normalize(),T=new i.Ray(h,w),E=this.findClosestKeyframeToRay(T,f),D=y(new i.Vector3(E.x,m,E.z)),O=this.findClosestKeyframeToRay(C,f),k=y(new i.Vector3(O.x,m,O.z));return new i.CatmullRomCurve3([x,D,k],!1,`centripetal`,.5)})}setBounding(e,t,n){let r=this.findRenderMesh();r.material.aggregationBoundsMin.copy(e),r.material.aggregationBoundsMax.copy(t),this.boundsSet=!0}setBounds(){if(!this.boundingAABB)throw Error(`请先调用 getCameraCurve 计算轨迹边界`);let e=this.boundingAABB,t=this.findRenderMesh(),n=new i.Vector3(e.min.x,0,e.min.y),r=new i.Vector3(e.max.x,3,e.max.y);t.material.aggregationBoundsMin.copy(n),t.material.aggregationBoundsMax.copy(r),this.boundsSet=!0}normalizedPointDuration(){let e=this.pointDuration;return e<=0?.01:Math.min(e<=1?e:e/this.duration,1)}resetToPointCloud(){return(0,n.__awaiter)(this,void 0,void 0,function*(){if(!this.isInitAnimationEnabled())return;this.boundingAABB||(yield this.getCameraCurve()),this.setBounds();let e=this.findRenderMesh().material;e.aggregationEnabled=!0,e.aggregationProgress=0,e.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0})}startAggregation(){if(!this.isInitAnimationEnabled()){console.warn(`[GaussianSplattingEntranceAnimationPlugin] modelScene.enableGaussianSplattingInitAnimation 为 false,已跳过聚合动画`);return}if(!this.boundsSet)throw Error(`请先调用 setBounds 设置聚合边界`);let e=this.findRenderMesh().material;e.aggregationEnabled=!0,e.aggregationProgress=0,e.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let t=performance.now(),n=this.duration;this.cancelAnimation=r.AnimationFrameLoop.shared.add(()=>{let r=performance.now()-t,i=Math.min(r/n,1);e.aggregationProgress=i*i*(3-2*i),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0,i>=1&&(e.aggregationEnabled=!1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null))})}playEntrance(){return(0,n.__awaiter)(this,void 0,void 0,function*(){if(!this.isInitAnimationEnabled()){console.warn(`[GaussianSplattingEntranceAnimationPlugin] modelScene.enableGaussianSplattingInitAnimation 为 false,已跳过入场动画`);return}let e=yield this.getCameraCurve(),t=this.boundingAABB,n=new i.Vector3((t.min.x+t.max.x)/2,this.curveHeight,(t.min.y+t.max.y)/2),a=e.getPointAt(0),o=new r.Camera(90).copy(this.five.camera);o.position.copy(a),o.lookAt(n),o.computePose(0),this.five.setState(Object.assign({},o.pose)),this.setBounds();let s=this.findRenderMesh().material;s.aggregationEnabled=!0,s.aggregationProgress=0,s.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let c=this.duration,l=performance.now();return new Promise(t=>{this.cancelAnimation=r.AnimationFrameLoop.shared.add(()=>{let r=performance.now()-l,i=Math.min(r/c,1),a=i*i*(3-2*i);s.aggregationProgress=a,this.five.modelSceneNeedsRender=!0;let u=e.getPointAt(a);o.position.copy(u),o.lookAt(n),o.computePose(0),this.five.setState(Object.assign({},o.pose)),this.five.needsRender=!0,i>=1&&(s.aggregationEnabled=!1,s.aggregationProgress=1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null),t())})})})}};exports.Controller=o;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five-webgpu
|
|
4
|
-
* Generated: 2026/10/
|
|
5
|
-
* Version: 1.0.0-alpha.
|
|
4
|
+
* Generated: 2026/10/30
|
|
5
|
+
* Version: 1.0.0-alpha.13
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +335,4 @@
|
|
|
335
335
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
336
336
|
* Agreement and all related documents shall be drafted in English.
|
|
337
337
|
|
|
338
|
-
*/import{BasePlugin as e}from"../BasePlugin/index.mjs";import{__awaiter as t}from"tslib";import{AnimationFrameLoop as n,Camera as r,loadPly as i}from"@realsee/five-webgpu";import*as a from"three/webgpu";var o=class{constructor(e,t,n,r,i){this.R=e,this.Q=t,this.A=n,this.B=r,this.C=i,this.cov=NaN,this.x=NaN}filter(e,t=0){if(isNaN(this.x))this.x=1/this.C*e,this.cov=1/this.C*this.Q*(1/this.C);else{let n=this.A*this.x+this.B*t,r=this.A*this.cov*this.A+this.R,i=r*this.C*(1/(this.C*r*this.C+this.Q));this.x=n+i*(e-this.C*n),this.cov=r-i*this.C*r}return this.x}},s=class extends e.Controller{updateState(e,t){let n=this.state;this.state=Object.assign(Object.assign({},this.state),e),this.hooks.emit(`stateChange`,{state:this.state,prevState:n,userAction:t})}constructor(e,t){var n,r,i;super(e),this.boundingAABB=null,this.cancelAnimation=null,this.boundsSet=!1,this.keyframes=[],this.five=e,this.state={enabled:!0,visible:!0},this.duration=(n=t==null?void 0:t.duration)==null?5e3:n,this.curveHeight=(r=t==null?void 0:t.curveHeight)==null?1.5:r,this.pointDuration=(i=t==null?void 0:t.pointDuration)==null?3e3:i}load(){return t(this,void 0,void 0,function*(){})}enable(e){var t;if(this.state.enabled)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n)}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n)}dispose(){this.disable(),this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null);try{let e=this.findRenderMesh();e&&(e.material.aggregationEnabled=!1,e.material.aggregationProgress=1)}catch(e){}}extractKeyframes(e){let t=[];if(!e.content.data)throw Error(`轨迹数据未加载`);let n=e.content.data.positionArray,r=n.length/3,i=.01,s=.1,c=new o(i,s,1,0,1),l=new o(i,s,1,0,1),u=new o(i,s,1,0,1),d=new Float32Array(r);for(let e=0;e<r;e++)if(e===0)d[e]=0;else{let t=new a.Vector3(n[(e-1)*3],n[(e-1)*3+1],n[(e-1)*3+2]);d[e]=new a.Vector3(n[e*3],n[e*3+1],n[e*3+2]).distanceTo(t)+d[e-1]}for(let i=0;i<r;i++){let o=new a.Vector3(0,0,0),s=0;for(let e=i-5;e<i+6;e++)e>=0&&e<r&&(o.add(new a.Vector3(n[e*3],n[e*3+1],n[e*3+2])),s++);o.divideScalar(s).applyMatrix4(e.transform);let f=c.filter(o.x),p=l.filter(o.y),m=u.filter(o.z);t.push({position:new a.Vector3(f,p,m),location:d[i]})}return t}computeAABB2D(e){let t=1/0,n=-1/0,r=1/0,i=-1/0;for(let a of e)a.position.x<t&&(t=a.position.x),a.position.x>n&&(n=a.position.x),a.position.z<r&&(r=a.position.z),a.position.z>i&&(i=a.position.z);return{min:new a.Vector2(t,r),max:new a.Vector2(n,i)}}findClosestKeyframeToRay(e,t){let n=1/0,r=t[0].position.clone(),i=new a.Vector3;for(let a of t){e.closestPointToPoint(a.position,i);let t=i.distanceTo(a.position);t<n&&(n=t,r=a.position.clone())}return r}findRenderMesh(){let e=null;if(this.five.scene.traverse(t=>{if(e)return;let n=t,r=n.material;r&&r.isPBMGaussianSplattingMaterial&&(e=n)}),!e)throw Error(`未找到 GaussianSplatting 渲染网格`);return e}loadTrajectoryDataIfNeeded(e){return t(this,void 0,void 0,function*(){var t,r,a,o,s,c,l,u;if((t=e.content)!=null&&t.data)return;if(((r=e.content)==null?void 0:r.loadState)===`LOADING`){yield new Promise(t=>{let r=n.shared.add(()=>{var n;let i=(n=e.content)==null?void 0:n.loadState;(i===`READY`||i===`FAILED`||i===`UNLOADED`)&&(r(),t())})});return}let d=(a=this.five.model.viewLayers)==null?void 0:a[0],f=d==null?void 0:d.fetcher,p=d==null?void 0:d.search,m=(o=e.content)==null?void 0:o.uri;if(!f||!m)return;let h=p?m.includes(`?`)?`${m}&${p.replace(/^\?/,``)}`:`${m}${p.startsWith(`?`)?p:`?${p}`}`:m;e.content.loadState=`LOADING`;try{let t=yield i(h,{type:`geometry`,customPropertyMapping:{time:{itemType:`uint32`,itemNames:[`time_milisec`]}},fetcher:f}),n=t.scene,r=n.getAttribute(`position`),a=n.getAttribute(`time`),o=(s=r==null?void 0:r.array)==null?new Float32Array:s,d=(c=a==null?void 0:a.array)==null?new Uint32Array:c;e.content.data={uri:h,byteLength:(l=t.byteLength)==null?0:l,memoryUsage:(u=t.memoryUsage)==null?0:u,positionArray:o,timeArray:d,object:null},e.content.loadState=`READY`}catch(t){console.warn(`[GaussianSplattingEntranceAnimationPlugin] trajectory ply 加载失败,将使用 3DGS AABB 回退`,t),e.content.data=void 0,e.content.loadState=`FAILED`}})}computeGSSceneBounds(){let e=new a.Box3,t=new a.Box3;return this.five.scene.traverse(n=>{let r=n;(r==null?void 0:r.boundingBox)instanceof a.Box3&&!r.boundingBox.isEmpty()&&(t.copy(r.boundingBox),r.matrixWorld&&t.applyMatrix4(r.matrixWorld),e.union(t))}),e.isEmpty()?null:e}getCameraCurve(){return t(this,void 0,void 0,function*(){var e,t,n,r,i,o,s,c,l,u;let d=(r=(n=(t=(e=this.five.model.viewLayers)==null?void 0:e[0])==null?void 0:t.trajectories)==null?void 0:n[0])==null?(c=(s=(o=(i=this.five.model.viewLayers)==null?void 0:i[0])==null?void 0:o.scene)==null?void 0:s.trajectories)==null?void 0:c[0]:r,f=null,p=null;if(d&&(yield this.loadTrajectoryDataIfNeeded(d),(l=d.content)!=null&&l.data&&((u=d.content.data.positionArray)==null?void 0:u.length)>=6&&(f=this.extractKeyframes(d),f.length>=2?p=this.computeAABB2D(f):f=null)),!f||!p){let e=this.computeGSSceneBounds();if(!e)throw Error(`未找到可用于计算入场曲线的 3DGS 边界或轨迹`);p={min:new a.Vector2(e.min.x,e.min.z),max:new a.Vector2(e.max.x,e.max.z)};let t=(p.min.x+p.max.x)/2,n=(p.min.y+p.max.y)/2,r=(e.min.y+e.max.y)/2,i=Math.max(p.max.x-p.min.x,p.max.y-p.min.y)*.5;f=[];let o=0,s=null;for(let e=0;e<16;e++){let c=e/16*Math.PI*2,l=new a.Vector3(t+Math.cos(c)*i,r,n+Math.sin(c)*i);s&&(o+=l.distanceTo(s)),f.push({position:l,location:o}),s=l}}this.keyframes=f,this.boundingAABB=p;let m=this.curveHeight,h=new a.Vector3((p.min.x+p.max.x)/2,m,(p.min.y+p.max.y)/2),g=(p.max.x-p.min.x)/2,_=(p.max.y-p.min.y)/2,v=Math.sqrt(g*g+_*_),y=e=>{let t=new a.Vector3().subVectors(e,h);return t.length()<.001&&t.set(1,0,0),h.clone().add(t.normalize().multiplyScalar(v))},b=new a.Vector3(f[0].position.x,m,f[0].position.z),x=y(b),S=new a.Vector3().subVectors(h,b).normalize(),C=new a.Ray(b,S),w=new a.Vector3(-S.z,0,S.x).normalize(),T=new a.Ray(h,w),E=this.findClosestKeyframeToRay(T,f),D=y(new a.Vector3(E.x,m,E.z)),O=this.findClosestKeyframeToRay(C,f),k=y(new a.Vector3(O.x,m,O.z));return new a.CatmullRomCurve3([x,D,k],!1,`centripetal`,.5)})}setBounding(e,t,n){let r=this.findRenderMesh();r.material.aggregationBoundsMin.copy(e),r.material.aggregationBoundsMax.copy(t),this.boundsSet=!0}setBounds(){if(!this.boundingAABB)throw Error(`请先调用 getCameraCurve 计算轨迹边界`);let e=this.boundingAABB,t=this.findRenderMesh(),n=new a.Vector3(e.min.x,0,e.min.y),r=new a.Vector3(e.max.x,3,e.max.y);t.material.aggregationBoundsMin.copy(n),t.material.aggregationBoundsMax.copy(r),this.boundsSet=!0}normalizedPointDuration(){let e=this.pointDuration;return e<=0?.01:Math.min(e<=1?e:e/this.duration,1)}resetToPointCloud(){return t(this,void 0,void 0,function*(){this.boundingAABB||(yield this.getCameraCurve()),this.setBounds();let e=this.findRenderMesh().material;e.aggregationEnabled=!0,e.aggregationProgress=0,e.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0})}startAggregation(){if(!this.boundsSet)throw Error(`请先调用 setBounds 设置聚合边界`);let e=this.findRenderMesh().material;e.aggregationEnabled=!0,e.aggregationProgress=0,e.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let t=performance.now(),r=this.duration;this.cancelAnimation=n.shared.add(()=>{let n=performance.now()-t,i=Math.min(n/r,1);e.aggregationProgress=i*i*(3-2*i),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0,i>=1&&(e.aggregationEnabled=!1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null))})}playEntrance(){return t(this,void 0,void 0,function*(){let e=yield this.getCameraCurve(),t=this.boundingAABB,i=new a.Vector3((t.min.x+t.max.x)/2,this.curveHeight,(t.min.y+t.max.y)/2),o=e.getPointAt(0),s=new r(90).copy(this.five.camera);s.position.copy(o),s.lookAt(i),s.computePose(0),this.five.setState(Object.assign({},s.pose)),this.setBounds();let c=this.findRenderMesh().material;c.aggregationEnabled=!0,c.aggregationProgress=0,c.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let l=this.duration,u=performance.now();return new Promise(t=>{this.cancelAnimation=n.shared.add(()=>{let n=performance.now()-u,r=Math.min(n/l,1),a=r*r*(3-2*r);c.aggregationProgress=a,this.five.modelSceneNeedsRender=!0;let o=e.getPointAt(a);s.position.copy(o),s.lookAt(i),s.computePose(0),this.five.setState(Object.assign({},s.pose)),this.five.needsRender=!0,r>=1&&(c.aggregationEnabled=!1,c.aggregationProgress=1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null),t())})})})}};export{s as Controller};
|
|
338
|
+
*/import{BasePlugin as e}from"../BasePlugin/index.mjs";import{__awaiter as t}from"tslib";import{AnimationFrameLoop as n,Camera as r,loadPly as i}from"@realsee/five-webgpu";import*as a from"three/webgpu";var o=class{constructor(e,t,n,r,i){this.R=e,this.Q=t,this.A=n,this.B=r,this.C=i,this.cov=NaN,this.x=NaN}filter(e,t=0){if(isNaN(this.x))this.x=1/this.C*e,this.cov=1/this.C*this.Q*(1/this.C);else{let n=this.A*this.x+this.B*t,r=this.A*this.cov*this.A+this.R,i=r*this.C*(1/(this.C*r*this.C+this.Q));this.x=n+i*(e-this.C*n),this.cov=r-i*this.C*r}return this.x}},s=class extends e.Controller{updateState(e,t){let n=this.state;this.state=Object.assign(Object.assign({},this.state),e),this.hooks.emit(`stateChange`,{state:this.state,prevState:n,userAction:t})}constructor(e,t){var n,r,i;super(e),this.boundingAABB=null,this.cancelAnimation=null,this.boundsSet=!1,this.keyframes=[],this.five=e,this.state={enabled:!0,visible:!0},this.duration=(n=t==null?void 0:t.duration)==null?5e3:n,this.curveHeight=(r=t==null?void 0:t.curveHeight)==null?1.5:r,this.pointDuration=(i=t==null?void 0:t.pointDuration)==null?3e3:i}load(){return t(this,void 0,void 0,function*(){})}enable(e){var t;if(this.state.enabled)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!0},n)}disable(e){var t;if(this.state.enabled===!1)return;let n=(t=e==null?void 0:e.userAction)==null?!0:t;this.updateState({enabled:!1},n)}dispose(){this.disable(),this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null);try{let e=this.findRenderMesh();e&&(e.material.aggregationEnabled=!1,e.material.aggregationProgress=1)}catch(e){}}extractKeyframes(e){let t=[];if(!e.content.data)throw Error(`轨迹数据未加载`);let n=e.content.data.positionArray,r=n.length/3,i=.01,s=.1,c=new o(i,s,1,0,1),l=new o(i,s,1,0,1),u=new o(i,s,1,0,1),d=new Float32Array(r);for(let e=0;e<r;e++)if(e===0)d[e]=0;else{let t=new a.Vector3(n[(e-1)*3],n[(e-1)*3+1],n[(e-1)*3+2]);d[e]=new a.Vector3(n[e*3],n[e*3+1],n[e*3+2]).distanceTo(t)+d[e-1]}for(let i=0;i<r;i++){let o=new a.Vector3(0,0,0),s=0;for(let e=i-5;e<i+6;e++)e>=0&&e<r&&(o.add(new a.Vector3(n[e*3],n[e*3+1],n[e*3+2])),s++);o.divideScalar(s).applyMatrix4(e.transform);let f=c.filter(o.x),p=l.filter(o.y),m=u.filter(o.z);t.push({position:new a.Vector3(f,p,m),location:d[i]})}return t}computeAABB2D(e){let t=1/0,n=-1/0,r=1/0,i=-1/0;for(let a of e)a.position.x<t&&(t=a.position.x),a.position.x>n&&(n=a.position.x),a.position.z<r&&(r=a.position.z),a.position.z>i&&(i=a.position.z);return{min:new a.Vector2(t,r),max:new a.Vector2(n,i)}}findClosestKeyframeToRay(e,t){let n=1/0,r=t[0].position.clone(),i=new a.Vector3;for(let a of t){e.closestPointToPoint(a.position,i);let t=i.distanceTo(a.position);t<n&&(n=t,r=a.position.clone())}return r}isInitAnimationEnabled(){return this.five.modelScene.parameter.resolveValue(`enableGaussianSplattingInitAnimation`)===!0}findRenderMesh(){let e=null;if(this.five.scene.traverse(t=>{if(e)return;let n=t,r=n.material;r&&r.isPBMGaussianSplattingMaterial&&(e=n)}),!e)throw Error(`未找到 GaussianSplatting 渲染网格`);return e}loadTrajectoryDataIfNeeded(e){return t(this,void 0,void 0,function*(){var t,r,a,o,s,c,l,u;if((t=e.content)!=null&&t.data)return;if(((r=e.content)==null?void 0:r.loadState)===`LOADING`){yield new Promise(t=>{let r=n.shared.add(()=>{var n;let i=(n=e.content)==null?void 0:n.loadState;(i===`READY`||i===`FAILED`||i===`UNLOADED`)&&(r(),t())})});return}let d=(a=this.five.model.viewLayers)==null?void 0:a[0],f=d==null?void 0:d.fetcher,p=d==null?void 0:d.search,m=(o=e.content)==null?void 0:o.uri;if(!f||!m)return;let h=p?m.includes(`?`)?`${m}&${p.replace(/^\?/,``)}`:`${m}${p.startsWith(`?`)?p:`?${p}`}`:m;e.content.loadState=`LOADING`;try{let t=yield i(h,{type:`geometry`,customPropertyMapping:{time:{itemType:`uint32`,itemNames:[`time_milisec`]}},fetcher:f}),n=t.scene,r=n.getAttribute(`position`),a=n.getAttribute(`time`),o=(s=r==null?void 0:r.array)==null?new Float32Array:s,d=(c=a==null?void 0:a.array)==null?new Uint32Array:c;e.content.data={uri:h,byteLength:(l=t.byteLength)==null?0:l,memoryUsage:(u=t.memoryUsage)==null?0:u,positionArray:o,timeArray:d,object:null},e.content.loadState=`READY`}catch(t){console.warn(`[GaussianSplattingEntranceAnimationPlugin] trajectory ply 加载失败,将使用 3DGS AABB 回退`,t),e.content.data=void 0,e.content.loadState=`FAILED`}})}computeGSSceneBounds(){let e=new a.Box3,t=new a.Box3;return this.five.scene.traverse(n=>{let r=n;(r==null?void 0:r.boundingBox)instanceof a.Box3&&!r.boundingBox.isEmpty()&&(t.copy(r.boundingBox),r.matrixWorld&&t.applyMatrix4(r.matrixWorld),e.union(t))}),e.isEmpty()?null:e}getCameraCurve(){return t(this,void 0,void 0,function*(){var e,t,n,r,i,o,s,c,l,u;let d=(r=(n=(t=(e=this.five.model.viewLayers)==null?void 0:e[0])==null?void 0:t.trajectories)==null?void 0:n[0])==null?(c=(s=(o=(i=this.five.model.viewLayers)==null?void 0:i[0])==null?void 0:o.scene)==null?void 0:s.trajectories)==null?void 0:c[0]:r,f=null,p=null;if(d&&(yield this.loadTrajectoryDataIfNeeded(d),(l=d.content)!=null&&l.data&&((u=d.content.data.positionArray)==null?void 0:u.length)>=6&&(f=this.extractKeyframes(d),f.length>=2?p=this.computeAABB2D(f):f=null)),!f||!p){let e=this.computeGSSceneBounds();if(!e)throw Error(`未找到可用于计算入场曲线的 3DGS 边界或轨迹`);p={min:new a.Vector2(e.min.x,e.min.z),max:new a.Vector2(e.max.x,e.max.z)};let t=(p.min.x+p.max.x)/2,n=(p.min.y+p.max.y)/2,r=(e.min.y+e.max.y)/2,i=Math.max(p.max.x-p.min.x,p.max.y-p.min.y)*.5;f=[];let o=0,s=null;for(let e=0;e<16;e++){let c=e/16*Math.PI*2,l=new a.Vector3(t+Math.cos(c)*i,r,n+Math.sin(c)*i);s&&(o+=l.distanceTo(s)),f.push({position:l,location:o}),s=l}}this.keyframes=f,this.boundingAABB=p;let m=this.curveHeight,h=new a.Vector3((p.min.x+p.max.x)/2,m,(p.min.y+p.max.y)/2),g=(p.max.x-p.min.x)/2,_=(p.max.y-p.min.y)/2,v=Math.sqrt(g*g+_*_),y=e=>{let t=new a.Vector3().subVectors(e,h);return t.length()<.001&&t.set(1,0,0),h.clone().add(t.normalize().multiplyScalar(v))},b=new a.Vector3(f[0].position.x,m,f[0].position.z),x=y(b),S=new a.Vector3().subVectors(h,b).normalize(),C=new a.Ray(b,S),w=new a.Vector3(-S.z,0,S.x).normalize(),T=new a.Ray(h,w),E=this.findClosestKeyframeToRay(T,f),D=y(new a.Vector3(E.x,m,E.z)),O=this.findClosestKeyframeToRay(C,f),k=y(new a.Vector3(O.x,m,O.z));return new a.CatmullRomCurve3([x,D,k],!1,`centripetal`,.5)})}setBounding(e,t,n){let r=this.findRenderMesh();r.material.aggregationBoundsMin.copy(e),r.material.aggregationBoundsMax.copy(t),this.boundsSet=!0}setBounds(){if(!this.boundingAABB)throw Error(`请先调用 getCameraCurve 计算轨迹边界`);let e=this.boundingAABB,t=this.findRenderMesh(),n=new a.Vector3(e.min.x,0,e.min.y),r=new a.Vector3(e.max.x,3,e.max.y);t.material.aggregationBoundsMin.copy(n),t.material.aggregationBoundsMax.copy(r),this.boundsSet=!0}normalizedPointDuration(){let e=this.pointDuration;return e<=0?.01:Math.min(e<=1?e:e/this.duration,1)}resetToPointCloud(){return t(this,void 0,void 0,function*(){if(!this.isInitAnimationEnabled())return;this.boundingAABB||(yield this.getCameraCurve()),this.setBounds();let e=this.findRenderMesh().material;e.aggregationEnabled=!0,e.aggregationProgress=0,e.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0})}startAggregation(){if(!this.isInitAnimationEnabled()){console.warn(`[GaussianSplattingEntranceAnimationPlugin] modelScene.enableGaussianSplattingInitAnimation 为 false,已跳过聚合动画`);return}if(!this.boundsSet)throw Error(`请先调用 setBounds 设置聚合边界`);let e=this.findRenderMesh().material;e.aggregationEnabled=!0,e.aggregationProgress=0,e.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let t=performance.now(),r=this.duration;this.cancelAnimation=n.shared.add(()=>{let n=performance.now()-t,i=Math.min(n/r,1);e.aggregationProgress=i*i*(3-2*i),this.five.needsRender=!0,this.five.modelSceneNeedsRender=!0,i>=1&&(e.aggregationEnabled=!1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null))})}playEntrance(){return t(this,void 0,void 0,function*(){if(!this.isInitAnimationEnabled()){console.warn(`[GaussianSplattingEntranceAnimationPlugin] modelScene.enableGaussianSplattingInitAnimation 为 false,已跳过入场动画`);return}let e=yield this.getCameraCurve(),t=this.boundingAABB,i=new a.Vector3((t.min.x+t.max.x)/2,this.curveHeight,(t.min.y+t.max.y)/2),o=e.getPointAt(0),s=new r(90).copy(this.five.camera);s.position.copy(o),s.lookAt(i),s.computePose(0),this.five.setState(Object.assign({},s.pose)),this.setBounds();let c=this.findRenderMesh().material;c.aggregationEnabled=!0,c.aggregationProgress=0,c.aggregationPointDuration=this.normalizedPointDuration(),this.five.needsRender=!0;let l=this.duration,u=performance.now();return new Promise(t=>{this.cancelAnimation=n.shared.add(()=>{let n=performance.now()-u,r=Math.min(n/l,1),a=r*r*(3-2*r);c.aggregationProgress=a,this.five.modelSceneNeedsRender=!0;let o=e.getPointAt(a);s.position.copy(o),s.lookAt(i),s.computePose(0),this.five.setState(Object.assign({},s.pose)),this.five.needsRender=!0,r>=1&&(c.aggregationEnabled=!1,c.aggregationProgress=1,this.cancelAnimation&&(this.cancelAnimation(),this.cancelAnimation=null),t())})})})}};export{s as Controller};
|