@web-ar-studio/webar-engine-sdk 1.0.2 → 1.0.4

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,5 +1,7 @@
1
1
  declare const PROJECT_MODE_QR = "QR";
2
2
  declare const PROJECT_MODE_IMAGE = "IMAGE";
3
+ declare const PROJECT_MODE_SLAM_3DOF = "SLAM_3DOF";
4
+ declare const PROJECT_MODE_FACE = "FACE";
3
5
  declare const PROJECT_MODE_MIX = "MIX";
4
6
  declare const TRIGGER_MODE_QR = "QR";
5
7
  declare const TRIGGER_MODE_IMAGE = "IMAGE";
@@ -33,7 +35,7 @@ type TTrigger = {
33
35
  source: string;
34
36
  };
35
37
 
36
- type TProjectMode = typeof PROJECT_MODE_QR | typeof PROJECT_MODE_IMAGE | typeof PROJECT_MODE_MIX;
38
+ type TProjectMode = typeof PROJECT_MODE_QR | typeof PROJECT_MODE_IMAGE | typeof PROJECT_MODE_SLAM_3DOF | typeof PROJECT_MODE_FACE | typeof PROJECT_MODE_MIX;
37
39
 
38
40
  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;
39
41
 
@@ -41,11 +43,19 @@ type TConfigData = {
41
43
  apiKey: string;
42
44
  mode: TProjectMode;
43
45
  container: Element;
46
+ } & ({
47
+ mode: typeof PROJECT_MODE_SLAM_3DOF | typeof PROJECT_MODE_FACE;
48
+ fov?: never;
49
+ triggers?: never;
50
+ isMultiTracking?: never;
51
+ anchor?: never;
52
+ } | {
53
+ mode: Exclude<TProjectMode, typeof PROJECT_MODE_SLAM_3DOF | typeof PROJECT_MODE_FACE>;
44
54
  fov: number;
45
55
  triggers: TTrigger[];
46
56
  isMultiTracking: boolean;
47
57
  anchor: TAnchorType;
48
- };
58
+ });
49
59
 
50
60
  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;
51
61
 
@@ -55,24 +65,31 @@ type TVector = {
55
65
  z: number;
56
66
  };
57
67
 
68
+ type TQuaternion = {
69
+ x: number;
70
+ y: number;
71
+ z: number;
72
+ w: number;
73
+ };
74
+
58
75
  type TEventDetectedData = {
59
76
  triggerId: number;
60
77
  positionVector: TVector;
61
- rotationVector: TVector;
78
+ rotationQuaternion: TQuaternion;
62
79
  scaleVector: TVector;
63
80
  };
64
81
 
65
82
  type TEventLostData = {
66
83
  triggerId: number;
67
84
  positionVector: TVector;
68
- rotationVector: TVector;
85
+ rotationQuaternion: TQuaternion;
69
86
  scaleVector: TVector;
70
87
  };
71
88
 
72
89
  type TEventPoseData = {
73
90
  triggerId: number;
74
91
  positionVector: TVector;
75
- rotationVector: TVector;
92
+ rotationQuaternion: TQuaternion;
76
93
  scaleVector: TVector;
77
94
  };
78
95
 
@@ -144,6 +161,9 @@ declare class WAS implements IWAS {
144
161
  private triggerScales;
145
162
  private checkPerformance;
146
163
  private checkPose;
164
+ private faceLandmarker;
165
+ private faceLandmarkerTime;
166
+ private faceData;
147
167
  private readonly browserManager;
148
168
  private readonly eventsManager;
149
169
  private readonly dataManager;
@@ -179,11 +199,14 @@ declare class WAS implements IWAS {
179
199
  private setConfig;
180
200
  private setTriggers;
181
201
  private loadImage;
202
+ private initFaceLandmarker;
203
+ private faceLandmarkerProcess;
182
204
  private process;
183
205
  private drawVideo;
184
206
  getTriggerSize(triggerId: number): TTriggerSize | undefined;
185
207
  getTriggerScale(triggerId: number): TVector | undefined;
186
208
  getViewportSizes(): TViewportSizes;
209
+ private getFaceData;
187
210
  }
188
211
 
189
- 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_IMAGE, PROJECT_MODE_MIX, PROJECT_MODE_QR, type TEventDetectedData, type TEventLostData, type TEventPoseData, TRIGGER_MODE_IMAGE, TRIGGER_MODE_QR, type TTriggerSize, type TViewportSizes, VIDEO_ERROR, WORKER_ERROR, WAS as default };
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 };