@web-ar-studio/webar-engine-sdk 1.0.13 → 1.0.14

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