@zappar/zappar-cv 3.0.1-alpha.16 → 3.0.1-alpha.19

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 (42) hide show
  1. package/README.md +2 -2
  2. package/lib/additional.d.ts +1 -0
  3. package/lib/deserializer.d.ts +4 -1
  4. package/lib/deserializer.js +3 -0
  5. package/lib/drawaxis.js +4 -39
  6. package/lib/gen/zappar-bridge.d.ts +34 -10
  7. package/lib/gen/zappar-bridge.js +3 -0
  8. package/lib/gen/zappar-client.d.ts +1 -0
  9. package/lib/gen/zappar-client.js +238 -48
  10. package/lib/gen/zappar-cwrap.js +164 -38
  11. package/lib/gen/zappar-native.d.ts +46 -12
  12. package/lib/gen/zappar-native.js +23 -1
  13. package/lib/gen/zappar-server.d.ts +3 -0
  14. package/lib/gen/zappar-server.js +128 -28
  15. package/lib/gen/zappar.d.ts +41 -12
  16. package/lib/gen/zappar.js +3 -0
  17. package/lib/html-element-source.d.ts +1 -0
  18. package/lib/html-element-source.js +5 -1
  19. package/lib/index.d.ts +1 -1
  20. package/lib/index.js +1 -1
  21. package/lib/mstp-camera-source.js +2 -1
  22. package/lib/native.js +48 -4
  23. package/lib/permission.js +35 -9
  24. package/lib/pipeline.d.ts +1 -1
  25. package/lib/pipeline.js +3 -2
  26. package/lib/sequencesource.js +1 -1
  27. package/lib/serializer.d.ts +4 -1
  28. package/lib/serializer.js +3 -0
  29. package/lib/tr.js +1 -1
  30. package/lib/version.d.ts +1 -1
  31. package/lib/version.js +1 -1
  32. package/lib/worker-imagebitmap.js +1 -1
  33. package/lib/worker-server.js +2 -2
  34. package/lib/workerinterface.d.ts +1 -0
  35. package/lib/zappar-cv.js +1 -1
  36. package/lib/zappar-cv.wasm +0 -0
  37. package/package.json +1 -1
  38. package/umd/{6cf17bab4f58a189fc94.wasm → 3c548945c91fd14a0d90.wasm} +0 -0
  39. package/umd/751.zappar-cv.js +1 -1
  40. package/umd/867.zappar-cv.js +1 -1
  41. package/umd/zappar-cv.js +1 -1
  42. package/umd/zappar-cv.worker.js +1 -1
@@ -22,6 +22,7 @@ export class zappar_client {
22
22
  this._instant_world_tracker_state_by_instance = new Map();
23
23
  this._zapcode_tracker_state_by_instance = new Map();
24
24
  this._world_tracker_state_by_instance = new Map();
25
+ this._custom_anchor_state_by_instance = new Map();
25
26
  this.impl = {
26
27
  log_level: () => {
27
28
  return this._globalState.log_level;
@@ -89,7 +90,7 @@ export class zappar_client {
89
90
  throw new Error("This object has been destroyed");
90
91
  return s.current_frame_user_data;
91
92
  },
92
- pipeline_camera_frame_submit: (o, data, width, height, user_data, camera_to_device_transform, camera_model, user_facing) => {
93
+ pipeline_camera_frame_submit: (o, data, width, height, user_data, camera_to_device_transform, camera_model, user_facing, timestampSeconds) => {
93
94
  let s = this._pipeline_state_by_instance.get(o);
94
95
  if (!s)
95
96
  throw new Error("This object has been destroyed");
@@ -102,6 +103,7 @@ export class zappar_client {
102
103
  m.matrix4x4(camera_to_device_transform);
103
104
  m.cameraModel(camera_model);
104
105
  m.bool(user_facing);
106
+ m.float(timestampSeconds);
105
107
  });
106
108
  },
107
109
  pipeline_camera_frame_camera_attitude: (o) => {
@@ -680,16 +682,22 @@ export class zappar_client {
680
682
  let newId = (this._latestId++);
681
683
  let s = {
682
684
  enabled: true,
683
- plane_detection_enabled: true,
684
- plane_count: 0,
685
- plane_pose: [],
686
- plane_visible: [],
687
- plane_polygon_data: [],
688
- plane_polygon_data_size: [],
689
- world_anchor_valid: false,
685
+ horizontal_plane_detection_enabled: true,
686
+ vertical_plane_detection_enabled: false,
687
+ plane_anchor_count: 0,
688
+ plane_anchor_pose: [],
689
+ plane_anchor_status: [],
690
+ plane_anchor_polygon_version: [],
691
+ plane_anchor_polygon_data: [],
692
+ plane_anchor_polygon_data_size: [],
693
+ plane_anchor_id: [],
694
+ plane_anchor_orientation: [],
695
+ world_anchor_status: 0,
690
696
  world_anchor_pose: new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
691
- ground_anchor_valid: false,
697
+ world_anchor_id: '',
698
+ ground_anchor_status: 0,
692
699
  ground_anchor_pose: new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
700
+ ground_anchor_id: '',
693
701
  tracks_data_enabled: false,
694
702
  tracks_data: new Float32Array([]),
695
703
  tracks_data_size: 0,
@@ -737,56 +745,95 @@ export class zappar_client {
737
745
  throw new Error("This object has been destroyed");
738
746
  return s.quality;
739
747
  },
740
- world_tracker_plane_detection_enabled: (o) => {
748
+ world_tracker_horizontal_plane_detection_enabled: (o) => {
741
749
  let s = this._world_tracker_state_by_instance.get(o);
742
750
  if (!s)
743
751
  throw new Error("This object has been destroyed");
744
- return s.plane_detection_enabled;
752
+ return s.horizontal_plane_detection_enabled;
745
753
  },
746
- world_tracker_plane_detection_enabled_set: (o, plane_detection_enabled) => {
754
+ world_tracker_horizontal_plane_detection_enabled_set: (o, horizontal_plane_detection_enabled) => {
747
755
  let s = this._world_tracker_state_by_instance.get(o);
748
756
  if (!s)
749
757
  throw new Error("This object has been destroyed");
750
758
  this.serializer.sendMessage(48, m => {
751
759
  m.type(o);
752
- m.bool(plane_detection_enabled);
760
+ m.bool(horizontal_plane_detection_enabled);
753
761
  });
754
762
  },
755
- world_tracker_plane_count: (o) => {
763
+ world_tracker_vertical_plane_detection_enabled: (o) => {
756
764
  let s = this._world_tracker_state_by_instance.get(o);
757
765
  if (!s)
758
766
  throw new Error("This object has been destroyed");
759
- return s.plane_count;
767
+ return s.vertical_plane_detection_enabled;
760
768
  },
761
- world_tracker_plane_pose_raw: (o, indx) => {
769
+ world_tracker_vertical_plane_detection_enabled_set: (o, vertical_plane_detection_enabled) => {
762
770
  let s = this._world_tracker_state_by_instance.get(o);
763
771
  if (!s)
764
772
  throw new Error("This object has been destroyed");
765
- return s.plane_pose[indx];
773
+ this.serializer.sendMessage(49, m => {
774
+ m.type(o);
775
+ m.bool(vertical_plane_detection_enabled);
776
+ });
777
+ },
778
+ world_tracker_plane_anchor_count: (o) => {
779
+ let s = this._world_tracker_state_by_instance.get(o);
780
+ if (!s)
781
+ throw new Error("This object has been destroyed");
782
+ return s.plane_anchor_count;
783
+ },
784
+ world_tracker_plane_anchor_id: (o, indx) => {
785
+ let s = this._world_tracker_state_by_instance.get(o);
786
+ if (!s)
787
+ throw new Error("This object has been destroyed");
788
+ return s.plane_anchor_id[indx];
789
+ },
790
+ world_tracker_plane_anchor_pose_raw: (o, indx) => {
791
+ let s = this._world_tracker_state_by_instance.get(o);
792
+ if (!s)
793
+ throw new Error("This object has been destroyed");
794
+ return s.plane_anchor_pose[indx];
795
+ },
796
+ world_tracker_plane_anchor_status: (o, indx) => {
797
+ let s = this._world_tracker_state_by_instance.get(o);
798
+ if (!s)
799
+ throw new Error("This object has been destroyed");
800
+ return s.plane_anchor_status[indx];
766
801
  },
767
- world_tracker_plane_visible: (o, indx) => {
802
+ world_tracker_plane_anchor_polygon_data_size: (o, indx) => {
768
803
  let s = this._world_tracker_state_by_instance.get(o);
769
804
  if (!s)
770
805
  throw new Error("This object has been destroyed");
771
- return s.plane_visible[indx];
806
+ return s.plane_anchor_polygon_data_size[indx];
772
807
  },
773
- world_tracker_plane_polygon_data_size: (o, indx) => {
808
+ world_tracker_plane_anchor_polygon_data: (o, indx) => {
774
809
  let s = this._world_tracker_state_by_instance.get(o);
775
810
  if (!s)
776
811
  throw new Error("This object has been destroyed");
777
- return s.plane_polygon_data_size[indx];
812
+ return s.plane_anchor_polygon_data[indx];
778
813
  },
779
- world_tracker_plane_polygon_data: (o, indx) => {
814
+ world_tracker_plane_anchor_polygon_version: (o, indx) => {
780
815
  let s = this._world_tracker_state_by_instance.get(o);
781
816
  if (!s)
782
817
  throw new Error("This object has been destroyed");
783
- return s.plane_polygon_data[indx];
818
+ return s.plane_anchor_polygon_version[indx];
784
819
  },
785
- world_tracker_world_anchor_valid: (o) => {
820
+ world_tracker_plane_anchor_orientation: (o, indx) => {
786
821
  let s = this._world_tracker_state_by_instance.get(o);
787
822
  if (!s)
788
823
  throw new Error("This object has been destroyed");
789
- return s.world_anchor_valid;
824
+ return s.plane_anchor_orientation[indx];
825
+ },
826
+ world_tracker_world_anchor_status: (o) => {
827
+ let s = this._world_tracker_state_by_instance.get(o);
828
+ if (!s)
829
+ throw new Error("This object has been destroyed");
830
+ return s.world_anchor_status;
831
+ },
832
+ world_tracker_world_anchor_id: (o) => {
833
+ let s = this._world_tracker_state_by_instance.get(o);
834
+ if (!s)
835
+ throw new Error("This object has been destroyed");
836
+ return s.world_anchor_id;
790
837
  },
791
838
  world_tracker_world_anchor_pose_raw: (o) => {
792
839
  let s = this._world_tracker_state_by_instance.get(o);
@@ -794,11 +841,17 @@ export class zappar_client {
794
841
  throw new Error("This object has been destroyed");
795
842
  return s.world_anchor_pose;
796
843
  },
797
- world_tracker_ground_anchor_valid: (o) => {
844
+ world_tracker_ground_anchor_id: (o) => {
845
+ let s = this._world_tracker_state_by_instance.get(o);
846
+ if (!s)
847
+ throw new Error("This object has been destroyed");
848
+ return s.ground_anchor_id;
849
+ },
850
+ world_tracker_ground_anchor_status: (o) => {
798
851
  let s = this._world_tracker_state_by_instance.get(o);
799
852
  if (!s)
800
853
  throw new Error("This object has been destroyed");
801
- return s.world_anchor_valid;
854
+ return s.ground_anchor_status;
802
855
  },
803
856
  world_tracker_ground_anchor_pose_raw: (o) => {
804
857
  let s = this._world_tracker_state_by_instance.get(o);
@@ -810,7 +863,7 @@ export class zappar_client {
810
863
  let s = this._world_tracker_state_by_instance.get(o);
811
864
  if (!s)
812
865
  throw new Error("This object has been destroyed");
813
- this.serializer.sendMessage(49, m => {
866
+ this.serializer.sendMessage(50, m => {
814
867
  m.type(o);
815
868
  });
816
869
  },
@@ -824,7 +877,7 @@ export class zappar_client {
824
877
  let s = this._world_tracker_state_by_instance.get(o);
825
878
  if (!s)
826
879
  throw new Error("This object has been destroyed");
827
- this.serializer.sendMessage(50, m => {
880
+ this.serializer.sendMessage(51, m => {
828
881
  m.type(o);
829
882
  m.bool(tracks_data_enabled);
830
883
  });
@@ -863,7 +916,7 @@ export class zappar_client {
863
916
  let s = this._world_tracker_state_by_instance.get(o);
864
917
  if (!s)
865
918
  throw new Error("This object has been destroyed");
866
- this.serializer.sendMessage(51, m => {
919
+ this.serializer.sendMessage(52, m => {
867
920
  m.type(o);
868
921
  m.bool(projections_data_enabled);
869
922
  });
@@ -880,6 +933,84 @@ export class zappar_client {
880
933
  throw new Error("This object has been destroyed");
881
934
  return s.projections_data;
882
935
  },
936
+ // #### custom_anchor ####
937
+ custom_anchor_create: (pipeline, worldtracker, id) => {
938
+ let newId = (this._latestId++);
939
+ let s = {
940
+ enabled: true,
941
+ pose: new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
942
+ status: 0,
943
+ };
944
+ this._custom_anchor_state_by_instance.set(newId, s);
945
+ this.serializer.sendMessage(53, m => {
946
+ m.type(newId);
947
+ m.type(pipeline);
948
+ m.type(worldtracker);
949
+ m.string(id);
950
+ });
951
+ return newId;
952
+ },
953
+ custom_anchor_destroy: (o) => {
954
+ let s = this._custom_anchor_state_by_instance.get(o);
955
+ if (!s)
956
+ throw new Error("This object has been destroyed");
957
+ this._custom_anchor_state_by_instance.delete(o);
958
+ this.serializer.sendMessage(54, m => {
959
+ m.type(o);
960
+ });
961
+ },
962
+ custom_anchor_status: (o) => {
963
+ let s = this._custom_anchor_state_by_instance.get(o);
964
+ if (!s)
965
+ throw new Error("This object has been destroyed");
966
+ return s.status;
967
+ },
968
+ custom_anchor_enabled_set: (o, enabled) => {
969
+ let s = this._custom_anchor_state_by_instance.get(o);
970
+ if (!s)
971
+ throw new Error("This object has been destroyed");
972
+ this.serializer.sendMessage(55, m => {
973
+ m.type(o);
974
+ m.bool(enabled);
975
+ });
976
+ },
977
+ custom_anchor_enabled: (o) => {
978
+ let s = this._custom_anchor_state_by_instance.get(o);
979
+ if (!s)
980
+ throw new Error("This object has been destroyed");
981
+ return s.enabled;
982
+ },
983
+ custom_anchor_pose_raw: (o) => {
984
+ let s = this._custom_anchor_state_by_instance.get(o);
985
+ if (!s)
986
+ throw new Error("This object has been destroyed");
987
+ return s.pose;
988
+ },
989
+ custom_anchor_pose_set_from_camera_offset_raw: (o, x, y, z, orientation) => {
990
+ let s = this._custom_anchor_state_by_instance.get(o);
991
+ if (!s)
992
+ throw new Error("This object has been destroyed");
993
+ this.serializer.sendMessage(56, m => {
994
+ m.type(o);
995
+ m.float(x);
996
+ m.float(y);
997
+ m.float(z);
998
+ m.transformOrientation(orientation);
999
+ });
1000
+ },
1001
+ custom_anchor_pose_set_from_anchor_offset: (o, anchor_id, x, y, z, orientation) => {
1002
+ let s = this._custom_anchor_state_by_instance.get(o);
1003
+ if (!s)
1004
+ throw new Error("This object has been destroyed");
1005
+ this.serializer.sendMessage(57, m => {
1006
+ m.type(o);
1007
+ m.string(anchor_id);
1008
+ m.float(x);
1009
+ m.float(y);
1010
+ m.float(z);
1011
+ m.transformOrientation(orientation);
1012
+ });
1013
+ },
883
1014
  };
884
1015
  }
885
1016
  processMessages(a) {
@@ -1080,7 +1211,7 @@ export class zappar_client {
1080
1211
  inst.anchor_pose[indx] = msg.matrix4x4();
1081
1212
  break;
1082
1213
  }
1083
- case 34: {
1214
+ case 40: {
1084
1215
  let handle = msg.type();
1085
1216
  let inst = this._world_tracker_state_by_instance.get(handle);
1086
1217
  if (!inst)
@@ -1093,25 +1224,25 @@ export class zappar_client {
1093
1224
  let inst = this._world_tracker_state_by_instance.get(handle);
1094
1225
  if (!inst)
1095
1226
  return;
1096
- inst.plane_count = msg.int();
1227
+ inst.plane_anchor_count = msg.int();
1097
1228
  break;
1098
1229
  }
1099
- case 26: {
1230
+ case 33: {
1100
1231
  let handle = msg.type();
1101
1232
  let inst = this._world_tracker_state_by_instance.get(handle);
1102
1233
  if (!inst)
1103
1234
  return;
1104
1235
  let indx = msg.int();
1105
- inst.plane_pose[indx] = msg.matrix4x4();
1236
+ inst.plane_anchor_id[indx] = msg.string();
1106
1237
  break;
1107
1238
  }
1108
- case 27: {
1239
+ case 26: {
1109
1240
  let handle = msg.type();
1110
1241
  let inst = this._world_tracker_state_by_instance.get(handle);
1111
1242
  if (!inst)
1112
1243
  return;
1113
1244
  let indx = msg.int();
1114
- inst.plane_visible[indx] = msg.bool();
1245
+ inst.plane_anchor_pose[indx] = msg.matrix4x4();
1115
1246
  break;
1116
1247
  }
1117
1248
  case 28: {
@@ -1120,7 +1251,7 @@ export class zappar_client {
1120
1251
  if (!inst)
1121
1252
  return;
1122
1253
  let indx = msg.int();
1123
- inst.plane_polygon_data_size[indx] = msg.int();
1254
+ inst.plane_anchor_status[indx] = msg.anchorStatus();
1124
1255
  break;
1125
1256
  }
1126
1257
  case 29: {
@@ -1129,7 +1260,7 @@ export class zappar_client {
1129
1260
  if (!inst)
1130
1261
  return;
1131
1262
  let indx = msg.int();
1132
- inst.plane_polygon_data[indx] = msg.floatArray();
1263
+ inst.plane_anchor_polygon_data_size[indx] = msg.int();
1133
1264
  break;
1134
1265
  }
1135
1266
  case 30: {
@@ -1137,10 +1268,45 @@ export class zappar_client {
1137
1268
  let inst = this._world_tracker_state_by_instance.get(handle);
1138
1269
  if (!inst)
1139
1270
  return;
1140
- inst.world_anchor_valid = msg.bool();
1271
+ let indx = msg.int();
1272
+ inst.plane_anchor_polygon_data[indx] = msg.floatArray();
1141
1273
  break;
1142
1274
  }
1143
1275
  case 31: {
1276
+ let handle = msg.type();
1277
+ let inst = this._world_tracker_state_by_instance.get(handle);
1278
+ if (!inst)
1279
+ return;
1280
+ let indx = msg.int();
1281
+ inst.plane_anchor_polygon_version[indx] = msg.int();
1282
+ break;
1283
+ }
1284
+ case 32: {
1285
+ let handle = msg.type();
1286
+ let inst = this._world_tracker_state_by_instance.get(handle);
1287
+ if (!inst)
1288
+ return;
1289
+ let indx = msg.int();
1290
+ inst.plane_anchor_orientation[indx] = msg.planeOrientation();
1291
+ break;
1292
+ }
1293
+ case 36: {
1294
+ let handle = msg.type();
1295
+ let inst = this._world_tracker_state_by_instance.get(handle);
1296
+ if (!inst)
1297
+ return;
1298
+ inst.world_anchor_status = msg.anchorStatus();
1299
+ break;
1300
+ }
1301
+ case 35: {
1302
+ let handle = msg.type();
1303
+ let inst = this._world_tracker_state_by_instance.get(handle);
1304
+ if (!inst)
1305
+ return;
1306
+ inst.world_anchor_id = msg.string();
1307
+ break;
1308
+ }
1309
+ case 34: {
1144
1310
  let handle = msg.type();
1145
1311
  let inst = this._world_tracker_state_by_instance.get(handle);
1146
1312
  if (!inst)
@@ -1148,23 +1314,31 @@ export class zappar_client {
1148
1314
  inst.world_anchor_pose = msg.matrix4x4();
1149
1315
  break;
1150
1316
  }
1151
- case 30: {
1317
+ case 38: {
1152
1318
  let handle = msg.type();
1153
1319
  let inst = this._world_tracker_state_by_instance.get(handle);
1154
1320
  if (!inst)
1155
1321
  return;
1156
- inst.world_anchor_valid = msg.bool();
1322
+ inst.ground_anchor_id = msg.string();
1157
1323
  break;
1158
1324
  }
1159
- case 33: {
1325
+ case 39: {
1160
1326
  let handle = msg.type();
1161
1327
  let inst = this._world_tracker_state_by_instance.get(handle);
1162
1328
  if (!inst)
1163
1329
  return;
1164
- inst.ground_anchor_pose = msg.matrix4x4();
1330
+ inst.ground_anchor_status = msg.anchorStatus();
1165
1331
  break;
1166
1332
  }
1167
1333
  case 37: {
1334
+ let handle = msg.type();
1335
+ let inst = this._world_tracker_state_by_instance.get(handle);
1336
+ if (!inst)
1337
+ return;
1338
+ inst.ground_anchor_pose = msg.matrix4x4();
1339
+ break;
1340
+ }
1341
+ case 43: {
1168
1342
  let handle = msg.type();
1169
1343
  let inst = this._world_tracker_state_by_instance.get(handle);
1170
1344
  if (!inst)
@@ -1172,7 +1346,7 @@ export class zappar_client {
1172
1346
  inst.tracks_data_size = msg.int();
1173
1347
  break;
1174
1348
  }
1175
- case 36: {
1349
+ case 42: {
1176
1350
  let handle = msg.type();
1177
1351
  let inst = this._world_tracker_state_by_instance.get(handle);
1178
1352
  if (!inst)
@@ -1180,7 +1354,7 @@ export class zappar_client {
1180
1354
  inst.tracks_data = msg.floatArray();
1181
1355
  break;
1182
1356
  }
1183
- case 39: {
1357
+ case 45: {
1184
1358
  let handle = msg.type();
1185
1359
  let inst = this._world_tracker_state_by_instance.get(handle);
1186
1360
  if (!inst)
@@ -1188,7 +1362,7 @@ export class zappar_client {
1188
1362
  inst.tracks_type_data_size = msg.int();
1189
1363
  break;
1190
1364
  }
1191
- case 38: {
1365
+ case 44: {
1192
1366
  let handle = msg.type();
1193
1367
  let inst = this._world_tracker_state_by_instance.get(handle);
1194
1368
  if (!inst)
@@ -1196,7 +1370,7 @@ export class zappar_client {
1196
1370
  inst.tracks_type_data = msg.ucharArray();
1197
1371
  break;
1198
1372
  }
1199
- case 42: {
1373
+ case 48: {
1200
1374
  let handle = msg.type();
1201
1375
  let inst = this._world_tracker_state_by_instance.get(handle);
1202
1376
  if (!inst)
@@ -1204,7 +1378,7 @@ export class zappar_client {
1204
1378
  inst.projections_data_size = msg.int();
1205
1379
  break;
1206
1380
  }
1207
- case 41: {
1381
+ case 47: {
1208
1382
  let handle = msg.type();
1209
1383
  let inst = this._world_tracker_state_by_instance.get(handle);
1210
1384
  if (!inst)
@@ -1212,6 +1386,22 @@ export class zappar_client {
1212
1386
  inst.projections_data = msg.floatArray();
1213
1387
  break;
1214
1388
  }
1389
+ case 50: {
1390
+ let handle = msg.type();
1391
+ let inst = this._custom_anchor_state_by_instance.get(handle);
1392
+ if (!inst)
1393
+ return;
1394
+ inst.status = msg.anchorStatus();
1395
+ break;
1396
+ }
1397
+ case 49: {
1398
+ let handle = msg.type();
1399
+ let inst = this._custom_anchor_state_by_instance.get(handle);
1400
+ if (!inst)
1401
+ return;
1402
+ inst.pose = msg.matrix4x4();
1403
+ break;
1404
+ }
1215
1405
  }
1216
1406
  });
1217
1407
  }