@realsee/five-webgpu 1.0.0-alpha.1
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/AGENTS_READ_ME.md +9 -0
- package/AI_CONTEXT.md +9 -0
- package/README.md +80 -0
- package/TERMS.txt +54 -0
- package/ai_guides/README.md +118 -0
- package/ai_guides/ai-doc-guidelines.md +102 -0
- package/ai_guides/api.md +274 -0
- package/ai_guides/features/3dtile.md +172 -0
- package/ai_guides/features/camera-animation.md +205 -0
- package/ai_guides/features/clipper.md +135 -0
- package/ai_guides/features/coordinate-system.md +128 -0
- package/ai_guides/features/event.md +154 -0
- package/ai_guides/features/five.md +184 -0
- package/ai_guides/features/gesture.md +181 -0
- package/ai_guides/features/get-screen-pixels.md +182 -0
- package/ai_guides/features/image-options.md +164 -0
- package/ai_guides/features/load-external-model.md +350 -0
- package/ai_guides/features/load-progress.md +140 -0
- package/ai_guides/features/material.md +153 -0
- package/ai_guides/features/mode.md +269 -0
- package/ai_guides/features/model.md +186 -0
- package/ai_guides/features/move-pano-effect.md +145 -0
- package/ai_guides/features/multi-work.md +146 -0
- package/ai_guides/features/pano-filter.md +144 -0
- package/ai_guides/features/pano-tile.md +132 -0
- package/ai_guides/features/pano-uv.md +131 -0
- package/ai_guides/features/parameter.md +153 -0
- package/ai_guides/features/raycast.md +175 -0
- package/ai_guides/features/request-proxy.md +112 -0
- package/ai_guides/features/screen-project.md +165 -0
- package/ai_guides/features/state.md +101 -0
- package/ai_guides/features/ultra-hdr.md +204 -0
- package/ai_guides/features/view-layer.md +187 -0
- package/ai_guides/features/work.md +303 -0
- package/ai_guides/glossary.md +93 -0
- package/ai_guides/intro.md +23 -0
- package/ai_guides/quick-start.md +69 -0
- package/ai_guides/release_notes/6.6.md +86 -0
- package/ai_guides/release_notes/6.7.md +401 -0
- package/ai_guides/release_notes/6.8.md +208 -0
- package/ai_guides/support.md +23 -0
- package/ai_guides/template.md +70 -0
- package/docs/.nojekyll +1 -0
- package/docs/00_FOR_AI_AGENTS.md +12 -0
- package/docs/README.md +12 -0
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +134 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1633 -0
- package/docs/classes/index.AdaptiveLuminancePass.html +23 -0
- package/docs/classes/index.AnimationFrameLoop.html +18 -0
- package/docs/classes/index.BoundingMesh.html +4 -0
- package/docs/classes/index.Camera.html +42 -0
- package/docs/classes/index.EffectComposer.html +25 -0
- package/docs/classes/index.EyeDomeLightingPass.html +20 -0
- package/docs/classes/index.Fetcher.html +5 -0
- package/docs/classes/index.Five.html +311 -0
- package/docs/classes/index.FivePass.html +17 -0
- package/docs/classes/index.FiveRenderer.html +8 -0
- package/docs/classes/index.FlowingFireworks3DPass.html +22 -0
- package/docs/classes/index.FlowingLight2DPass.html +21 -0
- package/docs/classes/index.FlowingLight3DPass.html +23 -0
- package/docs/classes/index.FullScreenQuad.html +7 -0
- package/docs/classes/index.GaussianBlurPass.html +19 -0
- package/docs/classes/index.Histogram.html +19 -0
- package/docs/classes/index.InternalWebGPURenderer.html +4 -0
- package/docs/classes/index.Model.html +93 -0
- package/docs/classes/index.ModelScene.html +40 -0
- package/docs/classes/index.Motion.html +17 -0
- package/docs/classes/index.NetworkSubscribe.html +41 -0
- package/docs/classes/index.PBMGaussianSplattingNodeMaterial.html +37 -0
- package/docs/classes/index.PBMGaussianSplattingObject.html +32 -0
- package/docs/classes/index.PBMGaussianSplattingRenderMesh.html +19 -0
- package/docs/classes/index.PBMGroup.html +5 -0
- package/docs/classes/index.PBMMesh.html +2 -0
- package/docs/classes/index.PBMMeshBasicMaterial.html +70 -0
- package/docs/classes/index.PBMMeshBasicNodeMaterial.html +74 -0
- package/docs/classes/index.PBMMeshPanoOnlyMaterial.html +70 -0
- package/docs/classes/index.PBMMeshPanoOnlyNodeMaterial.html +74 -0
- package/docs/classes/index.PBMMeshPhongMaterial.html +69 -0
- package/docs/classes/index.PBMMeshPhongNodeMaterial.html +73 -0
- package/docs/classes/index.PBMMeshPhysicalMaterial.html +69 -0
- package/docs/classes/index.PBMMeshPhysicalNodeMaterial.html +73 -0
- package/docs/classes/index.PBMPanoFilter.html +61 -0
- package/docs/classes/index.PBMPointCloud.html +50 -0
- package/docs/classes/index.PBMSkinnedMesh.html +8 -0
- package/docs/classes/index.PBMUpdateable.html +41 -0
- package/docs/classes/index.PanoCircleMesh.html +30 -0
- package/docs/classes/index.PanoCircleMeshCustom.html +30 -0
- package/docs/classes/index.PanoCircleMeshSolid.html +30 -0
- package/docs/classes/index.Parameter.html +114 -0
- package/docs/classes/index.Scene.html +18 -0
- package/docs/classes/index.Subscribe.html +43 -0
- package/docs/classes/index.TextureLoader.html +4 -0
- package/docs/classes/index.Tile.html +34 -0
- package/docs/classes/index.Tile3D.html +98 -0
- package/docs/classes/index.TileCache.html +8 -0
- package/docs/classes/index.TileNode.html +14 -0
- package/docs/classes/index.TileRequestScheduler.html +4 -0
- package/docs/classes/index.Tileset.html +38 -0
- package/docs/classes/index.Trajectory.html +8 -0
- package/docs/classes/index.TrajectoryNode.html +8 -0
- package/docs/classes/index.Work.html +52 -0
- package/docs/classes/index.WorkResolvedObserver.html +68 -0
- package/docs/documents/README.html +134 -0
- package/docs/documents/ai-doc-guidelines.html +117 -0
- package/docs/documents/api.html +337 -0
- package/docs/documents/features_3dtile.html +216 -0
- package/docs/documents/features_camera-animation.html +157 -0
- package/docs/documents/features_clipper.html +80 -0
- package/docs/documents/features_coordinate-system.html +127 -0
- package/docs/documents/features_event.html +104 -0
- package/docs/documents/features_five.html +147 -0
- package/docs/documents/features_gesture.html +121 -0
- package/docs/documents/features_get-screen-pixels.html +88 -0
- package/docs/documents/features_image-options.html +108 -0
- package/docs/documents/features_load-external-model.html +600 -0
- package/docs/documents/features_load-progress.html +110 -0
- package/docs/documents/features_material.html +341 -0
- package/docs/documents/features_mode.html +114 -0
- package/docs/documents/features_model.html +141 -0
- package/docs/documents/features_move-pano-effect.html +110 -0
- package/docs/documents/features_multi-work.html +97 -0
- package/docs/documents/features_pano-filter.html +119 -0
- package/docs/documents/features_pano-tile.html +100 -0
- package/docs/documents/features_pano-uv.html +82 -0
- package/docs/documents/features_parameter.html +101 -0
- package/docs/documents/features_raycast.html +98 -0
- package/docs/documents/features_request-proxy.html +78 -0
- package/docs/documents/features_screen-project.html +112 -0
- package/docs/documents/features_state.html +71 -0
- package/docs/documents/features_ultra-hdr.html +188 -0
- package/docs/documents/features_view-layer.html +158 -0
- package/docs/documents/features_work.html +129 -0
- package/docs/documents/glossary.html +94 -0
- package/docs/documents/intro.html +24 -0
- package/docs/documents/quick-start.html +32 -0
- package/docs/documents/release_notes_6.6.html +79 -0
- package/docs/documents/release_notes_6.7.html +209 -0
- package/docs/documents/release_notes_6.8.html +189 -0
- package/docs/documents/support.html +49 -0
- package/docs/documents/template.html +80 -0
- package/docs/enums/index.VolumePlaneIntersect.html +4 -0
- package/docs/functions/index.coordinatesToVector.html +2 -0
- package/docs/functions/index.createDebugBoundingMesh.html +1 -0
- package/docs/functions/index.createWorks.html +1 -0
- package/docs/functions/index.defaultImageURLTransform.html +5 -0
- package/docs/functions/index.getViewportScale.html +1 -0
- package/docs/functions/index.headingToLongitude.html +4 -0
- package/docs/functions/index.imageSupport.html +1 -0
- package/docs/functions/index.isBoundingVolume.html +1 -0
- package/docs/functions/index.isPanoId.html +1 -0
- package/docs/functions/index.loadAt3d.html +1 -0
- package/docs/functions/index.loadDome.html +1 -0
- package/docs/functions/index.loadDomez.html +1 -0
- package/docs/functions/index.loadGltf.html +1 -0
- package/docs/functions/index.loadPbm.html +1 -0
- package/docs/functions/index.loadPly.html +1 -0
- package/docs/functions/index.longitudeToHeading.html +4 -0
- package/docs/functions/index.makeBoundingVolume.html +1 -0
- package/docs/functions/index.panoEqual.html +1 -0
- package/docs/functions/index.panoParse.html +1 -0
- package/docs/functions/index.panoStringify.html +1 -0
- package/docs/functions/index.parseWork.html +7 -0
- package/docs/functions/index.registerPBMMaterials.html +3 -0
- package/docs/functions/index.vectorToCoordinates.html +2 -0
- package/docs/functions/index.workToJson.html +1 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +134 -0
- package/docs/interfaces/index.AddableObject.html +9 -0
- package/docs/interfaces/index.AjaxOptions.html +9 -0
- package/docs/interfaces/index.AnimationFrame.html +6 -0
- package/docs/interfaces/index.AnimationFrameContext.html +3 -0
- package/docs/interfaces/index.BaseEvent.html +5 -0
- package/docs/interfaces/index.BoundingVolume.html +15 -0
- package/docs/interfaces/index.BoxBoundingVolume.html +18 -0
- package/docs/interfaces/index.CameraPose.html +6 -0
- package/docs/interfaces/index.CullingVolume.html +9 -0
- package/docs/interfaces/index.Draco.html +12 -0
- package/docs/interfaces/index.EventCallback.html +394 -0
- package/docs/interfaces/index.FiveInitArgs.html +104 -0
- package/docs/interfaces/index.FiveLoadOptions.html +12 -0
- package/docs/interfaces/index.FloorplanControllerCustomInitArgs.html +17 -0
- package/docs/interfaces/index.GestureEvent.html +19 -0
- package/docs/interfaces/index.IPBMMaterial.html +64 -0
- package/docs/interfaces/index.ImageOptions.html +21 -0
- package/docs/interfaces/index.ImageURLMappings.html +1 -0
- package/docs/interfaces/index.ImageURLOptions.html +17 -0
- package/docs/interfaces/index.IntersectEvent.html +8 -0
- package/docs/interfaces/index.IntersectMesh.html +2 -0
- package/docs/interfaces/index.IntersectMeshInterface.html +3 -0
- package/docs/interfaces/index.Intersection.html +9 -0
- package/docs/interfaces/index.LoosePanoWork.html +10 -0
- package/docs/interfaces/index.LooseWork.html +15 -0
- package/docs/interfaces/index.LooseWorkInitial.html +11 -0
- package/docs/interfaces/index.LooseWorkModel.html +8 -0
- package/docs/interfaces/index.LooseWorkObserver.html +17 -0
- package/docs/interfaces/index.LooseWorkPanorama.html +22 -0
- package/docs/interfaces/index.LooseWorkVideo.html +4 -0
- package/docs/interfaces/index.LooseWorkWithExtrinsics.html +15 -0
- package/docs/interfaces/index.MapviewControllerCustomInitArgs.html +20 -0
- package/docs/interfaces/index.ModeChangeEvent.html +9 -0
- package/docs/interfaces/index.ModelControllerCustomInitArgs.html +20 -0
- package/docs/interfaces/index.ModelEvent.html +8 -0
- package/docs/interfaces/index.ModelOptions.html +11 -0
- package/docs/interfaces/index.ModelSceneEvent.html +6 -0
- package/docs/interfaces/index.ModelTileEvent.html +8 -0
- package/docs/interfaces/index.MotionKeyframe.html +4 -0
- package/docs/interfaces/index.MovePanoOptions.html +35 -0
- package/docs/interfaces/index.NetworkAbortError.html +1 -0
- package/docs/interfaces/index.NetworkFirbiddenError.html +1 -0
- package/docs/interfaces/index.NetworkOptions.html +7 -0
- package/docs/interfaces/index.NetworkProxyError.html +1 -0
- package/docs/interfaces/index.NetworkResourceEvent.html +9 -0
- package/docs/interfaces/index.NetworkResponseError.html +2 -0
- package/docs/interfaces/index.NetworkTimeoutError.html +1 -0
- package/docs/interfaces/index.ObjectEvent.html +6 -0
- package/docs/interfaces/index.PBMClipperParameter.html +3 -0
- package/docs/interfaces/index.PBMHDRConfig.html +12 -0
- package/docs/interfaces/index.PBMPanoDepth.html +9 -0
- package/docs/interfaces/index.PBMPanoFilterValue.html +6 -0
- package/docs/interfaces/index.PBMPanoPicture.html +14 -0
- package/docs/interfaces/index.PBMRefinedScreen.html +6 -0
- package/docs/interfaces/index.PanoCircleMeshCustomOptions.html +9 -0
- package/docs/interfaces/index.PanoCircleMeshInterface.html +30 -0
- package/docs/interfaces/index.PanoCircleMeshOptions.html +3 -0
- package/docs/interfaces/index.PanoCircleMeshSolidOptions.html +3 -0
- package/docs/interfaces/index.PanoEvent.html +11 -0
- package/docs/interfaces/index.PanoTextureEvent.html +9 -0
- package/docs/interfaces/index.PanoramaControllerCustomInitArgs.html +41 -0
- package/docs/interfaces/index.PanoramaLikeControllerCustomInitArgs.html +20 -0
- package/docs/interfaces/index.ParameterMaterialValue.html +74 -0
- package/docs/interfaces/index.ParameterTilesetValue.html +30 -0
- package/docs/interfaces/index.ParameterValue.html +103 -0
- package/docs/interfaces/index.Pass.html +9 -0
- package/docs/interfaces/index.PointCloudData.html +6 -0
- package/docs/interfaces/index.Pose.html +12 -0
- package/docs/interfaces/index.RegionBoundingVolume.html +21 -0
- package/docs/interfaces/index.RenderEvent.html +6 -0
- package/docs/interfaces/index.ResolvedParameterValue.html +104 -0
- package/docs/interfaces/index.RgbaData.html +7 -0
- package/docs/interfaces/index.SphereBoundingVolume.html +17 -0
- package/docs/interfaces/index.SplatData.html +10 -0
- package/docs/interfaces/index.State.html +23 -0
- package/docs/interfaces/index.StateEvent.html +7 -0
- package/docs/interfaces/index.TextureOptions.html +23 -0
- package/docs/interfaces/index.Tile3DOptions.html +11 -0
- package/docs/interfaces/index.TileCoordinateSystem.html +3 -0
- package/docs/interfaces/index.TileHeader.html +9 -0
- package/docs/interfaces/index.TilesetHeader.html +20 -0
- package/docs/interfaces/index.TilesetOptions.html +7 -0
- package/docs/interfaces/index.TopviewControllerCustomInitArgs.html +13 -0
- package/docs/interfaces/index.TrajectoryHeader.html +5 -0
- package/docs/interfaces/index.ViewLayer.html +97 -0
- package/docs/interfaces/index.Viewport.html +13 -0
- package/docs/interfaces/index.WebXRAxesParams.html +4 -0
- package/docs/interfaces/index.WebXRControllerParams.html +2 -0
- package/docs/interfaces/index.WorkCubeImage.html +15 -0
- package/docs/interfaces/index.WorkImage.html +22 -0
- package/docs/interfaces/index.WorkInitial.html +17 -0
- package/docs/interfaces/index.WorkInitialJson.html +8 -0
- package/docs/interfaces/index.WorkJson.html +11 -0
- package/docs/interfaces/index.WorkModel.html +16 -0
- package/docs/interfaces/index.WorkModelJson.html +6 -0
- package/docs/interfaces/index.WorkModelLayer.html +11 -0
- package/docs/interfaces/index.WorkModelLayerJson.html +5 -0
- package/docs/interfaces/index.WorkObserver.html +63 -0
- package/docs/interfaces/index.WorkObserverJson.html +10 -0
- package/docs/interfaces/index.WorkPanoramaJson.html +14 -0
- package/docs/interfaces/index.WorkPanoramasJson.html +3 -0
- package/docs/interfaces/index.WorkTile.html +21 -0
- package/docs/interfaces/index.WorkVideo.html +9 -0
- package/docs/interfaces/index.WorksEvent.html +8 -0
- package/docs/interfaces/index.XRControllerEvent.html +8 -0
- package/docs/interfaces/index.XRGestureEvent.html +11 -0
- package/docs/interfaces/index.XRSessionEvent.html +7 -0
- package/docs/modules/index.html +1 -0
- package/docs/modules.html +1 -0
- package/docs/types/index.AjaxResponseType.html +1 -0
- package/docs/types/index.AjaxResponseTypeMapping.html +1 -0
- package/docs/types/index.AnimationFrameLoopType.html +1 -0
- package/docs/types/index.BoundingVolumeJson.html +1 -0
- package/docs/types/index.BoxBoundingVolumeJson.html +2 -0
- package/docs/types/index.ControllerCustomInitTypes.html +6 -0
- package/docs/types/index.ControllerEventTypes.html +68 -0
- package/docs/types/index.CubeFace.html +1 -0
- package/docs/types/index.EasingFunction.html +1 -0
- package/docs/types/index.EventTypes.html +28 -0
- package/docs/types/index.FivePlugin.html +4 -0
- package/docs/types/index.FivePluginInit.html +3 -0
- package/docs/types/index.FivePluginInstance.html +3 -0
- package/docs/types/index.FlowingFireworks3DPassLine.html +16 -0
- package/docs/types/index.FlowingLight2DPassLine.html +10 -0
- package/docs/types/index.FlowingLight3DPassLine.html +10 -0
- package/docs/types/index.GestureTypes.html +1 -0
- package/docs/types/index.LegacyEventType.html +282 -0
- package/docs/types/index.LoadResultType.html +12 -0
- package/docs/types/index.Mode.html +15 -0
- package/docs/types/index.Models.html +11 -0
- package/docs/types/index.MotionCircle.html +2 -0
- package/docs/types/index.MotionConfig.html +1 -0
- package/docs/types/index.MotionInitalValue.html +1 -0
- package/docs/types/index.MotionValue.html +1 -0
- package/docs/types/index.MovePanoEffect.html +12 -0
- package/docs/types/index.NetWorkMeta.html +8 -0
- package/docs/types/index.NetworkError.html +1 -0
- package/docs/types/index.NetworkErrorCallback.html +1 -0
- package/docs/types/index.NetworkProgressCallback.html +1 -0
- package/docs/types/index.NetworkResponse.html +3 -0
- package/docs/types/index.NetworkState.html +1 -0
- package/docs/types/index.NetworkSuccessCallback.html +1 -0
- package/docs/types/index.NetworkType.html +1 -0
- package/docs/types/index.OutputTextureDataType.html +1 -0
- package/docs/types/index.PBMAlphaMode.html +1 -0
- package/docs/types/index.PBMColorStyle.html +1 -0
- package/docs/types/index.PBMFloorStyle.html +1 -0
- package/docs/types/index.PBMMeshMaterial.html +1 -0
- package/docs/types/index.PBMPointBack.html +1 -0
- package/docs/types/index.PBMPointCloudShaderType.html +1 -0
- package/docs/types/index.PBMPointShape.html +1 -0
- package/docs/types/index.PBMPointSize.html +1 -0
- package/docs/types/index.PBMTransition.html +1 -0
- package/docs/types/index.Pano.html +3 -0
- package/docs/types/index.PanoId.html +1 -0
- package/docs/types/index.ParseOptions.html +13 -0
- package/docs/types/index.PostProcessingType.html +1 -0
- package/docs/types/index.RegionBoundingVolumeJson.html +2 -0
- package/docs/types/index.RequestAnimationFrameArgs.html +1 -0
- package/docs/types/index.Scissor.html +2 -0
- package/docs/types/index.SphereBoundingVolumeJson.html +2 -0
- package/docs/types/index.SubscribeEventMap.html +1 -0
- package/docs/types/index.TileCacheOptions.html +3 -0
- package/docs/types/index.TileContentData.html +6 -0
- package/docs/types/index.TileRequestOrder.html +1 -0
- package/docs/types/index.TileRequestSchedulerOptions.html +4 -0
- package/docs/types/index.TilesetFrameState.html +21 -0
- package/docs/types/index.TrajectoryContentData.html +7 -0
- package/docs/types/index.WebXRControllerKey.html +1 -0
- package/docs/types/index.WebXRControllerType.html +1 -0
- package/docs/types/index.Works.html +1 -0
- package/docs/variables/index.PROXY_CONTROLLER_EVENT_NAMES.html +1 -0
- package/docs/variables/index.controllersDefaultInitArgs.html +1 -0
- package/docs/variables/index.draco.html +1 -0
- package/five/application/analysis.d.ts +40 -0
- package/five/application/controllers.d.ts +33 -0
- package/five/application/events-legacy.d.ts +454 -0
- package/five/application/events.d.ts +69 -0
- package/five/application/five.d.ts +498 -0
- package/five/application/fiveInitArgs.d.ts +173 -0
- package/five/application/fiveLoadOptions.d.ts +21 -0
- package/five/application/generateDefaultVideoElement.d.ts +2 -0
- package/five/application/getViewportScale.d.ts +2 -0
- package/five/application/initLights.d.ts +3 -0
- package/five/application/mode.d.ts +24 -0
- package/five/application/renderPoweredByRealsee.d.ts +3 -0
- package/five/assets/cardboard-png-data-url.d.ts +2 -0
- package/five/assets/gradient-png-data-url.d.ts +2 -0
- package/five/assets/loading-png-data-url.d.ts +2 -0
- package/five/assets/phone-png-data-url.d.ts +2 -0
- package/five/assets/realsee-pmg-data-url.d.ts +2 -0
- package/five/bvh/bvhMath.d.ts +33 -0
- package/five/bvh/bvhMesh.d.ts +7 -0
- package/five/bvh/bvhNode.d.ts +29 -0
- package/five/bvh/bvhObject.d.ts +19 -0
- package/five/bvh/bvhPoints.d.ts +6 -0
- package/five/bvh/index.d.ts +14 -0
- package/five/bvh/type.d.ts +1 -0
- package/five/bvh/worker.d.ts +36 -0
- package/five/certificates/hardware.d.ts +1 -0
- package/five/controllers/base.d.ts +166 -0
- package/five/controllers/events.d.ts +71 -0
- package/five/controllers/floorplan.d.ts +119 -0
- package/five/controllers/mapview.d.ts +138 -0
- package/five/controllers/model.d.ts +57 -0
- package/five/controllers/panorama.d.ts +143 -0
- package/five/controllers/panoramaLike.d.ts +87 -0
- package/five/controllers/topview.d.ts +42 -0
- package/five/core/camera.d.ts +65 -0
- package/five/core/internalWebGPURenderer.d.ts +13 -0
- package/five/core/panoVideo.d.ts +18 -0
- package/five/core/scene.d.ts +10 -0
- package/five/core/tiling.d.ts +56 -0
- package/five/declare.d.ts +35 -0
- package/five/gaussian-splatting/util/renderData.d.ts +66 -0
- package/five/gaussian-splatting/wasm/data.d.ts +20 -0
- package/five/gaussian-splatting/wasm/sort.d.ts +18 -0
- package/five/gaussian-splatting/worker/dataWorker.d.ts +1 -0
- package/five/gaussian-splatting/worker/sortWorker.d.ts +1 -0
- package/five/index.d.ts +58 -0
- package/five/index.js +1179 -0
- package/five/index.mjs +25111 -0
- package/five/meshes/boundingMesh.d.ts +12 -0
- package/five/meshes/intersectMesh.d.ts +8 -0
- package/five/meshes/panoCircleMesh.d.ts +36 -0
- package/five/meshes/panoCircleMeshCustom.d.ts +40 -0
- package/five/meshes/panoCircleMeshSolid.d.ts +35 -0
- package/five/meshes/panoSphereMesh.d.ts +29 -0
- package/five/model/helpers/coordinate-transform.d.ts +3 -0
- package/five/model/helpers/ellipsoid-coordinates.d.ts +14 -0
- package/five/model/helpers/get-edges-by-sphere.d.ts +8 -0
- package/five/model/helpers/get-recommend-tile3d-parameters.d.ts +8 -0
- package/five/model/index.d.ts +55 -0
- package/five/model/intersection.d.ts +18 -0
- package/five/model/loaders/at3d.d.ts +12 -0
- package/five/model/loaders/b3dm.d.ts +10 -0
- package/five/model/loaders/dome.d.ts +22 -0
- package/five/model/loaders/domez.d.ts +11 -0
- package/five/model/loaders/fbx.d.ts +8 -0
- package/five/model/loaders/glTF-helpers/extensions/CESIUM_RTC.d.ts +9 -0
- package/five/model/loaders/glTF-helpers/extensions/EXT_meshopt_compression.d.ts +8 -0
- package/five/model/loaders/glTF-helpers/extensions/EXT_texture_webp.d.ts +11 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_animation_pointer.d.ts +6 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_binary_glTF.d.ts +25 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_draco_mesh_compression.d.ts +11 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting.d.ts +26 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting_compression_spz.d.ts +11 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting_compression_spz_2.d.ts +13 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_materials_clearcoat.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_materials_emissive_strength.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_materials_sheen.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_materials_transmission.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_materials_unlit.d.ts +12 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_mesh_quantization.d.ts +6 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_node_visibility.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_texture_basisu.d.ts +9 -0
- package/five/model/loaders/glTF-helpers/extensions/KHR_texture_transform.d.ts +10 -0
- package/five/model/loaders/glTF-helpers/extensions/REALSEE_materials_lightmap.d.ts +7 -0
- package/five/model/loaders/glTF-helpers/extensions/base.d.ts +25 -0
- package/five/model/loaders/glTF-helpers/glTF.d.ts +713 -0
- package/five/model/loaders/glTF-helpers/index.d.ts +51 -0
- package/five/model/loaders/glTF-helpers/parser.d.ts +115 -0
- package/five/model/loaders/glTF-helpers/type.d.ts +14 -0
- package/five/model/loaders/gltf.d.ts +10 -0
- package/five/model/loaders/obj.d.ts +9 -0
- package/five/model/loaders/pbm.d.ts +26 -0
- package/five/model/loaders/ply.d.ts +24 -0
- package/five/model/loaders/pnts.d.ts +8 -0
- package/five/model/loaders/protobuf/dome.d.ts +540 -0
- package/five/model/loaders/protobuf/pbm.d.ts +203 -0
- package/five/model/loaders/shared.d.ts +16 -0
- package/five/model/loaders/splat.d.ts +8 -0
- package/five/model/loaders/spz.d.ts +14 -0
- package/five/model/loaders/tile3d-helpers/feature-table.d.ts +15 -0
- package/five/model/loaders/tile3d-helpers/gl-type.d.ts +20 -0
- package/five/model/loaders/tile3d-helpers/parse-gltf-array-buffer.d.ts +2 -0
- package/five/model/loaders/tile3d-helpers/parse-header.d.ts +2 -0
- package/five/model/loaders/tile3d-helpers/parse-point-cloud-attributes.d.ts +2 -0
- package/five/model/loaders/tile3d-helpers/parse-point-cloud-attributes.worker.d.ts +6 -0
- package/five/model/loaders/tile3d-helpers/parse-table.d.ts +3 -0
- package/five/model/loaders/tile3d-helpers/tile3d-type.d.ts +36 -0
- package/five/model/loaders/x3p.d.ts +22 -0
- package/five/model/materials/nodes/pbmMeshBasicNodeMaterial.d.ts +14 -0
- package/five/model/materials/nodes/pbmMeshPanoOnlyNodeMaterial.d.ts +14 -0
- package/five/model/materials/nodes/pbmMeshPhongNodeMaterial.d.ts +14 -0
- package/five/model/materials/nodes/pbmMeshPhysicalNodeMaterial.d.ts +14 -0
- package/five/model/materials/nodes/pbmPointCloudNodeMaterial.d.ts +22 -0
- package/five/model/materials/pbmGaussianSplattingNodeMaterial.d.ts +78 -0
- package/five/model/materials/pbmMaterial.d.ts +171 -0
- package/five/model/materials/pbmMaterialRegister.d.ts +6 -0
- package/five/model/materials/pbmMeshMaterial.d.ts +57 -0
- package/five/model/materials/pbmPointCloudMaterial.d.ts +20 -0
- package/five/model/materials/pbmPointCloudNodeMaterial.d.ts +46 -0
- package/five/model/materials/tsl/colorFilter.d.ts +9 -0
- package/five/model/materials/tsl/defines.d.ts +68 -0
- package/five/model/materials/tsl/nodeTypes.d.ts +12 -0
- package/five/model/materials/tsl/outputBuilder.d.ts +26 -0
- package/five/model/materials/tsl/panoColor.d.ts +17 -0
- package/five/model/materials/tsl/panoTransition.d.ts +8 -0
- package/five/model/materials/tsl/utils.d.ts +11 -0
- package/five/model/model-scene.d.ts +172 -0
- package/five/model/model.d.ts +203 -0
- package/five/model/objects/pbmGaussianSplattingObject.d.ts +47 -0
- package/five/model/objects/pbmGaussianSplattingRenderMesh.d.ts +73 -0
- package/five/model/objects/pbmGroup.d.ts +8 -0
- package/five/model/objects/pbmMesh.d.ts +10 -0
- package/five/model/objects/pbmPointCloud.d.ts +89 -0
- package/five/model/objects/pbmPointCloudObject.d.ts +81 -0
- package/five/model/parameter.d.ts +138 -0
- package/five/model/tile3d/header.d.ts +88 -0
- package/five/model/tile3d/index.d.ts +213 -0
- package/five/model/tile3d/tile-cache.d.ts +18 -0
- package/five/model/tile3d/tile-content.d.ts +10 -0
- package/five/model/tile3d/tile-node.d.ts +26 -0
- package/five/model/tile3d/tile-request-scheduler.d.ts +17 -0
- package/five/model/tile3d/tile.d.ts +79 -0
- package/five/model/tile3d/tileset-base-traverser.d.ts +59 -0
- package/five/model/tile3d/tileset-most-detail-traverser.d.ts +14 -0
- package/five/model/tile3d/tileset-normal-traverser.d.ts +15 -0
- package/five/model/tile3d/tileset-skip-traverser.d.ts +60 -0
- package/five/model/tile3d/tileset.d.ts +65 -0
- package/five/model/tile3d/trajectory-content.d.ts +0 -0
- package/five/model/tile3d/trajectory-node.d.ts +15 -0
- package/five/model/tile3d/trajectory.d.ts +30 -0
- package/five/model/tile3d/types.d.ts +33 -0
- package/five/model/view-layer.d.ts +20 -0
- package/five/renderer/compute-renderers/pointcloud-compute-renderer.d.ts +154 -0
- package/five/renderer/compute-renderers/rgb565.d.ts +45 -0
- package/five/renderer/compute-renderers/shaders/clear.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/fullscreenQuad.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/rasterize.d.ts +2 -0
- package/five/renderer/five-renderer.d.ts +33 -0
- package/five/renderer/index.d.ts +3 -0
- package/five/renderer/postprocessing/composer.d.ts +45 -0
- package/five/renderer/postprocessing/index.d.ts +8 -0
- package/five/renderer/postprocessing/passes/adaptive-luminance-pass.d.ts +27 -0
- package/five/renderer/postprocessing/passes/eye-dome-lighting-pass.d.ts +31 -0
- package/five/renderer/postprocessing/passes/flowing-fireworks-3d-pass.d.ts +71 -0
- package/five/renderer/postprocessing/passes/flowing-light-2d-pass.d.ts +26 -0
- package/five/renderer/postprocessing/passes/flowing-light-3d-pass.d.ts +75 -0
- package/five/renderer/postprocessing/passes/gaussian-blur-pass.d.ts +22 -0
- package/five/renderer/postprocessing/passes/pass.d.ts +38 -0
- package/five/renderer/scene-renderers/scene-renderer.d.ts +9 -0
- package/five/renderer/tools/full-screen-quad.d.ts +17 -0
- package/five/renderer/tools/postprocess-uv.d.ts +11 -0
- package/five/renderer/tools/render-cube-to-equirectangular.d.ts +7 -0
- package/five/renderer/tools/render-full-screen-depth.d.ts +2 -0
- package/five/renderer/tools/render-full-screen.d.ts +2 -0
- package/five/texture/histogram.d.ts +54 -0
- package/five/texture/imageBitmap.d.ts +13 -0
- package/five/texture/initTexture.d.ts +3 -0
- package/five/texture/loader.d.ts +39 -0
- package/five/texture/textureData.d.ts +11 -0
- package/five/thirdparty/fflate.d.ts +1407 -0
- package/five/thirdparty/hammer.d.ts +375 -0
- package/five/thirdparty/jsrsasign.d.ts +753 -0
- package/five/thirdparty/meshopt_decoder.d.ts +15 -0
- package/five/three-version-check.d.ts +1 -0
- package/five/types/addableObject.d.ts +12 -0
- package/five/types/cube.d.ts +2 -0
- package/five/types/gestureInput.d.ts +24 -0
- package/five/types/imageOptions.d.ts +20 -0
- package/five/types/intersectMeshInterface.d.ts +8 -0
- package/five/types/movePanoEffect.d.ts +13 -0
- package/five/types/movePanoOptions.d.ts +36 -0
- package/five/types/panoCircleMeshInterface.d.ts +34 -0
- package/five/types/plugin.d.ts +25 -0
- package/five/types/pose.d.ts +17 -0
- package/five/types/state.d.ts +20 -0
- package/five/types/viewport.d.ts +22 -0
- package/five/utils/ajax.d.ts +66 -0
- package/five/utils/animationFrameLoop.d.ts +45 -0
- package/five/utils/array.d.ts +31 -0
- package/five/utils/asyncTaskQueue.d.ts +8 -0
- package/five/utils/bufferGeometry.d.ts +33 -0
- package/five/utils/calculateProgress.d.ts +39 -0
- package/five/utils/calculateThreeMouse.d.ts +13 -0
- package/five/utils/canplayVideo.d.ts +2 -0
- package/five/utils/clamp.d.ts +2 -0
- package/five/utils/clock.d.ts +30 -0
- package/five/utils/createSymbol.d.ts +5 -0
- package/five/utils/decodeText.d.ts +2 -0
- package/five/utils/deepEqual.d.ts +2 -0
- package/five/utils/deepFreeze.d.ts +2 -0
- package/five/utils/defineProperty.d.ts +9 -0
- package/five/utils/detector.d.ts +14 -0
- package/five/utils/distance.d.ts +10 -0
- package/five/utils/draco.d.ts +26 -0
- package/five/utils/easing.d.ts +63 -0
- package/five/utils/event.d.ts +159 -0
- package/five/utils/face3.d.ts +12 -0
- package/five/utils/formatRad.d.ts +7 -0
- package/five/utils/hdr-data.d.ts +13 -0
- package/five/utils/imageSupport.d.ts +6 -0
- package/five/utils/imageURL.d.ts +42 -0
- package/five/utils/isEmptyObject.d.ts +2 -0
- package/five/utils/isNil.d.ts +6 -0
- package/five/utils/isNumber.d.ts +2 -0
- package/five/utils/isPowerOfTwo.d.ts +2 -0
- package/five/utils/isPromise.d.ts +2 -0
- package/five/utils/isSimilar.d.ts +6 -0
- package/five/utils/json.d.ts +7 -0
- package/five/utils/ktx2.d.ts +30 -0
- package/five/utils/lzma/index.d.ts +2 -0
- package/five/utils/lzma/lzma.d.ts +3 -0
- package/five/utils/lzma/lzmaWASM.d.ts +2 -0
- package/five/utils/lzma/lzmaWorker.d.ts +14 -0
- package/five/utils/memoryUsage.d.ts +37 -0
- package/five/utils/motion.d.ts +38 -0
- package/five/utils/noop.d.ts +6 -0
- package/five/utils/now.d.ts +7 -0
- package/five/utils/pano.d.ts +9 -0
- package/five/utils/pick.d.ts +3 -0
- package/five/utils/poseUtils.d.ts +5 -0
- package/five/utils/renderCubeTextureToCubeRenderTarget.d.ts +3 -0
- package/five/utils/renderDepth.d.ts +2 -0
- package/five/utils/renderTexturesToCubeRenderTarget.d.ts +10 -0
- package/five/utils/requestPermission.d.ts +3 -0
- package/five/utils/shaderContentFix.d.ts +7 -0
- package/five/utils/shaderMaterial.d.ts +20 -0
- package/five/utils/stateUtils.d.ts +5 -0
- package/five/utils/string-pattern.d.ts +8 -0
- package/five/utils/subscribe.d.ts +67 -0
- package/five/utils/tileCube.d.ts +19 -0
- package/five/utils/toFastProperties.d.ts +1 -0
- package/five/utils/typedCache.d.ts +10 -0
- package/five/utils/uniform.d.ts +15 -0
- package/five/utils/url.d.ts +35 -0
- package/five/utils/uuid.d.ts +5 -0
- package/five/utils/values.d.ts +2 -0
- package/five/utils/vectorCoordinates.d.ts +29 -0
- package/five/utils/volume.d.ts +111 -0
- package/five/utils/worker.d.ts +26 -0
- package/five/work/_ALLOW_HOST.d.ts +2 -0
- package/five/work/index.d.ts +6 -0
- package/five/work/keychain.d.ts +5 -0
- package/five/work/looseWorkType.d.ts +128 -0
- package/five/work/verify.d.ts +7 -0
- package/five/work/work.d.ts +246 -0
- package/five/work/workFetcher.d.ts +4 -0
- package/five/work/workJson.d.ts +3 -0
- package/five/work/workJsonType.d.ts +73 -0
- package/five/work/workObserverUtils.d.ts +36 -0
- package/five/work/workParser.d.ts +6 -0
- package/five/work/workResolvedObserver.d.ts +12 -0
- package/five/work/workVerify.d.ts +2 -0
- package/five/work/works.d.ts +10 -0
- package/llms.txt +66 -0
- package/package.json +56 -0
- package/plugins/BasePlugin/index.d.ts +96 -0
- package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.d.ts +66 -0
- package/plugins/GaussianSplattingEntranceAnimationPlugin/index.d.ts +5 -0
- package/plugins/GaussianSplattingEntranceAnimationPlugin/typing.d.ts +32 -0
- package/plugins/index.d.ts +2 -0
- package/plugins/index.js +255 -0
- package/plugins/index.mjs +539 -0
- package/plugins/utils/absoluteUrl.d.ts +5 -0
- package/react/autoCanvas.d.ts +9 -0
- package/react/canvas.d.ts +19 -0
- package/react/context.d.ts +12 -0
- package/react/createProvider.d.ts +98 -0
- package/react/createStore.d.ts +144 -0
- package/react/fiveApp.d.ts +22 -0
- package/react/hooks/unsafe__useFiveInstance.d.ts +9 -0
- package/react/hooks/useFiveAction.d.ts +147 -0
- package/react/hooks/useFiveCameraDirection.d.ts +7 -0
- package/react/hooks/useFiveCameraRaycaster.d.ts +7 -0
- package/react/hooks/useFiveCurrentObserver.d.ts +11 -0
- package/react/hooks/useFiveCurrentState.d.ts +15 -0
- package/react/hooks/useFiveEventCallback.d.ts +12 -0
- package/react/hooks/useFiveFloor.d.ts +15 -0
- package/react/hooks/useFiveHelper.d.ts +14 -0
- package/react/hooks/useFiveModelBounding.d.ts +5 -0
- package/react/hooks/useFiveModelEffect.d.ts +14 -0
- package/react/hooks/useFiveModelIntersectRaycaster.d.ts +22 -0
- package/react/hooks/useFiveModelReadyState.d.ts +8 -0
- package/react/hooks/useFivePlugin.d.ts +22 -0
- package/react/hooks/useFiveProject2d.d.ts +21 -0
- package/react/hooks/useFiveSceneEffect.d.ts +21 -0
- package/react/hooks/useFiveState.d.ts +6 -0
- package/react/hooks/useFiveWork.d.ts +29 -0
- package/react/index.d.ts +28 -0
- package/react/index.js +255 -0
- package/react/index.mjs +896 -0
- package/react/withFive.d.ts +213 -0
- package/resource/basis/1.16/basis_transcoder.js +22 -0
- package/resource/basis/1.16/basis_transcoder.wasm +0 -0
- package/resource/basis/README.md +5 -0
- package/resource/draco/1.5.6/draco_decoder.js +34 -0
- package/resource/draco/1.5.6/draco_decoder.wasm +0 -0
- package/resource/draco/1.5.6/draco_decoder_gltf.js +33 -0
- package/resource/draco/1.5.6/draco_decoder_gltf.wasm +0 -0
- package/resource/draco/1.5.6/draco_encoder.js +35 -0
- package/resource/draco/1.5.6/draco_encoder.wasm +0 -0
- package/resource/draco/1.5.6/draco_encoder_wrapper.js +97 -0
- package/resource/draco/1.5.6/draco_wasm_wrapper.js +117 -0
- package/resource/draco/1.5.6/draco_wasm_wrapper_gltf.js +116 -0
- package/resource/draco/README.md +5 -0
- package/umd/five-plugins.js +255 -0
- package/umd/five-react.js +255 -0
- package/umd/five.js +1579 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# 模型裁切 (Model Clipper)
|
|
2
|
+
|
|
3
|
+
- **Summary**: 使用 `parameter.clippers` 定义裁切盒,用于隐藏 (discard) 模型中特定区域的点云或网格。
|
|
4
|
+
- **Schema**: `PBMClipperParameter` 数组,包含变换矩阵和楼层索引。
|
|
5
|
+
- **Concepts**: Clipping Box (裁切盒), Matrix Transformation (矩阵变换), Negative Space (负空间).
|
|
6
|
+
- **Configuration**: `five.model.clippers`.
|
|
7
|
+
- **Examples**: 创建裁切盒并应用。
|
|
8
|
+
|
|
9
|
+
## Schema
|
|
10
|
+
|
|
11
|
+
> **Definition**: [PBMClipperParameter](../../five/model/materials/pbmMaterial.d.ts)
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
/** 模型裁切参数 */
|
|
15
|
+
interface PBMClipperParameter {
|
|
16
|
+
/**
|
|
17
|
+
* 裁切盒的变换矩阵。
|
|
18
|
+
* @description
|
|
19
|
+
* 定义了一个变换后的立方体空间。
|
|
20
|
+
* 基础形状为边长为 1 的立方体,中心在 (0,0,0),范围 [-0.5, 0.5]。
|
|
21
|
+
* 凡是落在这个变换后立方体内部的模型点,都会被丢弃 (discard)。
|
|
22
|
+
*/
|
|
23
|
+
clippingBoxMatrix: THREE.Matrix4;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* (可选) 楼层索引。
|
|
27
|
+
* @description
|
|
28
|
+
* 如果指定,则裁切仅对该楼层的点云生效。
|
|
29
|
+
* 如果未指定 (undefined),则对所有楼层生效。
|
|
30
|
+
*/
|
|
31
|
+
floorIndex?: number;
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Concepts
|
|
36
|
+
|
|
37
|
+
### Clipping Box (裁切盒)
|
|
38
|
+
Five 的裁切机制是基于**负空间**的:
|
|
39
|
+
- 默认情况下,所有模型点都是可见的。
|
|
40
|
+
- 当你添加一个 Clipper 时,你实际上是在定义一个“不可见区域”。
|
|
41
|
+
- 任何位于 Clipper 定义的 3D 盒体内部的点,都不会被渲染。
|
|
42
|
+
|
|
43
|
+
### Matrix Transformation (矩阵变换)
|
|
44
|
+
Clipper 的几何定义依赖于 `clippingBoxMatrix`。
|
|
45
|
+
- shader 内部逻辑是将世界坐标系下的点,乘以 `clippingBoxMatrix` 的**逆矩阵**。
|
|
46
|
+
- 然后判断该点是否在 `[-0.5, 0.5]` 的单位立方体范围内。
|
|
47
|
+
- 这意味着你可以直接使用 `THREE.Mesh` (BoxGeometry 1x1x1) 的 `matrix` 属性作为 `clippingBoxMatrix`,所见即所得。
|
|
48
|
+
|
|
49
|
+
## Configuration
|
|
50
|
+
|
|
51
|
+
你可以通过 `five.model.clippers` 属性来读写裁切配置。
|
|
52
|
+
|
|
53
|
+
| 属性 | 类型 | 说明 |
|
|
54
|
+
| --- | --- | --- |
|
|
55
|
+
| `five.model.clippers` | `PBMClipperParameter[]` | 设置裁切参数数组。设置新数组会覆盖旧配置。 |
|
|
56
|
+
|
|
57
|
+
## Examples
|
|
58
|
+
|
|
59
|
+
### 基础用法 (Basic Usage)
|
|
60
|
+
|
|
61
|
+
创建一个不可见的 Box,将其位置和大小作为裁切区域。
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import * as THREE from 'three';
|
|
65
|
+
import { Five } from '@realsee/five';
|
|
66
|
+
|
|
67
|
+
// 1. 创建一个辅助 Mesh 来定义裁切区域
|
|
68
|
+
// 注意:必须使用 1x1x1 的 BoxGeometry,因为 Shader 是基于单位立方体判断的
|
|
69
|
+
const clipperMesh = new THREE.Mesh(
|
|
70
|
+
new THREE.BoxGeometry(1, 1, 1),
|
|
71
|
+
new THREE.MeshBasicMaterial({ color: 0xff0000, wireframe: true })
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
// 2. 设置裁切盒的位置、旋转和缩放
|
|
75
|
+
clipperMesh.position.set(0, 1.5, 0); // 抬高位置
|
|
76
|
+
clipperMesh.scale.set(2, 3, 2); // 设定大小为 2x3x2
|
|
77
|
+
clipperMesh.rotation.y = Math.PI / 4; // 旋转 45 度
|
|
78
|
+
|
|
79
|
+
// 更新矩阵,确保 .matrix 属性是最新的
|
|
80
|
+
clipperMesh.updateMatrix();
|
|
81
|
+
|
|
82
|
+
// (可选) 将辅助 Mesh 加入场景以便调试看到范围
|
|
83
|
+
five.scene.add(clipperMesh);
|
|
84
|
+
|
|
85
|
+
// 3. 应用裁切参数
|
|
86
|
+
five.model.clippers = [
|
|
87
|
+
{
|
|
88
|
+
clippingBoxMatrix: clipperMesh.matrix,
|
|
89
|
+
// floorIndex: 0 // 可选:仅裁切第 0 层
|
|
90
|
+
}
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
// 4. 触发重绘
|
|
94
|
+
five.needsRender = true;
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 动态更新 (Dynamic Update)
|
|
98
|
+
|
|
99
|
+
如果需要动态移动裁切盒,需要重新赋值 `five.model.clippers` 或手动触发更新机制(虽然 setter 会自动触发更新,但如果只修改数组内部对象可能需要重新赋值)。
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
function updateClipper(mesh: THREE.Mesh) {
|
|
103
|
+
mesh.updateMatrix();
|
|
104
|
+
|
|
105
|
+
// 重新赋值以触发 Five 内部的 setter 和 uniform 更新
|
|
106
|
+
five.model.clippers = [{
|
|
107
|
+
clippingBoxMatrix: mesh.matrix
|
|
108
|
+
}];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// 在动画循环或交互事件中调用
|
|
112
|
+
// ...
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Debugging
|
|
116
|
+
|
|
117
|
+
- **辅助显示**: 始终建议在开发阶段将用于生成矩阵的 `THREE.Mesh` (Wireframe 模式) 添加到 `five.scene` 中,这样可以直观地看到裁切范围是否正确。
|
|
118
|
+
- **单位问题**: 确保 `BoxGeometry` 构造时没有传入参数 (默认 1,1,1) 或者显式传入 `(1, 1, 1)`。如果使用了 `(10, 10, 10)` 的几何体,那么 `scale` 设置为 1 时实际裁切范围是 10,可能会导致误解。建议统一使用单位几何体 + `scale` 的方式。
|
|
119
|
+
|
|
120
|
+
## Common Pitfalls
|
|
121
|
+
|
|
122
|
+
1. **矩阵未更新**: 修改了 Mesh 的 position/scale 后忘记调用 `updateMatrix()`,导致裁切位置没变。
|
|
123
|
+
2. **几何体尺寸**: 使用了非 `1x1x1` 的 BoxGeometry,导致裁切范围与 Mesh视觉大小不一致(Shader 始终假定是单位立方体)。
|
|
124
|
+
3. **楼层索引**: 设置了错误的 `floorIndex` 导致裁切看起来没生效(因为该区域的点可能属于另一个 floorIndex)。
|
|
125
|
+
4. **坐标系**: `clippingBoxMatrix` 是世界坐标系下的变换。如果模型本身有额外的父级变换(通常 Five 的模型直接在 Scene 下,或者是 Identity 变换),通常不需要额外处理。
|
|
126
|
+
|
|
127
|
+
## Related
|
|
128
|
+
|
|
129
|
+
* [model.md](./model.md): 模型模块概览。
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
```yaml
|
|
134
|
+
tags: [clipper, model, cut, discard, geometry]
|
|
135
|
+
```
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# 坐标系 (Coordinate System)
|
|
2
|
+
|
|
3
|
+
- **Summary**: 详解 Five 中的坐标系定义(Local, ENU, ECEF)及其相互转换关系。
|
|
4
|
+
- **Concepts**: Local (Y-up), ENU (Z-up), ECEF, ENU84, RootMeta, Observers.
|
|
5
|
+
- **Configuration**: `rootMeta` `coordinate` 配置。
|
|
6
|
+
- **Examples**: 坐标转换方法示例。
|
|
7
|
+
|
|
8
|
+
## Schema
|
|
9
|
+
|
|
10
|
+
> **Definition**: [TilesetHeader](../../five/model/tile3d/header.d.ts)
|
|
11
|
+
|
|
12
|
+
### RootMeta
|
|
13
|
+
|
|
14
|
+
3D Tiles `rootMeta` 字段中定义的坐标系元数据。
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
interface RootMeta {
|
|
18
|
+
/** 模型垂直轴向 (如 "Z", "-Y") */
|
|
19
|
+
upAxis?: string;
|
|
20
|
+
/** 坐标系转换矩阵信息 */
|
|
21
|
+
coordinate?: Coordinate;
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Coordinate
|
|
26
|
+
|
|
27
|
+
描述 ECEF 与 ENU 之间的转换关系。
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
interface Coordinate {
|
|
31
|
+
/** 地面高度 */
|
|
32
|
+
ground_height?: number;
|
|
33
|
+
/** ECEF 到 ENU 的转换矩阵 (4x4 数组) */
|
|
34
|
+
pose_ecef_to_enu?: number[];
|
|
35
|
+
/** ENU 到 ECEF 的转换矩阵 (4x4 数组) */
|
|
36
|
+
pose_enu_to_ecef?: number[];
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Concepts
|
|
41
|
+
|
|
42
|
+
### Local Coordinate System (Y-up)
|
|
43
|
+
Five 的渲染场景 (`five.scene`) 和 Observers (观察点) 使用 **Y-up** (Y 轴向上) 的右手坐标系。
|
|
44
|
+
这与 Three.js 的默认坐标系一致,便于前端开发和场景渲染。
|
|
45
|
+
- **Y 轴**: 垂直向上。
|
|
46
|
+
- **X/Z 轴**: 水平平面。
|
|
47
|
+
|
|
48
|
+
### ENU Coordinate System (Z-up)
|
|
49
|
+
在本项目及相关算法交互中,**ENU** 指代 **Z-up** (Z 轴向上) 的坐标系。这是为了和测绘行业习惯保持一致。
|
|
50
|
+
- **Z 轴**: 垂直向上。
|
|
51
|
+
- **X/Y 轴**: 水平平面。
|
|
52
|
+
- **ENU84**: 特指 Y 轴正向指向正北 (North) 的 ENU 坐标系。(注:普通的 ENU 坐标系中,北向不一定对应 Y 轴,这与部分行业标准有所区别)。
|
|
53
|
+
- **用途**: 推荐在给算法或后端接口传递模型数据时,使用 ENU 坐标系。
|
|
54
|
+
|
|
55
|
+
### ECEF Coordinate System
|
|
56
|
+
地心地固坐标系 (Earth-Centered, Earth-Fixed)。
|
|
57
|
+
- 当模型包含 RTK (Real-time kinematic) 信息时,通常基于 ECEF 坐标系进行描述。
|
|
58
|
+
- 可以通过 `ecefToEnu` 方法将 ECEF 坐标转换为 ENU 坐标。
|
|
59
|
+
|
|
60
|
+
### Model Orientation (at3d / 3dtiles)
|
|
61
|
+
模型 (如 `.at3d`, 3D Tiles) 的加载逻辑遵循以下原则:
|
|
62
|
+
1. **无 RTK 信息**: 默认为 **Z-up** (ENU)。
|
|
63
|
+
2. **有 RTK 信息**: 遵循 **ECEF** 坐标系。
|
|
64
|
+
3. **自动对齐**: Five 加载模型时(load 方法),会自动处理旋转和坐标系转换,将其对齐到 Five 的 Local (Y-up) 坐标系中。
|
|
65
|
+
- 开发者在 `five.scene` 中看到的所有模型都已处于统一的 Y-up 坐标系下。
|
|
66
|
+
|
|
67
|
+
### Coordinate in Files
|
|
68
|
+
在 3D Tiles 的 `tileset.json` 中,`rootMeta` 字段用于描述坐标系转换信息(没有该字段则默认 Z-up):
|
|
69
|
+
- 包含 `pose_ecef_to_enu` 和 `pose_enu_to_ecef` 变换矩阵。
|
|
70
|
+
- Five 读取这些信息来计算并构建完整的坐标转换链, 进行模型-观察点的坐标对齐。
|
|
71
|
+
|
|
72
|
+
在 model 的 `coordinate` 字段用于描述坐标系转换信息(没有该字段则默认 Z-up):
|
|
73
|
+
- 包含 `pose_ecef_to_enu` 和 `pose_enu_to_ecef` 变换矩阵。
|
|
74
|
+
- Five 读取这些信息来计算并构建完整的坐标转换链,确保模型-观察点的坐标对齐。
|
|
75
|
+
|
|
76
|
+
## Instance Methods
|
|
77
|
+
|
|
78
|
+
`ViewLayer` (继承自 `Tile3D`) 提供了成套的坐标转换方法,用于在 Local, ENU, ECEF 和 World 之间进行转换。
|
|
79
|
+
|
|
80
|
+
| 方法名 | 说明 |
|
|
81
|
+
| --- | --- |
|
|
82
|
+
| `localToEnu(vector)` | Local (Y-up) -> ENU (Z-up) |
|
|
83
|
+
| `enuToLocal(vector)` | ENU (Z-up) -> Local (Y-up) |
|
|
84
|
+
| `enuToEcef(vector)` | ENU (Z-up) -> ECEF |
|
|
85
|
+
| `ecefToEnu(vector)` | ECEF -> ENU (Z-up) |
|
|
86
|
+
| `localToEcef(vector)` | Local (Y-up) -> ECEF |
|
|
87
|
+
| `ecefToLocal(vector)` | ECEF -> Local (Y-up) |
|
|
88
|
+
| `worldToEnu(vector)` | World -> ENU (Z-up) |
|
|
89
|
+
| `enuToWorld(vector)` | ENU (Z-up) -> World |
|
|
90
|
+
|
|
91
|
+
> 注: `World` 坐标系通常指 Three.js 的世界坐标 (即 `five.scene` 的坐标)。在未通过 `Object3D` 层级嵌套偏移的情况下,`World` 等同于 `Local`。
|
|
92
|
+
|
|
93
|
+
## Examples
|
|
94
|
+
|
|
95
|
+
### 坐标转换 (Coordinate Transformation)
|
|
96
|
+
|
|
97
|
+
推荐在与后端或算法交互时,将 Local 坐标转换为 ENU 坐标。
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import * as THREE from 'three';
|
|
101
|
+
import { ViewLayer } from '@realsee/five';
|
|
102
|
+
|
|
103
|
+
// 假设已加载 ViewLayer
|
|
104
|
+
const viewLayer: ViewLayer = ...;
|
|
105
|
+
|
|
106
|
+
// 1. 获取场景中某点的坐标 (Local Y-up)
|
|
107
|
+
const localPosition = new THREE.Vector3(10, 20, 30);
|
|
108
|
+
|
|
109
|
+
// 2. 转换为 ENU 坐标 (Z-up) 用于传输给后端/算法
|
|
110
|
+
const enuPosition = viewLayer.localToEnu(localPosition.clone());
|
|
111
|
+
|
|
112
|
+
console.log(`Local: ${localPosition.toArray()}`); // [x, y, z] (y-up)
|
|
113
|
+
console.log(`ENU: ${enuPosition.toArray()}`); // [x, y, z] (z-up)
|
|
114
|
+
|
|
115
|
+
// 3. 将 ECEF 坐标转换为 Local 坐标用于显示
|
|
116
|
+
const ecefPosition = new THREE.Vector3( ... );
|
|
117
|
+
const displayPosition = viewLayer.ecefToLocal(ecefPosition.clone());
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Related
|
|
121
|
+
|
|
122
|
+
* [load-external-model.md](./load-external-model.md): 加载外部模型时的坐标轴配置 (`upAxis`, `modelUpAxis`)。
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
tags: [coordinate-system, enu, ecef, z-up, y-up, transform]
|
|
128
|
+
```
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Events (事件系统)
|
|
2
|
+
|
|
3
|
+
- **Summary**: Five 提供了一套基于发布/订阅模式的事件系统,用于监听用户交互、状态变更、数据加载及渲染生命周期。
|
|
4
|
+
- **Schema**: `on` / `once` / `off` 接口定义。
|
|
5
|
+
- **Concepts**: Gesture Events, State Events, Pano Events, Model Events, Lifecycle Events.
|
|
6
|
+
- **Examples**: 监听全景移动、手势交互及状态变更。
|
|
7
|
+
|
|
8
|
+
## Schema
|
|
9
|
+
|
|
10
|
+
> **Definition**: [Five](../../five/application/five.d.ts), [EventTypes](../../five/application/events.d.ts)
|
|
11
|
+
|
|
12
|
+
Five 实例提供了以下方法来管理事件监听:
|
|
13
|
+
|
|
14
|
+
### on
|
|
15
|
+
注册持久化事件监听器。
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
five.on(
|
|
19
|
+
name: string,
|
|
20
|
+
callback: (...args: any[]) => void,
|
|
21
|
+
once?: boolean
|
|
22
|
+
): () => void
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- **name**: 事件名称(支持的事件见 Concepts)。
|
|
26
|
+
- **callback**: 事件触发时的回调函数。
|
|
27
|
+
- **once**: (可选) 是否仅执行一次,默认为 `false`。
|
|
28
|
+
- **返回**: 一个函数,调用该函数可取消当前监听。
|
|
29
|
+
|
|
30
|
+
### once
|
|
31
|
+
注册一次性事件监听器(触发一次后自动销毁)。
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
five.once(
|
|
35
|
+
name: string,
|
|
36
|
+
callback: (...args: any[]) => void
|
|
37
|
+
): () => void
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### off
|
|
41
|
+
取消事件监听。
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
five.off(
|
|
45
|
+
name?: string,
|
|
46
|
+
callback?: (...args: any[]) => void
|
|
47
|
+
): void
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- **name**: (可选) 若不传,则清空所有事件;若传,则取消指定类型的事件。
|
|
51
|
+
- **callback**: (可选) 若传,则仅取消该特定的回调函数;若不传,则取消该类型下的所有回调。
|
|
52
|
+
|
|
53
|
+
## Concepts
|
|
54
|
+
|
|
55
|
+
Five 的事件系统将事件主要分为以下几类:
|
|
56
|
+
|
|
57
|
+
### Gesture Events (交互手势)
|
|
58
|
+
监听用户的鼠标或触摸操作。
|
|
59
|
+
|
|
60
|
+
- `gesture.tap`: 点击/轻触。
|
|
61
|
+
- `gesture.dbltap`: 双击/双击轻触。
|
|
62
|
+
- `gesture.press`: 长按。
|
|
63
|
+
- `gesture.pan`: 平移/拖拽。
|
|
64
|
+
- `gesture.pinch`: 缩放(双指或滚轮)。
|
|
65
|
+
- `gesture.mousewheel`: 鼠标滚轮滚动。
|
|
66
|
+
- `gesture.mousemove`: 鼠标移动。
|
|
67
|
+
|
|
68
|
+
### Pano Events (全景导航)
|
|
69
|
+
监听全景图的点位切换过程。
|
|
70
|
+
|
|
71
|
+
- `pano.arrived`: 成功到达新点位(移动动画结束)。
|
|
72
|
+
- `pano.moving`: 正在移动到新点位(动画进行中)。
|
|
73
|
+
- `pano.willChange`: 即将发生点位变更(旧版兼容)。
|
|
74
|
+
- `pano.error`: 点位加载或移动出错。
|
|
75
|
+
|
|
76
|
+
### State Events (状态变更)
|
|
77
|
+
监听 Five 内部状态(State)的变化,常用于 UI 同步或数据记录。
|
|
78
|
+
|
|
79
|
+
- `state.change`: 状态发生变更(可能是用户操作或代码触发)。
|
|
80
|
+
- `currentState.change`: 当前状态发生变更(通常指即时状态)。
|
|
81
|
+
- `state.synced`: 状态已同步。
|
|
82
|
+
|
|
83
|
+
### Model & Work Events (数据加载)
|
|
84
|
+
监听场景数据(Work)或模型(Model)的加载生命周期。
|
|
85
|
+
|
|
86
|
+
- `works.load`: Work 数据开始加载。
|
|
87
|
+
- `works.ready`: Work 数据加载完成且 Controller 就绪。
|
|
88
|
+
- `model.load`: 模型开始加载。
|
|
89
|
+
- `models.load`: 所有模型加载完成。
|
|
90
|
+
|
|
91
|
+
### Render Events (渲染循环)
|
|
92
|
+
监听每一帧的渲染过程。
|
|
93
|
+
|
|
94
|
+
- `render`: 每一帧渲染后触发。
|
|
95
|
+
- `render.prepare`: 每一帧渲染前触发。
|
|
96
|
+
|
|
97
|
+
## Examples
|
|
98
|
+
|
|
99
|
+
### 快速上手 (Quick Example)
|
|
100
|
+
监听点击事件并打印日志。
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { Five } from "@realsee/five";
|
|
104
|
+
|
|
105
|
+
const five = new Five();
|
|
106
|
+
|
|
107
|
+
// 监听点击事件
|
|
108
|
+
five.on("gesture.tap", (pose) => {
|
|
109
|
+
console.log("User tapped at:", pose);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// 监听点位变更完成
|
|
113
|
+
five.on("pano.arrived", (index) => {
|
|
114
|
+
console.log("Arrived at pano index:", index);
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 进阶用法 (Advanced Usage)
|
|
119
|
+
使用 `once` 监听一次性初始化事件,使用返回值取消监听。
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
// 1. 等待首次数据加载完成
|
|
123
|
+
five.once("works.ready", () => {
|
|
124
|
+
console.log("Five is ready!");
|
|
125
|
+
// 执行初始化逻辑,如自动巡游
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// 2. 动态绑定与解绑
|
|
129
|
+
const onRender = () => {
|
|
130
|
+
// 每一帧执行的逻辑
|
|
131
|
+
updateUI();
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// 开始监听
|
|
135
|
+
five.on("render", onRender);
|
|
136
|
+
|
|
137
|
+
// 在某个时刻取消监听(例如组件销毁时)
|
|
138
|
+
// five.off("render", onRender);
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Debugging
|
|
142
|
+
|
|
143
|
+
- 使用 `five.on("error", (err) => console.error(err))` 捕获全局错误。
|
|
144
|
+
|
|
145
|
+
## Related
|
|
146
|
+
|
|
147
|
+
- [state.md](./state.md): 了解 State 的结构与变更机制。
|
|
148
|
+
- [five.md](./five.md): Five 核心类说明。
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
```yaml
|
|
153
|
+
tags: [events, interaction, lifecycle, gesture, state]
|
|
154
|
+
```
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Five (Five 核心类)
|
|
2
|
+
|
|
3
|
+
- **Summary**: Five 是 @realsee/five 的核心类,负责 3D 场景的渲染、资源加载、用户交互和状态管理。
|
|
4
|
+
- **Schema**: FiveInitArgs 初始化参数接口。
|
|
5
|
+
- **Concepts**: Instance Management, Rendering Loop, Resource Loading, State Sync.
|
|
6
|
+
- **Configuration**: Five 初始化参数详解。
|
|
7
|
+
- **Examples**: 基础初始化、加载数据、销毁实例。
|
|
8
|
+
|
|
9
|
+
## Schema
|
|
10
|
+
|
|
11
|
+
### FiveInitArgs
|
|
12
|
+
|
|
13
|
+
> **Definition**: [FiveInitArgs](../../five/application/fiveInitArgs.d.ts)
|
|
14
|
+
|
|
15
|
+
`new Five(args)` 的初始化参数对象。
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
interface FiveInitArgs {
|
|
19
|
+
/** 外部传入的渲染器 (如果传入,部分渲染配置将失效) */
|
|
20
|
+
renderer?: THREE.WebGLRenderer;
|
|
21
|
+
/**
|
|
22
|
+
* 屏幕渲染区域 { left, bottom, width, height }
|
|
23
|
+
* 必须配合外部 renderer 使用
|
|
24
|
+
*/
|
|
25
|
+
viewport?: Viewport;
|
|
26
|
+
/** 背景颜色 (默认 0x181A1C) */
|
|
27
|
+
backgroundColor?: number | THREE.Color;
|
|
28
|
+
/** 背景透明度 (0-1, 默认 1) */
|
|
29
|
+
backgroundAlpha?: number;
|
|
30
|
+
/** 是否开启抗锯齿 (默认 false) */
|
|
31
|
+
antialias?: boolean;
|
|
32
|
+
/** 全景图配置 (见 image-options.md) */
|
|
33
|
+
imageOptions?: ImageOptions;
|
|
34
|
+
/** 贴图配置 (见 image-options.md) */
|
|
35
|
+
textureOptions?: TextureOptions;
|
|
36
|
+
/** 是否按需渲染 (默认 true, 推荐开启以节省性能) */
|
|
37
|
+
onlyRenderIfNeeds?: boolean;
|
|
38
|
+
/** 模式切换动画时长 (ms, 默认 1000) */
|
|
39
|
+
modeChangeDuration?: number;
|
|
40
|
+
/** 是否支持滚轮缩放 (默认 true) */
|
|
41
|
+
enableWheel?: boolean;
|
|
42
|
+
/** 插件列表 */
|
|
43
|
+
plugins?: FivePlugin[];
|
|
44
|
+
/** 是否显示 Powered by Realsee */
|
|
45
|
+
poweredByRealsee?: boolean;
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Concepts
|
|
50
|
+
|
|
51
|
+
### Instance Management (实例管理)
|
|
52
|
+
Five 实例是整个 3D 场景的入口。
|
|
53
|
+
- **Singleton-like**: 虽然支持多实例,但在同一个 DOM 容器中通常只维护一个 Five 实例。
|
|
54
|
+
- **Lifecycle**: 包含 `appendTo` (挂载)、`load` (加载数据)、`dispose` (销毁) 等生命周期方法。
|
|
55
|
+
|
|
56
|
+
### Rendering Loop (渲染循环)
|
|
57
|
+
Five 内部维护了一个 `requestAnimationFrame` 循环。
|
|
58
|
+
- **按需渲染**: 默认开启 `onlyRenderIfNeeds`,仅在画面发生变化(如视角移动、数据加载)时才触发 WebGL 绘制,大幅降低能耗。
|
|
59
|
+
- **手动触发**: 可以通过 `five.needsRender = true` 强制下一帧进行渲染。
|
|
60
|
+
|
|
61
|
+
### Resource Loading (资源加载)
|
|
62
|
+
通过 `load()` 方法加载 Work 数据。
|
|
63
|
+
- **数据解析**: 自动解析 Work 数据结构,生成场景图。
|
|
64
|
+
- **预加载**: 支持配置预加载策略,平衡首屏速度与流量。
|
|
65
|
+
|
|
66
|
+
## Configuration
|
|
67
|
+
|
|
68
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
69
|
+
| :--- | :--- | :--- | :--- |
|
|
70
|
+
| `imageOptions` | `ImageOptions` | `{}` | 图片加载策略,详见 [image-options.md](./image-options.md) |
|
|
71
|
+
| `textureOptions` | `TextureOptions` | `{}` | 贴图加载策略,同上 |
|
|
72
|
+
| `onlyRenderIfNeeds` | `boolean` | `true` | 是否仅在需要时渲染,建议保持 `true` |
|
|
73
|
+
| `antialias` | `boolean` | `false` | 抗锯齿,开启会增加性能消耗 |
|
|
74
|
+
| `modeChangeDuration` | `number` | `1000` | 模式切换动画时长 (ms) |
|
|
75
|
+
| `enableWheel` | `boolean` | `true` | 是否支持滚轮缩放 |
|
|
76
|
+
|
|
77
|
+
## Examples
|
|
78
|
+
|
|
79
|
+
### 快速上手 (Quick Example)
|
|
80
|
+
创建一个全屏的 Five 实例并加载数据。
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { Five, parseWork } from "@realsee/five";
|
|
84
|
+
|
|
85
|
+
// 1. 初始化实例
|
|
86
|
+
const five = new Five({
|
|
87
|
+
imageOptions: { size: 512 }, // 初始加载小图
|
|
88
|
+
onlyRenderIfNeeds: true
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// 2. 挂载到 DOM
|
|
92
|
+
five.appendTo(document.getElementById("app"));
|
|
93
|
+
|
|
94
|
+
// 3. 加载数据
|
|
95
|
+
// workData 通常来自服务端 API
|
|
96
|
+
five.load(workData);
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 进阶用法:自定义渲染器与视口
|
|
100
|
+
使用外部渲染器并指定视口区域(例如用于分屏渲染)。
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import * as THREE from "three/webgpu";
|
|
104
|
+
import { Five } from "@realsee/five";
|
|
105
|
+
|
|
106
|
+
const renderer = new THREE.WebGLRenderer();
|
|
107
|
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
|
108
|
+
document.body.appendChild(renderer.domElement);
|
|
109
|
+
|
|
110
|
+
const five = new Five({
|
|
111
|
+
renderer: renderer,
|
|
112
|
+
viewport: { left: 0, bottom: 0, width: 0.5, height: 1 } // 仅占用左半屏
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
five.load(workData);
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 进阶用法:自定义相机动画
|
|
119
|
+
|
|
120
|
+
使用 `updateCamera` 或 `updateCameraWithKeyframes` 实现平滑的视角漫游。
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
// 简单移动到指定视角
|
|
124
|
+
five.updateCamera(
|
|
125
|
+
{ longitude: Math.PI / 2, latitude: 0 }, // 目标姿态
|
|
126
|
+
1000 // 动画时长 1秒
|
|
127
|
+
).then(() => {
|
|
128
|
+
console.log("移动完成");
|
|
129
|
+
}).catch(() => {
|
|
130
|
+
console.log("移动被打断");
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// 复杂关键帧动画
|
|
134
|
+
const keyframes = [
|
|
135
|
+
{ progress: 0, value: { longitude: 0, latitude: 0 } },
|
|
136
|
+
{ progress: 0.5, value: { longitude: Math.PI / 4, latitude: 0.2 } },
|
|
137
|
+
{ progress: 1, value: { longitude: Math.PI / 2, latitude: 0 } }
|
|
138
|
+
];
|
|
139
|
+
|
|
140
|
+
five.updateCameraWithKeyframes(keyframes, 2000).then(() => {
|
|
141
|
+
console.log("关键帧动画完成");
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 实例属性 (Instance Properties)
|
|
146
|
+
|
|
147
|
+
- **`work`**: 当前加载的 Work 数据(主 Work)。详见 [work.md](./work.md)。
|
|
148
|
+
- **`works`**: 当前加载的所有 Work 数据列表。详见 [work.md](./work.md)。
|
|
149
|
+
- **`model`**: 当前加载的 Model 数据(主 Model)。详见 [model.md](./model.md)。
|
|
150
|
+
- **`models`**: 当前加载的所有 Model 数据列表。详见 [model.md](./model.md)。
|
|
151
|
+
|
|
152
|
+
### 实例方法 (Instance Methods)
|
|
153
|
+
|
|
154
|
+
- **`appendTo(element: HTMLElement)`**: 将 canvas 挂载到指定 DOM 元素。
|
|
155
|
+
- **`load(work: Work, state?: State, duration?: number)`**: 加载场景数据。详见 [work.md](./work.md)。
|
|
156
|
+
- **`dispose()`**: 销毁实例,释放 WebGL 上下文与内存。
|
|
157
|
+
- **`updateCamera(pose: Partial<Pose>, duration: number, userAction?: boolean)`**: 移动相机(不触发点位移动)。移动相机的视角或位置,不会改变当前所在的 PanoIndex。如果动画中途被打断,Promise 会被 reject。
|
|
158
|
+
- **`updateCameraWithKeyframes(keyframes: { progress: number; value: Pose; key?: string }[], duration: number, userAction?: boolean)`**: 通过关键帧动画移动相机。
|
|
159
|
+
- **`refresh()`**: 强制刷新画布尺寸。通常在窗口 resize 时调用,Five 会自动监听 resize,但在某些布局变化场景下可能需要手动调用。
|
|
160
|
+
- **`getPixels(x, y, width, height, ...)` / `getPixels(options)`**: 获取画布指定区域的像素数据。常用于截图、生成缩略图或颜色拾取。支持配置区域、像素比 (pixelRatio)、Y轴翻转 (flipY) 及是否忽略全景图 (skipPanorama) 等。
|
|
161
|
+
- **`project2d(vector: THREE.Vector3, testModel?: boolean): THREE.Vector2 | null`**: 计算三维坐标对应到屏幕的二维坐标。如果坐标在视野外或被遮挡(开启 testModel 时),返回 null。详见 [screen-project.md](./screen-project.md)。
|
|
162
|
+
- **`ready(args?: { tile?: boolean })`**: Promise,当 Five 状态稳定时 resolve。
|
|
163
|
+
- **Resolve 时机**:
|
|
164
|
+
1. **状态同步**:相机姿态已通过动画过渡到目标状态(`stateSynced` 为 true)。
|
|
165
|
+
2. **模型加载**:如果是 Floorplan/Topview/Mapview/Model 模态,需等待模型加载完成 (`modelScene.loaded`)。
|
|
166
|
+
3. **瓦片加载**:如果是 Panorama 模态且传入了 `{ tile: true }`,需等待当前视角的瓦片加载完成。
|
|
167
|
+
- **`setState(state: Partial<State>, options?: ChangeStateOptions)`**: 变更当前状态(如点位、视角)。详见 [state.md](./state.md)。
|
|
168
|
+
- **`on(event, callback)` / `off(event, callback)`**: 事件监听。详见 [event.md](./event.md)。
|
|
169
|
+
|
|
170
|
+
## Related
|
|
171
|
+
|
|
172
|
+
* [work.md](./work.md): Work 数据结构说明。
|
|
173
|
+
* [model.md](./model.md): Model 数据结构说明。
|
|
174
|
+
* [state.md](./state.md): 状态管理详解。
|
|
175
|
+
* [event.md](./event.md): 事件系统说明。
|
|
176
|
+
* [image-options.md](./image-options.md): 图片加载配置。
|
|
177
|
+
* [mode.md](./mode.md): 模态切换说明。
|
|
178
|
+
* [parameter.md](./parameter.md): 其他核心参数。
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
```yaml
|
|
183
|
+
tags: [five, initialization, core, instance, lifecycle]
|
|
184
|
+
```
|