@zappar/zappar-cv 3.0.1-alpha.16 → 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.
- package/README.md +2 -2
- package/lib/additional.d.ts +1 -0
- package/lib/deserializer.d.ts +4 -1
- package/lib/deserializer.js +3 -0
- package/lib/gen/zappar-bridge.d.ts +33 -9
- package/lib/gen/zappar-bridge.js +3 -0
- package/lib/gen/zappar-client.d.ts +1 -0
- package/lib/gen/zappar-client.js +236 -47
- package/lib/gen/zappar-cwrap.js +157 -32
- package/lib/gen/zappar-native.d.ts +44 -10
- package/lib/gen/zappar-native.js +23 -1
- package/lib/gen/zappar-server.d.ts +3 -0
- package/lib/gen/zappar-server.js +127 -27
- package/lib/gen/zappar.d.ts +40 -11
- package/lib/gen/zappar.js +3 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/native.js +48 -4
- package/lib/permission.js +35 -9
- package/lib/serializer.d.ts +4 -1
- package/lib/serializer.js +3 -0
- package/lib/tr.js +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/zappar-cv.js +1 -1
- package/lib/zappar-cv.wasm +0 -0
- package/package.json +1 -1
- package/umd/751.zappar-cv.js +1 -1
- package/umd/867.zappar-cv.js +1 -1
- package/umd/{6cf17bab4f58a189fc94.wasm → e601e2d6a412c37c4379.wasm} +0 -0
- package/umd/zappar-cv.js +1 -1
- package/umd/zappar-cv.worker.js +1 -1
package/lib/gen/zappar-server.js
CHANGED
|
@@ -28,6 +28,8 @@ export class zappar_server {
|
|
|
28
28
|
this._zapcode_tracker_by_instance = new Map();
|
|
29
29
|
this._pipeline_id_by_world_tracker_id = new Map();
|
|
30
30
|
this._world_tracker_by_instance = new Map();
|
|
31
|
+
this._pipeline_id_by_custom_anchor_id = new Map();
|
|
32
|
+
this._custom_anchor_by_instance = new Map();
|
|
31
33
|
}
|
|
32
34
|
processBuffer(b) {
|
|
33
35
|
this._deserializer.setData(b);
|
|
@@ -417,7 +419,7 @@ export class zappar_server {
|
|
|
417
419
|
let obj = this._world_tracker_by_instance.get(clientId);
|
|
418
420
|
if (obj === undefined)
|
|
419
421
|
return;
|
|
420
|
-
this._impl.
|
|
422
|
+
this._impl.world_tracker_horizontal_plane_detection_enabled_set(obj, msg.bool());
|
|
421
423
|
break;
|
|
422
424
|
}
|
|
423
425
|
case 49: {
|
|
@@ -425,7 +427,7 @@ export class zappar_server {
|
|
|
425
427
|
let obj = this._world_tracker_by_instance.get(clientId);
|
|
426
428
|
if (obj === undefined)
|
|
427
429
|
return;
|
|
428
|
-
this._impl.
|
|
430
|
+
this._impl.world_tracker_vertical_plane_detection_enabled_set(obj, msg.bool());
|
|
429
431
|
break;
|
|
430
432
|
}
|
|
431
433
|
case 50: {
|
|
@@ -433,10 +435,18 @@ export class zappar_server {
|
|
|
433
435
|
let obj = this._world_tracker_by_instance.get(clientId);
|
|
434
436
|
if (obj === undefined)
|
|
435
437
|
return;
|
|
436
|
-
this._impl.
|
|
438
|
+
this._impl.world_tracker_reset(obj);
|
|
437
439
|
break;
|
|
438
440
|
}
|
|
439
441
|
case 51: {
|
|
442
|
+
let clientId = msg.type();
|
|
443
|
+
let obj = this._world_tracker_by_instance.get(clientId);
|
|
444
|
+
if (obj === undefined)
|
|
445
|
+
return;
|
|
446
|
+
this._impl.world_tracker_tracks_data_enabled_set(obj, msg.bool());
|
|
447
|
+
break;
|
|
448
|
+
}
|
|
449
|
+
case 52: {
|
|
440
450
|
let clientId = msg.type();
|
|
441
451
|
let obj = this._world_tracker_by_instance.get(clientId);
|
|
442
452
|
if (obj === undefined)
|
|
@@ -444,6 +454,51 @@ export class zappar_server {
|
|
|
444
454
|
this._impl.world_tracker_projections_data_enabled_set(obj, msg.bool());
|
|
445
455
|
break;
|
|
446
456
|
}
|
|
457
|
+
case 53: {
|
|
458
|
+
let clientId = msg.type();
|
|
459
|
+
let arg_pipeline_id = msg.type();
|
|
460
|
+
let arg_pipeline = this._pipeline_by_instance.get(arg_pipeline_id);
|
|
461
|
+
let arg_worldtracker_id = msg.type();
|
|
462
|
+
let arg_worldtracker = this._world_tracker_by_instance.get(arg_worldtracker_id);
|
|
463
|
+
let arg_id = msg.string();
|
|
464
|
+
let handle = this._impl.custom_anchor_create(arg_pipeline, arg_worldtracker, arg_id);
|
|
465
|
+
this._custom_anchor_by_instance.set(clientId, handle);
|
|
466
|
+
this._pipeline_id_by_custom_anchor_id.set(clientId, arg_pipeline_id);
|
|
467
|
+
break;
|
|
468
|
+
}
|
|
469
|
+
case 54: {
|
|
470
|
+
let clientId = msg.type();
|
|
471
|
+
let obj = this._custom_anchor_by_instance.get(clientId);
|
|
472
|
+
if (obj === undefined)
|
|
473
|
+
return;
|
|
474
|
+
this._impl.custom_anchor_destroy(obj);
|
|
475
|
+
this._custom_anchor_by_instance.delete(clientId);
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
case 55: {
|
|
479
|
+
let clientId = msg.type();
|
|
480
|
+
let obj = this._custom_anchor_by_instance.get(clientId);
|
|
481
|
+
if (obj === undefined)
|
|
482
|
+
return;
|
|
483
|
+
this._impl.custom_anchor_enabled_set(obj, msg.bool());
|
|
484
|
+
break;
|
|
485
|
+
}
|
|
486
|
+
case 56: {
|
|
487
|
+
let clientId = msg.type();
|
|
488
|
+
let obj = this._custom_anchor_by_instance.get(clientId);
|
|
489
|
+
if (obj === undefined)
|
|
490
|
+
return;
|
|
491
|
+
this._impl.custom_anchor_pose_set_from_camera_offset_raw(obj, msg.float(), msg.float(), msg.float(), msg.transformOrientation());
|
|
492
|
+
break;
|
|
493
|
+
}
|
|
494
|
+
case 57: {
|
|
495
|
+
let clientId = msg.type();
|
|
496
|
+
let obj = this._custom_anchor_by_instance.get(clientId);
|
|
497
|
+
if (obj === undefined)
|
|
498
|
+
return;
|
|
499
|
+
this._impl.custom_anchor_pose_set_from_anchor_offset(obj, msg.string(), msg.float(), msg.float(), msg.float(), msg.transformOrientation());
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
447
502
|
}
|
|
448
503
|
});
|
|
449
504
|
}
|
|
@@ -657,82 +712,127 @@ export class zappar_server {
|
|
|
657
712
|
let serializer = this.serializersByPipelineId.get(pipeline);
|
|
658
713
|
if (!serializer)
|
|
659
714
|
continue;
|
|
660
|
-
serializer.sendMessage(
|
|
715
|
+
serializer.sendMessage(40, msg => {
|
|
661
716
|
msg.type(k);
|
|
662
717
|
msg.int(this._impl.world_tracker_quality(v));
|
|
663
718
|
});
|
|
664
719
|
serializer.sendMessage(25, msg => {
|
|
665
720
|
msg.type(k);
|
|
666
|
-
msg.int(this._impl.
|
|
721
|
+
msg.int(this._impl.world_tracker_plane_anchor_count(v));
|
|
667
722
|
});
|
|
668
|
-
for (let i = 0; i < this._impl.
|
|
669
|
-
serializer.sendMessage(
|
|
723
|
+
for (let i = 0; i < this._impl.world_tracker_plane_anchor_count(v); i++) {
|
|
724
|
+
serializer.sendMessage(33, msg => {
|
|
670
725
|
msg.type(k);
|
|
671
726
|
msg.int(i);
|
|
672
|
-
msg.
|
|
727
|
+
msg.string(this._impl.world_tracker_plane_anchor_id(v, i));
|
|
673
728
|
});
|
|
674
729
|
}
|
|
675
|
-
for (let i = 0; i < this._impl.
|
|
676
|
-
serializer.sendMessage(
|
|
730
|
+
for (let i = 0; i < this._impl.world_tracker_plane_anchor_count(v); i++) {
|
|
731
|
+
serializer.sendMessage(26, msg => {
|
|
677
732
|
msg.type(k);
|
|
678
733
|
msg.int(i);
|
|
679
|
-
msg.
|
|
734
|
+
msg.matrix4x4(this._impl.world_tracker_plane_anchor_pose_raw(v, i));
|
|
680
735
|
});
|
|
681
736
|
}
|
|
682
|
-
for (let i = 0; i < this._impl.
|
|
737
|
+
for (let i = 0; i < this._impl.world_tracker_plane_anchor_count(v); i++) {
|
|
683
738
|
serializer.sendMessage(28, msg => {
|
|
684
739
|
msg.type(k);
|
|
685
740
|
msg.int(i);
|
|
686
|
-
msg.
|
|
741
|
+
msg.anchorStatus(this._impl.world_tracker_plane_anchor_status(v, i));
|
|
687
742
|
});
|
|
688
743
|
}
|
|
689
|
-
for (let i = 0; i < this._impl.
|
|
744
|
+
for (let i = 0; i < this._impl.world_tracker_plane_anchor_count(v); i++) {
|
|
690
745
|
serializer.sendMessage(29, msg => {
|
|
691
746
|
msg.type(k);
|
|
692
747
|
msg.int(i);
|
|
693
|
-
msg.
|
|
748
|
+
msg.int(this._impl.world_tracker_plane_anchor_polygon_data_size(v, i));
|
|
694
749
|
});
|
|
695
750
|
}
|
|
696
|
-
|
|
751
|
+
for (let i = 0; i < this._impl.world_tracker_plane_anchor_count(v); i++) {
|
|
752
|
+
serializer.sendMessage(30, msg => {
|
|
753
|
+
msg.type(k);
|
|
754
|
+
msg.int(i);
|
|
755
|
+
msg.floatArray(this._impl.world_tracker_plane_anchor_polygon_data(v, i));
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
for (let i = 0; i < this._impl.world_tracker_plane_anchor_count(v); i++) {
|
|
759
|
+
serializer.sendMessage(31, msg => {
|
|
760
|
+
msg.type(k);
|
|
761
|
+
msg.int(i);
|
|
762
|
+
msg.int(this._impl.world_tracker_plane_anchor_polygon_version(v, i));
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
for (let i = 0; i < this._impl.world_tracker_plane_anchor_count(v); i++) {
|
|
766
|
+
serializer.sendMessage(32, msg => {
|
|
767
|
+
msg.type(k);
|
|
768
|
+
msg.int(i);
|
|
769
|
+
msg.planeOrientation(this._impl.world_tracker_plane_anchor_orientation(v, i));
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
serializer.sendMessage(36, msg => {
|
|
697
773
|
msg.type(k);
|
|
698
|
-
msg.
|
|
774
|
+
msg.anchorStatus(this._impl.world_tracker_world_anchor_status(v));
|
|
699
775
|
});
|
|
700
|
-
serializer.sendMessage(
|
|
776
|
+
serializer.sendMessage(35, msg => {
|
|
777
|
+
msg.type(k);
|
|
778
|
+
msg.string(this._impl.world_tracker_world_anchor_id(v));
|
|
779
|
+
});
|
|
780
|
+
serializer.sendMessage(34, msg => {
|
|
701
781
|
msg.type(k);
|
|
702
782
|
msg.matrix4x4(this._impl.world_tracker_world_anchor_pose_raw(v));
|
|
703
783
|
});
|
|
704
|
-
serializer.sendMessage(
|
|
784
|
+
serializer.sendMessage(38, msg => {
|
|
705
785
|
msg.type(k);
|
|
706
|
-
msg.
|
|
786
|
+
msg.string(this._impl.world_tracker_ground_anchor_id(v));
|
|
707
787
|
});
|
|
708
|
-
serializer.sendMessage(
|
|
788
|
+
serializer.sendMessage(39, msg => {
|
|
709
789
|
msg.type(k);
|
|
710
|
-
msg.
|
|
790
|
+
msg.anchorStatus(this._impl.world_tracker_ground_anchor_status(v));
|
|
711
791
|
});
|
|
712
792
|
serializer.sendMessage(37, msg => {
|
|
793
|
+
msg.type(k);
|
|
794
|
+
msg.matrix4x4(this._impl.world_tracker_ground_anchor_pose_raw(v));
|
|
795
|
+
});
|
|
796
|
+
serializer.sendMessage(43, msg => {
|
|
713
797
|
msg.type(k);
|
|
714
798
|
msg.int(this._impl.world_tracker_tracks_data_size(v));
|
|
715
799
|
});
|
|
716
|
-
serializer.sendMessage(
|
|
800
|
+
serializer.sendMessage(42, msg => {
|
|
717
801
|
msg.type(k);
|
|
718
802
|
msg.floatArray(this._impl.world_tracker_tracks_data(v));
|
|
719
803
|
});
|
|
720
|
-
serializer.sendMessage(
|
|
804
|
+
serializer.sendMessage(45, msg => {
|
|
721
805
|
msg.type(k);
|
|
722
806
|
msg.int(this._impl.world_tracker_tracks_type_data_size(v));
|
|
723
807
|
});
|
|
724
|
-
serializer.sendMessage(
|
|
808
|
+
serializer.sendMessage(44, msg => {
|
|
725
809
|
msg.type(k);
|
|
726
810
|
msg.ucharArray(this._impl.world_tracker_tracks_type_data(v));
|
|
727
811
|
});
|
|
728
|
-
serializer.sendMessage(
|
|
812
|
+
serializer.sendMessage(48, msg => {
|
|
729
813
|
msg.type(k);
|
|
730
814
|
msg.int(this._impl.world_tracker_projections_data_size(v));
|
|
731
815
|
});
|
|
732
|
-
serializer.sendMessage(
|
|
816
|
+
serializer.sendMessage(47, msg => {
|
|
733
817
|
msg.type(k);
|
|
734
818
|
msg.floatArray(this._impl.world_tracker_projections_data(v));
|
|
735
819
|
});
|
|
736
820
|
}
|
|
821
|
+
for (let [k, v] of this._custom_anchor_by_instance) {
|
|
822
|
+
let pipeline = this._pipeline_id_by_custom_anchor_id.get(k);
|
|
823
|
+
if (!pipeline)
|
|
824
|
+
continue;
|
|
825
|
+
let serializer = this.serializersByPipelineId.get(pipeline);
|
|
826
|
+
if (!serializer)
|
|
827
|
+
continue;
|
|
828
|
+
serializer.sendMessage(50, msg => {
|
|
829
|
+
msg.type(k);
|
|
830
|
+
msg.anchorStatus(this._impl.custom_anchor_status(v));
|
|
831
|
+
});
|
|
832
|
+
serializer.sendMessage(49, msg => {
|
|
833
|
+
msg.type(k);
|
|
834
|
+
msg.matrix4x4(this._impl.custom_anchor_pose_raw(v));
|
|
835
|
+
});
|
|
836
|
+
}
|
|
737
837
|
}
|
|
738
838
|
}
|
package/lib/gen/zappar.d.ts
CHANGED
|
@@ -5,11 +5,17 @@ export { face_landmark_name_t } from "./zappar-native";
|
|
|
5
5
|
export { frame_pixel_format_t } from "./zappar-native";
|
|
6
6
|
import { instant_world_tracker_transform_orientation_t } from "./zappar-native";
|
|
7
7
|
export { instant_world_tracker_transform_orientation_t } from "./zappar-native";
|
|
8
|
+
import { transform_orientation_t } from "./zappar-native";
|
|
9
|
+
export { transform_orientation_t } from "./zappar-native";
|
|
10
|
+
import { plane_orientation_t } from "./zappar-native";
|
|
11
|
+
export { plane_orientation_t } from "./zappar-native";
|
|
8
12
|
import { log_level_t } from "./zappar-native";
|
|
9
13
|
export { log_level_t } from "./zappar-native";
|
|
10
14
|
import { image_target_type_t } from "./zappar-native";
|
|
11
15
|
export { image_target_type_t } from "./zappar-native";
|
|
12
16
|
export { world_tracker_quality_t } from "./zappar-native";
|
|
17
|
+
import { anchor_status_t } from "./zappar-native";
|
|
18
|
+
export { anchor_status_t } from "./zappar-native";
|
|
13
19
|
import { camera_profile_t } from "./zappar-native";
|
|
14
20
|
export { camera_profile_t } from "./zappar-native";
|
|
15
21
|
export declare type zappar_pipeline_t = number & {
|
|
@@ -45,6 +51,9 @@ export declare type zappar_zapcode_tracker_t = number & {
|
|
|
45
51
|
export declare type zappar_world_tracker_t = number & {
|
|
46
52
|
_: 'zappar_world_tracker_t';
|
|
47
53
|
};
|
|
54
|
+
export declare type zappar_custom_anchor_t = number & {
|
|
55
|
+
_: 'zappar_custom_anchor_t';
|
|
56
|
+
};
|
|
48
57
|
export interface zappar {
|
|
49
58
|
loaded(): boolean;
|
|
50
59
|
camera_default_device_id(userFacing: boolean): string;
|
|
@@ -205,20 +214,28 @@ export interface zappar {
|
|
|
205
214
|
world_tracker_enabled(o: zappar_world_tracker_t): boolean;
|
|
206
215
|
world_tracker_enabled_set(o: zappar_world_tracker_t, enabled: boolean): void;
|
|
207
216
|
world_tracker_quality(o: zappar_world_tracker_t): number;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
217
|
+
world_tracker_horizontal_plane_detection_enabled(o: zappar_world_tracker_t): boolean;
|
|
218
|
+
world_tracker_horizontal_plane_detection_enabled_set(o: zappar_world_tracker_t, horizontal_plane_detection_enabled: boolean): void;
|
|
219
|
+
world_tracker_vertical_plane_detection_enabled(o: zappar_world_tracker_t): boolean;
|
|
220
|
+
world_tracker_vertical_plane_detection_enabled_set(o: zappar_world_tracker_t, vertical_plane_detection_enabled: boolean): void;
|
|
221
|
+
world_tracker_vertical_plane_detection_supported(o: zappar_world_tracker_t): boolean;
|
|
222
|
+
world_tracker_plane_anchor_count(o: zappar_world_tracker_t): number;
|
|
223
|
+
world_tracker_plane_anchor_id(o: zappar_world_tracker_t, indx: number): string;
|
|
224
|
+
world_tracker_plane_anchor_pose_raw(o: zappar_world_tracker_t, indx: number): Float32Array;
|
|
225
|
+
world_tracker_plane_anchor_status(o: zappar_world_tracker_t, indx: number): anchor_status_t;
|
|
226
|
+
world_tracker_plane_anchor_pose_camera_relative(o: zappar_world_tracker_t, indx: number, mirror: boolean): Float32Array;
|
|
227
|
+
world_tracker_plane_anchor_pose(o: zappar_world_tracker_t, indx: number, camera_pose: Float32Array, mirror: boolean): Float32Array;
|
|
228
|
+
world_tracker_plane_anchor_polygon_data_size(o: zappar_world_tracker_t, indx: number): number;
|
|
229
|
+
world_tracker_plane_anchor_polygon_data(o: zappar_world_tracker_t, indx: number): Float32Array;
|
|
230
|
+
world_tracker_plane_anchor_polygon_version(o: zappar_world_tracker_t, indx: number): number;
|
|
231
|
+
world_tracker_plane_anchor_orientation(o: zappar_world_tracker_t, indx: number): plane_orientation_t;
|
|
232
|
+
world_tracker_world_anchor_status(o: zappar_world_tracker_t): anchor_status_t;
|
|
233
|
+
world_tracker_world_anchor_id(o: zappar_world_tracker_t): string;
|
|
218
234
|
world_tracker_world_anchor_pose_raw(o: zappar_world_tracker_t): Float32Array;
|
|
219
235
|
world_tracker_world_anchor_pose_camera_relative(o: zappar_world_tracker_t, mirror: boolean): Float32Array;
|
|
220
236
|
world_tracker_world_anchor_pose(o: zappar_world_tracker_t, camera_pose: Float32Array, mirror: boolean): Float32Array;
|
|
221
|
-
|
|
237
|
+
world_tracker_ground_anchor_id(o: zappar_world_tracker_t): string;
|
|
238
|
+
world_tracker_ground_anchor_status(o: zappar_world_tracker_t): anchor_status_t;
|
|
222
239
|
world_tracker_ground_anchor_pose_raw(o: zappar_world_tracker_t): Float32Array;
|
|
223
240
|
world_tracker_ground_anchor_pose_camera_relative(o: zappar_world_tracker_t, mirror: boolean): Float32Array;
|
|
224
241
|
world_tracker_ground_anchor_pose(o: zappar_world_tracker_t, camera_pose: Float32Array, mirror: boolean): Float32Array;
|
|
@@ -233,4 +250,16 @@ export interface zappar {
|
|
|
233
250
|
world_tracker_projections_data_enabled_set(o: zappar_world_tracker_t, projections_data_enabled: boolean): void;
|
|
234
251
|
world_tracker_projections_data_size(o: zappar_world_tracker_t): number;
|
|
235
252
|
world_tracker_projections_data(o: zappar_world_tracker_t): Float32Array;
|
|
253
|
+
custom_anchor_create(pipeline: zappar_pipeline_t, worldtracker: zappar_world_tracker_t, id: string): zappar_custom_anchor_t;
|
|
254
|
+
custom_anchor_destroy(o: zappar_custom_anchor_t): void;
|
|
255
|
+
custom_anchor_id(o: zappar_custom_anchor_t): string;
|
|
256
|
+
custom_anchor_status(o: zappar_custom_anchor_t): anchor_status_t;
|
|
257
|
+
custom_anchor_enabled_set(o: zappar_custom_anchor_t, enabled: boolean): void;
|
|
258
|
+
custom_anchor_enabled(o: zappar_custom_anchor_t): boolean;
|
|
259
|
+
custom_anchor_pose_raw(o: zappar_custom_anchor_t): Float32Array;
|
|
260
|
+
custom_anchor_pose_camera_relative(o: zappar_custom_anchor_t, mirror: boolean): Float32Array;
|
|
261
|
+
custom_anchor_pose(o: zappar_custom_anchor_t, camera_pose: Float32Array, mirror: boolean): Float32Array;
|
|
262
|
+
custom_anchor_pose_set_from_camera_offset_raw(o: zappar_custom_anchor_t, x: number, y: number, z: number, orientation: transform_orientation_t): void;
|
|
263
|
+
custom_anchor_pose_set_from_camera_offset(o: zappar_custom_anchor_t, x: number, y: number, z: number, orientation: transform_orientation_t): void;
|
|
264
|
+
custom_anchor_pose_set_from_anchor_offset(o: zappar_custom_anchor_t, anchor_id: string, x: number, y: number, z: number, orientation: transform_orientation_t): void;
|
|
236
265
|
}
|
package/lib/gen/zappar.js
CHANGED
|
@@ -2,7 +2,10 @@ export { barcode_format_t } from "./zappar-native";
|
|
|
2
2
|
export { face_landmark_name_t } from "./zappar-native";
|
|
3
3
|
export { frame_pixel_format_t } from "./zappar-native";
|
|
4
4
|
export { instant_world_tracker_transform_orientation_t } from "./zappar-native";
|
|
5
|
+
export { transform_orientation_t } from "./zappar-native";
|
|
6
|
+
export { plane_orientation_t } from "./zappar-native";
|
|
5
7
|
export { log_level_t } from "./zappar-native";
|
|
6
8
|
export { image_target_type_t } from "./zappar-native";
|
|
7
9
|
export { world_tracker_quality_t } from "./zappar-native";
|
|
10
|
+
export { anchor_status_t } from "./zappar-native";
|
|
8
11
|
export { camera_profile_t } from "./zappar-native";
|
package/lib/index.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ import { Options } from "./options";
|
|
|
4
4
|
export declare type Zappar = zappar & Additional;
|
|
5
5
|
export declare function initialize(opts?: Options): Zappar;
|
|
6
6
|
export { CameraFrameData } from './camera-frame-data';
|
|
7
|
-
export { zappar_image_tracker_t, zappar_instant_world_tracker_t, zappar_world_tracker_t, zappar_barcode_finder_t, zappar_face_tracker_t, zappar_face_landmark_t, zappar_zapcode_tracker_t, barcode_format_t, face_landmark_name_t, instant_world_tracker_transform_orientation_t, log_level_t, zappar_face_mesh_t, zappar_pipeline_t, zappar_camera_source_t, zappar_sequence_source_t, image_target_type_t, world_tracker_quality_t, camera_profile_t } from "./gen/zappar";
|
|
7
|
+
export { zappar_image_tracker_t, zappar_instant_world_tracker_t, zappar_world_tracker_t, zappar_barcode_finder_t, zappar_face_tracker_t, zappar_face_landmark_t, zappar_zapcode_tracker_t, zappar_custom_anchor_t, barcode_format_t, face_landmark_name_t, instant_world_tracker_transform_orientation_t, log_level_t, zappar_face_mesh_t, zappar_pipeline_t, zappar_camera_source_t, zappar_sequence_source_t, image_target_type_t, world_tracker_quality_t, camera_profile_t, transform_orientation_t, plane_orientation_t, anchor_status_t, } from "./gen/zappar";
|
package/lib/index.js
CHANGED
|
@@ -4,4 +4,4 @@ export function initialize(opts) {
|
|
|
4
4
|
console.log(`Zappar CV v${VERSION}`);
|
|
5
5
|
return nativeInitialize(opts);
|
|
6
6
|
}
|
|
7
|
-
export { barcode_format_t, face_landmark_name_t, instant_world_tracker_transform_orientation_t, log_level_t, image_target_type_t, world_tracker_quality_t, camera_profile_t } from "./gen/zappar";
|
|
7
|
+
export { barcode_format_t, face_landmark_name_t, instant_world_tracker_transform_orientation_t, log_level_t, image_target_type_t, world_tracker_quality_t, camera_profile_t, transform_orientation_t, plane_orientation_t, anchor_status_t, } from "./gen/zappar";
|
package/lib/native.js
CHANGED
|
@@ -28,6 +28,7 @@ import { ImageTracker } from "./imagetracker";
|
|
|
28
28
|
import { MSTPCameraSource } from "./mstp-camera-source";
|
|
29
29
|
import { drawGrid } from "./drawgrid";
|
|
30
30
|
import { getPointsDataMatrix } from "./drawpoints";
|
|
31
|
+
import { drawAxis } from "./drawaxis";
|
|
31
32
|
let client;
|
|
32
33
|
const pipelineByWorldTracker = new Map();
|
|
33
34
|
export function initialize(opts) {
|
|
@@ -149,6 +150,7 @@ export function initialize(opts) {
|
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
});
|
|
153
|
+
const customAnchorIDs = new Map();
|
|
152
154
|
client = Object.assign(Object.assign({}, c.impl), { loaded: () => loaded, camera_default_device_id: userFacing => userFacing ? CameraSource.USER_DEFAULT_DEVICE_ID : CameraSource.DEFAULT_DEVICE_ID, camera_source_create: (p, deviceId) => createCameraSource(p, deviceId), camera_source_destroy: cam => { var _a; return (_a = getCameraSource(cam)) === null || _a === void 0 ? void 0 : _a.destroy(); }, camera_source_pause: cam => { var _a; return (_a = getCameraSource(cam)) === null || _a === void 0 ? void 0 : _a.pause(); }, camera_source_start: cam => { var _a; return (_a = getCameraSource(cam)) === null || _a === void 0 ? void 0 : _a.start(); }, camera_source_profile_set: (cam, p) => { var _a; return (_a = getCameraSource(cam)) === null || _a === void 0 ? void 0 : _a.setProfile(p); }, camera_count: () => 2, camera_id: indx => indx === 0 ? CameraSource.DEFAULT_DEVICE_ID : CameraSource.USER_DEFAULT_DEVICE_ID, camera_name: indx => indx === 0 ? "Rear-facing Camera" : "User-facing Camera", camera_user_facing: indx => indx !== 0, pose_from_raw: (raw_pose, mirror) => {
|
|
153
155
|
let res = applyScreenCounterRotation(undefined, raw_pose);
|
|
154
156
|
if (mirror) {
|
|
@@ -173,6 +175,8 @@ export function initialize(opts) {
|
|
|
173
175
|
drawPlane(gl, projectionMatrix, cameraMatrix, targetMatrix, texture);
|
|
174
176
|
}, draw_grid: (gl, projectionMatrix, cameraMatrix, targetMatrix) => {
|
|
175
177
|
drawGrid(gl, projectionMatrix, cameraMatrix, targetMatrix);
|
|
178
|
+
}, draw_axis: (gl, projectionMatrix, cameraMatrix, targetMatrix) => {
|
|
179
|
+
drawAxis(gl, projectionMatrix, cameraMatrix, targetMatrix);
|
|
176
180
|
}, pipeline_draw_face: (p, projectionMatrix, cameraMatrix, targetMatrix, o) => {
|
|
177
181
|
var _a;
|
|
178
182
|
let obj = getFaceMesh(o);
|
|
@@ -224,6 +228,44 @@ export function initialize(opts) {
|
|
|
224
228
|
let rawVec = vec3.create();
|
|
225
229
|
vec3.transformMat4(rawVec, [x, y, z], rotationMat);
|
|
226
230
|
c.impl.instant_world_tracker_anchor_pose_set_from_camera_offset_raw(o, rawVec[0], rawVec[1], rawVec[2], orientation);
|
|
231
|
+
}, custom_anchor_pose_camera_relative: (o, mirror) => {
|
|
232
|
+
let res = applyScreenCounterRotation(undefined, c.impl.custom_anchor_pose_raw(o));
|
|
233
|
+
if (mirror) {
|
|
234
|
+
let scale = mat4.create();
|
|
235
|
+
mat4.fromScaling(scale, [-1, 1, 1]);
|
|
236
|
+
mat4.multiply(res, scale, res);
|
|
237
|
+
mat4.multiply(res, res, scale);
|
|
238
|
+
}
|
|
239
|
+
return res;
|
|
240
|
+
}, custom_anchor_pose: (o, cameraPose, mirror) => {
|
|
241
|
+
let res = applyScreenCounterRotation(undefined, c.impl.custom_anchor_pose_raw(o));
|
|
242
|
+
if (mirror) {
|
|
243
|
+
let scale = mat4.create();
|
|
244
|
+
mat4.fromScaling(scale, [-1, 1, 1]);
|
|
245
|
+
mat4.multiply(res, scale, res);
|
|
246
|
+
mat4.multiply(res, res, scale);
|
|
247
|
+
}
|
|
248
|
+
mat4.multiply(res, cameraPose, res);
|
|
249
|
+
return res;
|
|
250
|
+
}, custom_anchor_create: (p, wt, id) => {
|
|
251
|
+
const ret = c.impl.custom_anchor_create(p, wt, id);
|
|
252
|
+
customAnchorIDs.set(ret, id);
|
|
253
|
+
return ret;
|
|
254
|
+
}, custom_anchor_id: (o) => {
|
|
255
|
+
let id = customAnchorIDs.get(o);
|
|
256
|
+
if (!id) {
|
|
257
|
+
zcwarn("attempting to call custom_anchor_id on a destroyed zappar_custom_anchor_t");
|
|
258
|
+
return "";
|
|
259
|
+
}
|
|
260
|
+
return id;
|
|
261
|
+
}, custom_anchor_pose_set_from_camera_offset: (o, x, y, z, orientation) => {
|
|
262
|
+
let userFacing = false;
|
|
263
|
+
let rotation = cameraRotationForScreenOrientation(userFacing) * Math.PI / 180.0;
|
|
264
|
+
let rotationMat = mat4.create();
|
|
265
|
+
mat4.fromRotation(rotationMat, -rotation, [0, 0, 1]);
|
|
266
|
+
let rawVec = vec3.create();
|
|
267
|
+
vec3.transformMat4(rawVec, [x, y, z], rotationMat);
|
|
268
|
+
c.impl.custom_anchor_pose_set_from_camera_offset_raw(o, rawVec[0], rawVec[1], rawVec[2], orientation);
|
|
227
269
|
}, image_tracker_create: pipeline => ImageTracker.create(pipeline, c.impl), image_tracker_destroy: t => { var _a; return (_a = ImageTracker.get(t)) === null || _a === void 0 ? void 0 : _a.destroy(); }, image_tracker_target_type: (t, i) => {
|
|
228
270
|
let obj = ImageTracker.get(t);
|
|
229
271
|
if (!obj) {
|
|
@@ -554,8 +596,8 @@ export function initialize(opts) {
|
|
|
554
596
|
if (pipeline === undefined || !client)
|
|
555
597
|
return mat4.create();
|
|
556
598
|
return getPointsDataMatrix(client.pipeline_camera_frame_data_width(pipeline), client.pipeline_camera_frame_data_height(pipeline), screenWidth, screenHeight, mirror);
|
|
557
|
-
},
|
|
558
|
-
let res = applyScreenCounterRotation(undefined, c.impl.
|
|
599
|
+
}, world_tracker_plane_anchor_pose_camera_relative: (o, indx, mirror) => {
|
|
600
|
+
let res = applyScreenCounterRotation(undefined, c.impl.world_tracker_plane_anchor_pose_raw(o, indx));
|
|
559
601
|
if (mirror) {
|
|
560
602
|
let scale = mat4.create();
|
|
561
603
|
mat4.fromScaling(scale, [-1, 1, 1]);
|
|
@@ -563,8 +605,8 @@ export function initialize(opts) {
|
|
|
563
605
|
mat4.multiply(res, res, scale);
|
|
564
606
|
}
|
|
565
607
|
return res;
|
|
566
|
-
},
|
|
567
|
-
let res = applyScreenCounterRotation(undefined, c.impl.
|
|
608
|
+
}, world_tracker_plane_anchor_pose: (o, indx, cameraPose, mirror) => {
|
|
609
|
+
let res = applyScreenCounterRotation(undefined, c.impl.world_tracker_plane_anchor_pose_raw(o, indx));
|
|
568
610
|
if (mirror) {
|
|
569
611
|
let scale = mat4.create();
|
|
570
612
|
mat4.fromScaling(scale, [-1, 1, 1]);
|
|
@@ -611,6 +653,8 @@ export function initialize(opts) {
|
|
|
611
653
|
mat4.multiply(res, res, scale);
|
|
612
654
|
}
|
|
613
655
|
return res;
|
|
656
|
+
}, world_tracker_vertical_plane_detection_supported: (o) => {
|
|
657
|
+
return false;
|
|
614
658
|
}, html_element_source_create: (pipeline, elm) => HTMLElementSource.createVideoElementSource(pipeline, elm), html_element_source_start: o => { var _a; return (_a = HTMLElementSource.getVideoElementSource(o)) === null || _a === void 0 ? void 0 : _a.start(); }, html_element_source_pause: o => { var _a; return (_a = HTMLElementSource.getVideoElementSource(o)) === null || _a === void 0 ? void 0 : _a.pause(); }, html_element_source_destroy: o => { var _a; return (_a = HTMLElementSource.getVideoElementSource(o)) === null || _a === void 0 ? void 0 : _a.destroy(); }, sequence_source_create: p => SequenceSource.create(p), sequence_source_load_from_memory: (o, data) => { var _a; return (_a = SequenceSource.get(o)) === null || _a === void 0 ? void 0 : _a.loadFromMemory(data); }, sequence_source_pause: o => { var _a; return (_a = SequenceSource.get(o)) === null || _a === void 0 ? void 0 : _a.pause(); }, sequence_source_start: o => { var _a; return (_a = SequenceSource.get(o)) === null || _a === void 0 ? void 0 : _a.start(); }, sequence_source_max_playback_fps_set: (o, fps) => { var _a; return (_a = SequenceSource.get(o)) === null || _a === void 0 ? void 0 : _a.maxPlaybackFpsSet(fps); }, sequence_source_time_set: (o, t) => { var _a; return (_a = SequenceSource.get(o)) === null || _a === void 0 ? void 0 : _a.setTime(t); }, sequence_source_destroy: o => { var _a; return (_a = SequenceSource.get(o)) === null || _a === void 0 ? void 0 : _a.destroy(); }, permission_granted_all: permissionGrantedAll, permission_granted_camera: permissionGrantedCamera, permission_granted_motion: permissionGrantedMotion, permission_denied_any: permissionDeniedAny, permission_denied_camera: permissionDeniedCamera, permission_denied_motion: permissionDeniedMotion, permission_request_motion: permissionRequestMotion, permission_request_camera: permissionRequestCamera, permission_request_all: permissionRequestAll, permission_request_ui: permissionRequestUI, permission_request_ui_promise: permissionRequestUI, permission_denied_ui: permissionDeniedUI, browser_incompatible: compatibility.incompatible, browser_incompatible_ui: compatibility.incompatible_ui, log_level_set: l => {
|
|
615
659
|
setLogLevel(l);
|
|
616
660
|
c.impl.log_level_set(l);
|
package/lib/permission.js
CHANGED
|
@@ -82,6 +82,7 @@ export function permissionRequestUI() {
|
|
|
82
82
|
}
|
|
83
83
|
let div = document.createElement("div");
|
|
84
84
|
div.classList.add("zappar-permission-request");
|
|
85
|
+
div.classList.add("zappar-permission-request-without-button");
|
|
85
86
|
div.innerHTML = `
|
|
86
87
|
<style>
|
|
87
88
|
.zappar-permission-request {
|
|
@@ -99,7 +100,21 @@ export function permissionRequestUI() {
|
|
|
99
100
|
align-items: center;
|
|
100
101
|
justify-content: center;
|
|
101
102
|
}
|
|
103
|
+
.zappar-permission-request-without-button {
|
|
104
|
+
justify-content: flex-start;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.zappar-permission-request-without-button #zappar-permission-request-button {
|
|
108
|
+
display: none;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.zappar-permission-request-without-button .zappar-inner {
|
|
112
|
+
max-width: 300px;
|
|
113
|
+
}
|
|
114
|
+
|
|
102
115
|
.zappar-inner {
|
|
116
|
+
margin-top: 30%;
|
|
117
|
+
margin-bottom: 30%;
|
|
103
118
|
max-width: 400px;
|
|
104
119
|
text-align: center;
|
|
105
120
|
}
|
|
@@ -127,24 +142,35 @@ export function permissionRequestUI() {
|
|
|
127
142
|
</div>
|
|
128
143
|
`;
|
|
129
144
|
document.body.append(div);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
button === null || button === void 0 ? void 0 : button.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
function attempt() {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
133
147
|
yield permissionRequestAll();
|
|
134
148
|
div.remove();
|
|
135
149
|
while (true) {
|
|
136
150
|
yield nextFrame();
|
|
137
151
|
if (permissionDeniedAny()) {
|
|
138
|
-
|
|
139
|
-
return;
|
|
152
|
+
return false;
|
|
140
153
|
}
|
|
141
154
|
if (permissionGrantedAll()) {
|
|
142
|
-
|
|
143
|
-
return;
|
|
155
|
+
return true;
|
|
144
156
|
}
|
|
145
157
|
}
|
|
158
|
+
return false;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
return yield attempt();
|
|
163
|
+
}
|
|
164
|
+
catch (err) {
|
|
165
|
+
// We may need a user interaction
|
|
166
|
+
div.classList.remove("zappar-permission-request-without-button");
|
|
167
|
+
let button = div.querySelector("#zappar-permission-request-button");
|
|
168
|
+
return yield new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
button === null || button === void 0 ? void 0 : button.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
resolve(yield attempt());
|
|
171
|
+
}));
|
|
146
172
|
}));
|
|
147
|
-
}
|
|
173
|
+
}
|
|
148
174
|
});
|
|
149
175
|
}
|
|
150
176
|
function nextFrame() {
|
|
@@ -254,7 +280,7 @@ function permissionDeniedUIChrome() {
|
|
|
254
280
|
</style>
|
|
255
281
|
<div class="zappar-inner">
|
|
256
282
|
<div class="zappar-title">Permission is Needed</div>
|
|
257
|
-
<div class="zappar-text">Permission to access your device's camera and motion sensors is necessary for this experience.<br/><br/>To grant access, please tap the
|
|
283
|
+
<div class="zappar-text">Permission to access your device's camera and motion sensors is necessary for this experience.<br/><br/>To grant access, please tap the <svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 -960 960 960" width="16px" fill="white"><path d="M696-144q-60.48 0-102.24-41.76T552-288q0-60.48 41.76-102.24T696-432q60.48 0 102.24 41.76T840-288q0 60.48-41.76 102.24T696-144Zm.12-72Q726-216 747-237.12q21-21.12 21-51T746.88-339q-21.12-21-51-21T645-338.88q-21 21.12-21 51T645.12-237q21.12 21 51 21ZM168-252v-72h312v72H168Zm96-276q-60.48 0-102.24-41.76T120-672q0-60.48 41.76-102.24T264-816q60.48 0 102.24 41.76T408-672q0 60.48-41.76 102.24T264-528Zm.12-72Q294-600 315-621.12q21-21.12 21-51T314.88-723q-21.12-21-51-21T213-722.88q-21 21.12-21 51T213.12-621q21.12 21 51 21ZM480-636v-72h312v72H480Zm216 348ZM264-672Z"/></svg> button in the address bar of your browser, then "Permissions", and finally "Reset permissions". You can then reload the page to try again.</div>
|
|
258
284
|
<button id="zappar-permission-reload-button">Reload</button>
|
|
259
285
|
</div>
|
|
260
286
|
`;
|
package/lib/serializer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { barcode_format_t, face_landmark_name_t, instant_world_tracker_transform_orientation_t, log_level_t } from "./gen/zappar-native";
|
|
1
|
+
import { barcode_format_t, face_landmark_name_t, instant_world_tracker_transform_orientation_t, transform_orientation_t, log_level_t, plane_orientation_t, anchor_status_t } from "./gen/zappar-native";
|
|
2
2
|
export interface MessageAppender {
|
|
3
3
|
int: (i: number) => void;
|
|
4
4
|
bool: (i: boolean) => void;
|
|
@@ -17,6 +17,9 @@ export interface MessageAppender {
|
|
|
17
17
|
barcodeFormat: (f: barcode_format_t) => void;
|
|
18
18
|
faceLandmarkName: (f: face_landmark_name_t) => void;
|
|
19
19
|
instantTrackerTransformOrientation: (f: instant_world_tracker_transform_orientation_t) => void;
|
|
20
|
+
transformOrientation: (f: transform_orientation_t) => void;
|
|
21
|
+
planeOrientation: (f: plane_orientation_t) => void;
|
|
22
|
+
anchorStatus: (f: anchor_status_t) => void;
|
|
20
23
|
logLevel: (f: log_level_t) => void;
|
|
21
24
|
}
|
|
22
25
|
export declare class MessageSerializer {
|
package/lib/serializer.js
CHANGED
|
@@ -31,6 +31,9 @@ export class MessageSerializer {
|
|
|
31
31
|
barcodeFormat: i => this.int(i),
|
|
32
32
|
faceLandmarkName: i => this.int(i),
|
|
33
33
|
instantTrackerTransformOrientation: i => this.int(i),
|
|
34
|
+
transformOrientation: i => this.int(i),
|
|
35
|
+
planeOrientation: i => this.int(i),
|
|
36
|
+
anchorStatus: i => this.int(i),
|
|
34
37
|
logLevel: i => this.int(i),
|
|
35
38
|
};
|
|
36
39
|
this._freeBufferPool.push(new ArrayBuffer(16));
|
package/lib/tr.js
CHANGED
|
@@ -35,7 +35,7 @@ export function tr(str) {
|
|
|
35
35
|
}
|
|
36
36
|
switch (str) {
|
|
37
37
|
case STRINGS.PermissionTitle: return "Almost there...";
|
|
38
|
-
case STRINGS.PermissionDescription: return "In order to provide this
|
|
38
|
+
case STRINGS.PermissionDescription: return "In order to provide this immersive experience, we need access to your device's camera and motion sensors.";
|
|
39
39
|
case STRINGS.PermissionButton: return "Grant Access";
|
|
40
40
|
}
|
|
41
41
|
return "";
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.0.1-alpha.
|
|
1
|
+
export declare const VERSION = "3.0.1-alpha.17";
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "3.0.1-alpha.
|
|
1
|
+
export const VERSION = "3.0.1-alpha.17";
|