@toolmain/components 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/dist/index.d.ts +722 -3
- package/dist/index.js +12398 -562
- package/package.json +9 -10
- package/readme.md +0 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Component } from 'vue';
|
|
2
2
|
import { ComponentOptionsMixin } from 'vue';
|
|
3
3
|
import { ComponentProvideOptions } from 'vue';
|
|
4
|
+
import { CSS2DObject } from 'three/addons';
|
|
4
5
|
import type * as CSS_2 from 'csstype';
|
|
5
6
|
import { DefineComponent } from 'vue';
|
|
7
|
+
import { Dexie } from 'dexie';
|
|
8
|
+
import { DialogProps } from 'element-plus';
|
|
9
|
+
import { EntityTable } from 'dexie';
|
|
10
|
+
import { EventBus as EventBus_2 } from '@toolmain/shared';
|
|
11
|
+
import { GLTF } from 'three/addons';
|
|
6
12
|
import type { MaybeRef } from 'vue';
|
|
13
|
+
import { OrbitControls } from 'three/addons';
|
|
14
|
+
import { PointerLockControls } from 'three/addons';
|
|
7
15
|
import { PublicProps } from 'vue';
|
|
8
|
-
import
|
|
16
|
+
import { Reactive } from 'vue';
|
|
17
|
+
import { RoundedBoxGeometry } from 'three/addons';
|
|
18
|
+
import { ShallowRef } from 'vue';
|
|
19
|
+
import { default as Stats_2 } from 'three/addons/libs/stats.module.js';
|
|
20
|
+
import { StoreDefinition } from 'pinia';
|
|
21
|
+
import * as THREE from 'three';
|
|
22
|
+
import { TransformControlsMode } from 'three/addons';
|
|
23
|
+
import { VNode } from 'vue';
|
|
24
|
+
import { VNodeProps } from 'vue';
|
|
9
25
|
|
|
10
26
|
declare const __VLS_component: DefineComponent<__VLS_Props, {
|
|
11
27
|
update: () => void;
|
|
@@ -29,6 +45,20 @@ onMaskClick?: (() => any) | undefined;
|
|
|
29
45
|
"onUpdate:modelValue"?: ((data: ScaleConfig) => any) | undefined;
|
|
30
46
|
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
31
47
|
|
|
48
|
+
declare const __VLS_component_3: DefineComponent<__VLS_Props_2, {
|
|
49
|
+
world: World;
|
|
50
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
51
|
+
loaded: (args_0: World) => any;
|
|
52
|
+
targetClick: (args_0: TargetData) => any;
|
|
53
|
+
}, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{
|
|
54
|
+
onLoaded?: ((args_0: World) => any) | undefined;
|
|
55
|
+
onTargetClick?: ((args_0: TargetData) => any) | undefined;
|
|
56
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
57
|
+
|
|
58
|
+
declare const __VLS_component_4: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
59
|
+
|
|
60
|
+
declare const __VLS_component_5: DefineComponent<__VLS_Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_3> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
61
|
+
|
|
32
62
|
declare type __VLS_Props = {
|
|
33
63
|
/**
|
|
34
64
|
* 选择top时,如果元素滚动到[底部]消失或即将消失,会回到原位置
|
|
@@ -40,6 +70,36 @@ declare type __VLS_Props = {
|
|
|
40
70
|
offset?: number;
|
|
41
71
|
};
|
|
42
72
|
|
|
73
|
+
declare type __VLS_Props_2 = {
|
|
74
|
+
/**
|
|
75
|
+
* if true, will add a panel for debugging. press `m` to toggle the panel
|
|
76
|
+
*/
|
|
77
|
+
debug?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* if you want to use draco decoder, must specify `dracoDecoderPath`
|
|
80
|
+
*
|
|
81
|
+
* 1. you can set the path with cdn url: `https://www.gstatic.com/draco/versioned/decoders/1.5.7/`
|
|
82
|
+
* 2. or copy the draco decoder files to your `/public/droc/gltf` directory, and set the value to `/droc/gltf`
|
|
83
|
+
*/
|
|
84
|
+
dracoDecoderPath?: string;
|
|
85
|
+
/**
|
|
86
|
+
* config for rendering models
|
|
87
|
+
*/
|
|
88
|
+
config: ThreePanelConf;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
declare type __VLS_Props_3 = {
|
|
92
|
+
text: string;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
declare type __VLS_Props_4 = {
|
|
96
|
+
modelValue?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* @description 如果为true,则在icon不可视时摧毁元素而不是隐藏透明度
|
|
99
|
+
*/
|
|
100
|
+
destroyIcon?: boolean;
|
|
101
|
+
};
|
|
102
|
+
|
|
43
103
|
declare type __VLS_Slots = {} & {
|
|
44
104
|
default?: (props: typeof __VLS_1) => any;
|
|
45
105
|
};
|
|
@@ -50,6 +110,22 @@ declare type __VLS_Slots_2 = {} & {
|
|
|
50
110
|
default?: (props: typeof __VLS_7) => any;
|
|
51
111
|
};
|
|
52
112
|
|
|
113
|
+
declare type __VLS_Slots_3 = {} & {
|
|
114
|
+
default?: (props: typeof __VLS_9) => any;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
declare type __VLS_Slots_4 = {} & {
|
|
118
|
+
header?: (props: typeof __VLS_8) => any;
|
|
119
|
+
} & {
|
|
120
|
+
default?: (props: typeof __VLS_15) => any;
|
|
121
|
+
} & {
|
|
122
|
+
footer?: (props: typeof __VLS_18) => any;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
declare type __VLS_Slots_5 = {} & {
|
|
126
|
+
default?: (props: typeof __VLS_10) => any;
|
|
127
|
+
};
|
|
128
|
+
|
|
53
129
|
declare type __VLS_WithSlots<T, S> = T & {
|
|
54
130
|
new (): {
|
|
55
131
|
$slots: S;
|
|
@@ -62,6 +138,29 @@ declare type __VLS_WithSlots_2<T, S> = T & {
|
|
|
62
138
|
};
|
|
63
139
|
};
|
|
64
140
|
|
|
141
|
+
declare type __VLS_WithSlots_3<T, S> = T & {
|
|
142
|
+
new (): {
|
|
143
|
+
$slots: S;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
declare type __VLS_WithSlots_4<T, S> = T & {
|
|
148
|
+
new (): {
|
|
149
|
+
$slots: S;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
declare type __VLS_WithSlots_5<T, S> = T & {
|
|
154
|
+
new (): {
|
|
155
|
+
$slots: S;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* anger to rad
|
|
161
|
+
*/
|
|
162
|
+
export declare function a2r(angle: number): number;
|
|
163
|
+
|
|
65
164
|
export declare const Affix: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
66
165
|
|
|
67
166
|
export declare type AnimateDir = "left" | "top" | "bottom" | "right" | "self" | "center" | {
|
|
@@ -71,6 +170,154 @@ export declare type AnimateDir = "left" | "top" | "bottom" | "right" | "self" |
|
|
|
71
170
|
|
|
72
171
|
declare type ArrMutKeys = "splice" | "push" | "pop" | "shift" | "unshift";
|
|
73
172
|
|
|
173
|
+
export declare class Bot {
|
|
174
|
+
box: THREE.Box3;
|
|
175
|
+
size: THREE.Vector3;
|
|
176
|
+
animateDuration: number;
|
|
177
|
+
model?: GLTF;
|
|
178
|
+
animations: THREE.AnimationClip[];
|
|
179
|
+
mixer: THREE.AnimationMixer | undefined;
|
|
180
|
+
skeleton: THREE.SkeletonHelper | undefined;
|
|
181
|
+
/**
|
|
182
|
+
* preset actions lists,in clude weight,name,and Action instance
|
|
183
|
+
*/
|
|
184
|
+
baseActions: BotAction[];
|
|
185
|
+
direction: THREE.Vector3;
|
|
186
|
+
move: {
|
|
187
|
+
forward: boolean;
|
|
188
|
+
backward: boolean;
|
|
189
|
+
left: boolean;
|
|
190
|
+
right: boolean;
|
|
191
|
+
speed: number;
|
|
192
|
+
jumpHeight: number;
|
|
193
|
+
canJump: boolean;
|
|
194
|
+
jumping: boolean;
|
|
195
|
+
status: string;
|
|
196
|
+
onFloor: boolean;
|
|
197
|
+
};
|
|
198
|
+
initPosition: THREE.Vector3;
|
|
199
|
+
readonly loader: Loader;
|
|
200
|
+
readonly core: Core;
|
|
201
|
+
readonly collider?: ReturnType<typeof useCollider>;
|
|
202
|
+
private currentAction?;
|
|
203
|
+
private uv;
|
|
204
|
+
private actionMap;
|
|
205
|
+
constructor(opts: BotOptions);
|
|
206
|
+
/**
|
|
207
|
+
* load bot
|
|
208
|
+
*/
|
|
209
|
+
load(gltfPath: string, conf?: LoadOptions): Promise<GLTF | null>;
|
|
210
|
+
/**
|
|
211
|
+
* teleport bot to a new position
|
|
212
|
+
*/
|
|
213
|
+
teleport(x: number, y: number, z: number): void;
|
|
214
|
+
update(delta: number): void;
|
|
215
|
+
once<K extends keyof BotEv>(event: K, callback: BotEv[K]): Bot;
|
|
216
|
+
on<K extends keyof BotEv>(event: K, callback: BotEv[K]): Bot;
|
|
217
|
+
emit<K extends keyof BotEv>(event: K, ...args: Parameters<BotEv[K]>): Bot;
|
|
218
|
+
run(): void;
|
|
219
|
+
walk(): void;
|
|
220
|
+
idle(): void;
|
|
221
|
+
dispose(): void;
|
|
222
|
+
private init;
|
|
223
|
+
private setWeight;
|
|
224
|
+
private _action;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export declare interface BotAction {
|
|
228
|
+
name: string;
|
|
229
|
+
action: THREE.AnimationAction;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export declare type BotActionMap = {
|
|
233
|
+
[key in BotActionName]: string;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export declare enum BotActionName {
|
|
237
|
+
IDLE = "idle",
|
|
238
|
+
RUN = "run",
|
|
239
|
+
WALK = "walk",
|
|
240
|
+
JUMP = "jump"
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export declare interface BotEv {
|
|
244
|
+
BotPos: (e: THREE.Vector3) => void;
|
|
245
|
+
BotLoaded: (model: THREE.Group<THREE.Object3DEventMap>) => void;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export declare interface BotOptions {
|
|
249
|
+
core: Core;
|
|
250
|
+
initPosition?: THREE.Vector3;
|
|
251
|
+
jumpHeight?: number;
|
|
252
|
+
speed?: number;
|
|
253
|
+
actionMap?: BotActionMap;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export declare type CameraConf = {
|
|
257
|
+
position: {
|
|
258
|
+
x: number;
|
|
259
|
+
y: number;
|
|
260
|
+
z: number;
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
export declare type ControlConf = {
|
|
265
|
+
target: {
|
|
266
|
+
x: number;
|
|
267
|
+
y: number;
|
|
268
|
+
z: number;
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export declare const Copy: __VLS_WithSlots_5<typeof __VLS_component_5, __VLS_Slots_5>;
|
|
273
|
+
|
|
274
|
+
export declare class Core {
|
|
275
|
+
#private;
|
|
276
|
+
scene: THREE.Scene;
|
|
277
|
+
camera: THREE.PerspectiveCamera;
|
|
278
|
+
renderer: THREE.WebGLRenderer;
|
|
279
|
+
db: Dexie & {
|
|
280
|
+
model: EntityTable< {
|
|
281
|
+
id: string;
|
|
282
|
+
url: string;
|
|
283
|
+
data: Blob;
|
|
284
|
+
}, "id">;
|
|
285
|
+
config: EntityTable< {
|
|
286
|
+
id: string;
|
|
287
|
+
url: string;
|
|
288
|
+
data: Record<string, unknown>;
|
|
289
|
+
}, "id">;
|
|
290
|
+
};
|
|
291
|
+
stats: Stats_2;
|
|
292
|
+
clock: THREE.Clock;
|
|
293
|
+
raycaster: THREE.Raycaster;
|
|
294
|
+
orbitCtrls: OrbitControls;
|
|
295
|
+
keyboard: {
|
|
296
|
+
ev: EventBus<{
|
|
297
|
+
[x: string]: any;
|
|
298
|
+
}>;
|
|
299
|
+
init: () => void;
|
|
300
|
+
dispose: () => void;
|
|
301
|
+
};
|
|
302
|
+
container: El;
|
|
303
|
+
loader: Loader;
|
|
304
|
+
world: World;
|
|
305
|
+
constructor();
|
|
306
|
+
init(el: HTMLElement): void;
|
|
307
|
+
once<K extends keyof ThreeEv>(event: K, callback: ThreeEv[K]): Core;
|
|
308
|
+
on<K extends keyof ThreeEv>(event: K, callback: ThreeEv[K]): Core;
|
|
309
|
+
emit<K extends keyof ThreeEv>(event: K, ...args: Parameters<ThreeEv[K]>): Core;
|
|
310
|
+
render(): void;
|
|
311
|
+
dispose(): void;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export declare interface CSS2DObjectOptions {
|
|
315
|
+
id: string;
|
|
316
|
+
el: HTMLElement;
|
|
317
|
+
target: CSS2DObject;
|
|
318
|
+
container: THREE.Mesh;
|
|
319
|
+
}
|
|
320
|
+
|
|
74
321
|
/**
|
|
75
322
|
* CSS Properties
|
|
76
323
|
*/
|
|
@@ -78,6 +325,27 @@ declare interface CSSProperties extends CSS_2.Properties<string | number>, CSS_2
|
|
|
78
325
|
[v: `--${string}`]: string | number | undefined;
|
|
79
326
|
}
|
|
80
327
|
|
|
328
|
+
export declare const db: Dexie & {
|
|
329
|
+
model: EntityTable<{
|
|
330
|
+
id: string;
|
|
331
|
+
url: string;
|
|
332
|
+
data: Blob;
|
|
333
|
+
}, "id">;
|
|
334
|
+
config: EntityTable<{
|
|
335
|
+
id: string;
|
|
336
|
+
url: string;
|
|
337
|
+
data: Record<string, unknown>;
|
|
338
|
+
}, "id">;
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
declare interface DebugPanel {
|
|
342
|
+
id: string;
|
|
343
|
+
label: string;
|
|
344
|
+
node: VNode | Component | string;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export declare const DialogPanel: __VLS_WithSlots_4<typeof __VLS_component_4, __VLS_Slots_4>;
|
|
348
|
+
|
|
81
349
|
declare type Dir = "horizontal" | "vertical" | "any";
|
|
82
350
|
|
|
83
351
|
declare interface DragAttr {
|
|
@@ -132,6 +400,52 @@ export declare interface DragOffset {
|
|
|
132
400
|
scale: FixedArray<number, 2>;
|
|
133
401
|
}
|
|
134
402
|
|
|
403
|
+
export declare class El {
|
|
404
|
+
el: HTMLElement;
|
|
405
|
+
constructor(element?: HTMLElement | null);
|
|
406
|
+
setEl(el: HTMLElement): void;
|
|
407
|
+
getEl(): HTMLElement;
|
|
408
|
+
size(): ElRect;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export declare interface ElRect {
|
|
412
|
+
width: number;
|
|
413
|
+
height: number;
|
|
414
|
+
left: number;
|
|
415
|
+
top: number;
|
|
416
|
+
right: number;
|
|
417
|
+
bottom: number;
|
|
418
|
+
x: number;
|
|
419
|
+
y: number;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* @description changed origin: https://github.com/browserify/events
|
|
424
|
+
*/
|
|
425
|
+
declare interface EventBus<T extends Record<string, any>> {
|
|
426
|
+
setMaxListeners(n: number): void;
|
|
427
|
+
addListener<K extends keyof T>(type: K, listener: T[K]): void;
|
|
428
|
+
removeAllListeners<K extends keyof T>(type?: K): void;
|
|
429
|
+
removeListener<K extends keyof T>(type: K, listener: T[K]): void;
|
|
430
|
+
prependListener<K extends keyof T>(type: K, listener: T[K]): void;
|
|
431
|
+
emit<K extends keyof T>(type: K, ...args: Parameters<T[K]>): void;
|
|
432
|
+
/**
|
|
433
|
+
* addListener
|
|
434
|
+
*/
|
|
435
|
+
on<K extends keyof T>(type: K, listener: T[K]): void;
|
|
436
|
+
/**
|
|
437
|
+
* removeListener
|
|
438
|
+
*/
|
|
439
|
+
off<K extends keyof T>(type: K, listener: T[K]): void;
|
|
440
|
+
once<K extends keyof T>(type: K, listener: T[K]): void;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export declare function fetchRemote(url: string, onProgress?: (progress: LoadProgressData) => void): Promise<{
|
|
444
|
+
code: number;
|
|
445
|
+
msg: string;
|
|
446
|
+
data?: Blob;
|
|
447
|
+
}>;
|
|
448
|
+
|
|
135
449
|
/**
|
|
136
450
|
* 定长数组类型
|
|
137
451
|
*/
|
|
@@ -139,8 +453,156 @@ declare type FixedArray<T, L extends number> = Pick<T[], Exclude<keyof T[], ArrM
|
|
|
139
453
|
readonly length: L;
|
|
140
454
|
};
|
|
141
455
|
|
|
456
|
+
export declare function getModel(url: string, onProgress?: (progress: LoadProgressData) => void): Promise<{
|
|
457
|
+
code: number;
|
|
458
|
+
msg: string;
|
|
459
|
+
data?: Blob;
|
|
460
|
+
}>;
|
|
461
|
+
|
|
462
|
+
export declare function gradientColor(startColorHex: string, endColorHex: string, step: number): Array<string>;
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* translate hex color to rgb color array
|
|
466
|
+
*/
|
|
467
|
+
export declare function hex2rgb(sColor: string): Array<number>;
|
|
468
|
+
|
|
142
469
|
declare type InitType = "auto" | "inherit" | "initial" | "unset";
|
|
143
470
|
|
|
471
|
+
export declare enum KeyCode {
|
|
472
|
+
init = "KEYBOARD:INIT",
|
|
473
|
+
keydown = "KEYBOARD:KEYDOWN",
|
|
474
|
+
keyup = "KEYBOARD:KEYUP",
|
|
475
|
+
keyStatus = "KEYBOARD:KEYSTATUS",
|
|
476
|
+
KeyWA = "KeyWA",
|
|
477
|
+
KeyWD = "KeyWD",
|
|
478
|
+
KeyAS = "KeyAS",
|
|
479
|
+
KeySD = "KeySD",
|
|
480
|
+
ShiftLeft = "ShiftLeft",
|
|
481
|
+
Space = "Space",
|
|
482
|
+
KeyW = "KeyW",
|
|
483
|
+
KeyA = "KeyA",
|
|
484
|
+
KeyS = "KeyS",
|
|
485
|
+
KeyD = "KeyD",
|
|
486
|
+
ArrowLeft = "ArrowLeft",
|
|
487
|
+
ArrowRight = "ArrowRight",
|
|
488
|
+
ArrowUp = "ArrowUp",
|
|
489
|
+
ArrowDown = "ArrowDown"
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export declare interface LightMeta {
|
|
493
|
+
/**
|
|
494
|
+
* unique id is required
|
|
495
|
+
*/
|
|
496
|
+
id: string;
|
|
497
|
+
type: LightType | string;
|
|
498
|
+
color: string | THREE.Color;
|
|
499
|
+
groundColor?: string | THREE.Color;
|
|
500
|
+
/**
|
|
501
|
+
* light helper will be created, this field control it's visibility
|
|
502
|
+
*/
|
|
503
|
+
helper?: boolean;
|
|
504
|
+
helperColor?: string;
|
|
505
|
+
helperSize?: number;
|
|
506
|
+
visible?: boolean;
|
|
507
|
+
position?: {
|
|
508
|
+
x: number;
|
|
509
|
+
y: number;
|
|
510
|
+
z: number;
|
|
511
|
+
};
|
|
512
|
+
rotate?: {
|
|
513
|
+
x: number;
|
|
514
|
+
y: number;
|
|
515
|
+
z: number;
|
|
516
|
+
};
|
|
517
|
+
name?: string;
|
|
518
|
+
intensity?: number;
|
|
519
|
+
distance?: number;
|
|
520
|
+
angle?: number;
|
|
521
|
+
castShadow?: boolean;
|
|
522
|
+
penumbra?: number;
|
|
523
|
+
decay?: number;
|
|
524
|
+
/**
|
|
525
|
+
* if need TransformControls
|
|
526
|
+
*/
|
|
527
|
+
debugger?: boolean;
|
|
528
|
+
/**
|
|
529
|
+
* debugger mode
|
|
530
|
+
*/
|
|
531
|
+
mode?: TransformControlsMode;
|
|
532
|
+
[x: string]: any;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
export declare class Lights {
|
|
536
|
+
#private;
|
|
537
|
+
ev: EventBus<any>;
|
|
538
|
+
constructor(core: Core);
|
|
539
|
+
update(meta: LightMeta): void;
|
|
540
|
+
add(meta: LightMeta): void;
|
|
541
|
+
clear(id: string): void;
|
|
542
|
+
dispose(): void;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
export declare enum LightsEvent {
|
|
546
|
+
ObjectChange = "objectChange",
|
|
547
|
+
ObjectAdd = "objectAdd",
|
|
548
|
+
ObjectRemove = "objectRemove"
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
export declare enum LightType {
|
|
552
|
+
PointLight = "PointLight",
|
|
553
|
+
DirectionalLight = "DirectionalLight",
|
|
554
|
+
SpotLight = "SpotLight",
|
|
555
|
+
AmbientLight = "AmbientLight",
|
|
556
|
+
HemisphereLight = "HemisphereLight"
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
export declare class Loader {
|
|
560
|
+
#private;
|
|
561
|
+
private manager;
|
|
562
|
+
data: Record<string, LoadParam>;
|
|
563
|
+
private uv;
|
|
564
|
+
constructor(config?: LoaderConfig);
|
|
565
|
+
private init;
|
|
566
|
+
on<K extends keyof LoaderEvent>(event: K, callback: LoaderEvent[K]): Loader;
|
|
567
|
+
emit<K extends keyof LoaderEvent>(event: K, ...args: Parameters<LoaderEvent[K]>): Loader;
|
|
568
|
+
onProgress(url: string, loaded: number, total: number): void;
|
|
569
|
+
onStart(url: string, loaded: number, total: number): void;
|
|
570
|
+
onLoaded(): void;
|
|
571
|
+
onError(url: string): void;
|
|
572
|
+
load<T>(path: string, conf?: LoadOptions): Promise<T | null>;
|
|
573
|
+
loadGLTF(path: string, conf?: LoadOptions): Promise<GLTF | null>;
|
|
574
|
+
loadFBX(path: string, conf?: LoadOptions): Promise<THREE.Group<THREE.Object3DEventMap> | null>;
|
|
575
|
+
dispose(): void;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
export declare type LoaderConfig = {
|
|
579
|
+
dracoLoaderPath?: string;
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
export declare type LoaderEvent = Pick<ThreeEv, "LoadError" | "LoadProgress" | "LoadStart" | "Loaded" | "Log" | "Custom">;
|
|
583
|
+
|
|
584
|
+
export declare interface LoadOptions {
|
|
585
|
+
/**
|
|
586
|
+
* mark the loading progress bar is independent
|
|
587
|
+
*/
|
|
588
|
+
independent?: boolean;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
export declare type LoadParam = LoadProgressData & LoadOptions;
|
|
592
|
+
|
|
593
|
+
export declare interface LoadProgressData {
|
|
594
|
+
url: string;
|
|
595
|
+
/**
|
|
596
|
+
* loaded resources' number
|
|
597
|
+
*/
|
|
598
|
+
loaded: number;
|
|
599
|
+
/**
|
|
600
|
+
* total resources' number
|
|
601
|
+
*/
|
|
602
|
+
total: number;
|
|
603
|
+
describe?: string;
|
|
604
|
+
}
|
|
605
|
+
|
|
144
606
|
export declare interface MoveHook {
|
|
145
607
|
x?: (oldVal: number, newVal: number, width: number, height: number) => number;
|
|
146
608
|
y?: (oldVal: number, newVal: number, width: number, height: number) => number;
|
|
@@ -159,7 +621,46 @@ export declare type MoveParams = DragAttr & {
|
|
|
159
621
|
translateY: number;
|
|
160
622
|
};
|
|
161
623
|
|
|
162
|
-
export declare const ParentView: DefineComponent< {},
|
|
624
|
+
export declare const ParentView: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* rad to anger
|
|
628
|
+
*/
|
|
629
|
+
export declare function r2a(radian: number): number;
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* 远程资源,贴图,视频等
|
|
633
|
+
*/
|
|
634
|
+
export declare interface RemoteSrc {
|
|
635
|
+
/**
|
|
636
|
+
* resource type
|
|
637
|
+
*
|
|
638
|
+
* 1:image 2:video 3:link 4:color 5:api
|
|
639
|
+
*/
|
|
640
|
+
sourceType: number;
|
|
641
|
+
objectName: string;
|
|
642
|
+
/**
|
|
643
|
+
* color will be used as texture
|
|
644
|
+
*/
|
|
645
|
+
color?: string;
|
|
646
|
+
/**
|
|
647
|
+
* image/video address
|
|
648
|
+
*/
|
|
649
|
+
fileUrl?: string;
|
|
650
|
+
/**
|
|
651
|
+
* other resource except image/video
|
|
652
|
+
*/
|
|
653
|
+
content?: string;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
export declare type RendererConf = {
|
|
657
|
+
clearColor: string;
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* tranlate rgb color to hex string
|
|
662
|
+
*/
|
|
663
|
+
export declare function rgb2Hex(rgb: string): string;
|
|
163
664
|
|
|
164
665
|
export declare interface ScaleConfig {
|
|
165
666
|
/**
|
|
@@ -277,9 +778,227 @@ export declare interface ScaleProps {
|
|
|
277
778
|
dragTarget?: MaybeRef<HTMLElement | null | undefined>;
|
|
278
779
|
}
|
|
279
780
|
|
|
781
|
+
export declare class Scene {
|
|
782
|
+
model?: GLTF;
|
|
783
|
+
remoteResources: Record<string, RemoteSrc>;
|
|
784
|
+
bvh?: THREE.Mesh;
|
|
785
|
+
remoteTarget: Record<string, TargetSrc>;
|
|
786
|
+
/**
|
|
787
|
+
* when true,emit the `RendererClick` event
|
|
788
|
+
*/
|
|
789
|
+
clickNotify: boolean;
|
|
790
|
+
private blobUrls;
|
|
791
|
+
readonly loader: Loader;
|
|
792
|
+
private core;
|
|
793
|
+
constructor(core: Core, loaderConfig?: LoaderConfig);
|
|
794
|
+
private createVideo;
|
|
795
|
+
/**
|
|
796
|
+
* set texture
|
|
797
|
+
*/
|
|
798
|
+
setRemoteTexture(src: RemoteSrc): void;
|
|
799
|
+
/**
|
|
800
|
+
* set a anchor of an object, when click the object,the corresponding event will be triggered
|
|
801
|
+
*/
|
|
802
|
+
setRemoteTarget(src: TargetSrc[] | TargetSrc): void;
|
|
803
|
+
load(gltfPath: string, conf?: LoadOptions): Promise<GLTF | undefined>;
|
|
804
|
+
setClickNotify(val?: boolean): void;
|
|
805
|
+
dispose(): void;
|
|
806
|
+
private disposeModel;
|
|
807
|
+
private clearBlob;
|
|
808
|
+
private init;
|
|
809
|
+
/**
|
|
810
|
+
* emit click event for debug
|
|
811
|
+
*/
|
|
812
|
+
private onEmitClick;
|
|
813
|
+
private onTargetClick;
|
|
814
|
+
private initSceneInteraction;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
export declare const Spinner: DefineComponent<__VLS_Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
818
|
+
"update:modelValue": (value: boolean) => any;
|
|
819
|
+
}, string, PublicProps, Readonly<__VLS_Props_4> & Readonly<{
|
|
820
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
821
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
822
|
+
|
|
280
823
|
declare enum Status {
|
|
281
824
|
NORMAL = "NORMAL",
|
|
282
825
|
HIDDEN = "HIDDEN"
|
|
283
826
|
}
|
|
284
827
|
|
|
828
|
+
export declare type TargetData = {
|
|
829
|
+
type: "TargetSrc";
|
|
830
|
+
data: TargetSrc;
|
|
831
|
+
} | {
|
|
832
|
+
type: "RemoteSrc";
|
|
833
|
+
data: RemoteSrc;
|
|
834
|
+
} | {
|
|
835
|
+
type: "Object";
|
|
836
|
+
data: THREE.Object3D<THREE.Object3DEventMap>;
|
|
837
|
+
};
|
|
838
|
+
|
|
839
|
+
export declare interface TargetSrc {
|
|
840
|
+
objectName: string;
|
|
841
|
+
data: Record<string, any>;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
export declare interface ThreeEv {
|
|
845
|
+
/**
|
|
846
|
+
* OrbitControl trigger `change` event
|
|
847
|
+
*/
|
|
848
|
+
OrbitChanged: (e: THREE.Event<"change", OrbitControls>) => void;
|
|
849
|
+
/**
|
|
850
|
+
* PointerLockControls trigger `lock` event
|
|
851
|
+
*/
|
|
852
|
+
PointerLock: (e: THREE.Event<"lock", PointerLockControls>) => void;
|
|
853
|
+
/**
|
|
854
|
+
* PointerLockControls trigger `unlock` event
|
|
855
|
+
*/
|
|
856
|
+
PointerUnlock: (e: THREE.Event<"unlock", PointerLockControls>) => void;
|
|
857
|
+
/**
|
|
858
|
+
* triggered before each render loop
|
|
859
|
+
*/
|
|
860
|
+
Render: (delta: number) => void;
|
|
861
|
+
RendererClick: (mouse: THREE.Vector2, intersects: THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>>[]) => void;
|
|
862
|
+
/**
|
|
863
|
+
* triggered when window resize
|
|
864
|
+
*/
|
|
865
|
+
Resize: () => void;
|
|
866
|
+
/**
|
|
867
|
+
* scene and renderer resources will be disposed
|
|
868
|
+
*/
|
|
869
|
+
Dispose: () => void;
|
|
870
|
+
/**
|
|
871
|
+
* global resource loading progress
|
|
872
|
+
*/
|
|
873
|
+
LoadStart: (e: LoadParam) => void;
|
|
874
|
+
/**
|
|
875
|
+
* global resource loading progress
|
|
876
|
+
*/
|
|
877
|
+
LoadProgress: (e: LoadParam) => void;
|
|
878
|
+
/**
|
|
879
|
+
* global resource loading progress
|
|
880
|
+
*/
|
|
881
|
+
Loaded: () => void;
|
|
882
|
+
/**
|
|
883
|
+
* global resource loading progress
|
|
884
|
+
*/
|
|
885
|
+
LoadError: (url: string) => void;
|
|
886
|
+
/**
|
|
887
|
+
* log event
|
|
888
|
+
*/
|
|
889
|
+
Log: (msg: {
|
|
890
|
+
code: number;
|
|
891
|
+
msg: string;
|
|
892
|
+
data?: {
|
|
893
|
+
type?: string;
|
|
894
|
+
data?: unknown;
|
|
895
|
+
};
|
|
896
|
+
}) => void;
|
|
897
|
+
/**
|
|
898
|
+
* camera params update
|
|
899
|
+
*/
|
|
900
|
+
CameraUpdate: (e: {
|
|
901
|
+
position: {
|
|
902
|
+
x: number;
|
|
903
|
+
y: number;
|
|
904
|
+
z: number;
|
|
905
|
+
};
|
|
906
|
+
fov?: number;
|
|
907
|
+
aspect?: number;
|
|
908
|
+
near?: number;
|
|
909
|
+
far?: number;
|
|
910
|
+
}) => void;
|
|
911
|
+
/**
|
|
912
|
+
* custom event for eventbus
|
|
913
|
+
*/
|
|
914
|
+
Custom: (e: {
|
|
915
|
+
type: string;
|
|
916
|
+
data?: unknown;
|
|
917
|
+
}) => void;
|
|
918
|
+
/**
|
|
919
|
+
* when click the specified object
|
|
920
|
+
*/
|
|
921
|
+
TargetClick: (e: TargetData) => void;
|
|
922
|
+
/**
|
|
923
|
+
* 场景加载完毕
|
|
924
|
+
*/
|
|
925
|
+
SceneLoaded: () => void;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
export declare const ThreePanel: __VLS_WithSlots_3<typeof __VLS_component_3, __VLS_Slots_3>;
|
|
929
|
+
|
|
930
|
+
export declare type ThreePanelConf = {
|
|
931
|
+
url?: string;
|
|
932
|
+
control: ControlConf;
|
|
933
|
+
camera: CameraConf;
|
|
934
|
+
renderer: RendererConf;
|
|
935
|
+
lights: Array<LightMeta>;
|
|
936
|
+
};
|
|
937
|
+
|
|
938
|
+
export declare function useCollider(bot: Bot): {
|
|
939
|
+
teleport: (x: number, y: number, z: number) => void;
|
|
940
|
+
getPlayer: () => THREE.Mesh<RoundedBoxGeometry, THREE.MeshStandardMaterial, THREE.Object3DEventMap>;
|
|
941
|
+
update: (delta: number) => void;
|
|
942
|
+
init: () => void;
|
|
943
|
+
jump: () => void;
|
|
944
|
+
reset: () => void;
|
|
945
|
+
getCapsule: () => {
|
|
946
|
+
radius: number;
|
|
947
|
+
segment: THREE.Line3;
|
|
948
|
+
};
|
|
949
|
+
getTempBoxHelper: () => THREE.Box3Helper;
|
|
950
|
+
getGravity: () => number;
|
|
951
|
+
setGravity: (value: number) => void;
|
|
952
|
+
setCapsule: (raduis: number, start: THREE.Vector3Like, end: THREE.Vector3Like) => void;
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
export declare const useCSS2DRenderer: () => {
|
|
956
|
+
init: (globalWorld: World) => void;
|
|
957
|
+
createCube: () => THREE.Mesh<THREE.BoxGeometry, THREE.MeshBasicMaterial, THREE.Object3DEventMap>;
|
|
958
|
+
add: (id: string, el: HTMLElement, callback?: (delta: number, el: HTMLElement, target: CSS2DObject, container: THREE.Mesh) => void) => void;
|
|
959
|
+
remove: (id: string) => void;
|
|
960
|
+
dispose: () => void;
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* 动态增加debugger 面板
|
|
965
|
+
*/
|
|
966
|
+
export declare const useDebugger: StoreDefinition<"use-debugger", Pick<{
|
|
967
|
+
panels: Reactive<DebugPanel[]>;
|
|
968
|
+
addPanel: (conf: DebugPanel) => void;
|
|
969
|
+
}, "panels">, Pick<{
|
|
970
|
+
panels: Reactive<DebugPanel[]>;
|
|
971
|
+
addPanel: (conf: DebugPanel) => void;
|
|
972
|
+
}, never>, Pick<{
|
|
973
|
+
panels: Reactive<DebugPanel[]>;
|
|
974
|
+
addPanel: (conf: DebugPanel) => void;
|
|
975
|
+
}, "addPanel">>;
|
|
976
|
+
|
|
977
|
+
export declare function (preset?: Partial<Writable<DialogProps>>): any;
|
|
978
|
+
|
|
979
|
+
export declare const useElement: <T extends Record<string, unknown> & VNodeProps>(node?: VNode) => {
|
|
980
|
+
el: ShallowRef<HTMLElement, HTMLElement>;
|
|
981
|
+
update: (node: VNode, prop?: T) => void;
|
|
982
|
+
updateProps: (prop: T) => void;
|
|
983
|
+
};
|
|
984
|
+
|
|
985
|
+
export declare function useKeyboard(): {
|
|
986
|
+
ev: EventBus_2< {
|
|
987
|
+
[x: string]: any;
|
|
988
|
+
}>;
|
|
989
|
+
init: () => void;
|
|
990
|
+
dispose: () => void;
|
|
991
|
+
};
|
|
992
|
+
|
|
993
|
+
export declare interface World {
|
|
994
|
+
core: Core;
|
|
995
|
+
bot: Bot | null;
|
|
996
|
+
scene: Scene | null;
|
|
997
|
+
lights: Lights | null;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
declare type Writable<T> = {
|
|
1001
|
+
-readonly [K in keyof T]: T[K];
|
|
1002
|
+
};
|
|
1003
|
+
|
|
285
1004
|
export { }
|