@realsee/five 6.0.0-alpha.1 → 6.0.0-alpha.100
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 +58 -1
- package/TERMS.txt +0 -2
- package/docs/assets/highlight.css +20 -20
- package/docs/assets/main.js +59 -52
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +805 -825
- package/docs/classes/five.AnimationFrameLoop.html +16 -15
- package/docs/classes/five.BoxBoundingVolume.html +19 -1
- package/docs/classes/five.Camera.html +38 -11
- package/docs/classes/five.CullingVolume.html +13 -1
- package/docs/classes/five.Fetcher.html +5 -0
- package/docs/classes/five.Five.html +235 -284
- package/docs/classes/five.InternalWebGLRenderer.html +2 -1
- package/docs/classes/five.IntersectMesh.html +4 -1
- package/docs/classes/five.Model.html +69 -57
- package/docs/classes/five.ModelViewLayer.html +18 -0
- package/docs/classes/five.NetworkAbortError.html +2 -0
- package/docs/classes/five.NetworkFirbiddenError.html +2 -0
- package/docs/classes/five.NetworkResponseError.html +3 -0
- package/docs/classes/five.NetworkSubscribe.html +42 -56
- package/docs/classes/five.NetworkTimeoutError.html +2 -0
- package/docs/classes/five.PBMContainer.html +12 -13
- package/docs/classes/five.PBMGroup.html +3 -3
- package/docs/classes/five.PBMMesh.html +4 -5
- package/docs/classes/five.PBMMeshMaterial.html +50 -41
- package/docs/classes/five.PanoCircleMesh.html +30 -7
- package/docs/classes/five.PanoCircleMeshCustom.html +30 -7
- package/docs/classes/five.PanoCircleMeshSolid.html +30 -7
- package/docs/classes/five.RegionBoundingVolume.html +22 -1
- package/docs/classes/five.RequestScheduler.html +13 -12
- package/docs/classes/five.Scene.html +5 -3
- package/docs/classes/five.SphereBoundingVolume.html +18 -1
- package/docs/classes/five.Subscribe.html +43 -62
- package/docs/classes/five.TextureLoader.html +5 -1
- package/docs/classes/five.Tile.html +30 -1
- package/docs/classes/five.Tile3DModel.html +45 -1
- package/docs/classes/five.TileCubeTextureTarget.html +9 -1
- package/docs/classes/five.TileNode.html +5 -1
- package/docs/classes/five.Tileset.html +33 -5
- package/docs/classes/five.TilesetCache.html +8 -1
- package/docs/classes/five.TilesetTraverser.html +19 -1
- package/docs/classes/five.Work.html +33 -28
- package/docs/classes/five.XRButton.html +3 -1
- package/docs/classes/gltf_loader.DDSLoader.html +3 -1
- package/docs/classes/gltf_loader.DRACOLoader.html +8 -1
- package/docs/classes/gltf_loader.GLTFLoader.html +18 -17
- package/docs/classes/gltf_loader.GLTFObject.html +8 -6
- package/docs/classes/gltf_loader.GLTFParser.html +6 -1
- package/docs/classes/gltf_loader.THREEGLTFLoader.html +8 -1
- package/docs/classes/line.Line.html +10 -1
- package/docs/classes/line.LineGeometry.html +14 -1
- package/docs/classes/line.LineMaterial.html +8 -1
- package/docs/classes/line.LineSegmentsGeometry.html +12 -1
- package/docs/classes/line.THREE_Line2.html +4 -1
- package/docs/classes/line.THREE_LineSegments2.html +4 -1
- package/docs/classes/plugins.BasePlugin.Controller.html +38 -0
- package/docs/classes/plugins.ItemMaskController.html +37 -0
- package/docs/classes/react.Store.html +23 -29
- package/docs/classes/sticker.Sticker.html +25 -32
- package/docs/classes/vfx.Airflow.html +8 -1
- package/docs/classes/vfx.Flame.html +10 -1
- package/docs/classes/vfx.Particle.html +79 -82
- package/docs/classes/vfx.SpotLight.html +7 -1
- package/docs/enums/five.VolumePlaneIntersect.html +4 -1
- package/docs/functions/five.defaultImageURLTransform.html +5 -0
- package/docs/functions/five.getViewportScale.html +1 -0
- package/docs/functions/five.imageSupport.html +1 -0
- package/docs/functions/five.isPanoId.html +1 -0
- package/docs/functions/five.loadAt3d.html +1 -0
- package/docs/functions/five.loadB3dm.html +1 -0
- package/docs/functions/five.loadDome.html +1 -0
- package/docs/functions/five.loadDomez.html +1 -0
- package/docs/functions/five.loadPbm.html +1 -0
- package/docs/functions/five.loadPnts.html +1 -0
- package/docs/functions/five.panoEqual.html +1 -0
- package/docs/functions/five.panoParse.html +1 -0
- package/docs/functions/five.panoStringify.html +1 -0
- package/docs/functions/five.parseWork.html +7 -0
- package/docs/functions/plugins.ItemMaskPlugin.html +1 -0
- package/docs/functions/react.FiveCanvas-1.html +6 -0
- package/docs/functions/react.createFiveFeature.html +1 -0
- package/docs/functions/react.createFiveProvider.html +9 -0
- package/docs/functions/react.createStore.html +15 -0
- package/docs/functions/react.unsafe__useFiveInstance.html +5 -0
- package/docs/functions/react.useFiveAction.html +19 -0
- package/docs/functions/react.useFiveCameraDirection.html +3 -0
- package/docs/functions/react.useFiveCameraRaycaster.html +3 -0
- package/docs/functions/react.useFiveCurrentObserver.html +5 -0
- package/docs/functions/react.useFiveCurrentState.html +5 -0
- package/docs/functions/react.useFiveEventCallback.html +5 -0
- package/docs/functions/react.useFiveFloor.html +5 -0
- package/docs/functions/react.useFiveHelper.html +5 -0
- package/docs/functions/react.useFiveModelIntersectRaycaster.html +7 -0
- package/docs/functions/react.useFiveModelReadyState.html +4 -0
- package/docs/functions/react.useFiveProject2d.html +7 -0
- package/docs/functions/react.useFiveScene.html +2 -0
- package/docs/functions/react.useFiveSceneEffect.html +5 -0
- package/docs/functions/react.useFiveState.html +1 -0
- package/docs/functions/react.useFiveWork.html +8 -0
- package/docs/functions/react.withFive.html +1 -0
- package/docs/functions/vue.unsafe__useFiveInject.html +5 -0
- package/docs/functions/vue.useFiveAction.html +25 -0
- package/docs/functions/vue.useFiveCameraDirection.html +3 -0
- package/docs/functions/vue.useFiveCameraRaycaster.html +3 -0
- package/docs/functions/vue.useFiveCurrentObserver.html +5 -0
- package/docs/functions/vue.useFiveCurrentState.html +5 -0
- package/docs/functions/vue.useFiveEventCallback.html +5 -0
- package/docs/functions/vue.useFiveFloor.html +5 -0
- package/docs/functions/vue.useFiveHelper.html +5 -0
- package/docs/functions/vue.useFiveModel.html +2 -0
- package/docs/functions/vue.useFiveModelBounding.html +2 -0
- package/docs/functions/vue.useFiveModelIntersectRaycaster.html +7 -0
- package/docs/functions/vue.useFiveModelReadyState.html +4 -0
- package/docs/functions/vue.useFiveProject2d.html +7 -0
- package/docs/functions/vue.useFiveScene.html +2 -0
- package/docs/functions/vue.useFiveState.html +5 -0
- package/docs/functions/vue.useFiveWorks.html +8 -0
- package/docs/index.html +81 -79
- package/docs/interfaces/five.AddableObject.html +9 -9
- package/docs/interfaces/five.AjaxOptions.html +11 -0
- package/docs/interfaces/five.AnimationFrame.html +5 -1
- package/docs/interfaces/five.BaseEvent.html +5 -0
- package/docs/interfaces/five.BoundingVolume.html +15 -1
- package/docs/interfaces/five.CameraPose.html +6 -1
- package/docs/interfaces/five.ClipperParameter.html +3 -1
- package/docs/interfaces/five.EventCallback.html +355 -358
- package/docs/interfaces/five.FiveInitArgs.html +80 -86
- package/docs/interfaces/five.FiveLoadOptions.html +36 -0
- package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +17 -15
- package/docs/interfaces/five.GestureEvent.html +19 -0
- package/docs/interfaces/five.ImageOptions.html +16 -18
- package/docs/interfaces/five.ImageURLMappings.html +1 -1
- package/docs/interfaces/five.ImageURLOptions.html +15 -15
- package/docs/interfaces/five.IntersectEvent.html +8 -0
- package/docs/interfaces/five.IntersectMeshInterface.html +3 -3
- package/docs/interfaces/five.Intersection.html +5 -7
- package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +15 -11
- package/docs/interfaces/five.ModeChangeEvent.html +9 -0
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +18 -18
- package/docs/interfaces/five.ModelEvent.html +8 -0
- package/docs/interfaces/five.ModelsEvent.html +6 -0
- package/docs/interfaces/five.MotionKeyframe.html +4 -1
- package/docs/interfaces/five.MovePanoOptions.html +24 -33
- package/docs/interfaces/five.NetworkOptions.html +9 -9
- package/docs/interfaces/five.NetworkResourceEvent.html +9 -0
- package/docs/interfaces/five.ObjectEvent.html +6 -0
- package/docs/interfaces/five.PBMPanoPicture.html +9 -7
- package/docs/interfaces/five.PBMParameters.html +42 -39
- package/docs/interfaces/five.PanoCircleMeshCustomOptions.html +9 -1
- package/docs/interfaces/five.PanoCircleMeshInterface.html +21 -10
- package/docs/interfaces/five.PanoCircleMeshOptions.html +3 -1
- package/docs/interfaces/five.PanoCircleMeshSolidOptions.html +3 -1
- package/docs/interfaces/five.PanoEvent.html +11 -0
- package/docs/interfaces/five.PanoTextureEvent.html +9 -0
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +32 -32
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +18 -18
- package/docs/interfaces/five.Pose.html +15 -32
- package/docs/interfaces/five.RenderEvent.html +7 -0
- package/docs/interfaces/five.Scissor.html +11 -12
- package/docs/interfaces/five.State.html +20 -21
- package/docs/interfaces/five.StateEvent.html +7 -0
- package/docs/interfaces/five.SubscribeMixinType.emit.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.hasListener.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.off.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.on.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.once.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.waitUnitl.html +1 -1
- package/docs/interfaces/five.TextureOptions.html +18 -20
- package/docs/interfaces/five.Tile3DModelLoaderOptions.html +12 -3
- package/docs/interfaces/five.TileCubeNode.html +7 -1
- package/docs/interfaces/five.TileCubeTree.html +2 -1
- package/docs/interfaces/five.TileHeader.html +9 -1
- package/docs/interfaces/five.TilesetHeader.html +6 -1
- package/docs/interfaces/five.TilesetOptions.html +6 -1
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +9 -9
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +28 -28
- package/docs/interfaces/five.WebXRAxesParams.html +4 -0
- package/docs/interfaces/five.WebXRControllerParams.html +2 -1
- package/docs/interfaces/five.WorkCubeImage.html +15 -13
- package/docs/interfaces/five.WorkImage.html +20 -21
- package/docs/interfaces/five.WorkInitial.html +17 -17
- package/docs/interfaces/five.WorkModel.html +12 -13
- package/docs/interfaces/five.WorkObserver.html +40 -31
- package/docs/interfaces/five.WorkResolvedObserver.html +41 -0
- package/docs/interfaces/five.WorkTile.html +10 -1
- package/docs/interfaces/five.WorkVideo.html +8 -9
- package/docs/interfaces/five.WorksEvent.html +9 -0
- package/docs/interfaces/five.XRControllerEvent.html +8 -0
- package/docs/interfaces/five.XRGestureEvent.html +11 -0
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +28 -28
- package/docs/interfaces/five.XRSessionEvent.html +7 -0
- package/docs/interfaces/gltf_loader.DDS.html +7 -1
- package/docs/interfaces/gltf_loader.GLTF.html +10 -4
- package/docs/interfaces/gltf_loader.GLTFReference.html +3 -1
- package/docs/interfaces/gltf_loader.THREEGLTF.html +8 -1
- package/docs/interfaces/plugins.BasePlugin.BaseOptions.html +3 -0
- package/docs/interfaces/plugins.BasePlugin.Config.html +5 -0
- package/docs/interfaces/plugins.BasePlugin.State.html +8 -0
- package/docs/interfaces/plugins.ItemMaskPluginType.Config.html +2 -0
- package/docs/interfaces/plugins.ItemMaskPluginType.EventMap.html +10 -0
- package/docs/interfaces/plugins.ItemMaskPluginType.ItemType.html +13 -0
- package/docs/interfaces/plugins.ItemMaskPluginType.MaskType.html +4 -0
- package/docs/interfaces/plugins.ItemMaskPluginType.Params.html +4 -0
- package/docs/interfaces/plugins.ItemMaskPluginType.State.html +14 -0
- package/docs/interfaces/react.FiveActionReactCallbacks.html +27 -39
- package/docs/interfaces/react.FiveInjectionTypes.html +112 -143
- package/docs/interfaces/react.PropTypeOfFiveFeatures.html +2 -1
- package/docs/interfaces/sticker.IntersectionLike.html +7 -8
- package/docs/interfaces/vfx.ParticleArgs.html +67 -68
- package/docs/interfaces/vfx.ParticleTweenKeyframe.html +3 -1
- package/docs/interfaces/vue.FiveActionVueCallbacks.html +31 -42
- package/docs/modules/five.SubscribeMixinType.html +7 -1
- package/docs/modules/five.html +170 -481
- package/docs/modules/gltf_loader.html +11 -1
- package/docs/modules/line.html +8 -1
- package/docs/modules/plugins.BasePlugin.html +6 -0
- package/docs/modules/plugins.ItemMaskPluginType.html +9 -0
- package/docs/modules/plugins.html +5 -0
- package/docs/modules/react.FiveCanvas.html +8 -0
- package/docs/modules/react.html +37 -130
- package/docs/modules/sticker.html +3 -1
- package/docs/modules/vfx.html +8 -1
- package/docs/modules/vue.html +24 -115
- package/docs/types/five.AjaxResponseType.html +1 -0
- package/docs/types/five.AjaxResponseTypeMapping.html +1 -0
- package/docs/types/five.BoundingVolumeJson.html +1 -0
- package/docs/types/five.BoxBoundingVolumeJson.html +1 -0
- package/docs/types/five.ControllerCustomInitTypes.html +1 -0
- package/docs/types/five.ControllerEventTypes.html +32 -0
- package/docs/types/five.EventTypes.html +26 -0
- package/docs/types/five.FivePlugin.html +71 -0
- package/docs/types/five.FivePluginInit.html +3 -0
- package/docs/types/five.FivePluginInstance.html +3 -0
- package/docs/types/five.GestureTypes.html +1 -0
- package/docs/types/five.LegacyEventType.html +203 -0
- package/docs/types/five.LooseWork.html +1 -0
- package/docs/types/five.LooseWorkInitial.html +1 -0
- package/docs/types/five.LooseWorkModel.html +1 -0
- package/docs/types/five.LooseWorkObserver.html +1 -0
- package/docs/types/five.LooseWorkPanorama.html +1 -0
- package/docs/types/five.LooseWorkVideo.html +1 -0
- package/docs/types/five.LooseWorkWithExtrinsics.html +2 -0
- package/docs/types/five.Mirror.html +1 -0
- package/docs/types/five.Mode.html +10 -0
- package/docs/types/five.ModelMaterialValues.html +1 -0
- package/docs/types/five.Models.html +13 -0
- package/docs/types/five.MotionValue.html +1 -0
- package/docs/types/five.MovePanoEffect.html +11 -0
- package/docs/types/five.NetWorkMeta.html +1 -0
- package/docs/types/five.NetworkError.html +1 -0
- package/docs/types/five.NetworkErrorCallback.html +1 -0
- package/docs/types/five.NetworkProgressCallback.html +1 -0
- package/docs/types/five.NetworkResponse.html +1 -0
- package/docs/types/five.NetworkState.html +1 -0
- package/docs/types/five.NetworkSuccessCallback.html +1 -0
- package/docs/types/five.NetworkType.html +1 -0
- package/docs/types/five.Pano.html +1 -0
- package/docs/types/five.PanoId.html +1 -0
- package/docs/types/five.ParseWorkOptions.html +6 -0
- package/docs/types/five.ParsedResultType.html +1 -0
- package/docs/types/five.PostProcessingType.html +1 -0
- package/docs/types/five.RegionBoundingVolumeJson.html +1 -0
- package/docs/types/five.RequestResult.html +1 -0
- package/docs/types/five.SphereBoundingVolumeJson.html +1 -0
- package/docs/types/five.SubscribeEventMap.html +1 -0
- package/docs/types/five.TileContentData.html +1 -0
- package/docs/types/five.TilesetFrameState.html +1 -0
- package/docs/types/five.WebXRControllerKey.html +1 -0
- package/docs/types/five.WebXRControllerType.html +1 -0
- package/docs/types/five.Works.html +1 -0
- package/docs/types/line.LineMaterialParameters.html +1 -0
- package/docs/types/plugins.BasePlugin.EventMap.html +6 -0
- package/docs/types/plugins.ItemMaskPluginType.PluginData.html +1 -0
- package/docs/types/plugins.ItemMaskPluginType.ServerData.html +1 -0
- package/docs/types/react.FiveInjectionActionFeature.html +1 -0
- package/docs/types/react.FiveInjectionDataFeature.html +1 -0
- package/docs/types/react.FiveInjectionFeature.html +1 -0
- package/docs/types/react.FiveProviderPropTypes.html +1 -0
- package/docs/types/react.FiveProviderType.html +1 -0
- package/docs/types/react.StoreActionMapHanlder.html +1 -0
- package/docs/types/react.StoreActionMapType.html +1 -0
- package/docs/types/react.StoreProviderType.html +1 -0
- package/docs/types/react.StoreValueMapType.html +1 -0
- package/docs/types/vfx.ParticleType.html +1 -0
- package/docs/types/vue.FiveModelIntersectRaycaster.html +1 -0
- package/docs/types/vue.FiveProviderComponent.html +1 -0
- package/docs/types/vue.Project2d.html +1 -0
- package/docs/variables/five.PROXY_CONTROLLER_EVENT_NAMES.html +1 -0
- package/docs/variables/five.defaultPbmParameters.html +1 -0
- package/docs/variables/react.INJECTION_PROPNAME.html +1 -0
- package/docs/variables/vue.FiveCanvas.html +8 -0
- package/docs/variables/vue.FiveProvider.html +8 -0
- package/five/index.d.ts +1775 -1260
- package/five/index.js +1879 -218
- package/five/index.mjs +23248 -0
- package/gltf-loader/index.js +204 -203
- package/gltf-loader/index.mjs +1708 -0
- package/line/index.js +396 -202
- package/line/index.mjs +776 -0
- package/package.json +48 -12
- package/plugins/index.d.ts +253 -0
- package/plugins/index.js +350 -0
- package/plugins/index.mjs +796 -0
- package/react/index.d.ts +41 -47
- package/react/index.js +198 -203
- package/react/index.mjs +1072 -0
- package/scripts/five-staticify.js +183 -2
- package/sticker/index.js +198 -203
- package/sticker/index.mjs +399 -0
- package/umd/five-gltf-loader.js +261 -1
- package/umd/five-line.js +454 -1
- package/umd/five-plugins.js +350 -0
- package/umd/five-react.js +255 -1
- package/umd/five-sticker.js +255 -1
- package/umd/five-vfx.js +539 -1
- package/umd/five-vue.js +255 -1
- package/umd/five.js +2023 -2
- package/vfx/index.js +481 -202
- package/vfx/index.mjs +1032 -0
- package/vue/index.d.ts +5 -4
- package/vue/index.js +198 -203
- package/vue/index.mjs +574 -0
- package/docs/assets/icons.css +0 -1043
- package/docs/assets/icons.png +0 -0
- package/docs/assets/icons@2x.png +0 -0
- package/docs/assets/widgets.png +0 -0
- package/docs/assets/widgets@2x.png +0 -0
- package/docs/classes/five.BVH.html +0 -10
- package/docs/classes/five.BVHIntersect.html +0 -1
- package/docs/classes/five.BVHNode.html +0 -7
- package/docs/classes/five.BVHVector3.html +0 -1
- package/docs/classes/five.Clipper.html +0 -1
- package/docs/classes/five.PBMMaterialReferenceCache.html +0 -1
- package/docs/enums/five.PBMPointColorType.html +0 -1
- package/docs/enums/five.PBMPointShapeType.html +0 -1
- package/docs/enums/five.PBMPointSizeType.html +0 -1
- package/docs/interfaces/five.DepthPanoramaControllerCustomInitArgs.html +0 -26
- package/docs/interfaces/five.ModelLodOptions.html +0 -1
- package/docs/interfaces/five.WorkOptions.html +0 -15
- package/docs/modules.html +0 -1
- package/exporters/staticify.js +0 -210
- package/scripts/five-plugin-init.js +0 -83
- package/scripts/five-quick-start-init.js +0 -80
- package/scripts/five-react-component-init.js +0 -83
- package/templates/plugin/README.md +0 -38
- package/templates/plugin/devtools/external-five.js +0 -5
- package/templates/plugin/devtools/external-three.js +0 -5
- package/templates/plugin/devtools/tsconfig.build.json +0 -18
- package/templates/plugin/devtools/webpack.bundle.js +0 -44
- package/templates/plugin/devtools/webpack.example.js +0 -39
- package/templates/plugin/docs/.gitkeep +0 -0
- package/templates/plugin/examples/data.json +0 -507
- package/templates/plugin/examples/index.html +0 -28
- package/templates/plugin/examples/index.ts +0 -12
- package/templates/plugin/lib/index.ts +0 -30
- package/templates/plugin/package.json +0 -32
- package/templates/plugin/tsconfig.json +0 -26
- package/templates/quick-start/README.md +0 -47
- package/templates/quick-start/assets/work.json +0 -507
- package/templates/quick-start/index.html +0 -54
- package/templates/quick-start/index.tsx +0 -123
- package/templates/quick-start/package.json +0 -25
- package/templates/quick-start/tsconfig.json +0 -27
- package/templates/quick-start/webpack.config.js +0 -45
- package/templates/quick-start/webpack.production.js +0 -42
- package/templates/react-component/README.md +0 -32
- package/templates/react-component/devtools/external-five.js +0 -5
- package/templates/react-component/devtools/external-react.js +0 -5
- package/templates/react-component/devtools/external-three.js +0 -5
- package/templates/react-component/devtools/tsconfig.build.json +0 -19
- package/templates/react-component/devtools/webpack.bundle.js +0 -44
- package/templates/react-component/devtools/webpack.example.js +0 -39
- package/templates/react-component/docs/.gitkeep +0 -0
- package/templates/react-component/examples/data.json +0 -507
- package/templates/react-component/examples/index.html +0 -17
- package/templates/react-component/examples/index.tsx +0 -62
- package/templates/react-component/lib/index.tsx +0 -157
- package/templates/react-component/package.json +0 -38
- package/templates/react-component/tsconfig.json +0 -27
- package/umd/five-gltf-loader.js.LICENSE.txt +0 -14
- package/umd/five-line.js.LICENSE.txt +0 -14
- package/umd/five-react.js.LICENSE.txt +0 -14
- package/umd/five-sticker.js.LICENSE.txt +0 -14
- package/umd/five.js.LICENSE.txt +0 -100
|
@@ -1,7 +1,189 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
3
5
|
const { program } = require("commander");
|
|
4
|
-
const
|
|
6
|
+
const archiver = require("archiver");
|
|
7
|
+
const ejs = require("ejs");
|
|
8
|
+
const { parseWork, defaultImageURLTransform } = require("@realsee/five");
|
|
9
|
+
|
|
10
|
+
function matchJsonpFunctionName(url) {
|
|
11
|
+
const regExps = [
|
|
12
|
+
/\.([0-9a-z]+)\.jsonp([\?\#].*)?$/i,
|
|
13
|
+
/jsonp_([0-9a-z]+)([\?\#].*)?$/i
|
|
14
|
+
];
|
|
15
|
+
for (const regExp of regExps) {
|
|
16
|
+
const matched = url.match(regExp);
|
|
17
|
+
if (matched) {
|
|
18
|
+
return "jsonp_" + matched[1];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
async function download(url, jsonpHandleKey) {
|
|
25
|
+
const request = /^https\:/.test(url) ? require("https") : require("http");
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
const req = request.get(url, res => {
|
|
28
|
+
const mime = res.headers['content-type'];
|
|
29
|
+
const buffers = [];
|
|
30
|
+
|
|
31
|
+
res.on('data', chunk => buffers.push(chunk));
|
|
32
|
+
res.on('end', () => {
|
|
33
|
+
const contents = Buffer.concat(buffers);
|
|
34
|
+
if (jsonpHandleKey) {
|
|
35
|
+
const dataURL = `data:${mime};base64,${contents.toString('base64')}`;
|
|
36
|
+
const jsopContents = `window[${JSON.stringify(jsonpHandleKey)}] && window[${JSON.stringify(jsonpHandleKey)}](${JSON.stringify(dataURL)})`;
|
|
37
|
+
resolve(Buffer.from(jsopContents));
|
|
38
|
+
} else {
|
|
39
|
+
resolve(Buffer.from(contents));
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
res.on("error", () => reject(new Error(`fetch ${url} got error`)));
|
|
43
|
+
});
|
|
44
|
+
req.on("error", () => reject(new Error(`fetch ${url} got error`)));
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const template = `
|
|
49
|
+
<!DOCTYPE html>
|
|
50
|
+
<html lang="en">
|
|
51
|
+
<head>
|
|
52
|
+
<meta charset="UTF-8">
|
|
53
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
54
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
55
|
+
<title>REALSEE PREVIEW</title>
|
|
56
|
+
<style>
|
|
57
|
+
* { margin: 0; padding: 0; }
|
|
58
|
+
html, body { height: 100%; width: 100%; overflow: hidden; }
|
|
59
|
+
#app { position: fixed; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; }
|
|
60
|
+
.buttons { position: fixed; top: 10px; left: 10px; pointer-events: none; }
|
|
61
|
+
.buttons h3 { margin-top: 10px; text-shadow: 0 0 2px rgba(255, 255, 255, 0.5); }
|
|
62
|
+
.buttons button { pointer-events: auto; display: block; font-size: 14px; color: #FFF; background: #5a6268; padding: 3px 10px; border: 1px solid #333; margin-right: 2px; border-radius: 2px; cursor: pointer; margin-top: 10px; }
|
|
63
|
+
.buttons button:active { background: #333; }
|
|
64
|
+
</style>
|
|
65
|
+
<script src="./three.min.js"></script>
|
|
66
|
+
<script src="./five.js"></script>
|
|
67
|
+
<script>const workJSON = <%- JSON.stringify(work_json) %></script>
|
|
68
|
+
</head>
|
|
69
|
+
<body>
|
|
70
|
+
<!-- 试图渲染容器 -->
|
|
71
|
+
<div id="app"></div>
|
|
72
|
+
<script>
|
|
73
|
+
const five = new FiveSDK.Five();
|
|
74
|
+
five.appendTo(document.getElementById("app"));
|
|
75
|
+
const work = FiveSDK.parseWork(workJSON, { baseURL: "./", shortPath: <%- JSON.stringify(short_path) %>, jsonp: <%- JSON.stringify(jsonp) %> });
|
|
76
|
+
five.load(work);
|
|
77
|
+
|
|
78
|
+
const modeButtons = [
|
|
79
|
+
{ mode: "Panorama", label: "全景漫游模式" },
|
|
80
|
+
{ mode: "Model", label: "模型漫游模式" },
|
|
81
|
+
{ mode: "Floorplan", label: "模型纵览模式" },
|
|
82
|
+
{ mode: "Topview", label: "模型俯视模式" },
|
|
83
|
+
{ mode: "Mapview", label: "模型自由模式" },
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
const buttons = document.createElement("div");
|
|
87
|
+
buttons.className = "buttons";
|
|
88
|
+
document.body.appendChild(buttons);
|
|
89
|
+
buttons.appendChild(document.createElement("h3")).innerHTML = "模式控制";
|
|
90
|
+
|
|
91
|
+
// 模态按钮
|
|
92
|
+
for (let i = 0; i < modeButtons.length; i++) {
|
|
93
|
+
const button = document.createElement("button");
|
|
94
|
+
button.innerHTML = modeButtons[i].label;
|
|
95
|
+
button.addEventListener('click', () => {
|
|
96
|
+
// 通过 changeMode 方法可以切换模态
|
|
97
|
+
five.changeMode(FiveSDK.Five.Mode[modeButtons[i].mode]);
|
|
98
|
+
});
|
|
99
|
+
buttons.appendChild(button);
|
|
100
|
+
}
|
|
101
|
+
window.addEventListener("resize", () => five.refresh(), false);
|
|
102
|
+
</script>
|
|
103
|
+
</body>
|
|
104
|
+
</html>
|
|
105
|
+
`;
|
|
106
|
+
|
|
107
|
+
function getThreeJsBuffer() {
|
|
108
|
+
let tempPath = path.resolve(__dirname);
|
|
109
|
+
while (!(tempPath === '/' || tempPath === ".")) {
|
|
110
|
+
const threeFilePath = path.join(tempPath, "node_modules/three/build/three.min.js");
|
|
111
|
+
if (fs.existsSync(threeFilePath)) {
|
|
112
|
+
return fs.readFileSync(threeFilePath);
|
|
113
|
+
}
|
|
114
|
+
tempPath = path.dirname(tempPath);
|
|
115
|
+
}
|
|
116
|
+
throw new Error("three.js is not found");
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function getFiveJsBuffer() {
|
|
120
|
+
return fs.readFileSync(path.join(__dirname, "../umd/five.js"));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async function staticify(work, output, shortPath = false, jsonp = false, preview = true) {
|
|
124
|
+
const zipFilename = /\.zip$/.test(output) ? output : output + ".zip";
|
|
125
|
+
const outputStream = fs.createWriteStream(zipFilename);
|
|
126
|
+
const archive = archiver("zip", { zlib: { level: 9 } });
|
|
127
|
+
archive.on("error", (err) => { throw err; });
|
|
128
|
+
outputStream.on("close", function() {
|
|
129
|
+
console.info(`zip ${archive.pointer()} total bytes`);
|
|
130
|
+
console.info(`dist ${zipFilename}`);
|
|
131
|
+
});
|
|
132
|
+
archive.pipe(outputStream);
|
|
133
|
+
|
|
134
|
+
const resources = [];
|
|
135
|
+
const workJSONObject = JSON.parse(fs.readFileSync(work, "utf8"));
|
|
136
|
+
parseWork(workJSONObject, {
|
|
137
|
+
shortPath,
|
|
138
|
+
jsonp,
|
|
139
|
+
traverseResource(resource) {
|
|
140
|
+
resources.push(resource);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
const textureCount = resources.filter(({ type }) => type === "texture").length;
|
|
145
|
+
let textureSize;
|
|
146
|
+
if (textureCount > 50) {
|
|
147
|
+
textureSize = 64;
|
|
148
|
+
} else if (textureCount > 40) {
|
|
149
|
+
textureSize = 128;
|
|
150
|
+
} else if (textureCount > 30) {
|
|
151
|
+
textureSize = 256;
|
|
152
|
+
} else if (textureCount > 15) {
|
|
153
|
+
textureSize = 512;
|
|
154
|
+
} else if (textureCount > 10) {
|
|
155
|
+
textureSize = 1024;
|
|
156
|
+
}
|
|
157
|
+
if (textureSize) {
|
|
158
|
+
for (const resource of resources) {
|
|
159
|
+
if (resource.type === "texture") {
|
|
160
|
+
resource.origin = defaultImageURLTransform(resource.origin, { size: textureSize, key: resource.type });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
for (const { origin, relative } of resources) {
|
|
165
|
+
const buffer = await download(origin, matchJsonpFunctionName(relative));
|
|
166
|
+
console.info(`${origin} -> ${relative}`);
|
|
167
|
+
archive.append(buffer, { name: relative });
|
|
168
|
+
}
|
|
169
|
+
archive.append(fs.readFileSync(work), { name: "work.json" });
|
|
170
|
+
|
|
171
|
+
if (preview) {
|
|
172
|
+
archive.append(getFiveJsBuffer(), { name: "five.js" });
|
|
173
|
+
archive.append(getThreeJsBuffer(), { name: "three.min.js" });
|
|
174
|
+
|
|
175
|
+
const data = {
|
|
176
|
+
work_json: workJSONObject,
|
|
177
|
+
short_path: Boolean(shortPath),
|
|
178
|
+
jsonp: Boolean(jsonp),
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const html = typeof preview === 'string' ? ejs.render(fs.readFileSync(preview, "utf8"), data) : ejs.render(template, data);
|
|
182
|
+
archive.append(html, { name: "index.html" });
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
archive.finalize();
|
|
186
|
+
}
|
|
5
187
|
|
|
6
188
|
program
|
|
7
189
|
.requiredOption("--work <work>", "work 的 json 文件")
|
|
@@ -15,7 +197,6 @@ program.parse(process.argv);
|
|
|
15
197
|
|
|
16
198
|
async function main(program) {
|
|
17
199
|
let { work, output, shortPath, jsonp, preview, template } = program.opts();
|
|
18
|
-
console.log(template)
|
|
19
200
|
if (preview !== false && template) {
|
|
20
201
|
preview = template;
|
|
21
202
|
}
|