@zappar/zappar-cv 0.3.14 → 0.4.0-beta.11
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 +2 -1
- package/lib/camera-source-map.d.ts +10 -0
- package/lib/camera-source-map.js +40 -0
- package/lib/camera-source.d.ts +3 -5
- package/lib/camera-source.js +8 -15
- package/lib/deserializer.d.ts +1 -0
- package/lib/deserializer.js +7 -0
- package/lib/drawcamera.js +2 -1
- package/lib/gen/zappar-client.d.ts +1 -0
- package/lib/gen/zappar-client.js +78 -41
- package/lib/gen/zappar-cwrap.js +71 -20
- package/lib/gen/zappar-native.d.ts +20 -3
- package/lib/gen/zappar-native.js +13 -1
- package/lib/gen/zappar-server.d.ts +3 -0
- package/lib/gen/zappar-server.js +70 -34
- package/lib/gen/zappar.d.ts +29 -1
- package/lib/gen/zappar.js +5 -3
- package/lib/gfx.d.ts +1 -0
- package/lib/gfx.js +4 -0
- package/lib/gl-state-manager.d.ts +9 -0
- package/lib/gl-state-manager.js +35 -0
- package/lib/html-element-source.d.ts +7 -22
- package/lib/html-element-source.js +30 -289
- package/lib/image-process-gl.d.ts +37 -0
- package/lib/image-process-gl.js +298 -0
- package/lib/imagebitmap-camera-source.d.ts +36 -0
- package/lib/imagebitmap-camera-source.js +277 -0
- package/lib/imagetracker.d.ts +28 -0
- package/lib/imagetracker.js +119 -0
- package/lib/index.d.ts +1 -1
- package/lib/mstp-camera-source.d.ts +29 -0
- package/lib/mstp-camera-source.js +230 -0
- package/lib/native.js +129 -6
- package/lib/pipeline.d.ts +22 -2
- package/lib/pipeline.js +140 -19
- package/lib/profile.d.ts +2 -0
- package/lib/profile.js +21 -6
- package/lib/riff-reader.d.ts +18 -0
- package/lib/riff-reader.js +56 -0
- package/lib/sequencerecorder.d.ts +83 -0
- package/lib/sequencerecorder.js +283 -0
- package/lib/sequencesource.d.ts +23 -0
- package/lib/sequencesource.js +170 -0
- package/lib/serializer.d.ts +1 -0
- package/lib/serializer.js +1 -0
- package/lib/source.d.ts +10 -3
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/worker-imagebitmap.d.ts +5 -0
- package/lib/worker-imagebitmap.js +63 -0
- package/lib/worker-server.js +124 -8
- package/lib/workerinterface.d.ts +50 -1
- package/lib/zcv.js +121 -197
- package/lib/zcv.wasm +0 -0
- package/package.json +6 -3
- package/umd/e9486c1cdadb21608a4f7e2fa3be9517.wasm +0 -0
- package/umd/zappar-cv.js +1 -1
- package/umd/zappar-cv.worker.js +1 -1
- package/umd/0bdbfe863a384bcd2935e7437d8f1153.wasm +0 -0
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/0.
|
|
21
|
+
<script src="https://libs.zappar.com/zappar-cv/0.4.0-beta.11/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/0.
|
|
25
|
+
[https://libs.zappar.com/zappar-cv/0.4.0-beta.11/zappar-cv.zip](https://libs.zappar.com/zappar-cv/0.4.0-beta.11/zappar-cv.zip)
|
package/lib/additional.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { zappar_face_mesh_t, zappar_face_tracker_t, zappar_pipeline_t } from "./gen/zappar";
|
|
1
|
+
import { zappar_face_mesh_t, zappar_face_tracker_t, zappar_pipeline_t, zappar_image_tracker_t } from "./gen/zappar";
|
|
2
2
|
export declare type zappar_html_element_source_t = number & {
|
|
3
3
|
_: 'zappar_html_element_source_t';
|
|
4
4
|
};
|
|
@@ -8,6 +8,7 @@ export interface Additional {
|
|
|
8
8
|
pipeline_draw_face(pipeline: zappar_pipeline_t, projectionMatrix: Float32Array, cameraMatrix: Float32Array, targetMatrix: Float32Array, o: zappar_face_mesh_t): void;
|
|
9
9
|
pipeline_draw_face_project(pipeline: zappar_pipeline_t, drawwMatrix: Float32Array, vertices: Float32Array, uvMatrix: Float32Array, uvs: Float32Array, indices: Uint16Array, texture: WebGLTexture): void;
|
|
10
10
|
draw_plane(gl: WebGLRenderingContext, projectionMatrix: Float32Array, cameraMatrix: Float32Array, targetMatrix: Float32Array, texture: string): void;
|
|
11
|
+
image_tracker_target_image(o: zappar_image_tracker_t, indx: number): HTMLImageElement | undefined;
|
|
11
12
|
face_mesh_load_default(o: zappar_face_mesh_t): Promise<void>;
|
|
12
13
|
face_mesh_load_default_face(o: zappar_face_mesh_t, fillMouth: boolean, fillEyeL: boolean, fillEyeR: boolean): Promise<void>;
|
|
13
14
|
face_mesh_load_default_full_head_simplified(o: zappar_face_mesh_t, fillMouth: boolean, fillEyeL: boolean, fillEyeR: boolean, fillNeck: boolean): Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CameraSource } from "./camera-source";
|
|
2
|
+
import { zappar_camera_source_t, zappar_pipeline_t } from "./gen/zappar";
|
|
3
|
+
import { ImageBitmapCameraSource } from "./imagebitmap-camera-source";
|
|
4
|
+
import { MSTPCameraSource } from "./mstp-camera-source";
|
|
5
|
+
export declare type CameraSourceType = CameraSource | MSTPCameraSource | ImageBitmapCameraSource;
|
|
6
|
+
export declare function getNextCameraSourceId(): zappar_camera_source_t;
|
|
7
|
+
export declare function setCameraSourceId(id: zappar_camera_source_t, c: CameraSourceType): void;
|
|
8
|
+
export declare function getCameraSource(id: zappar_camera_source_t): CameraSourceType | undefined;
|
|
9
|
+
export declare function deleteCameraSource(id: zappar_camera_source_t): void;
|
|
10
|
+
export declare function createCameraSource(p: zappar_pipeline_t, deviceId: string): zappar_camera_source_t;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCameraSource = exports.deleteCameraSource = exports.getCameraSource = exports.setCameraSourceId = exports.getNextCameraSourceId = void 0;
|
|
4
|
+
const camera_source_1 = require("./camera-source");
|
|
5
|
+
const imagebitmap_camera_source_1 = require("./imagebitmap-camera-source");
|
|
6
|
+
const loglevel_1 = require("./loglevel");
|
|
7
|
+
const mstp_camera_source_1 = require("./mstp-camera-source");
|
|
8
|
+
const profile_1 = require("./profile");
|
|
9
|
+
let latest = 1;
|
|
10
|
+
let byId = new Map();
|
|
11
|
+
function getNextCameraSourceId() {
|
|
12
|
+
return (latest++);
|
|
13
|
+
}
|
|
14
|
+
exports.getNextCameraSourceId = getNextCameraSourceId;
|
|
15
|
+
function setCameraSourceId(id, c) {
|
|
16
|
+
byId.set(id, c);
|
|
17
|
+
}
|
|
18
|
+
exports.setCameraSourceId = setCameraSourceId;
|
|
19
|
+
function getCameraSource(id) {
|
|
20
|
+
return byId.get(id);
|
|
21
|
+
}
|
|
22
|
+
exports.getCameraSource = getCameraSource;
|
|
23
|
+
function deleteCameraSource(id) {
|
|
24
|
+
byId.delete(id);
|
|
25
|
+
}
|
|
26
|
+
exports.deleteCameraSource = deleteCameraSource;
|
|
27
|
+
function createCameraSource(p, deviceId) {
|
|
28
|
+
let ret = getNextCameraSourceId();
|
|
29
|
+
if (profile_1.profile.preferMediaStreamTrackProcessorCamera &&
|
|
30
|
+
'MediaStreamTrackProcessor' in window &&
|
|
31
|
+
'MediaStreamTrackGenerator' in window)
|
|
32
|
+
setCameraSourceId(ret, new mstp_camera_source_1.MSTPCameraSource(ret, p, deviceId));
|
|
33
|
+
else if (profile_1.profile.preferImageBitmapCamera && typeof OffscreenCanvas !== "undefined")
|
|
34
|
+
setCameraSourceId(ret, new imagebitmap_camera_source_1.ImageBitmapCameraSource(ret, p, deviceId));
|
|
35
|
+
else
|
|
36
|
+
setCameraSourceId(ret, new camera_source_1.CameraSource(ret, p, deviceId));
|
|
37
|
+
loglevel_1.zcout("camera_source_t initialized");
|
|
38
|
+
return ret;
|
|
39
|
+
}
|
|
40
|
+
exports.createCameraSource = createCameraSource;
|
package/lib/camera-source.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { zappar_camera_source_t, zappar_pipeline_t } from "./gen/zappar";
|
|
2
2
|
import { HTMLElementSource } from "./html-element-source";
|
|
3
|
-
import { CameraFrameInfo } from "./source";
|
|
4
3
|
export declare class CameraSource extends HTMLElementSource {
|
|
5
4
|
private _impl;
|
|
6
5
|
private _deviceId;
|
|
@@ -8,19 +7,18 @@ export declare class CameraSource extends HTMLElementSource {
|
|
|
8
7
|
static DEFAULT_DEVICE_ID: string;
|
|
9
8
|
private _currentStream;
|
|
10
9
|
private _activeDeviceId;
|
|
11
|
-
|
|
12
|
-
static get(m: zappar_camera_source_t): CameraSource | undefined;
|
|
13
|
-
private constructor();
|
|
10
|
+
constructor(_impl: zappar_camera_source_t, pipeline: zappar_pipeline_t, _deviceId: string);
|
|
14
11
|
destroy(): void;
|
|
15
12
|
private _stop;
|
|
16
13
|
pause(): void;
|
|
17
14
|
start(): void;
|
|
18
15
|
private _getConstraints;
|
|
19
|
-
getFrame(allowRead: boolean):
|
|
16
|
+
getFrame(allowRead: boolean): void;
|
|
20
17
|
private _getUserMedia;
|
|
21
18
|
private _syncCamera;
|
|
22
19
|
private _hasStartedOrientation;
|
|
23
20
|
private _deviceMotionListener;
|
|
21
|
+
private _deviceOrientationListener;
|
|
24
22
|
private _startDeviceOrientation;
|
|
25
23
|
private _startDeviceMotion;
|
|
26
24
|
private _stopDeviceMotion;
|
package/lib/camera-source.js
CHANGED
|
@@ -15,8 +15,7 @@ const profile_1 = require("./profile");
|
|
|
15
15
|
const pipeline_1 = require("./pipeline");
|
|
16
16
|
const cameramodel_1 = require("./cameramodel");
|
|
17
17
|
const loglevel_1 = require("./loglevel");
|
|
18
|
-
|
|
19
|
-
let byId = new Map();
|
|
18
|
+
const camera_source_map_1 = require("./camera-source-map");
|
|
20
19
|
let _videoSingleton = document.createElement("video");
|
|
21
20
|
_videoSingleton.setAttribute('playsinline', '');
|
|
22
21
|
_videoSingleton.setAttribute('webkit-playsinline', '');
|
|
@@ -56,17 +55,8 @@ class CameraSource extends html_element_source_1.HTMLElementSource {
|
|
|
56
55
|
}
|
|
57
56
|
};
|
|
58
57
|
}
|
|
59
|
-
static create(p, deviceId) {
|
|
60
|
-
let ret = (latest++);
|
|
61
|
-
byId.set(ret, new CameraSource(ret, p, deviceId));
|
|
62
|
-
loglevel_1.zcout("camera_source_t initialized");
|
|
63
|
-
return ret;
|
|
64
|
-
}
|
|
65
|
-
static get(m) {
|
|
66
|
-
return byId.get(m);
|
|
67
|
-
}
|
|
68
58
|
destroy() {
|
|
69
|
-
|
|
59
|
+
camera_source_map_1.deleteCameraSource(this._impl);
|
|
70
60
|
super.destroy();
|
|
71
61
|
}
|
|
72
62
|
_stop() {
|
|
@@ -140,7 +130,7 @@ class CameraSource extends html_element_source_1.HTMLElementSource {
|
|
|
140
130
|
}
|
|
141
131
|
getFrame(allowRead) {
|
|
142
132
|
this._cameraToScreenRotation = cameramodel_1.cameraRotationForScreenOrientation(false);
|
|
143
|
-
|
|
133
|
+
super.getFrame(allowRead);
|
|
144
134
|
}
|
|
145
135
|
_getUserMedia() {
|
|
146
136
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -188,7 +178,7 @@ class CameraSource extends html_element_source_1.HTMLElementSource {
|
|
|
188
178
|
if (this._hasStartedOrientation)
|
|
189
179
|
return;
|
|
190
180
|
this._hasStartedOrientation = true;
|
|
191
|
-
|
|
181
|
+
this._deviceOrientationListener = (ev) => {
|
|
192
182
|
let pipeline = pipeline_1.Pipeline.get(this._pipeline);
|
|
193
183
|
if (!pipeline)
|
|
194
184
|
return;
|
|
@@ -196,13 +186,16 @@ class CameraSource extends html_element_source_1.HTMLElementSource {
|
|
|
196
186
|
if (ev.alpha === null || ev.beta === null || ev.gamma === null)
|
|
197
187
|
return;
|
|
198
188
|
pipeline.motionAttitudeSubmit(timeStamp, ev.alpha, ev.beta, ev.gamma);
|
|
199
|
-
}
|
|
189
|
+
};
|
|
190
|
+
window.addEventListener("deviceorientation", this._deviceOrientationListener);
|
|
200
191
|
}
|
|
201
192
|
_startDeviceMotion() {
|
|
202
193
|
window.addEventListener("devicemotion", this._deviceMotionListener, false);
|
|
203
194
|
}
|
|
204
195
|
_stopDeviceMotion() {
|
|
205
196
|
window.removeEventListener("devicemotion", this._deviceMotionListener);
|
|
197
|
+
if (this._deviceOrientationListener)
|
|
198
|
+
window.removeEventListener("deviceorientation", this._deviceOrientationListener);
|
|
206
199
|
}
|
|
207
200
|
}
|
|
208
201
|
exports.CameraSource = CameraSource;
|
package/lib/deserializer.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ interface Message {
|
|
|
7
7
|
dataWithLength: () => ArrayBuffer;
|
|
8
8
|
type: () => number;
|
|
9
9
|
matrix4x4: () => Float32Array;
|
|
10
|
+
matrix3x3: () => Float32Array;
|
|
10
11
|
identityCoefficients: () => Float32Array;
|
|
11
12
|
expressionCoefficients: () => Float32Array;
|
|
12
13
|
cameraModel: () => Float32Array;
|
package/lib/deserializer.js
CHANGED
|
@@ -50,6 +50,13 @@ class MessageDeserializer {
|
|
|
50
50
|
this._startOffset += len;
|
|
51
51
|
return ret;
|
|
52
52
|
},
|
|
53
|
+
matrix3x3: () => {
|
|
54
|
+
let len = this._i32View[this._startOffset++];
|
|
55
|
+
let ret = new Float32Array(len);
|
|
56
|
+
ret.set(this._f32View.subarray(this._startOffset, this._startOffset + 9));
|
|
57
|
+
this._startOffset += len;
|
|
58
|
+
return ret;
|
|
59
|
+
},
|
|
53
60
|
identityCoefficients: () => {
|
|
54
61
|
let len = this._i32View[this._startOffset++];
|
|
55
62
|
let ret = new Float32Array(len);
|
package/lib/drawcamera.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.cameraFrameTextureMatrix = exports.CameraDraw = void 0;
|
|
4
4
|
const shader_1 = require("./shader");
|
|
5
5
|
const gl_matrix_1 = require("gl-matrix");
|
|
6
|
+
let identity = gl_matrix_1.mat4.create();
|
|
6
7
|
class CameraDraw {
|
|
7
8
|
constructor(_gl) {
|
|
8
9
|
this._gl = _gl;
|
|
@@ -47,7 +48,7 @@ class CameraDraw {
|
|
|
47
48
|
let vbo = this._generate(gl, i);
|
|
48
49
|
gl.activeTexture(gl.TEXTURE0);
|
|
49
50
|
gl.useProgram(shader.prog);
|
|
50
|
-
gl.uniformMatrix4fv(shader.unif_skinTexTransform, false, cameraFrameTextureMatrix(i.dataWidth, i.dataHeight, screenWidth, screenHeight, i.uvTransform, mirror));
|
|
51
|
+
gl.uniformMatrix4fv(shader.unif_skinTexTransform, false, cameraFrameTextureMatrix(i.dataWidth, i.dataHeight, screenWidth, screenHeight, i.uvTransform || identity, mirror));
|
|
51
52
|
gl.uniform1i(shader.unif_skinSampler, 0);
|
|
52
53
|
gl.bindTexture(gl.TEXTURE_2D, i.texture);
|
|
53
54
|
gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
|
|
@@ -10,6 +10,7 @@ export declare class zappar_client {
|
|
|
10
10
|
private _latestId;
|
|
11
11
|
private _pipeline_state_by_instance;
|
|
12
12
|
private _camera_source_state_by_instance;
|
|
13
|
+
private _sequence_source_state_by_instance;
|
|
13
14
|
private _image_tracker_state_by_instance;
|
|
14
15
|
private _face_tracker_state_by_instance;
|
|
15
16
|
private _face_mesh_state_by_instance;
|
package/lib/gen/zappar-client.js
CHANGED
|
@@ -16,6 +16,7 @@ class zappar_client {
|
|
|
16
16
|
this._latestId = 1;
|
|
17
17
|
this._pipeline_state_by_instance = new Map();
|
|
18
18
|
this._camera_source_state_by_instance = new Map();
|
|
19
|
+
this._sequence_source_state_by_instance = new Map();
|
|
19
20
|
this._image_tracker_state_by_instance = new Map();
|
|
20
21
|
this._face_tracker_state_by_instance = new Map();
|
|
21
22
|
this._face_mesh_state_by_instance = new Map();
|
|
@@ -27,12 +28,12 @@ class zappar_client {
|
|
|
27
28
|
return this._globalState.log_level;
|
|
28
29
|
},
|
|
29
30
|
log_level_set: (level) => {
|
|
30
|
-
this.serializer.sendMessage(
|
|
31
|
+
this.serializer.sendMessage(34, m => {
|
|
31
32
|
m.logLevel(level);
|
|
32
33
|
});
|
|
33
34
|
},
|
|
34
35
|
analytics_project_id_set: (id) => {
|
|
35
|
-
this.serializer.sendMessage(
|
|
36
|
+
this.serializer.sendMessage(31, m => {
|
|
36
37
|
m.string(id);
|
|
37
38
|
});
|
|
38
39
|
},
|
|
@@ -44,10 +45,11 @@ class zappar_client {
|
|
|
44
45
|
camera_model: new Float32Array([300, 300, 160, 120, 0, 0]),
|
|
45
46
|
camera_pose: new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
|
|
46
47
|
camera_frame_camera_attitude: new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
|
|
48
|
+
camera_frame_device_attitude: new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
|
|
47
49
|
frame_number: 0,
|
|
48
50
|
};
|
|
49
51
|
this._pipeline_state_by_instance.set(newId, s);
|
|
50
|
-
this.serializer.sendMessage(
|
|
52
|
+
this.serializer.sendMessage(27, m => {
|
|
51
53
|
m.type(newId);
|
|
52
54
|
});
|
|
53
55
|
return newId;
|
|
@@ -57,7 +59,7 @@ class zappar_client {
|
|
|
57
59
|
if (!s)
|
|
58
60
|
throw new Error("This object has been destroyed");
|
|
59
61
|
this._pipeline_state_by_instance.delete(o);
|
|
60
|
-
this.serializer.sendMessage(
|
|
62
|
+
this.serializer.sendMessage(28, m => {
|
|
61
63
|
m.type(o);
|
|
62
64
|
});
|
|
63
65
|
},
|
|
@@ -87,7 +89,7 @@ class zappar_client {
|
|
|
87
89
|
throw new Error("This object has been destroyed");
|
|
88
90
|
return s.current_frame_user_data;
|
|
89
91
|
},
|
|
90
|
-
pipeline_camera_frame_submit: (o, data, width, height, user_data, camera_to_device_transform) => {
|
|
92
|
+
pipeline_camera_frame_submit: (o, data, width, height, user_data, camera_to_device_transform, camera_model, user_facing) => {
|
|
91
93
|
let s = this._pipeline_state_by_instance.get(o);
|
|
92
94
|
if (!s)
|
|
93
95
|
throw new Error("This object has been destroyed");
|
|
@@ -98,14 +100,27 @@ class zappar_client {
|
|
|
98
100
|
m.int(height);
|
|
99
101
|
m.int(user_data);
|
|
100
102
|
m.matrix4x4(camera_to_device_transform);
|
|
103
|
+
m.cameraModel(camera_model);
|
|
104
|
+
m.bool(user_facing);
|
|
101
105
|
});
|
|
102
106
|
},
|
|
107
|
+
pipeline_camera_frame_submit_raw_pointer: (o, data, dataLength, format, width, height, user_data, camera_to_device_transform, rotation, camera_model, user_facing) => {
|
|
108
|
+
let s = this._pipeline_state_by_instance.get(o);
|
|
109
|
+
if (!s)
|
|
110
|
+
throw new Error("This object has been destroyed");
|
|
111
|
+
},
|
|
103
112
|
pipeline_camera_frame_camera_attitude: (o) => {
|
|
104
113
|
let s = this._pipeline_state_by_instance.get(o);
|
|
105
114
|
if (!s)
|
|
106
115
|
throw new Error("This object has been destroyed");
|
|
107
116
|
return s.camera_frame_camera_attitude;
|
|
108
117
|
},
|
|
118
|
+
pipeline_camera_frame_device_attitude: (o) => {
|
|
119
|
+
let s = this._pipeline_state_by_instance.get(o);
|
|
120
|
+
if (!s)
|
|
121
|
+
throw new Error("This object has been destroyed");
|
|
122
|
+
return s.camera_frame_device_attitude;
|
|
123
|
+
},
|
|
109
124
|
pipeline_motion_accelerometer_submit: (o, time, x, y, z) => {
|
|
110
125
|
let s = this._pipeline_state_by_instance.get(o);
|
|
111
126
|
if (!s)
|
|
@@ -142,12 +157,21 @@ class zappar_client {
|
|
|
142
157
|
m.float(z);
|
|
143
158
|
});
|
|
144
159
|
},
|
|
160
|
+
pipeline_motion_attitude_matrix_submit: (o, mat) => {
|
|
161
|
+
let s = this._pipeline_state_by_instance.get(o);
|
|
162
|
+
if (!s)
|
|
163
|
+
throw new Error("This object has been destroyed");
|
|
164
|
+
this.serializer.sendMessage(13, m => {
|
|
165
|
+
m.type(o);
|
|
166
|
+
m.matrix4x4(mat);
|
|
167
|
+
});
|
|
168
|
+
},
|
|
145
169
|
// #### camera_source ####
|
|
146
170
|
camera_source_create: (pipeline, device_id) => {
|
|
147
171
|
let newId = (this._latestId++);
|
|
148
172
|
let s = {};
|
|
149
173
|
this._camera_source_state_by_instance.set(newId, s);
|
|
150
|
-
this.serializer.sendMessage(
|
|
174
|
+
this.serializer.sendMessage(29, m => {
|
|
151
175
|
m.type(newId);
|
|
152
176
|
m.type(pipeline);
|
|
153
177
|
m.string(device_id);
|
|
@@ -159,7 +183,27 @@ class zappar_client {
|
|
|
159
183
|
if (!s)
|
|
160
184
|
throw new Error("This object has been destroyed");
|
|
161
185
|
this._camera_source_state_by_instance.delete(o);
|
|
162
|
-
this.serializer.sendMessage(
|
|
186
|
+
this.serializer.sendMessage(30, m => {
|
|
187
|
+
m.type(o);
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
// #### sequence_source ####
|
|
191
|
+
sequence_source_create: (pipeline) => {
|
|
192
|
+
let newId = (this._latestId++);
|
|
193
|
+
let s = {};
|
|
194
|
+
this._sequence_source_state_by_instance.set(newId, s);
|
|
195
|
+
this.serializer.sendMessage(35, m => {
|
|
196
|
+
m.type(newId);
|
|
197
|
+
m.type(pipeline);
|
|
198
|
+
});
|
|
199
|
+
return newId;
|
|
200
|
+
},
|
|
201
|
+
sequence_source_destroy: (o) => {
|
|
202
|
+
let s = this._sequence_source_state_by_instance.get(o);
|
|
203
|
+
if (!s)
|
|
204
|
+
throw new Error("This object has been destroyed");
|
|
205
|
+
this._sequence_source_state_by_instance.delete(o);
|
|
206
|
+
this.serializer.sendMessage(36, m => {
|
|
163
207
|
m.type(o);
|
|
164
208
|
});
|
|
165
209
|
},
|
|
@@ -169,7 +213,6 @@ class zappar_client {
|
|
|
169
213
|
let s = {
|
|
170
214
|
enabled: true,
|
|
171
215
|
target_loaded_version: -1,
|
|
172
|
-
target_count: 0,
|
|
173
216
|
anchor_count: 0,
|
|
174
217
|
anchor_id: [],
|
|
175
218
|
anchor_pose: [],
|
|
@@ -186,7 +229,7 @@ class zappar_client {
|
|
|
186
229
|
if (!s)
|
|
187
230
|
throw new Error("This object has been destroyed");
|
|
188
231
|
this._image_tracker_state_by_instance.delete(o);
|
|
189
|
-
this.serializer.sendMessage(
|
|
232
|
+
this.serializer.sendMessage(14, m => {
|
|
190
233
|
m.type(o);
|
|
191
234
|
});
|
|
192
235
|
},
|
|
@@ -205,12 +248,6 @@ class zappar_client {
|
|
|
205
248
|
throw new Error("This object has been destroyed");
|
|
206
249
|
return s.target_loaded_version;
|
|
207
250
|
},
|
|
208
|
-
image_tracker_target_count: (o) => {
|
|
209
|
-
let s = this._image_tracker_state_by_instance.get(o);
|
|
210
|
-
if (!s)
|
|
211
|
-
throw new Error("This object has been destroyed");
|
|
212
|
-
return s.target_count;
|
|
213
|
-
},
|
|
214
251
|
image_tracker_enabled: (o) => {
|
|
215
252
|
let s = this._image_tracker_state_by_instance.get(o);
|
|
216
253
|
if (!s)
|
|
@@ -258,7 +295,7 @@ class zappar_client {
|
|
|
258
295
|
anchor_expression_coefficients: [],
|
|
259
296
|
};
|
|
260
297
|
this._face_tracker_state_by_instance.set(newId, s);
|
|
261
|
-
this.serializer.sendMessage(
|
|
298
|
+
this.serializer.sendMessage(20, m => {
|
|
262
299
|
m.type(newId);
|
|
263
300
|
m.type(pipeline);
|
|
264
301
|
});
|
|
@@ -269,7 +306,7 @@ class zappar_client {
|
|
|
269
306
|
if (!s)
|
|
270
307
|
throw new Error("This object has been destroyed");
|
|
271
308
|
this._face_tracker_state_by_instance.delete(o);
|
|
272
|
-
this.serializer.sendMessage(
|
|
309
|
+
this.serializer.sendMessage(21, m => {
|
|
273
310
|
m.type(o);
|
|
274
311
|
});
|
|
275
312
|
},
|
|
@@ -277,7 +314,7 @@ class zappar_client {
|
|
|
277
314
|
let s = this._face_tracker_state_by_instance.get(o);
|
|
278
315
|
if (!s)
|
|
279
316
|
throw new Error("This object has been destroyed");
|
|
280
|
-
this.serializer.sendMessage(
|
|
317
|
+
this.serializer.sendMessage(22, m => {
|
|
281
318
|
m.type(o);
|
|
282
319
|
m.dataWithLength(data);
|
|
283
320
|
});
|
|
@@ -292,7 +329,7 @@ class zappar_client {
|
|
|
292
329
|
let s = this._face_tracker_state_by_instance.get(o);
|
|
293
330
|
if (!s)
|
|
294
331
|
throw new Error("This object has been destroyed");
|
|
295
|
-
this.serializer.sendMessage(
|
|
332
|
+
this.serializer.sendMessage(23, m => {
|
|
296
333
|
m.type(o);
|
|
297
334
|
m.bool(enabled);
|
|
298
335
|
});
|
|
@@ -307,7 +344,7 @@ class zappar_client {
|
|
|
307
344
|
let s = this._face_tracker_state_by_instance.get(o);
|
|
308
345
|
if (!s)
|
|
309
346
|
throw new Error("This object has been destroyed");
|
|
310
|
-
this.serializer.sendMessage(
|
|
347
|
+
this.serializer.sendMessage(24, m => {
|
|
311
348
|
m.type(o);
|
|
312
349
|
m.int(num);
|
|
313
350
|
});
|
|
@@ -353,7 +390,7 @@ class zappar_client {
|
|
|
353
390
|
let newId = (this._latestId++);
|
|
354
391
|
let s = {};
|
|
355
392
|
this._face_mesh_state_by_instance.set(newId, s);
|
|
356
|
-
this.serializer.sendMessage(
|
|
393
|
+
this.serializer.sendMessage(25, m => {
|
|
357
394
|
m.type(newId);
|
|
358
395
|
});
|
|
359
396
|
return newId;
|
|
@@ -363,7 +400,7 @@ class zappar_client {
|
|
|
363
400
|
if (!s)
|
|
364
401
|
throw new Error("This object has been destroyed");
|
|
365
402
|
this._face_mesh_state_by_instance.delete(o);
|
|
366
|
-
this.serializer.sendMessage(
|
|
403
|
+
this.serializer.sendMessage(26, m => {
|
|
367
404
|
m.type(o);
|
|
368
405
|
});
|
|
369
406
|
},
|
|
@@ -372,7 +409,7 @@ class zappar_client {
|
|
|
372
409
|
let newId = (this._latestId++);
|
|
373
410
|
let s = {};
|
|
374
411
|
this._face_landmark_state_by_instance.set(newId, s);
|
|
375
|
-
this.serializer.sendMessage(
|
|
412
|
+
this.serializer.sendMessage(32, m => {
|
|
376
413
|
m.type(newId);
|
|
377
414
|
m.faceLandmarkName(landmark);
|
|
378
415
|
});
|
|
@@ -383,7 +420,7 @@ class zappar_client {
|
|
|
383
420
|
if (!s)
|
|
384
421
|
throw new Error("This object has been destroyed");
|
|
385
422
|
this._face_landmark_state_by_instance.delete(o);
|
|
386
|
-
this.serializer.sendMessage(
|
|
423
|
+
this.serializer.sendMessage(33, m => {
|
|
387
424
|
m.type(o);
|
|
388
425
|
});
|
|
389
426
|
},
|
|
@@ -398,7 +435,7 @@ class zappar_client {
|
|
|
398
435
|
formats: (1 << 17) - 1,
|
|
399
436
|
};
|
|
400
437
|
this._barcode_finder_state_by_instance.set(newId, s);
|
|
401
|
-
this.serializer.sendMessage(
|
|
438
|
+
this.serializer.sendMessage(16, m => {
|
|
402
439
|
m.type(newId);
|
|
403
440
|
m.type(pipeline);
|
|
404
441
|
});
|
|
@@ -409,7 +446,7 @@ class zappar_client {
|
|
|
409
446
|
if (!s)
|
|
410
447
|
throw new Error("This object has been destroyed");
|
|
411
448
|
this._barcode_finder_state_by_instance.delete(o);
|
|
412
|
-
this.serializer.sendMessage(
|
|
449
|
+
this.serializer.sendMessage(17, m => {
|
|
413
450
|
m.type(o);
|
|
414
451
|
});
|
|
415
452
|
},
|
|
@@ -417,7 +454,7 @@ class zappar_client {
|
|
|
417
454
|
let s = this._barcode_finder_state_by_instance.get(o);
|
|
418
455
|
if (!s)
|
|
419
456
|
throw new Error("This object has been destroyed");
|
|
420
|
-
this.serializer.sendMessage(
|
|
457
|
+
this.serializer.sendMessage(18, m => {
|
|
421
458
|
m.type(o);
|
|
422
459
|
m.bool(enabled);
|
|
423
460
|
});
|
|
@@ -456,7 +493,7 @@ class zappar_client {
|
|
|
456
493
|
let s = this._barcode_finder_state_by_instance.get(o);
|
|
457
494
|
if (!s)
|
|
458
495
|
throw new Error("This object has been destroyed");
|
|
459
|
-
this.serializer.sendMessage(
|
|
496
|
+
this.serializer.sendMessage(19, m => {
|
|
460
497
|
m.type(o);
|
|
461
498
|
m.barcodeFormat(f);
|
|
462
499
|
});
|
|
@@ -480,7 +517,7 @@ class zappar_client {
|
|
|
480
517
|
if (!s)
|
|
481
518
|
throw new Error("This object has been destroyed");
|
|
482
519
|
this._instant_world_tracker_state_by_instance.delete(o);
|
|
483
|
-
this.serializer.sendMessage(
|
|
520
|
+
this.serializer.sendMessage(15, m => {
|
|
484
521
|
m.type(o);
|
|
485
522
|
});
|
|
486
523
|
},
|
|
@@ -505,7 +542,7 @@ class zappar_client {
|
|
|
505
542
|
throw new Error("This object has been destroyed");
|
|
506
543
|
return s.pose;
|
|
507
544
|
},
|
|
508
|
-
|
|
545
|
+
instant_world_tracker_anchor_pose_set_from_camera_offset_raw: (o, x, y, z, orientation) => {
|
|
509
546
|
let s = this._instant_world_tracker_state_by_instance.get(o);
|
|
510
547
|
if (!s)
|
|
511
548
|
throw new Error("This object has been destroyed");
|
|
@@ -555,20 +592,20 @@ class zappar_client {
|
|
|
555
592
|
inst.camera_frame_camera_attitude = msg.matrix4x4();
|
|
556
593
|
break;
|
|
557
594
|
}
|
|
558
|
-
case
|
|
595
|
+
case 12: {
|
|
559
596
|
let handle = msg.type();
|
|
560
|
-
let inst = this.
|
|
597
|
+
let inst = this._pipeline_state_by_instance.get(handle);
|
|
561
598
|
if (!inst)
|
|
562
599
|
return;
|
|
563
|
-
inst.
|
|
600
|
+
inst.camera_frame_device_attitude = msg.matrix4x4();
|
|
564
601
|
break;
|
|
565
602
|
}
|
|
566
|
-
case
|
|
603
|
+
case 19: {
|
|
567
604
|
let handle = msg.type();
|
|
568
605
|
let inst = this._image_tracker_state_by_instance.get(handle);
|
|
569
606
|
if (!inst)
|
|
570
607
|
return;
|
|
571
|
-
inst.
|
|
608
|
+
inst.target_loaded_version = msg.int();
|
|
572
609
|
break;
|
|
573
610
|
}
|
|
574
611
|
case 1: {
|
|
@@ -597,7 +634,7 @@ class zappar_client {
|
|
|
597
634
|
inst.anchor_pose[indx] = msg.matrix4x4();
|
|
598
635
|
break;
|
|
599
636
|
}
|
|
600
|
-
case
|
|
637
|
+
case 18: {
|
|
601
638
|
let handle = msg.type();
|
|
602
639
|
let inst = this._face_tracker_state_by_instance.get(handle);
|
|
603
640
|
if (!inst)
|
|
@@ -605,7 +642,7 @@ class zappar_client {
|
|
|
605
642
|
inst.model_loaded = msg.int();
|
|
606
643
|
break;
|
|
607
644
|
}
|
|
608
|
-
case
|
|
645
|
+
case 13: {
|
|
609
646
|
let handle = msg.type();
|
|
610
647
|
let inst = this._face_tracker_state_by_instance.get(handle);
|
|
611
648
|
if (!inst)
|
|
@@ -613,7 +650,7 @@ class zappar_client {
|
|
|
613
650
|
inst.anchor_count = msg.int();
|
|
614
651
|
break;
|
|
615
652
|
}
|
|
616
|
-
case
|
|
653
|
+
case 14: {
|
|
617
654
|
let handle = msg.type();
|
|
618
655
|
let inst = this._face_tracker_state_by_instance.get(handle);
|
|
619
656
|
if (!inst)
|
|
@@ -622,7 +659,7 @@ class zappar_client {
|
|
|
622
659
|
inst.anchor_id[indx] = msg.string();
|
|
623
660
|
break;
|
|
624
661
|
}
|
|
625
|
-
case
|
|
662
|
+
case 15: {
|
|
626
663
|
let handle = msg.type();
|
|
627
664
|
let inst = this._face_tracker_state_by_instance.get(handle);
|
|
628
665
|
if (!inst)
|
|
@@ -631,7 +668,7 @@ class zappar_client {
|
|
|
631
668
|
inst.anchor_pose[indx] = msg.matrix4x4();
|
|
632
669
|
break;
|
|
633
670
|
}
|
|
634
|
-
case
|
|
671
|
+
case 16: {
|
|
635
672
|
let handle = msg.type();
|
|
636
673
|
let inst = this._face_tracker_state_by_instance.get(handle);
|
|
637
674
|
if (!inst)
|
|
@@ -640,7 +677,7 @@ class zappar_client {
|
|
|
640
677
|
inst.anchor_identity_coefficients[indx] = msg.identityCoefficients();
|
|
641
678
|
break;
|
|
642
679
|
}
|
|
643
|
-
case
|
|
680
|
+
case 17: {
|
|
644
681
|
let handle = msg.type();
|
|
645
682
|
let inst = this._face_tracker_state_by_instance.get(handle);
|
|
646
683
|
if (!inst)
|