@zappar/zappar-cv 3.0.1-alpha.15 → 3.0.1-alpha.17

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.
@@ -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;
@@ -680,13 +681,22 @@ export class zappar_client {
680
681
  let newId = (this._latestId++);
681
682
  let s = {
682
683
  enabled: true,
683
- plane_detection_enabled: true,
684
- plane_count: 0,
685
- plane_pose: [],
686
- world_anchor_valid: false,
684
+ horizontal_plane_detection_enabled: true,
685
+ vertical_plane_detection_enabled: false,
686
+ plane_anchor_count: 0,
687
+ plane_anchor_pose: [],
688
+ plane_anchor_status: [],
689
+ plane_anchor_polygon_version: [],
690
+ plane_anchor_polygon_data: [],
691
+ plane_anchor_polygon_data_size: [],
692
+ plane_anchor_id: [],
693
+ plane_anchor_orientation: [],
694
+ world_anchor_status: 0,
687
695
  world_anchor_pose: new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
688
- ground_anchor_valid: false,
696
+ world_anchor_id: '',
697
+ ground_anchor_status: 0,
689
698
  ground_anchor_pose: new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
699
+ ground_anchor_id: '',
690
700
  tracks_data_enabled: false,
691
701
  tracks_data: new Float32Array([]),
692
702
  tracks_data_size: 0,
@@ -734,38 +744,95 @@ export class zappar_client {
734
744
  throw new Error("This object has been destroyed");
735
745
  return s.quality;
736
746
  },
737
- world_tracker_plane_detection_enabled: (o) => {
747
+ world_tracker_horizontal_plane_detection_enabled: (o) => {
738
748
  let s = this._world_tracker_state_by_instance.get(o);
739
749
  if (!s)
740
750
  throw new Error("This object has been destroyed");
741
- return s.plane_detection_enabled;
751
+ return s.horizontal_plane_detection_enabled;
742
752
  },
743
- world_tracker_plane_detection_enabled_set: (o, plane_detection_enabled) => {
753
+ world_tracker_horizontal_plane_detection_enabled_set: (o, horizontal_plane_detection_enabled) => {
744
754
  let s = this._world_tracker_state_by_instance.get(o);
745
755
  if (!s)
746
756
  throw new Error("This object has been destroyed");
747
757
  this.serializer.sendMessage(48, m => {
748
758
  m.type(o);
749
- m.bool(plane_detection_enabled);
759
+ m.bool(horizontal_plane_detection_enabled);
750
760
  });
751
761
  },
752
- world_tracker_plane_count: (o) => {
762
+ world_tracker_vertical_plane_detection_enabled: (o) => {
753
763
  let s = this._world_tracker_state_by_instance.get(o);
754
764
  if (!s)
755
765
  throw new Error("This object has been destroyed");
756
- return s.plane_count;
766
+ return s.vertical_plane_detection_enabled;
757
767
  },
758
- world_tracker_plane_pose_raw: (o, indx) => {
768
+ world_tracker_vertical_plane_detection_enabled_set: (o, vertical_plane_detection_enabled) => {
759
769
  let s = this._world_tracker_state_by_instance.get(o);
760
770
  if (!s)
761
771
  throw new Error("This object has been destroyed");
762
- return s.plane_pose[indx];
772
+ this.serializer.sendMessage(49, m => {
773
+ m.type(o);
774
+ m.bool(vertical_plane_detection_enabled);
775
+ });
776
+ },
777
+ world_tracker_plane_anchor_count: (o) => {
778
+ let s = this._world_tracker_state_by_instance.get(o);
779
+ if (!s)
780
+ throw new Error("This object has been destroyed");
781
+ return s.plane_anchor_count;
782
+ },
783
+ world_tracker_plane_anchor_id: (o, indx) => {
784
+ let s = this._world_tracker_state_by_instance.get(o);
785
+ if (!s)
786
+ throw new Error("This object has been destroyed");
787
+ return s.plane_anchor_id[indx];
788
+ },
789
+ world_tracker_plane_anchor_pose_raw: (o, indx) => {
790
+ let s = this._world_tracker_state_by_instance.get(o);
791
+ if (!s)
792
+ throw new Error("This object has been destroyed");
793
+ return s.plane_anchor_pose[indx];
794
+ },
795
+ world_tracker_plane_anchor_status: (o, indx) => {
796
+ let s = this._world_tracker_state_by_instance.get(o);
797
+ if (!s)
798
+ throw new Error("This object has been destroyed");
799
+ return s.plane_anchor_status[indx];
800
+ },
801
+ world_tracker_plane_anchor_polygon_data_size: (o, indx) => {
802
+ let s = this._world_tracker_state_by_instance.get(o);
803
+ if (!s)
804
+ throw new Error("This object has been destroyed");
805
+ return s.plane_anchor_polygon_data_size[indx];
763
806
  },
764
- world_tracker_world_anchor_valid: (o) => {
807
+ world_tracker_plane_anchor_polygon_data: (o, indx) => {
765
808
  let s = this._world_tracker_state_by_instance.get(o);
766
809
  if (!s)
767
810
  throw new Error("This object has been destroyed");
768
- return s.world_anchor_valid;
811
+ return s.plane_anchor_polygon_data[indx];
812
+ },
813
+ world_tracker_plane_anchor_polygon_version: (o, indx) => {
814
+ let s = this._world_tracker_state_by_instance.get(o);
815
+ if (!s)
816
+ throw new Error("This object has been destroyed");
817
+ return s.plane_anchor_polygon_version[indx];
818
+ },
819
+ world_tracker_plane_anchor_orientation: (o, indx) => {
820
+ let s = this._world_tracker_state_by_instance.get(o);
821
+ if (!s)
822
+ throw new Error("This object has been destroyed");
823
+ return s.plane_anchor_orientation[indx];
824
+ },
825
+ world_tracker_world_anchor_status: (o) => {
826
+ let s = this._world_tracker_state_by_instance.get(o);
827
+ if (!s)
828
+ throw new Error("This object has been destroyed");
829
+ return s.world_anchor_status;
830
+ },
831
+ world_tracker_world_anchor_id: (o) => {
832
+ let s = this._world_tracker_state_by_instance.get(o);
833
+ if (!s)
834
+ throw new Error("This object has been destroyed");
835
+ return s.world_anchor_id;
769
836
  },
770
837
  world_tracker_world_anchor_pose_raw: (o) => {
771
838
  let s = this._world_tracker_state_by_instance.get(o);
@@ -773,11 +840,17 @@ export class zappar_client {
773
840
  throw new Error("This object has been destroyed");
774
841
  return s.world_anchor_pose;
775
842
  },
776
- world_tracker_ground_anchor_valid: (o) => {
843
+ world_tracker_ground_anchor_id: (o) => {
777
844
  let s = this._world_tracker_state_by_instance.get(o);
778
845
  if (!s)
779
846
  throw new Error("This object has been destroyed");
780
- return s.world_anchor_valid;
847
+ return s.ground_anchor_id;
848
+ },
849
+ world_tracker_ground_anchor_status: (o) => {
850
+ let s = this._world_tracker_state_by_instance.get(o);
851
+ if (!s)
852
+ throw new Error("This object has been destroyed");
853
+ return s.ground_anchor_status;
781
854
  },
782
855
  world_tracker_ground_anchor_pose_raw: (o) => {
783
856
  let s = this._world_tracker_state_by_instance.get(o);
@@ -789,7 +862,7 @@ export class zappar_client {
789
862
  let s = this._world_tracker_state_by_instance.get(o);
790
863
  if (!s)
791
864
  throw new Error("This object has been destroyed");
792
- this.serializer.sendMessage(49, m => {
865
+ this.serializer.sendMessage(50, m => {
793
866
  m.type(o);
794
867
  });
795
868
  },
@@ -803,7 +876,7 @@ export class zappar_client {
803
876
  let s = this._world_tracker_state_by_instance.get(o);
804
877
  if (!s)
805
878
  throw new Error("This object has been destroyed");
806
- this.serializer.sendMessage(50, m => {
879
+ this.serializer.sendMessage(51, m => {
807
880
  m.type(o);
808
881
  m.bool(tracks_data_enabled);
809
882
  });
@@ -842,7 +915,7 @@ export class zappar_client {
842
915
  let s = this._world_tracker_state_by_instance.get(o);
843
916
  if (!s)
844
917
  throw new Error("This object has been destroyed");
845
- this.serializer.sendMessage(51, m => {
918
+ this.serializer.sendMessage(52, m => {
846
919
  m.type(o);
847
920
  m.bool(projections_data_enabled);
848
921
  });
@@ -859,6 +932,84 @@ export class zappar_client {
859
932
  throw new Error("This object has been destroyed");
860
933
  return s.projections_data;
861
934
  },
935
+ // #### custom_anchor ####
936
+ custom_anchor_create: (pipeline, worldtracker, id) => {
937
+ let newId = (this._latestId++);
938
+ let s = {
939
+ enabled: true,
940
+ pose: new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
941
+ status: 0,
942
+ };
943
+ this._custom_anchor_state_by_instance.set(newId, s);
944
+ this.serializer.sendMessage(53, m => {
945
+ m.type(newId);
946
+ m.type(pipeline);
947
+ m.type(worldtracker);
948
+ m.string(id);
949
+ });
950
+ return newId;
951
+ },
952
+ custom_anchor_destroy: (o) => {
953
+ let s = this._custom_anchor_state_by_instance.get(o);
954
+ if (!s)
955
+ throw new Error("This object has been destroyed");
956
+ this._custom_anchor_state_by_instance.delete(o);
957
+ this.serializer.sendMessage(54, m => {
958
+ m.type(o);
959
+ });
960
+ },
961
+ custom_anchor_status: (o) => {
962
+ let s = this._custom_anchor_state_by_instance.get(o);
963
+ if (!s)
964
+ throw new Error("This object has been destroyed");
965
+ return s.status;
966
+ },
967
+ custom_anchor_enabled_set: (o, enabled) => {
968
+ let s = this._custom_anchor_state_by_instance.get(o);
969
+ if (!s)
970
+ throw new Error("This object has been destroyed");
971
+ this.serializer.sendMessage(55, m => {
972
+ m.type(o);
973
+ m.bool(enabled);
974
+ });
975
+ },
976
+ custom_anchor_enabled: (o) => {
977
+ let s = this._custom_anchor_state_by_instance.get(o);
978
+ if (!s)
979
+ throw new Error("This object has been destroyed");
980
+ return s.enabled;
981
+ },
982
+ custom_anchor_pose_raw: (o) => {
983
+ let s = this._custom_anchor_state_by_instance.get(o);
984
+ if (!s)
985
+ throw new Error("This object has been destroyed");
986
+ return s.pose;
987
+ },
988
+ custom_anchor_pose_set_from_camera_offset_raw: (o, x, y, z, orientation) => {
989
+ let s = this._custom_anchor_state_by_instance.get(o);
990
+ if (!s)
991
+ throw new Error("This object has been destroyed");
992
+ this.serializer.sendMessage(56, m => {
993
+ m.type(o);
994
+ m.float(x);
995
+ m.float(y);
996
+ m.float(z);
997
+ m.transformOrientation(orientation);
998
+ });
999
+ },
1000
+ custom_anchor_pose_set_from_anchor_offset: (o, anchor_id, x, y, z, orientation) => {
1001
+ let s = this._custom_anchor_state_by_instance.get(o);
1002
+ if (!s)
1003
+ throw new Error("This object has been destroyed");
1004
+ this.serializer.sendMessage(57, m => {
1005
+ m.type(o);
1006
+ m.string(anchor_id);
1007
+ m.float(x);
1008
+ m.float(y);
1009
+ m.float(z);
1010
+ m.transformOrientation(orientation);
1011
+ });
1012
+ },
862
1013
  };
863
1014
  }
864
1015
  processMessages(a) {
@@ -1059,7 +1210,7 @@ export class zappar_client {
1059
1210
  inst.anchor_pose[indx] = msg.matrix4x4();
1060
1211
  break;
1061
1212
  }
1062
- case 31: {
1213
+ case 40: {
1063
1214
  let handle = msg.type();
1064
1215
  let inst = this._world_tracker_state_by_instance.get(handle);
1065
1216
  if (!inst)
@@ -1072,24 +1223,25 @@ export class zappar_client {
1072
1223
  let inst = this._world_tracker_state_by_instance.get(handle);
1073
1224
  if (!inst)
1074
1225
  return;
1075
- inst.plane_count = msg.int();
1226
+ inst.plane_anchor_count = msg.int();
1076
1227
  break;
1077
1228
  }
1078
- case 26: {
1229
+ case 33: {
1079
1230
  let handle = msg.type();
1080
1231
  let inst = this._world_tracker_state_by_instance.get(handle);
1081
1232
  if (!inst)
1082
1233
  return;
1083
1234
  let indx = msg.int();
1084
- inst.plane_pose[indx] = msg.matrix4x4();
1235
+ inst.plane_anchor_id[indx] = msg.string();
1085
1236
  break;
1086
1237
  }
1087
- case 27: {
1238
+ case 26: {
1088
1239
  let handle = msg.type();
1089
1240
  let inst = this._world_tracker_state_by_instance.get(handle);
1090
1241
  if (!inst)
1091
1242
  return;
1092
- inst.world_anchor_valid = msg.bool();
1243
+ let indx = msg.int();
1244
+ inst.plane_anchor_pose[indx] = msg.matrix4x4();
1093
1245
  break;
1094
1246
  }
1095
1247
  case 28: {
@@ -1097,15 +1249,17 @@ export class zappar_client {
1097
1249
  let inst = this._world_tracker_state_by_instance.get(handle);
1098
1250
  if (!inst)
1099
1251
  return;
1100
- inst.world_anchor_pose = msg.matrix4x4();
1252
+ let indx = msg.int();
1253
+ inst.plane_anchor_status[indx] = msg.anchorStatus();
1101
1254
  break;
1102
1255
  }
1103
- case 27: {
1256
+ case 29: {
1104
1257
  let handle = msg.type();
1105
1258
  let inst = this._world_tracker_state_by_instance.get(handle);
1106
1259
  if (!inst)
1107
1260
  return;
1108
- inst.world_anchor_valid = msg.bool();
1261
+ let indx = msg.int();
1262
+ inst.plane_anchor_polygon_data_size[indx] = msg.int();
1109
1263
  break;
1110
1264
  }
1111
1265
  case 30: {
@@ -1113,10 +1267,77 @@ export class zappar_client {
1113
1267
  let inst = this._world_tracker_state_by_instance.get(handle);
1114
1268
  if (!inst)
1115
1269
  return;
1116
- inst.ground_anchor_pose = msg.matrix4x4();
1270
+ let indx = msg.int();
1271
+ inst.plane_anchor_polygon_data[indx] = msg.floatArray();
1272
+ break;
1273
+ }
1274
+ case 31: {
1275
+ let handle = msg.type();
1276
+ let inst = this._world_tracker_state_by_instance.get(handle);
1277
+ if (!inst)
1278
+ return;
1279
+ let indx = msg.int();
1280
+ inst.plane_anchor_polygon_version[indx] = msg.int();
1281
+ break;
1282
+ }
1283
+ case 32: {
1284
+ let handle = msg.type();
1285
+ let inst = this._world_tracker_state_by_instance.get(handle);
1286
+ if (!inst)
1287
+ return;
1288
+ let indx = msg.int();
1289
+ inst.plane_anchor_orientation[indx] = msg.planeOrientation();
1290
+ break;
1291
+ }
1292
+ case 36: {
1293
+ let handle = msg.type();
1294
+ let inst = this._world_tracker_state_by_instance.get(handle);
1295
+ if (!inst)
1296
+ return;
1297
+ inst.world_anchor_status = msg.anchorStatus();
1298
+ break;
1299
+ }
1300
+ case 35: {
1301
+ let handle = msg.type();
1302
+ let inst = this._world_tracker_state_by_instance.get(handle);
1303
+ if (!inst)
1304
+ return;
1305
+ inst.world_anchor_id = msg.string();
1117
1306
  break;
1118
1307
  }
1119
1308
  case 34: {
1309
+ let handle = msg.type();
1310
+ let inst = this._world_tracker_state_by_instance.get(handle);
1311
+ if (!inst)
1312
+ return;
1313
+ inst.world_anchor_pose = msg.matrix4x4();
1314
+ break;
1315
+ }
1316
+ case 38: {
1317
+ let handle = msg.type();
1318
+ let inst = this._world_tracker_state_by_instance.get(handle);
1319
+ if (!inst)
1320
+ return;
1321
+ inst.ground_anchor_id = msg.string();
1322
+ break;
1323
+ }
1324
+ case 39: {
1325
+ let handle = msg.type();
1326
+ let inst = this._world_tracker_state_by_instance.get(handle);
1327
+ if (!inst)
1328
+ return;
1329
+ inst.ground_anchor_status = msg.anchorStatus();
1330
+ break;
1331
+ }
1332
+ case 37: {
1333
+ let handle = msg.type();
1334
+ let inst = this._world_tracker_state_by_instance.get(handle);
1335
+ if (!inst)
1336
+ return;
1337
+ inst.ground_anchor_pose = msg.matrix4x4();
1338
+ break;
1339
+ }
1340
+ case 43: {
1120
1341
  let handle = msg.type();
1121
1342
  let inst = this._world_tracker_state_by_instance.get(handle);
1122
1343
  if (!inst)
@@ -1124,7 +1345,7 @@ export class zappar_client {
1124
1345
  inst.tracks_data_size = msg.int();
1125
1346
  break;
1126
1347
  }
1127
- case 33: {
1348
+ case 42: {
1128
1349
  let handle = msg.type();
1129
1350
  let inst = this._world_tracker_state_by_instance.get(handle);
1130
1351
  if (!inst)
@@ -1132,7 +1353,7 @@ export class zappar_client {
1132
1353
  inst.tracks_data = msg.floatArray();
1133
1354
  break;
1134
1355
  }
1135
- case 36: {
1356
+ case 45: {
1136
1357
  let handle = msg.type();
1137
1358
  let inst = this._world_tracker_state_by_instance.get(handle);
1138
1359
  if (!inst)
@@ -1140,7 +1361,7 @@ export class zappar_client {
1140
1361
  inst.tracks_type_data_size = msg.int();
1141
1362
  break;
1142
1363
  }
1143
- case 35: {
1364
+ case 44: {
1144
1365
  let handle = msg.type();
1145
1366
  let inst = this._world_tracker_state_by_instance.get(handle);
1146
1367
  if (!inst)
@@ -1148,7 +1369,7 @@ export class zappar_client {
1148
1369
  inst.tracks_type_data = msg.ucharArray();
1149
1370
  break;
1150
1371
  }
1151
- case 39: {
1372
+ case 48: {
1152
1373
  let handle = msg.type();
1153
1374
  let inst = this._world_tracker_state_by_instance.get(handle);
1154
1375
  if (!inst)
@@ -1156,7 +1377,7 @@ export class zappar_client {
1156
1377
  inst.projections_data_size = msg.int();
1157
1378
  break;
1158
1379
  }
1159
- case 38: {
1380
+ case 47: {
1160
1381
  let handle = msg.type();
1161
1382
  let inst = this._world_tracker_state_by_instance.get(handle);
1162
1383
  if (!inst)
@@ -1164,6 +1385,22 @@ export class zappar_client {
1164
1385
  inst.projections_data = msg.floatArray();
1165
1386
  break;
1166
1387
  }
1388
+ case 50: {
1389
+ let handle = msg.type();
1390
+ let inst = this._custom_anchor_state_by_instance.get(handle);
1391
+ if (!inst)
1392
+ return;
1393
+ inst.status = msg.anchorStatus();
1394
+ break;
1395
+ }
1396
+ case 49: {
1397
+ let handle = msg.type();
1398
+ let inst = this._custom_anchor_state_by_instance.get(handle);
1399
+ if (!inst)
1400
+ return;
1401
+ inst.pose = msg.matrix4x4();
1402
+ break;
1403
+ }
1167
1404
  }
1168
1405
  });
1169
1406
  }