@web-ar-studio/webar-engine-sdk 1.0.9 → 1.0.10

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/dist/index.d.ts CHANGED
@@ -1,261 +1,302 @@
1
- declare const PROJECT_MODE_QR = "QR";
2
- declare const PROJECT_MODE_IMAGE = "IMAGE";
3
- declare const PROJECT_MODE_SLAM_3DOF = "SLAM_3DOF";
4
- declare const PROJECT_MODE_FACE = "FACE";
5
- declare const PROJECT_MODE_MIX = "MIX";
6
- declare const TRIGGER_MODE_QR = "QR";
7
- declare const TRIGGER_MODE_IMAGE = "IMAGE";
8
- declare const TRIGGER_MODE_FACE = "FACE";
9
- declare const EVENT_DETECTED = "detected";
10
- declare const EVENT_LOST = "lost";
11
- declare const EVENT_POSE = "pose";
12
- declare const EVENT_PROCESS = "process";
13
- declare const EVENT_RESIZE = "resize";
14
- declare const EVENT_DEVICE_ORIENTATION = "deviceorientation";
15
- declare const EVENT_SCREEN_ORIENTATION = "change";
16
- declare const EVENT_VISIBILITY = "visibilitychange";
17
- declare const EVENT_FRAME = "frame";
18
- declare const DATA_ERROR = "DataError";
19
- declare const EVENT_ERROR = "EventError";
20
- declare const GL_ERROR = "GlError";
21
- declare const WORKER_ERROR = "WorkerError";
22
- declare const HTML_ERROR = "HTMLError";
23
- declare const DEVICE_ERROR = "DeviceError";
24
- declare const VIDEO_ERROR = "VideoError";
25
- declare const ANCHOR_TYPE_BOTTOM_LEFT = "bottomLeft";
26
- declare const ANCHOR_TYPE_BOTTOM_RIGHT = "bottomRight";
27
- declare const ANCHOR_TYPE_TOP_LEFT = "topLeft";
28
- declare const ANCHOR_TYPE_TOP_RIGHT = "topRight";
29
- declare const ANCHOR_TYPE_CENTER = "center";
30
- declare const ANCHOR_TYPE_ORIGIN = "origin";
31
- declare const ANCHOR_TYPE_LEFT_EYEBROW = 283;
32
- declare const ANCHOR_TYPE_RIGHT_EYEBROW = 53;
33
- declare const ANCHOR_TYPE_LEFT_EAR = 356;
34
- declare const ANCHOR_TYPE_RIGHT_EAR = 127;
35
- declare const ANCHOR_TYPE_LEFT_EYE = 374;
36
- declare const ANCHOR_TYPE_RIGHT_EYE = 145;
37
- declare const ANCHOR_TYPE_NOSE_BRIDGE = 6;
38
- declare const ANCHOR_TYPE_NOSE_TIP = 4;
39
- declare const ANCHOR_TYPE_NOSE_BASE = 2;
40
- declare const ANCHOR_TYPE_BOTTOM_LIP = 14;
41
- declare const ANCHOR_TYPE_CHIN = 199;
42
-
43
- type TTriggerMode = typeof TRIGGER_MODE_QR | typeof TRIGGER_MODE_IMAGE | typeof TRIGGER_MODE_FACE;
44
-
45
- type TTrigger = {
46
- id: number;
47
- mode: TTriggerMode;
48
- } & ({
49
- mode: typeof TRIGGER_MODE_FACE;
50
- source: null;
51
- } | {
52
- mode: Exclude<TTriggerMode, typeof TRIGGER_MODE_FACE>;
53
- source: string;
54
- });
55
-
56
- type TProjectMode = typeof PROJECT_MODE_QR | typeof PROJECT_MODE_IMAGE | typeof PROJECT_MODE_SLAM_3DOF | typeof PROJECT_MODE_FACE | typeof PROJECT_MODE_MIX;
57
-
58
- type TAnchorType = typeof ANCHOR_TYPE_BOTTOM_LEFT | typeof ANCHOR_TYPE_BOTTOM_RIGHT | typeof ANCHOR_TYPE_TOP_LEFT | typeof ANCHOR_TYPE_TOP_RIGHT | typeof ANCHOR_TYPE_CENTER;
59
-
60
- type TAnchorFaceType = typeof ANCHOR_TYPE_ORIGIN | typeof ANCHOR_TYPE_LEFT_EYEBROW | typeof ANCHOR_TYPE_RIGHT_EYEBROW | typeof ANCHOR_TYPE_LEFT_EAR | typeof ANCHOR_TYPE_RIGHT_EAR | typeof ANCHOR_TYPE_LEFT_EYE | typeof ANCHOR_TYPE_RIGHT_EYE | typeof ANCHOR_TYPE_NOSE_BRIDGE | typeof ANCHOR_TYPE_NOSE_TIP | typeof ANCHOR_TYPE_NOSE_BASE | typeof ANCHOR_TYPE_BOTTOM_LIP | typeof ANCHOR_TYPE_CHIN;
61
-
62
- type TConfigData = {
63
- apiKey: string;
64
- mode: TProjectMode;
65
- container: Element;
66
- } & ({
67
- mode: typeof PROJECT_MODE_SLAM_3DOF;
68
- fov?: never;
69
- near?: never;
70
- far?: never;
71
- triggers?: never;
72
- isMultiTracking?: never;
73
- anchor?: never;
74
- } | {
75
- mode: typeof PROJECT_MODE_FACE;
76
- fov: number;
77
- near: number;
78
- far: number;
79
- triggers: TTrigger[];
80
- isMultiTracking?: never;
81
- anchor?: TAnchorFaceType;
82
- } | {
83
- mode: Exclude<TProjectMode, typeof PROJECT_MODE_SLAM_3DOF | typeof PROJECT_MODE_FACE>;
84
- fov: number;
85
- near?: never;
86
- far?: never;
87
- triggers: TTrigger[];
88
- isMultiTracking: boolean;
89
- anchor: TAnchorType;
90
- });
91
-
92
- type TEventWASType = typeof EVENT_DETECTED | typeof EVENT_LOST | typeof EVENT_POSE | typeof EVENT_PROCESS | typeof EVENT_RESIZE | typeof EVENT_DEVICE_ORIENTATION | typeof EVENT_SCREEN_ORIENTATION | typeof EVENT_VISIBILITY | typeof EVENT_FRAME;
93
-
94
- type TVector = {
95
- x: number;
96
- y: number;
97
- z: number;
98
- };
99
-
100
- type TQuaternion = {
101
- x: number;
102
- y: number;
103
- z: number;
104
- w: number;
105
- };
106
-
107
- type TEventDetectedData = {
108
- triggerId: number;
109
- positionVector: TVector;
110
- rotationQuaternion: TQuaternion;
111
- scaleVector: TVector;
112
- landmarksData?: TVector[];
113
- };
114
-
115
- type TEventLostData = {
116
- triggerId: number;
117
- positionVector: TVector;
118
- rotationQuaternion: TQuaternion;
119
- scaleVector: TVector;
120
- landmarksData?: TVector[];
121
- };
122
-
123
- type TEventPoseData = {
124
- triggerId: number;
125
- positionVector: TVector;
126
- rotationQuaternion: TQuaternion;
127
- scaleVector: TVector;
128
- landmarksData?: TVector[];
129
- };
130
-
131
- type TEventWASCallBack = {
132
- (detectedData: TEventDetectedData[]): void;
133
- (lostData: TEventLostData[]): void;
134
- (poseData: TEventPoseData[]): void;
135
- (isProcess: boolean): void;
136
- (event: UIEvent): void;
137
- (event: DeviceOrientationEvent): void;
138
- (angle: number): void;
139
- (isVisible: boolean): void;
140
- (deltaTime: number): void;
141
- };
142
-
143
- type TEventType = typeof EVENT_DETECTED | typeof EVENT_LOST | typeof EVENT_POSE | typeof EVENT_PROCESS | typeof EVENT_RESIZE | typeof EVENT_DEVICE_ORIENTATION | typeof EVENT_SCREEN_ORIENTATION | typeof EVENT_VISIBILITY | typeof EVENT_FRAME;
144
-
145
- type TViewportSizes = {
146
- width: number;
147
- height: number;
148
- };
149
-
150
- type TWAS = {
151
- canvas: HTMLCanvasElement;
152
- context: WebGL2RenderingContext | WebGLRenderingContext | null;
153
- videoCanvas: HTMLCanvasElement;
154
- viewportSizes: TViewportSizes;
155
- };
156
-
157
- type TTriggerSize = {
158
- id: number;
159
- width: number;
160
- height: number;
161
- };
162
-
163
- interface IWAS {
164
- init(configData: TConfigData): Promise<TWAS>;
165
- on(type: TEventWASType, callBack: TEventWASCallBack): Promise<void>;
166
- un(type: TEventType): Promise<void>;
167
- dispose(): Promise<void>;
168
- setMediaStream(): Promise<void>;
169
- getTriggerSize(triggerId: number): TTriggerSize | undefined;
170
- getTriggerScale(triggerId: number): TVector | undefined;
171
- getViewportSizes(): TViewportSizes;
172
- getFaceMeshTriangulation(): Uint16Array;
173
- getFaceMeshTriangulationFillMouth(): Uint16Array;
174
- getFaceMeshTriangulationFillEyes(): Uint16Array;
175
- getFaceMeshTriangulationFill(): Uint16Array;
176
- getFaceMeshUv(): Float32Array;
177
- getFaceMeshPosition(): Float32Array;
178
- }
179
-
180
- declare class WAS implements IWAS {
181
- private configData;
182
- private video;
183
- private canvas3D;
184
- private canvasGrayscale;
185
- private canvasGrayscale2D;
186
- private canvasVideo;
187
- private canvas3DContext;
188
- private canvasGrayscaleContext;
189
- private canvasGrayscale2DContext;
190
- private canvasVideoContext;
191
- private isSaveFrame;
192
- private videoWidth;
193
- private videoHeight;
194
- private containerWidth;
195
- private containerHeight;
196
- private isMessageSent;
197
- private isMessageSentSetConfig;
198
- private isNeedToSetConfig;
199
- private isProcess;
200
- private countTriggers;
201
- private triggerSizes;
202
- private triggerScales;
203
- private checkPerformance;
204
- private checkPose;
205
- private faceLandmarker;
206
- private faceLandmarkerTime;
207
- private faceData;
208
- private readonly fov;
209
- private readonly near;
210
- private readonly far;
211
- private readonly browserManager;
212
- private readonly eventsManager;
213
- private readonly dataManager;
214
- private readonly glManager;
215
- private readonly workerManager;
216
- constructor();
217
- init(configData: TConfigData): Promise<TWAS>;
218
- on(type: typeof EVENT_DETECTED, callBack: (detectedData: TEventDetectedData[]) => void): Promise<void>;
219
- on(type: typeof EVENT_LOST, callBack: (lostData: TEventLostData[]) => void): Promise<void>;
220
- on(type: typeof EVENT_POSE, callBack: (poseData: TEventPoseData[]) => void): Promise<void>;
221
- on(type: typeof EVENT_PROCESS, callBack: (isProcess: boolean) => void): Promise<void>;
222
- on(type: typeof EVENT_RESIZE, callBack: (event: UIEvent) => void): Promise<void>;
223
- on(type: typeof EVENT_DEVICE_ORIENTATION, callBack: (event: DeviceOrientationEvent) => void): Promise<void>;
224
- on(type: typeof EVENT_SCREEN_ORIENTATION, callBack: (angle: number) => void): Promise<void>;
225
- on(type: typeof EVENT_VISIBILITY, callBack: (isVisible: boolean) => void): Promise<void>;
226
- on(type: typeof EVENT_FRAME, callBack: (deltaTime: number) => void): Promise<void>;
227
- un(type: TEventType): Promise<void>;
228
- dispose(): Promise<void>;
229
- private initVideo;
230
- private initCanvas;
231
- private initContext;
232
- setMediaStream(): Promise<void>;
233
- private updateSizes;
234
- private setVideoWidth;
235
- private setVideoHeight;
236
- private getVideoWidth;
237
- private getVideoHeight;
238
- private setContainerWidth;
239
- private setContainerHeight;
240
- private getContainerWidth;
241
- private getContainerHeight;
242
- private restartMediaStream;
243
- private setConfig;
244
- private setTriggers;
245
- private loadImage;
246
- private initFaceLandmarker;
247
- private faceLandmarkerProcess;
248
- private process;
249
- private drawVideo;
250
- getTriggerSize(triggerId: number): TTriggerSize | undefined;
251
- getTriggerScale(triggerId: number): TVector | undefined;
252
- getViewportSizes(): TViewportSizes;
253
- getFaceMeshTriangulation(): Uint16Array;
254
- getFaceMeshTriangulationFillMouth(): Uint16Array;
255
- getFaceMeshTriangulationFillEyes(): Uint16Array;
256
- getFaceMeshTriangulationFill(): Uint16Array;
257
- getFaceMeshUv(): Float32Array;
258
- getFaceMeshPosition(): Float32Array;
259
- }
260
-
261
- export { ANCHOR_TYPE_BOTTOM_LEFT, ANCHOR_TYPE_BOTTOM_LIP, ANCHOR_TYPE_BOTTOM_RIGHT, ANCHOR_TYPE_CENTER, ANCHOR_TYPE_CHIN, ANCHOR_TYPE_LEFT_EAR, ANCHOR_TYPE_LEFT_EYE, ANCHOR_TYPE_LEFT_EYEBROW, ANCHOR_TYPE_NOSE_BASE, ANCHOR_TYPE_NOSE_BRIDGE, ANCHOR_TYPE_NOSE_TIP, ANCHOR_TYPE_ORIGIN, ANCHOR_TYPE_RIGHT_EAR, ANCHOR_TYPE_RIGHT_EYE, ANCHOR_TYPE_RIGHT_EYEBROW, ANCHOR_TYPE_TOP_LEFT, ANCHOR_TYPE_TOP_RIGHT, DATA_ERROR, DEVICE_ERROR, EVENT_DETECTED, EVENT_DEVICE_ORIENTATION, EVENT_ERROR, EVENT_FRAME, EVENT_LOST, EVENT_POSE, EVENT_PROCESS, EVENT_RESIZE, EVENT_SCREEN_ORIENTATION, EVENT_VISIBILITY, GL_ERROR, HTML_ERROR, PROJECT_MODE_FACE, PROJECT_MODE_IMAGE, PROJECT_MODE_MIX, PROJECT_MODE_QR, PROJECT_MODE_SLAM_3DOF, type TEventDetectedData, type TEventLostData, type TEventPoseData, TRIGGER_MODE_FACE, TRIGGER_MODE_IMAGE, TRIGGER_MODE_QR, type TTriggerSize, type TViewportSizes, VIDEO_ERROR, WORKER_ERROR, WAS as default };
1
+ declare const PROJECT_MODE_QR = "QR";
2
+ declare const PROJECT_MODE_IMAGE = "IMAGE";
3
+ declare const PROJECT_MODE_SLAM_3DOF = "SLAM_3DOF";
4
+ declare const PROJECT_MODE_SLAM_WEBXR = "SLAM_WEBXR";
5
+ declare const PROJECT_MODE_FACE = "FACE";
6
+ declare const PROJECT_MODE_MIX = "MIX";
7
+ declare const TRIGGER_MODE_QR = "QR";
8
+ declare const TRIGGER_MODE_IMAGE = "IMAGE";
9
+ declare const TRIGGER_MODE_SLAM_WEBXR = "SLAM_WEBXR";
10
+ declare const TRIGGER_MODE_FACE = "FACE";
11
+ declare const EVENT_DETECTED = "detected";
12
+ declare const EVENT_LOST = "lost";
13
+ declare const EVENT_POSE = "pose";
14
+ declare const EVENT_PROCESS = "process";
15
+ declare const EVENT_RESIZE = "resize";
16
+ declare const EVENT_DEVICE_ORIENTATION = "deviceorientation";
17
+ declare const EVENT_SCREEN_ORIENTATION = "change";
18
+ declare const EVENT_VISIBILITY = "visibilitychange";
19
+ declare const EVENT_SELECT = "select";
20
+ declare const EVENT_FRAME = "frame";
21
+ declare const DATA_ERROR = "DataError";
22
+ declare const EVENT_ERROR = "EventError";
23
+ declare const XR_ERROR = "XrError";
24
+ declare const GL_ERROR = "GlError";
25
+ declare const WORKER_ERROR = "WorkerError";
26
+ declare const HTML_ERROR = "HTMLError";
27
+ declare const DEVICE_ERROR = "DeviceError";
28
+ declare const VIDEO_ERROR = "VideoError";
29
+ declare const ANCHOR_TYPE_BOTTOM_LEFT = "bottomLeft";
30
+ declare const ANCHOR_TYPE_BOTTOM_RIGHT = "bottomRight";
31
+ declare const ANCHOR_TYPE_TOP_LEFT = "topLeft";
32
+ declare const ANCHOR_TYPE_TOP_RIGHT = "topRight";
33
+ declare const ANCHOR_TYPE_CENTER = "center";
34
+ declare const ANCHOR_TYPE_ORIGIN = "origin";
35
+ declare const ANCHOR_TYPE_LEFT_EYEBROW = 283;
36
+ declare const ANCHOR_TYPE_RIGHT_EYEBROW = 53;
37
+ declare const ANCHOR_TYPE_LEFT_EAR = 356;
38
+ declare const ANCHOR_TYPE_RIGHT_EAR = 127;
39
+ declare const ANCHOR_TYPE_LEFT_EYE = 374;
40
+ declare const ANCHOR_TYPE_RIGHT_EYE = 145;
41
+ declare const ANCHOR_TYPE_NOSE_BRIDGE = 6;
42
+ declare const ANCHOR_TYPE_NOSE_TIP = 4;
43
+ declare const ANCHOR_TYPE_NOSE_BASE = 2;
44
+ declare const ANCHOR_TYPE_BOTTOM_LIP = 14;
45
+ declare const ANCHOR_TYPE_CHIN = 199;
46
+
47
+ type TTriggerMode = typeof TRIGGER_MODE_QR | typeof TRIGGER_MODE_IMAGE | typeof TRIGGER_MODE_SLAM_WEBXR | typeof TRIGGER_MODE_FACE;
48
+
49
+ type TTrigger = {
50
+ id: number;
51
+ mode: TTriggerMode;
52
+ } & ({
53
+ mode: typeof TRIGGER_MODE_SLAM_WEBXR | typeof TRIGGER_MODE_FACE;
54
+ source: null;
55
+ } | {
56
+ mode: Exclude<TTriggerMode, typeof TRIGGER_MODE_SLAM_WEBXR | typeof TRIGGER_MODE_FACE>;
57
+ source: string;
58
+ });
59
+
60
+ type TProjectMode = typeof PROJECT_MODE_QR | typeof PROJECT_MODE_IMAGE | typeof PROJECT_MODE_SLAM_3DOF | typeof PROJECT_MODE_SLAM_WEBXR | typeof PROJECT_MODE_FACE | typeof PROJECT_MODE_MIX;
61
+
62
+ type TAnchorType = typeof ANCHOR_TYPE_BOTTOM_LEFT | typeof ANCHOR_TYPE_BOTTOM_RIGHT | typeof ANCHOR_TYPE_TOP_LEFT | typeof ANCHOR_TYPE_TOP_RIGHT | typeof ANCHOR_TYPE_CENTER;
63
+
64
+ type TAnchorFaceType = typeof ANCHOR_TYPE_ORIGIN | typeof ANCHOR_TYPE_LEFT_EYEBROW | typeof ANCHOR_TYPE_RIGHT_EYEBROW | typeof ANCHOR_TYPE_LEFT_EAR | typeof ANCHOR_TYPE_RIGHT_EAR | typeof ANCHOR_TYPE_LEFT_EYE | typeof ANCHOR_TYPE_RIGHT_EYE | typeof ANCHOR_TYPE_NOSE_BRIDGE | typeof ANCHOR_TYPE_NOSE_TIP | typeof ANCHOR_TYPE_NOSE_BASE | typeof ANCHOR_TYPE_BOTTOM_LIP | typeof ANCHOR_TYPE_CHIN;
65
+
66
+ type TConfigData = {
67
+ apiKey: string;
68
+ mode: TProjectMode;
69
+ container: Element;
70
+ } & ({
71
+ mode: typeof PROJECT_MODE_SLAM_3DOF;
72
+ uiContainer?: never;
73
+ fov?: never;
74
+ near?: never;
75
+ far?: never;
76
+ triggers?: never;
77
+ isMultiTracking?: never;
78
+ anchor?: never;
79
+ } | {
80
+ mode: typeof PROJECT_MODE_SLAM_WEBXR;
81
+ uiContainer: Element;
82
+ fov?: never;
83
+ near?: never;
84
+ far?: never;
85
+ triggers: TTrigger[];
86
+ isMultiTracking?: never;
87
+ anchor?: never;
88
+ } | {
89
+ mode: typeof PROJECT_MODE_FACE;
90
+ uiContainer?: never;
91
+ fov: number;
92
+ near: number;
93
+ far: number;
94
+ triggers: TTrigger[];
95
+ isMultiTracking?: never;
96
+ anchor?: TAnchorFaceType;
97
+ } | {
98
+ mode: Exclude<TProjectMode, typeof PROJECT_MODE_SLAM_3DOF | typeof PROJECT_MODE_SLAM_WEBXR | typeof PROJECT_MODE_FACE>;
99
+ uiContainer?: never;
100
+ fov: number;
101
+ near?: never;
102
+ far?: never;
103
+ triggers: TTrigger[];
104
+ isMultiTracking: boolean;
105
+ anchor: TAnchorType;
106
+ });
107
+
108
+ type TEventWASType = typeof EVENT_DETECTED | typeof EVENT_LOST | typeof EVENT_POSE | typeof EVENT_PROCESS | typeof EVENT_RESIZE | typeof EVENT_DEVICE_ORIENTATION | typeof EVENT_SCREEN_ORIENTATION | typeof EVENT_VISIBILITY | typeof EVENT_SELECT | typeof EVENT_FRAME;
109
+
110
+ type TVector = {
111
+ x: number;
112
+ y: number;
113
+ z: number;
114
+ };
115
+
116
+ type TQuaternion = {
117
+ x: number;
118
+ y: number;
119
+ z: number;
120
+ w: number;
121
+ };
122
+
123
+ type TEventDetectedData = {
124
+ triggerId: number;
125
+ positionVector: TVector;
126
+ rotationQuaternion: TQuaternion;
127
+ scaleVector: TVector;
128
+ landmarksData?: TVector[];
129
+ };
130
+
131
+ type TEventLostData = {
132
+ triggerId: number;
133
+ positionVector: TVector;
134
+ rotationQuaternion: TQuaternion;
135
+ scaleVector: TVector;
136
+ landmarksData?: TVector[];
137
+ };
138
+
139
+ type TEventPoseData = {
140
+ triggerId: number;
141
+ positionVector: TVector;
142
+ rotationQuaternion: TQuaternion;
143
+ scaleVector: TVector;
144
+ landmarksData?: TVector[];
145
+ };
146
+
147
+ type TEventWASCallBack = {
148
+ (detectedData: TEventDetectedData[]): void;
149
+ (lostData: TEventLostData[]): void;
150
+ (poseData: TEventPoseData[]): void;
151
+ (isProcess: boolean): void;
152
+ (event: UIEvent): void;
153
+ (event: DeviceOrientationEvent): void;
154
+ (angle: number): void;
155
+ (isVisible: boolean): void;
156
+ (): void;
157
+ (deltaTime: number): void;
158
+ };
159
+
160
+ type TEventType = typeof EVENT_DETECTED | typeof EVENT_LOST | typeof EVENT_POSE | typeof EVENT_PROCESS | typeof EVENT_RESIZE | typeof EVENT_DEVICE_ORIENTATION | typeof EVENT_SCREEN_ORIENTATION | typeof EVENT_VISIBILITY | typeof EVENT_SELECT | typeof EVENT_FRAME;
161
+
162
+ type TViewportSizes = {
163
+ width: number;
164
+ height: number;
165
+ };
166
+
167
+ type TWAS = {
168
+ canvas: HTMLCanvasElement;
169
+ context: WebGL2RenderingContext | WebGLRenderingContext | null;
170
+ videoCanvas: HTMLCanvasElement | null;
171
+ viewportSizes: TViewportSizes;
172
+ };
173
+
174
+ type TTriggerSize = {
175
+ id: number;
176
+ width: number;
177
+ height: number;
178
+ };
179
+
180
+ type TEventEmitType = typeof EVENT_DETECTED | typeof EVENT_LOST | typeof EVENT_POSE | typeof EVENT_PROCESS | typeof EVENT_SELECT;
181
+
182
+ type TEventEmitData = TEventDetectedData[] | TEventLostData[] | TEventPoseData[] | boolean;
183
+
184
+ type TXRViewerPose = {
185
+ positionVector: TVector;
186
+ rotationQuaternion: TQuaternion;
187
+ scaleVector: TVector;
188
+ projectionMatrix: Float32Array;
189
+ };
190
+
191
+ interface IWAS {
192
+ init(configData: TConfigData): Promise<TWAS>;
193
+ on(type: TEventWASType, callBack: TEventWASCallBack): Promise<void>;
194
+ un(type: TEventType): Promise<void>;
195
+ dispose(): Promise<void>;
196
+ setMediaStream(): Promise<void>;
197
+ getTriggerSize(triggerId: number): TTriggerSize | null;
198
+ getTriggerScale(triggerId: number): TVector | null;
199
+ getViewportSizes(): TViewportSizes;
200
+ getFaceMeshTriangulation(): Uint16Array;
201
+ getFaceMeshTriangulationFillMouth(): Uint16Array;
202
+ getFaceMeshTriangulationFillEyes(): Uint16Array;
203
+ getFaceMeshTriangulationFill(): Uint16Array;
204
+ getFaceMeshUv(): Float32Array;
205
+ getFaceMeshPosition(): Float32Array;
206
+ getIsSupportXRSession(): Promise<boolean>;
207
+ getIsActiveXRSession(): boolean;
208
+ endXRSession(): void;
209
+ getXRViewerPose(): TXRViewerPose | null;
210
+ emit(type: TEventEmitType, data?: TEventEmitData): void;
211
+ getDeltaTime(): number;
212
+ }
213
+
214
+ declare class WAS implements IWAS {
215
+ private configData;
216
+ private video;
217
+ private canvas3D;
218
+ private canvasGrayscale;
219
+ private canvasGrayscale2D;
220
+ private canvasVideo;
221
+ private canvas3DContext;
222
+ private canvasGrayscaleContext;
223
+ private canvasGrayscale2DContext;
224
+ private canvasVideoContext;
225
+ private isSaveFrame;
226
+ private videoWidth;
227
+ private videoHeight;
228
+ private containerWidth;
229
+ private containerHeight;
230
+ private isMessageSent;
231
+ private isMessageSentSetConfig;
232
+ private isNeedToSetConfig;
233
+ private isProcess;
234
+ private triggerSizes;
235
+ private triggerScales;
236
+ private checkPerformance;
237
+ private checkPose;
238
+ private faceLandmarker;
239
+ private faceLandmarkerTime;
240
+ private faceData;
241
+ private readonly fov;
242
+ private readonly near;
243
+ private readonly far;
244
+ private readonly browserManager;
245
+ private readonly xrManager;
246
+ private readonly eventsManager;
247
+ private readonly dataManager;
248
+ private readonly glManager;
249
+ private readonly workerManager;
250
+ constructor();
251
+ init(configData: TConfigData): Promise<TWAS>;
252
+ on(type: typeof EVENT_DETECTED, callBack: (detectedData: TEventDetectedData[]) => void): Promise<void>;
253
+ on(type: typeof EVENT_LOST, callBack: (lostData: TEventLostData[]) => void): Promise<void>;
254
+ on(type: typeof EVENT_POSE, callBack: (poseData: TEventPoseData[]) => void): Promise<void>;
255
+ on(type: typeof EVENT_PROCESS, callBack: (isProcess: boolean) => void): Promise<void>;
256
+ on(type: typeof EVENT_RESIZE, callBack: (event: UIEvent) => void): Promise<void>;
257
+ on(type: typeof EVENT_DEVICE_ORIENTATION, callBack: (event: DeviceOrientationEvent) => void): Promise<void>;
258
+ on(type: typeof EVENT_SCREEN_ORIENTATION, callBack: (angle: number) => void): Promise<void>;
259
+ on(type: typeof EVENT_VISIBILITY, callBack: (isVisible: boolean) => void): Promise<void>;
260
+ on(type: typeof EVENT_SELECT, callBack: () => void): Promise<void>;
261
+ on(type: typeof EVENT_FRAME, callBack: (deltaTime: number) => void): Promise<void>;
262
+ un(type: TEventType): Promise<void>;
263
+ dispose(): Promise<void>;
264
+ private initVideo;
265
+ private initCanvas;
266
+ private initContext;
267
+ setMediaStream(): Promise<void>;
268
+ private updateSizes;
269
+ private setVideoWidth;
270
+ private setVideoHeight;
271
+ private getVideoWidth;
272
+ private getVideoHeight;
273
+ private setContainerWidth;
274
+ private setContainerHeight;
275
+ private getContainerWidth;
276
+ private getContainerHeight;
277
+ private restartMediaStream;
278
+ private setConfig;
279
+ private setTriggers;
280
+ private loadImage;
281
+ private initFaceLandmarker;
282
+ private faceLandmarkerProcess;
283
+ private process;
284
+ private drawVideo;
285
+ getTriggerSize(triggerId: number): TTriggerSize | null;
286
+ getTriggerScale(triggerId: number): TVector | null;
287
+ getViewportSizes(): TViewportSizes;
288
+ getFaceMeshTriangulation(): Uint16Array;
289
+ getFaceMeshTriangulationFillMouth(): Uint16Array;
290
+ getFaceMeshTriangulationFillEyes(): Uint16Array;
291
+ getFaceMeshTriangulationFill(): Uint16Array;
292
+ getFaceMeshUv(): Float32Array;
293
+ getFaceMeshPosition(): Float32Array;
294
+ getIsSupportXRSession(): Promise<boolean>;
295
+ getIsActiveXRSession(): boolean;
296
+ endXRSession(): void;
297
+ getXRViewerPose(): TXRViewerPose | null;
298
+ emit(type: TEventEmitType, data?: TEventEmitData): void;
299
+ getDeltaTime(): number;
300
+ }
301
+
302
+ export { ANCHOR_TYPE_BOTTOM_LEFT, ANCHOR_TYPE_BOTTOM_LIP, ANCHOR_TYPE_BOTTOM_RIGHT, ANCHOR_TYPE_CENTER, ANCHOR_TYPE_CHIN, ANCHOR_TYPE_LEFT_EAR, ANCHOR_TYPE_LEFT_EYE, ANCHOR_TYPE_LEFT_EYEBROW, ANCHOR_TYPE_NOSE_BASE, ANCHOR_TYPE_NOSE_BRIDGE, ANCHOR_TYPE_NOSE_TIP, ANCHOR_TYPE_ORIGIN, ANCHOR_TYPE_RIGHT_EAR, ANCHOR_TYPE_RIGHT_EYE, ANCHOR_TYPE_RIGHT_EYEBROW, ANCHOR_TYPE_TOP_LEFT, ANCHOR_TYPE_TOP_RIGHT, DATA_ERROR, DEVICE_ERROR, EVENT_DETECTED, EVENT_DEVICE_ORIENTATION, EVENT_ERROR, EVENT_FRAME, EVENT_LOST, EVENT_POSE, EVENT_PROCESS, EVENT_RESIZE, EVENT_SCREEN_ORIENTATION, EVENT_SELECT, EVENT_VISIBILITY, GL_ERROR, HTML_ERROR, PROJECT_MODE_FACE, PROJECT_MODE_IMAGE, PROJECT_MODE_MIX, PROJECT_MODE_QR, PROJECT_MODE_SLAM_3DOF, PROJECT_MODE_SLAM_WEBXR, type TEventDetectedData, type TEventLostData, type TEventPoseData, TRIGGER_MODE_FACE, TRIGGER_MODE_IMAGE, TRIGGER_MODE_QR, TRIGGER_MODE_SLAM_WEBXR, type TTriggerSize, type TViewportSizes, type TXRViewerPose, VIDEO_ERROR, WORKER_ERROR, XR_ERROR, WAS as default };