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