@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,568 @@
1
+ import * as THREE_2 from 'three';
2
+
3
+ export declare class BVH {
4
+ private trianglesArray;
5
+ private offsetArray;
6
+ private maxTrianglesPerNode;
7
+ private bboxArray;
8
+ private rootNode;
9
+ private nodesToSplit;
10
+ constructor(trianglesArray: Float32Array, maxTrianglesPerNode: number);
11
+ private splitNode;
12
+ /**
13
+ * 计算射线与三角形的碰撞
14
+ * @param rayOrigin - 射线的原点坐标
15
+ * @param rayDirection - 设想的方向向量
16
+ * @param backfaceCulling - 是否背面剔除
17
+ * @return 碰撞焦点数组
18
+ */
19
+ intersectRay(rayOrigin: BVHVector3, rayDirection: BVHVector3, backfaceCulling: boolean): BVHIntersect[];
20
+ dispose(): void;
21
+ }
22
+
23
+ export declare class BVHIntersect {
24
+ triangle: [BVHVector3, BVHVector3, BVHVector3];
25
+ triangleIndex: number;
26
+ intersectionPoint: BVHVector3;
27
+ constructor(triangle: [BVHVector3, BVHVector3, BVHVector3], triangleIndex: number, intersectionPoint: BVHVector3);
28
+ }
29
+
30
+ /**
31
+ * A node in the BVH structure
32
+ * @param extents - the min coords of this node's bounding box
33
+ * @param startIndex - an index in the bbox array, where the first element of this node is located
34
+ * @param endIndex - an index in the bbox array, where the last of this node is located, plus 1 (meaning that its non-inclusive).
35
+ * @param level - distance of this node from the root for the bvh tree. root node has level=0, its children have level=1 etc.
36
+ */
37
+ export declare class BVHNode {
38
+ extents: ArrayLike<number>;
39
+ startIndex: number;
40
+ endIndex: number;
41
+ level: number;
42
+ node0: BVHNode | null;
43
+ node1: BVHNode | null;
44
+ constructor(extents: ArrayLike<number>, startIndex: number, endIndex: number, level: number);
45
+ clearShapes(): void;
46
+ }
47
+
48
+ export declare class BVHVector3 {
49
+ x: number;
50
+ y: number;
51
+ z: number;
52
+ constructor(x: number, y: number, z: number);
53
+ copy(v: BVHVector3): this;
54
+ set(x: number, y: number, z: number): this;
55
+ fromArray(array: number[], firstElementPos?: number): this;
56
+ add(v: BVHVector3): this;
57
+ multiplyScalar(scalar: number): this;
58
+ subVectors(a: BVHVector3, b: BVHVector3): this;
59
+ dot(v: BVHVector3): number;
60
+ cross(v: BVHVector3): this;
61
+ crossVectors(a: BVHVector3, b: BVHVector3): this;
62
+ clone(): BVHVector3;
63
+ }
64
+
65
+ /**
66
+ * Five 模型事件列表
67
+ * @description
68
+ * 可以通过 `five.model.on(METHOD_NAME, METHOD)` 调用
69
+ */
70
+ declare interface EventCallback extends EventType {
71
+ }
72
+ export { EventCallback }
73
+ export { EventCallback as ModelEventCallback }
74
+
75
+ /**
76
+ * 模型事件列表
77
+ * @description
78
+ * 具体事件列表 请查看 {@link ModelEventCallback}
79
+ */
80
+ declare type EventType = {
81
+ /**
82
+ * 模型 bvh树 计算完成
83
+ * @description
84
+ * bvh 树用于高效的碰撞检测,可以在 `model.bvh` 属性来设置是否开启。默认开启。
85
+ * bvh 树计算需要一定事件,可能会暂时影响一些性能。计算完毕后,会对碰撞检测带来质的提升。
86
+ */
87
+ bvhLoaded(): void;
88
+ /** 模型三角面片结构加载完成 */
89
+ geometryLoaded(): void;
90
+ /** 模型材质结构加载完成 */
91
+ materialLoaded(): void;
92
+ /** 模型加载完成 */
93
+ loaded(): void;
94
+ /**
95
+ * 内部错误
96
+ * @param error - 错误对象
97
+ */
98
+ error(error: Error): void;
99
+ };
100
+ export { EventType }
101
+ export { EventType as ModelEventType }
102
+
103
+ export declare interface Intersection {
104
+ /** 焦点坐标 */
105
+ point: THREE_2.Vector3;
106
+ /** 焦点面片 */
107
+ face?: {
108
+ normal: THREE_2.Vector3;
109
+ } | null;
110
+ /** 焦点距离 */
111
+ distance: number;
112
+ }
113
+
114
+ export declare type LooseWork = {
115
+ bvh?: boolean;
116
+ modelAsync?: boolean;
117
+ initial?: LooseWorkInitial;
118
+ base_url?: string;
119
+ model?: LooseWorkModel;
120
+ panorama: {
121
+ base_url?: string;
122
+ pano_high_cube_base_url?: string;
123
+ info?: LooseWorkPanorama[];
124
+ list?: LooseWorkPanorama[];
125
+ };
126
+ observers: LooseWorkObserver[];
127
+ };
128
+
129
+ export declare type LooseWorkInitial = {
130
+ pano_index?: number;
131
+ pano?: number;
132
+ longitude?: number;
133
+ latitude?: number;
134
+ heading?: number;
135
+ };
136
+
137
+ export declare type LooseWorkModel = {
138
+ file_url: string;
139
+ material_textures?: string[];
140
+ material_base_url?: string;
141
+ };
142
+
143
+ export declare type LooseWorkObserver = {
144
+ active?: boolean;
145
+ index?: number;
146
+ visible_nodes: number[];
147
+ accessible_nodes: number[];
148
+ quaternion: {
149
+ y: number;
150
+ x: number;
151
+ z: number;
152
+ w: number;
153
+ };
154
+ standing_position: number[];
155
+ position: number[];
156
+ floor?: number;
157
+ floor_index?: number;
158
+ };
159
+
160
+ export declare type LooseWorkPanorama = {
161
+ active?: boolean;
162
+ loadable?: boolean;
163
+ index?: number;
164
+ up: string;
165
+ down: string;
166
+ right: string;
167
+ left: string;
168
+ front: string;
169
+ back: string;
170
+ video?: LooseWorkVideo;
171
+ luminance?: {
172
+ up: string;
173
+ down: string;
174
+ right: string;
175
+ left: string;
176
+ front: string;
177
+ back: string;
178
+ };
179
+ tiles?: number[];
180
+ };
181
+
182
+ export declare type LooseWorkVideo = {
183
+ source: string;
184
+ matrix: number[];
185
+ size: number[];
186
+ };
187
+
188
+ /**
189
+ * Five 的显示模式,可以通过 `five.changeMode` `five.setState` 来切换
190
+ * - **Panorama**: 全景图游走模式
191
+ * - **Model**: 模型游走模式
192
+ * - **Floorplan**: 模型查看模式
193
+ * - **Topview**: 户型图模式
194
+ * - **DepthPanorama**: 深度图游走模式
195
+ * - **VRPanorama**: VR眼镜模式
196
+ */
197
+ export declare type Mode =
198
+ /** 模型查看模式 */
199
+ "Floorplan" |
200
+ /** 户型图模式 */
201
+ "Topview" |
202
+ /** 全景图游走模式 */
203
+ "Panorama" |
204
+ /** VR眼镜模式 */
205
+ "VRPanorama" |
206
+ /** 模型游走模式 */
207
+ "Model" |
208
+ /** 深度图游走模式 */
209
+ "DepthPanorama";
210
+
211
+ /**
212
+ * Five 模型
213
+ * @description
214
+ * 通过 work 数据加载, 适配 at3d、pbm、dome、domez 格式的文件
215
+ * 可以通过 jsonp 解析 base64 的 dataURL 内容,
216
+ * 需要满足 your/path/filename.at3d.json_xxxxxx,
217
+ * 通过 json_xxxxxx(<dataURL>) 方式返回。
218
+ */
219
+ export declare class Model extends PBMGroup implements Subscribe<EventType> {
220
+ /** 是否加载完成 */
221
+ loaded: boolean;
222
+ /** 是否未加载 */
223
+ empty: boolean;
224
+ /** 外接盒子的大小 */
225
+ bounding: THREE_2.Box3;
226
+ /** 当前显示的楼层 */
227
+ shownfloor: number | null;
228
+ /**
229
+ * 判断是否注册了事件
230
+ * 具体可查看 {@link Subscribe.hasListener}
231
+ */
232
+ hasListener: SubscribeMixinType.hasListener<EventType>;
233
+ /**
234
+ * 注册事件
235
+ * 具体可查看 {@link Subscribe.on}
236
+ */
237
+ on: SubscribeMixinType.on<EventType>;
238
+ /**
239
+ * 注册事件(是否只执行一次)
240
+ * 具体可查看 {@link Subscribe.once}
241
+ */
242
+ once: SubscribeMixinType.once<EventType>;
243
+ /**
244
+ * 解除事件
245
+ * 具体可查看 {@link Subscribe.off}
246
+ */
247
+ off: SubscribeMixinType.off<EventType>;
248
+ /**
249
+ * 触发事件
250
+ * 具体可查看 {@link Subscribe.emit}
251
+ */
252
+ emit: SubscribeMixinType.emit<EventType>;
253
+ /** bvh 树的计算结果 */
254
+ bvhs: BVH[] & {
255
+ loaded?: boolean;
256
+ };
257
+ constructor();
258
+ /**
259
+ * 获取模型边界线
260
+ * @param threshold - 面片间夹角阈值
261
+ * @returns 所有模型边界线
262
+ */
263
+ getEdges(threshold?: number): THREE_2.Line3[];
264
+ /** 获取当前楼层数 */
265
+ hasFloors(): number;
266
+ /**
267
+ * 显示某楼层
268
+ * @example
269
+ * ```
270
+ * model.show() //显示全部楼层
271
+ * model.show(1) //显示第一楼层
272
+ * model.show(1, 0) //显示第一楼层, 并且其他楼层透明度为 0
273
+ * ```
274
+ */
275
+ show(): void;
276
+ show(floorIndex: number, hideOpacity?: number): void;
277
+ /**
278
+ * 计算模型射线碰撞检测
279
+ * @param raycaster - THREE 射线对象
280
+ * @param floors - 和某一楼层做碰撞检测, 不传为和所有楼层做碰撞检测
281
+ * @returns 返回碰撞
282
+ */
283
+ intersectRaycaster(raycaster: THREE_2.Raycaster, floors?: number | number[]): Intersection[];
284
+ buildBVH(): void;
285
+ /**
286
+ * 加载模型
287
+ * @param workModel - work 的 model 内容
288
+ * @param imageOptions - 图片参数
289
+ */
290
+ load(workModel: WorkModel): Promise<void>;
291
+ /**
292
+ * 析构函数
293
+ * @description
294
+ * 一旦析构,则不能使用
295
+ */
296
+ dispose(): void;
297
+ }
298
+
299
+ /**
300
+ * 解析 Work 数据
301
+ * @param obj - work 数据,从如数开发者平台获取
302
+ * @param options - 配置参数, 可以在此二次设置 baseURL 等参数
303
+ * @param urlTransform - 配置参数, URL 解析规则
304
+ * @returns - 签署过的 Work 数据结构
305
+ */
306
+ export declare function parseWork(obj: Work | LooseWork | string | any, options?: ParseWorkOptions, urlTransform?: (origin: string, absolute: string, relative: string, type: "panorama" | "texture" | "model") => void): Work;
307
+
308
+ export declare type ParseWorkOptions = {
309
+ /** 重写 work 中的资源前缀 */
310
+ baseURL?: string;
311
+ /** work 中的资源地址使用短地址 */
312
+ shortPath?: boolean;
313
+ /** work 中的资源使用 jsonp 方式发布 */
314
+ jsonp?: boolean;
315
+ /** work 中模型是否计算bvh碰撞数,默认计算 true */
316
+ modelBvh?: boolean;
317
+ };
318
+
319
+ /** PBM 模型组 */
320
+ export declare class PBMGroup extends THREE_2.Group {
321
+ /** 楼层序号 */
322
+ floorIndex: number;
323
+ /** 是否需要更新按需渲染 */
324
+ needsRender: boolean;
325
+ /** 析构模型网格 */
326
+ disposeGeometry(): void;
327
+ }
328
+
329
+ /** PBM 对象 */
330
+ export declare class PBMMesh extends THREE_2.Mesh<THREE_2.BufferGeometry> {
331
+ /** 楼层序号 */
332
+ floorIndex: number;
333
+ /** 是否需要更新按需渲染 */
334
+ needsRender: boolean;
335
+ }
336
+
337
+ /**
338
+ * 相机位姿
339
+ * [[include: coordinate.md]]
340
+ */
341
+ export declare interface Pose {
342
+ /** 相机俯仰角 */
343
+ longitude: number;
344
+ /** 相机偏航角 */
345
+ latitude: number;
346
+ /** 相机可视角度(垂直)*/
347
+ fov: number;
348
+ /** 相机位置*/
349
+ offset: THREE_2.Vector3;
350
+ }
351
+
352
+ /**
353
+ * 状态
354
+ * @description
355
+ * ```text
356
+ * 可以通过 five.state 和 five.setState 来获取和设置。
357
+ * 通过 state 设置后,five 会通过合适的动画运动来达到设置的位置。
358
+ * 来迎合一些通过数据驱动的场景。
359
+ * ```
360
+ */
361
+ export declare interface State extends Pose {
362
+ /** 模态 */
363
+ mode: Mode;
364
+ /** 观察点序号 */
365
+ panoIndex: number;
366
+ }
367
+
368
+ /**
369
+ * 监听者模式
370
+ * @template T - 预设的监听回调类型
371
+ * @example
372
+ * ```
373
+ * new Subscribe<{
374
+ * "foo": [arg1: number, arg2: string],
375
+ * "bar": [arg: boolean],
376
+ * }>()
377
+ * ```
378
+ */
379
+ export declare class Subscribe<T extends SubscribeEventMap> {
380
+ /**
381
+ * 判断是否注册了事件
382
+ * @param name - 事件类型
383
+ */
384
+ hasListener(name: keyof T): boolean;
385
+ /**
386
+ * 注册事件
387
+ * @param name - 事件类型
388
+ * @param callback - 事件回调函数
389
+ * @param once - 是否只执行一次
390
+ * @returns 解除事件
391
+ * @template K - 预设的监听事件名称
392
+ * @template C - 回调函数函数上下文
393
+ */
394
+ on<K extends keyof T>(name: K, callback: (...args: Parameters<T[K]>) => ReturnType<T[K]>, once?: boolean): () => void;
395
+ /**
396
+ * 注册事件(是否只执行一次)
397
+ * @param name - 事件类型
398
+ * @param callback - 事件回调函数
399
+ * @returns 解除事件
400
+ * @template K - 预设的监听事件名称
401
+ * @template C - 回调函数函数上下文
402
+ */
403
+ once<K extends keyof T>(name: K, callback: (...args: Parameters<T[K]>) => ReturnType<T[K]>): () => void;
404
+ /**
405
+ * 解除事件
406
+ *
407
+ * 如果 name 不传的话解除对应所有事件
408
+ * 如果 name, callback 不传的话解除所有name的所有事件
409
+ * @param name - 事件类型
410
+ * @param callback - 事件回调函数
411
+ * @template K - 预设的监听事件名称
412
+ */
413
+ off<K extends keyof T>(name?: K, callback?: (...args: Parameters<T[K]>) => ReturnType<T[K]>): void;
414
+ /**
415
+ * 触发事件
416
+ * @param name - 事件类型
417
+ * @param data - 触发事件的数据
418
+ * @returns canceled 是否被触发取消
419
+ * @template K - 预设的监听事件名称
420
+ */
421
+ emit<K extends keyof T>(name: K, ...data: Parameters<T[K]>): boolean;
422
+ }
423
+
424
+ export declare type SubscribeEventMap = {
425
+ [name: string]: (...args: any[]) => void | boolean;
426
+ };
427
+
428
+ export declare namespace SubscribeMixinType {
429
+ export interface hasListener<T extends SubscribeEventMap> {
430
+ (name: keyof T): boolean;
431
+ }
432
+ export interface on<T extends SubscribeEventMap> {
433
+ <K extends keyof T>(name: K, callback: (...args: Parameters<T[K]>) => ReturnType<T[K]>, once?: boolean): () => void;
434
+ }
435
+ export interface once<T extends SubscribeEventMap> {
436
+ <K extends keyof T>(name: K, callback: (...args: Parameters<T[K]>) => ReturnType<T[K]>): () => void;
437
+ }
438
+ export interface off<T extends SubscribeEventMap> {
439
+ <K extends keyof T>(names?: K | K[], callback?: (...args: any[]) => any): void;
440
+ }
441
+ export interface emit<T extends SubscribeEventMap> {
442
+ <K extends keyof T>(name: K, ...data: Parameters<T[K]>): boolean;
443
+ }
444
+ }
445
+
446
+ export declare class Work {
447
+ /** 名称 */
448
+ name: string;
449
+ /** 编号 */
450
+ workCode: string;
451
+ /** 允许访问的安全域名 */
452
+ allowHosts: string[];
453
+ /** 过期时间 */
454
+ expire: Date;
455
+ /** 初始化参数 */
456
+ initial: WorkInitial;
457
+ /** 模型参数 */
458
+ model?: WorkModel;
459
+ /** 全景点位信息 */
460
+ observers: WorkObserver[];
461
+ /** 数据签发人 */
462
+ issuer: string;
463
+ /** 原始数据 */
464
+ raw: {
465
+ works: string[];
466
+ options: string;
467
+ };
468
+ /**
469
+ * 解析 Work 数据
470
+ * @param obj - work 数据,从如数开发者平台获取
471
+ * @param options - 配置参数, 可以在此二次设置 baseURL 等参数
472
+ * @param urlTransform - 配置参数, URL 解析规则
473
+ * @returns - 签署过的 Work 数据结构
474
+ */
475
+ static parse: typeof parseWork;
476
+ constructor();
477
+ toJSON(): any;
478
+ }
479
+
480
+ export declare interface WorkCubeImage {
481
+ /** 全景图 up */
482
+ up: string;
483
+ /** 全景图 down */
484
+ down: string;
485
+ /** 全景图 right */
486
+ right: string;
487
+ /** 全景图 left */
488
+ left: string;
489
+ /** 全景图 front */
490
+ front: string;
491
+ /** 全景图 back */
492
+ back: string;
493
+ }
494
+
495
+ /** 全景图 */
496
+ export declare interface WorkImage extends WorkCubeImage {
497
+ /** 深度图 */
498
+ depth?: string;
499
+ /** 光照强度图 */
500
+ luminance?: WorkCubeImage;
501
+ /** 瓦片信息 */
502
+ tiles?: WorkTile[];
503
+ }
504
+
505
+ /** 初始化位姿参数 */
506
+ export declare interface WorkInitial extends Omit<State, "offset"> {
507
+ }
508
+
509
+ /** 模型数据 */
510
+ export declare interface WorkModel {
511
+ /** 模型文件地址 at3d / domez */
512
+ file: string;
513
+ /** 模型贴图文件地址 */
514
+ textures: string[];
515
+ /** 模型贴图文件地址的父目录 */
516
+ textureBase: string;
517
+ /** 是否开启 bvh 碰撞树,开启会大大加快射线碰撞的执行效率 */
518
+ bvh: boolean;
519
+ }
520
+
521
+ /** 每个点位的数据 */
522
+ export declare interface WorkObserver {
523
+ /** 点位序号 */
524
+ panoIndex: number;
525
+ /** 点位是否激活可用 */
526
+ active: boolean;
527
+ /** 点位是否可加载 */
528
+ loadable: boolean;
529
+ /** 点位全景图 */
530
+ images: WorkImage;
531
+ /** 点位视频 */
532
+ video?: WorkVideo;
533
+ /** 可以看到的相关点位序号 */
534
+ visibleNodes: number[];
535
+ /** 可以连通的相关点位序号 */
536
+ accessibleNodes: number[];
537
+ /** 点位和模型的旋转对齐关系四元数 */
538
+ quaternion: THREE_2.Quaternion;
539
+ /** 点位和模型的地面位置坐标关系 */
540
+ standingPosition: THREE_2.Vector3;
541
+ /** 点位和模型的观察点坐标关系 */
542
+ position: THREE_2.Vector3;
543
+ /** 点位所在楼层 */
544
+ floorIndex: number;
545
+ }
546
+
547
+ export declare interface WorkTile {
548
+ level: number;
549
+ size: number;
550
+ up: string;
551
+ down: string;
552
+ right: string;
553
+ left: string;
554
+ front: string;
555
+ back: string;
556
+ }
557
+
558
+ /** 全景视频贴片 */
559
+ export declare interface WorkVideo {
560
+ /** 视频源 url */
561
+ source: string;
562
+ /** 视频源变化矩阵 */
563
+ matrix: THREE_2.Matrix4;
564
+ /** 视频源长宽尺寸 */
565
+ size: THREE_2.Vector2;
566
+ }
567
+
568
+ export { }