@realsee/five 5.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.
Files changed (173) hide show
  1. package/README.md +362 -0
  2. package/TERMS.txt +56 -0
  3. package/docs/.nojekyll +1 -0
  4. package/docs/assets/highlight.css +134 -0
  5. package/docs/assets/icons.css +1043 -0
  6. package/docs/assets/icons.png +0 -0
  7. package/docs/assets/icons@2x.png +0 -0
  8. package/docs/assets/main.js +52 -0
  9. package/docs/assets/search.js +1 -0
  10. package/docs/assets/style.css +1388 -0
  11. package/docs/assets/widgets.png +0 -0
  12. package/docs/assets/widgets@2x.png +0 -0
  13. package/docs/classes/five.AnimationFrameLoop.html +15 -0
  14. package/docs/classes/five.BVH.html +10 -0
  15. package/docs/classes/five.BVHIntersect.html +1 -0
  16. package/docs/classes/five.BVHNode.html +7 -0
  17. package/docs/classes/five.BVHVector3.html +1 -0
  18. package/docs/classes/five.Camera.html +11 -0
  19. package/docs/classes/five.Five.html +303 -0
  20. package/docs/classes/five.InternalWebGLRenderer.html +1 -0
  21. package/docs/classes/five.IntersectMesh.html +1 -0
  22. package/docs/classes/five.LegacyPanoCircleMesh.html +5 -0
  23. package/docs/classes/five.Model.html +77 -0
  24. package/docs/classes/five.NetworkSubscribe.html +50 -0
  25. package/docs/classes/five.PBMContainer.html +17 -0
  26. package/docs/classes/five.PBMGroup.html +19 -0
  27. package/docs/classes/five.PBMMaterial.html +15 -0
  28. package/docs/classes/five.PBMMesh.html +7 -0
  29. package/docs/classes/five.PanoCircleMesh.html +7 -0
  30. package/docs/classes/five.Scene.html +3 -0
  31. package/docs/classes/five.Subscribe.html +56 -0
  32. package/docs/classes/five.Work.html +30 -0
  33. package/docs/classes/gltf_loader.GLTFLoader.html +17 -0
  34. package/docs/classes/gltf_loader.GLTFObject.html +7 -0
  35. package/docs/classes/line.Line.html +1 -0
  36. package/docs/classes/line.LineGeometry.html +1 -0
  37. package/docs/classes/line.LineMaterial.html +1 -0
  38. package/docs/classes/line.LineSegmentsGeometry.html +1 -0
  39. package/docs/classes/line.THREE_Line2.html +1 -0
  40. package/docs/classes/line.THREE_LineSegments2.html +1 -0
  41. package/docs/classes/react.Store.html +29 -0
  42. package/docs/classes/server.BVH.html +10 -0
  43. package/docs/classes/server.BVHIntersect.html +1 -0
  44. package/docs/classes/server.BVHNode.html +7 -0
  45. package/docs/classes/server.BVHVector3.html +1 -0
  46. package/docs/classes/server.Model.html +63 -0
  47. package/docs/classes/server.PBMGroup.html +9 -0
  48. package/docs/classes/server.PBMMesh.html +7 -0
  49. package/docs/classes/sticker.Sticker.html +32 -0
  50. package/docs/index.html +182 -0
  51. package/docs/interfaces/five.AddableObject.html +1 -0
  52. package/docs/interfaces/five.AnimationFrame.html +1 -0
  53. package/docs/interfaces/five.CameraPose.html +1 -0
  54. package/docs/interfaces/five.DepthPanoramaControllerCustomInitArgs.html +28 -0
  55. package/docs/interfaces/five.EventCallback.html +391 -0
  56. package/docs/interfaces/five.FiveInitArgs.html +96 -0
  57. package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +15 -0
  58. package/docs/interfaces/five.ImageOptions.html +16 -0
  59. package/docs/interfaces/five.ImageURLOptions.html +1 -0
  60. package/docs/interfaces/five.IntersectMeshInterface.html +3 -0
  61. package/docs/interfaces/five.Intersection.html +7 -0
  62. package/docs/interfaces/five.ModelControllerCustomInitArgs.html +20 -0
  63. package/docs/interfaces/five.ModelEventCallback.html +22 -0
  64. package/docs/interfaces/five.MovePanoOptions.html +39 -0
  65. package/docs/interfaces/five.PBMPanoPicture.html +7 -0
  66. package/docs/interfaces/five.PBMParameters.html +15 -0
  67. package/docs/interfaces/five.PanoCircleMeshInterface.html +19 -0
  68. package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +28 -0
  69. package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +20 -0
  70. package/docs/interfaces/five.Pose.html +35 -0
  71. package/docs/interfaces/five.Scissor.html +14 -0
  72. package/docs/interfaces/five.State.html +19 -0
  73. package/docs/interfaces/five.SubscribeMixinType.emit.html +1 -0
  74. package/docs/interfaces/five.SubscribeMixinType.hasListener.html +1 -0
  75. package/docs/interfaces/five.SubscribeMixinType.off.html +1 -0
  76. package/docs/interfaces/five.SubscribeMixinType.on.html +1 -0
  77. package/docs/interfaces/five.SubscribeMixinType.once.html +1 -0
  78. package/docs/interfaces/five.TextureOptions.html +18 -0
  79. package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +7 -0
  80. package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +24 -0
  81. package/docs/interfaces/five.WorkCubeImage.html +13 -0
  82. package/docs/interfaces/five.WorkImage.html +21 -0
  83. package/docs/interfaces/five.WorkInitial.html +13 -0
  84. package/docs/interfaces/five.WorkModel.html +11 -0
  85. package/docs/interfaces/five.WorkObserver.html +25 -0
  86. package/docs/interfaces/five.WorkTile.html +1 -0
  87. package/docs/interfaces/five.WorkVideo.html +9 -0
  88. package/docs/interfaces/gltf_loader.GLTF.html +7 -0
  89. package/docs/interfaces/react.FiveActionReactCallbacks.html +62 -0
  90. package/docs/interfaces/react.FiveInjectionTypes.html +191 -0
  91. package/docs/interfaces/react.PropTypeOfFiveFeatures.html +1 -0
  92. package/docs/interfaces/server.Intersection.html +7 -0
  93. package/docs/interfaces/server.ModelEventCallback.html +18 -0
  94. package/docs/interfaces/sticker.IntersectionLike.html +8 -0
  95. package/docs/media/coordinate.jpg +0 -0
  96. package/docs/media/topview.jpg +0 -0
  97. package/docs/media/typescript.jpg +0 -0
  98. package/docs/modules/five.SubscribeMixinType.html +1 -0
  99. package/docs/modules/five.html +481 -0
  100. package/docs/modules/gltf_loader.html +1 -0
  101. package/docs/modules/line.html +1 -0
  102. package/docs/modules/react.html +130 -0
  103. package/docs/modules/server.html +18 -0
  104. package/docs/modules/sticker.html +1 -0
  105. package/docs/modules.html +1 -0
  106. package/exporters/staticify.js +203 -0
  107. package/five/index.d.ts +2061 -0
  108. package/five/index.js +372 -0
  109. package/gltf-loader/index.d.ts +75 -0
  110. package/gltf-loader/index.js +260 -0
  111. package/line/index.d.ts +68 -0
  112. package/line/index.js +260 -0
  113. package/package.json +36 -0
  114. package/react/index.d.ts +812 -0
  115. package/react/index.js +260 -0
  116. package/resource/basis/basis_transcoder.js +22 -0
  117. package/resource/basis/basis_transcoder.wasm +0 -0
  118. package/resource/gltf/draco_decoder.js +31 -0
  119. package/resource/gltf/draco_decoder.wasm +0 -0
  120. package/resource/gltf/draco_wasm_wrapper.js +119 -0
  121. package/scripts/five-plugin-init.js +83 -0
  122. package/scripts/five-quick-start-init.js +80 -0
  123. package/scripts/five-react-component-init.js +83 -0
  124. package/scripts/five-staticify.js +21 -0
  125. package/server/index.d.ts +568 -0
  126. package/server/index.js +367 -0
  127. package/sticker/index.d.ts +70 -0
  128. package/sticker/index.js +260 -0
  129. package/templates/plugin/README.md +38 -0
  130. package/templates/plugin/devtools/external-five.js +5 -0
  131. package/templates/plugin/devtools/external-three.js +5 -0
  132. package/templates/plugin/devtools/tsconfig.build.json +18 -0
  133. package/templates/plugin/devtools/webpack.bundle.js +44 -0
  134. package/templates/plugin/devtools/webpack.example.js +39 -0
  135. package/templates/plugin/docs/.gitkeep +0 -0
  136. package/templates/plugin/examples/data.json +507 -0
  137. package/templates/plugin/examples/index.html +28 -0
  138. package/templates/plugin/examples/index.ts +12 -0
  139. package/templates/plugin/lib/index.ts +30 -0
  140. package/templates/plugin/package.json +32 -0
  141. package/templates/plugin/tsconfig.json +26 -0
  142. package/templates/quick-start/README.md +47 -0
  143. package/templates/quick-start/assets/work.json +507 -0
  144. package/templates/quick-start/index.html +54 -0
  145. package/templates/quick-start/index.tsx +123 -0
  146. package/templates/quick-start/package.json +25 -0
  147. package/templates/quick-start/tsconfig.json +27 -0
  148. package/templates/quick-start/webpack.config.js +45 -0
  149. package/templates/quick-start/webpack.production.js +42 -0
  150. package/templates/react-component/README.md +32 -0
  151. package/templates/react-component/devtools/external-five.js +5 -0
  152. package/templates/react-component/devtools/external-react.js +5 -0
  153. package/templates/react-component/devtools/external-three.js +5 -0
  154. package/templates/react-component/devtools/tsconfig.build.json +19 -0
  155. package/templates/react-component/devtools/webpack.bundle.js +44 -0
  156. package/templates/react-component/devtools/webpack.example.js +39 -0
  157. package/templates/react-component/docs/.gitkeep +0 -0
  158. package/templates/react-component/examples/data.json +507 -0
  159. package/templates/react-component/examples/index.html +17 -0
  160. package/templates/react-component/examples/index.tsx +62 -0
  161. package/templates/react-component/lib/index.tsx +157 -0
  162. package/templates/react-component/package.json +38 -0
  163. package/templates/react-component/tsconfig.json +27 -0
  164. package/umd/five-gltf-loader.js +2 -0
  165. package/umd/five-gltf-loader.js.LICENSE.txt +14 -0
  166. package/umd/five-line.js +2 -0
  167. package/umd/five-line.js.LICENSE.txt +14 -0
  168. package/umd/five-react.js +2 -0
  169. package/umd/five-react.js.LICENSE.txt +14 -0
  170. package/umd/five-sticker.js +2 -0
  171. package/umd/five-sticker.js.LICENSE.txt +14 -0
  172. package/umd/five.js +2 -0
  173. package/umd/five.js.LICENSE.txt +116 -0
@@ -0,0 +1,812 @@
1
+ import { EventCallback } from '@realsee/five';
2
+ import { Five } from '@realsee/five';
3
+ import { FiveInitArgs } from '@realsee/five';
4
+ import { Intersection } from '@realsee/five';
5
+ import { Model } from '@realsee/five';
6
+ import { Pose } from '@realsee/five';
7
+ import * as React_2 from 'react';
8
+ import { Scene } from '@realsee/five';
9
+ import { State } from '@realsee/five';
10
+ import * as THREE_2 from 'three';
11
+ import { Vector2 } from 'three';
12
+ import { Work } from '@realsee/five';
13
+
14
+ export declare function createFiveFeature<T extends FiveInjectionFeature>(...features: T[]): T[];
15
+
16
+ /**
17
+ * 创建一个 FiveProvider
18
+ * 在 React 的体系下,使用 Provider 的方式来组织组件结构。
19
+ * 在 FiveProvider 下,可以使用 FiveCanvas 来创建渲染画布。
20
+ * 以及使用 useFiveState useFiveEvent等 Five React Hooks API 来对 FiveProvider 进行操作
21
+ * @param fiveInitArgs - Five 初始化参数
22
+ * @returns FiveProvider React 组件
23
+ * @example
24
+ * ```
25
+ * const FiveProvider = createFiveProvider({...fiveInitArgs});
26
+ * const App: React.FC = () => {
27
+ * return <FiveProvider initialWork={work}>
28
+ * <FiveCanvas width={512} height={512} />
29
+ * </FiveProvider>
30
+ * };
31
+ * ReactDOM.render(<App/>, document.getElementById("app"));
32
+ * ```
33
+ */
34
+ export declare function createFiveProvider(fiveInitArgs?: Omit<FiveInitArgs, "renderer" | "scissor">): {
35
+ new (props: FiveProviderPropTypes): {
36
+ /**
37
+ * five 实例,可以通过 FiveProvider 的 ref.five 获取得到
38
+ * 在一些外部调用方面可以尝试使用
39
+ */
40
+ five?: Five;
41
+ loadWork(work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean): Promise<void>;
42
+ shouldComponentUpdate(nextProps: FiveProviderPropTypes): boolean;
43
+ componentWillUnmount(): void;
44
+ render(): JSX.Element;
45
+ context: any;
46
+ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<FiveProviderPropTypes>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void;
47
+ forceUpdate(callback?: () => void): void;
48
+ readonly props: Readonly<FiveProviderPropTypes> & Readonly<{
49
+ children?: React_2.ReactNode;
50
+ }>;
51
+ state: Readonly<{}>;
52
+ refs: {
53
+ [key: string]: React_2.ReactInstance;
54
+ };
55
+ componentDidMount?(): void;
56
+ componentDidCatch?(error: Error, errorInfo: React_2.ErrorInfo): void;
57
+ getSnapshotBeforeUpdate?(prevProps: Readonly<FiveProviderPropTypes>, prevState: Readonly<{}>): any;
58
+ componentDidUpdate?(prevProps: Readonly<FiveProviderPropTypes>, prevState: Readonly<{}>, snapshot?: any): void;
59
+ componentWillMount?(): void;
60
+ UNSAFE_componentWillMount?(): void;
61
+ componentWillReceiveProps?(nextProps: Readonly<FiveProviderPropTypes>, nextContext: any): void;
62
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<FiveProviderPropTypes>, nextContext: any): void;
63
+ componentWillUpdate?(nextProps: Readonly<FiveProviderPropTypes>, nextState: Readonly<{}>, nextContext: any): void;
64
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<FiveProviderPropTypes>, nextState: Readonly<{}>, nextContext: any): void;
65
+ };
66
+ contextType?: React_2.Context<any>;
67
+ };
68
+
69
+ export declare function createStore<T extends StoreValueMapType, A extends StoreActionMapType = {}>(actionHandler: StoreActionMapHanlder<T, keyof T, A>): {
70
+ /**
71
+ * 使用 Store
72
+ * @param names - 获取的 Store 字段
73
+ * @returns [值, 修改值方法]
74
+ */
75
+ useStore<K extends keyof T>(names: K[]): [values: Pick<T, K>, setValues: (values: Pick<T, K>) => void];
76
+ /**
77
+ * 使用 Store (仅设置值)
78
+ * @param names - 获取的 Store 字段
79
+ * @returns 修改值方法
80
+ */
81
+ useStoreSetter<K_1 extends keyof T>(names: K_1[]): (values: Pick<T, K_1>) => void;
82
+ /**
83
+ * 监听 Store 变化
84
+ * @param names - Store 字段
85
+ * @param callback - 监听变化的回调函数
86
+ * @param deps - 依赖对象
87
+ */
88
+ watchStore<K_2 extends keyof T>(names: K_2[], callback: (values: Pick<T, K_2>, prevValues: Pick<T, K_2>) => void, deps?: React_2.DependencyList | undefined): void;
89
+ useStoreAction<N extends keyof A, F extends A[N]>(actionName: N): F;
90
+ /**
91
+ * Store Provider.
92
+ * 内部组件均可和 store 交互
93
+ */
94
+ StoreProvider: {
95
+ new (props: {
96
+ initialValue: T;
97
+ onValuesChange?: (value: T, prevValue: T) => void;
98
+ children: React_2.ReactNode;
99
+ }): {
100
+ store: Store<T>;
101
+ shouldComponentUpdate(nextProps: {
102
+ initialValue: T;
103
+ onValuesChange?: (value: T, prevValue: T) => void;
104
+ children: React_2.ReactNode;
105
+ }): boolean;
106
+ render(): JSX.Element;
107
+ context: any;
108
+ setState<K_3 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{
109
+ initialValue: T;
110
+ onValuesChange?: (value: T, prevValue: T) => void;
111
+ children: React_2.ReactNode;
112
+ }>) => {} | Pick<{}, K_3>) | Pick<{}, K_3>, callback?: () => void): void;
113
+ forceUpdate(callback?: () => void): void;
114
+ readonly props: Readonly<{
115
+ initialValue: T;
116
+ onValuesChange?: (value: T, prevValue: T) => void;
117
+ children: React_2.ReactNode;
118
+ }> & Readonly<{
119
+ children?: React_2.ReactNode;
120
+ }>;
121
+ state: Readonly<{}>;
122
+ refs: {
123
+ [key: string]: React_2.ReactInstance;
124
+ };
125
+ componentDidMount?(): void;
126
+ componentWillUnmount?(): void;
127
+ componentDidCatch?(error: Error, errorInfo: React_2.ErrorInfo): void;
128
+ getSnapshotBeforeUpdate?(prevProps: Readonly<{
129
+ initialValue: T;
130
+ onValuesChange?: (value: T, prevValue: T) => void;
131
+ children: React_2.ReactNode;
132
+ }>, prevState: Readonly<{}>): any;
133
+ componentDidUpdate?(prevProps: Readonly<{
134
+ initialValue: T;
135
+ onValuesChange?: (value: T, prevValue: T) => void;
136
+ children: React_2.ReactNode;
137
+ }>, prevState: Readonly<{}>, snapshot?: any): void;
138
+ componentWillMount?(): void;
139
+ UNSAFE_componentWillMount?(): void;
140
+ componentWillReceiveProps?(nextProps: Readonly<{
141
+ initialValue: T;
142
+ onValuesChange?: (value: T, prevValue: T) => void;
143
+ children: React_2.ReactNode;
144
+ }>, nextContext: any): void;
145
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{
146
+ initialValue: T;
147
+ onValuesChange?: (value: T, prevValue: T) => void;
148
+ children: React_2.ReactNode;
149
+ }>, nextContext: any): void;
150
+ componentWillUpdate?(nextProps: Readonly<{
151
+ initialValue: T;
152
+ onValuesChange?: (value: T, prevValue: T) => void;
153
+ children: React_2.ReactNode;
154
+ }>, nextState: Readonly<{}>, nextContext: any): void;
155
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<{
156
+ initialValue: T;
157
+ onValuesChange?: (value: T, prevValue: T) => void;
158
+ children: React_2.ReactNode;
159
+ }>, nextState: Readonly<{}>, nextContext: any): void;
160
+ };
161
+ contextType?: React_2.Context<any>;
162
+ };
163
+ };
164
+
165
+ /**
166
+ * Five 命令集合
167
+ */
168
+ export declare interface FiveActionReactCallbacks {
169
+ /**
170
+ * 移动相机。(不触发点位移动)
171
+ * @description
172
+ * 如果动画中途被打断(用户触发行为,或者调用 setState, load, changeMode)的等
173
+ * 会 Promise.reject。运动完成则 Promise.resolve
174
+ * @param pose - 相机目标位置
175
+ * @param duration - 动画触发的时常
176
+ * @returns Promise 是否移动成功
177
+ */
178
+ updateCamera(pose: Pose, duration: number): Promise<void>;
179
+ /**
180
+ * 初始化 initBasisLoader
181
+ * @description
182
+ * 同初始化的 initBasisLoader 参数。用于初始化 basisLoader。
183
+ * basisLoader 只会初始化一次,一旦初始化则不会再修改。
184
+ *
185
+ * @param transcoderResourcePath - basis 解析器路径
186
+ * 如果不设置,使用默认解析器 basis 解析器。
187
+ * 可以传入解析器的 `resourcePath`, 则使用指定的解析器
188
+ * @example
189
+ * ```
190
+ * // 使用默认解析器
191
+ * initialBasisLoader();
192
+ *
193
+ * // 使用指定解析器
194
+ * // 会调用这个目录下的 basis_transcoder.js basis_transcoder.wasm 文件作为解析器
195
+ * initialBasisLoader("https://vrlab-public.ljcdn.com/release/static/image/release/five/basis/");
196
+ * ```
197
+ */
198
+ initBasisLoader(transcoderResourcePath?: string): void;
199
+ /**
200
+ * 获取画面中的像素颜色
201
+ * @param x - 获取像素区域的起始坐标 x
202
+ * @param y - 获取像素区域的起始坐标 y
203
+ * @param width - 获取像素区域的宽度
204
+ * @param height - 获取像素区域的高度
205
+ * @param pixelRatio - 获取区域的像素比
206
+ * @returns rgba颜色平铺的 Uint8Array
207
+ */
208
+ getPixels(x: number, y: number, width: number, height: number, pixelRatio?: number): Uint8Array;
209
+ /**
210
+ * 强制渲染
211
+ * @description
212
+ * 调用 `render()` 和 `needsRender()` 均可在按需渲染时,使得画面渲染一次
213
+ * 区别在于:
214
+ * - `needsRender()` 为在下帧渲染画面
215
+ * - `render()` 在当前帧渲染画面
216
+ * 推荐使用 `needsRender()`, 可以更加流畅。但是如果需要截图等同步操作,可以使用 `render()`
217
+ *
218
+ * @param callback - 渲染完成回调
219
+ */
220
+ render(callback?: () => void): void;
221
+ /**
222
+ * 下一帧渲染
223
+ * @description
224
+ * 调用 `render()` 和 `needsRender()` 均可在按需渲染时,使得画面渲染一次
225
+ * 区别在于:
226
+ * - `needsRender()` 为在下帧渲染画面
227
+ * - `render()` 在当前帧渲染画面
228
+ * 推荐使用 `needsRender()`, 可以更加流畅。但是如果需要截图等同步操作,可以使用 `render()`
229
+ */
230
+ needsRender(): void;
231
+ /**
232
+ * 预加载点位图片资源
233
+ * @param panoIndex - 观察点序号
234
+ * @param callback - 加载完成回调, 并传递加载用时。
235
+ * @returns 加载完成的 Promise 参数同 callback
236
+ */
237
+ preloadPano(panoIndex: number, callback?: (costs: number) => void): Promise<number>;
238
+ }
239
+
240
+ /**
241
+ * Five 渲染区域组件
242
+ * @description Five 渲染区域组件,请在 FiveProvider 内使用
243
+ * @param width - 渲染区域的宽度
244
+ * @param height - 渲染区域的高度
245
+ * @returns React 元素
246
+ * @example
247
+ * ```typescript
248
+ * <FiveProvider initialWork={work}>
249
+ * <FiveCanvas width={512} height={512}/>
250
+ * </FiveProvider>
251
+ * ```
252
+ */
253
+ export declare const FiveCanvas: React_2.FC<{
254
+ width: number;
255
+ height: number;
256
+ }>;
257
+
258
+ export declare type FiveInjectionActionFeature = "loadWork" | "setState" | "on" | "off" | "intersectRaycaster" | "project2d" | "updateCamera" | "initBasisLoader" | "getPixels" | "render" | "needsRender" | "preloadPano" | "showFloor" | "toggleHelperVisible";
259
+
260
+ export declare type FiveInjectionDataFeature = "unsafe__fiveInstance" | "currentState" | "currentObserver" | "state" | "work" | "model" | "scene" | "cameraDirection" | "cameraRaycaster" | "modelReadyState" | "shownFloor" | "totalFloorLength" | "helperVisible";
261
+
262
+ export declare type FiveInjectionFeature = FiveInjectionDataFeature | FiveInjectionActionFeature;
263
+
264
+ export declare interface FiveInjectionTypes extends Record<FiveInjectionFeature, any> {
265
+ /**
266
+ * Five React Inject: 获取 five 实例
267
+ * @description 不到万不得已,并不推荐直接使用。
268
+ * @deprecated 不到万不得已,并不推荐直接使用。
269
+ */
270
+ unsafe__fiveInstance: Five;
271
+ /**
272
+ * Five React Inject: Five 的目标状态
273
+ * @description
274
+ * ```text
275
+ * five 设置了以下状态
276
+ *
277
+ * - mode: Mode
278
+ * - panoIndex: number
279
+ * - longitude: number
280
+ * - latitude: number
281
+ * - fov: number
282
+ * - offset: THREE.Vector3
283
+ *
284
+ * 可以通过 state, currentState 和 setState 来获取和设置。
285
+ * 通过 state 设置后,five 会通过合适的动画运动来达到设置的位置。
286
+ * 来迎合一些通过数据驱动的场景。
287
+ * ```
288
+ */
289
+ state: State;
290
+ /**
291
+ * Five React Inject: Five 的当前状态
292
+ * @description
293
+ * ```text
294
+ * five 设置了以下状态
295
+ *
296
+ * - mode: Mode
297
+ * - panoIndex: number
298
+ * - longitude: number
299
+ * - latitude: number
300
+ * - fov: number
301
+ * - offset: THREE.Vector3
302
+ *
303
+ * 可以通过 state, currentState 和 setState 来获取和设置。
304
+ * 通过 state 设置后,five 会通过合适的动画运动来达到设置的位置。
305
+ * 来迎合一些通过数据驱动的场景。
306
+ * ```
307
+ */
308
+ currentState: State;
309
+ /**
310
+ * Five React Inject: Five Work
311
+ */
312
+ work: Work;
313
+ /**
314
+ * 设置 State
315
+ * @description
316
+ * ```text
317
+ * five 设置了以下状态
318
+ *
319
+ * - mode: Mode
320
+ * - panoIndex: number
321
+ * - longitude: number
322
+ * - latitude: number
323
+ * - fov: number
324
+ * - offset: THREE.Vector3
325
+ *
326
+ * 可以通过 state, currentState 和 setState 来获取和设置。
327
+ * 通过 state 设置后,five 会通过合适的动画运动来达到设置的位置。
328
+ * 来迎合一些通过数据驱动的场景。
329
+ * ```
330
+ * @param state - 目标状态
331
+ * @param immediately - 是否马上转换,马上转换会尽快达到目标状态,尽量减少中间状态,更少动画。
332
+ */
333
+ setState: Five["setState"];
334
+ /**
335
+ * 加载 Work 数据
336
+ * @param inputWork - Work 数据
337
+ * @param state - 初始化姿态
338
+ * - "inherit" 使用当前姿态
339
+ * - "initial" 使用 Work 数据中的 initial 姿态
340
+ * - State 自定义姿态
341
+ * @param duration - 切换时间
342
+ */
343
+ loadWork: Five["load"];
344
+ /**
345
+ * 监听事件
346
+ * @param name - 事件名 具体事件列表 请查看 Five.EventCallback
347
+ * @param callback - 回调函数
348
+ * @param once - 是否一次触发
349
+ * @returns 解除事件绑定
350
+ * @example
351
+ * ```
352
+ * $five.on("panoArrived", () => {});
353
+ * ```
354
+ */
355
+ on: Five["on"];
356
+ /**
357
+ * 监听事件一次触发
358
+ * @param name - 事件名 具体事件列表 请查看 Five.EventCallback
359
+ * @param callback - 回调函数
360
+ * @returns 解除事件绑定
361
+ * @example
362
+ * ```
363
+ * $five.once("panoArrived", () => {});
364
+ * ```
365
+ */
366
+ once: Five["once"];
367
+ /**
368
+ * 解除事件绑定
369
+ * @param name - 事件名 具体事件列表 请查看 Five.EventCallback
370
+ * @param callback - 回调函数
371
+ * @example
372
+ * ```
373
+ * $five.off("panoArrived", () => {});
374
+ * ```
375
+ */
376
+ off: Five["off"];
377
+ /**
378
+ * 计算模型射线碰撞检测
379
+ * @param raycaster - THREE 射线对象
380
+ * @param floors - 和某一楼层做碰撞检测, 不传为和所有楼层做碰撞检测
381
+ * @returns 返回碰撞
382
+ */
383
+ intersectRaycaster: Model["intersectRaycaster"];
384
+ /**
385
+ * 计算三维坐标对应到屏幕的二维坐标
386
+ * @description
387
+ * 如果三维坐标不在屏幕中,则返回 null
388
+ * @param vector - 三维坐标
389
+ * @param testModel - 是否计算模型遮挡
390
+ * @returns 二维坐标 或者 null
391
+ */
392
+ project2d: Five["project2d"];
393
+ /**
394
+ * 移动相机。(不触发点位移动)
395
+ * @description
396
+ * 如果动画中途被打断(用户触发行为,或者调用 setState, load, changeMode)的等
397
+ * 会 Promise.reject。运动完成则 Promise.resolve
398
+ * @param pose - 相机目标位置
399
+ * @param duration - 动画触发的时常
400
+ * @returns Promise 是否移动成功
401
+ */
402
+ updateCamera: Five["updateCamera"];
403
+ /**
404
+ * 初始化 initBasisLoader
405
+ * @description
406
+ * 同初始化的 initBasisLoader 参数。用于初始化 basisLoader。
407
+ * basisLoader 只会初始化一次,一旦初始化则不会再修改。
408
+ *
409
+ * @param transcoderResourcePath - basis 解析器路径
410
+ * 如果不设置,使用默认解析器 basis 解析器。
411
+ * 可以传入解析器的 `resourcePath`, 则使用指定的解析器
412
+ * @example
413
+ * ```
414
+ * // 使用默认解析器
415
+ * five.initialBasisLoader();
416
+ *
417
+ * // 使用指定解析器
418
+ * // 会调用这个目录下的 basis_transcoder.js basis_transcoder.wasm 文件作为解析器
419
+ * five.initialBasisLoader("https://vrlab-public.ljcdn.com/release/static/image/release/five/basis/");
420
+ * ```
421
+ */
422
+ initBasisLoader: Five["initBasisLoader"];
423
+ /**
424
+ * 获取画面中的像素颜色
425
+ * @param x - 获取像素区域的起始坐标 x
426
+ * @param y - 获取像素区域的起始坐标 y
427
+ * @param width - 获取像素区域的宽度
428
+ * @param height - 获取像素区域的高度
429
+ * @param pixelRatio - 获取区域的像素比
430
+ * @returns rgba颜色平铺的 Uint8Array
431
+ */
432
+ getPixels: Five["getPixels"];
433
+ /**
434
+ * 强制渲染
435
+ * @description
436
+ * 调用 `render()` 和设置 `needsRender()` 均可在按需渲染时,使得画面渲染一次
437
+ * 区别在于:
438
+ * - `needsRender()` 为在下帧渲染画面
439
+ * - `render()` 在当前帧渲染画面
440
+ * 推荐使用 `needsRender()`, 可以更加流畅。但是如果需要截图等同步操作,可以使用 `render()`
441
+ *
442
+ * @param callback - 渲染完成回调
443
+ */
444
+ render: Five["render"];
445
+ /**
446
+ * 下一帧渲染
447
+ * @description
448
+ * 调用 `render()` 和设置 `needsRender()` 均可在按需渲染时,使得画面渲染一次
449
+ * 区别在于:
450
+ * - `needsRender()` 为在下帧渲染画面
451
+ * - `render()` 在当前帧渲染画面
452
+ * 推荐使用 `needsRender()`, 可以更加流畅。但是如果需要截图等同步操作,可以使用 `render()`
453
+ *
454
+ */
455
+ needsRender: () => void;
456
+ /**
457
+ * 预加载点位图片资源
458
+ * @param panoIndex - 观察点序号
459
+ * @param callback - 加载完成回调, 并传递加载用时。
460
+ * @returns 加载完成的 Promise 参数同 callback
461
+ */
462
+ preloadPano: Five["preloadPano"];
463
+ /**
464
+ * 显示楼层
465
+ * @param floorIndex - 楼层,如果不传则都显示
466
+ */
467
+ showFloor: (floorIndex?: number) => void;
468
+ /**
469
+ * 帮助元素的隐藏/显示
470
+ * @param visible - 隐藏/显示
471
+ */
472
+ toggleHelperVisible: (visible: boolean) => void;
473
+ }
474
+
475
+ export declare type FiveProviderPropTypes = {
476
+ work?: Work;
477
+ initialWork?: Work | Promise<Work>;
478
+ initialState?: "inherit" | "initial" | Partial<Omit<State, "offset">>;
479
+ initialUserAction?: boolean;
480
+ onWorkChange?: (work: Work) => void;
481
+ onStateChange?: (state: State, userAction: boolean) => void;
482
+ onCurrentStateChange?: (state: State, userAction: boolean) => void;
483
+ onError?: (error: Error) => void;
484
+ children: React_2.ReactNode;
485
+ };
486
+
487
+ export declare type FiveProviderType = ReturnType<typeof createFiveProvider>;
488
+
489
+ export declare const INJECTION_PROPNAME = "$five";
490
+
491
+ export declare interface PropTypeOfFiveFeatures<F extends FiveInjectionFeature[]> {
492
+ [INJECTION_PROPNAME]: Pick<FiveInjectionTypes, F[number]>;
493
+ }
494
+
495
+ /**
496
+ * 监听者模式
497
+ * @template T - 预设的监听回调类型
498
+ * @example
499
+ * ```
500
+ * new Store<{
501
+ * "foo": [arg1: number, arg2: string],
502
+ * "bar": [arg: boolean],
503
+ * }>()
504
+ * ```
505
+ */
506
+ export declare class Store<T extends StoreValueMapType> {
507
+ /** 值 */
508
+ values: T;
509
+ /** 全局的数据变化钩子 */
510
+ onValuesChange?: (values: T, prevValues: T) => void;
511
+ private listeners;
512
+ constructor(initialValue: T, onValuesChange?: (values: T, prevValues: T) => void);
513
+ /**
514
+ * 监听数据变化
515
+ * @param names - 监听的字段名称
516
+ * @param callback - 回调函数
517
+ * @returns 解除监听数据变化
518
+ */
519
+ on<K extends keyof T>(names: K[], callback: (values: Pick<T, K>, prevValues: Pick<T, K>) => void): () => void;
520
+ /**
521
+ * 获取值
522
+ * @param names - 值的名称
523
+ */
524
+ getValues<K extends keyof T>(names: K[]): Pick<T, K>;
525
+ /**
526
+ * 设置值
527
+ * @param values - 设置值
528
+ */
529
+ setValues<K extends keyof T>(names: K[], values: Pick<T, K>): void;
530
+ }
531
+
532
+ export declare type StoreActionMapHanlder<T extends StoreValueMapType, K extends keyof T, M extends StoreActionMapType> = {
533
+ [Key in keyof M]: [
534
+ callback: (getValues: () => Pick<T, K>, setValues: (values: Pick<T, K>) => void, ...args: Parameters<M[Key]>) => ReturnType<M[Key]>,
535
+ ...deps: K[]
536
+ ];
537
+ };
538
+
539
+ export declare type StoreActionMapType = {
540
+ [name: string]: (...args: any[]) => any;
541
+ };
542
+
543
+ export declare type StoreProviderType = ReturnType<typeof createStore>["StoreProvider"];
544
+
545
+ export declare type StoreValueMapType = Record<string, any>;
546
+
547
+ /**
548
+ * Five React Hooks: 获取 five 实例
549
+ * @description 不到万不得已,并不推荐直接使用。
550
+ * @deprecated 不到万不得已,并不推荐直接使用。
551
+ * @returns five 实例
552
+ */
553
+ export declare function unsafe__useFiveInstance(): Five;
554
+
555
+ /**
556
+ * Five React Hooks: 使用 Five 的命令
557
+ *
558
+ * @function updateCamera
559
+ * ```
560
+ * 移动相机。(不触发点位移动)
561
+ * 如果动画中途被打断(用户触发行为,或者调用 setState, load, changeMode)的等
562
+ * 会 Promise.reject。运动完成则 Promise.resolve
563
+ *
564
+ * // params pose - 相机目标位置
565
+ * // params duration - 动画触发的时常
566
+ * // params Promise - 是否移动成功
567
+ * updateCamera(pose: Pose, duration: number): Promise<void>
568
+ * ```
569
+ *
570
+ * @function initBasisLoader
571
+ * ```
572
+ * 初始化 initBasisLoader
573
+ * 同初始化的 initBasisLoader 参数。用于初始化 basisLoader。
574
+ * basisLoader 只会初始化一次,一旦初始化则不会再修改。
575
+ *
576
+ * // param transcoderResourcePath
577
+ * // 如果不设置,使用默认解析器 basis 解析器。
578
+ * // 可以传入解析器的 `resourcePath`, 则使用指定的解析器
579
+ * initBasisLoader(transcoderResourcePath?: string): void,
580
+ * ```
581
+ *
582
+ * @function getPixels
583
+ * ```
584
+ * 获取画面中的像素颜色
585
+ * // param x - 获取像素区域的起始坐标 x
586
+ * // param y - 获取像素区域的起始坐标 y
587
+ * // param width - 获取像素区域的宽度
588
+ * // param height - 获取像素区域的高度
589
+ * // param pixelRatio - 获取区域的像素比
590
+ * // returns rgba颜色平铺的 Uint8Array
591
+ * getPixels(x: number, y: number, width: number, height: number, pixelRatio?: number): Uint8Array,
592
+ * ```
593
+ *
594
+ * @function render
595
+ * ```
596
+ * 强制渲染
597
+ * 调用 render() 和 needsRender() 均可在按需渲染时,使得画面渲染一次
598
+ * 区别在于:
599
+ * - needsRender() 为在下帧渲染画面
600
+ * - render() 在当前帧渲染画面
601
+ * 推荐使用 needsRender(), 可以更加流畅。但是如果需要截图等同步操作,可以使用 render()
602
+ *
603
+ * // param callback 渲染完成回调
604
+ * render(callback?: () => void): void,
605
+ * ```
606
+ *
607
+ * @function needsRender
608
+ * ```
609
+ * 下一帧渲染
610
+ * 调用 render() 和 needsRender() 均可在按需渲染时,使得画面渲染一次
611
+ * 区别在于:
612
+ * - needsRender() 为在下帧渲染画面
613
+ * - render() 在当前帧渲染画面
614
+ * 推荐使用 needsRender(), 可以更加流畅。但是如果需要截图等同步操作,可以使用 render()
615
+ * needsRender(): void,
616
+ * ```
617
+ *
618
+ * @function preloadPano
619
+ * ```
620
+ * 预加载点位图片资源
621
+ * // param panoIndex - 观察点序号
622
+ * // param callback - 加载完成回调, 并传递加载用时。
623
+ * // returns 加载完成的 Promise 参数同 callback
624
+ * preloadPano(panoIndex: number, callback?: (costs: number) => void): Promise<number>
625
+ * ```
626
+ *
627
+ * @example
628
+ * ```
629
+ * const { updateCamera, initBasisLoader, getPixels, render, needsRender, preloadPano } = useFiveAction();
630
+ * ```
631
+ */
632
+ export declare function useFiveAction(): FiveActionReactCallbacks;
633
+
634
+ /**
635
+ * Five React Hooks: 得到当前相机的方向(单位向量)
636
+ * @returns 当前相机的方向的单位向量
637
+ */
638
+ export declare function useFiveCameraDirection(): THREE_2.Vector3;
639
+
640
+ /**
641
+ * Five React Hooks: 得到当前相机的方向(射线对象)
642
+ * @returns 当前相机的方向的射线对象
643
+ */
644
+ export declare function useFiveCameraRaycaster(): THREE_2.Raycaster;
645
+
646
+ /**
647
+ * Five React Hooks: Five 的当前观测点
648
+ * @returns Work.observers[number] 当前观测点, 如果 work 未加载则为 null
649
+ * @example
650
+ * ```
651
+ * const observer = useFiveCurrentObserver();
652
+ * ```
653
+ */
654
+ export declare function useFiveCurrentObserver(): Work["observers"][number] | null;
655
+
656
+ /**
657
+ * Five React Hooks: Five 的实时状态
658
+ * @returns
659
+ * [ currentState: Five 的实时状态, setState: 设置 Five 的状态 ]
660
+ * @example
661
+ * ```
662
+ * const [ currentState, setState ] = useFiveCurrentState;
663
+ * ```
664
+ */
665
+ export declare function useFiveCurrentState(): [
666
+ currentState: State,
667
+ setState: (state: Partial<State> | ((prevState: State) => Partial<State>), immediately?: boolean, userAction?: boolean) => void
668
+ ];
669
+
670
+ /**
671
+ * Five React Hooks: Five 事件监听
672
+ * 具体事件列表 请查看 Five.EventCallback
673
+ * @example
674
+ * ```
675
+ * useFiveEvent("cameraUpdate", pose => {});
676
+ * ```
677
+ */
678
+ export declare function useFiveEventCallback<T extends keyof EventCallback>(name: T, callback: EventCallback[T], deps?: React_2.DependencyList | undefined): void;
679
+
680
+ /**
681
+ * Five React Hooks: Five 楼层
682
+ * @returns
683
+ * [ shownFloor: Five 当前显示的楼层, null 为都显示, showFloor: 设置显示楼层,不传参数为都显示 ]
684
+ * @example
685
+ * ```
686
+ * const [ shownFloor, showFloor ] = useFiveHelper;
687
+ * ```
688
+ */
689
+ export declare function useFiveFloor(): [
690
+ shownFloor: number | null,
691
+ totalFloorLength: number,
692
+ showFloor: (floorIndex?: number) => void
693
+ ];
694
+
695
+ /**
696
+ * Five React Hooks: Five 帮助元素的隐藏/显示
697
+ * @returns
698
+ * [ helperVisible: Five 帮助元素是否显示显示, toggleHelperVisible: 设置 帮助元素的隐藏/显示 ]
699
+ * @example
700
+ * ```
701
+ * const [ helperVisible, toggleHelperVisible ] = useFiveHelper;
702
+ * ```
703
+ */
704
+ export declare function useFiveHelper(): [
705
+ helperVisible: boolean,
706
+ toggleHelperVisible: (visible: boolean) => void
707
+ ];
708
+
709
+ /**
710
+ * Five React Hooks: 获取当前模型碰撞检测方法
711
+ *
712
+ * @function fiveModelIntersectRaycaster
713
+ * ```
714
+ * 计算模型射线碰撞检测
715
+ * // param raycaster THREE 射线对象
716
+ * // param floors 和某一楼层做碰撞检测, 不传为和所有楼层做碰撞检测
717
+ * // returns 返回碰撞
718
+ * intersectRaycaster(raycaster: THREE.Raycaster, floors?: number | number[]): Intersection[]
719
+ * ```
720
+ *
721
+ * @example
722
+ * ```
723
+ * const fiveModelIntersectRaycaster = useFiveModelIntersectRaycaster();
724
+ * const intersects = fiveModelIntersectRaycaster(raycaster);
725
+ * ```
726
+ */
727
+ export declare function useFiveModelIntersectRaycaster(): (raycaster: THREE_2.Raycaster) => Intersection[];
728
+
729
+ /**
730
+ * Five React Hooks: 获取当前模型加载状态
731
+ * @returns
732
+ * "Loaded": 加载完成
733
+ * "Empty" 加载未完成
734
+ */
735
+ export declare function useFiveModelReadyState(): "Loaded" | "Empty";
736
+
737
+ /**
738
+ * Five React Hooks: 将三维的坐标对应到而为屏幕
739
+ *
740
+ * @function preject2d
741
+ * ```
742
+ * 计算模型射线碰撞检测
743
+ * // param vector 三维的坐标
744
+ * // param testModel 是否和模型检测,如果检测,则被模型遮挡会返回 null
745
+ * // returns 三维的坐标 或者 null
746
+ * preject2d(vector: THREE.Vector3, testModel: boolean): THREE.Vector2 | null
747
+ * ```
748
+ *
749
+ * @example
750
+ * ```
751
+ * const preject2d = useFiveProject2d();
752
+ * const { x: width, y: height } = preject2d(new THREE.Vector3(0, 0, 0));
753
+ * ```
754
+ */
755
+ export declare function useFiveProject2d(): (vector: THREE.Vector3, testModel: boolean) => Vector2;
756
+
757
+ /**
758
+ * @deprecated
759
+ * 请使用 `useFiveSceneEffect` 替代
760
+ */
761
+ export declare const useFiveScene: typeof useFiveSceneEffect;
762
+
763
+ /**
764
+ * Five React Hooks: 操作 Five 的 Scene
765
+ * @param callback - 获取 Five 的 Scene 的回调函数
766
+ * @example
767
+ * ```
768
+ * useFiveSceneEffect(scene => {
769
+ * // object is a THREE.Object3D
770
+ * scene.add(object);
771
+ * return () => scene.remove(object); // 析构函数
772
+ * });
773
+ * ```
774
+ */
775
+ export declare function useFiveSceneEffect(callback: (scene: Scene) => void | (() => void), deps?: React_2.DependencyList | undefined): void;
776
+
777
+ export declare function useFiveState(): [
778
+ state: State,
779
+ setState: (state: Partial<State> | ((prevState: State) => Partial<State>), immediately?: boolean, userAction?: boolean) => void
780
+ ];
781
+
782
+ /**
783
+ * Five React Hooks: 获取/设置当前的 Work
784
+ *
785
+ * @returns
786
+ * [ work: 获取当前的 Work, loadWork: 设置 Work ]
787
+
788
+ * @function loadWork
789
+ * ```
790
+ * 加载 Work 数据
791
+ * // param work Work 数据
792
+ * // param state 初始化姿态
793
+ * // - "inherit" 使用当前姿态
794
+ * // - "initial" 使用 Work 数据中的 initial 姿态
795
+ * // - State 自定义姿态
796
+ * // param duration 切换时间
797
+ * (work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number) => void
798
+ * ```
799
+ *
800
+ * @example
801
+ * ```
802
+ * const [ work, loadWork ] = useFiveWork;
803
+ * ```
804
+ */
805
+ export declare function useFiveWork(): [
806
+ work: Work | undefined,
807
+ loadWork: (work: Work, state?: "inherit" | "initial" | Partial<Omit<State, "offset">>, duration?: number, userAction?: boolean) => Promise<void>
808
+ ];
809
+
810
+ 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">>>;
811
+
812
+ export { }