@zappar/zappar-cv 3.9.2 → 3.11.0

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.
Files changed (47) hide show
  1. package/README.md +2 -2
  2. package/lib/bridged-camera-source.d.ts +1 -0
  3. package/lib/bridged-camera-source.js +8 -0
  4. package/lib/bridged-d3-tracker.js +2 -26
  5. package/lib/camera-source.d.ts +3 -0
  6. package/lib/camera-source.js +8 -2
  7. package/lib/drawpoints.js +30 -38
  8. package/lib/gen/zappar-bridge.d.ts +12 -0
  9. package/lib/gen/zappar-client.js +173 -5
  10. package/lib/gen/zappar-cwrap.js +115 -0
  11. package/lib/gen/zappar-native.d.ts +14 -1
  12. package/lib/gen/zappar-native.js +1 -0
  13. package/lib/gen/zappar-server.js +75 -0
  14. package/lib/gen/zappar.d.ts +9 -8
  15. package/lib/html-element-source.d.ts +1 -0
  16. package/lib/html-element-source.js +4 -3
  17. package/lib/image-process-gl.d.ts +4 -5
  18. package/lib/image-process-gl.js +14 -25
  19. package/lib/imagebitmap-camera-source.d.ts +3 -0
  20. package/lib/imagebitmap-camera-source.js +12 -5
  21. package/lib/mstp-camera-source.d.ts +3 -0
  22. package/lib/mstp-camera-source.js +8 -2
  23. package/lib/native.js +39 -19
  24. package/lib/profile.d.ts +2 -1
  25. package/lib/profile.js +33 -2
  26. package/lib/sequencesource.js +2 -2
  27. package/lib/src/bridged-camera-source.d.ts +1 -0
  28. package/lib/src/camera-source.d.ts +3 -0
  29. package/lib/src/gen/zappar-bridge.d.ts +12 -0
  30. package/lib/src/gen/zappar-native.d.ts +14 -1
  31. package/lib/src/gen/zappar.d.ts +9 -8
  32. package/lib/src/html-element-source.d.ts +1 -0
  33. package/lib/src/image-process-gl.d.ts +4 -5
  34. package/lib/src/imagebitmap-camera-source.d.ts +3 -0
  35. package/lib/src/mstp-camera-source.d.ts +3 -0
  36. package/lib/src/profile.d.ts +2 -1
  37. package/lib/src/version.d.ts +1 -1
  38. package/lib/src/webxr-camera-source.d.ts +5 -0
  39. package/lib/tests/common.d.ts +3 -1
  40. package/lib/version.d.ts +1 -1
  41. package/lib/version.js +1 -1
  42. package/lib/webxr-camera-source.d.ts +5 -0
  43. package/lib/webxr-camera-source.js +67 -35
  44. package/lib/worker-imagebitmap.js +2 -14
  45. package/lib/zappar-cv.js +1 -1
  46. package/lib/zappar-cv.wasm +0 -0
  47. package/package.json +1 -1
package/README.md CHANGED
@@ -18,8 +18,8 @@ npm i @zappar/zappar-cv
18
18
 
19
19
  You can use our CDN from within your HTML:
20
20
  ```
21
- <script src="https://libs.zappar.com/zappar-cv/3.9.2/zappar-cv.js"></script>
21
+ <script src="https://libs.zappar.com/zappar-cv/3.11.0/zappar-cv.js"></script>
22
22
  ```
23
23
 
24
24
  Or you can download and host our standalone JavaScript bundle:
25
- [https://libs.zappar.com/zappar-cv/3.9.2/zappar-cv.zip](https://libs.zappar.com/zappar-cv/3.9.2/zappar-cv.zip)
25
+ [https://libs.zappar.com/zappar-cv/3.11.0/zappar-cv.zip](https://libs.zappar.com/zappar-cv/3.11.0/zappar-cv.zip)
@@ -39,6 +39,7 @@ export declare class BridgedCameraSource extends Source {
39
39
  uploadGL(info: CameraFrameInfo): void;
40
40
  recycle(info: CameraFrameInfo): void;
41
41
  setProfile(p: camera_profile_t): void;
42
+ setPreferredResolution(w: number, h: number): void;
42
43
  private _anchorPoseFloat32;
43
44
  private _anchorPoseUint16;
44
45
  setCustomAnchorPose(anchor: zappar_custom_anchor_t, pose_version: number, pose: Float32Array): void;
@@ -365,6 +365,11 @@ export class BridgedCameraSource extends Source {
365
365
  this._decodeBuffers.push(recycleBuffer);
366
366
  }
367
367
  setProfile(p) {
368
+ // Treat FULL as the same as HIGH for the bridge so we don't
369
+ // change the interface. The main use case (high res D3) is
370
+ // already handled separately in the bridge anyway.
371
+ if (p == camera_profile_t.FULL)
372
+ p = camera_profile_t.HIGH;
368
373
  if (this._profile === p)
369
374
  return;
370
375
  this._profile = p;
@@ -372,6 +377,9 @@ export class BridgedCameraSource extends Source {
372
377
  this._messageHandler.postMessage(`setProfile${this._profile}`);
373
378
  }
374
379
  }
380
+ setPreferredResolution(w, h) {
381
+ // Not implemented over the bridge yet
382
+ }
375
383
  setCustomAnchorPose(anchor, pose_version, pose) {
376
384
  let message = `setCustomAnchorPose${anchor}:${pose_version}:`;
377
385
  this._anchorPoseFloat32.set(pose);
@@ -16,7 +16,6 @@ export class BridgedD3Tracker {
16
16
  let s = {
17
17
  pipeline: p,
18
18
  enabled: true,
19
- sizeById: Object.create(null),
20
19
  maxResolution: false,
21
20
  };
22
21
  this._d3StateById.set(newId, s);
@@ -58,11 +57,8 @@ export class BridgedD3Tracker {
58
57
  const data = this._getD3Data(o);
59
58
  return (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.detections) === null || _a === void 0 ? void 0 : _a[indx]) === null || _b === void 0 ? void 0 : _b.qr) !== null && _c !== void 0 ? _c : '';
60
59
  },
61
- d3_tracker_pose_raw: (o, indx) => {
62
- return this.impl.d3_tracker_pose0_raw(o, indx);
63
- },
64
60
  d3_tracker_pose0_raw: (o, indx) => {
65
- var _a, _b, _c, _d, _e, _f;
61
+ var _a, _b, _c;
66
62
  const data = this._getD3Data(o);
67
63
  let ret = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.detections) === null || _a === void 0 ? void 0 : _a[indx]) === null || _b === void 0 ? void 0 : _b.worldPoses) === null || _c === void 0 ? void 0 : _c[0];
68
64
  if (!ret)
@@ -79,18 +75,10 @@ export class BridgedD3Tracker {
79
75
  }
80
76
  const computed = mat4.create();
81
77
  mat4.multiply(computed, worldToCamera, ret);
82
- const state = this._getD3State(o);
83
- const id = (_e = (_d = data === null || data === void 0 ? void 0 : data.detections) === null || _d === void 0 ? void 0 : _d[indx]) === null || _e === void 0 ? void 0 : _e.id;
84
- if (id && id.length > 0) {
85
- const size = 0.5 * ((_f = state.sizeById[id]) !== null && _f !== void 0 ? _f : 2);
86
- computed[12] *= size;
87
- computed[13] *= size;
88
- computed[14] *= size;
89
- }
90
78
  return computed;
91
79
  },
92
80
  d3_tracker_pose1_raw: (o, indx) => {
93
- var _a, _b, _c, _d, _e, _f;
81
+ var _a, _b, _c;
94
82
  const data = this._getD3Data(o);
95
83
  let ret = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.detections) === null || _a === void 0 ? void 0 : _a[indx]) === null || _b === void 0 ? void 0 : _b.worldPoses) === null || _c === void 0 ? void 0 : _c[1];
96
84
  if (!ret)
@@ -107,14 +95,6 @@ export class BridgedD3Tracker {
107
95
  }
108
96
  const computed = mat4.create();
109
97
  mat4.multiply(computed, worldToCamera, ret);
110
- const state = this._getD3State(o);
111
- const id = (_e = (_d = data === null || data === void 0 ? void 0 : data.detections) === null || _d === void 0 ? void 0 : _d[indx]) === null || _e === void 0 ? void 0 : _e.id;
112
- if (id && id.length > 0) {
113
- const size = 0.5 * ((_f = state.sizeById[id]) !== null && _f !== void 0 ? _f : 2);
114
- computed[12] *= size;
115
- computed[13] *= size;
116
- computed[14] *= size;
117
- }
118
98
  return computed;
119
99
  },
120
100
  d3_tracker_landmarks_data: (o, indx) => {
@@ -149,10 +129,6 @@ export class BridgedD3Tracker {
149
129
  const data = this._getD3Data(o);
150
130
  return (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.detections) === null || _a === void 0 ? void 0 : _a[indx]) === null || _b === void 0 ? void 0 : _b.category) !== null && _c !== void 0 ? _c : 0;
151
131
  },
152
- d3_tracker_size_for_id_set: (o, id, size) => {
153
- const state = this._getD3State(o);
154
- state.sizeById[id] = size;
155
- },
156
132
  };
157
133
  }
158
134
  static IsSupported() {
@@ -7,6 +7,8 @@ export declare class CameraSource extends HTMLElementSource {
7
7
  static DEFAULT_DEVICE_ID: string;
8
8
  private _currentStream;
9
9
  private _activeDeviceId;
10
+ private _preferredWidth;
11
+ private _preferredHeight;
10
12
  private _explicitUserCameraId;
11
13
  private _explicitEnvironmentCameraId;
12
14
  constructor(_impl: zappar_camera_source_t, pipeline: zappar_pipeline_t, _deviceId: string);
@@ -14,6 +16,7 @@ export declare class CameraSource extends HTMLElementSource {
14
16
  private _stop;
15
17
  pause(): void;
16
18
  start(): void;
19
+ setPreferredResolution(w: number, h: number): void;
17
20
  private _getConstraints;
18
21
  getFrame(allowRead: boolean): void;
19
22
  private _getUserMedia;
@@ -28,6 +28,8 @@ export class CameraSource extends HTMLElementSource {
28
28
  this._deviceId = _deviceId;
29
29
  this._currentStream = null;
30
30
  this._activeDeviceId = null;
31
+ this._preferredWidth = profile.videoWidth;
32
+ this._preferredHeight = profile.videoHeight;
31
33
  this._hasStartedOrientation = false;
32
34
  this._lastTimestamp = -1;
33
35
  this._deviceMotionListener = (ev) => {
@@ -90,6 +92,10 @@ export class CameraSource extends HTMLElementSource {
90
92
  this._startDeviceMotion();
91
93
  this._syncCamera();
92
94
  }
95
+ setPreferredResolution(w, h) {
96
+ this._preferredWidth = w;
97
+ this._preferredHeight = h;
98
+ }
93
99
  _getConstraints() {
94
100
  return __awaiter(this, void 0, void 0, function* () {
95
101
  let deviceId;
@@ -120,8 +126,8 @@ export class CameraSource extends HTMLElementSource {
120
126
  audio: false,
121
127
  video: {
122
128
  facingMode: facingMode,
123
- width: profile.videoWidth,
124
- height: profile.videoHeight,
129
+ width: this._preferredWidth,
130
+ height: this._preferredHeight,
125
131
  frameRate: profile.requestHighFrameRate ? 60 : undefined,
126
132
  deviceId: deviceId
127
133
  }
package/lib/drawpoints.js CHANGED
@@ -1,6 +1,6 @@
1
- import { profile } from "./profile";
2
1
  import { compileShader, linkProgram } from "./shader";
3
2
  import { mat4 } from "gl-matrix";
3
+ import { cameraRotationForScreenOrientation } from "./cameramodel";
4
4
  let identity = mat4.create();
5
5
  export class PointsDraw {
6
6
  constructor(_gl) {
@@ -134,47 +134,39 @@ void main()
134
134
  {
135
135
  gl_FragColor = vec4(color, 1.0);
136
136
  }`;
137
- function cameraRotationForScreenOrientation() {
138
- if (window.screen.orientation && !profile.forceWindowOrientation) {
139
- switch (window.screen.orientation.type) {
140
- case "portrait-primary":
141
- return 270;
142
- case "landscape-secondary":
143
- return 180;
144
- case "portrait-secondary":
145
- return 90;
146
- default:
147
- return 0;
148
- }
137
+ export function getPointsDataMatrix(frameWidth, frameHeight, screenWidth, screenHeight, mirror) {
138
+ // Considering camera-relative coords, so think in landscape
139
+ const rotationDegs = cameraRotationForScreenOrientation(false);
140
+ const isLandscape = (rotationDegs == 0) || (rotationDegs == 180);
141
+ const screenWidthLandscape = isLandscape ? screenWidth : screenHeight;
142
+ const screenHeightLandscape = isLandscape ? screenHeight : screenWidth;
143
+ const screenAspectLandscape = screenWidthLandscape / screenHeightLandscape;
144
+ const frameAspect = frameWidth / frameHeight;
145
+ let xScale, yScale;
146
+ if (screenAspectLandscape > frameAspect) {
147
+ // crop-to-fill, wider screen than frame
148
+ // width will map to -1 to +1
149
+ xScale = 2 / frameWidth;
150
+ yScale = -2 / (frameWidth / screenAspectLandscape);
149
151
  }
150
- else if (window.orientation !== undefined) {
151
- switch (window.orientation) {
152
- case 0: return 270;
153
- case 90: return 0;
154
- case 180: return 90;
155
- case -90: return 180;
156
- }
152
+ else {
153
+ // crop-to-fill, taller screen than frame
154
+ // height will map to -1 to +1
155
+ yScale = -2 / frameHeight;
156
+ xScale = 2 / (frameHeight * screenAspectLandscape);
157
157
  }
158
- return 0;
159
- }
160
- export function getPointsDataMatrix(frameWidth, frameHeight, screenWidth, screenHeight, mirror) {
158
+ // Offset so origin is the centre of the frame
159
+ let xOffset = xScale * (-(frameWidth - 1) * 0.5);
160
+ let yOffset = yScale * (-(frameHeight - 1) * 0.5);
161
+ // Fill in the 2D scale / offset values
161
162
  let ret = mat4.create();
163
+ ret[0] = xScale;
164
+ ret[5] = yScale;
165
+ ret[12] = xOffset;
166
+ ret[13] = yOffset;
167
+ // Apply rotation to the final screen orientation
162
168
  let trans = mat4.create();
163
- // Translate to centre UV coords
164
- mat4.fromTranslation(trans, [-0.5 * frameWidth, -0.5 * frameHeight, 0]);
165
- mat4.multiply(ret, trans, ret);
166
- mat4.fromScaling(trans, [2 / frameWidth, 2 / -frameHeight, 1]);
167
- mat4.multiply(ret, trans, ret);
168
- if (mirror) {
169
- mat4.fromScaling(trans, [-1, 1, 1]);
170
- mat4.multiply(ret, trans, ret);
171
- }
172
- let screenAspect = screenWidth > screenHeight ? (screenWidth / screenHeight) : (screenHeight / screenWidth);
173
- let frameAspect = frameWidth / frameHeight;
174
- mat4.fromScaling(trans, [1, screenAspect / frameAspect, 1]);
175
- mat4.multiply(ret, trans, ret);
176
- // Apply rotation back into ZCV's landscape space
177
- mat4.fromRotation(trans, cameraRotationForScreenOrientation() * Math.PI / 180.0, [0, 0, 1]);
169
+ mat4.fromRotation(trans, cameraRotationForScreenOrientation(false) * Math.PI / 180.0, [0, 0, 1]);
178
170
  mat4.multiply(ret, trans, ret);
179
171
  return ret;
180
172
  }
@@ -186,4 +186,16 @@ export interface zappar {
186
186
  custom_anchor_pose_set_with_parent(o: zappar_custom_anchor_t, pose: Float32Array, anchor_id: string): void;
187
187
  d3_tracker_create(pipeline: zappar_pipeline_t): zappar_d3_tracker_t;
188
188
  d3_tracker_destroy(o: zappar_d3_tracker_t): void;
189
+ d3_tracker_enabled(o: zappar_d3_tracker_t): boolean;
190
+ d3_tracker_enabled_set(o: zappar_d3_tracker_t, enabled: boolean): void;
191
+ d3_tracker_count(o: zappar_d3_tracker_t): number;
192
+ d3_tracker_id(o: zappar_d3_tracker_t, indx: number): string;
193
+ d3_tracker_pose0_raw(o: zappar_d3_tracker_t, indx: number): Float32Array;
194
+ d3_tracker_pose1_raw(o: zappar_d3_tracker_t, indx: number): Float32Array;
195
+ d3_tracker_type(o: zappar_d3_tracker_t, indx: number): number;
196
+ d3_tracker_category(o: zappar_d3_tracker_t, indx: number): number;
197
+ d3_tracker_qr(o: zappar_d3_tracker_t, indx: number): string;
198
+ d3_tracker_dense(o: zappar_d3_tracker_t, indx: number): number;
199
+ d3_tracker_landmarks_data(o: zappar_d3_tracker_t, indx: number): Float32Array;
200
+ d3_tracker_landmarks_data_size(o: zappar_d3_tracker_t, indx: number): number;
189
201
  }
@@ -1114,15 +1114,18 @@ export class zappar_client {
1114
1114
  d3_tracker_create: (pipeline) => {
1115
1115
  let newId = (this._latestId++);
1116
1116
  let s = {
1117
- id: [],
1118
1117
  enabled: true,
1118
+ process_max_resolution: false,
1119
1119
  count: 0,
1120
- qr: [],
1121
- pose: [],
1120
+ id: [],
1121
+ pose0: [],
1122
+ pose1: [],
1122
1123
  type: [],
1123
- dense: [],
1124
1124
  category: [],
1125
- process_max_resolution: false,
1125
+ qr: [],
1126
+ dense: [],
1127
+ landmarks_data: [],
1128
+ landmarks_data_size: [],
1126
1129
  };
1127
1130
  this._d3_tracker_state_by_instance.set(newId, s);
1128
1131
  this.serializer.sendMessage(60, m => {
@@ -1140,6 +1143,82 @@ export class zappar_client {
1140
1143
  m.type(o);
1141
1144
  });
1142
1145
  },
1146
+ d3_tracker_enabled: (o) => {
1147
+ let s = this._d3_tracker_state_by_instance.get(o);
1148
+ if (!s)
1149
+ throw new Error("This object has been destroyed");
1150
+ return s.enabled;
1151
+ },
1152
+ d3_tracker_enabled_set: (o, enabled) => {
1153
+ let s = this._d3_tracker_state_by_instance.get(o);
1154
+ if (!s)
1155
+ throw new Error("This object has been destroyed");
1156
+ this.serializer.sendMessage(64, m => {
1157
+ m.type(o);
1158
+ m.bool(enabled);
1159
+ });
1160
+ s.enabled = enabled;
1161
+ },
1162
+ d3_tracker_count: (o) => {
1163
+ let s = this._d3_tracker_state_by_instance.get(o);
1164
+ if (!s)
1165
+ throw new Error("This object has been destroyed");
1166
+ return s.count;
1167
+ },
1168
+ d3_tracker_id: (o, indx) => {
1169
+ let s = this._d3_tracker_state_by_instance.get(o);
1170
+ if (!s)
1171
+ throw new Error("This object has been destroyed");
1172
+ return s.id[indx];
1173
+ },
1174
+ d3_tracker_pose0_raw: (o, indx) => {
1175
+ let s = this._d3_tracker_state_by_instance.get(o);
1176
+ if (!s)
1177
+ throw new Error("This object has been destroyed");
1178
+ return s.pose0[indx];
1179
+ },
1180
+ d3_tracker_pose1_raw: (o, indx) => {
1181
+ let s = this._d3_tracker_state_by_instance.get(o);
1182
+ if (!s)
1183
+ throw new Error("This object has been destroyed");
1184
+ return s.pose1[indx];
1185
+ },
1186
+ d3_tracker_type: (o, indx) => {
1187
+ let s = this._d3_tracker_state_by_instance.get(o);
1188
+ if (!s)
1189
+ throw new Error("This object has been destroyed");
1190
+ return s.type[indx];
1191
+ },
1192
+ d3_tracker_category: (o, indx) => {
1193
+ let s = this._d3_tracker_state_by_instance.get(o);
1194
+ if (!s)
1195
+ throw new Error("This object has been destroyed");
1196
+ return s.category[indx];
1197
+ },
1198
+ d3_tracker_qr: (o, indx) => {
1199
+ let s = this._d3_tracker_state_by_instance.get(o);
1200
+ if (!s)
1201
+ throw new Error("This object has been destroyed");
1202
+ return s.qr[indx];
1203
+ },
1204
+ d3_tracker_dense: (o, indx) => {
1205
+ let s = this._d3_tracker_state_by_instance.get(o);
1206
+ if (!s)
1207
+ throw new Error("This object has been destroyed");
1208
+ return s.dense[indx];
1209
+ },
1210
+ d3_tracker_landmarks_data: (o, indx) => {
1211
+ let s = this._d3_tracker_state_by_instance.get(o);
1212
+ if (!s)
1213
+ throw new Error("This object has been destroyed");
1214
+ return s.landmarks_data[indx];
1215
+ },
1216
+ d3_tracker_landmarks_data_size: (o, indx) => {
1217
+ let s = this._d3_tracker_state_by_instance.get(o);
1218
+ if (!s)
1219
+ throw new Error("This object has been destroyed");
1220
+ return s.landmarks_data_size[indx];
1221
+ },
1143
1222
  };
1144
1223
  }
1145
1224
  processMessages(a) {
@@ -1571,6 +1650,95 @@ export class zappar_client {
1571
1650
  inst.pose = msg.matrix4x4();
1572
1651
  break;
1573
1652
  }
1653
+ case 56: {
1654
+ let handle = msg.type();
1655
+ let inst = this._d3_tracker_state_by_instance.get(handle);
1656
+ if (!inst)
1657
+ return;
1658
+ inst.count = msg.int();
1659
+ break;
1660
+ }
1661
+ case 57: {
1662
+ let handle = msg.type();
1663
+ let inst = this._d3_tracker_state_by_instance.get(handle);
1664
+ if (!inst)
1665
+ return;
1666
+ let indx = msg.int();
1667
+ inst.id[indx] = msg.string();
1668
+ break;
1669
+ }
1670
+ case 58: {
1671
+ let handle = msg.type();
1672
+ let inst = this._d3_tracker_state_by_instance.get(handle);
1673
+ if (!inst)
1674
+ return;
1675
+ let indx = msg.int();
1676
+ inst.pose0[indx] = msg.matrix4x4();
1677
+ break;
1678
+ }
1679
+ case 59: {
1680
+ let handle = msg.type();
1681
+ let inst = this._d3_tracker_state_by_instance.get(handle);
1682
+ if (!inst)
1683
+ return;
1684
+ let indx = msg.int();
1685
+ inst.pose1[indx] = msg.matrix4x4();
1686
+ break;
1687
+ }
1688
+ case 60: {
1689
+ let handle = msg.type();
1690
+ let inst = this._d3_tracker_state_by_instance.get(handle);
1691
+ if (!inst)
1692
+ return;
1693
+ let indx = msg.int();
1694
+ inst.type[indx] = msg.int();
1695
+ break;
1696
+ }
1697
+ case 61: {
1698
+ let handle = msg.type();
1699
+ let inst = this._d3_tracker_state_by_instance.get(handle);
1700
+ if (!inst)
1701
+ return;
1702
+ let indx = msg.int();
1703
+ inst.category[indx] = msg.int();
1704
+ break;
1705
+ }
1706
+ case 62: {
1707
+ let handle = msg.type();
1708
+ let inst = this._d3_tracker_state_by_instance.get(handle);
1709
+ if (!inst)
1710
+ return;
1711
+ let indx = msg.int();
1712
+ inst.qr[indx] = msg.string();
1713
+ break;
1714
+ }
1715
+ case 63: {
1716
+ let handle = msg.type();
1717
+ let inst = this._d3_tracker_state_by_instance.get(handle);
1718
+ if (!inst)
1719
+ return;
1720
+ let indx = msg.int();
1721
+ inst.dense[indx] = msg.int();
1722
+ break;
1723
+ }
1724
+ case 64: {
1725
+ let handle = msg.type();
1726
+ let inst = this._d3_tracker_state_by_instance.get(handle);
1727
+ if (!inst)
1728
+ return;
1729
+ let indx = msg.int();
1730
+ inst.landmarks_data[indx] = msg.floatArray();
1731
+ break;
1732
+ }
1733
+ case 65: {
1734
+ let handle = msg.type();
1735
+ let inst = this._d3_tracker_state_by_instance.get(handle);
1736
+ if (!inst)
1737
+ return;
1738
+ let indx = msg.int();
1739
+ inst.landmarks_data_size[indx] = msg.int();
1740
+ break;
1741
+ }
1574
1742
  }
1575
1743
  });
1576
1744
  }
@@ -388,6 +388,52 @@ export function getRuntimeObject(mod) {
388
388
  ]);
389
389
  let d3_tracker_create_wrapped = mod.cwrap("zappar_d3_tracker_create", "number", ["number"]);
390
390
  let d3_tracker_destroy_wrapped = mod.cwrap("zappar_d3_tracker_destroy", null, ["number"]);
391
+ let d3_tracker_enabled_wrapped = mod.cwrap("zappar_d3_tracker_enabled", "number", [
392
+ "number"
393
+ ]);
394
+ let d3_tracker_enabled_set_wrapped = mod.cwrap("zappar_d3_tracker_enabled_set", null, [
395
+ "number",
396
+ "number"
397
+ ]);
398
+ let d3_tracker_count_wrapped = mod.cwrap("zappar_d3_tracker_count", "number", [
399
+ "number"
400
+ ]);
401
+ let d3_tracker_id_wrapped = mod.cwrap("zappar_d3_tracker_id", "string", [
402
+ "number",
403
+ "number"
404
+ ]);
405
+ let d3_tracker_pose0_raw_wrapped = mod.cwrap("zappar_d3_tracker_pose0_raw", "number", [
406
+ "number",
407
+ "number"
408
+ ]);
409
+ let d3_tracker_pose1_raw_wrapped = mod.cwrap("zappar_d3_tracker_pose1_raw", "number", [
410
+ "number",
411
+ "number"
412
+ ]);
413
+ let d3_tracker_type_wrapped = mod.cwrap("zappar_d3_tracker_type", "number", [
414
+ "number",
415
+ "number"
416
+ ]);
417
+ let d3_tracker_category_wrapped = mod.cwrap("zappar_d3_tracker_category", "number", [
418
+ "number",
419
+ "number"
420
+ ]);
421
+ let d3_tracker_qr_wrapped = mod.cwrap("zappar_d3_tracker_qr", "string", [
422
+ "number",
423
+ "number"
424
+ ]);
425
+ let d3_tracker_dense_wrapped = mod.cwrap("zappar_d3_tracker_dense", "number", [
426
+ "number",
427
+ "number"
428
+ ]);
429
+ let d3_tracker_landmarks_data_wrapped = mod.cwrap("zappar_d3_tracker_landmarks_data", "number", [
430
+ "number",
431
+ "number"
432
+ ]);
433
+ let d3_tracker_landmarks_data_size_wrapped = mod.cwrap("zappar_d3_tracker_landmarks_data_size", "number", [
434
+ "number",
435
+ "number"
436
+ ]);
391
437
  let dataArrayArgLength = 32;
392
438
  let dataArrayArg = mod._malloc(dataArrayArgLength);
393
439
  let floatDataArrayArgLength = 16 * 4;
@@ -1129,5 +1175,74 @@ export function getRuntimeObject(mod) {
1129
1175
  d3_tracker_destroy: () => {
1130
1176
  d3_tracker_destroy_wrapped();
1131
1177
  },
1178
+ d3_tracker_enabled: (o) => {
1179
+ let ret = d3_tracker_enabled_wrapped(o);
1180
+ ret = ret === 1;
1181
+ return ret;
1182
+ },
1183
+ d3_tracker_enabled_set: (o, enabled) => {
1184
+ let arg_enabled = enabled ? 1 : 0;
1185
+ let ret = d3_tracker_enabled_set_wrapped(o, arg_enabled);
1186
+ return ret;
1187
+ },
1188
+ d3_tracker_count: (o) => {
1189
+ let ret = d3_tracker_count_wrapped(o);
1190
+ return ret;
1191
+ },
1192
+ d3_tracker_id: (o, indx) => {
1193
+ let arg_indx = indx;
1194
+ let ret = d3_tracker_id_wrapped(o, arg_indx);
1195
+ return ret;
1196
+ },
1197
+ d3_tracker_pose0_raw: (o, indx) => {
1198
+ let arg_indx = indx;
1199
+ let ret = d3_tracker_pose0_raw_wrapped(o, arg_indx);
1200
+ let ab = new Float32Array(16);
1201
+ ab.set(mod.HEAPF32.subarray(ret / 4, 16 + ret / 4));
1202
+ ret = ab;
1203
+ return ret;
1204
+ },
1205
+ d3_tracker_pose1_raw: (o, indx) => {
1206
+ let arg_indx = indx;
1207
+ let ret = d3_tracker_pose1_raw_wrapped(o, arg_indx);
1208
+ let ab = new Float32Array(16);
1209
+ ab.set(mod.HEAPF32.subarray(ret / 4, 16 + ret / 4));
1210
+ ret = ab;
1211
+ return ret;
1212
+ },
1213
+ d3_tracker_type: (o, indx) => {
1214
+ let arg_indx = indx;
1215
+ let ret = d3_tracker_type_wrapped(o, arg_indx);
1216
+ return ret;
1217
+ },
1218
+ d3_tracker_category: (o, indx) => {
1219
+ let arg_indx = indx;
1220
+ let ret = d3_tracker_category_wrapped(o, arg_indx);
1221
+ return ret;
1222
+ },
1223
+ d3_tracker_qr: (o, indx) => {
1224
+ let arg_indx = indx;
1225
+ let ret = d3_tracker_qr_wrapped(o, arg_indx);
1226
+ return ret;
1227
+ },
1228
+ d3_tracker_dense: (o, indx) => {
1229
+ let arg_indx = indx;
1230
+ let ret = d3_tracker_dense_wrapped(o, arg_indx);
1231
+ return ret;
1232
+ },
1233
+ d3_tracker_landmarks_data: (o, indx) => {
1234
+ let arg_indx = indx;
1235
+ let ret = d3_tracker_landmarks_data_wrapped(o, arg_indx);
1236
+ let retsize = d3_tracker_landmarks_data_size_wrapped(o, indx);
1237
+ let ab = new Float32Array(retsize);
1238
+ ab.set(mod.HEAPF32.subarray(ret / 4, retsize + ret / 4));
1239
+ ret = ab;
1240
+ return ret;
1241
+ },
1242
+ d3_tracker_landmarks_data_size: (o, indx) => {
1243
+ let arg_indx = indx;
1244
+ let ret = d3_tracker_landmarks_data_size_wrapped(o, arg_indx);
1245
+ return ret;
1246
+ },
1132
1247
  };
1133
1248
  }
@@ -85,7 +85,8 @@ export declare enum plane_orientation_t {
85
85
  }
86
86
  export declare enum camera_profile_t {
87
87
  DEFAULT = 0,
88
- HIGH = 1
88
+ HIGH = 1,
89
+ FULL = 2
89
90
  }
90
91
  export declare enum world_scale_mode_t {
91
92
  DEFAULT = 0,
@@ -263,4 +264,16 @@ export interface zappar_cwrap {
263
264
  custom_anchor_pose_set_with_parent(o: zappar_custom_anchor_t, pose: Float32Array, anchor_id: string): void;
264
265
  d3_tracker_create(pipeline: zappar_pipeline_t): zappar_d3_tracker_t;
265
266
  d3_tracker_destroy(o: zappar_d3_tracker_t): void;
267
+ d3_tracker_enabled(o: zappar_d3_tracker_t): boolean;
268
+ d3_tracker_enabled_set(o: zappar_d3_tracker_t, enabled: boolean): void;
269
+ d3_tracker_count(o: zappar_d3_tracker_t): number;
270
+ d3_tracker_id(o: zappar_d3_tracker_t, indx: number): string;
271
+ d3_tracker_pose0_raw(o: zappar_d3_tracker_t, indx: number): Float32Array;
272
+ d3_tracker_pose1_raw(o: zappar_d3_tracker_t, indx: number): Float32Array;
273
+ d3_tracker_type(o: zappar_d3_tracker_t, indx: number): number;
274
+ d3_tracker_category(o: zappar_d3_tracker_t, indx: number): number;
275
+ d3_tracker_qr(o: zappar_d3_tracker_t, indx: number): string;
276
+ d3_tracker_dense(o: zappar_d3_tracker_t, indx: number): number;
277
+ d3_tracker_landmarks_data(o: zappar_d3_tracker_t, indx: number): Float32Array;
278
+ d3_tracker_landmarks_data_size(o: zappar_d3_tracker_t, indx: number): number;
266
279
  }
@@ -107,6 +107,7 @@ export var camera_profile_t;
107
107
  (function (camera_profile_t) {
108
108
  camera_profile_t[camera_profile_t["DEFAULT"] = 0] = "DEFAULT";
109
109
  camera_profile_t[camera_profile_t["HIGH"] = 1] = "HIGH";
110
+ camera_profile_t[camera_profile_t["FULL"] = 2] = "FULL";
110
111
  })(camera_profile_t || (camera_profile_t = {}));
111
112
  ;
112
113
  export var world_scale_mode_t;