@realsee/five 5.0.0-alpha.11 → 5.0.0-alpha.110
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/README.md +75 -63
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +134 -0
- package/docs/assets/icons.css +1043 -0
- package/docs/assets/{images/icons.png → icons.png} +0 -0
- package/docs/assets/{images/icons@2x.png → icons@2x.png} +0 -0
- package/docs/assets/main.js +52 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1388 -0
- package/docs/assets/{images/widgets.png → widgets.png} +0 -0
- package/docs/assets/{images/widgets@2x.png → widgets@2x.png} +0 -0
- package/docs/classes/five.AnimationFrameLoop.html +15 -0
- package/docs/classes/five.BVH.html +10 -0
- package/docs/classes/five.BVHIntersect.html +1 -0
- package/docs/classes/five.BVHNode.html +7 -0
- package/docs/classes/five.BVHVector3.html +1 -0
- package/docs/classes/five.Camera.html +11 -0
- package/docs/classes/five.Five.html +303 -0
- package/docs/classes/five.InternalWebGLRenderer.html +1 -0
- package/docs/classes/five.IntersectMesh.html +1 -0
- package/docs/classes/five.LegacyPanoCircleMesh.html +5 -0
- package/docs/classes/five.Model.html +77 -0
- package/docs/classes/five.NetworkSubscribe.html +50 -0
- package/docs/classes/five.PBMContainer.html +17 -0
- package/docs/classes/five.PBMGroup.html +19 -0
- package/docs/classes/five.PBMMaterial.html +15 -0
- package/docs/classes/five.PBMMesh.html +7 -0
- package/docs/classes/five.PanoCircleMesh.html +7 -0
- package/docs/classes/five.Scene.html +3 -0
- package/docs/classes/five.Subscribe.html +56 -0
- package/docs/classes/five.Work.html +30 -0
- package/docs/classes/gltf_loader.GLTFLoader.html +17 -0
- package/docs/classes/gltf_loader.GLTFObject.html +7 -0
- package/docs/classes/line.Line.html +1 -0
- package/docs/classes/line.LineGeometry.html +1 -0
- package/docs/classes/line.LineMaterial.html +1 -0
- package/docs/classes/line.LineSegmentsGeometry.html +1 -0
- package/docs/classes/line.THREE_Line2.html +1 -0
- package/docs/classes/line.THREE_LineSegments2.html +1 -0
- package/docs/classes/react.Store.html +29 -0
- package/docs/classes/server.BVH.html +10 -0
- package/docs/classes/server.BVHIntersect.html +1 -0
- package/docs/classes/server.BVHNode.html +7 -0
- package/docs/classes/server.BVHVector3.html +1 -0
- package/docs/classes/server.Model.html +63 -0
- package/docs/classes/server.PBMGroup.html +9 -0
- package/docs/classes/server.PBMMesh.html +7 -0
- package/docs/classes/sticker.Sticker.html +32 -0
- package/docs/index.html +166 -420
- package/docs/interfaces/five.AddableObject.html +1 -0
- package/docs/interfaces/five.AnimationFrame.html +1 -0
- package/docs/interfaces/five.CameraPose.html +1 -0
- package/docs/interfaces/five.DepthPanoramaControllerCustomInitArgs.html +28 -0
- package/docs/interfaces/five.EventCallback.html +391 -0
- package/docs/interfaces/five.FiveInitArgs.html +96 -0
- package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +15 -0
- package/docs/interfaces/five.ImageOptions.html +18 -0
- package/docs/interfaces/five.ImageURLOptions.html +15 -0
- package/docs/interfaces/five.IntersectMeshInterface.html +3 -0
- package/docs/interfaces/five.Intersection.html +7 -0
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +20 -0
- package/docs/interfaces/five.ModelEventCallback.html +22 -0
- package/docs/interfaces/five.MovePanoOptions.html +40 -0
- package/docs/interfaces/five.PBMPanoPicture.html +7 -0
- package/docs/interfaces/five.PBMParameters.html +15 -0
- package/docs/interfaces/five.PanoCircleMeshInterface.html +19 -0
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +28 -0
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +20 -0
- package/docs/interfaces/five.Pose.html +35 -0
- package/docs/interfaces/five.Scissor.html +14 -0
- package/docs/interfaces/five.State.html +19 -0
- package/docs/interfaces/five.SubscribeMixinType.emit.html +1 -0
- package/docs/interfaces/five.SubscribeMixinType.hasListener.html +1 -0
- package/docs/interfaces/five.SubscribeMixinType.off.html +1 -0
- package/docs/interfaces/five.SubscribeMixinType.on.html +1 -0
- package/docs/interfaces/five.SubscribeMixinType.once.html +1 -0
- package/docs/interfaces/five.TextureOptions.html +20 -0
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +7 -0
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +24 -0
- package/docs/interfaces/five.WorkCubeImage.html +13 -0
- package/docs/interfaces/five.WorkImage.html +21 -0
- package/docs/interfaces/five.WorkInitial.html +13 -0
- package/docs/interfaces/five.WorkModel.html +11 -0
- package/docs/interfaces/five.WorkObserver.html +25 -0
- package/docs/interfaces/five.WorkTile.html +1 -0
- package/docs/interfaces/five.WorkVideo.html +9 -0
- package/docs/interfaces/gltf_loader.GLTF.html +7 -0
- package/docs/interfaces/react.FiveActionReactCallbacks.html +62 -0
- package/docs/interfaces/react.FiveInjectionTypes.html +191 -0
- package/docs/interfaces/react.PropTypeOfFiveFeatures.html +1 -0
- package/docs/interfaces/server.Intersection.html +7 -0
- package/docs/interfaces/server.ModelEventCallback.html +18 -0
- package/docs/interfaces/sticker.IntersectionLike.html +8 -0
- package/docs/modules/five.SubscribeMixinType.html +1 -0
- package/docs/modules/five.html +481 -0
- package/docs/modules/gltf_loader.html +1 -0
- package/docs/modules/line.html +1 -0
- package/docs/modules/react.html +130 -941
- package/docs/modules/server.html +18 -0
- package/docs/modules/sticker.html +1 -0
- package/docs/modules.html +1 -119
- package/exporters/staticify.js +203 -0
- package/five/index.d.ts +2073 -0
- package/five/index.js +372 -0
- package/gltf-loader/index.d.ts +75 -0
- package/gltf-loader/index.js +260 -0
- package/line/index.d.ts +68 -0
- package/line/index.js +260 -0
- package/package.json +19 -17
- package/react/index.d.ts +812 -17
- package/react/index.js +260 -1
- package/resource/{basis_transcoder.js → basis/basis_transcoder.js} +0 -0
- package/resource/{basis_transcoder.wasm → basis/basis_transcoder.wasm} +0 -0
- package/resource/gltf/draco_decoder.js +31 -0
- package/resource/gltf/draco_decoder.wasm +0 -0
- package/resource/gltf/draco_wasm_wrapper.js +119 -0
- package/scripts/five-staticify.js +21 -0
- package/server/index.d.ts +568 -5
- package/server/index.js +367 -1
- package/sticker/index.d.ts +70 -0
- package/sticker/index.js +260 -0
- package/templates/plugin/examples/index.html +1 -1
- package/templates/quick-start/README.md +1 -1
- package/templates/quick-start/index.tsx +1 -1
- package/templates/quick-start/package.json +1 -1
- package/templates/react-component/examples/index.html +1 -1
- package/templates/react-component/examples/index.tsx +4 -4
- package/templates/react-component/lib/index.tsx +5 -5
- package/umd/five-gltf-loader.js +2 -0
- package/umd/five-gltf-loader.js.LICENSE.txt +14 -0
- package/umd/five-line.js +2 -0
- package/umd/five-line.js.LICENSE.txt +14 -0
- package/umd/five-react.js +2 -0
- package/umd/five-react.js.LICENSE.txt +14 -0
- package/umd/five-sticker.js +2 -0
- package/umd/five-sticker.js.LICENSE.txt +14 -0
- package/umd/five.js +2 -0
- package/umd/five.js.LICENSE.txt +116 -0
- package/application/constant.d.ts +0 -6
- package/application/constant.js +0 -1
- package/application/controllers.d.ts +0 -31
- package/application/controllers.js +0 -1
- package/application/events.d.ts +0 -140
- package/application/events.js +0 -1
- package/application/five.d.ts +0 -418
- package/application/five.js +0 -1
- package/application/fiveInitArgs.d.ts +0 -157
- package/application/fiveInitArgs.js +0 -1
- package/application/generateDefaultVideoElement.d.ts +0 -2
- package/application/generateDefaultVideoElement.js +0 -1
- package/application/getViewportScale.d.ts +0 -2
- package/application/getViewportScale.js +0 -1
- package/application/initLights.d.ts +0 -3
- package/application/initLights.js +0 -1
- package/bundles/five.js +0 -2
- package/bundles/five.js.LICENSE.txt +0 -160
- package/controllers/base.d.ts +0 -80
- package/controllers/base.js +0 -1
- package/controllers/depthPanorama.d.ts +0 -40
- package/controllers/depthPanorama.js +0 -1
- package/controllers/events.d.ts +0 -273
- package/controllers/events.js +0 -1
- package/controllers/floorplan.d.ts +0 -102
- package/controllers/floorplan.js +0 -1
- package/controllers/model.d.ts +0 -23
- package/controllers/model.js +0 -1
- package/controllers/panorama.d.ts +0 -69
- package/controllers/panorama.js +0 -1
- package/controllers/panoramaLike.d.ts +0 -88
- package/controllers/panoramaLike.js +0 -1
- package/controllers/topview.d.ts +0 -28
- package/controllers/topview.js +0 -1
- package/controllers/vrPanorama.d.ts +0 -40
- package/controllers/vrPanorama.js +0 -1
- package/core/camera.d.ts +0 -15
- package/core/camera.js +0 -1
- package/core/cubeTexture.d.ts +0 -6
- package/core/cubeTexture.js +0 -1
- package/core/internalWebGLRenderer.d.ts +0 -11
- package/core/internalWebGLRenderer.js +0 -1
- package/core/pbmGroup.d.ts +0 -22
- package/core/pbmGroup.js +0 -1
- package/core/pbmMaterial.d.ts +0 -39
- package/core/pbmMaterial.js +0 -1
- package/core/pbmMesh.d.ts +0 -10
- package/core/pbmMesh.js +0 -1
- package/core/pbmParameters.d.ts +0 -36
- package/core/pbmParameters.js +0 -1
- package/core/scene.d.ts +0 -5
- package/core/scene.js +0 -1
- package/core/subscribe.d.ts +0 -76
- package/core/subscribe.js +0 -1
- package/core/updatableTexture.d.ts +0 -12
- package/core/updatableTexture.js +0 -1
- package/docs/assets/css/main.css +0 -2660
- package/docs/assets/js/main.js +0 -248
- package/docs/assets/js/search.js +0 -1
- package/docs/classes/index.five.html +0 -2567
- package/docs/classes/index.fivecamera.html +0 -427
- package/docs/classes/index.fiveline.html +0 -458
- package/docs/classes/index.fivescene.html +0 -302
- package/docs/classes/index.internalwebglrenderer.html +0 -316
- package/docs/classes/index.model.html +0 -999
- package/docs/classes/index.pbmgroup.html +0 -531
- package/docs/classes/index.pbmmaterial.html +0 -637
- package/docs/classes/index.pbmmesh.html +0 -358
- package/docs/classes/index.subscribe.html +0 -672
- package/docs/interfaces/index.depthpanoramacontrollercustominitargs.html +0 -524
- package/docs/interfaces/index.fiveeventcallback.html +0 -2568
- package/docs/interfaces/index.fiveinitargs.html +0 -811
- package/docs/interfaces/index.floorplancontrollercustominitargs.html +0 -399
- package/docs/interfaces/index.imageoptions.html +0 -436
- package/docs/interfaces/index.intersection.html +0 -331
- package/docs/interfaces/index.intersectmeshinterface.html +0 -292
- package/docs/interfaces/index.modelcontrollercustominitargs.html +0 -470
- package/docs/interfaces/index.modeleventcallback.html +0 -432
- package/docs/interfaces/index.movepanooptions.html +0 -573
- package/docs/interfaces/index.panocirclemeshinterface.html +0 -465
- package/docs/interfaces/index.panoramacontrollercustominitargs.html +0 -549
- package/docs/interfaces/index.panoramalikecontrollercustominitargs.html +0 -468
- package/docs/interfaces/index.pbmparameters.html +0 -578
- package/docs/interfaces/index.pose.html +0 -374
- package/docs/interfaces/index.scissor.html +0 -356
- package/docs/interfaces/index.state.html +0 -404
- package/docs/interfaces/index.topviewcontrollercustominitargs.html +0 -330
- package/docs/interfaces/index.vrpanoramacontrollercustominitargs.html +0 -536
- package/docs/interfaces/react.fiveactionreactcallbacks.html +0 -530
- package/docs/interfaces/react.injectfivetoprops.html +0 -231
- package/docs/modules/index.html +0 -925
- package/five.js.LICENSE.txt +0 -160
- package/index.d.ts +0 -33
- package/index.js +0 -1
- package/loaders/basis/BasisTextureLoader.d.ts +0 -116
- package/loaders/basis/BasisTextureLoader.js +0 -1
- package/loaders/basis/index.d.ts +0 -3
- package/loaders/basis/index.js +0 -1
- package/loaders/cubeTexture/imagePool.d.ts +0 -7
- package/loaders/cubeTexture/imagePool.js +0 -1
- package/loaders/cubeTexture/index.d.ts +0 -58
- package/loaders/cubeTexture/index.js +0 -1
- package/loaders/depthTexture/index.d.ts +0 -60
- package/loaders/depthTexture/index.js +0 -1
- package/loaders/model/at3d.d.ts +0 -7
- package/loaders/model/at3d.js +0 -1
- package/loaders/model/dome.d.ts +0 -14
- package/loaders/model/dome.js +0 -1
- package/loaders/model/domez.d.ts +0 -7
- package/loaders/model/domez.js +0 -1
- package/loaders/model/index.d.ts +0 -135
- package/loaders/model/index.js +0 -1
- package/loaders/model/pbm.d.ts +0 -27
- package/loaders/model/pbm.js +0 -1
- package/loaders/model/tools/bvhtree/index.d.ts +0 -2
- package/loaders/model/tools/bvhtree/index.js +0 -1
- package/loaders/model/tools/lzma/index.d.ts +0 -2
- package/loaders/model/tools/lzma/index.js +0 -1
- package/loaders/model/tools/lzma/lzma-caller.d.ts +0 -13
- package/loaders/model/tools/lzma/lzma-caller.js +0 -1
- package/loaders/model/tools/lzma/lzma.d.ts +0 -2
- package/loaders/model/tools/lzma/lzma.js +0 -1
- package/loaders/model/tools/lzma/lzmaWorker.d.ts +0 -1
- package/loaders/model/tools/lzma/lzmaWorker.js +0 -1
- package/loaders/tileTexture/index.d.ts +0 -26
- package/loaders/tileTexture/index.js +0 -1
- package/meshes/boundingMesh.d.ts +0 -9
- package/meshes/boundingMesh.js +0 -1
- package/meshes/intersectMesh.d.ts +0 -11
- package/meshes/intersectMesh.js +0 -1
- package/meshes/panoCircleMesh.d.ts +0 -29
- package/meshes/panoCircleMesh.js +0 -1
- package/meshes/panoSphereMesh.d.ts +0 -16
- package/meshes/panoSphereMesh.js +0 -1
- package/objects/line/circle_png.d.ts +0 -1
- package/objects/line/circle_png.js +0 -1
- package/objects/line/index.d.ts +0 -12
- package/objects/line/index.js +0 -1
- package/objects/line/utils/Line2.d.ts +0 -7
- package/objects/line/utils/Line2.js +0 -1
- package/objects/line/utils/LineGeometry.d.ts +0 -10
- package/objects/line/utils/LineGeometry.js +0 -1
- package/objects/line/utils/LineMaterial.d.ts +0 -20
- package/objects/line/utils/LineMaterial.js +0 -1
- package/objects/line/utils/LineSegments2.d.ts +0 -11
- package/objects/line/utils/LineSegments2.js +0 -1
- package/objects/line/utils/LineSegmentsGeometry.d.ts +0 -15
- package/objects/line/utils/LineSegmentsGeometry.js +0 -1
- package/react/canvas.d.ts +0 -19
- package/react/canvas.js +0 -1
- package/react/context.d.ts +0 -9
- package/react/context.js +0 -1
- package/react/createProvider.d.ts +0 -65
- package/react/createProvider.js +0 -1
- package/react/createStore.d.ts +0 -138
- package/react/createStore.js +0 -1
- package/react/hooks/unsafe__useFiveInstance.d.ts +0 -9
- package/react/hooks/unsafe__useFiveInstance.js +0 -1
- package/react/hooks/useFiveAction.d.ts +0 -154
- package/react/hooks/useFiveAction.js +0 -1
- package/react/hooks/useFiveCameraDirection.d.ts +0 -7
- package/react/hooks/useFiveCameraDirection.js +0 -1
- package/react/hooks/useFiveCameraRaycaster.d.ts +0 -7
- package/react/hooks/useFiveCameraRaycaster.js +0 -1
- package/react/hooks/useFiveCurrentState.d.ts +0 -15
- package/react/hooks/useFiveCurrentState.js +0 -1
- package/react/hooks/useFiveEvent.d.ts +0 -12
- package/react/hooks/useFiveEvent.js +0 -1
- package/react/hooks/useFiveModelIntersectRaycaster.d.ts +0 -21
- package/react/hooks/useFiveModelIntersectRaycaster.js +0 -1
- package/react/hooks/useFiveModelReadyState.d.ts +0 -8
- package/react/hooks/useFiveModelReadyState.js +0 -1
- package/react/hooks/useFiveProject2d.d.ts +0 -20
- package/react/hooks/useFiveProject2d.js +0 -1
- package/react/hooks/useFiveScene.d.ts +0 -16
- package/react/hooks/useFiveScene.js +0 -1
- package/react/hooks/useFiveState.d.ts +0 -6
- package/react/hooks/useFiveState.js +0 -1
- package/react/hooks/useFiveWork.d.ts +0 -30
- package/react/hooks/useFiveWork.js +0 -1
- package/react/rendererPool.d.ts +0 -8
- package/react/rendererPool.js +0 -1
- package/react/withFive.d.ts +0 -239
- package/react/withFive.js +0 -1
- package/scripts/export-five-resource/chfs.exe +0 -0
- package/scripts/export-five-resource/fileify.js +0 -192
- package/scripts/export-five-resource/format-work.js +0 -71
- package/scripts/export-five-resource/staticify.js +0 -327
- package/scripts/transcode-model/BufferGeometryUtils.js +0 -832
- package/scripts/transcode-model/LoaderSupport.js +0 -1545
- package/scripts/transcode-model/MTLLoader.js +0 -602
- package/scripts/transcode-model/OBJLoader2.js +0 -1470
- package/scripts/transcode-model/obj2pbm.js +0 -65
- package/server/core/pbmGroup.d.ts +0 -11
- package/server/core/pbmGroup.js +0 -1
- package/server/core/pbmMesh.d.ts +0 -9
- package/server/core/pbmMesh.js +0 -1
- package/server/model/at3d.d.ts +0 -5
- package/server/model/at3d.js +0 -1
- package/server/model/dome.d.ts +0 -11
- package/server/model/dome.js +0 -1
- package/server/model/domez.d.ts +0 -5
- package/server/model/domez.js +0 -1
- package/server/model/index.d.ts +0 -134
- package/server/model/index.js +0 -1
- package/server/model/pbm.d.ts +0 -24
- package/server/model/pbm.js +0 -1
- package/server/model/tools/bvhtree/index.d.ts +0 -2
- package/server/model/tools/bvhtree/index.js +0 -1
- package/server/model/tools/fetchArraybuffer.d.ts +0 -2
- package/server/model/tools/fetchArraybuffer.js +0 -1
- package/server/model/tools/lzma/index.d.ts +0 -2
- package/server/model/tools/lzma/index.js +0 -1
- package/server/model/tools/lzma/lzma.d.ts +0 -2
- package/server/model/tools/lzma/lzma.js +0 -1
- package/shaders/depth/fragment.d.ts +0 -2
- package/shaders/depth/fragment.js +0 -1
- package/shaders/depth/vertex.d.ts +0 -2
- package/shaders/depth/vertex.js +0 -1
- package/shaders/pbm/fragment.d.ts +0 -2
- package/shaders/pbm/fragment.js +0 -1
- package/shaders/pbm/vertex.d.ts +0 -2
- package/shaders/pbm/vertex.js +0 -1
- package/three-version-check.d.ts +0 -1
- package/three-version-check.js +0 -1
- package/types/imageOptions.d.ts +0 -24
- package/types/imageOptions.js +0 -1
- package/types/mode.d.ts +0 -23
- package/types/mode.js +0 -1
- package/types/movePanoOptions.d.ts +0 -40
- package/types/movePanoOptions.js +0 -1
- package/types/plugin.d.ts +0 -26
- package/types/plugin.js +0 -1
- package/types/pose.d.ts +0 -16
- package/types/pose.js +0 -1
- package/types/scissor.d.ts +0 -18
- package/types/scissor.js +0 -1
- package/types/state.d.ts +0 -18
- package/types/state.js +0 -1
- package/utils/BufferGeometryUtils.d.ts +0 -31
- package/utils/BufferGeometryUtils.js +0 -1
- package/utils/ajax.d.ts +0 -13
- package/utils/ajax.js +0 -1
- package/utils/animationFrame.d.ts +0 -24
- package/utils/animationFrame.js +0 -1
- package/utils/arrayMax.d.ts +0 -10
- package/utils/arrayMax.js +0 -1
- package/utils/arrayMin.d.ts +0 -11
- package/utils/arrayMin.js +0 -1
- package/utils/busy.d.ts +0 -13
- package/utils/busy.js +0 -1
- package/utils/calculateProgress.d.ts +0 -37
- package/utils/calculateProgress.js +0 -1
- package/utils/calculateThreeMouse.d.ts +0 -13
- package/utils/calculateThreeMouse.js +0 -1
- package/utils/cameraWorldToLocal.d.ts +0 -13
- package/utils/cameraWorldToLocal.js +0 -1
- package/utils/coordinatesToVector.d.ts +0 -7
- package/utils/coordinatesToVector.js +0 -1
- package/utils/createImage.d.ts +0 -2
- package/utils/createImage.js +0 -1
- package/utils/detector.d.ts +0 -13
- package/utils/detector.js +0 -1
- package/utils/formatRad.d.ts +0 -7
- package/utils/formatRad.js +0 -1
- package/utils/headingToLongitude.d.ts +0 -6
- package/utils/headingToLongitude.js +0 -1
- package/utils/imageLoader.d.ts +0 -10
- package/utils/imageLoader.js +0 -1
- package/utils/imageURL.d.ts +0 -9
- package/utils/imageURL.js +0 -1
- package/utils/isAbsoluteURL.d.ts +0 -6
- package/utils/isAbsoluteURL.js +0 -1
- package/utils/isNil.d.ts +0 -6
- package/utils/isNil.js +0 -1
- package/utils/longitudeToHeading.d.ts +0 -6
- package/utils/longitudeToHeading.js +0 -1
- package/utils/mouseWheel.d.ts +0 -17
- package/utils/mouseWheel.js +0 -1
- package/utils/noop.d.ts +0 -6
- package/utils/noop.js +0 -1
- package/utils/now.d.ts +0 -5
- package/utils/now.js +0 -1
- package/utils/preload.d.ts +0 -5
- package/utils/preload.js +0 -1
- package/utils/tween.d.ts +0 -88
- package/utils/tween.js +0 -1
- package/utils/uuid.d.ts +0 -5
- package/utils/uuid.js +0 -1
- package/utils/vectorTocoordinates.d.ts +0 -7
- package/utils/vectorTocoordinates.js +0 -1
- package/utils/webglError.d.ts +0 -7
- package/utils/webglError.js +0 -1
- package/webvr/helper.img.d.ts +0 -1
- package/webvr/helper.img.js +0 -1
- package/webvr/vrEffect.d.ts +0 -13
- package/webvr/vrEffect.js +0 -1
- package/work/index.d.ts +0 -5
- package/work/index.js +0 -1
- package/work/looseWorkType.d.ts +0 -61
- package/work/looseWorkType.js +0 -1
- package/work/parse.d.ts +0 -4
- package/work/parse.js +0 -1
- package/work/stringify.d.ts +0 -4
- package/work/stringify.js +0 -1
- package/work/workType.d.ts +0 -49
- package/work/workType.js +0 -1
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Work } from "@realsee/five";
|
|
2
|
-
import { useFiveWorkLoader } from "../context";
|
|
3
|
-
/**
|
|
4
|
-
* Five React Hooks: 获取/设置当前的 Work
|
|
5
|
-
*
|
|
6
|
-
* @returns
|
|
7
|
-
* [ work: 获取当前的 Work, loadWork: 设置 Work ]
|
|
8
|
-
|
|
9
|
-
* @function loadWork
|
|
10
|
-
* ```
|
|
11
|
-
* 加载 Work 数据
|
|
12
|
-
* // param work Work 数据
|
|
13
|
-
* // param state 初始化姿态
|
|
14
|
-
* // - "inherit" 使用当前姿态
|
|
15
|
-
* // - "initial" 使用 Work 数据中的 initial 姿态
|
|
16
|
-
* // - State 自定义姿态
|
|
17
|
-
* // param duration 切换时间
|
|
18
|
-
* (work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number) => void
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```
|
|
23
|
-
* const [ work, loadWork ] = useFiveWork;
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
declare function useFiveWork(): [
|
|
27
|
-
work: Work,
|
|
28
|
-
loadWork: ReturnType<typeof useFiveWorkLoader>
|
|
29
|
-
];
|
|
30
|
-
export { useFiveWork };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useFiveWork=void 0;var e=require("tslib").__importStar(require("react")),r=require("../context");exports.useFiveWork=function(){var t=r.useFiveInstance(),o=r.useFiveWorkLoader(),u=e.useState((function(){return t.work})),n=u[0],i=u[1];return e.useLayoutEffect((function(){return t.on("load",(function(){return i(t.work)}))}),[t]),[n,o]};
|
package/react/rendererPool.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
declare function getRenderer({ backgroundColor, backgroundAlpha, pixelRatio, }?: {
|
|
3
|
-
backgroundColor?: number;
|
|
4
|
-
backgroundAlpha?: number;
|
|
5
|
-
pixelRatio?: number;
|
|
6
|
-
}): THREE.WebGLRenderer;
|
|
7
|
-
declare function revokeRenderer(renderer: THREE.WebGLRenderer): void;
|
|
8
|
-
export { getRenderer, revokeRenderer };
|
package/react/rendererPool.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.revokeRenderer=exports.getRenderer=void 0;var e=require("tslib").__importStar(require("three")),r=[];exports.getRenderer=function(o){var t=void 0===o?{}:o,i=t.backgroundColor,a=void 0===i?1579548:i,n=t.backgroundAlpha,d=void 0===n?1:n,s=t.pixelRatio,l=void 0===s?1:s,u=r.shift();return u||(u=new e.WebGLRenderer({antialias:!1,alpha:!0})),u.setPixelRatio(l),u.setClearColor(a,d),u.autoClear=!0,u},exports.revokeRenderer=function(e){-1===r.indexOf(e)&&r.push(e)};
|
package/react/withFive.d.ts
DELETED
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import * as THREE from "three";
|
|
3
|
-
import { useFiveWorkLoader } from "./context";
|
|
4
|
-
import { Five, Model } from "@realsee/five";
|
|
5
|
-
declare const INJECT_SYMBOL = "$five";
|
|
6
|
-
declare type DataFeature = "unsafe__fiveInstance" | "currentState" | "state" | "work" | "scene" | "cameraDirection" | "cameraRaycaster" | "modelReadyState";
|
|
7
|
-
declare type ActionFeature = "loadWork" | "setState" | "on" | "off" | "intersectRaycaster" | "project2d" | "updateCamera" | "initBasisLoader" | "getPixels" | "render" | "needsRender" | "preloadPano";
|
|
8
|
-
declare type Feature = DataFeature | ActionFeature;
|
|
9
|
-
declare function useFiveState(five: Five, features: Feature[]): readonly [{
|
|
10
|
-
mode: import("../types/mode").Mode;
|
|
11
|
-
panoIndex: number;
|
|
12
|
-
longitude: number;
|
|
13
|
-
latitude: number;
|
|
14
|
-
fov: number;
|
|
15
|
-
offset: THREE.Vector3;
|
|
16
|
-
}, symbol];
|
|
17
|
-
declare function useFiveCurrentState(five: Five, features: Feature[]): readonly [import("../types/state").State, symbol];
|
|
18
|
-
declare function useUnsafe__fiveInstance(five: Five, features: Feature[]): readonly [Five];
|
|
19
|
-
declare function useFiveWork(five: Five, features: Feature[]): readonly [import("../work/workType").Work, symbol];
|
|
20
|
-
declare function useLoadWork(loadWork: ReturnType<typeof useFiveWorkLoader>, features: Feature[]): undefined | ReturnType<typeof useFiveWorkLoader>;
|
|
21
|
-
declare function useSetState(five: Five, features: Feature[]): undefined | Five["setState"];
|
|
22
|
-
declare function useOn(five: Five, features: Feature[]): undefined | Five["on"];
|
|
23
|
-
declare function useOnce(five: Five, features: Feature[]): undefined | Five["once"];
|
|
24
|
-
declare function useOff(five: Five, features: Feature[]): undefined | Five["off"];
|
|
25
|
-
declare function useModelIntersectRaycaster(five: Five, features: Feature[]): undefined | Model["intersectRaycaster"];
|
|
26
|
-
declare function useProject2d(five: Five, features: Feature[]): undefined | Five["project2d"];
|
|
27
|
-
declare function useUpdateCamera(five: Five, features: Feature[]): undefined | Five["updateCamera"];
|
|
28
|
-
declare function useInitBasisLoader(five: Five, features: Feature[]): undefined | Five["initBasisLoader"];
|
|
29
|
-
declare function useGetPixels(five: Five, features: Feature[]): undefined | Five["getPixels"];
|
|
30
|
-
declare function useRender(five: Five, features: Feature[]): undefined | Five["render"];
|
|
31
|
-
declare function useNeedsRender(five: Five, features: Feature[]): undefined | (() => void);
|
|
32
|
-
declare function usePreloadPano(five: Five, features: Feature[]): undefined | Five["preloadPano"];
|
|
33
|
-
interface InjectFive extends Record<Feature, any> {
|
|
34
|
-
/**
|
|
35
|
-
* Five React Inject: 获取 five 实例
|
|
36
|
-
* @description
|
|
37
|
-
* 不到万不得已,并不推荐直接使用。
|
|
38
|
-
* @deprecated
|
|
39
|
-
*/
|
|
40
|
-
unsafe__fiveInstance: NonNullable<ReturnType<typeof useUnsafe__fiveInstance>[0]>;
|
|
41
|
-
/**
|
|
42
|
-
* Five React Inject: Five 的目标状态
|
|
43
|
-
* @description
|
|
44
|
-
* ```text
|
|
45
|
-
* five 设置了以下状态
|
|
46
|
-
*
|
|
47
|
-
* - mode: Mode
|
|
48
|
-
* - panoIndex: number
|
|
49
|
-
* - longitude: number
|
|
50
|
-
* - latitude: number
|
|
51
|
-
* - fov: number
|
|
52
|
-
* - offset: THREE.Vector3
|
|
53
|
-
*
|
|
54
|
-
* 可以通过 state, currentState 和 setState 来获取和设置。
|
|
55
|
-
* 通过 state 设置后,five 会通过合适的动画运动来达到设置的位置。
|
|
56
|
-
* 来迎合一些通过数据驱动的场景。
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
state: NonNullable<ReturnType<typeof useFiveState>[0]>;
|
|
60
|
-
/**
|
|
61
|
-
* Five React Inject: Five 的当前状态
|
|
62
|
-
* @description
|
|
63
|
-
* ```text
|
|
64
|
-
* five 设置了以下状态
|
|
65
|
-
*
|
|
66
|
-
* - mode: Mode
|
|
67
|
-
* - panoIndex: number
|
|
68
|
-
* - longitude: number
|
|
69
|
-
* - latitude: number
|
|
70
|
-
* - fov: number
|
|
71
|
-
* - offset: THREE.Vector3
|
|
72
|
-
*
|
|
73
|
-
* 可以通过 state, currentState 和 setState 来获取和设置。
|
|
74
|
-
* 通过 state 设置后,five 会通过合适的动画运动来达到设置的位置。
|
|
75
|
-
* 来迎合一些通过数据驱动的场景。
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
currentState: NonNullable<ReturnType<typeof useFiveCurrentState>[0]>;
|
|
79
|
-
/**
|
|
80
|
-
* Five React Inject: Five Work
|
|
81
|
-
*/
|
|
82
|
-
work: NonNullable<ReturnType<typeof useFiveWork>[0]>;
|
|
83
|
-
/**
|
|
84
|
-
* 设置 State
|
|
85
|
-
* @description
|
|
86
|
-
* ```text
|
|
87
|
-
* five 设置了以下状态
|
|
88
|
-
*
|
|
89
|
-
* - mode: Mode
|
|
90
|
-
* - panoIndex: number
|
|
91
|
-
* - longitude: number
|
|
92
|
-
* - latitude: number
|
|
93
|
-
* - fov: number
|
|
94
|
-
* - offset: THREE.Vector3
|
|
95
|
-
*
|
|
96
|
-
* 可以通过 state, currentState 和 setState 来获取和设置。
|
|
97
|
-
* 通过 state 设置后,five 会通过合适的动画运动来达到设置的位置。
|
|
98
|
-
* 来迎合一些通过数据驱动的场景。
|
|
99
|
-
*
|
|
100
|
-
* @param state 目标状态
|
|
101
|
-
* @param immediately 是否马上转换,马上转换会尽快达到目标状态,尽量减少中间状态,更少动画。
|
|
102
|
-
*/
|
|
103
|
-
setState: NonNullable<ReturnType<typeof useSetState>>;
|
|
104
|
-
/**
|
|
105
|
-
* 加载 Work 数据
|
|
106
|
-
* @param inputWork Work 数据
|
|
107
|
-
* @param state 初始化姿态
|
|
108
|
-
* - "inherit" 使用当前姿态
|
|
109
|
-
* - "initial" 使用 Work 数据中的 initial 姿态
|
|
110
|
-
* - State 自定义姿态
|
|
111
|
-
* @param duration 切换时间
|
|
112
|
-
*/
|
|
113
|
-
loadWork: NonNullable<ReturnType<typeof useLoadWork>>;
|
|
114
|
-
/**
|
|
115
|
-
* 监听事件
|
|
116
|
-
* @param name 事件名 具体事件列表 请查看 {@link FiveEventCallback}
|
|
117
|
-
* @param callback 回调函数
|
|
118
|
-
* @param once 是否一次触发
|
|
119
|
-
* @returns 解除事件绑定
|
|
120
|
-
* @example
|
|
121
|
-
* ```
|
|
122
|
-
* $five.on("panoArrived", () => {});
|
|
123
|
-
* ```
|
|
124
|
-
*/
|
|
125
|
-
on: NonNullable<ReturnType<typeof useOn>>;
|
|
126
|
-
/**
|
|
127
|
-
* 监听事件一次触发
|
|
128
|
-
* @param name 事件名 具体事件列表 请查看 {@link FiveEventCallback}
|
|
129
|
-
* @param callback 回调函数
|
|
130
|
-
* @returns 解除事件绑定
|
|
131
|
-
* @example
|
|
132
|
-
* ```
|
|
133
|
-
* $five.once("panoArrived", () => {});
|
|
134
|
-
* ```
|
|
135
|
-
*/
|
|
136
|
-
once: NonNullable<ReturnType<typeof useOnce>>;
|
|
137
|
-
/**
|
|
138
|
-
* 解除事件绑定
|
|
139
|
-
* @param name 事件名 具体事件列表 请查看 {@link FiveEventCallback}
|
|
140
|
-
* @param callback 回调函数
|
|
141
|
-
* @example
|
|
142
|
-
* ```
|
|
143
|
-
* $five.off("panoArrived", () => {});
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
off: NonNullable<ReturnType<typeof useOff>>;
|
|
147
|
-
/**
|
|
148
|
-
* 计算模型射线碰撞检测
|
|
149
|
-
* @param raycaster THREE 射线对象
|
|
150
|
-
* @param floors 和某一楼层做碰撞检测, 不传为和所有楼层做碰撞检测
|
|
151
|
-
* @returns 返回碰撞
|
|
152
|
-
*/
|
|
153
|
-
intersectRaycaster: NonNullable<ReturnType<typeof useModelIntersectRaycaster>>;
|
|
154
|
-
/**
|
|
155
|
-
* 计算三维坐标对应到屏幕的二维坐标
|
|
156
|
-
* @description
|
|
157
|
-
* 如果三维坐标不在屏幕中,则返回 null
|
|
158
|
-
* @param vector 三维坐标
|
|
159
|
-
* @param testModel 是否计算模型遮挡
|
|
160
|
-
* @returns 二维坐标 或者 null
|
|
161
|
-
*/
|
|
162
|
-
project2d: NonNullable<ReturnType<typeof useProject2d>>;
|
|
163
|
-
/**
|
|
164
|
-
* 移动相机。(不触发点位移动)
|
|
165
|
-
* @description
|
|
166
|
-
* 如果动画中途被打断(用户触发行为,或者调用 setState, load, changeMode)的等
|
|
167
|
-
* 会 Promise.reject。运动完成则 Promise.resolve
|
|
168
|
-
* @param pose 相机目标位置
|
|
169
|
-
* @param duration 动画触发的时常
|
|
170
|
-
* @returns Promise 是否移动成功
|
|
171
|
-
*/
|
|
172
|
-
updateCamera: NonNullable<ReturnType<typeof useUpdateCamera>>;
|
|
173
|
-
/**
|
|
174
|
-
* 初始化 initBasisLoader
|
|
175
|
-
* @description
|
|
176
|
-
* 同初始化的 initBasisLoader 参数。用于初始化 basisLoader。
|
|
177
|
-
* basisLoader 只会初始化一次,一旦初始化则不会再修改。
|
|
178
|
-
*
|
|
179
|
-
* @param transcoderResourcePath
|
|
180
|
-
* 如果不设置,使用默认解析器 basis 解析器。
|
|
181
|
-
* 可以传入解析器的 `resourcePath`, 则使用指定的解析器
|
|
182
|
-
* @example
|
|
183
|
-
* ```
|
|
184
|
-
* // 使用默认解析器
|
|
185
|
-
* five.initialBasisLoader();
|
|
186
|
-
*
|
|
187
|
-
* // 使用指定解析器
|
|
188
|
-
* // 会调用这个目录下的 basis_transcoder.js basis_transcoder.wasm 文件作为解析器
|
|
189
|
-
* five.initialBasisLoader("https://vrlab-public.ljcdn.com/release/static/image/release/five/basis/");
|
|
190
|
-
* ```
|
|
191
|
-
*/
|
|
192
|
-
initBasisLoader: NonNullable<ReturnType<typeof useInitBasisLoader>>;
|
|
193
|
-
/**
|
|
194
|
-
* 获取画面中的像素颜色
|
|
195
|
-
* @param x 获取像素区域的起始坐标 x
|
|
196
|
-
* @param y 获取像素区域的起始坐标 y
|
|
197
|
-
* @param width 获取像素区域的宽度
|
|
198
|
-
* @param height 获取像素区域的高度
|
|
199
|
-
* @param pixelRatio 获取区域的像素比
|
|
200
|
-
* @returns rgba颜色平铺的 Uint8Array
|
|
201
|
-
*/
|
|
202
|
-
getPixels: NonNullable<ReturnType<typeof useGetPixels>>;
|
|
203
|
-
/**
|
|
204
|
-
* 强制渲染
|
|
205
|
-
* @description
|
|
206
|
-
* 调用 `render()` 和设置 `needsRender()` 均可在按需渲染时,使得画面渲染一次
|
|
207
|
-
* 区别在于:
|
|
208
|
-
* - `needsRender()` 为在下帧渲染画面
|
|
209
|
-
* - `render()` 在当前帧渲染画面
|
|
210
|
-
* 推荐使用 `needsRender()`, 可以更加流畅。但是如果需要截图等同步操作,可以使用 `render()`
|
|
211
|
-
*
|
|
212
|
-
* @param callback 渲染完成回调
|
|
213
|
-
*/
|
|
214
|
-
render: NonNullable<ReturnType<typeof useRender>>;
|
|
215
|
-
/**
|
|
216
|
-
* 下一帧渲染
|
|
217
|
-
* @description
|
|
218
|
-
* 调用 `render()` 和设置 `needsRender()` 均可在按需渲染时,使得画面渲染一次
|
|
219
|
-
* 区别在于:
|
|
220
|
-
* - `needsRender()` 为在下帧渲染画面
|
|
221
|
-
* - `render()` 在当前帧渲染画面
|
|
222
|
-
* 推荐使用 `needsRender()`, 可以更加流畅。但是如果需要截图等同步操作,可以使用 `render()`
|
|
223
|
-
*
|
|
224
|
-
* @param callback 渲染完成回调
|
|
225
|
-
*/
|
|
226
|
-
needsRender: NonNullable<ReturnType<typeof useNeedsRender>>;
|
|
227
|
-
/**
|
|
228
|
-
* 预加载点位图片资源
|
|
229
|
-
* @param panoIndex 观察点序号
|
|
230
|
-
* @param callback 加载完成回调, 并传递加载用时。
|
|
231
|
-
* @returns 加载完成的 Promise 参数同 callback
|
|
232
|
-
*/
|
|
233
|
-
preloadPano: NonNullable<ReturnType<typeof usePreloadPano>>;
|
|
234
|
-
}
|
|
235
|
-
interface InjectFiveToProps<F extends Feature> {
|
|
236
|
-
[INJECT_SYMBOL]: Pick<InjectFive, F>;
|
|
237
|
-
}
|
|
238
|
-
declare function withFive<F extends Feature>(...features: F[]): <P extends InjectFiveToProps<F>, C extends React.ComponentClass<P, any>>(Component: C & React.ComponentClass<P, any>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<Omit<P, "$five">> & React.RefAttributes<Omit<InstanceType<C>, "state" | "setState" | "render" | "componentDidMount" | "shouldComponentUpdate" | "componentWillUnmount" | "componentDidCatch" | "getSnapshotBeforeUpdate" | "componentDidUpdate" | "componentWillMount" | "UNSAFE_componentWillMount" | "componentWillReceiveProps" | "UNSAFE_componentWillReceiveProps" | "componentWillUpdate" | "UNSAFE_componentWillUpdate" | "context" | "forceUpdate" | "props" | "refs">>>;
|
|
239
|
-
export { withFive, InjectFiveToProps, Feature as InjectFiveFeature };
|
package/react/withFive.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.withFive=void 0;var e=require("tslib"),n=e.__importStar(require("react")),t=e.__importStar(require("three")),r=require("./context");function o(e,n){return n.indexOf(e)>=0}function u(e,n){for(var t=0,r=Object.keys(n);t<r.length;t++){var o=r[t];void 0!==n[o]&&(e[o]=n[o])}}function a(t,r){var u=o("state",r),a=n.useState(Symbol()),i=a[0],f=a[1],c=n.useMemo((function(){if(u)return e.__assign({},t.state)}),[t,i]);return n.useLayoutEffect((function(){if(u)return t.on("stateChange",(function(){return f(Symbol())}))}),[t]),[c,i]}function i(e,t){var r=o("currentState",t),u=n.useState(Symbol()),a=u[0],i=u[1],f=n.useMemo((function(){if(r)return e.getCurrentState()}),[e,a]);return n.useLayoutEffect((function(){if(r)return e.on("currentStateChange",(function(){return i(Symbol())}))}),[e]),[f,a]}function f(e,n){return[o("unsafe__fiveInstance",n)?e:void 0]}function c(e,t){var r=o("work",t),u=n.useState(Symbol()),a=u[0],i=u[1],f=n.useMemo((function(){if(r)return e.work}),[e,a]);return n.useLayoutEffect((function(){if(r)return e.on("load",(function(){return i(Symbol())}))}),[e]),[f,a]}function s(e,n){return[o("scene",n)?e.scene:void 0]}function l(e,r){var u=o("cameraDirection",r),a=n.useState(Symbol()),i=a[0],f=a[1],c=n.useMemo((function(){if(u)return e.camera.getWorldDirection(new t.Vector3)}),[e,i]);return n.useLayoutEffect((function(){if(u)return e.on("cameraUpdate",(function(){return f(Symbol())}))}),[e]),[c,i]}function d(e,r){var u=o("cameraRaycaster",r),a=n.useState(Symbol()),i=a[0],f=a[1],c=n.useMemo((function(){if(u){var n=e.camera.getWorldDirection(new t.Vector3);return new t.Raycaster(e.camera.position,n)}}),[e,i]);return n.useLayoutEffect((function(){if(u)return e.on("cameraUpdate",(function(){return f(Symbol())}))}),[e]),[c,i]}function m(e,t){var r=o("modelReadyState",t),u=n.useState(Symbol()),a=u[0],i=u[1],f=n.useMemo((function(){if(r)return e.model.empty?"Empty":"Loaded"}),[e,a]);return n.useLayoutEffect((function(){if(r)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[f,a]}function p(e,n){if(o("loadWork",n))return e}function y(e,n){if(o("setState",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.setState.apply(e,n)}}function v(e,n){if(o("on",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.on.apply(e,n)}}function S(e,n){if(o("on",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.once.apply(e,n)}}function g(e,n){if(o("off",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.off.apply(e,n)}}function h(e,n){if(o("intersectRaycaster",n))return function(){for(var n,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(n=e.model).intersectRaycaster.apply(n,t)}}function _(e,n){if(o("project2d",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.project2d.apply(e,n)}}function b(e,n){if(o("updateCamera",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.updateCamera.apply(e,n)}}function L(e,n){if(o("initBasisLoader",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.initBasisLoader.apply(e,n)}}function R(e,n){if(o("getPixels",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.getPixels.apply(e,n)}}function w(e,n){if(o("render",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.render.apply(e,n)}}function M(e,n){if(o("needsRender",n))return function(){e.needsRender=!0}}function x(e,n){if(o("preloadPano",n))return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.preloadPano.apply(e,n)}}exports.withFive=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return function(o){return n.forwardRef((function(E,k){var P=r.useFiveInstance(),C=r.useFiveWorkLoader(),j=f(P,t)[0],W=a(P,t),q=W[0],D=W[1],F=i(P,t),B=F[0],I=F[1],O=c(P,t),U=O[0],V=O[1],$=s(P,t)[0],z=l(P,t),A=z[0],G=z[1],H=d(P,t),J=H[0],K=H[1],N=m(P,t),Q=N[0],T=N[1],X=n.useMemo((function(){var e={};return u(e,{setState:y(P,t),loadWork:p(C,t),on:v(P,t),once:S(P,t),off:g(P,t),intersectRaycaster:h(P,t),project2d:_(P,t),updateCamera:b(P,t),initBasisLoader:L(P,t),getPixels:R(P,t),render:w(P,t),needsRender:M(P,t),preloadPano:x(P,t)}),e}),[P,C]),Y=n.useMemo((function(){var n=e.__assign({},X);return u(n,{unsafe__fiveInstance:j,state:q,currentState:B,work:U,scene:$,cameraDirection:A,cameraRaycaster:J,modelReadyState:Q}),n}),[P,X,D,I,V,G,K,T]);return n.createElement(o,e.__assign({ref:k,$five:Y},E))}))}};
|
|
Binary file
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
const http = require("http");
|
|
4
|
-
const mkdirp = require("mkdirp");
|
|
5
|
-
const crypto = require("crypto");
|
|
6
|
-
const formatWork = require("./format-work");
|
|
7
|
-
|
|
8
|
-
const [
|
|
9
|
-
__command__,
|
|
10
|
-
__scriptPath__,
|
|
11
|
-
workPath,
|
|
12
|
-
exportPath,
|
|
13
|
-
] = process.argv;
|
|
14
|
-
|
|
15
|
-
const work = JSON.parse(fs.readFileSync(workPath));
|
|
16
|
-
|
|
17
|
-
if (!fs.existsSync(exportPath)) fs.mkdirSync(exportPath);
|
|
18
|
-
|
|
19
|
-
function md5(contents) {
|
|
20
|
-
const md5 = crypto.createHash("md5");
|
|
21
|
-
md5.update(contents);
|
|
22
|
-
return md5.digest("hex");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function shortPath(path) {
|
|
26
|
-
const array = path.split("/");
|
|
27
|
-
if (array.length < 3) return path;
|
|
28
|
-
const start = array.shift();
|
|
29
|
-
const end = array.pop();
|
|
30
|
-
return [start, md5(array.join("/")), end].join("/");
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function imageURL(url, options = {}) {
|
|
34
|
-
if (typeof options.transform === "function") {
|
|
35
|
-
return options.transform(url, options);
|
|
36
|
-
}
|
|
37
|
-
if (url.indexOf("//vrlab-public.ljcdn.com") >= 0) {
|
|
38
|
-
if (/\.basis(\?|$)/.test(url) && options.basisLoaderInitialized !== true) {
|
|
39
|
-
url = url.replace(/\.basis(\?|$)/, ".jpg$1");
|
|
40
|
-
}
|
|
41
|
-
if (/\.jpg$/.test(url)) {
|
|
42
|
-
const { size, quality, format } = options;
|
|
43
|
-
if (size || quality || format) {
|
|
44
|
-
let suffix = "?imageMogr2";
|
|
45
|
-
if (quality) suffix += "/quality/" + quality;
|
|
46
|
-
if (size) suffix += "/thumbnail/" + size + "x";
|
|
47
|
-
if (format) suffix += "/format/" + format;
|
|
48
|
-
url = url.replace("//vrlab-public.ljcdn.com", "//vrlab-image4.ljcdn.com") + suffix;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return url
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function downloadAsDataURL(url, filename, handleKey) {
|
|
56
|
-
filename = path.resolve(filename);
|
|
57
|
-
mkdirp.sync(path.dirname(filename));
|
|
58
|
-
return new Promise(resolve => {
|
|
59
|
-
http.get(url.replace(/^https\:/, "http:"), res => {
|
|
60
|
-
const mime = res.headers["content-type"];
|
|
61
|
-
const buffers = [];
|
|
62
|
-
|
|
63
|
-
res.on("data", chunk => buffers.push(chunk));
|
|
64
|
-
res.on("end", () => {
|
|
65
|
-
const dataURL = `data:${mime};base64,${Buffer.concat(buffers).toString("base64")}`;
|
|
66
|
-
const contents = `window[${JSON.stringify(handleKey)}] && window[${JSON.stringify(handleKey)}](${JSON.stringify(dataURL)})`;
|
|
67
|
-
fs.writeFileSync(filename, contents, "utf8");
|
|
68
|
-
resolve();
|
|
69
|
-
})
|
|
70
|
-
})
|
|
71
|
-
})
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function traverse(json, callback, keyPath = "") {
|
|
75
|
-
json = callback(json, keyPath);
|
|
76
|
-
if (json) {
|
|
77
|
-
if (typeof json === "array") {
|
|
78
|
-
for (let i = 0; i < json.length; i++) {
|
|
79
|
-
json[i] = traverse(json[i], callback, keyPath + "." + i);
|
|
80
|
-
}
|
|
81
|
-
} else if (typeof json === "object") {
|
|
82
|
-
for (let i = 0, keys = Object.keys(json); i < keys.length; i++) {
|
|
83
|
-
const key = keys[i];
|
|
84
|
-
json[key] = traverse(json[key], callback, keyPath + "." + key);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return json;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const urlRegExp = /^https?:\/\/(?:[\w-]+\.)*[\w-]{1,63}(?:\.(?:\w+))(?:$|\/)/i;
|
|
92
|
-
const fileRegExp = /\.[a-z0-9]{1,6}$/;
|
|
93
|
-
|
|
94
|
-
const htmlExample = (work) => `
|
|
95
|
-
<!DOCTYPE html>
|
|
96
|
-
<html lang="en">
|
|
97
|
-
<head>
|
|
98
|
-
<meta charset="UTF-8">
|
|
99
|
-
<title>如视 VR SDK 调用实例</title>
|
|
100
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
101
|
-
<style>
|
|
102
|
-
html, body { height: 100%; width: 100%; overflow: hidden; }
|
|
103
|
-
* { margin: 0; padding: 0 }
|
|
104
|
-
#app { position: fixed; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; }
|
|
105
|
-
.buttons { position: fixed; top: 10px; left: 10px; }
|
|
106
|
-
.buttons button { display: block; margin-top: 10px; }
|
|
107
|
-
</style>
|
|
108
|
-
</head>
|
|
109
|
-
<body>
|
|
110
|
-
<!-- 试图渲染容器 -->
|
|
111
|
-
<div id="app"></div>
|
|
112
|
-
|
|
113
|
-
<!-- 简易空间按钮 -->
|
|
114
|
-
<div class="buttons">
|
|
115
|
-
<!-- 点击进入相机全景模式 -->
|
|
116
|
-
<button onclick="five.changeMode(Five.Mode.Panorama)">全景模式(Panorama)</button>
|
|
117
|
-
<!-- 点击进入相机模型自由模式 -->
|
|
118
|
-
<button onclick="five.changeMode(Five.Mode.Floorplan, {latitude: Math.PI / 4, longitude: Math.PI / 4})">模型自由模式(Floorplan)</button>
|
|
119
|
-
<!-- 点击进入相机模型垂直模式 -->
|
|
120
|
-
<button onclick="five.changeMode(Five.Mode.Topview)">模型垂直模式(Topview)</button>
|
|
121
|
-
<!-- 点击进入相机VR眼睛模式 -->
|
|
122
|
-
<button onclick="five.changeMode(Five.Mode.VRPanorama)">眼睛模式(VRPanorama)</button>
|
|
123
|
-
<!-- 点击进入相机模型漫游模式 -->
|
|
124
|
-
<button onclick="five.changeMode(Five.Mode.Model)">模型漫游模式(Model)</button>
|
|
125
|
-
</div>
|
|
126
|
-
|
|
127
|
-
<script>${fs.readFileSync(path.join(__dirname, "../bundles/five.js"), "utf8")}</script>
|
|
128
|
-
<script>
|
|
129
|
-
// Five 是 如视 VR 视图渲染库的构造函数,通过 new 关键字产生实例。
|
|
130
|
-
// 构造函数的具体参数见文档,这边仅配置常用的几项
|
|
131
|
-
var five = new Five({
|
|
132
|
-
// 初始化为全景观测状态状态
|
|
133
|
-
mode: Five.Mode.Panorama,
|
|
134
|
-
// 初始化为摄像机位于第 0 个观测点的位置
|
|
135
|
-
panoIndex: 0,
|
|
136
|
-
// 初始化为摄像机水平角度为 0
|
|
137
|
-
longitude: 0,
|
|
138
|
-
// 初始化为摄像机俯仰角度为 0
|
|
139
|
-
latitude: 0,
|
|
140
|
-
// 取消初始化镜头过度动画
|
|
141
|
-
initWithTransition: false,
|
|
142
|
-
// 按需渲染
|
|
143
|
-
onlyRenderIfNeeds: true,
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
// 将渲染视图的 canvas 添加到 DOM 中
|
|
147
|
-
five.appendTo(document.getElementById("app"))
|
|
148
|
-
|
|
149
|
-
// 如果显示区域需要变动,在变动时请调用 refresh 重置显示参数
|
|
150
|
-
window.addEventListener("resize", function () {
|
|
151
|
-
five.refresh()
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
five.load(${JSON.stringify(work, "", " ")});
|
|
155
|
-
</script>
|
|
156
|
-
</body>
|
|
157
|
-
</html>
|
|
158
|
-
`;
|
|
159
|
-
|
|
160
|
-
let downloadQueue = Promise.resolve();
|
|
161
|
-
|
|
162
|
-
function main(work, exportPath) {
|
|
163
|
-
|
|
164
|
-
// 生成输出目录
|
|
165
|
-
mkdirp(path.resolve(exportPath));
|
|
166
|
-
|
|
167
|
-
// 修改work
|
|
168
|
-
traverse(work, (value, keyPath) => {
|
|
169
|
-
if (typeof value === "string" && urlRegExp.test(value) && fileRegExp.test(value)) {
|
|
170
|
-
const handleKey = "jsonp_" + md5(value);
|
|
171
|
-
const relativeValue = value.replace(urlRegExp, match => "downloads/" + md5(match) + "/") + "." + handleKey;
|
|
172
|
-
const filename = shortPath(path.resolve(exportPath, relativeValue));
|
|
173
|
-
downloadQueue = downloadQueue.then(() => {
|
|
174
|
-
if (keyPath.indexOf("model.material_textures") >= 0) {
|
|
175
|
-
value = imageURL(value, { size: 512 });
|
|
176
|
-
}
|
|
177
|
-
return downloadAsDataURL(value, filename, handleKey)
|
|
178
|
-
.then(() => console.log(`success ${value} => ${filename}`))
|
|
179
|
-
.catch(() => console.log(`error ${value} => ${filename}`));
|
|
180
|
-
})
|
|
181
|
-
return relativeValue;
|
|
182
|
-
}
|
|
183
|
-
return value;
|
|
184
|
-
})
|
|
185
|
-
|
|
186
|
-
work.base_url = "./";
|
|
187
|
-
|
|
188
|
-
// 输出 html
|
|
189
|
-
fs.writeFileSync(path.resolve(exportPath, "index.html"), htmlExample(work), "utf-8");
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
main(formatWork(work), exportPath);
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
function objectGet(obj, pathArray, defaultValue) {
|
|
2
|
-
try {
|
|
3
|
-
for (let i = 0; i < pathArray.length; i++) {
|
|
4
|
-
obj = obj[pathArray[i]];
|
|
5
|
-
}
|
|
6
|
-
return obj === undefined ? defaultValue : obj;
|
|
7
|
-
} catch (error) {
|
|
8
|
-
return defaultValue;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
module.exports = function parse(input) {
|
|
13
|
-
|
|
14
|
-
const work = {};
|
|
15
|
-
|
|
16
|
-
const base_url = objectGet(input, "base_url", "");
|
|
17
|
-
|
|
18
|
-
work.project_id = objectGet(input, ["project_id"]);
|
|
19
|
-
work.work_code = objectGet(input, ["work_code"]);
|
|
20
|
-
|
|
21
|
-
work.initial = {
|
|
22
|
-
pano_index: objectGet(input, ["initial", "pano_index"], objectGet(input, ["initial", "pano"], 0)),
|
|
23
|
-
latitude: objectGet(input, ["initial", "latitude"], 0),
|
|
24
|
-
longitude: objectGet(input, ["initial", "longitude"], 0),
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
work.model = {
|
|
28
|
-
file_url: base_url + objectGet(input, ["model", "file_url"], ""),
|
|
29
|
-
material_textures: objectGet(input, ["model", "material_textures"], []).map(url => {
|
|
30
|
-
if (/^https?:/.test(url)) return url;
|
|
31
|
-
return base_url + url;
|
|
32
|
-
}),
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
work.observers = objectGet(input, ["observers"], []).map(one => {
|
|
36
|
-
return {
|
|
37
|
-
visible_nodes: one.visible_nodes,
|
|
38
|
-
accessible_nodes: one.accessible_nodes,
|
|
39
|
-
index: one.index,
|
|
40
|
-
quaternion: one.quaternion,
|
|
41
|
-
standing_position: one.standing_position,
|
|
42
|
-
position: one.position,
|
|
43
|
-
floor_index: one.floor_index,
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
work.panorama = {
|
|
48
|
-
count: objectGet(input, ["panorama", "count"], 0),
|
|
49
|
-
list: objectGet(input, ["panorama", "list"], []).map((_, index) => {
|
|
50
|
-
const parseURL = (url) => {
|
|
51
|
-
const panoCubeBaseURL = objectGet(input, ["panorama", "base_url"], "");
|
|
52
|
-
const panoCubePath = objectGet(input, ["panorama", "pano_high_cube_base_url"], "");
|
|
53
|
-
if (panoCubePath || panoCubeBaseURL) {
|
|
54
|
-
return base_url + panoCubeBaseURL + panoCubePath + index + "/" + url;
|
|
55
|
-
} else {
|
|
56
|
-
return base_url + url;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
index: objectGet(input, ["panorama", "list", index, "index"], 0),
|
|
61
|
-
up: parseURL(objectGet(input, ["panorama", "list", index, "up"], objectGet(input, ["panorama", "info", index, "up"], ""))),
|
|
62
|
-
down: parseURL(objectGet(input, ["panorama", "list", index, "down"], objectGet(input, ["panorama", "info", index, "down"], ""))),
|
|
63
|
-
left: parseURL(objectGet(input, ["panorama", "list", index, "left"], objectGet(input, ["panorama", "info", index, "left"], ""))),
|
|
64
|
-
right: parseURL(objectGet(input, ["panorama", "list", index, "right"], objectGet(input, ["panorama", "info", index, "right"], ""))),
|
|
65
|
-
front: parseURL(objectGet(input, ["panorama", "list", index, "front"], objectGet(input, ["panorama", "info", index, "front"], ""))),
|
|
66
|
-
back: parseURL(objectGet(input, ["panorama", "list", index, "back"], objectGet(input, ["panorama", "info", index, "back"], ""))),
|
|
67
|
-
};
|
|
68
|
-
}),
|
|
69
|
-
}
|
|
70
|
-
return work;
|
|
71
|
-
};
|