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