@realsee/five 5.0.0-alpha.21 → 5.0.0-alpha.210

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.
Files changed (256) hide show
  1. package/README.md +18 -8
  2. package/docs/.nojekyll +1 -0
  3. package/docs/assets/highlight.css +134 -0
  4. package/docs/assets/icons.css +1043 -0
  5. package/docs/assets/main.js +52 -0
  6. package/docs/assets/search.js +1 -0
  7. package/docs/assets/style.css +1414 -0
  8. package/docs/classes/five.AnimationFrameLoop.html +15 -0
  9. package/docs/classes/five.BVH.html +10 -0
  10. package/docs/classes/five.BVHIntersect.html +1 -0
  11. package/docs/classes/five.BVHNode.html +7 -0
  12. package/docs/classes/five.BVHVector3.html +1 -0
  13. package/docs/classes/five.Camera.html +11 -0
  14. package/docs/classes/five.Clipper.html +1 -0
  15. package/docs/classes/five.Five.html +335 -0
  16. package/docs/classes/five.InternalWebGLRenderer.html +1 -0
  17. package/docs/classes/five.IntersectMesh.html +1 -0
  18. package/docs/classes/five.Model.html +99 -0
  19. package/docs/classes/five.NetworkSubscribe.html +50 -0
  20. package/docs/classes/five.PBMContainer.html +17 -0
  21. package/docs/classes/five.PBMGroup.html +19 -0
  22. package/docs/classes/five.PBMMaterial.html +29 -0
  23. package/docs/classes/five.PBMMesh.html +7 -0
  24. package/docs/classes/five.PanoCircleMesh.html +7 -0
  25. package/docs/classes/five.PanoCircleMeshCustom.html +7 -0
  26. package/docs/classes/five.PanoCircleMeshSolid.html +7 -0
  27. package/docs/classes/five.Scene.html +3 -0
  28. package/docs/classes/five.Subscribe.html +56 -0
  29. package/docs/classes/five.TextureLoader.html +1 -0
  30. package/docs/classes/five.Tile3D.html +34 -0
  31. package/docs/classes/five.Tile3DModel.html +15 -0
  32. package/docs/classes/five.TileBoundingSphere.html +1 -0
  33. package/docs/classes/five.TileCacheNode.html +1 -0
  34. package/docs/classes/five.TileCubeTextureTarget.html +1 -0
  35. package/docs/classes/five.TileCullingVolume.html +1 -0
  36. package/docs/classes/five.TileOrientedBoundingBox.html +1 -0
  37. package/docs/classes/five.TileRequestScheduler.html +16 -0
  38. package/docs/classes/five.Tileset3D.html +11 -0
  39. package/docs/classes/five.Tileset3DTraverser.html +1 -0
  40. package/docs/classes/five.TilesetCache.html +1 -0
  41. package/docs/classes/five.Work.html +32 -0
  42. package/docs/classes/five.XRButton.html +1 -0
  43. package/docs/classes/gltf_loader.DDSLoader.html +1 -0
  44. package/docs/classes/gltf_loader.DRACOLoader.html +1 -0
  45. package/docs/classes/gltf_loader.GLTFLoader.html +17 -0
  46. package/docs/classes/gltf_loader.GLTFObject.html +7 -0
  47. package/docs/classes/gltf_loader.GLTFParser.html +1 -0
  48. package/docs/classes/gltf_loader.THREEGLTFLoader.html +1 -0
  49. package/docs/classes/line.Line.html +1 -0
  50. package/docs/classes/line.LineGeometry.html +1 -0
  51. package/docs/classes/line.LineMaterial.html +1 -0
  52. package/docs/classes/line.LineSegmentsGeometry.html +1 -0
  53. package/docs/classes/line.THREE_Line2.html +1 -0
  54. package/docs/classes/line.THREE_LineSegments2.html +1 -0
  55. package/docs/classes/react.Store.html +29 -0
  56. package/docs/classes/server.BVH.html +10 -0
  57. package/docs/classes/server.BVHIntersect.html +1 -0
  58. package/docs/classes/server.BVHNode.html +7 -0
  59. package/docs/classes/server.BVHVector3.html +1 -0
  60. package/docs/classes/server.Model.html +70 -0
  61. package/docs/classes/server.PBMContainer.html +7 -0
  62. package/docs/classes/server.PBMGroup.html +9 -0
  63. package/docs/classes/server.PBMMesh.html +7 -0
  64. package/docs/classes/sticker.Sticker.html +32 -0
  65. package/docs/classes/vfx.Airflow.html +1 -0
  66. package/docs/classes/vfx.Flame.html +1 -0
  67. package/docs/classes/vfx.Particle.html +89 -0
  68. package/docs/classes/vfx.SpotLight.html +1 -0
  69. package/docs/index.html +166 -434
  70. package/docs/interfaces/five.AddableObject.html +9 -0
  71. package/docs/interfaces/five.AnimationFrame.html +1 -0
  72. package/docs/interfaces/five.CameraPose.html +1 -0
  73. package/docs/interfaces/five.ClipperParameter.html +1 -0
  74. package/docs/interfaces/five.DepthPanoramaControllerCustomInitArgs.html +28 -0
  75. package/docs/interfaces/five.EventCallback.html +405 -0
  76. package/docs/interfaces/five.FiveInitArgs.html +111 -0
  77. package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +17 -0
  78. package/docs/interfaces/five.ImageOptions.html +18 -0
  79. package/docs/interfaces/five.ImageURLMappings.html +1 -0
  80. package/docs/interfaces/five.ImageURLOptions.html +15 -0
  81. package/docs/interfaces/five.IntersectMeshInterface.html +3 -0
  82. package/docs/interfaces/five.Intersection.html +7 -0
  83. package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +15 -0
  84. package/docs/interfaces/five.ModelControllerCustomInitArgs.html +20 -0
  85. package/docs/interfaces/five.ModelEventCallback.html +26 -0
  86. package/docs/interfaces/five.ModelLodOptions.html +1 -0
  87. package/docs/interfaces/five.MotionKeyframe.html +1 -0
  88. package/docs/interfaces/five.MovePanoOptions.html +42 -0
  89. package/docs/interfaces/five.NetworkOptions.html +9 -0
  90. package/docs/interfaces/five.PBMPanoPicture.html +7 -0
  91. package/docs/interfaces/five.PBMParameters.html +29 -0
  92. package/docs/interfaces/five.PanoCircleMeshCustomOptions.html +1 -0
  93. package/docs/interfaces/five.PanoCircleMeshInterface.html +19 -0
  94. package/docs/interfaces/five.PanoCircleMeshOptions.html +1 -0
  95. package/docs/interfaces/five.PanoCircleMeshSolidOptions.html +1 -0
  96. package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +35 -0
  97. package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +20 -0
  98. package/docs/interfaces/five.Pose.html +37 -0
  99. package/docs/interfaces/five.Scissor.html +14 -0
  100. package/docs/interfaces/five.State.html +21 -0
  101. package/docs/interfaces/five.SubscribeMixinType.emit.html +1 -0
  102. package/docs/interfaces/five.SubscribeMixinType.hasListener.html +1 -0
  103. package/docs/interfaces/five.SubscribeMixinType.off.html +1 -0
  104. package/docs/interfaces/five.SubscribeMixinType.on.html +1 -0
  105. package/docs/interfaces/five.SubscribeMixinType.once.html +1 -0
  106. package/docs/interfaces/five.TextureOptions.html +20 -0
  107. package/docs/interfaces/five.Tile3DModelLoaderOptions.html +3 -0
  108. package/docs/interfaces/five.TileBoundingVolume.html +19 -0
  109. package/docs/interfaces/five.TileContent.html +1 -0
  110. package/docs/interfaces/five.TileCubeNode.html +1 -0
  111. package/docs/interfaces/five.TileCubeTree.html +1 -0
  112. package/docs/interfaces/five.Tileset3dOptions.html +1 -0
  113. package/docs/interfaces/five.TilesetJSON.html +1 -0
  114. package/docs/interfaces/five.TilesetJSONNode.html +1 -0
  115. package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +9 -0
  116. package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +31 -0
  117. package/docs/interfaces/five.WebXRAxesParams.html +1 -0
  118. package/docs/interfaces/five.WebXRControllerParams.html +1 -0
  119. package/docs/interfaces/five.WorkCubeImage.html +13 -0
  120. package/docs/interfaces/five.WorkImage.html +21 -0
  121. package/docs/interfaces/five.WorkInitial.html +13 -0
  122. package/docs/interfaces/five.WorkModel.html +11 -0
  123. package/docs/interfaces/five.WorkModelTiles.html +3 -0
  124. package/docs/interfaces/five.WorkObserver.html +27 -0
  125. package/docs/interfaces/five.WorkTile.html +1 -0
  126. package/docs/interfaces/five.WorkVideo.html +9 -0
  127. package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +31 -0
  128. package/docs/interfaces/gltf_loader.DDS.html +1 -0
  129. package/docs/interfaces/gltf_loader.GLTF.html +7 -0
  130. package/docs/interfaces/gltf_loader.GLTFReference.html +1 -0
  131. package/docs/interfaces/gltf_loader.THREEGLTF.html +1 -0
  132. package/docs/interfaces/react.FiveActionReactCallbacks.html +52 -0
  133. package/docs/interfaces/react.FiveInjectionTypes.html +181 -0
  134. package/docs/interfaces/react.PropTypeOfFiveFeatures.html +1 -0
  135. package/docs/interfaces/server.Intersection.html +7 -0
  136. package/docs/interfaces/server.ModelEventCallback.html +18 -0
  137. package/docs/interfaces/sticker.IntersectionLike.html +8 -0
  138. package/docs/interfaces/vfx.ParticleArgs.html +75 -0
  139. package/docs/interfaces/vfx.ParticleTweenKeyframe.html +1 -0
  140. package/docs/interfaces/vue.FiveActionVueCallbacks.html +60 -0
  141. package/docs/modules/five.SubscribeMixinType.html +1 -0
  142. package/docs/modules/five.html +470 -3006
  143. package/docs/modules/gltf_loader.html +1 -155
  144. package/docs/modules/line.html +1 -210
  145. package/docs/modules/react.html +130 -1507
  146. package/docs/modules/server.html +18 -526
  147. package/docs/modules/sticker.html +1 -151
  148. package/docs/modules/vfx.html +1 -0
  149. package/docs/modules/vue.html +115 -0
  150. package/docs/modules.html +1 -136
  151. package/exporters/staticify.js +210 -0
  152. package/five/index.d.ts +1505 -283
  153. package/five/index.js +362 -1
  154. package/gltf-loader/index.d.ts +90 -5
  155. package/gltf-loader/index.js +260 -1
  156. package/line/index.d.ts +1 -0
  157. package/line/index.js +260 -1
  158. package/package.json +12 -11
  159. package/react/index.d.ts +73 -72
  160. package/react/index.js +260 -1
  161. package/scripts/five-staticify.js +26 -0
  162. package/server/index.d.ts +222 -27
  163. package/server/index.js +357 -1
  164. package/sticker/index.d.ts +2 -1
  165. package/sticker/index.js +260 -1
  166. package/templates/quick-start/package.json +1 -1
  167. package/umd/five-gltf-loader.js +1 -2
  168. package/umd/five-line.js +1 -2
  169. package/umd/five-react.js +1 -2
  170. package/umd/five-sticker.js +1 -2
  171. package/umd/five-vfx.js +1 -0
  172. package/umd/five-vue.js +1 -0
  173. package/umd/five.js +1 -1
  174. package/umd/five.js.LICENSE.txt +58 -118
  175. package/vfx/index.d.ts +264 -0
  176. package/vfx/index.js +260 -0
  177. package/vue/index.d.ts +441 -0
  178. package/vue/index.js +260 -0
  179. package/docs/assets/css/main.css +0 -2660
  180. package/docs/assets/js/main.js +0 -248
  181. package/docs/assets/js/search.js +0 -1
  182. package/docs/classes/five.camera.html +0 -323
  183. package/docs/classes/five.five-1.html +0 -2670
  184. package/docs/classes/five.hashcubetexture.html +0 -252
  185. package/docs/classes/five.internalwebglrenderer.html +0 -212
  186. package/docs/classes/five.model.html +0 -962
  187. package/docs/classes/five.pbmcontainer.html +0 -411
  188. package/docs/classes/five.pbmgroup.html +0 -430
  189. package/docs/classes/five.pbmmaterial.html +0 -533
  190. package/docs/classes/five.pbmmesh.html +0 -254
  191. package/docs/classes/five.scene.html +0 -263
  192. package/docs/classes/five.subscribe.html +0 -569
  193. package/docs/classes/gltf_loader.gltfloader.html +0 -412
  194. package/docs/classes/gltf_loader.gltfobject.html +0 -287
  195. package/docs/classes/line.line-1.html +0 -384
  196. package/docs/classes/line.linegeometry.html +0 -530
  197. package/docs/classes/line.linematerial.html +0 -306
  198. package/docs/classes/line.linesegmentsgeometry.html +0 -477
  199. package/docs/classes/line.three_line2.html +0 -280
  200. package/docs/classes/line.three_linesegments2.html +0 -282
  201. package/docs/classes/react.store.html +0 -605
  202. package/docs/classes/server.model.html +0 -823
  203. package/docs/classes/server.pbmgroup.html +0 -366
  204. package/docs/classes/server.pbmmesh.html +0 -335
  205. package/docs/classes/sticker.sticker-1.html +0 -465
  206. package/docs/interfaces/five.addableobject.html +0 -234
  207. package/docs/interfaces/five.depthpanoramacontrollercustominitargs.html +0 -420
  208. package/docs/interfaces/five.eventcallback.html +0 -2548
  209. package/docs/interfaces/five.fiveinitargs.html +0 -707
  210. package/docs/interfaces/five.floorplancontrollercustominitargs.html +0 -295
  211. package/docs/interfaces/five.imageoptions.html +0 -332
  212. package/docs/interfaces/five.intersection.html +0 -227
  213. package/docs/interfaces/five.intersectmeshinterface.html +0 -188
  214. package/docs/interfaces/five.modelcontrollercustominitargs.html +0 -366
  215. package/docs/interfaces/five.modeleventcallback.html +0 -367
  216. package/docs/interfaces/five.movepanooptions.html +0 -469
  217. package/docs/interfaces/five.panocirclemeshinterface.html +0 -361
  218. package/docs/interfaces/five.panoramacontrollercustominitargs.html +0 -464
  219. package/docs/interfaces/five.panoramalikecontrollercustominitargs.html +0 -364
  220. package/docs/interfaces/five.pbmparameters.html +0 -474
  221. package/docs/interfaces/five.pose.html +0 -270
  222. package/docs/interfaces/five.scissor.html +0 -252
  223. package/docs/interfaces/five.state.html +0 -300
  224. package/docs/interfaces/five.subscribemixintype.emit.html +0 -180
  225. package/docs/interfaces/five.subscribemixintype.haslistener.html +0 -171
  226. package/docs/interfaces/five.subscribemixintype.off.html +0 -198
  227. package/docs/interfaces/five.subscribemixintype.on.html +0 -213
  228. package/docs/interfaces/five.subscribemixintype.once.html +0 -210
  229. package/docs/interfaces/five.topviewcontrollercustominitargs.html +0 -226
  230. package/docs/interfaces/five.vrpanoramacontrollercustominitargs.html +0 -452
  231. package/docs/interfaces/gltf_loader.gltf.html +0 -304
  232. package/docs/interfaces/react.fiveactionreactcallbacks.html +0 -580
  233. package/docs/interfaces/react.fiveinjectiontypes.html +0 -1625
  234. package/docs/interfaces/react.injectfivetoprops.html +0 -280
  235. package/docs/interfaces/server.intersection.html +0 -308
  236. package/docs/interfaces/server.modeleventcallback.html +0 -409
  237. package/docs/interfaces/sticker.intersectionlike.html +0 -223
  238. package/docs/modules/five.subscribemixintype.html +0 -143
  239. package/scripts/export-five-resource/chfs.exe +0 -0
  240. package/scripts/export-five-resource/fileify.js +0 -192
  241. package/scripts/export-five-resource/format-work.js +0 -71
  242. package/scripts/export-five-resource/staticify.js +0 -327
  243. package/scripts/transcode-model/BufferGeometryUtils.js +0 -832
  244. package/scripts/transcode-model/LoaderSupport.js +0 -1545
  245. package/scripts/transcode-model/MTLLoader.js +0 -602
  246. package/scripts/transcode-model/OBJLoader2.js +0 -1470
  247. package/scripts/transcode-model/obj2pbm.js +0 -65
  248. /package/docs/assets/{images/icons.png → icons.png} +0 -0
  249. /package/docs/assets/{images/icons@2x.png → icons@2x.png} +0 -0
  250. /package/docs/assets/{images/widgets.png → widgets.png} +0 -0
  251. /package/docs/assets/{images/widgets@2x.png → widgets@2x.png} +0 -0
  252. /package/resource/{basis_transcoder.js → basis/basis_transcoder.js} +0 -0
  253. /package/resource/{basis_transcoder.wasm → basis/basis_transcoder.wasm} +0 -0
  254. /package/resource/{draco_decoder.js → gltf/draco_decoder.js} +0 -0
  255. /package/resource/{draco_decoder.wasm → gltf/draco_decoder.wasm} +0 -0
  256. /package/resource/{draco_wasm_wrapper.js → gltf/draco_wasm_wrapper.js} +0 -0
package/react/index.d.ts CHANGED
@@ -11,6 +11,8 @@ import * as THREE_2 from 'three';
11
11
  import { Vector2 } from 'three';
12
12
  import { Work } from '@realsee/five';
13
13
 
14
+ export declare function createFiveFeature<T extends FiveInjectionFeature>(...features: T[]): T[];
15
+
14
16
  /**
15
17
  * 创建一个 FiveProvider
16
18
  * 在 React 的体系下,使用 Provider 的方式来组织组件结构。
@@ -29,17 +31,56 @@ import { Work } from '@realsee/five';
29
31
  * ReactDOM.render(<App/>, document.getElementById("app"));
30
32
  * ```
31
33
  */
32
- export declare function createFiveProvider(fiveInitArgs: Omit<FiveInitArgs, "renderer" | "scissor">): {
33
- new (props: FiveProviderPropTypes): {
34
+ export declare function createFiveProvider(fiveInitArgs?: Omit<FiveInitArgs, "renderer" | "scissor">): {
35
+ new (props: FiveProviderPropTypes | Readonly<FiveProviderPropTypes>): {
36
+ /**
37
+ * five 实例,可以通过 FiveProvider 的 ref.five 获取得到
38
+ * 在一些外部调用方面可以尝试使用
39
+ */
40
+ five?: Five;
41
+ unmout: boolean;
42
+ loadWork(work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean): Promise<void>;
43
+ shouldComponentUpdate(nextProps: FiveProviderPropTypes): boolean;
44
+ componentWillUnmount(): void;
45
+ render(): React_2.FunctionComponentElement<React_2.ProviderProps<{
46
+ five: Five;
47
+ loadWork: (work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean) => Promise<void>;
48
+ }>>;
49
+ context: any;
50
+ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<FiveProviderPropTypes>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void;
51
+ forceUpdate(callback?: () => void): void;
52
+ readonly props: Readonly<FiveProviderPropTypes> & Readonly<{
53
+ children?: React_2.ReactNode;
54
+ }>;
55
+ state: Readonly<{}>;
56
+ refs: {
57
+ [key: string]: React_2.ReactInstance;
58
+ };
59
+ componentDidMount?(): void;
60
+ componentDidCatch?(error: Error, errorInfo: React_2.ErrorInfo): void;
61
+ getSnapshotBeforeUpdate?(prevProps: Readonly<FiveProviderPropTypes>, prevState: Readonly<{}>): any;
62
+ componentDidUpdate?(prevProps: Readonly<FiveProviderPropTypes>, prevState: Readonly<{}>, snapshot?: any): void;
63
+ componentWillMount?(): void;
64
+ UNSAFE_componentWillMount?(): void;
65
+ componentWillReceiveProps?(nextProps: Readonly<FiveProviderPropTypes>, nextContext: any): void;
66
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<FiveProviderPropTypes>, nextContext: any): void;
67
+ componentWillUpdate?(nextProps: Readonly<FiveProviderPropTypes>, nextState: Readonly<{}>, nextContext: any): void;
68
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<FiveProviderPropTypes>, nextState: Readonly<{}>, nextContext: any): void;
69
+ };
70
+ new (props: FiveProviderPropTypes, context: any): {
34
71
  /**
35
72
  * five 实例,可以通过 FiveProvider 的 ref.five 获取得到
36
73
  * 在一些外部调用方面可以尝试使用
37
74
  */
38
75
  five?: Five;
39
- loadWork(work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number): void;
76
+ unmout: boolean;
77
+ loadWork(work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean): Promise<void>;
40
78
  shouldComponentUpdate(nextProps: FiveProviderPropTypes): boolean;
41
79
  componentWillUnmount(): void;
42
- render(): JSX.Element;
80
+ render(): React_2.FunctionComponentElement<React_2.ProviderProps<{
81
+ five: Five;
82
+ loadWork: (work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean) => Promise<void>;
83
+ }>>;
43
84
  context: any;
44
85
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<FiveProviderPropTypes>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void;
45
86
  forceUpdate(callback?: () => void): void;
@@ -101,7 +142,7 @@ export declare function createStore<T extends StoreValueMapType, A extends Store
101
142
  onValuesChange?: (value: T, prevValue: T) => void;
102
143
  children: React_2.ReactNode;
103
144
  }): boolean;
104
- render(): JSX.Element;
145
+ render(): React_2.FunctionComponentElement<React_2.ProviderProps<Store<T>>>;
105
146
  context: any;
106
147
  setState<K_3 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{
107
148
  initialValue: T;
@@ -174,26 +215,6 @@ export declare interface FiveActionReactCallbacks {
174
215
  * @returns Promise 是否移动成功
175
216
  */
176
217
  updateCamera(pose: Pose, duration: number): Promise<void>;
177
- /**
178
- * 初始化 initBasisLoader
179
- * @description
180
- * 同初始化的 initBasisLoader 参数。用于初始化 basisLoader。
181
- * basisLoader 只会初始化一次,一旦初始化则不会再修改。
182
- *
183
- * @param transcoderResourcePath - basis 解析器路径
184
- * 如果不设置,使用默认解析器 basis 解析器。
185
- * 可以传入解析器的 `resourcePath`, 则使用指定的解析器
186
- * @example
187
- * ```
188
- * // 使用默认解析器
189
- * initialBasisLoader();
190
- *
191
- * // 使用指定解析器
192
- * // 会调用这个目录下的 basis_transcoder.js basis_transcoder.wasm 文件作为解析器
193
- * initialBasisLoader("https://vrlab-public.ljcdn.com/release/static/image/release/five/basis/");
194
- * ```
195
- */
196
- initBasisLoader(transcoderResourcePath?: string): void;
197
218
  /**
198
219
  * 获取画面中的像素颜色
199
220
  * @param x - 获取像素区域的起始坐标 x
@@ -255,7 +276,7 @@ export declare const FiveCanvas: React_2.FC<{
255
276
 
256
277
  export declare type FiveInjectionActionFeature = "loadWork" | "setState" | "on" | "off" | "intersectRaycaster" | "project2d" | "updateCamera" | "initBasisLoader" | "getPixels" | "render" | "needsRender" | "preloadPano" | "showFloor" | "toggleHelperVisible";
257
278
 
258
- export declare type FiveInjectionDataFeature = "unsafe__fiveInstance" | "currentState" | "state" | "work" | "scene" | "cameraDirection" | "cameraRaycaster" | "modelReadyState" | "shownFloor" | "totalFloorLength" | "helperVisible";
279
+ export declare type FiveInjectionDataFeature = "unsafe__fiveInstance" | "currentState" | "currentObserver" | "state" | "work" | "model" | "scene" | "cameraDirection" | "cameraRaycaster" | "modelReadyState" | "shownFloor" | "totalFloorLength" | "helperVisible";
259
280
 
260
281
  export declare type FiveInjectionFeature = FiveInjectionDataFeature | FiveInjectionActionFeature;
261
282
 
@@ -398,26 +419,6 @@ export declare interface FiveInjectionTypes extends Record<FiveInjectionFeature,
398
419
  * @returns Promise 是否移动成功
399
420
  */
400
421
  updateCamera: Five["updateCamera"];
401
- /**
402
- * 初始化 initBasisLoader
403
- * @description
404
- * 同初始化的 initBasisLoader 参数。用于初始化 basisLoader。
405
- * basisLoader 只会初始化一次,一旦初始化则不会再修改。
406
- *
407
- * @param transcoderResourcePath - basis 解析器路径
408
- * 如果不设置,使用默认解析器 basis 解析器。
409
- * 可以传入解析器的 `resourcePath`, 则使用指定的解析器
410
- * @example
411
- * ```
412
- * // 使用默认解析器
413
- * five.initialBasisLoader();
414
- *
415
- * // 使用指定解析器
416
- * // 会调用这个目录下的 basis_transcoder.js basis_transcoder.wasm 文件作为解析器
417
- * five.initialBasisLoader("https://vrlab-public.ljcdn.com/release/static/image/release/five/basis/");
418
- * ```
419
- */
420
- initBasisLoader: Five["initBasisLoader"];
421
422
  /**
422
423
  * 获取画面中的像素颜色
423
424
  * @param x - 获取像素区域的起始坐标 x
@@ -472,22 +473,24 @@ export declare interface FiveInjectionTypes extends Record<FiveInjectionFeature,
472
473
 
473
474
  export declare type FiveProviderPropTypes = {
474
475
  work?: Work;
475
- initialWork?: Work;
476
+ initialWork?: Work | Promise<Work>;
476
477
  initialState?: "inherit" | "initial" | Partial<Omit<State, "offset">>;
478
+ initialUserAction?: boolean;
477
479
  onWorkChange?: (work: Work) => void;
478
480
  onStateChange?: (state: State, userAction: boolean) => void;
479
481
  onCurrentStateChange?: (state: State, userAction: boolean) => void;
482
+ onError?: (error: Error) => void;
480
483
  children: React_2.ReactNode;
481
484
  };
482
485
 
483
486
  export declare type FiveProviderType = ReturnType<typeof createFiveProvider>;
484
487
 
485
- export declare interface InjectFiveToProps<F extends FiveInjectionFeature> {
486
- [INJECTION_PROPNAME]: Pick<FiveInjectionTypes, F>;
487
- }
488
-
489
488
  export declare const INJECTION_PROPNAME = "$five";
490
489
 
490
+ export declare interface PropTypeOfFiveFeatures<F extends FiveInjectionFeature[]> {
491
+ [INJECTION_PROPNAME]: Pick<FiveInjectionTypes, F[number]>;
492
+ }
493
+
491
494
  /**
492
495
  * 监听者模式
493
496
  * @template T - 预设的监听回调类型
@@ -563,18 +566,6 @@ export declare function unsafe__useFiveInstance(): Five;
563
566
  * updateCamera(pose: Pose, duration: number): Promise<void>
564
567
  * ```
565
568
  *
566
- * @function initBasisLoader
567
- * ```
568
- * 初始化 initBasisLoader
569
- * 同初始化的 initBasisLoader 参数。用于初始化 basisLoader。
570
- * basisLoader 只会初始化一次,一旦初始化则不会再修改。
571
- *
572
- * // param transcoderResourcePath
573
- * // 如果不设置,使用默认解析器 basis 解析器。
574
- * // 可以传入解析器的 `resourcePath`, 则使用指定的解析器
575
- * initBasisLoader(transcoderResourcePath?: string): void,
576
- * ```
577
- *
578
569
  * @function getPixels
579
570
  * ```
580
571
  * 获取画面中的像素颜色
@@ -639,6 +630,16 @@ export declare function useFiveCameraDirection(): THREE_2.Vector3;
639
630
  */
640
631
  export declare function useFiveCameraRaycaster(): THREE_2.Raycaster;
641
632
 
633
+ /**
634
+ * Five React Hooks: Five 的当前观测点
635
+ * @returns Work.observers[number] 当前观测点, 如果 work 未加载则为 null
636
+ * @example
637
+ * ```
638
+ * const observer = useFiveCurrentObserver();
639
+ * ```
640
+ */
641
+ export declare function useFiveCurrentObserver(): Work["observers"][number] | null;
642
+
642
643
  /**
643
644
  * Five React Hooks: Five 的实时状态
644
645
  * @returns
@@ -650,7 +651,7 @@ export declare function useFiveCameraRaycaster(): THREE_2.Raycaster;
650
651
  */
651
652
  export declare function useFiveCurrentState(): [
652
653
  currentState: State,
653
- setState: (state: Partial<State>, immediately?: boolean) => void
654
+ setState: (state: Partial<State> | ((prevState: State) => Partial<State>), immediately?: boolean, userAction?: boolean) => void
654
655
  ];
655
656
 
656
657
  /**
@@ -669,7 +670,7 @@ export declare function useFiveEventCallback<T extends keyof EventCallback>(name
669
670
  * [ shownFloor: Five 当前显示的楼层, null 为都显示, showFloor: 设置显示楼层,不传参数为都显示 ]
670
671
  * @example
671
672
  * ```
672
- * const [ shownFloor, showFloor ] = useFiveHelper;
673
+ * const [ shownFloor, showFloor ] = useFiveFloor;
673
674
  * ```
674
675
  */
675
676
  export declare function useFiveFloor(): [
@@ -713,7 +714,7 @@ toggleHelperVisible: (visible: boolean) => void
713
714
  export declare function useFiveModelIntersectRaycaster(): (raycaster: THREE_2.Raycaster) => Intersection[];
714
715
 
715
716
  /**
716
- * Five React Hooks: 获取当前模型碰加载状态
717
+ * Five React Hooks: 获取当前模型加载状态
717
718
  * @returns
718
719
  * "Loaded": 加载完成
719
720
  * "Empty" 加载未完成
@@ -751,10 +752,10 @@ export declare const useFiveScene: typeof useFiveSceneEffect;
751
752
  * @param callback - 获取 Five 的 Scene 的回调函数
752
753
  * @example
753
754
  * ```
754
- * useFiveScene(scene => {
755
+ * useFiveSceneEffect(scene => {
755
756
  * // object is a THREE.Object3D
756
757
  * scene.add(object);
757
- * return () => scene.remove(object);
758
+ * return () => scene.remove(object); // 析构函数
758
759
  * });
759
760
  * ```
760
761
  */
@@ -762,7 +763,7 @@ export declare function useFiveSceneEffect(callback: (scene: Scene) => void | ((
762
763
 
763
764
  export declare function useFiveState(): [
764
765
  state: State,
765
- setState: (state: Partial<State>, immediately?: boolean) => void
766
+ setState: (state: Partial<State> | ((prevState: State) => Partial<State>), immediately?: boolean, userAction?: boolean) => void
766
767
  ];
767
768
 
768
769
  /**
@@ -789,10 +790,10 @@ setState: (state: Partial<State>, immediately?: boolean) => void
789
790
  * ```
790
791
  */
791
792
  export declare function useFiveWork(): [
792
- work: Work,
793
- loadWork: (work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number) => void
793
+ work: Work | undefined,
794
+ loadWork: (work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean) => Promise<void>
794
795
  ];
795
796
 
796
- export declare function withFive<F extends FiveInjectionFeature>(...features: F[]): <P extends InjectFiveToProps<F>, C extends React_2.ComponentClass<P, any>>(Component: C & React_2.ComponentClass<P, any>) => React_2.ForwardRefExoticComponent<React_2.PropsWithoutRef<Omit<P, "$five">> & React_2.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">>>;
797
+ export declare function withFive<F extends FiveInjectionFeature[]>(features: F): <P extends PropTypeOfFiveFeatures<F>, C extends React_2.ComponentClass<P, any>>(Component: C & React_2.ComponentClass<P, any>) => React_2.ForwardRefExoticComponent<React_2.PropsWithoutRef<Omit<P, "$five">> & React_2.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">>>;
797
798
 
798
799
  export { }
package/react/index.js CHANGED
@@ -1 +1,260 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react"),t=require("three"),n=require("@realsee/five");function o(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var u=o(r),i=o(t),a=[];var f=u.createContext(null);function s(){var e=u.useContext(f);if(!e)throw new Error("FiveProvider never found.");return e.five}function c(){var e=u.useContext(f);if(!e)throw new Error("FiveProvider never found.");return e.loadWork}var l={display:"inline-block",overflow:"hidden"};function d(e,r){var t=s(),n=[t];void 0!==r&&(n=n.concat(r)),u.useLayoutEffect((function(){return e(t.scene)}),n)}var v=d;function p(r){return e.__assign({},r.state)}function h(e){var r=e.camera.getWorldDirection(new i.Vector3);return new i.Raycaster(e.camera.position,r)}function m(e){return e.camera.getWorldDirection(new i.Vector3)}function y(e){return e.model.empty?"Empty":"Loaded"}function g(e,r){return r.indexOf(e)>=0}function S(e,r){for(var t=0,n=Object.keys(r);t<n.length;t++){var o=n[t];void 0!==r[o]&&(e[o]=r[o])}}function C(r,t){var n=g("state",t),o=u.useState(Symbol()),i=o[0],a=o[1],f=u.useMemo((function(){if(n)return e.__assign({},r.state)}),[r,i]);return u.useLayoutEffect((function(){if(n)return r.on("stateChange",(function(){return a(Symbol())}))}),[r]),[f,i]}function w(e,r){var t=g("currentState",r),n=u.useState(Symbol()),o=n[0],i=n[1],a=u.useMemo((function(){if(t)return e.getCurrentState()}),[e,o]);return u.useLayoutEffect((function(){if(t)return e.on("currentStateChange",(function(){return i(Symbol())}))}),[e]),[a,o]}function b(e,r){return[g("unsafe__fiveInstance",r)?e:void 0]}function k(e,r){var t=g("work",r),n=u.useState(Symbol()),o=n[0],i=n[1],a=u.useMemo((function(){if(t)return e.work}),[e,o]);return u.useLayoutEffect((function(){if(t)return e.on("load",(function(){return i(Symbol())}))}),[e]),[a,o]}function E(e,r){return[g("scene",r)?e.scene:void 0]}function x(e,r){var t=g("cameraDirection",r),n=u.useState(Symbol()),o=n[0],a=n[1],f=u.useMemo((function(){if(t)return e.camera.getWorldDirection(new i.Vector3)}),[e,o]);return u.useLayoutEffect((function(){if(t)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,o]}function L(e,r){var t=g("cameraRaycaster",r),n=u.useState(Symbol()),o=n[0],a=n[1],f=u.useMemo((function(){if(t){var r=e.camera.getWorldDirection(new i.Vector3);return new i.Raycaster(e.camera.position,r)}}),[e,o]);return u.useLayoutEffect((function(){if(t)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,o]}function _(e,r){var t=g("modelReadyState",r),n=u.useState(Symbol()),o=n[0],i=n[1],a=u.useMemo((function(){if(t)return e.model.empty?"Empty":"Loaded"}),[e,o]);return u.useLayoutEffect((function(){if(t)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,o]}function F(e,r){var t=g("shownFloor",r),n=u.useState(Symbol()),o=n[0],i=n[1],a=u.useMemo((function(){if(t)return e.model.shownFloor}),[e,o]);return u.useLayoutEffect((function(){if(t)return e.on("modelShownFloorChange",(function(){return i(Symbol())}))}),[e]),[a,o]}function P(e,r){var t=g("totalFloorLength",r),n=u.useState(Symbol()),o=n[0],i=n[1],a=u.useMemo((function(){if(t)return e.model.hasFloors()}),[e,o]);return u.useLayoutEffect((function(){if(t)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,o]}function R(e,r){var t=g("helperVisible",r),n=u.useState(Symbol()),o=n[0],i=n[1],a=u.useMemo((function(){if(t)return e.helperVisible}),[e,o]);return u.useLayoutEffect((function(){if(t)return e.on("helpersVisibleChange",(function(){return i(Symbol())}))}),[e]),[a,o]}function V(e,r){if(g("loadWork",r))return e}function W(e,r){if(g("setState",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.setState.apply(e,r)}}function M(e,r){if(g("on",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.on.apply(e,r)}}function O(e,r){if(g("on",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.once.apply(e,r)}}function j(e,r){if(g("off",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.off.apply(e,r)}}function N(e,r){if(g("intersectRaycaster",r))return function(){for(var r,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(r=e.model).intersectRaycaster.apply(r,t)}}function A(e,r){if(g("project2d",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.project2d.apply(e,r)}}function D(e,r){if(g("updateCamera",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.updateCamera.apply(e,r)}}function U(e,r){if(g("initBasisLoader",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.initBasisLoader.apply(e,r)}}function B(e,r){if(g("getPixels",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.getPixels.apply(e,r)}}function I(e,r){if(g("render",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.render.apply(e,r)}}function q(e,r){if(g("needsRender",r))return function(){e.needsRender=!0}}function H(e,r){if(g("preloadPano",r))return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.preloadPano.apply(e,r)}}function z(e,r){if(g("showFloor",r))return function(r){"number"==typeof r?e.model.show(r):e.model.show()}}function G(e,r){if(g("toggleHelperVisible",r))return function(r){e.helperVisible=r}}function T(e,r){for(var t={},n=r.length,o=-1;++o<n;){var u=r[o];u in e&&(t[u]=e[u])}return t}function $(e,r){for(var t=0;t<e.length;t++)for(var n=0;t<r.length;n++)if(e[t]===r[n])return!0;return!1}var J=function(){function r(e,r){this.values=e,this.listeners=[],this.onValuesChange=r}return r.prototype.on=function(e,r){var t=this,n=[e,r];return this.listeners.push(n),function(){var e=t.listeners.indexOf(n);e>=0&&t.listeners.splice(e,1)}},r.prototype.getValues=function(e){return T(this.values,e)},r.prototype.setValues=function(r,t){var n,o,u=[];for(var i in t)r.indexOf(i)>=0&&(n=t[i],o=this.values[i],!("number"==typeof n&&"number"==typeof o&&isNaN(n)&&isNaN(o)||n===o))&&u.push(i);if(0!==u.length){for(var a=e.__assign({},this.values),f=0,s=u;f<s.length;f++){var c=s[f];this.values[c]=t[c]}this.onValuesChange&&this.onValuesChange(this.values,a);for(var l=0,d=this.listeners;l<d.length;l++){var v=d[l],p=v[0],h=v[1];if($(p,u)){var m=T(a,p);h(T(this.values,p),m)}}}},r}();exports.FiveCanvas=function(r){var t=r.width,n=r.height,o=s(),i=u.createRef(),a=e.__assign({width:t,height:n},l);return u.useLayoutEffect((function(){if(i.current){if(null!==o.renderer.domElement.parentNode&&o.renderer.domElement.parentNode!==i.current)throw new Error("There are more than 2 fiveCanvas in this context.");o.renderer.domElement.parentNode!==i.current&&i.current.appendChild(o.renderer.domElement),o.camera.aspect=t/n,o.camera.updateProjectionMatrix(),o.renderer.setSize(t,n),o.needsRender=!0}}),[t,n,i.current]),u.createElement("div",{ref:i,style:a})},exports.INJECTION_PROPNAME="$five",exports.Store=J,exports.createFiveProvider=function(r){return function(t){function o(o){var u=t.call(this,o)||this;if(!o.work&&!o.initialWork)throw new Error("props 'work' or 'initialWork' is never set.");var f=function(e){var r=void 0===e?{}:e,t=r.backgroundColor,n=void 0===t?1579548:t,o=r.backgroundAlpha,u=void 0===o?1:o,f=r.pixelRatio,s=void 0===f?1:f,c=a.shift();return c||((c=new i.WebGLRenderer({antialias:!1,alpha:!0})).outputEncoding=i.sRGBEncoding),c.setPixelRatio(s),c.setClearColor(n,u),c.autoClear=!0,c}({pixelRatio:1===n.getViewportScale()?window.devicePixelRatio:1});return u.five=new n.Five(e.__assign({renderer:f},r)),u.five.load(o.work||o.initialWork,o.initialState),u.five.on("load",(function(){var e;u.props.onWorkChange&&u.props.onWorkChange(null===(e=u.five)||void 0===e?void 0:e.work)})),u.five.on("stateChange",(function(e,r){u.props.onStateChange&&u.props.onStateChange(e,r)})),u.five.on("currentStateChange",(function(e,r){u.props.onCurrentStateChange&&u.props.onCurrentStateChange(e,r)})),u}return e.__extends(o,t),o.prototype.loadWork=function(e,r,t){var n;if(this.props.work)throw new Error("props 'work' is set in fiveProvider, if you need modify work internal, use 'initialWork' instead.");null===(n=this.five)||void 0===n||n.load(e,r,t)},o.prototype.shouldComponentUpdate=function(e){var r,t;return e.work&&e.work!==(null===(r=this.five)||void 0===r?void 0:r.work)&&(null===(t=this.five)||void 0===t||t.load(e.work,e.initialState)),e.children!==this.props.children},o.prototype.componentWillUnmount=function(){var e;this.five&&(this.five.dispose(),e=this.five.renderer,-1===a.indexOf(e)&&a.push(e),delete this.five)},o.prototype.render=function(){var e=this;return u.createElement(f.Provider,{value:{five:this.five,loadWork:function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return e.loadWork.apply(e,r)}}},this.props.children)},o}(u.Component)},exports.createStore=function(r){var t=u.createContext(null);return{useStore:function(r){var n=u.useContext(t);if(null===n)throw new Error("StoreProvider never found.");var o=u.useRef(!0),i=u.useState(n.getValues(r)),a=i[0],f=i[1],s=e.__spreadArray([n],r);return u.useLayoutEffect((function(){return o.current?o.current=!1:f(n.getValues(r)),n.on(r,(function(e){return f(e)}))}),s),[a,u.useCallback((function(e){return n.setValues(r,e)}),s)]},useStoreSetter:function(r){var n=u.useContext(t);if(null===n)throw new Error("StoreProvider never found.");return u.useCallback((function(e){return n.setValues(r,e)}),e.__spreadArray([n],r))},watchStore:function(r,n,o){var i=u.useContext(t);if(null===i)throw new Error("StoreProvider never found.");var a=e.__spreadArray([i],r);void 0!==o&&(a=a.concat(o)),u.useLayoutEffect((function(){return i.on(r,n)}),a)},useStoreAction:function(n){var o=u.useContext(t);if(null===o)throw new Error("StoreProvider never found.");return u.useCallback((function(){for(var t=[],u=0;u<arguments.length;u++)t[u]=arguments[u];var i=r[n],a=i[0],f=i.slice(1),s=function(){return o.getValues(f)},c=function(e){return o.setValues(f,e)};return a.apply(void 0,e.__spreadArray([s,c],t))}),[])},StoreProvider:function(r){function n(e){var t=r.call(this,e)||this;return t.store=new J(e.initialValue,(function(){for(var e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];t.props.onValuesChange&&(e=t.props).onValuesChange.apply(e,r)})),t}return e.__extends(n,r),n.prototype.shouldComponentUpdate=function(e){return e.children!==this.props.children},n.prototype.render=function(){return u.createElement(t.Provider,{value:this.store},this.props.children)},n}(u.Component)}},exports.unsafe__useFiveInstance=function(){return s()},exports.useFiveAction=function(){var e=s();return{updateCamera:u.useCallback((function(r,t){return e.updateCamera(r,t)}),[e]),initBasisLoader:u.useCallback((function(r){return e.initBasisLoader(r)}),[e]),getPixels:u.useCallback((function(r,t,n,o,u){return e.getPixels(r,t,n,o,u)}),[e]),render:u.useCallback((function(r){return e.render(r)}),[e]),needsRender:u.useCallback((function(){return e.needsRender=!0}),[e]),preloadPano:u.useCallback((function(r,t){return e.preloadPano(r,t)}),[e])}},exports.useFiveCameraDirection=function(){var e=s(),r=u.useState((function(){return m(e)})),t=r[0],n=r[1];return u.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return n(m(e))}))}),[e]),t},exports.useFiveCameraRaycaster=function(){var e=s(),r=u.useState((function(){return h(e)})),t=r[0],n=r[1];return u.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return n(h(e))}))}),[e]),t},exports.useFiveCurrentState=function(){var e=s(),r=u.useState((function(){return e.getCurrentState()})),t=r[0],n=r[1],o=u.useCallback((function(r,t){void 0===t&&(t=!1),e.setState(r,t)}),[e]);return u.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return n(e.getCurrentState())}))}),[e]),[t,o]},exports.useFiveEventCallback=function(e,r,t){var n=u.useState({});n[0],n[1];var o=s();if(!o)throw new Error("fiveProvider never found.");var i=[o,e];void 0!==t&&(i=i.concat(t)),u.useLayoutEffect((function(){return o.on(e,r)}),i)},exports.useFiveFloor=function(){var e=s(),r=u.useState(e.model.shownFloor),t=r[0],n=r[1],o=u.useState(e.model.floorLength),i=o[0],a=o[1],f=u.useCallback((function(r){"number"==typeof r?e.model.show(r):e.model.show()}),[e]);return u.useLayoutEffect((function(){var r=[];return r.push(e.on("modelShownFloorChange",(function(){return n(e.model.shownFloor)}))),r.push(e.on("modelLoaded",(function(){return a(e.model.floorLength)}))),function(){for(var e;e=r.shift();)e()}}),[e]),[t,i,f]},exports.useFiveHelper=function(){var e=s(),r=u.useState(e.helperVisible),t=r[0],n=r[1],o=u.useCallback((function(r){e.helperVisible=r}),[e]);return u.useLayoutEffect((function(){return e.on("helpersVisibleChange",(function(e){return n(e)}))}),[e]),[t,o]},exports.useFiveModelIntersectRaycaster=function(){var e=s();return u.useCallback((function(r){return e.model.intersectRaycaster(r)}),[e])},exports.useFiveModelReadyState=function(){var e=s(),r=u.useState((function(){return y(e)})),t=r[0],n=r[1];return u.useLayoutEffect((function(){return e.on("modelLoaded",(function(){return n(y(e))}))}),[e]),t},exports.useFiveProject2d=function(){var e=s();return u.useCallback((function(r,t){return e.project2d(r,t)}),[e])},exports.useFiveScene=v,exports.useFiveSceneEffect=d,exports.useFiveState=function(){var e=s(),r=u.useState((function(){return p(e)})),t=r[0],n=r[1],o=u.useCallback((function(r,t){void 0===t&&(t=!1),e.setState(r,t)}),[e]);return u.useLayoutEffect((function(){return e.on("stateChange",(function(){return n(p(e))}))}),[e]),[t,o]},exports.useFiveWork=function(){var e=s(),r=c(),t=u.useState((function(){return e.work})),n=t[0],o=t[1];return u.useLayoutEffect((function(){return e.on("load",(function(){return o(e.work)}))}),[e]),[n,r]},exports.withFive=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return function(t){return u.forwardRef((function(n,o){var i=s(),a=c(),f=b(i,r)[0],l=C(i,r),d=l[0],v=l[1],p=w(i,r),h=p[0],m=p[1],y=k(i,r),g=y[0],T=y[1],$=E(i,r)[0],J=x(i,r),K=J[0],Q=J[1],X=L(i,r),Y=X[0],Z=X[1],ee=_(i,r),re=ee[0],te=ee[1],ne=F(i,r),oe=ne[0],ue=ne[1],ie=P(i,r),ae=ie[0],fe=ie[1],se=R(i,r),ce=se[0],le=se[1],de=u.useMemo((function(){var e={};return S(e,{setState:W(i,r),loadWork:V(a,r),on:M(i,r),once:O(i,r),off:j(i,r),intersectRaycaster:N(i,r),project2d:A(i,r),updateCamera:D(i,r),initBasisLoader:U(i,r),getPixels:B(i,r),render:I(i,r),needsRender:q(i,r),preloadPano:H(i,r),showFloor:z(i,r),toggleHelperVisible:G(i,r)}),e}),[i,a]),ve=u.useMemo((function(){var r=e.__assign({},de);return S(r,{unsafe__fiveInstance:f,state:d,currentState:h,work:g,scene:$,cameraDirection:K,cameraRaycaster:Y,modelReadyState:re,shownFloor:oe,totalFloorLength:ae,helperVisible:ce}),r}),[i,de,v,m,T,Q,Z,te,ue,fe,le]);return u.createElement(t,e.__assign({ref:o,$five:ve},n))}))}};
1
+ /**
2
+ * @realsee/five
3
+ *
4
+ * Generated: 2023-08-07
5
+ * Version: 5.0.0-alpha.210
6
+ *
7
+ * Terms:
8
+ * Realsee SDK License Agreement
9
+ *
10
+ * Update: July 28, 2021
11
+ *
12
+ * THIS LICENSE AGREEMENT BETWEEN YOU AND 【BEIKE REALSEE TECHNOLOGY (HK)
13
+ * LIMITED】(“Realsee”) FORMS A LEGALLY BINDING CONTRACT BETWEEN YOU AND REALSEE IN
14
+ * RELATION TO YOUR USE OF THE SDK. This License Agreement accompanies the Realsee
15
+ * Software Development Kit(s) for the software and related explanatory materials
16
+ * (the "SDK") and includes any upgrades, modified versions, updates, additions,
17
+ * and copies of the SDK licensed to You by Realsee.
18
+ * BY DOWNLOADING, INSTALLING, OR OTHERWISE ACCESSING OR USING THE SDK, YOU AGREE
19
+ * THAT YOU HAVE READ, UNDERSTOOD, AND AGREE TO BE BOUND BY THIS AGREEMENT. YOU ARE
20
+ * AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO
21
+ * THE TERMS AND CONDITIONS STATED BELOW.
22
+ * This Agreement applies to Your use of the SDK in the country in which You
23
+ * legally install it (“Territory”) and is subject to the laws of such Territory
24
+ * and further subject to Section 12 below. Different terms, conditions, and
25
+ * limitations may apply to the use of the SDK in any additional countries.
26
+ * 1. DEFINITIONS.
27
+ * “Agreement” means this Realsee SDK License Agreement.
28
+ * “Developer”, “You” and “Your” means the person(s) or entity acquiring or using
29
+ * the SDK or otherwise exercising rights under the terms of this Agreement.
30
+ * “Documentation” means the technical or other specifications or documentation
31
+ * that Realsee may provide to You for use in connection with the SDK.
32
+ * “Integrated Product” means any software, website, or on-line service developed
33
+ * by You based on or using the SDK (collectively, the “Integrated Product”).
34
+ * “Intellectual Property” means any patents, patent rights, trademarks, service
35
+ * marks, registered and unregistered designs, applications for any of the
36
+ * foregoing, copyright, and any other similar protected rights in any country and
37
+ * to the extent recognised by any relevant jurisdiction as intellectual property,
38
+ * trade secrets, know-how and confidential information. Realsee reserves all
39
+ * rights not expressly granted to You.
40
+ * “Realsee” means [Beike Realsee Technology (HK) Limited, a company incorporated
41
+ * and validly existing under the laws of Hong Kong].
42
+ * “SDK” means the Realsee-proprietary Software Development Kits (SDK) provided
43
+ * hereunder, includes all development tools (including any compiler and debugger),
44
+ * application programming interfaces (“APIs”), libraries, binary utilities, header
45
+ * files, Documentation, content, data, code samples, and other materials provided
46
+ * to You in connection with this Agreement, whether delivered through a download,
47
+ * or any other media or form, and is licensed, not sold, to You by Realsee for use
48
+ * only under the terms of this Agreement. The terms of this Agreement will govern
49
+ * any updates provided by Realsee that replace and/or supplement the original SDK
50
+ * delivered to You, unless such update is accompanied by a separate license, in
51
+ * which case the terms of such license will govern.
52
+ * 2. LICENSED USES AND RESTRICTIONS.
53
+ * 2.1 Subject to the restrictions contained in this Section 2, Realsee grants to
54
+ * You during the term, a limited, non-exclusive, revocable, non-sublicensable,
55
+ * non-transferable license to install and use the SDK within the Territory only
56
+ * for the purpose of internal development.
57
+ * 2.2 Restrictions. You acknowledge and agree that, You shall not, and shall
58
+ * ensure that Your affiliates, employees, agents, representatives, officers,
59
+ * representatives, and subcontractors do not (directly or indirectly):
60
+ * 2.2.1 decompile, reverse engineer, disassemble or attempt to derive the source
61
+ * code of, those components of the SDK provided in object code form, or any part
62
+ * thereof;
63
+ * 2.2.2 remove, alter, or obscure any copyright notice or other proprietary rights
64
+ * notice on any part of the SDK;
65
+ * 2.2.3 sell, assign, pledge, rent, lease, lend, upload to or host on any website
66
+ * or server for use by any third party except You, redistribute, or sublicense the
67
+ * SDK (or any part thereof), or operate the SDK (or any part thereof) in the
68
+ * capacity of a service bureau or other hosted services provider, in whole or in
69
+ * part, nor may You enable others to do so;
70
+ * 2.2.4 or alter, modify, customize or improve the SDK, or any part thereof;
71
+ * 2.2.5 use the SDK (or any part thereof) for any illegal purpose, in any manner
72
+ * that is inconsistent with the terms of this Agreement, or to engage in any
73
+ * illegal activity;
74
+ * 2.2.6 use the SDK (or any part thereof) in any manner that may damage the
75
+ * operation of Realsee’s products or services; or
76
+ * 2.2.7 use the SDK or any information contained therein or otherwise provided by
77
+ * Realsee for the purpose of developing, or having developed, any product
78
+ * competitive with any Realsee product or service, as determined by Realsee in its
79
+ * sole discretion;
80
+ * 2.2.8 include any portion of the SDK in Your Developer products.
81
+ * 2.3 Realsee has the right to impose reasonable conditions such as a reasonable
82
+ * fee for use of the SDK in Integrated Product in the future.
83
+ * 2.4 You may make a limited number of copies of the SDK to be used by Your
84
+ * employees or consultants as provided herein, and not for general business
85
+ * purposes, and such employees or consultants shall be subject to the obligations
86
+ * and restrictions in this Agreement.
87
+ * 2.5 All licenses not expressly granted in this Agreement are reserved and no
88
+ * other licenses, immunity, or rights, express or implied, are granted by Realsee,
89
+ * by implication, estoppel, or otherwise.
90
+ * 3. CONFIDENTIALITY.
91
+ * The SDK and all source code, Documentation, specifications, engineering details,
92
+ * and related information pertaining to the SDK, whether in oral, written,
93
+ * graphic, or electronic form, are and shall remain the confidential and
94
+ * proprietary information of Realsee or its licensors (collectively, the
95
+ * “Confidential Information”). You shall (i) disclose Confidential Information to
96
+ * only those directors and employees (collectively, “Affiliates”) whose duties
97
+ * justify their need to know such information and who have been clearly informed
98
+ * of their obligation to maintain the confidential, proprietary, and/or trade
99
+ * secret status of such Confidential Information; and (ii) use Confidential
100
+ * Information solely in accordance with the license granted hereunder. In any
101
+ * event, You and Your Affiliates shall treat Confidential Information as strictly
102
+ * confidential and shall use the same care to prevent disclosure of such
103
+ * information as You use with respect to Your own similar confidential and/or
104
+ * proprietary information, which shall not be less than the care a reasonable
105
+ * person would use under similar circumstances. All Confidential Information, and
106
+ * any copies thereof, shall be returned promptly to Realsee upon request. You
107
+ * shall ensure that Your Affiliates comply with the provisions of this Section 3,
108
+ * and You shall be liable for any breach of this Section 3 resulting from the act
109
+ * or omission of any of Your Affiliates. You shall not disclose Confidential
110
+ * Information to any third party, including, without limitation, any of Your
111
+ * subcontractors.
112
+ * 4. PROPRIETARY RIGHTS.
113
+ * 4.1 As between You and Realsee, Realsee and/or its licensors retain ownership of
114
+ * all right, title, and interest in, to, and under the SDK, including, without
115
+ * limitation, all patents, copyrights, trade secrets, trademarks and other
116
+ * intellectual property and other proprietary rights therein, and reserve all
117
+ * rights not expressly granted to You.
118
+ * 4.2 The items contained in the SDK are the intellectual property of Realsee and
119
+ * its licensors and are protected by PRC copyright and patent law, international
120
+ * treaty provisions and applicable laws of the country in which it is being used.
121
+ * You agree to protect all copyright and other ownership interests of Realsee
122
+ * and/or its licensors in all items in the SDK supplied under this License
123
+ * Agreement. You agree that all copies of the items in the SDK, reproduced for any
124
+ * reason by You, contain the same copyright notices, and other proprietary notices
125
+ * as appropriate, as appear on or in the original items delivered by Realsee in
126
+ * the SDK. Realsee and/or its licensors retain title and ownership of the items in
127
+ * the SDK, the media on which it is loaded, and all subsequent copies, regardless
128
+ * of the form or media in or on which the original and other copies may exist.
129
+ * Except as stated above, this Agreement does not grant You any rights to patents,
130
+ * copyrights, trade secrets, trademarks or any other rights in respect to the
131
+ * items in the SDK.
132
+ * 5. TERM AND TERMINATION.
133
+ * 5.1 This Agreement is effective until terminated. Realsee has the right to
134
+ * terminate this Agreement immediately, without judicial intervention, if You fail
135
+ * to comply with any term herein. Upon any such termination You must remove all
136
+ * full and partial copies of the items in the SDK from Your computer and
137
+ * discontinue the use of the items in the SDK.
138
+ * 5.2 Realsee may at any time, terminate the Agreement with You if: (A) You have
139
+ * breached any provision of the Agreement; or (B) Realsee is required to do so by
140
+ * law; or (C) Realsee decides to no longer provide the SDK or certain parts of the
141
+ * SDK to users in the country in which You are resident or from which You use the
142
+ * service, or the provision of the SDK or certain SDK services to You by Realsee
143
+ * is, in Realsee's sole discretion, no longer legally or commercially viable.
144
+ * 5.3 When the Agreement comes to an end, all of the legal rights, obligations and
145
+ * liabilities that You and Realsee have benefited from, been subject to (or which
146
+ * have accrued over time whilst the Agreement has been in force) or which are
147
+ * expressed to continue indefinitely, shall be unaffected by this cessation, and
148
+ * the provisions of Section 3, 4, 6, 7 and 8 shall continue to apply to such
149
+ * rights, obligations and liabilities indefinitely.
150
+ * 6. DISCLAIMER OF WARRANTY.
151
+ * YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT, TO THE EXTENT PERMITTED BY APPLICABLE
152
+ * LAW, USE OF THE SDK (OR ANY PART THEREOF) IS AT YOUR SOLE RISK AND THAT THE
153
+ * ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY, AND EFFORT IS
154
+ * WITH YOU. REALSEE LICENSES THE SDK TO YOU ONLY ON AN "AS-IS" BASIS. REALSEE
155
+ * MAKES NO REPRESENTATION WITH RESPECT TO THE ADEQUACY OF ANY ITEMS IN THE SDK,
156
+ * WHETHER OR NOT USED BY YOU IN THE DEVELOPMENT OF INTEGRATED PRODUCT, FOR ANY
157
+ * PARTICULAR PURPOSE OR WITH RESPECT TO THEIR ADEQUACY TO PRODUCE ANY PARTICULAR
158
+ * RESULT. REALSEE AND ITS LICENSORS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING
159
+ * OUT OF THIS AGREEMENT OR FROM THE DISTRIBUTION OR USE OF INTEGRATED PRODUCT
160
+ * CONTAINING PORTIONS OF THE SDK. REALSEE AND ITS LICENSORS DISCLAIM ALL
161
+ * WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED
162
+ * CONDITIONS OR WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
163
+ * OR NONINFRINGEMENT OF ANY THIRD PARTY RIGHT IN RESPECT OF THE ITEMS IN THE SDK
164
+ * OR ANY SERVICES RELATED TO THE SDK.
165
+ * REALSEE IS UNDER NO OBLIGATION TO PROVIDE ANY SUPPORT UNDER THIS LICENSE
166
+ * AGREEMENT, INCLUDING UPGRADES OR FUTURE VERSIONS OF THE SDK OR ANY PORTIONS
167
+ * THEREOF, TO YOU, END USER OR TO ANY OTHER PARTY.
168
+ * 7. LIMITATION OF LIABILITY.
169
+ * TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, IN NO EVENT WILL REALSEE OR ITS
170
+ * LICENSORS BE LIABLE FOR ANY DIRECT, INCIDENTAL, SPECIAL, INDIRECT, OR
171
+ * CONSEQUENTIAL DAMAGES, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE,
172
+ * LOSS OF BUSINESS, REVENUE, OR PROFITS, LOSS OF OPPORTUNITY (WHETHER DIRECT OR
173
+ * INDIRECT), CORRUPTION OR LOSS OF DATA, LOSS OF REPUTATION OR SAVINGS, DOWNTIME,
174
+ * OR DAMAGE TO, LOSS OF OR REPLACEMENT OF DATA OR TRANSACTIONS, COST OF
175
+ * PROCUREMENT OF SUBSTITUTE SERVICES, BUSINESS INTERRUPTION, OR ANY OTHER
176
+ * COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR INABILITY
177
+ * TO USE THE SDK (OR ANY PART THEREOF), ANY INTEGRATED PRODUCT, OR ANY THIRD PARTY
178
+ * SOFTWARE, APPLICATIONS, OR SERVICES IN CONJUNCTION WITH THE SDK (OR ANY PART
179
+ * THEREOF), HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT,
180
+ * OR OTHERWISE) AND EVEN IF REALSEE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
181
+ * DAMAGES. IN NO EVENT WILL REALSEE’S TOTAL LIABILITY TO YOU FOR ALL DAMAGES
182
+ * EXCEED ONE HUNDRED DOLLARS ($100.00). THE FOREGOING LIMITATIONS WILL APPLY EVEN
183
+ * IF THE ABOVE STATED REMEDY FAILS OF ITS ESSENTIAL PURPOSE. THE LIMITATIONS
184
+ * CONTAINED IN SECTIONS 6 AND THIS SECTION 7 ARE A FUNDAMENTAL PART OF THE BASIS
185
+ * OF REALSEE’S BARGAIN HEREUNDER, AND REALSEE WOULD NOT ENTER INTO THIS AGREEMENT
186
+ * OR PROVIDE YOU WITH ACCESS TO THE SDK ABSENT SUCH LIMITATIONS.
187
+ * 8. INDEMNIFICATION.
188
+ * To the extent permitted by applicable law, You agree to indemnify, defend and
189
+ * hold harmless Realsee, its affiliates and each of their directors, officers,
190
+ * employees, independent contractors, and agents (each a “Realsee Indemnified
191
+ * Party”) from any and all claims, losses, liabilities, damages, expenses, and
192
+ * costs (including without limitation attorneys’ fees and court costs) incurred by
193
+ * a Realsee Indemnified Party as a result of: (i) Your non-compliance with any
194
+ * terms of this Agreement; (ii) Your use of the SDK (or any part thereof); or
195
+ * (iii) Your use of any Integrated Product, including any claim that Integrated
196
+ * Product infringes the copyright, trademark, trade secret or other intellectual
197
+ * property right of a third party.
198
+ * 9. ACKNOWLEDGEMENTS.
199
+ * Portions of the SDK may utilize or include third party software and other
200
+ * copyrighted material. Acknowledgments, licensing terms, and disclaimers for such
201
+ * material are contained in Documentation for the SDK or may otherwise accompany
202
+ * such material, and Your use of such materials governed by their respective
203
+ * terms. In the event of conflict between the terms of this Agreement and an
204
+ * applicable open source or third party agreement, the open source or third party
205
+ * agreement will control solely with respect to the open source software or third
206
+ * party software. Moreover, You shall not subject any items (including not limited
207
+ * to source code, object code, and any software) included in the SDK to any open
208
+ * source license.
209
+ * 10. NON-BLOCKING OF REALSEE DEVELOPMENT.
210
+ * You acknowledge that Realsee is currently developing or may develop technologies
211
+ * and products in the future that have or may have design and/or functionality
212
+ * similar to Integrated Product that You may develop based on Your license herein.
213
+ * Nothing in this Agreement shall impair, limit or curtail Realsee's right to
214
+ * continue with its development, maintenance and/or distribution of Realsee's
215
+ * technology or products.
216
+ * 11. GENERAL.
217
+ * 11.1 Export Control. You may not use or otherwise export or re-export the SDK
218
+ * (or any part thereof) except as authorized by United States law and the laws of
219
+ * the jurisdiction(s) in which the SDK (or any part thereof) was obtained. In
220
+ * particular, but without limitation, the SDK may not be exported or re-exported
221
+ * (i) into any U.S. embargoed countries or (ii) to anyone on the U.S. Treasury
222
+ * Department's list of Specially Designated Nationals or the U.S. Department of
223
+ * Commerce Denied Person's List or Entity List. By using the SDK (or any part
224
+ * thereof), You represent and warrant that You are not located in any such country
225
+ * or on any such list.
226
+ * 11.2 Governing Law. This Agreement and the rights of the parties hereunder shall
227
+ * be governed by and construed in accordance with the laws of People’s Republic of
228
+ * China (for purpose of this Agreement, excluding Hong Kong, Taiwan, and Macau),
229
+ * without reference to its conflict of laws principles. Any dispute, controversy
230
+ * or claim arising from or in connection with this Agreement, or the breach,
231
+ * termination or invalidity thereof, shall be submitted to China International
232
+ * Economic and Trade Arbitration Commission (“CIETAC”) for arbitration in Beijing
233
+ * which shall be conducted in accordance with the CIETAC's arbitration rules in
234
+ * effect at the time of applying for arbitration. The arbitral award is final and
235
+ * binding upon both parties.
236
+ * 11.3 Severability. If any provision of this Agreement is held by a court of
237
+ * competent jurisdiction to be unenforceable for any reason, the remaining
238
+ * provisions hereof will be unaffected and remain in full force and effect.
239
+ * 11.4. Modifications. Realsee reserves the right, from time to time, with or
240
+ * without notice to You, to make revisions to this Agreement in our sole and
241
+ * absolute discretion. The most current version of this Agreement will supersede
242
+ * all previous versions and shall be made available on the website where the SDK
243
+ * is made available, or by such other means as Realsee may determine in its
244
+ * discretion. Any modified versions of this Agreement hereto shall take effect
245
+ * from the time that it is made available. You shall be responsible for regularly
246
+ * checking for notice of any such modifications. You agree that Your continued use
247
+ * of the SDK constitutes Your agreement to the modified Agreement.
248
+ * 11.5 Relationship of the Parties. This Agreement will not be construed as
249
+ * creating an agency, partnership, joint venture, fiduciary duty, or any other
250
+ * form of legal association between You and Realsee, and You will not represent to
251
+ * the contrary, whether expressly, by implication, appearance, or otherwise.
252
+ * 11.6 Entire Agreement; Governing Language. This Agreement constitutes the entire
253
+ * agreement between You and Realsee with respect to the use of the SDK licensed
254
+ * hereunder and supersedes all prior understandings regarding such subject matter.
255
+ * No amendment to or modification of this Agreement will be binding unless in
256
+ * writing and signed by Realsee. You and Realsee hereto confirm that this
257
+ * Agreement and all related documents shall be drafted in English.
258
+ */
259
+
260
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("three"),r=require("@realsee/five");function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=n(e),u=n(t),i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},i(e,t)};function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var f=function(){return f=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},f.apply(this,arguments)};function c(e,t,r){if(r||2===arguments.length)for(var n,o=0,u=t.length;o<u;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}var s=[],l=[];var v=o.createContext(null);function p(){var e=o.useContext(v);if(!e)throw new Error("FiveProvider never found.");return e.five}function d(){var e=o.useContext(v);if(!e)throw new Error("FiveProvider never found.");return e.loadWork}var h={display:"inline-block",overflow:"hidden"};function m(e,t){var r=p(),n=[r];void 0!==t&&(n=n.concat(t)),o.useLayoutEffect((function(){return e(r.scene)}),n)}var y=m;function g(e){return f({},e.state)}function S(e){var t=e.camera.getWorldDirection(new u.Vector3);return new u.Raycaster(e.camera.position,t)}function b(e){return e.camera.getWorldDirection(new u.Vector3)}function w(e){return e.model.empty?"Empty":"Loaded"}function C(e,t){return t.indexOf(e)>=0}function E(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];void 0!==t[o]&&(e[o]=t[o])}}function k(e,t){if(C("loadWork",t))return e}function x(e,t){if(C("setState",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.setState.apply(e,t)}}function L(e,t){if(C("on",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.on.apply(e,t)}}function F(e,t){if(C("on",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.once.apply(e,t)}}function P(e,t){if(C("off",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.off.apply(e,t)}}function R(e,t){if(C("intersectRaycaster",t))return function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return(t=e.model).intersectRaycaster.apply(t,r)}}function V(e,t){if(C("project2d",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.project2d.apply(e,t)}}function O(e,t){if(C("updateCamera",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.updateCamera.apply(e,t)}}function W(e,t){if(C("getPixels",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.getPixels.apply(e,t)}}function M(e,t){if(C("render",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.render.apply(e,t)}}function _(e,t){if(C("needsRender",t))return function(){e.needsRender=!0}}function j(e,t){if(C("preloadPano",t))return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.preloadPano.apply(e,t)}}function A(e,t){if(C("showFloor",t))return function(t){"number"==typeof t?e.model.show(t):e.model.show()}}function N(e,t){if(C("toggleHelperVisible",t))return function(t){e.helperVisible=t}}function U(e,t){for(var r={},n=t.length,o=-1;++o<n;){var u=t[o];u in e&&(r[u]=e[u])}return r}function D(e,t){for(var r=0;r<e.length;r++)for(var n=0;n<t.length;n++)if(e[r]===t[n])return!0;return!1}var I=function(){function e(e,t){this.values=e,this.listeners=[],this.onValuesChange=t}return e.prototype.on=function(e,t){var r=this,n=[e,t];return this.listeners.push(n),function(){var e=r.listeners.indexOf(n);e>=0&&r.listeners.splice(e,1)}},e.prototype.getValues=function(e){return U(this.values,e)},e.prototype.setValues=function(e,t){var r,n,o=[];for(var u in t)e.indexOf(u)>=0&&(r=t[u],n=this.values[u],!("number"==typeof r&&"number"==typeof n&&isNaN(r)&&isNaN(n)||r===n))&&o.push(u);if(0!==o.length){for(var i=f({},this.values),a=0,c=o;a<c.length;a++){var s=c[a];this.values[s]=t[s]}this.onValuesChange&&this.onValuesChange(this.values,i);for(var l=0,v=this.listeners;l<v.length;l++){var p=v[l],d=p[0],h=p[1];if(D(d,o)){var m=U(i,d);h(U(this.values,d),m)}}}},e}();exports.FiveCanvas=function(e){var t=e.width,r=e.height,n=p(),u=o.createRef(),i=f({width:t,height:r},h);return o.useLayoutEffect((function(){if(u.current&&n.renderer){if(null!==n.renderer.domElement.parentNode&&n.renderer.domElement.parentNode!==u.current)throw new Error("There are more than 2 fiveCanvas in this context.");n.renderer.domElement.parentNode!==u.current&&u.current.appendChild(n.renderer.domElement),n.camera.aspect=t/r,n.camera.updateProjectionMatrix(),n.renderer.setSize(t,r),n.needsRender=!0}}),[t,r,u.current]),o.createElement("div",{ref:u,style:i})},exports.INJECTION_PROPNAME="$five",exports.Store=I,exports.createFiveFeature=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e},exports.createFiveProvider=function(e){return void 0===e&&(e={}),function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.unmout=!1,e}return a(n,t),n.prototype.loadWork=function(e,t,r,n){if(void 0===n&&(n=!0),this.props.work)throw new Error("props 'work' is set in fiveProvider, if you need modify work internal, use 'initialWork' instead.");return this.five.load(e,t,r,n)},n.prototype.shouldComponentUpdate=function(e){var t,r;return e.work&&e.work!==(null===(t=this.five)||void 0===t?void 0:t.work)&&(null===(r=this.five)||void 0===r||r.load(e.work,e.initialState)),!0},n.prototype.componentWillUnmount=function(){var e;this.unmout=!0,this.five&&(this.five.dispose(),(e=this.five.renderer)&&(e.capabilities.isWebGL2?-1===l.indexOf(e)&&l.push(e):-1===s.indexOf(e)&&s.push(e)),delete this.five)},n.prototype.render=function(){var t,n=this;if(this.unmout)return null;if(!this.five){var i=function(e){var t=void 0===e?{}:e,r=t.backgroundColor,n=void 0===r?1579548:r,o=t.backgroundAlpha,i=void 0===o?1:o,a=t.pixelRatio,f=void 0===a?1:a,c=t.webgl2,v=void 0!==c&&c;if("undefined"!=typeof window){var p=null;if(!(p=v?s.shift():l.shift())){if(v){var d=document.createElement("canvas"),h=d.getContext("webgl2");if(null===h)throw new Error("error occurred when getting webgl2 canvas context");p=new u.WebGLRenderer({antialias:!1,alpha:!0,canvas:d,context:h})}else p=new u.WebGLRenderer({antialias:!1,alpha:!0});p.outputEncoding=u.sRGBEncoding}return p.setPixelRatio(f),p.setClearColor(n,i),p.autoClear=!0,p}}({pixelRatio:1===r.getViewportScale()?window.devicePixelRatio:1,backgroundAlpha:e.backgroundAlpha,backgroundColor:e.backgroundColor,webgl2:null==e?void 0:e.webgl2});this.five=new r.Five(f({renderer:i},e)),(this.props.work||this.props.initialWork)&&this.five.load(this.props.work||this.props.initialWork,this.props.initialState,void 0,null===(t=this.props.initialUserAction)||void 0===t||t),this.five.on("load",(function(){var e;n.props.onWorkChange&&n.props.onWorkChange(null===(e=n.five)||void 0===e?void 0:e.work)})),this.five.on("stateChange",(function(e,t){n.props.onStateChange&&n.props.onStateChange(e,t)})),this.five.on("currentStateChange",(function(e,t){n.props.onCurrentStateChange&&n.props.onCurrentStateChange(e,t)})),this.five.on("error",(function(e){n.props.onError?n.props.onError(e):console.warn(e.message)}))}return o.createElement(v.Provider,{value:{five:this.five,loadWork:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.loadWork.apply(n,e)}}},this.props.children)},n}(o.Component)},exports.createStore=function(e){var t=o.createContext(null);return{useStore:function(e){var r=o.useContext(t);if(null===r)throw new Error("StoreProvider never found.");var n=o.useRef(!0),u=o.useState(r.getValues(e)),i=u[0],a=u[1],f=c([r],e,!0);o.useLayoutEffect((function(){return n.current?n.current=!1:a(r.getValues(e)),r.on(e,(function(e){return a(e)}))}),f);var s=o.useCallback((function(t){return r.setValues(e,t)}),f);return[i,s]},useStoreSetter:function(e){var r=o.useContext(t);if(null===r)throw new Error("StoreProvider never found.");return o.useCallback((function(t){return r.setValues(e,t)}),c([r],e,!0))},watchStore:function(e,r,n){var u=o.useContext(t);if(null===u)throw new Error("StoreProvider never found.");var i=c([u],e,!0);void 0!==n&&(i=i.concat(n)),o.useLayoutEffect((function(){return u.on(e,r)}),i)},useStoreAction:function(r){var n=o.useContext(t);if(null===n)throw new Error("StoreProvider never found.");var u=o.useCallback((function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];var u=e[r],i=u[0],a=u.slice(1);return i.apply(void 0,c([function(){return n.getValues(a)},function(e){return n.setValues(a,e)}],t,!1))}),[]);return u},StoreProvider:function(e){function r(t){var r=e.call(this,t)||this;return r.store=new I(t.initialValue,(function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];r.props.onValuesChange&&(e=r.props).onValuesChange.apply(e,t)})),r}return a(r,e),r.prototype.shouldComponentUpdate=function(e){return e.children!==this.props.children},r.prototype.render=function(){return o.createElement(t.Provider,{value:this.store},this.props.children)},r}(o.Component)}},exports.unsafe__useFiveInstance=function(){return p()},exports.useFiveAction=function(){var e=p();return{updateCamera:o.useCallback((function(t,r){return e.updateCamera(t,r)}),[e]),getPixels:o.useCallback((function(t,r,n,o,u){return e.getPixels(t,r,n,o,u)}),[e]),render:o.useCallback((function(t){return e.render(t)}),[e]),needsRender:o.useCallback((function(){return e.needsRender=!0}),[e]),preloadPano:o.useCallback((function(t,r){return e.preloadPano(t,r)}),[e])}},exports.useFiveCameraDirection=function(){var e=p(),t=o.useState((function(){return b(e)})),r=t[0],n=t[1];return o.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return n(b(e))}))}),[e]),r},exports.useFiveCameraRaycaster=function(){var e=p(),t=o.useState((function(){return S(e)})),r=t[0],n=t[1];return o.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return n(S(e))}))}),[e]),r},exports.useFiveCurrentObserver=function(){var e=p(),t=o.useState((function(){return e.getCurrentState()})),r=t[0],n=t[1];return o.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return n(e.getCurrentState())}))}),[e]),e.work?e.work.observers[r.panoIndex]:null},exports.useFiveCurrentState=function(){var e=p(),t=o.useState((function(){return e.getCurrentState()})),r=t[0],n=t[1],u=o.useCallback((function(t,r,n){void 0===r&&(r=!1),void 0===n&&(n=!0);var o="function"==typeof t?t(e.getCurrentState()):t;e.setState(o,r,n)}),[e]);return o.useLayoutEffect((function(){return e.on("currentStateChange",(function(){return n(e.getCurrentState())}))}),[e]),[r,u]},exports.useFiveEventCallback=function(e,t,r){var n=p(),u=[n,e];void 0!==r&&(u=u.concat(r)),o.useLayoutEffect((function(){return n.on(e,t)}),u)},exports.useFiveFloor=function(){var e=p(),t=o.useState(e.model.shownFloor),r=t[0],n=t[1],u=o.useState(e.model.floorLength),i=u[0],a=u[1],f=o.useCallback((function(t){"number"==typeof t?e.model.show(t):e.model.show()}),[e]);return o.useLayoutEffect((function(){var t=[];return t.push(e.on("modelShownFloorChange",(function(){return n(e.model.shownFloor)}))),t.push(e.on("modelLoaded",(function(){return a(e.model.floorLength)}))),function(){for(var e;e=t.shift();)e()}}),[e]),[r,i,f]},exports.useFiveHelper=function(){var e=p(),t=o.useState(e.helperVisible),r=t[0],n=t[1],u=o.useCallback((function(t){e.helperVisible=t}),[e]);return o.useLayoutEffect((function(){return e.on("helpersVisibleChange",(function(e){return n(e)}))}),[e]),[r,u]},exports.useFiveModelIntersectRaycaster=function(){var e=p();return o.useCallback((function(t){return e.model.intersectRaycaster(t)}),[e])},exports.useFiveModelReadyState=function(){var e=p(),t=o.useState((function(){return w(e)})),r=t[0],n=t[1];return o.useLayoutEffect((function(){return e.on("modelLoaded",(function(){return n(w(e))}))}),[e]),r},exports.useFiveProject2d=function(){var e=p(),t=o.useState((function(){return Symbol()}));t[0];var r=t[1];return o.useLayoutEffect((function(){return e.on("cameraUpdate",(function(){return r(Symbol())}))}),[e]),o.useCallback((function(t,r){return e.project2d(t,r)}),[e])},exports.useFiveScene=y,exports.useFiveSceneEffect=m,exports.useFiveState=function(){var e=p(),t=o.useState((function(){return g(e)})),r=t[0],n=t[1],u=o.useCallback((function(t,r,n){void 0===r&&(r=!1),void 0===n&&(n=!0);var o="function"==typeof t?t(e.getCurrentState()):t;e.setState(o,r,n)}),[e]);return o.useLayoutEffect((function(){return e.on("stateChange",(function(){return n(g(e))}))}),[e]),[r,u]},exports.useFiveWork=function(){var e=p(),t=d(),r=o.useState((function(){return e.work})),n=r[0],u=r[1];return o.useLayoutEffect((function(){return e.on("load",(function(){return u(e.work)}))}),[e]),[n,t]},exports.withFive=function(e){return function(t){return o.forwardRef((function(r,n){var i=p(),a=d(),c=function(e,t){return[C("unsafe__fiveInstance",t)?e:void 0]}(i,e)[0],s=function(e,t){var r=C("state",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return f({},e.state)}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("stateChange",(function(){return i(Symbol())}))}),[e]),[a,u]}(i,e),l=s[0],v=s[1],h=function(e,t){var r=C("currentState",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return e.getCurrentState()}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("currentStateChange",(function(){return i(Symbol())}))}),[e]),[a,u]}(i,e),m=h[0],y=h[1],g=function(e,t){var r=C("currentObserver",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return e.getCurrentState()}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("currentStateChange",(function(){return i(Symbol())}))}),[e]),[a?e.work?e.work.observers[a.panoIndex]:null:void 0,u]}(i,e),S=g[0],b=g[1],w=function(e,t){var r=C("work",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return e.work}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("load",(function(){return i(Symbol())}))}),[e]),[a,u]}(i,e),U=w[0],D=w[1],I=function(e,t){var r=C("model",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return e.model}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,u]}(i,e),G=I[0],q=I[1],H=function(e,t){return[C("scene",t)?e.scene:void 0]}(i,e)[0],T=function(e,t){var r=C("cameraDirection",t),n=o.useState(Symbol()),i=n[0],a=n[1],f=o.useMemo((function(){if(r)return e.camera.getWorldDirection(new u.Vector3)}),[e,i]);return o.useLayoutEffect((function(){if(r)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,i]}(i,e),z=T[0],$=T[1],B=function(e,t){var r=C("cameraRaycaster",t),n=o.useState(Symbol()),i=n[0],a=n[1],f=o.useMemo((function(){if(r){var t=e.camera.getWorldDirection(new u.Vector3);return new u.Raycaster(e.camera.position,t)}}),[e,i]);return o.useLayoutEffect((function(){if(r)return e.on("cameraUpdate",(function(){return a(Symbol())}))}),[e]),[f,i]}(i,e),J=B[0],K=B[1],Q=function(e,t){var r=C("modelReadyState",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return e.model.empty?"Empty":"Loaded"}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,u]}(i,e),X=Q[0],Y=Q[1],Z=function(e,t){var r=C("shownFloor",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return e.model.shownFloor}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("modelShownFloorChange",(function(){return i(Symbol())}))}),[e]),[a,u]}(i,e),ee=Z[0],te=Z[1],re=function(e,t){var r=C("totalFloorLength",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return e.model.hasFloors()}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("modelLoaded",(function(){return i(Symbol())}))}),[e]),[a,u]}(i,e),ne=re[0],oe=re[1],ue=function(e,t){var r=C("helperVisible",t),n=o.useState(Symbol()),u=n[0],i=n[1],a=o.useMemo((function(){if(r)return e.helperVisible}),[e,u]);return o.useLayoutEffect((function(){if(r)return e.on("helpersVisibleChange",(function(){return i(Symbol())}))}),[e]),[a,u]}(i,e),ie=ue[0],ae=ue[1],fe=o.useMemo((function(){var t={};return E(t,{setState:x(i,e),loadWork:k(a,e),on:L(i,e),once:F(i,e),off:P(i,e),intersectRaycaster:R(i,e),project2d:V(i,e),updateCamera:O(i,e),getPixels:W(i,e),render:M(i,e),needsRender:_(i,e),preloadPano:j(i,e),showFloor:A(i,e),toggleHelperVisible:N(i,e)}),t}),[i,a]),ce=o.useMemo((function(){var e=f({},fe);return E(e,{unsafe__fiveInstance:c,state:l,currentState:m,currentObserver:S,work:U,model:G,scene:H,cameraDirection:z,cameraRaycaster:J,modelReadyState:X,shownFloor:ee,totalFloorLength:ne,helperVisible:ie}),e}),[i,fe,v,y,b,D,q,$,K,Y,te,oe,ae]);return o.createElement(t,f({ref:n,$five:ce},r))}))}};
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { program } = require("commander");
4
+ const staticify = require("../exporters/staticify");
5
+
6
+ program
7
+ .requiredOption("--work <work>", "work 的 json 文件")
8
+ .requiredOption("--output <output>", "work 静态化的位置")
9
+ .option("--shortPath", "简化路径 可选")
10
+ .option("--jsonp", "使用jsonp的方式加载文件 可选")
11
+ .option("--no-preview", "不生成预览文件")
12
+ .option("--template <template>", "html模版文件ejs 参数为 work_json, short_path, jsonp")
13
+
14
+ program.parse(process.argv);
15
+
16
+ async function main(program) {
17
+ let { work, output, shortPath, jsonp, preview, template } = program.opts();
18
+ console.log(template)
19
+ if (preview !== false && template) {
20
+ preview = template;
21
+ }
22
+ await staticify(work, output, shortPath, jsonp, preview);
23
+ }
24
+
25
+ main(program);
26
+