@web-ar-studio/webar-engine-sdk 1.0.5 → 1.0.7

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
@@ -5,6 +5,7 @@ declare const PROJECT_MODE_FACE = "FACE";
5
5
  declare const PROJECT_MODE_MIX = "MIX";
6
6
  declare const TRIGGER_MODE_QR = "QR";
7
7
  declare const TRIGGER_MODE_IMAGE = "IMAGE";
8
+ declare const TRIGGER_MODE_FACE = "FACE";
8
9
  declare const EVENT_DETECTED = "detected";
9
10
  declare const EVENT_LOST = "lost";
10
11
  declare const EVENT_POSE = "pose";
@@ -26,32 +27,63 @@ declare const ANCHOR_TYPE_BOTTOM_RIGHT = "bottomRight";
26
27
  declare const ANCHOR_TYPE_TOP_LEFT = "topLeft";
27
28
  declare const ANCHOR_TYPE_TOP_RIGHT = "topRight";
28
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;
29
42
 
30
- type TTriggerMode = typeof TRIGGER_MODE_QR | typeof TRIGGER_MODE_IMAGE;
43
+ type TTriggerMode = typeof TRIGGER_MODE_QR | typeof TRIGGER_MODE_IMAGE | typeof TRIGGER_MODE_FACE;
31
44
 
32
45
  type TTrigger = {
33
46
  id: number;
34
47
  mode: TTriggerMode;
48
+ } & ({
49
+ mode: typeof TRIGGER_MODE_FACE;
50
+ source: null;
51
+ } | {
52
+ mode: Exclude<TTriggerMode, typeof TRIGGER_MODE_FACE>;
35
53
  source: string;
36
- };
54
+ });
37
55
 
38
56
  type TProjectMode = typeof PROJECT_MODE_QR | typeof PROJECT_MODE_IMAGE | typeof PROJECT_MODE_SLAM_3DOF | typeof PROJECT_MODE_FACE | typeof PROJECT_MODE_MIX;
39
57
 
40
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;
41
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
+
42
62
  type TConfigData = {
43
63
  apiKey: string;
44
64
  mode: TProjectMode;
45
65
  container: Element;
46
66
  } & ({
47
- mode: typeof PROJECT_MODE_SLAM_3DOF | typeof PROJECT_MODE_FACE;
67
+ mode: typeof PROJECT_MODE_SLAM_3DOF;
48
68
  fov?: never;
69
+ near?: never;
70
+ far?: never;
49
71
  triggers?: never;
50
72
  isMultiTracking?: never;
51
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;
52
82
  } | {
53
83
  mode: Exclude<TProjectMode, typeof PROJECT_MODE_SLAM_3DOF | typeof PROJECT_MODE_FACE>;
54
84
  fov: number;
85
+ near?: never;
86
+ far?: never;
55
87
  triggers: TTrigger[];
56
88
  isMultiTracking: boolean;
57
89
  anchor: TAnchorType;
@@ -77,6 +109,7 @@ type TEventDetectedData = {
77
109
  positionVector: TVector;
78
110
  rotationQuaternion: TQuaternion;
79
111
  scaleVector: TVector;
112
+ landmarksData?: TVector[];
80
113
  };
81
114
 
82
115
  type TEventLostData = {
@@ -84,6 +117,7 @@ type TEventLostData = {
84
117
  positionVector: TVector;
85
118
  rotationQuaternion: TQuaternion;
86
119
  scaleVector: TVector;
120
+ landmarksData?: TVector[];
87
121
  };
88
122
 
89
123
  type TEventPoseData = {
@@ -91,6 +125,7 @@ type TEventPoseData = {
91
125
  positionVector: TVector;
92
126
  rotationQuaternion: TQuaternion;
93
127
  scaleVector: TVector;
128
+ landmarksData?: TVector[];
94
129
  };
95
130
 
96
131
  type TEventWASCallBack = {
@@ -134,6 +169,12 @@ interface IWAS {
134
169
  getTriggerSize(triggerId: number): TTriggerSize | undefined;
135
170
  getTriggerScale(triggerId: number): TVector | undefined;
136
171
  getViewportSizes(): TViewportSizes;
172
+ getFaceMeshTriangulation(): Uint16Array;
173
+ getFaceMeshTriangulationFillMouth(): Uint16Array;
174
+ getFaceMeshTriangulationFillEyes(): Uint16Array;
175
+ getFaceMeshTriangulationFill(): Uint16Array;
176
+ getFaceMeshUv(): Float32Array;
177
+ getFaceMeshPosition(): Float32Array;
137
178
  }
138
179
 
139
180
  declare class WAS implements IWAS {
@@ -164,6 +205,9 @@ declare class WAS implements IWAS {
164
205
  private faceLandmarker;
165
206
  private faceLandmarkerTime;
166
207
  private faceData;
208
+ private readonly fov;
209
+ private readonly near;
210
+ private readonly far;
167
211
  private readonly browserManager;
168
212
  private readonly eventsManager;
169
213
  private readonly dataManager;
@@ -206,7 +250,12 @@ declare class WAS implements IWAS {
206
250
  getTriggerSize(triggerId: number): TTriggerSize | undefined;
207
251
  getTriggerScale(triggerId: number): TVector | undefined;
208
252
  getViewportSizes(): TViewportSizes;
209
- private getFaceData;
253
+ getFaceMeshTriangulation(): Uint16Array;
254
+ getFaceMeshTriangulationFillMouth(): Uint16Array;
255
+ getFaceMeshTriangulationFillEyes(): Uint16Array;
256
+ getFaceMeshTriangulationFill(): Uint16Array;
257
+ getFaceMeshUv(): Float32Array;
258
+ getFaceMeshPosition(): Float32Array;
210
259
  }
211
260
 
212
- export { ANCHOR_TYPE_BOTTOM_LEFT, ANCHOR_TYPE_BOTTOM_RIGHT, ANCHOR_TYPE_CENTER, 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_IMAGE, TRIGGER_MODE_QR, type TTriggerSize, type TViewportSizes, VIDEO_ERROR, WORKER_ERROR, WAS as default };
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 };