@zappar/zappar-cv 3.0.1-alpha.1 → 3.0.1-alpha.3
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 +6 -0
- package/lib/camera-frame-data.d.ts +5 -0
- package/lib/camera-frame-data.js +1 -0
- package/lib/deserializer.d.ts +1 -0
- package/lib/deserializer.js +7 -0
- package/lib/drawgrid.d.ts +2 -0
- package/lib/drawgrid.js +136 -0
- package/lib/drawpoints.d.ts +10 -0
- package/lib/drawpoints.js +180 -0
- package/lib/gen/zappar-bridge.d.ts +126 -0
- package/lib/gen/zappar-bridge.js +7 -0
- package/lib/gen/zappar-client.d.ts +2 -2
- package/lib/gen/zappar-client.js +76 -5
- package/lib/gen/zappar-cwrap.js +81 -0
- package/lib/gen/zappar-native.d.ts +10 -0
- package/lib/gen/zappar-server.js +24 -0
- package/lib/gen/zappar.d.ts +7 -0
- package/lib/html-element-source.js +1 -0
- package/lib/imagetracker.d.ts +3 -2
- package/lib/index.d.ts +1 -0
- package/lib/native.js +28 -3
- package/lib/pipeline.d.ts +11 -3
- package/lib/pipeline.js +72 -3
- package/lib/serializer.d.ts +1 -0
- package/lib/serializer.js +1 -0
- package/lib/source.d.ts +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/worker-server.js +48 -3
- package/lib/workerinterface.d.ts +16 -0
- package/lib/zappar-cv.js +134 -133
- package/lib/zappar-cv.wasm +0 -0
- package/package.json +1 -1
- package/umd/429.zappar-cv.js +1 -1
- package/umd/867.zappar-cv.js +1 -1
- package/umd/{501114eb92cddf5f56fe.wasm → a5f074b0d01366261164.wasm} +0 -0
- package/umd/zappar-cv.js +1 -1
- package/umd/zappar-cv.worker.js +1 -1
package/lib/gen/zappar-cwrap.js
CHANGED
|
@@ -8,6 +8,18 @@ export function getRuntimeObject(mod) {
|
|
|
8
8
|
]);
|
|
9
9
|
let pipeline_create_wrapped = mod.cwrap("zappar_pipeline_create", "number", []);
|
|
10
10
|
let pipeline_destroy_wrapped = mod.cwrap("zappar_pipeline_destroy", null, ["number"]);
|
|
11
|
+
let pipeline_camera_frame_data_raw_wrapped = mod.cwrap("zappar_pipeline_camera_frame_data_raw", "number", [
|
|
12
|
+
"number"
|
|
13
|
+
]);
|
|
14
|
+
let pipeline_camera_frame_data_raw_size_wrapped = mod.cwrap("zappar_pipeline_camera_frame_data_raw_size", "number", [
|
|
15
|
+
"number"
|
|
16
|
+
]);
|
|
17
|
+
let pipeline_camera_frame_data_raw_width_wrapped = mod.cwrap("zappar_pipeline_camera_frame_data_raw_width", "number", [
|
|
18
|
+
"number"
|
|
19
|
+
]);
|
|
20
|
+
let pipeline_camera_frame_data_raw_height_wrapped = mod.cwrap("zappar_pipeline_camera_frame_data_raw_height", "number", [
|
|
21
|
+
"number"
|
|
22
|
+
]);
|
|
11
23
|
let pipeline_frame_update_wrapped = mod.cwrap("zappar_pipeline_frame_update", null, [
|
|
12
24
|
"number"
|
|
13
25
|
]);
|
|
@@ -220,6 +232,25 @@ export function getRuntimeObject(mod) {
|
|
|
220
232
|
let world_tracker_reset_wrapped = mod.cwrap("zappar_world_tracker_reset", null, [
|
|
221
233
|
"number"
|
|
222
234
|
]);
|
|
235
|
+
let world_tracker_debug_enabled_wrapped = mod.cwrap("zappar_world_tracker_debug_enabled", "number", [
|
|
236
|
+
"number"
|
|
237
|
+
]);
|
|
238
|
+
let world_tracker_debug_enabled_set_wrapped = mod.cwrap("zappar_world_tracker_debug_enabled_set", null, [
|
|
239
|
+
"number",
|
|
240
|
+
"number"
|
|
241
|
+
]);
|
|
242
|
+
let world_tracker_debug_tracks_data_size_wrapped = mod.cwrap("zappar_world_tracker_debug_tracks_data_size", "number", [
|
|
243
|
+
"number"
|
|
244
|
+
]);
|
|
245
|
+
let world_tracker_debug_tracks_data_wrapped = mod.cwrap("zappar_world_tracker_debug_tracks_data", "number", [
|
|
246
|
+
"number"
|
|
247
|
+
]);
|
|
248
|
+
let world_tracker_debug_projections_data_size_wrapped = mod.cwrap("zappar_world_tracker_debug_projections_data_size", "number", [
|
|
249
|
+
"number"
|
|
250
|
+
]);
|
|
251
|
+
let world_tracker_debug_projections_data_wrapped = mod.cwrap("zappar_world_tracker_debug_projections_data", "number", [
|
|
252
|
+
"number"
|
|
253
|
+
]);
|
|
223
254
|
let dataArrayArgLength = 32;
|
|
224
255
|
let dataArrayArg = mod._malloc(dataArrayArgLength);
|
|
225
256
|
let floatDataArrayArgLength = 16 * 4;
|
|
@@ -257,6 +288,22 @@ export function getRuntimeObject(mod) {
|
|
|
257
288
|
pipeline_destroy: () => {
|
|
258
289
|
pipeline_destroy_wrapped();
|
|
259
290
|
},
|
|
291
|
+
pipeline_camera_frame_data_raw: (o) => {
|
|
292
|
+
let ret = pipeline_camera_frame_data_raw_wrapped(o);
|
|
293
|
+
return ret;
|
|
294
|
+
},
|
|
295
|
+
pipeline_camera_frame_data_raw_size: (o) => {
|
|
296
|
+
let ret = pipeline_camera_frame_data_raw_size_wrapped(o);
|
|
297
|
+
return ret;
|
|
298
|
+
},
|
|
299
|
+
pipeline_camera_frame_data_raw_width: (o) => {
|
|
300
|
+
let ret = pipeline_camera_frame_data_raw_width_wrapped(o);
|
|
301
|
+
return ret;
|
|
302
|
+
},
|
|
303
|
+
pipeline_camera_frame_data_raw_height: (o) => {
|
|
304
|
+
let ret = pipeline_camera_frame_data_raw_height_wrapped(o);
|
|
305
|
+
return ret;
|
|
306
|
+
},
|
|
260
307
|
pipeline_frame_update: (o) => {
|
|
261
308
|
let ret = pipeline_frame_update_wrapped(o);
|
|
262
309
|
return ret;
|
|
@@ -679,5 +726,39 @@ export function getRuntimeObject(mod) {
|
|
|
679
726
|
let ret = world_tracker_reset_wrapped(o);
|
|
680
727
|
return ret;
|
|
681
728
|
},
|
|
729
|
+
world_tracker_debug_enabled: (o) => {
|
|
730
|
+
let ret = world_tracker_debug_enabled_wrapped(o);
|
|
731
|
+
ret = ret === 1;
|
|
732
|
+
return ret;
|
|
733
|
+
},
|
|
734
|
+
world_tracker_debug_enabled_set: (o, debug_enabled) => {
|
|
735
|
+
let arg_debug_enabled = debug_enabled ? 1 : 0;
|
|
736
|
+
let ret = world_tracker_debug_enabled_set_wrapped(o, arg_debug_enabled);
|
|
737
|
+
return ret;
|
|
738
|
+
},
|
|
739
|
+
world_tracker_debug_tracks_data_size: (o) => {
|
|
740
|
+
let ret = world_tracker_debug_tracks_data_size_wrapped(o);
|
|
741
|
+
return ret;
|
|
742
|
+
},
|
|
743
|
+
world_tracker_debug_tracks_data: (o) => {
|
|
744
|
+
let ret = world_tracker_debug_tracks_data_wrapped(o);
|
|
745
|
+
let retsize = world_tracker_debug_tracks_data_size_wrapped(o);
|
|
746
|
+
let ab = new Float32Array(retsize);
|
|
747
|
+
ab.set(mod.HEAPF32.subarray(ret / 4, retsize + ret / 4));
|
|
748
|
+
ret = ab;
|
|
749
|
+
return ret;
|
|
750
|
+
},
|
|
751
|
+
world_tracker_debug_projections_data_size: (o) => {
|
|
752
|
+
let ret = world_tracker_debug_projections_data_size_wrapped(o);
|
|
753
|
+
return ret;
|
|
754
|
+
},
|
|
755
|
+
world_tracker_debug_projections_data: (o) => {
|
|
756
|
+
let ret = world_tracker_debug_projections_data_wrapped(o);
|
|
757
|
+
let retsize = world_tracker_debug_projections_data_size_wrapped(o);
|
|
758
|
+
let ab = new Float32Array(retsize);
|
|
759
|
+
ab.set(mod.HEAPF32.subarray(ret / 4, retsize + ret / 4));
|
|
760
|
+
ret = ab;
|
|
761
|
+
return ret;
|
|
762
|
+
},
|
|
682
763
|
};
|
|
683
764
|
}
|
|
@@ -102,6 +102,10 @@ export interface zappar_cwrap {
|
|
|
102
102
|
analytics_project_id_set(id: string, uid: string): void;
|
|
103
103
|
pipeline_create(): zappar_pipeline_t;
|
|
104
104
|
pipeline_destroy(o: zappar_pipeline_t): void;
|
|
105
|
+
pipeline_camera_frame_data_raw(o: zappar_pipeline_t): number;
|
|
106
|
+
pipeline_camera_frame_data_raw_size(o: zappar_pipeline_t): number;
|
|
107
|
+
pipeline_camera_frame_data_raw_width(o: zappar_pipeline_t): number;
|
|
108
|
+
pipeline_camera_frame_data_raw_height(o: zappar_pipeline_t): number;
|
|
105
109
|
pipeline_frame_update(o: zappar_pipeline_t): void;
|
|
106
110
|
pipeline_frame_number(o: zappar_pipeline_t): number;
|
|
107
111
|
pipeline_camera_model(o: zappar_pipeline_t): Float32Array;
|
|
@@ -175,4 +179,10 @@ export interface zappar_cwrap {
|
|
|
175
179
|
world_tracker_ground_anchor_valid(o: zappar_world_tracker_t): boolean;
|
|
176
180
|
world_tracker_ground_anchor_pose_raw(o: zappar_world_tracker_t): Float32Array;
|
|
177
181
|
world_tracker_reset(o: zappar_world_tracker_t): void;
|
|
182
|
+
world_tracker_debug_enabled(o: zappar_world_tracker_t): boolean;
|
|
183
|
+
world_tracker_debug_enabled_set(o: zappar_world_tracker_t, debug_enabled: boolean): void;
|
|
184
|
+
world_tracker_debug_tracks_data_size(o: zappar_world_tracker_t): number;
|
|
185
|
+
world_tracker_debug_tracks_data(o: zappar_world_tracker_t): Float32Array;
|
|
186
|
+
world_tracker_debug_projections_data_size(o: zappar_world_tracker_t): number;
|
|
187
|
+
world_tracker_debug_projections_data(o: zappar_world_tracker_t): Float32Array;
|
|
178
188
|
}
|
package/lib/gen/zappar-server.js
CHANGED
|
@@ -384,6 +384,14 @@ export class zappar_server {
|
|
|
384
384
|
this._impl.world_tracker_reset(obj);
|
|
385
385
|
break;
|
|
386
386
|
}
|
|
387
|
+
case 45: {
|
|
388
|
+
let clientId = msg.type();
|
|
389
|
+
let obj = this._world_tracker_by_instance.get(clientId);
|
|
390
|
+
if (obj === undefined)
|
|
391
|
+
return;
|
|
392
|
+
this._impl.world_tracker_debug_enabled_set(obj, msg.bool());
|
|
393
|
+
break;
|
|
394
|
+
}
|
|
387
395
|
}
|
|
388
396
|
});
|
|
389
397
|
}
|
|
@@ -598,6 +606,22 @@ export class zappar_server {
|
|
|
598
606
|
msg.type(k);
|
|
599
607
|
msg.matrix4x4(this._impl.world_tracker_ground_anchor_pose_raw(v));
|
|
600
608
|
});
|
|
609
|
+
serializer.sendMessage(29, msg => {
|
|
610
|
+
msg.type(k);
|
|
611
|
+
msg.int(this._impl.world_tracker_debug_tracks_data_size(v));
|
|
612
|
+
});
|
|
613
|
+
serializer.sendMessage(28, msg => {
|
|
614
|
+
msg.type(k);
|
|
615
|
+
msg.floatArray(this._impl.world_tracker_debug_tracks_data(v));
|
|
616
|
+
});
|
|
617
|
+
serializer.sendMessage(31, msg => {
|
|
618
|
+
msg.type(k);
|
|
619
|
+
msg.int(this._impl.world_tracker_debug_projections_data_size(v));
|
|
620
|
+
});
|
|
621
|
+
serializer.sendMessage(30, msg => {
|
|
622
|
+
msg.type(k);
|
|
623
|
+
msg.floatArray(this._impl.world_tracker_debug_projections_data(v));
|
|
624
|
+
});
|
|
601
625
|
}
|
|
602
626
|
}
|
|
603
627
|
}
|
package/lib/gen/zappar.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export interface zappar {
|
|
|
49
49
|
camera_user_facing(indx: number): boolean;
|
|
50
50
|
projection_matrix_from_camera_model(model: Float32Array, renderWidth: number, renderHeight: number): Float32Array;
|
|
51
51
|
projection_matrix_from_camera_model_ext(model: Float32Array, renderWidth: number, renderHeight: number, zNear: number, zFar: number): Float32Array;
|
|
52
|
+
pose_from_raw(raw_pose: Float32Array, mirror: boolean): Float32Array;
|
|
52
53
|
log_level(): log_level_t;
|
|
53
54
|
log_level_set(level: log_level_t): void;
|
|
54
55
|
permission_request_ui(): void;
|
|
@@ -200,4 +201,10 @@ export interface zappar {
|
|
|
200
201
|
world_tracker_ground_anchor_pose_camera_relative(o: zappar_world_tracker_t, mirror: boolean): Float32Array;
|
|
201
202
|
world_tracker_ground_anchor_pose(o: zappar_world_tracker_t, camera_pose: Float32Array, mirror: boolean): Float32Array;
|
|
202
203
|
world_tracker_reset(o: zappar_world_tracker_t): void;
|
|
204
|
+
world_tracker_debug_enabled(o: zappar_world_tracker_t): boolean;
|
|
205
|
+
world_tracker_debug_enabled_set(o: zappar_world_tracker_t, debug_enabled: boolean): void;
|
|
206
|
+
world_tracker_debug_tracks_data_size(o: zappar_world_tracker_t): number;
|
|
207
|
+
world_tracker_debug_tracks_data(o: zappar_world_tracker_t): Float32Array;
|
|
208
|
+
world_tracker_debug_projections_data_size(o: zappar_world_tracker_t): number;
|
|
209
|
+
world_tracker_debug_projections_data(o: zappar_world_tracker_t): Float32Array;
|
|
203
210
|
}
|
|
@@ -89,6 +89,7 @@ export class HTMLElementSource extends Source {
|
|
|
89
89
|
if (info) {
|
|
90
90
|
let token = pipeline.registerToken(info);
|
|
91
91
|
pipeline.sendDataToWorker(info.data || new ArrayBuffer(0), token, info.dataWidth, info.dataHeight, info.userFacing, info.cameraToDevice, info.cameraModel);
|
|
92
|
+
info.data = undefined;
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
catch (ex) {
|
package/lib/imagetracker.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { zappar_image_tracker_t, zappar_pipeline_t } from "./gen/zappar";
|
|
2
|
-
import {
|
|
2
|
+
import { zappar } from "./gen/zappar-bridge";
|
|
3
|
+
import { image_target_type_t } from "./gen/zappar-native";
|
|
3
4
|
interface PreviewInfo {
|
|
4
5
|
compressed: Uint8Array;
|
|
5
6
|
mimeType: string;
|
|
@@ -26,7 +27,7 @@ export declare class ImageTracker {
|
|
|
26
27
|
private _client;
|
|
27
28
|
private _impl;
|
|
28
29
|
private _targets;
|
|
29
|
-
static create(pipeline: zappar_pipeline_t, client:
|
|
30
|
+
static create(pipeline: zappar_pipeline_t, client: zappar): zappar_image_tracker_t;
|
|
30
31
|
static get(p: zappar_image_tracker_t): ImageTracker | undefined;
|
|
31
32
|
private constructor();
|
|
32
33
|
destroy(): void;
|
package/lib/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ import { Additional } from "./additional";
|
|
|
3
3
|
import { Options } from "./options";
|
|
4
4
|
export declare type Zappar = zappar & Additional;
|
|
5
5
|
export declare function initialize(opts?: Options): Zappar;
|
|
6
|
+
export { CameraFrameData } from './camera-frame-data';
|
|
6
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, 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 } from "./gen/zappar";
|
package/lib/native.js
CHANGED
|
@@ -26,6 +26,7 @@ import { createCameraSource, getCameraSource } from "./camera-source-map";
|
|
|
26
26
|
import { gfx } from "./gfx";
|
|
27
27
|
import { ImageTracker } from "./imagetracker";
|
|
28
28
|
import { MSTPCameraSource } from "./mstp-camera-source";
|
|
29
|
+
import { drawGrid } from "./drawgrid";
|
|
29
30
|
let client;
|
|
30
31
|
export function initialize(opts) {
|
|
31
32
|
if (client)
|
|
@@ -49,7 +50,7 @@ export function initialize(opts) {
|
|
|
49
50
|
c.impl.analytics_project_id_set(".wiz" + pathParts[1], uid);
|
|
50
51
|
}
|
|
51
52
|
messageManager.onIncomingMessage.bind(msg => {
|
|
52
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
53
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
53
54
|
switch (msg.t) {
|
|
54
55
|
case "zappar":
|
|
55
56
|
(_a = Pipeline.get(msg.p)) === null || _a === void 0 ? void 0 : _a.pendingMessages.push(msg.d);
|
|
@@ -72,6 +73,11 @@ export function initialize(opts) {
|
|
|
72
73
|
(_g = (_f = Pipeline.get(msgt.p)) === null || _f === void 0 ? void 0 : _f.imageBitmapFromWorker) === null || _g === void 0 ? void 0 : _g.call(_f, msgt);
|
|
73
74
|
break;
|
|
74
75
|
}
|
|
76
|
+
case "raw": {
|
|
77
|
+
let msgt = msg;
|
|
78
|
+
(_h = Pipeline.get(msgt.p)) === null || _h === void 0 ? void 0 : _h.cameraFrameDataRawResult(msgt);
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
75
81
|
case "streamEndedS2C": {
|
|
76
82
|
let msgt = msg;
|
|
77
83
|
const src = getCameraSource(msgt.source);
|
|
@@ -132,11 +138,30 @@ export function initialize(opts) {
|
|
|
132
138
|
}
|
|
133
139
|
}
|
|
134
140
|
});
|
|
135
|
-
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_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,
|
|
141
|
+
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_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) => {
|
|
142
|
+
let res = applyScreenCounterRotation(undefined, raw_pose);
|
|
143
|
+
if (mirror) {
|
|
144
|
+
let scale = mat4.create();
|
|
145
|
+
mat4.fromScaling(scale, [-1, 1, 1]);
|
|
146
|
+
mat4.multiply(res, scale, res);
|
|
147
|
+
mat4.multiply(res, res, scale);
|
|
148
|
+
}
|
|
149
|
+
return res;
|
|
150
|
+
}, pipeline_create: () => Pipeline.create(c.impl, messageManager), pipeline_frame_update: (p) => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.frameUpdate(c); }, pipeline_camera_frame_draw_gl: (pipeline, screenWidth, screenHeight, mirror) => {
|
|
136
151
|
var _a;
|
|
137
152
|
(_a = Pipeline.get(pipeline)) === null || _a === void 0 ? void 0 : _a.cameraFrameDrawGL(screenWidth, screenHeight, mirror);
|
|
153
|
+
}, pipeline_camera_frame_data_width: (pipeline) => {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
const info = (_a = Pipeline.get(pipeline)) === null || _a === void 0 ? void 0 : _a.getCurrentCameraInfo();
|
|
156
|
+
return (_b = info === null || info === void 0 ? void 0 : info.dataWidth) !== null && _b !== void 0 ? _b : 0;
|
|
157
|
+
}, pipeline_camera_frame_data_height: (pipeline) => {
|
|
158
|
+
var _a, _b;
|
|
159
|
+
const info = (_a = Pipeline.get(pipeline)) === null || _a === void 0 ? void 0 : _a.getCurrentCameraInfo();
|
|
160
|
+
return (_b = info === null || info === void 0 ? void 0 : info.dataHeight) !== null && _b !== void 0 ? _b : 0;
|
|
138
161
|
}, draw_plane: (gl, projectionMatrix, cameraMatrix, targetMatrix, texture) => {
|
|
139
162
|
drawPlane(gl, projectionMatrix, cameraMatrix, targetMatrix, texture);
|
|
163
|
+
}, draw_grid: (gl, projectionMatrix, cameraMatrix, targetMatrix) => {
|
|
164
|
+
drawGrid(gl, projectionMatrix, cameraMatrix, targetMatrix);
|
|
140
165
|
}, pipeline_draw_face: (p, projectionMatrix, cameraMatrix, targetMatrix, o) => {
|
|
141
166
|
var _a;
|
|
142
167
|
let obj = getFaceMesh(o);
|
|
@@ -156,7 +181,7 @@ export function initialize(opts) {
|
|
|
156
181
|
return;
|
|
157
182
|
}
|
|
158
183
|
(_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.drawImageTargetPreview(projectionMatrix, cameraMatrix, targetMatrix, indx, obj);
|
|
159
|
-
}, projection_matrix_from_camera_model: projectionMatrix, projection_matrix_from_camera_model_ext: projectionMatrix, pipeline_process_gl: p => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.processGL(); }, pipeline_gl_context_set: (p, gl, texturePool) => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.glContextSet(gl, texturePool); }, pipeline_gl_context_lost: (p) => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.glContextLost(); }, pipeline_camera_frame_upload_gl: p => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.uploadGL(); }, pipeline_camera_frame_texture_gl: p => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.cameraFrameTexture(); }, pipeline_camera_frame_texture_matrix: (p, sw, sh, mirror) => { var _a; return ((_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.cameraFrameTextureMatrix(sw, sh, mirror)) || mat4.create(); }, pipeline_camera_frame_user_facing: p => { var _a; return ((_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.cameraFrameUserFacing()) || false; }, pipeline_camera_pose_default: () => mat4.create(), pipeline_camera_pose_with_attitude: (p, mirror) => { var _a; return ((_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.cameraPoseWithAttitude(mirror)) || mat4.create(); }, pipeline_camera_pose_with_origin: (p, o) => { let res = mat4.create(); mat4.invert(res, o); return res; }, pipeline_sequence_record_clear: p => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.sequenceRecordClear(); }, pipeline_sequence_record_start: (p, expectedFrames) => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.sequenceRecordStart(expectedFrames); }, pipeline_sequence_record_stop: p => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.sequenceRecordStop(); }, pipeline_sequence_record_device_attitude_matrices_set: (p, v) => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.sequenceRecordDeviceAttitudeMatrices(v); }, pipeline_sequence_record_data: p => { var _a; return ((_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.sequenceRecordData()) || new Uint8Array(0); }, pipeline_sequence_record_data_size: p => { var _a; return ((_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.sequenceRecordData().byteLength) || 0; }, instant_world_tracker_anchor_pose_camera_relative: (o, mirror) => {
|
|
184
|
+
}, projection_matrix_from_camera_model: projectionMatrix, projection_matrix_from_camera_model_ext: projectionMatrix, pipeline_process_gl: p => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.processGL(); }, pipeline_gl_context_set: (p, gl, texturePool) => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.glContextSet(gl, texturePool); }, pipeline_gl_context_lost: (p) => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.glContextLost(); }, pipeline_camera_frame_upload_gl: p => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.uploadGL(); }, pipeline_camera_frame_texture_gl: p => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.cameraFrameTexture(); }, pipeline_camera_frame_texture_matrix: (p, sw, sh, mirror) => { var _a; return ((_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.cameraFrameTextureMatrix(sw, sh, mirror)) || mat4.create(); }, pipeline_camera_frame_user_facing: p => { var _a; return ((_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.cameraFrameUserFacing()) || false; }, pipeline_camera_pose_default: () => mat4.create(), pipeline_camera_pose_with_attitude: (p, mirror) => { var _a; return ((_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.cameraPoseWithAttitude(mirror)) || mat4.create(); }, pipeline_camera_pose_with_origin: (p, o) => { let res = mat4.create(); mat4.invert(res, o); return res; }, pipeline_sequence_record_clear: p => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.sequenceRecordClear(); }, pipeline_sequence_record_start: (p, expectedFrames) => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.sequenceRecordStart(expectedFrames); }, pipeline_sequence_record_stop: p => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.sequenceRecordStop(); }, pipeline_sequence_record_device_attitude_matrices_set: (p, v) => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.sequenceRecordDeviceAttitudeMatrices(v); }, pipeline_sequence_record_data: p => { var _a; return ((_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.sequenceRecordData()) || new Uint8Array(0); }, pipeline_sequence_record_data_size: p => { var _a; return ((_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.sequenceRecordData().byteLength) || 0; }, pipeline_camera_frame_data_raw: p => { var _a; return ((_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.getCameraFrameDataRaw()) || Promise.reject(); }, pipeline_camera_frame_data_raw_enabled_set: (p, v) => { var _a; return (_a = Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.setCameraFrameDataRawEnabled(v); }, instant_world_tracker_anchor_pose_camera_relative: (o, mirror) => {
|
|
160
185
|
let res = applyScreenCounterRotation(undefined, c.impl.instant_world_tracker_anchor_pose_raw(o));
|
|
161
186
|
if (mirror) {
|
|
162
187
|
let scale = mat4.create();
|
package/lib/pipeline.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/// <reference types="dom-webcodecs" />
|
|
2
2
|
import { zappar_pipeline_t, zappar_camera_source_t } from "./gen/zappar";
|
|
3
|
-
import { zappar_cwrap } from "./gen/zappar-native";
|
|
4
3
|
import { zappar_client } from "./gen/zappar-client";
|
|
5
4
|
import { MsgManager } from "./messages";
|
|
6
5
|
import { Source, CameraFrameInfo } from "./source";
|
|
7
|
-
import { CameraFrameReturnS2C, ImageBitmapS2C, VideoFrameS2C } from "./workerinterface";
|
|
6
|
+
import { CameraDataRawS2C, CameraFrameReturnS2C, ImageBitmapS2C, VideoFrameS2C } from "./workerinterface";
|
|
8
7
|
import { FaceMesh } from "./facemesh";
|
|
9
8
|
import { Event } from "./event";
|
|
10
9
|
import { ImageTracker } from "./imagetracker";
|
|
10
|
+
import { zappar } from "./gen/zappar-bridge";
|
|
11
|
+
import { CameraFrameData } from "./camera-frame-data";
|
|
11
12
|
export declare class Pipeline {
|
|
12
13
|
private _client;
|
|
13
14
|
private _impl;
|
|
@@ -27,12 +28,17 @@ export declare class Pipeline {
|
|
|
27
28
|
private _sequenceRecorder;
|
|
28
29
|
private _sequenceRecordDeviceAttitudeMatrices;
|
|
29
30
|
private _sequenceRecorderFirstCameraToken;
|
|
31
|
+
private _cameraFrameDataPromises;
|
|
32
|
+
private _cameraFrameDataResolves;
|
|
33
|
+
private _cameraFrameDataRejects;
|
|
34
|
+
private _cameraFrameDataEnabled;
|
|
30
35
|
onGLContextReset: Event;
|
|
31
|
-
static create(client:
|
|
36
|
+
static create(client: zappar, mgr: MsgManager): zappar_pipeline_t;
|
|
32
37
|
static get(p: zappar_pipeline_t): Pipeline | undefined;
|
|
33
38
|
private constructor();
|
|
34
39
|
frameUpdate(client: zappar_client): void;
|
|
35
40
|
cleanOldFrames(): void;
|
|
41
|
+
cameraFrameDataRawResult(msg: CameraDataRawS2C): void;
|
|
36
42
|
cameraTokenReturn(msg: CameraFrameReturnS2C): void;
|
|
37
43
|
sequenceRecordStart(expectedFrames: number): void;
|
|
38
44
|
sequenceRecordStop(): void;
|
|
@@ -40,6 +46,8 @@ export declare class Pipeline {
|
|
|
40
46
|
sequenceRecordClear(): void;
|
|
41
47
|
sequenceRecordDeviceAttitudeMatrices(v: boolean): void;
|
|
42
48
|
getVideoTexture(): WebGLTexture | undefined;
|
|
49
|
+
getCameraFrameDataRaw(): Promise<CameraFrameData | undefined>;
|
|
50
|
+
setCameraFrameDataRawEnabled(e: boolean): void;
|
|
43
51
|
destroy(): void;
|
|
44
52
|
getCurrentCameraInfo(): CameraFrameInfo | undefined;
|
|
45
53
|
cameraFrameDrawGL(screenWidth: number, screenHeight: number, mirror?: boolean): void;
|
package/lib/pipeline.js
CHANGED
|
@@ -24,6 +24,10 @@ export class Pipeline {
|
|
|
24
24
|
this.cameraPixelArrays = [];
|
|
25
25
|
this._sequenceRecordDeviceAttitudeMatrices = true;
|
|
26
26
|
this._sequenceRecorderFirstCameraToken = 0;
|
|
27
|
+
this._cameraFrameDataPromises = new Map();
|
|
28
|
+
this._cameraFrameDataResolves = new Map();
|
|
29
|
+
this._cameraFrameDataRejects = new Map();
|
|
30
|
+
this._cameraFrameDataEnabled = false;
|
|
27
31
|
this.onGLContextReset = new Event();
|
|
28
32
|
}
|
|
29
33
|
static create(client, mgr) {
|
|
@@ -56,14 +60,34 @@ export class Pipeline {
|
|
|
56
60
|
if (t[1].texture)
|
|
57
61
|
this.videoTextures.push(t[1].texture);
|
|
58
62
|
(_b = (_a = t[1].frame) === null || _a === void 0 ? void 0 : _a.close) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
63
|
+
if (t[1].data) {
|
|
64
|
+
this.cameraPixelArrays.push(t[1].data);
|
|
65
|
+
t[1].data = undefined;
|
|
66
|
+
}
|
|
59
67
|
this.cameraTokens.delete(t[0]);
|
|
60
68
|
}
|
|
61
69
|
}
|
|
62
70
|
}
|
|
71
|
+
cameraFrameDataRawResult(msg) {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
let info = this.cameraTokens.get(msg.token);
|
|
74
|
+
if (!info)
|
|
75
|
+
return;
|
|
76
|
+
if (msg.data === null) {
|
|
77
|
+
(_a = this._cameraFrameDataRejects.get(info)) === null || _a === void 0 ? void 0 : _a(new Error('Raw camera data not available'));
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
info.data = msg.data.data;
|
|
81
|
+
(_b = this._cameraFrameDataResolves.get(info)) === null || _b === void 0 ? void 0 : _b(msg.data);
|
|
82
|
+
}
|
|
83
|
+
this._cameraFrameDataRejects.delete(info);
|
|
84
|
+
this._cameraFrameDataResolves.delete(info);
|
|
85
|
+
this._cameraFrameDataPromises.delete(info);
|
|
86
|
+
}
|
|
63
87
|
cameraTokenReturn(msg) {
|
|
88
|
+
let info = this.cameraTokens.get(msg.token);
|
|
64
89
|
if (this._sequenceRecorder && this._sequenceRecordDeviceAttitudeMatrices
|
|
65
90
|
&& msg.token >= this._sequenceRecorderFirstCameraToken) {
|
|
66
|
-
let info = this.cameraTokens.get(msg.token);
|
|
67
91
|
if (info) {
|
|
68
92
|
if (msg.att)
|
|
69
93
|
this._sequenceRecorder.appendAttitudeMatrix(msg.att);
|
|
@@ -71,7 +95,20 @@ export class Pipeline {
|
|
|
71
95
|
this._sequenceRecorder.appendCameraFrame(info);
|
|
72
96
|
}
|
|
73
97
|
}
|
|
74
|
-
|
|
98
|
+
if (info && !info.data && msg.d) {
|
|
99
|
+
info.data = msg.d;
|
|
100
|
+
const rawRequestResolve = this._cameraFrameDataResolves.get(info);
|
|
101
|
+
if (rawRequestResolve) {
|
|
102
|
+
rawRequestResolve({
|
|
103
|
+
data: info.data,
|
|
104
|
+
width: info.dataWidth,
|
|
105
|
+
height: info.dataHeight,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
this._cameraFrameDataRejects.delete(info);
|
|
109
|
+
this._cameraFrameDataResolves.delete(info);
|
|
110
|
+
this._cameraFrameDataPromises.delete(info);
|
|
111
|
+
}
|
|
75
112
|
this.tokensInFlight--;
|
|
76
113
|
}
|
|
77
114
|
sequenceRecordStart(expectedFrames) {
|
|
@@ -97,6 +134,37 @@ export class Pipeline {
|
|
|
97
134
|
getVideoTexture() {
|
|
98
135
|
return this.videoTextures.pop();
|
|
99
136
|
}
|
|
137
|
+
getCameraFrameDataRaw() {
|
|
138
|
+
if (!this._cameraFrameDataEnabled)
|
|
139
|
+
throw new Error('Raw camera frame data is not enabled.');
|
|
140
|
+
const info = this.getCurrentCameraInfo();
|
|
141
|
+
if (!info)
|
|
142
|
+
return Promise.resolve(undefined);
|
|
143
|
+
if (info.data)
|
|
144
|
+
return Promise.resolve({ data: info.data.slice(0), width: info.dataWidth, height: info.dataHeight });
|
|
145
|
+
let existing = this._cameraFrameDataPromises.get(info);
|
|
146
|
+
if (!existing) {
|
|
147
|
+
existing = new Promise((resolve, reject) => {
|
|
148
|
+
if (typeof info.remoteToken !== 'undefined') {
|
|
149
|
+
const msg = {
|
|
150
|
+
t: "rawrequest",
|
|
151
|
+
token: info.remoteToken,
|
|
152
|
+
p: this._impl,
|
|
153
|
+
};
|
|
154
|
+
this._mgr.postOutgoingMessage(msg, []);
|
|
155
|
+
}
|
|
156
|
+
this._cameraFrameDataResolves.set(info, resolve);
|
|
157
|
+
this._cameraFrameDataRejects.set(info, reject);
|
|
158
|
+
});
|
|
159
|
+
this._cameraFrameDataPromises.set(info, existing);
|
|
160
|
+
}
|
|
161
|
+
return existing;
|
|
162
|
+
}
|
|
163
|
+
setCameraFrameDataRawEnabled(e) {
|
|
164
|
+
this._cameraFrameDataEnabled = e;
|
|
165
|
+
const msg = { t: 'rawenabled', v: e };
|
|
166
|
+
this._mgr.postOutgoingMessage(msg, []);
|
|
167
|
+
}
|
|
100
168
|
destroy() {
|
|
101
169
|
this._client.pipeline_destroy(this._impl);
|
|
102
170
|
byId.delete(this._impl);
|
|
@@ -226,7 +294,8 @@ export class Pipeline {
|
|
|
226
294
|
uvTransform: msg.uvTransform,
|
|
227
295
|
cameraModel: msg.cameraModel,
|
|
228
296
|
cameraToDevice: msg.cameraToDevice,
|
|
229
|
-
cameraSource
|
|
297
|
+
cameraSource,
|
|
298
|
+
remoteToken: msg.token,
|
|
230
299
|
});
|
|
231
300
|
this.cleanOldFrames();
|
|
232
301
|
}
|
package/lib/serializer.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface MessageAppender {
|
|
|
8
8
|
type: (t: number) => void;
|
|
9
9
|
matrix4x4: (a: Float32Array) => void;
|
|
10
10
|
matrix3x3: (a: Float32Array) => void;
|
|
11
|
+
floatArray: (a: Float32Array) => void;
|
|
11
12
|
cameraModel: (a: Float32Array) => void;
|
|
12
13
|
identityCoefficients: (a: Float32Array) => void;
|
|
13
14
|
expressionCoefficients: (a: Float32Array) => void;
|
package/lib/serializer.js
CHANGED
|
@@ -22,6 +22,7 @@ export class MessageSerializer {
|
|
|
22
22
|
type: i => this.int(i),
|
|
23
23
|
matrix4x4: i => this.float32ArrayBuffer(i),
|
|
24
24
|
matrix3x3: i => this.float32ArrayBuffer(i),
|
|
25
|
+
floatArray: i => this.float32ArrayBuffer(i),
|
|
25
26
|
identityCoefficients: i => this.float32ArrayBuffer(i),
|
|
26
27
|
expressionCoefficients: i => this.float32ArrayBuffer(i),
|
|
27
28
|
cameraModel: i => this.float32ArrayBuffer(i),
|
package/lib/source.d.ts
CHANGED
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.3";
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "3.0.1-alpha.
|
|
1
|
+
export const VERSION = "3.0.1-alpha.3";
|
package/lib/worker-server.js
CHANGED
|
@@ -19,6 +19,8 @@ import { getWorkerMessageAPI } from "./worker-messages";
|
|
|
19
19
|
export let messageManager = new MsgManager();
|
|
20
20
|
let workerMessageChannel;
|
|
21
21
|
let latestCameraToScreenRotation = 0;
|
|
22
|
+
let rawDataAccessEnabled = false;
|
|
23
|
+
const rawCameraFrameBuffersByPipeline = new Map();
|
|
22
24
|
export function launchWorkerServer(wasmUrl, module) {
|
|
23
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
26
|
let mod = ZNM.default({
|
|
@@ -45,7 +47,7 @@ export function launchWorkerServer(wasmUrl, module) {
|
|
|
45
47
|
});
|
|
46
48
|
messageManager.postOutgoingMessage("loaded", []);
|
|
47
49
|
messageManager.onIncomingMessage.bind((msg) => {
|
|
48
|
-
var _a;
|
|
50
|
+
var _a, _b, _c;
|
|
49
51
|
switch (msg.t) {
|
|
50
52
|
case "zappar":
|
|
51
53
|
server.processBuffer(msg.d);
|
|
@@ -75,6 +77,23 @@ export function launchWorkerServer(wasmUrl, module) {
|
|
|
75
77
|
messageManager.postOutgoingMessage(ret, [msgt.d]);
|
|
76
78
|
break;
|
|
77
79
|
}
|
|
80
|
+
case "rawenabled": {
|
|
81
|
+
const msgt = msg;
|
|
82
|
+
rawDataAccessEnabled = msgt.v;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
case "rawrequest": {
|
|
86
|
+
const msgt = msg;
|
|
87
|
+
const buffers = rawCameraFrameBuffersByPipeline.get(msgt.p);
|
|
88
|
+
const ret = {
|
|
89
|
+
t: "raw",
|
|
90
|
+
token: msgt.token,
|
|
91
|
+
p: msgt.p,
|
|
92
|
+
data: buffers ? (_c = (_b = buffers.ready.find(entry => entry.token === msgt.token)) === null || _b === void 0 ? void 0 : _b.data) !== null && _c !== void 0 ? _c : null : null,
|
|
93
|
+
};
|
|
94
|
+
messageManager.postOutgoingMessage(ret, []);
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
78
97
|
case "streamC2S": {
|
|
79
98
|
let msgt = msg;
|
|
80
99
|
consumeStream(mod, r, msgt.s, msgt.p, msgt.userFacing, server, msgt.source, workerMessageAPI).then(() => {
|
|
@@ -243,8 +262,8 @@ function consumeReader(mod, r, reader, p, userFacing, server, source, workerMess
|
|
|
243
262
|
t: "videoFrameS2C",
|
|
244
263
|
userFacing,
|
|
245
264
|
uvTransform,
|
|
246
|
-
w: dataWidth,
|
|
247
|
-
h: dataHeight,
|
|
265
|
+
w: profile.dataWidth,
|
|
266
|
+
h: profile.dataHeight,
|
|
248
267
|
cameraToDevice: cameraToDeviceTransform,
|
|
249
268
|
cameraModel,
|
|
250
269
|
source
|
|
@@ -263,6 +282,32 @@ function consumeReader(mod, r, reader, p, userFacing, server, source, workerMess
|
|
|
263
282
|
// (mod as any).ccall('what_to_stderr', 'number', ['number'], [err]);
|
|
264
283
|
}
|
|
265
284
|
r.pipeline_frame_update(pipeline);
|
|
285
|
+
if (rawDataAccessEnabled) {
|
|
286
|
+
let buffers = rawCameraFrameBuffersByPipeline.get(p);
|
|
287
|
+
if (!buffers) {
|
|
288
|
+
buffers = { available: [], ready: [] };
|
|
289
|
+
rawCameraFrameBuffersByPipeline.set(p, buffers);
|
|
290
|
+
}
|
|
291
|
+
if (buffers.ready.length > 4) {
|
|
292
|
+
const removed = buffers.ready.splice(0, 1);
|
|
293
|
+
for (const entry of removed)
|
|
294
|
+
buffers.available.push(new Uint8Array(entry.data.data));
|
|
295
|
+
}
|
|
296
|
+
const size = r.pipeline_camera_frame_data_raw_size(pipeline);
|
|
297
|
+
let buffer;
|
|
298
|
+
while (!buffer || buffer.byteLength < size) {
|
|
299
|
+
if (buffers.available.length < 1)
|
|
300
|
+
buffers.available.push(new Uint8Array(size));
|
|
301
|
+
buffer = buffers.available.pop();
|
|
302
|
+
}
|
|
303
|
+
const dataPointer = r.pipeline_camera_frame_data_raw(pipeline);
|
|
304
|
+
buffer.set(mod.HEAPU8.subarray(dataPointer, dataPointer + size));
|
|
305
|
+
buffers.ready.push({ token, data: {
|
|
306
|
+
data: buffer,
|
|
307
|
+
width: r.pipeline_camera_frame_data_raw_width(p),
|
|
308
|
+
height: r.pipeline_camera_frame_data_raw_height(p),
|
|
309
|
+
} });
|
|
310
|
+
}
|
|
266
311
|
server.exploreState();
|
|
267
312
|
}
|
|
268
313
|
frame.close();
|
package/lib/workerinterface.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="dom-webcodecs" />
|
|
2
|
+
import { CameraFrameData } from "./camera-frame-data";
|
|
2
3
|
import { zappar_camera_source_t, zappar_pipeline_t } from "./gen/zappar-native";
|
|
3
4
|
export interface CameraFrameC2S {
|
|
4
5
|
t: "cameraFrameC2S";
|
|
@@ -83,3 +84,18 @@ export interface AttitudeMatrixC2S {
|
|
|
83
84
|
p: zappar_pipeline_t;
|
|
84
85
|
m: Float32Array;
|
|
85
86
|
}
|
|
87
|
+
export interface CameraDataRawEnabledC2S {
|
|
88
|
+
t: "rawenabled";
|
|
89
|
+
v: boolean;
|
|
90
|
+
}
|
|
91
|
+
export interface CameraDataRawRequestC2S {
|
|
92
|
+
t: "rawrequest";
|
|
93
|
+
p: zappar_pipeline_t;
|
|
94
|
+
token: number;
|
|
95
|
+
}
|
|
96
|
+
export interface CameraDataRawS2C {
|
|
97
|
+
t: "raw";
|
|
98
|
+
token: number;
|
|
99
|
+
p: zappar_pipeline_t;
|
|
100
|
+
data: CameraFrameData | null;
|
|
101
|
+
}
|