qt-human 2.2.0-alpha.5 → 2.2.0-alpha.6

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 (57) hide show
  1. package/dist/assets/earth_bg.png +0 -0
  2. package/dist/assets/empty.wav +0 -0
  3. package/dist/assets/images/earth_bg.png +0 -0
  4. package/dist/assets/images/sky.png +0 -0
  5. package/dist/assets/images/starflake1.png +0 -0
  6. package/dist/assets/images/starflake2.png +0 -0
  7. package/dist/assets/sky.png +0 -0
  8. package/dist/assets/starflake1.png +0 -0
  9. package/dist/assets/starflake2.png +0 -0
  10. package/dist/assets/wav/empty.wav +0 -0
  11. package/dist/bundle.esm.js +4 -0
  12. package/dist/bundle.iife.js +4 -0
  13. package/dist/bundle.umd.js +4 -0
  14. package/dist/index.d.ts +1031 -0
  15. package/dist/types/api/helper/index.d.ts +2 -0
  16. package/dist/types/api/human.d.ts +20 -0
  17. package/dist/types/api/interface/index.d.ts +35 -0
  18. package/dist/types/const.d.ts +12 -0
  19. package/dist/types/index.d.ts +6 -0
  20. package/dist/types/modules/components/loading.d.ts +37 -0
  21. package/dist/types/modules/core/audio.d.ts +27 -0
  22. package/dist/types/modules/core/loader.d.ts +8 -0
  23. package/dist/types/modules/core/recorder.d.ts +26 -0
  24. package/dist/types/modules/core/recorder2.d.ts +38 -0
  25. package/dist/types/modules/core/render.d.ts +117 -0
  26. package/dist/types/modules/core/voice-interaction.d.ts +46 -0
  27. package/dist/types/modules/core/websocket.d.ts +19 -0
  28. package/dist/types/modules/human.d.ts +78 -0
  29. package/dist/types/types/api.d.ts +0 -0
  30. package/dist/types/types/common.d.ts +0 -0
  31. package/dist/types/types/declarations.d.ts +4 -0
  32. package/dist/types/types/enum.d.ts +20 -0
  33. package/dist/types/types/enum.ts +38 -0
  34. package/dist/types/types/index.d.ts +659 -0
  35. package/dist/types/types/model.d.ts +521 -0
  36. package/dist/types/types/recorder.d.ts +3 -0
  37. package/dist/types/utils/AudioManager.d.ts +45 -0
  38. package/dist/types/utils/actionNotifier.d.ts +11 -0
  39. package/dist/types/utils/aes.d.ts +3 -0
  40. package/dist/types/utils/blendShapes.d.ts +12 -0
  41. package/dist/types/utils/blendShapes2.d.ts +13 -0
  42. package/dist/types/utils/blendShapesAzure.d.ts +13 -0
  43. package/dist/types/utils/blendShapesOvr.d.ts +11 -0
  44. package/dist/types/utils/chatMessageHandler.d.ts +21 -0
  45. package/dist/types/utils/detector.d.ts +2 -0
  46. package/dist/types/utils/eventBus.d.ts +8 -0
  47. package/dist/types/utils/fileCache.d.ts +11 -0
  48. package/dist/types/utils/framePlayer.d.ts +28 -0
  49. package/dist/types/utils/frameProbeTime.d.ts +16 -0
  50. package/dist/types/utils/fuse.d.ts +8 -0
  51. package/dist/types/utils/http.d.ts +18 -0
  52. package/dist/types/utils/index.d.ts +8 -0
  53. package/dist/types/utils/repeat.d.ts +18 -0
  54. package/dist/types/utils/sentences.d.ts +5 -0
  55. package/dist/types/utils/sequence.d.ts +15 -0
  56. package/dist/types/utils/storage.d.ts +18 -0
  57. package/package.json +1 -1
@@ -0,0 +1,659 @@
1
+ import { API } from "./api";
2
+ import * as THREE from 'three'
3
+ import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader.js';
4
+
5
+ export namespace QuanTe {
6
+ export type Character = 'xiaomeng' | 'custom' | 'quan' | 'doctor' | 'boy' | 'girl' | '';
7
+ export type ModelID = 'xiaomeng_mouth' | 'xiaomeng_eyeLash' | 'xiaomeng_head';
8
+ export type Cloth = {};
9
+ export type Scene = {};
10
+ export type AskParamType = API.AskParam & { message: API.MSG[] };
11
+
12
+ // 状态,init: 初始化, ready: 模型已准备就绪, prepare2play: 准备播放,playing: 正在播放
13
+ export type Status = 'init' | 'ready' | 'prepare2play' | 'playing'
14
+ export type ConfigurationOptions = {
15
+ // 帧数, blendshapes每秒执行的帧数, 默认30帧
16
+ fps: number
17
+ }
18
+ // 模式, nomal 普通模式(默认), voice 语音控制, only_render 只渲染模型
19
+ export type Mode = 'voice' | 'nomal' | 'only_render'
20
+ export type VoiceModeConfig = {
21
+ // 为true时不会受到唤醒词,退出词和打断词的影响,程序会一直收音并且会随时打断
22
+ keepActive?: boolean
23
+ }
24
+ export type Configuration = {
25
+ // 模型容器
26
+ container?: string | HTMLElement,
27
+ // 授权token,
28
+ token: string;
29
+ // 数字人ID
30
+ characterId?: string;
31
+ // 音频配置
32
+ audio?: {
33
+ volumn?: number;
34
+ };
35
+ // 服务配置
36
+ server?: {
37
+ // 接口
38
+ api?: string;
39
+ // socket服务接口
40
+ wss?: string;
41
+ // gateway服务接口配置
42
+ // 咨询
43
+ questionApiParams?: API.AskParam;
44
+ // 文本转语音
45
+ text2Speach?: Text2SpeechParams;
46
+ }
47
+ // 模型描述文件
48
+ modelConfig?: Partial<QuanTe.Model.Description>;
49
+ loading?: string | HTMLElement;
50
+ loadingDestory?: boolean;
51
+ // 其他参数
52
+ options?: ConfigurationOptions;
53
+ mode?: Mode,
54
+ voiceModeConfig?: VoiceModeConfig,
55
+ // 不立即渲染
56
+ isNotRender?: boolean
57
+ }
58
+ export type VoiceConfig = {
59
+ wakeWords?: string[],
60
+ exitWords?: string[],
61
+ interruptWorlds?: string[],
62
+ sampleRate?: number
63
+ // 无操作时退出时间
64
+ exitTime?: number
65
+ // 音量检测值
66
+ level?: number
67
+ // 结束录音等待时间
68
+ waitTime?: number
69
+ }
70
+ export interface Human {
71
+ name: string;
72
+ // 设置人物模型
73
+ public setCharacter(characterId: string, config?: Partial<Configuration>): Promise<boolean>;
74
+ // 设置人物模型数据
75
+ public setCharacterData(characterId: string): Promise<boolean>
76
+ // 说一段话
77
+ public speak(text: string, callback?: Function): Promise<QuanTe.API.StreamAudioPlayInfo>;
78
+ // AI 问答
79
+ public ask(params: AskParams, callback: (msgs: IResultData<QuanTe.API.ChatMessage[]>) => void): Promise<QuanTe.Result<QuanTe.API.AskResponse>>;
80
+ // 静音 isMute: true: 静音, false:取消静音
81
+ public muteAudio(isMute: boolean);
82
+ // 禁用动作 isMute: true: 禁用, false:取消禁用
83
+ public muteAction(isMute: boolean);
84
+ // 销毁
85
+ public destroy();
86
+ // 使用音频说一段话,uri音频资源
87
+ // public speakByAudio(uri: string, shapes: number[][]): Promise<boolean>;
88
+ // 开始录音转文本
89
+ public startVoice2Text(callback?: (data: API.Voice2Text) => void): Promise<QuanTe.Result<QuanTe.Recorder.PermissionResult>>;
90
+ // 结束录音转文本
91
+ public stopVoice2Text(callback?: (data: API.Voice2Text) => void): Promise<QuanTe.Result<null>>;
92
+ // 停止,停止语音和口型
93
+ public stop(): Promise<boolean>;
94
+ // 根据audio地址和blend_shapes说一段话
95
+ public speakByAudioShapes(uris: string[], shapes: Array<number[][]>): Promise<boolean>
96
+ // 更新token
97
+ public updateToken(token: string): void;
98
+ // 切换视角
99
+ public setAngleView({ camera, controls }: { camera: QuanTe.Model.TCamera & { duration?: number }, controls: QuanTe.Model.OrbitControl & { duration?: number } }): void;
100
+ // 执行动画
101
+ public playAction(code: string, opts: PlayActionOptions): Promise<void>
102
+ public getModelInfo(): ModelInfo | null
103
+ // 离线渲染模型, 不可使用asr、tts、咨询大模型等功能
104
+ public offlineRender(files: CharacterModel[]): Promise<boolean>
105
+ // 停止渲染
106
+ public stopRender(): Promise<boolean>
107
+ // 开始渲染
108
+ public startRender(): Promise<boolean>
109
+ public openVoiceInteraction(config: VoiceConfig): Promise<boolean>
110
+ public closeRecorder(): Promise<boolean>
111
+ public openRecorder(): Promise<QuanTe.Result<QuanTe.Recorder.PermissionResult>>
112
+ }
113
+
114
+ export interface ModelInfo {
115
+ actor: THREE.Group<THREE.Object3DEventMap>,
116
+ scenes: THREE.Object3D[]
117
+ animations: THREE.AnimationClip[]
118
+ mixer: THREE.AnimationMixer,
119
+ actions: any[]
120
+ }
121
+
122
+ export type PlayActionOptions = { loop?: THREE.AnimationActionLoopStyles, repetitions?: number }
123
+
124
+ // json 对象
125
+ export type Json = {[key: string]: any};
126
+
127
+ export interface Result<T> {
128
+ code: number;
129
+ data: T;
130
+ msg: string;
131
+ }
132
+
133
+
134
+ export namespace Recorder {
135
+ export interface PermissionResult {
136
+ isUserNotAllow: boolean;
137
+ }
138
+
139
+ // 语音转文字
140
+ export interface Voice2Text {
141
+ // 是否结束
142
+ is_final: boolean;
143
+ // 模型
144
+ mode?: string;
145
+ // 文字内容
146
+ text: string;
147
+ wav_name: string;
148
+ }
149
+ }
150
+
151
+ export namespace Loader {
152
+ export interface LoaderResponse extends API.CharacterModel {
153
+ buffer?: any;
154
+ gltf?: GLTF;
155
+ }
156
+ // 加载进度
157
+ export interface LoaderProgress {
158
+ // 资源
159
+ url: string;
160
+ // 进度值
161
+ progress: number;
162
+ // 数据总量
163
+ total: number;
164
+ }
165
+ // 加载进度
166
+ export interface Progress {
167
+ // 资源名称
168
+ code: string;
169
+ // 进度值
170
+ progress: number;
171
+ // 数据总量
172
+ total: number;
173
+ }
174
+ }
175
+
176
+ export namespace API {
177
+ export type SceneType = 'hdr' | 'picture' | 'glb' | 'background' | 'video'
178
+ export type TTS_ROLE = 'woman' | 'man' | 'xiaoxiao' | 'yunxiao' | 'yunhao'
179
+ export type TTS_MODEL = 'gpt-sovits' | 'xunfei' | 'paddle' | 'paddle2' | 'azure'
180
+ export type TTS_VISEME = 'azure' | 'ovr' | 'a2f' | 'qt' | 'none' | 'a2f3d'
181
+ export type ChatMessageResonseMode = 'streaming' | 'blocking'
182
+
183
+ export interface IResult {
184
+ code: number
185
+ msg: string
186
+ }
187
+
188
+ // 请求响应参数(包含data)
189
+ export interface IResultData<T = any> extends IResult {
190
+ data: T
191
+ }
192
+
193
+ // 文本转语音&blend_shapes
194
+ export interface Text2Speech {
195
+ // 音频url
196
+ url: string;
197
+ // 音频时长
198
+ duration: number;
199
+ // 口型
200
+ blend_shapes: number[] | number[][];
201
+ // 语音文本
202
+ content: string;
203
+ }
204
+ export interface Text2SpeechParams {
205
+ // '音色' TTS_ROLE
206
+ role?: string;
207
+ // 内容
208
+ content: string;
209
+ // '语速, 默认: 1'
210
+ speed?: number;
211
+ // '模型,默认:gpt-sovits'
212
+ model?: TTS_MODEL;
213
+ // '口型,默认:a2f'
214
+ viseme?: TTS_VISEME;
215
+ // '是否开启平滑[0: 关闭, 1: 开启],默认开启'
216
+ smooth_method?: number;
217
+ // '平滑值:[1~10],默认5'
218
+ smooth_interations?: number;
219
+ }
220
+ // 消息
221
+ export interface MSG {
222
+ // 角色, user: 用户消息, assistant: 服务消息
223
+ role: 'user' | 'assistant';
224
+ // 消息内容
225
+ content: string;
226
+ }
227
+ // 咨询参数
228
+ export interface AskParam {
229
+ // 模型,默认使用quan
230
+ model?: 'quan' | 'charglm-3' | 'qwen1.5' | 'glm-4' | 'openai' | 'echo';
231
+ // 渠道, 应用ID
232
+ channel?: string;
233
+ // 流式, 默认true
234
+ stream?: boolean;
235
+ // 断句, 默认true
236
+ sentence?: boolean;
237
+ // 最大输出, 默认1000
238
+ max_tokens?: 1000;
239
+ // 温度设置, 默认1
240
+ temperature?: number;
241
+ // 会话ID, 默认0
242
+ conversation_id?: string;
243
+ // 文件
244
+ files?: {type: 'image', transfer_method: 'remote_url', url: string}[]
245
+ }
246
+ export interface PlayInfo {
247
+ // bs 数据
248
+ shapes: number[][];
249
+ // 音频链接
250
+ url: string;
251
+ // 音频时长
252
+ duration: number;
253
+ // 文本内容
254
+ content: string;
255
+ }
256
+ export interface StreamAudioPlayInfo {
257
+ // bs 数据
258
+ shapes: number[][];
259
+ // 音频链接
260
+ audios: ArrayBuffer[];
261
+ // 音频时长
262
+ duration: number;
263
+ // 文本内容
264
+ content: string;
265
+ // 音频采样率
266
+ rate: number;
267
+ }
268
+ // 咨询错误
269
+ export interface AskError {
270
+ // 文本内容
271
+ content: string;
272
+ // 错误消息
273
+ errorMessage: string;
274
+ }
275
+ export interface AskResponse {
276
+ // 请求ID
277
+ reqId: string;
278
+ // 播放数据
279
+ playInfos: PlayInfo[];
280
+ // 错误数据
281
+ errorInfos: AskError[];
282
+ }
283
+ export interface AskStreamResponse {
284
+ // 请求ID
285
+ reqId: string;
286
+ // 播放数据
287
+ playInfos: StreamAudioPlayInfo[];
288
+ // 错误数据
289
+ errorInfos: AskError[];
290
+ }
291
+
292
+ export interface CharacterTimbre {
293
+ id: string
294
+ name: string
295
+ enabled: SystemBoolean
296
+ value: string
297
+ }
298
+ export interface CharacterModel {
299
+ id: string
300
+ name: string
301
+ enabled: SystemBoolean
302
+ code: string
303
+ bundle: string
304
+ type: 'apose' | 'animation' | 'animation_system'
305
+ }
306
+
307
+ export interface CharacterScene {
308
+ id: string
309
+ name: string
310
+ path: string
311
+ type: SceneType
312
+ pictures: string[]
313
+ background: string
314
+ }
315
+ export interface Pronunciation {
316
+ id: string
317
+ // 词汇,来源
318
+ source: string
319
+ // 发音
320
+ target: string
321
+ }
322
+ export interface CharacterInfo {
323
+ id: string
324
+ // userId: string
325
+ // timbreId: string
326
+ // sceneId: string
327
+ // moldId: string
328
+ name: string
329
+ description: string
330
+ language: string
331
+ animationEnabled: SystemBoolean
332
+ timbre: CharacterTimbre
333
+ animations: CharacterModel[]
334
+ aposes: CharacterModel[]
335
+ scene: CharacterScene | null
336
+ configuration: any
337
+ pronunciations: Pronunciation[]
338
+ token: string
339
+ renderings: string[]
340
+ }
341
+
342
+ export interface ChatMessage {
343
+ event: string
344
+ conversation_id: string
345
+ message_id: string
346
+ created_at: number
347
+ task_id: string
348
+ id: string
349
+ answer: string
350
+ from_variable_selector: string
351
+ message?: string
352
+ }
353
+
354
+ export interface ChatMessageFile {
355
+ type: 'image'
356
+ transfer_method: 'remote_url' | 'local_file'
357
+ url: string
358
+ }
359
+ export interface ChatMessageParams {
360
+ message: MSG[]
361
+ language?: string
362
+ conversation_id?: string
363
+ response_mode?: ChatMessageResonseMode
364
+ files?: ChatMessageFile[]
365
+ inputs?: any
366
+ }
367
+ export interface AskParams {
368
+ // 请求ID
369
+ reqId?: string;
370
+ message: MSG[]
371
+ conversation_id?: string
372
+ response_mode?: ChatMessageResonseMode
373
+ files?: ChatMessageFile[]
374
+ commandType?: string
375
+ inputs?: any
376
+ }
377
+ }
378
+
379
+ export namespace Model {
380
+ export type XYZ = [number, number, number];
381
+ export type Matrix4 = [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number];
382
+ export interface GridHelper {
383
+ size?: number
384
+ divisions?: number
385
+ color1?: THREE.ColorRepresentation
386
+ color2?: THREE.ColorRepresentation
387
+ }
388
+ /**
389
+ * 模型描述内容
390
+ */
391
+ export interface Description {
392
+ // 模型名称
393
+ name: string;
394
+ // 模型配置
395
+ model: Model;
396
+ // 摄像机
397
+ camera: TCamera;
398
+ // 轨道控制器
399
+ orbitControls: OrbitControl;
400
+ // 背景
401
+ background: Background;
402
+ // 灯光
403
+ lights: Light[];
404
+ // 网格线
405
+ // constructor(size?: number, divisions?: number, color1?: ColorRepresentation, color2?: ColorRepresentation);
406
+ gridHelper?: GridHelper;
407
+ // 解压缩目录
408
+ dracoPath?: string;
409
+ }
410
+ type FileType = 'zip' | 'bundle' | ''
411
+ interface File {
412
+ // 文件名
413
+ name: string;
414
+ // 文件类型
415
+ type: FileType;
416
+ // zip类型解压密码
417
+ pwd: string;
418
+ // 文件路径
419
+ url: string;
420
+ }
421
+ export interface BodyOption {
422
+ //
423
+ key: string;
424
+ name: string;
425
+ // 前缀
426
+ prefix: string;
427
+ // 后缀
428
+ suffix: string;
429
+ }
430
+ export interface Body {
431
+ // 主体模型名称
432
+ name: string;
433
+ // 部位描述
434
+ options: BodyOption[];
435
+ }
436
+ /**
437
+ * 模型
438
+ */
439
+ export interface Model {
440
+ // 主体部位
441
+ body: Body;
442
+ // 位置
443
+ position?: XYZ;
444
+ // 旋转角度
445
+ rotation?: XYZ;
446
+ // 缩放
447
+ scale?: XYZ;
448
+ // 是否开启旋转, 默认不开启
449
+ rotate?: boolean;
450
+ }
451
+ export interface Object3D {
452
+ id?: number;
453
+ name?: string;
454
+ // 可见性。这个值为true时,物体将被渲染。默认值为true。
455
+ visible?: boolean;
456
+ // 位置
457
+ position?: XYZ;
458
+ // 物体的局部旋转,以弧度来表示 new THREE.Euler( 0, 1, 1.57, 'XYZ' );
459
+ rotation?: XYZ;
460
+ // 对象是否被渲染到阴影贴图中。默认值为false
461
+ castShadow?: boolean;
462
+ // 材质是否接收阴影。默认值为false。
463
+ receiveShadow?: boolean;
464
+ // 物体的局部缩放。默认值是Vector3( 1, 1, 1 )
465
+ scale?: XYZ;
466
+ // 物体的层级关系。物体只有和一个正在使用的Camera至少在同一个层时才可见。当使用Raycaster进行射线检测的时候此项属性可以用于过滤不参与检测的物体
467
+ layers?: number;
468
+ // 局部变换矩阵
469
+ matrix: Matrix4;
470
+ // 这个属性由lookAt方法所使用,例如,来决定结果的朝向。 默认值是Object3D.DEFAULT_UP,即( 0, 1, 0 )。
471
+ up?: XYZ
472
+ uuid?: string;
473
+ }
474
+ /**
475
+ * 摄像机
476
+ */
477
+ export interface Camera extends Object3D {
478
+ // // 位置
479
+ // position: XYZ;
480
+ // // 旋转角度
481
+ // rotation: XYZ;
482
+ // 夹角
483
+ fov?: number;
484
+ // z轴距离, 深度
485
+ // depth: number;
486
+ // // 看向某个点,如果没有则不设置
487
+ // lookAt?: XYZ;
488
+ zoom?: number;
489
+ near?: number;
490
+ far?: number;
491
+ focus?: number;
492
+ aspect?: number;
493
+ filmGauge?: number;
494
+ filmOffset?: number;
495
+ }
496
+ /**
497
+ * 透视摄像机
498
+ */
499
+ export interface PerspectiveCamera extends Camera {
500
+ uuid?: string;
501
+ type: 'PerspectiveCamera';
502
+ // 摄像机视锥体垂直视野角度
503
+ fov?: number;
504
+ // 摄像机视锥体长宽比
505
+ aspect?: number;
506
+ // 摄像机视锥体近端面
507
+ near?: number;
508
+ // 摄像机视锥体远端面
509
+ far?: number;
510
+ // 用于立体视觉和景深效果的物体的距离。 这个参数不会影响摄像机的投影矩阵,除非使用了StereoCamera。 默认值是10
511
+ focus?: number;
512
+ // 胶片尺寸,其默认值为35(毫米)。 这个参数不会影响摄像机的投影矩阵,除非.filmOffset被设置为了一个非零的值
513
+ filmGauge?: number;
514
+ // 水平偏离中心偏移量,和.filmGauge单位相同。默认值为0
515
+ filmOffset?: number;
516
+ // 获取或者设置摄像机的缩放倍数,其默认值为1
517
+ zoom?: number;
518
+ }
519
+
520
+ export type TCamera = PerspectiveCamera
521
+ /**
522
+ * 光
523
+ */
524
+ export interface BaseLight extends Object3D {
525
+ // 颜色
526
+ color: string | number;
527
+ // 强度
528
+ intensity: number;
529
+ }
530
+ /**
531
+ * 光线阴影
532
+ */
533
+ export interface LightShadow {
534
+ autoUpdate?: boolean;
535
+ // 光的世界里。这用于生成场景的深度图;从光的角度来看,其他物体背后的物体将处于阴影中
536
+ camera?: TCamera;
537
+ // 阴影贴图偏差,在确定曲面是否在阴影中时,从标准化深度添加或减去多少。默认值为0.此处非常小的调整(大约0.0001)可能有助于减少阴影中的伪影
538
+ bias?: number;
539
+ // 将此值设置为大于1的值将模糊阴影的边缘。较高的值会在阴影中产生不必要的条带效果 - 更大的mapSize将允许在这些效果变得可见之前使用更高的值。
540
+ radius?: number;
541
+ }
542
+ /**
543
+ * 平行光
544
+ */
545
+ export interface DirectionalLight extends BaseLight {
546
+ // 类型
547
+ type: 'DirectionalLight';
548
+ // 阴影
549
+ shadow: LightShadow
550
+ }
551
+ /**
552
+ * 环境光
553
+ */
554
+ export interface AmbientLight extends BaseLight {
555
+ // 类型
556
+ type: 'AmbientLight';
557
+ }
558
+ /**
559
+ * 聚光灯
560
+ */
561
+ export interface SpotLight extends BaseLight {
562
+ // 类型
563
+ type: 'SpotLight';
564
+ name: string;
565
+ // 衰减值,默认为2
566
+ decay?: number;
567
+ // 光源照射的最大距离。默认值为 0(无限远)。
568
+ distance?: number;
569
+ // 聚光锥的半影衰减百分比。默认值为 0
570
+ penumbra?: number;
571
+ // angle - 光线照射范围的角度。默认值为 Math.PI/3
572
+ angle?: number;
573
+ shadow?: LightShadow;
574
+ target?: string;
575
+ }
576
+ /**
577
+ * 点光源
578
+ */
579
+ export interface PointLight extends BaseLight {
580
+ // 类型
581
+ type: 'PointLight';
582
+ // 衰减值,默认为2
583
+ decay?: number;
584
+ // 光源照射的最大距离。默认值为 0(无限远)。
585
+ distance?: number;
586
+ shadow?: LightShadow;
587
+ target?: string;
588
+ }
589
+ /**
590
+ * 平面光光源
591
+ */
592
+ export interface RectAreaLight extends BaseLight {
593
+ // 类型
594
+ type: 'RectAreaLight';
595
+ // 光源宽度
596
+ width: number;
597
+ // 光源高度
598
+ height: number;
599
+ // 光源的功率, 单位为流明(lm)
600
+ power?: number;
601
+ // 使用色温
602
+ useColorTemperature?: boolean;
603
+ // 色温值
604
+ colorTemperature?: number;
605
+ }
606
+ export interface HemisphereLight extends BaseLight {
607
+ // 类型
608
+ type: 'HemisphereLight';
609
+ // 一个表示颜色的 Color 的实例、字符串或数字,默认为一个白色(0xffffff)的 Color 对象
610
+ skyColor?: number;
611
+ // 一个表示颜色的 Color 的实例、字符串或数字,默认为一个白色(0xffffff)的 Color 对象
612
+ groundColor?: number;
613
+ }
614
+ /**
615
+ * 灯光
616
+ */
617
+ export type Light = AmbientLight | DirectionalLight | SpotLight | PointLight | RectAreaLight | HemisphereLight
618
+ // interface Light {
619
+ // directional?: DirectionalLight;
620
+ // ambient?: AmbientLight;
621
+ // spot?: SpotLight;
622
+ // point?: PointLight;
623
+ // }
624
+ /**
625
+ * 轨道控制器
626
+ */
627
+ export interface OrbitControl {
628
+ // 当设置为false时,控制器将不会响应用户的操作。默认值为true。
629
+ enabled?: boolean;
630
+ // 启用或禁用摄像机的缩放。默认值为true。
631
+ enableZoom?: boolean;
632
+ // 启用或禁用摄像机水平或垂直旋转。默认值为true。
633
+ enableRotate?: boolean;
634
+ // 启用或禁用摄像机平移,默认为true。
635
+ enablePan?: boolean;
636
+ // 你能够将相机向内移动多少(仅适用于PerspectiveCamera),其默认值为0。
637
+ minDistance?: number;
638
+ // 你能够将相机向外移动多少(仅适用于PerspectiveCamera),其默认值为Infinity。
639
+ maxDistance?: number;
640
+ // 你能够垂直旋转的角度的下限,范围是0到Math.PI,其默认值为0。
641
+ minPolarAngle?: number;
642
+ // 你能够垂直旋转的角度的上限,范围是0到Math.PI,其默认值为Math.PI。
643
+ maxPolarAngle?: number;
644
+ // 控制器的焦点,.object的轨道围绕它运行。 它可以在任何时候被手动更新,以更改控制器的焦点。
645
+ target?: XYZ;
646
+ // 是否使用轨道控制器
647
+ useOrbitControl?: boolean;
648
+ }
649
+ /**
650
+ * 背景
651
+ */
652
+ export interface Background {
653
+ // 背景图片或颜色值
654
+ bg: string;
655
+ }
656
+ }
657
+
658
+ }
659
+