@zappar/zappar-cv 2.1.3 → 3.0.0-alpha.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 (41) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +2 -2
  3. package/lib/camera-source.d.ts +1 -0
  4. package/lib/camera-source.js +18 -3
  5. package/lib/drawcamera.js +24 -3
  6. package/lib/gen/zappar-client.d.ts +1 -0
  7. package/lib/gen/zappar-client.js +230 -26
  8. package/lib/gen/zappar-cwrap.js +147 -0
  9. package/lib/gen/zappar-native.d.ts +24 -0
  10. package/lib/gen/zappar-native.js +7 -0
  11. package/lib/gen/zappar-server.d.ts +3 -0
  12. package/lib/gen/zappar-server.js +132 -25
  13. package/lib/gen/zappar.d.ts +26 -0
  14. package/lib/gen/zappar.js +1 -0
  15. package/lib/imagebitmap-camera-source.d.ts +1 -0
  16. package/lib/imagebitmap-camera-source.js +18 -3
  17. package/lib/index.d.ts +1 -1
  18. package/lib/index.js +1 -1
  19. package/lib/mstp-camera-source.d.ts +1 -0
  20. package/lib/mstp-camera-source.js +18 -3
  21. package/lib/native.js +57 -0
  22. package/lib/pipeline.d.ts +4 -0
  23. package/lib/pipeline.js +85 -4
  24. package/lib/profile.d.ts +2 -0
  25. package/lib/profile.js +6 -1
  26. package/lib/sequencerecorder.d.ts +18 -2
  27. package/lib/sequencerecorder.js +60 -0
  28. package/lib/sequencesource.js +16 -0
  29. package/lib/version.d.ts +1 -1
  30. package/lib/version.js +1 -1
  31. package/lib/worker-imagebitmap.js +1 -1
  32. package/lib/worker-server.js +65 -3
  33. package/lib/workerinterface.d.ts +15 -0
  34. package/lib/zappar-cv.js +92 -90
  35. package/lib/zappar-cv.wasm +0 -0
  36. package/package.json +2 -2
  37. package/umd/56.zappar-cv.js +1 -1
  38. package/umd/d728c530a2842970b329.wasm +0 -0
  39. package/umd/zappar-cv.js +1 -1
  40. package/umd/zappar-cv.worker.js +1 -1
  41. package/umd/17b53fcc0ff7ee6350b4.wasm +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.1.4] - 2023-07-06
4
+
5
+ - Whitelisted `*.ngrok-free.app` domain.
6
+
7
+ ## [2.1.3] - 2023-06-23
8
+
9
+ ### Fixed
10
+
11
+ - Performance issues when using curved tracking.
12
+
3
13
  ## [2.0.2] - 2023-05-04
4
14
 
5
15
  ### Fixed
@@ -76,6 +86,7 @@
76
86
  ## [0.3.10] - 2021-09-17
77
87
 
78
88
  ### Added
89
+
79
90
  - loaded() function which returns true once the library is fully loaded and available for use
80
91
 
81
92
  ### Changed
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/2.1.3/zappar-cv.js"></script>
21
+ <script src="https://libs.zappar.com/zappar-cv/3.0.0-alpha.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/2.1.3/zappar-cv.zip](https://libs.zappar.com/zappar-cv/2.1.3/zappar-cv.zip)
25
+ [https://libs.zappar.com/zappar-cv/3.0.0-alpha.0/zappar-cv.zip](https://libs.zappar.com/zappar-cv/3.0.0-alpha.0/zappar-cv.zip)
@@ -19,6 +19,7 @@ export declare class CameraSource extends HTMLElementSource {
19
19
  private _getUserMedia;
20
20
  private _syncCamera;
21
21
  private _hasStartedOrientation;
22
+ private _lastTimestamp;
22
23
  private _deviceMotionListener;
23
24
  private _deviceOrientationListener;
24
25
  private _startDeviceOrientation;
@@ -29,23 +29,36 @@ export class CameraSource extends HTMLElementSource {
29
29
  this._currentStream = null;
30
30
  this._activeDeviceId = null;
31
31
  this._hasStartedOrientation = false;
32
+ this._lastTimestamp = -1;
32
33
  this._deviceMotionListener = (ev) => {
33
34
  let pipeline = Pipeline.get(this._pipeline);
34
35
  if (!pipeline)
35
36
  return;
36
37
  let timeStamp = (ev.timeStamp !== undefined && ev.timeStamp !== null) ? ev.timeStamp : performance.now();
38
+ let interval = ev.interval * profile.intervalMultiplier;
39
+ if (this._lastTimestamp > -1 && !profile.trustSensorIntervals) {
40
+ interval = Math.max(timeStamp - this._lastTimestamp, interval);
41
+ }
42
+ this._lastTimestamp = timeStamp;
43
+ if (ev.acceleration !== null &&
44
+ ev.acceleration.x !== null &&
45
+ ev.acceleration.y !== null &&
46
+ ev.acceleration.z !== null) {
47
+ pipeline.motionAccelerometerWithoutGravitySubmitInt(timeStamp, interval, ev.acceleration.x * profile.deviceMotionMutliplier, ev.acceleration.y * profile.deviceMotionMutliplier, ev.acceleration.z * profile.deviceMotionMutliplier);
48
+ }
37
49
  if (ev.accelerationIncludingGravity !== null &&
38
50
  ev.accelerationIncludingGravity.x !== null &&
39
51
  ev.accelerationIncludingGravity.y !== null &&
40
52
  ev.accelerationIncludingGravity.z !== null) {
41
53
  pipeline.motionAccelerometerSubmit(timeStamp, ev.accelerationIncludingGravity.x * profile.deviceMotionMutliplier, ev.accelerationIncludingGravity.y * profile.deviceMotionMutliplier, ev.accelerationIncludingGravity.z * profile.deviceMotionMutliplier);
54
+ pipeline.motionAccelerometerWithGravitySubmitInt(timeStamp, interval, ev.accelerationIncludingGravity.x * profile.deviceMotionMutliplier, ev.accelerationIncludingGravity.y * profile.deviceMotionMutliplier, ev.accelerationIncludingGravity.z * profile.deviceMotionMutliplier);
42
55
  }
43
56
  if (ev.rotationRate !== null &&
44
57
  ev.rotationRate.alpha !== null &&
45
58
  ev.rotationRate.beta !== null &&
46
- ev.rotationRate.gamma !== null && !this._hasStartedOrientation) {
47
- ev.timeStamp;
48
- pipeline.motionRotationRateSubmit(timeStamp, ev.rotationRate.alpha * Math.PI / -180.0, ev.rotationRate.beta * Math.PI / -180.0, ev.rotationRate.gamma * Math.PI / -180.0);
59
+ ev.rotationRate.gamma !== null && this._hasStartedOrientation) {
60
+ pipeline.motionRotationRateSubmit(timeStamp, ev.rotationRate.alpha, ev.rotationRate.beta, ev.rotationRate.gamma);
61
+ pipeline.motionRotationRateSubmitInt(timeStamp, interval, ev.rotationRate.alpha, ev.rotationRate.beta, ev.rotationRate.gamma);
49
62
  }
50
63
  else if (!this._hasStartedOrientation) {
51
64
  this._startDeviceOrientation();
@@ -197,11 +210,13 @@ export class CameraSource extends HTMLElementSource {
197
210
  if (ev.alpha === null || ev.beta === null || ev.gamma === null)
198
211
  return;
199
212
  pipeline.motionAttitudeSubmit(timeStamp, ev.alpha, ev.beta, ev.gamma);
213
+ pipeline.motionAttitudeSubmitInt(timeStamp, 0, ev.alpha, ev.beta, ev.gamma);
200
214
  };
201
215
  window.addEventListener("deviceorientation", this._deviceOrientationListener);
202
216
  }
203
217
  _startDeviceMotion() {
204
218
  window.addEventListener("devicemotion", this._deviceMotionListener, false);
219
+ this._startDeviceOrientation();
205
220
  }
206
221
  _stopDeviceMotion() {
207
222
  window.removeEventListener("devicemotion", this._deviceMotionListener);
package/lib/drawcamera.js CHANGED
@@ -38,9 +38,19 @@ export class CameraDraw {
38
38
  if (!i.texture)
39
39
  return;
40
40
  let gl = this._gl;
41
+ const reenableDepthTest = gl.isEnabled(gl.DEPTH_TEST);
42
+ const reenableScissorTest = gl.isEnabled(gl.SCISSOR_TEST);
43
+ const reenableCullFace = gl.isEnabled(gl.CULL_FACE);
44
+ const reenableStencilTest = gl.isEnabled(gl.STENCIL_TEST);
45
+ const reenableBlend = gl.isEnabled(gl.BLEND);
46
+ const previousBoundTexture = gl.getParameter(gl.TEXTURE_BINDING_2D);
47
+ const previousBoundFramebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);
48
+ const previousProgram = gl.getParameter(gl.CURRENT_PROGRAM);
49
+ const previousActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE);
41
50
  gl.disable(gl.DEPTH_TEST);
42
51
  gl.disable(gl.SCISSOR_TEST);
43
52
  gl.disable(gl.CULL_FACE);
53
+ gl.disable(gl.STENCIL_TEST);
44
54
  gl.disable(gl.BLEND);
45
55
  let shader = this._getCameraShader(gl);
46
56
  let vbo = this._generate(gl, i);
@@ -57,9 +67,20 @@ export class CameraDraw {
57
67
  gl.drawArrays(gl.TRIANGLES, 0, 6);
58
68
  gl.disableVertexAttribArray(shader.attr_position);
59
69
  gl.disableVertexAttribArray(shader.attr_texCoord);
60
- gl.bindTexture(gl.TEXTURE_2D, null);
61
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
62
- gl.useProgram(null);
70
+ gl.bindFramebuffer(gl.FRAMEBUFFER, previousBoundFramebuffer);
71
+ gl.useProgram(previousProgram);
72
+ gl.bindTexture(gl.TEXTURE_2D, previousBoundTexture);
73
+ gl.activeTexture(previousActiveTexture);
74
+ if (reenableBlend)
75
+ gl.enable(gl.BLEND);
76
+ if (reenableCullFace)
77
+ gl.enable(gl.CULL_FACE);
78
+ if (reenableDepthTest)
79
+ gl.enable(gl.DEPTH_TEST);
80
+ if (reenableScissorTest)
81
+ gl.enable(gl.SCISSOR_TEST);
82
+ if (reenableStencilTest)
83
+ gl.enable(gl.STENCIL_TEST);
63
84
  }
64
85
  _getCameraShader(gl) {
65
86
  if (this._shader)
@@ -17,6 +17,7 @@ export declare class zappar_client {
17
17
  private _face_landmark_state_by_instance;
18
18
  private _barcode_finder_state_by_instance;
19
19
  private _instant_world_tracker_state_by_instance;
20
+ private _world_tracker_state_by_instance;
20
21
  impl: zappar_cwrap;
21
22
  processMessages(a: ArrayBuffer): void;
22
23
  }
@@ -20,17 +20,18 @@ export class zappar_client {
20
20
  this._face_landmark_state_by_instance = new Map();
21
21
  this._barcode_finder_state_by_instance = new Map();
22
22
  this._instant_world_tracker_state_by_instance = new Map();
23
+ this._world_tracker_state_by_instance = new Map();
23
24
  this.impl = {
24
25
  log_level: () => {
25
26
  return this._globalState.log_level;
26
27
  },
27
28
  log_level_set: (level) => {
28
- this.serializer.sendMessage(34, m => {
29
+ this.serializer.sendMessage(38, m => {
29
30
  m.logLevel(level);
30
31
  });
31
32
  },
32
33
  analytics_project_id_set: (id, uid) => {
33
- this.serializer.sendMessage(31, m => {
34
+ this.serializer.sendMessage(35, m => {
34
35
  m.string(id);
35
36
  m.string(uid);
36
37
  });
@@ -47,7 +48,7 @@ export class zappar_client {
47
48
  frame_number: 0,
48
49
  };
49
50
  this._pipeline_state_by_instance.set(newId, s);
50
- this.serializer.sendMessage(27, m => {
51
+ this.serializer.sendMessage(31, m => {
51
52
  m.type(newId);
52
53
  });
53
54
  return newId;
@@ -57,7 +58,7 @@ export class zappar_client {
57
58
  if (!s)
58
59
  throw new Error("This object has been destroyed");
59
60
  this._pipeline_state_by_instance.delete(o);
60
- this.serializer.sendMessage(28, m => {
61
+ this.serializer.sendMessage(32, m => {
61
62
  m.type(o);
62
63
  });
63
64
  },
@@ -131,13 +132,52 @@ export class zappar_client {
131
132
  m.float(z);
132
133
  });
133
134
  },
134
- pipeline_motion_rotation_rate_submit: (o, time, x, y, z) => {
135
+ pipeline_motion_accelerometer_with_gravity_submit_int: (o, time, interval, x, y, z) => {
136
+ let s = this._pipeline_state_by_instance.get(o);
137
+ if (!s)
138
+ throw new Error("This object has been destroyed");
139
+ this.serializer.sendMessage(12, m => {
140
+ m.type(o);
141
+ m.timestamp(time);
142
+ m.timestamp(interval);
143
+ m.float(x);
144
+ m.float(y);
145
+ m.float(z);
146
+ });
147
+ },
148
+ pipeline_motion_accelerometer_without_gravity_submit_int: (o, time, interval, x, y, z) => {
135
149
  let s = this._pipeline_state_by_instance.get(o);
136
150
  if (!s)
137
151
  throw new Error("This object has been destroyed");
138
152
  this.serializer.sendMessage(11, m => {
139
153
  m.type(o);
140
154
  m.timestamp(time);
155
+ m.timestamp(interval);
156
+ m.float(x);
157
+ m.float(y);
158
+ m.float(z);
159
+ });
160
+ },
161
+ pipeline_motion_rotation_rate_submit: (o, time, x, y, z) => {
162
+ let s = this._pipeline_state_by_instance.get(o);
163
+ if (!s)
164
+ throw new Error("This object has been destroyed");
165
+ this.serializer.sendMessage(15, m => {
166
+ m.type(o);
167
+ m.timestamp(time);
168
+ m.float(x);
169
+ m.float(y);
170
+ m.float(z);
171
+ });
172
+ },
173
+ pipeline_motion_rotation_rate_submit_int: (o, time, interval, x, y, z) => {
174
+ let s = this._pipeline_state_by_instance.get(o);
175
+ if (!s)
176
+ throw new Error("This object has been destroyed");
177
+ this.serializer.sendMessage(13, m => {
178
+ m.type(o);
179
+ m.timestamp(time);
180
+ m.timestamp(interval);
141
181
  m.float(x);
142
182
  m.float(y);
143
183
  m.float(z);
@@ -147,7 +187,7 @@ export class zappar_client {
147
187
  let s = this._pipeline_state_by_instance.get(o);
148
188
  if (!s)
149
189
  throw new Error("This object has been destroyed");
150
- this.serializer.sendMessage(12, m => {
190
+ this.serializer.sendMessage(16, m => {
151
191
  m.type(o);
152
192
  m.timestamp(time);
153
193
  m.float(x);
@@ -155,11 +195,24 @@ export class zappar_client {
155
195
  m.float(z);
156
196
  });
157
197
  },
198
+ pipeline_motion_attitude_submit_int: (o, time, interval, x, y, z) => {
199
+ let s = this._pipeline_state_by_instance.get(o);
200
+ if (!s)
201
+ throw new Error("This object has been destroyed");
202
+ this.serializer.sendMessage(14, m => {
203
+ m.type(o);
204
+ m.timestamp(time);
205
+ m.timestamp(interval);
206
+ m.float(x);
207
+ m.float(y);
208
+ m.float(z);
209
+ });
210
+ },
158
211
  pipeline_motion_attitude_matrix_submit: (o, mat) => {
159
212
  let s = this._pipeline_state_by_instance.get(o);
160
213
  if (!s)
161
214
  throw new Error("This object has been destroyed");
162
- this.serializer.sendMessage(13, m => {
215
+ this.serializer.sendMessage(17, m => {
163
216
  m.type(o);
164
217
  m.matrix4x4(mat);
165
218
  });
@@ -169,7 +222,7 @@ export class zappar_client {
169
222
  let newId = (this._latestId++);
170
223
  let s = {};
171
224
  this._camera_source_state_by_instance.set(newId, s);
172
- this.serializer.sendMessage(29, m => {
225
+ this.serializer.sendMessage(33, m => {
173
226
  m.type(newId);
174
227
  m.type(pipeline);
175
228
  m.string(device_id);
@@ -181,7 +234,7 @@ export class zappar_client {
181
234
  if (!s)
182
235
  throw new Error("This object has been destroyed");
183
236
  this._camera_source_state_by_instance.delete(o);
184
- this.serializer.sendMessage(30, m => {
237
+ this.serializer.sendMessage(34, m => {
185
238
  m.type(o);
186
239
  });
187
240
  },
@@ -190,7 +243,7 @@ export class zappar_client {
190
243
  let newId = (this._latestId++);
191
244
  let s = {};
192
245
  this._sequence_source_state_by_instance.set(newId, s);
193
- this.serializer.sendMessage(35, m => {
246
+ this.serializer.sendMessage(39, m => {
194
247
  m.type(newId);
195
248
  m.type(pipeline);
196
249
  });
@@ -201,7 +254,7 @@ export class zappar_client {
201
254
  if (!s)
202
255
  throw new Error("This object has been destroyed");
203
256
  this._sequence_source_state_by_instance.delete(o);
204
- this.serializer.sendMessage(36, m => {
257
+ this.serializer.sendMessage(40, m => {
205
258
  m.type(o);
206
259
  });
207
260
  },
@@ -227,7 +280,7 @@ export class zappar_client {
227
280
  if (!s)
228
281
  throw new Error("This object has been destroyed");
229
282
  this._image_tracker_state_by_instance.delete(o);
230
- this.serializer.sendMessage(14, m => {
283
+ this.serializer.sendMessage(18, m => {
231
284
  m.type(o);
232
285
  });
233
286
  },
@@ -293,7 +346,7 @@ export class zappar_client {
293
346
  anchor_expression_coefficients: [],
294
347
  };
295
348
  this._face_tracker_state_by_instance.set(newId, s);
296
- this.serializer.sendMessage(20, m => {
349
+ this.serializer.sendMessage(24, m => {
297
350
  m.type(newId);
298
351
  m.type(pipeline);
299
352
  });
@@ -304,7 +357,7 @@ export class zappar_client {
304
357
  if (!s)
305
358
  throw new Error("This object has been destroyed");
306
359
  this._face_tracker_state_by_instance.delete(o);
307
- this.serializer.sendMessage(21, m => {
360
+ this.serializer.sendMessage(25, m => {
308
361
  m.type(o);
309
362
  });
310
363
  },
@@ -312,7 +365,7 @@ export class zappar_client {
312
365
  let s = this._face_tracker_state_by_instance.get(o);
313
366
  if (!s)
314
367
  throw new Error("This object has been destroyed");
315
- this.serializer.sendMessage(22, m => {
368
+ this.serializer.sendMessage(26, m => {
316
369
  m.type(o);
317
370
  m.dataWithLength(data);
318
371
  });
@@ -327,7 +380,7 @@ export class zappar_client {
327
380
  let s = this._face_tracker_state_by_instance.get(o);
328
381
  if (!s)
329
382
  throw new Error("This object has been destroyed");
330
- this.serializer.sendMessage(23, m => {
383
+ this.serializer.sendMessage(27, m => {
331
384
  m.type(o);
332
385
  m.bool(enabled);
333
386
  });
@@ -342,7 +395,7 @@ export class zappar_client {
342
395
  let s = this._face_tracker_state_by_instance.get(o);
343
396
  if (!s)
344
397
  throw new Error("This object has been destroyed");
345
- this.serializer.sendMessage(24, m => {
398
+ this.serializer.sendMessage(28, m => {
346
399
  m.type(o);
347
400
  m.int(num);
348
401
  });
@@ -388,7 +441,7 @@ export class zappar_client {
388
441
  let newId = (this._latestId++);
389
442
  let s = {};
390
443
  this._face_mesh_state_by_instance.set(newId, s);
391
- this.serializer.sendMessage(25, m => {
444
+ this.serializer.sendMessage(29, m => {
392
445
  m.type(newId);
393
446
  });
394
447
  return newId;
@@ -398,7 +451,7 @@ export class zappar_client {
398
451
  if (!s)
399
452
  throw new Error("This object has been destroyed");
400
453
  this._face_mesh_state_by_instance.delete(o);
401
- this.serializer.sendMessage(26, m => {
454
+ this.serializer.sendMessage(30, m => {
402
455
  m.type(o);
403
456
  });
404
457
  },
@@ -407,7 +460,7 @@ export class zappar_client {
407
460
  let newId = (this._latestId++);
408
461
  let s = {};
409
462
  this._face_landmark_state_by_instance.set(newId, s);
410
- this.serializer.sendMessage(32, m => {
463
+ this.serializer.sendMessage(36, m => {
411
464
  m.type(newId);
412
465
  m.faceLandmarkName(landmark);
413
466
  });
@@ -418,7 +471,7 @@ export class zappar_client {
418
471
  if (!s)
419
472
  throw new Error("This object has been destroyed");
420
473
  this._face_landmark_state_by_instance.delete(o);
421
- this.serializer.sendMessage(33, m => {
474
+ this.serializer.sendMessage(37, m => {
422
475
  m.type(o);
423
476
  });
424
477
  },
@@ -433,7 +486,7 @@ export class zappar_client {
433
486
  formats: (1 << 17) - 1,
434
487
  };
435
488
  this._barcode_finder_state_by_instance.set(newId, s);
436
- this.serializer.sendMessage(16, m => {
489
+ this.serializer.sendMessage(20, m => {
437
490
  m.type(newId);
438
491
  m.type(pipeline);
439
492
  });
@@ -444,7 +497,7 @@ export class zappar_client {
444
497
  if (!s)
445
498
  throw new Error("This object has been destroyed");
446
499
  this._barcode_finder_state_by_instance.delete(o);
447
- this.serializer.sendMessage(17, m => {
500
+ this.serializer.sendMessage(21, m => {
448
501
  m.type(o);
449
502
  });
450
503
  },
@@ -452,7 +505,7 @@ export class zappar_client {
452
505
  let s = this._barcode_finder_state_by_instance.get(o);
453
506
  if (!s)
454
507
  throw new Error("This object has been destroyed");
455
- this.serializer.sendMessage(18, m => {
508
+ this.serializer.sendMessage(22, m => {
456
509
  m.type(o);
457
510
  m.bool(enabled);
458
511
  });
@@ -491,7 +544,7 @@ export class zappar_client {
491
544
  let s = this._barcode_finder_state_by_instance.get(o);
492
545
  if (!s)
493
546
  throw new Error("This object has been destroyed");
494
- this.serializer.sendMessage(19, m => {
547
+ this.serializer.sendMessage(23, m => {
495
548
  m.type(o);
496
549
  m.barcodeFormat(f);
497
550
  });
@@ -515,7 +568,7 @@ export class zappar_client {
515
568
  if (!s)
516
569
  throw new Error("This object has been destroyed");
517
570
  this._instant_world_tracker_state_by_instance.delete(o);
518
- this.serializer.sendMessage(15, m => {
571
+ this.serializer.sendMessage(19, m => {
519
572
  m.type(o);
520
573
  });
521
574
  },
@@ -552,6 +605,100 @@ export class zappar_client {
552
605
  m.instantTrackerTransformOrientation(orientation);
553
606
  });
554
607
  },
608
+ // #### world_tracker ####
609
+ world_tracker_create: (pipeline) => {
610
+ let newId = (this._latestId++);
611
+ let s = {
612
+ enabled: true,
613
+ plane_count: 0,
614
+ plane_pose: [],
615
+ world_anchor_valid: true,
616
+ world_anchor_pose: new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
617
+ ground_anchor_valid: true,
618
+ ground_anchor_pose: new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
619
+ quality: 0,
620
+ };
621
+ this._world_tracker_state_by_instance.set(newId, s);
622
+ this.serializer.sendMessage(41, m => {
623
+ m.type(newId);
624
+ m.type(pipeline);
625
+ });
626
+ return newId;
627
+ },
628
+ world_tracker_destroy: (o) => {
629
+ let s = this._world_tracker_state_by_instance.get(o);
630
+ if (!s)
631
+ throw new Error("This object has been destroyed");
632
+ this._world_tracker_state_by_instance.delete(o);
633
+ this.serializer.sendMessage(42, m => {
634
+ m.type(o);
635
+ });
636
+ },
637
+ world_tracker_enabled: (o) => {
638
+ let s = this._world_tracker_state_by_instance.get(o);
639
+ if (!s)
640
+ throw new Error("This object has been destroyed");
641
+ return s.enabled;
642
+ },
643
+ world_tracker_enabled_set: (o, enabled) => {
644
+ let s = this._world_tracker_state_by_instance.get(o);
645
+ if (!s)
646
+ throw new Error("This object has been destroyed");
647
+ this.serializer.sendMessage(43, m => {
648
+ m.type(o);
649
+ m.bool(enabled);
650
+ });
651
+ },
652
+ world_tracker_quality: (o) => {
653
+ let s = this._world_tracker_state_by_instance.get(o);
654
+ if (!s)
655
+ throw new Error("This object has been destroyed");
656
+ return s.quality;
657
+ },
658
+ world_tracker_plane_count: (o) => {
659
+ let s = this._world_tracker_state_by_instance.get(o);
660
+ if (!s)
661
+ throw new Error("This object has been destroyed");
662
+ return s.plane_count;
663
+ },
664
+ world_tracker_plane_pose_raw: (o, indx) => {
665
+ let s = this._world_tracker_state_by_instance.get(o);
666
+ if (!s)
667
+ throw new Error("This object has been destroyed");
668
+ return s.plane_pose[indx];
669
+ },
670
+ world_tracker_world_anchor_valid: (o) => {
671
+ let s = this._world_tracker_state_by_instance.get(o);
672
+ if (!s)
673
+ throw new Error("This object has been destroyed");
674
+ return s.world_anchor_valid;
675
+ },
676
+ world_tracker_world_anchor_pose_raw: (o) => {
677
+ let s = this._world_tracker_state_by_instance.get(o);
678
+ if (!s)
679
+ throw new Error("This object has been destroyed");
680
+ return s.world_anchor_pose;
681
+ },
682
+ world_tracker_ground_anchor_valid: (o) => {
683
+ let s = this._world_tracker_state_by_instance.get(o);
684
+ if (!s)
685
+ throw new Error("This object has been destroyed");
686
+ return s.world_anchor_valid;
687
+ },
688
+ world_tracker_ground_anchor_pose_raw: (o) => {
689
+ let s = this._world_tracker_state_by_instance.get(o);
690
+ if (!s)
691
+ throw new Error("This object has been destroyed");
692
+ return s.ground_anchor_pose;
693
+ },
694
+ world_tracker_reset: (o) => {
695
+ let s = this._world_tracker_state_by_instance.get(o);
696
+ if (!s)
697
+ throw new Error("This object has been destroyed");
698
+ this.serializer.sendMessage(44, m => {
699
+ m.type(o);
700
+ });
701
+ },
555
702
  };
556
703
  }
557
704
  processMessages(a) {
@@ -718,6 +865,63 @@ export class zappar_client {
718
865
  inst.pose = msg.matrix4x4();
719
866
  break;
720
867
  }
868
+ case 27: {
869
+ let handle = msg.type();
870
+ let inst = this._world_tracker_state_by_instance.get(handle);
871
+ if (!inst)
872
+ return;
873
+ inst.quality = msg.int();
874
+ break;
875
+ }
876
+ case 21: {
877
+ let handle = msg.type();
878
+ let inst = this._world_tracker_state_by_instance.get(handle);
879
+ if (!inst)
880
+ return;
881
+ inst.plane_count = msg.int();
882
+ break;
883
+ }
884
+ case 22: {
885
+ let handle = msg.type();
886
+ let inst = this._world_tracker_state_by_instance.get(handle);
887
+ if (!inst)
888
+ return;
889
+ let indx = msg.int();
890
+ inst.plane_pose[indx] = msg.matrix4x4();
891
+ break;
892
+ }
893
+ case 23: {
894
+ let handle = msg.type();
895
+ let inst = this._world_tracker_state_by_instance.get(handle);
896
+ if (!inst)
897
+ return;
898
+ inst.world_anchor_valid = msg.bool();
899
+ break;
900
+ }
901
+ case 24: {
902
+ let handle = msg.type();
903
+ let inst = this._world_tracker_state_by_instance.get(handle);
904
+ if (!inst)
905
+ return;
906
+ inst.world_anchor_pose = msg.matrix4x4();
907
+ break;
908
+ }
909
+ case 23: {
910
+ let handle = msg.type();
911
+ let inst = this._world_tracker_state_by_instance.get(handle);
912
+ if (!inst)
913
+ return;
914
+ inst.world_anchor_valid = msg.bool();
915
+ break;
916
+ }
917
+ case 26: {
918
+ let handle = msg.type();
919
+ let inst = this._world_tracker_state_by_instance.get(handle);
920
+ if (!inst)
921
+ return;
922
+ inst.ground_anchor_pose = msg.matrix4x4();
923
+ break;
924
+ }
721
925
  }
722
926
  });
723
927
  }