@zappar/zappar-cv 3.3.0-beta.1 → 3.4.0-beta.0
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/bridged-camera-source.d.ts +2 -0
- package/lib/bridged-camera-source.js +13 -0
- package/lib/bridged-message.d.ts +1 -0
- package/lib/bridged-world-tracker.js +8 -6
- package/lib/camera-frame-data.d.ts +1 -2
- package/lib/ceres-worker.d.ts +1 -1
- package/lib/ceres-worker.js +5 -5
- package/lib/gen/zappar-bridge.d.ts +3 -1
- package/lib/gen/zappar-client.js +100 -71
- package/lib/gen/zappar-cwrap.js +27 -6
- package/lib/gen/zappar-native.d.ts +6 -3
- package/lib/gen/zappar-native.js +1 -0
- package/lib/gen/zappar-server.js +80 -68
- package/lib/gen/zappar.d.ts +3 -1
- package/lib/html-element-source.js +3 -4
- package/lib/index-standalone.js +1 -1
- package/lib/mstp-camera-source.d.ts +3 -0
- package/lib/mstp-camera-source.js +21 -0
- package/lib/native.js +20 -14
- package/lib/options.d.ts +2 -1
- package/lib/pipeline.d.ts +1 -0
- package/lib/pipeline.js +13 -0
- package/lib/profile.js +1 -2
- package/lib/src/additional.d.ts +49 -0
- package/lib/src/android-bridge-message-handler.d.ts +15 -0
- package/lib/src/array-from-string.d.ts +2 -0
- package/lib/src/bridged-camera-source.d.ts +53 -0
- package/lib/src/bridged-d3-tracker.d.ts +18 -0
- package/lib/src/bridged-message-parser.d.ts +12 -0
- package/lib/src/bridged-message.d.ts +79 -0
- package/lib/src/bridged-world-tracker.d.ts +21 -0
- package/lib/src/camera-frame-data.d.ts +10 -0
- package/lib/src/camera-source-map.d.ts +11 -0
- package/lib/src/camera-source.d.ts +28 -0
- package/lib/src/cameramodel.d.ts +2 -0
- package/lib/src/ceres-worker.d.ts +1 -0
- package/lib/src/compatibility.d.ts +5 -0
- package/lib/src/data-download.d.ts +8 -0
- package/lib/src/deserializer.d.ts +41 -0
- package/lib/src/direct.d.ts +3 -0
- package/lib/src/drawaxis.d.ts +2 -0
- package/lib/src/drawcamera.d.ts +12 -0
- package/lib/src/drawface.d.ts +16 -0
- package/lib/src/drawfaceproject.d.ts +15 -0
- package/lib/src/drawgrid.d.ts +2 -0
- package/lib/src/drawmesh.d.ts +14 -0
- package/lib/src/drawplane.d.ts +2 -0
- package/lib/src/drawpoints.d.ts +11 -0
- package/lib/src/drawpointswithtype.d.ts +13 -0
- package/lib/src/drawpolygon.d.ts +5 -0
- package/lib/src/drawpreviewmesh.d.ts +16 -0
- package/lib/src/drawquad.d.ts +2 -0
- package/lib/src/event.d.ts +30 -0
- package/lib/src/facelandmark.d.ts +11 -0
- package/lib/src/facelandmarkdata.d.ts +4 -0
- package/lib/src/facelandmarkinterface.d.ts +5 -0
- package/lib/src/facemesh.d.ts +27 -0
- package/lib/src/gen/zappar-bridge.d.ts +182 -0
- package/lib/src/gen/zappar-client.d.ts +26 -0
- package/lib/src/gen/zappar-cwrap.d.ts +12 -0
- package/lib/src/gen/zappar-native.d.ts +256 -0
- package/lib/src/gen/zappar-server.d.ts +50 -0
- package/lib/src/gen/zappar.d.ts +311 -0
- package/lib/src/gfx.d.ts +1 -0
- package/lib/src/gl-state-manager.d.ts +9 -0
- package/lib/src/html-element-source.d.ts +42 -0
- package/lib/src/image-process-gl.d.ts +40 -0
- package/lib/src/imagebitmap-camera-source.d.ts +39 -0
- package/lib/src/imagetracker-previewmesh.d.ts +2 -0
- package/lib/src/imagetracker.d.ts +43 -0
- package/lib/src/index-standalone.d.ts +3 -0
- package/lib/src/index.d.ts +7 -0
- package/lib/src/landmarkdatagenerate.d.ts +2 -0
- package/lib/src/loglevel.d.ts +5 -0
- package/lib/src/messages.d.ts +13 -0
- package/lib/src/mstp-camera-source.d.ts +44 -0
- package/lib/src/native.d.ts +3 -0
- package/lib/src/options.d.ts +5 -0
- package/lib/src/permission.d.ts +12 -0
- package/lib/src/pipeline.d.ts +88 -0
- package/lib/src/profile.d.ts +24 -0
- package/lib/src/riff-reader.d.ts +18 -0
- package/lib/src/sequencerecorder.d.ts +99 -0
- package/lib/src/sequencesource.d.ts +25 -0
- package/lib/src/serializer.d.ts +60 -0
- package/lib/src/shader.d.ts +2 -0
- package/lib/src/source.d.ts +22 -0
- package/lib/src/tr.d.ts +6 -0
- package/lib/src/tracing/jsontracer.d.ts +14 -0
- package/lib/src/tracing/performancetracer.d.ts +11 -0
- package/lib/src/tracing/sharedtracer.d.ts +2 -0
- package/lib/src/tracing/usertimingtracer.d.ts +10 -0
- package/lib/src/version.d.ts +1 -0
- package/lib/src/worker-client.d.ts +4 -0
- package/lib/src/worker-imagebitmap.d.ts +5 -0
- package/lib/src/worker-messages.d.ts +11 -0
- package/lib/src/worker-server.d.ts +3 -0
- package/lib/src/worker.d.ts +1 -0
- package/lib/src/workerinterface.d.ts +110 -0
- package/lib/src/yuv-conversion-gl.d.ts +44 -0
- package/lib/tests/barcode-finder.d.ts +1 -0
- package/lib/tests/camera-data-raw.d.ts +1 -0
- package/lib/tests/camera-data-rgb.d.ts +1 -0
- package/lib/tests/camera-far-near.d.ts +1 -0
- package/lib/tests/camera-only.d.ts +1 -0
- package/lib/tests/common.d.ts +15 -0
- package/lib/tests/d3-tracking.d.ts +1 -0
- package/lib/tests/drawanchor.d.ts +3 -0
- package/lib/tests/face-landmarks.d.ts +1 -0
- package/lib/tests/face-tracking.d.ts +1 -0
- package/lib/tests/image-tracking-cylinder.d.ts +1 -0
- package/lib/tests/image-tracking-preview-mesh.d.ts +1 -0
- package/lib/tests/image-tracking.d.ts +1 -0
- package/lib/tests/instant-tracking.d.ts +1 -0
- package/lib/tests/no-rendering.d.ts +1 -0
- package/lib/tests/sequence-preview.d.ts +1 -0
- package/lib/tests/two-pipelines.d.ts +1 -0
- package/lib/tests/video-face-tracking.d.ts +1 -0
- package/lib/tests/world-tracking-camera-offset-anchor.d.ts +1 -0
- package/lib/tests/world-tracking-meshes.d.ts +1 -0
- package/lib/tests/world-tracking-plane-offset-anchor.d.ts +1 -0
- package/lib/tests/world-tracking.d.ts +1 -0
- package/lib/tests/zapcode-tracking.d.ts +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/worker-client.d.ts +1 -1
- package/lib/worker-client.js +23 -9
- package/lib/worker-messages.d.ts +2 -1
- package/lib/worker-messages.js +2 -1
- package/lib/worker-server.js +27 -10
- package/lib/workerinterface.d.ts +2 -1
- package/lib/zappar-cv.js +1 -1
- package/lib/zappar-cv.wasm +0 -0
- package/package.json +2 -4
- package/umd/169.zappar-cv.js +0 -1
- package/umd/25.zappar-cv.js +0 -1
- package/umd/287.zappar-cv.js +0 -1
- package/umd/482727c0e7dd40d73f5a.zbin +0 -0
- package/umd/670905e7f3a8925b89cb.wasm +0 -0
- package/umd/867.zappar-cv.js +0 -1
- package/umd/b4f46e148a3b3b5aef90.zbin +0 -0
- package/umd/f7b62a3a53b5c9b3222b.zbin +0 -0
- package/umd/zappar-cv-ceres.worker.js +0 -1
- package/umd/zappar-cv.js +0 -1
- package/umd/zappar-cv.worker.js +0 -1
package/lib/gen/zappar.d.ts
CHANGED
|
@@ -96,7 +96,7 @@ export interface zappar {
|
|
|
96
96
|
pipeline_camera_pose_with_attitude(o: zappar_pipeline_t, mirror: boolean): Float32Array;
|
|
97
97
|
pipeline_camera_pose_with_origin(o: zappar_pipeline_t, pose: Float32Array): Float32Array;
|
|
98
98
|
pipeline_camera_frame_user_data(o: zappar_pipeline_t): number;
|
|
99
|
-
pipeline_camera_frame_submit(o: zappar_pipeline_t, data: ArrayBuffer, width: number, height: number, user_data: number, camera_to_device_transform: Float32Array, camera_model: Float32Array, user_facing: boolean,
|
|
99
|
+
pipeline_camera_frame_submit(o: zappar_pipeline_t, data: ArrayBuffer, width: number, height: number, user_data: number, camera_to_device_transform: Float32Array, camera_model: Float32Array, user_facing: boolean, timestampMicroseconds: number): void;
|
|
100
100
|
pipeline_camera_frame_camera_attitude(o: zappar_pipeline_t): Float32Array;
|
|
101
101
|
pipeline_camera_frame_device_attitude(o: zappar_pipeline_t): Float32Array;
|
|
102
102
|
pipeline_camera_frame_user_facing(o: zappar_pipeline_t): boolean;
|
|
@@ -107,6 +107,7 @@ export interface zappar {
|
|
|
107
107
|
pipeline_motion_rotation_rate_submit_int(o: zappar_pipeline_t, time: number, interval: number, x: number, y: number, z: number): void;
|
|
108
108
|
pipeline_motion_attitude_submit(o: zappar_pipeline_t, time: number, x: number, y: number, z: number): void;
|
|
109
109
|
pipeline_motion_attitude_submit_int(o: zappar_pipeline_t, time: number, interval: number, x: number, y: number, z: number): void;
|
|
110
|
+
pipeline_motion_relative_orientation_submit_int(o: zappar_pipeline_t, time: number, interval: number, x: number, y: number, z: number, w: number): void;
|
|
110
111
|
pipeline_motion_attitude_matrix_submit(o: zappar_pipeline_t, mat: Float32Array): void;
|
|
111
112
|
pipeline_sequence_record_start(o: zappar_pipeline_t, expected_frames: number): void;
|
|
112
113
|
pipeline_sequence_record_stop(o: zappar_pipeline_t): void;
|
|
@@ -218,6 +219,7 @@ export interface zappar {
|
|
|
218
219
|
world_tracker_destroy(o: zappar_world_tracker_t): void;
|
|
219
220
|
world_tracker_enabled(o: zappar_world_tracker_t): boolean;
|
|
220
221
|
world_tracker_enabled_set(o: zappar_world_tracker_t, enabled: boolean): void;
|
|
222
|
+
world_tracker_session_number(o: zappar_world_tracker_t): number;
|
|
221
223
|
world_tracker_quality(o: zappar_world_tracker_t): number;
|
|
222
224
|
world_tracker_horizontal_plane_detection_enabled(o: zappar_world_tracker_t): boolean;
|
|
223
225
|
world_tracker_horizontal_plane_detection_enabled_set(o: zappar_world_tracker_t, horizontal_plane_detection_enabled: boolean): void;
|
|
@@ -87,7 +87,6 @@ export class HTMLElementSource extends Source {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
getFrame(currentlyProcessing) {
|
|
90
|
-
var _a;
|
|
91
90
|
let pipeline = Pipeline.get(this._pipeline);
|
|
92
91
|
if (!pipeline)
|
|
93
92
|
return;
|
|
@@ -102,7 +101,8 @@ export class HTMLElementSource extends Source {
|
|
|
102
101
|
let info = this._processFrame(gl, this._cameraToScreenRotation, currentlyProcessing);
|
|
103
102
|
if (info) {
|
|
104
103
|
let token = pipeline.registerToken(info);
|
|
105
|
-
|
|
104
|
+
// Use -1 for frame time for now since iOS accuracy is not good enough
|
|
105
|
+
pipeline.sendDataToWorker(info.data || new ArrayBuffer(0), token, info.dataWidth, info.dataHeight, info.userFacing, info.cameraToDevice, info.cameraModel, -1); // this._frameTime ?? (performance.now() * 1000));
|
|
106
106
|
info.data = undefined;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
@@ -116,9 +116,8 @@ export class HTMLElementSource extends Source {
|
|
|
116
116
|
if (!(video === null || video === void 0 ? void 0 : video.requestVideoFrameCallback))
|
|
117
117
|
return;
|
|
118
118
|
video.requestVideoFrameCallback((time, metadata) => {
|
|
119
|
-
var _a;
|
|
120
119
|
if (typeof metadata === 'object')
|
|
121
|
-
this._frameTime =
|
|
120
|
+
this._frameTime = metadata.captureTime ? metadata.captureTime * 1000.0 : undefined;
|
|
122
121
|
if (typeof metadata === 'object' && typeof metadata.presentedFrames === 'number') {
|
|
123
122
|
if (this._lastPresentedFrames === metadata.presentedFrames) {
|
|
124
123
|
console.log('Avoided identical frame');
|
package/lib/index-standalone.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { initialize as init } from "./index";
|
|
2
2
|
export * from "./index";
|
|
3
3
|
export function initialize(opts) {
|
|
4
|
-
return init(Object.assign(Object.assign({}, opts), { worker: (opts === null || opts === void 0 ? void 0 : opts.worker) || new (require("worker-loader?inline=fallback!./worker").default)(),
|
|
4
|
+
return init(Object.assign(Object.assign({}, opts), { worker: (opts === null || opts === void 0 ? void 0 : opts.worker) || new (require("worker-loader?inline=fallback!./worker").default)(), ceresWorker0: (opts === null || opts === void 0 ? void 0 : opts.ceresWorker0) || new (require("worker-loader?inline=fallback&filename=zappar-cv-ceres.worker.js!./ceres-worker").default)(), ceresWorker1: (opts === null || opts === void 0 ? void 0 : opts.ceresWorker1) || new (require("worker-loader?inline=fallback&filename=zappar-cv-ceres.worker.js!./ceres-worker").default)() }));
|
|
5
5
|
}
|
|
@@ -14,6 +14,7 @@ export declare class MSTPCameraSource extends Source {
|
|
|
14
14
|
private _accelerometer?;
|
|
15
15
|
private _linearAcceleration?;
|
|
16
16
|
private _gyroscope?;
|
|
17
|
+
private _relativeOrientation?;
|
|
17
18
|
constructor(_impl: zappar_camera_source_t, _pipeline: zappar_pipeline_t, _deviceId: string);
|
|
18
19
|
destroy(): void;
|
|
19
20
|
private _stop;
|
|
@@ -36,6 +37,8 @@ export declare class MSTPCameraSource extends Source {
|
|
|
36
37
|
private _linearAccelerationReading;
|
|
37
38
|
private _lastGyroscopeReading;
|
|
38
39
|
private _gyroscopeReading;
|
|
40
|
+
private _lastReleativeOrientationReading;
|
|
41
|
+
private _relativeOrientationReading;
|
|
39
42
|
private _stopDeviceMotion;
|
|
40
43
|
uploadGL(info: CameraFrameInfo): void;
|
|
41
44
|
}
|
|
@@ -105,6 +105,19 @@ export class MSTPCameraSource extends Source {
|
|
|
105
105
|
pipeline.motionRotationRateSubmit(timestamp, -this._gyroscope.x, -this._gyroscope.y, -this._gyroscope.z);
|
|
106
106
|
pipeline.motionRotationRateSubmitInt(timestamp, interval, this._gyroscope.x * 180 / Math.PI, this._gyroscope.y * 180 / Math.PI, this._gyroscope.z * 180 / Math.PI);
|
|
107
107
|
};
|
|
108
|
+
this._lastReleativeOrientationReading = -1;
|
|
109
|
+
this._relativeOrientationReading = () => {
|
|
110
|
+
var _a;
|
|
111
|
+
if (!this._relativeOrientation || this._relativeOrientation.quaternion === undefined)
|
|
112
|
+
return;
|
|
113
|
+
let pipeline = Pipeline.get(this._pipeline);
|
|
114
|
+
if (!pipeline)
|
|
115
|
+
return;
|
|
116
|
+
const timestamp = (_a = this._relativeOrientation.timestamp) !== null && _a !== void 0 ? _a : performance.now();
|
|
117
|
+
const interval = this._lastReleativeOrientationReading > -1 ? timestamp - this._lastReleativeOrientationReading : 30;
|
|
118
|
+
this._lastReleativeOrientationReading = timestamp;
|
|
119
|
+
pipeline.motionRelativeOrientationSubmitInt(timestamp, interval, this._relativeOrientation.quaternion[0], this._relativeOrientation.quaternion[1], this._relativeOrientation.quaternion[2], this._relativeOrientation.quaternion[3]);
|
|
120
|
+
};
|
|
108
121
|
zcout("Using MSTP camera source");
|
|
109
122
|
}
|
|
110
123
|
destroy() {
|
|
@@ -275,6 +288,7 @@ export class MSTPCameraSource extends Source {
|
|
|
275
288
|
this._accelerometer = new Accelerometer({ frequency: 60 });
|
|
276
289
|
this._linearAcceleration = new LinearAccelerationSensor({ frequency: 60 });
|
|
277
290
|
this._gyroscope = new Gyroscope({ frequency: 60 });
|
|
291
|
+
this._relativeOrientation = new RelativeOrientationSensor({ frequency: 60 });
|
|
278
292
|
// throw new Error();
|
|
279
293
|
this._accelerometer.addEventListener('reading', this._accelerometerReading);
|
|
280
294
|
this._accelerometer.start();
|
|
@@ -282,6 +296,8 @@ export class MSTPCameraSource extends Source {
|
|
|
282
296
|
this._linearAcceleration.start();
|
|
283
297
|
this._gyroscope.addEventListener('reading', this._gyroscopeReading);
|
|
284
298
|
this._gyroscope.start();
|
|
299
|
+
this._relativeOrientation.addEventListener('reading', this._relativeOrientationReading);
|
|
300
|
+
this._relativeOrientation.start();
|
|
285
301
|
}
|
|
286
302
|
catch (err) {
|
|
287
303
|
window.addEventListener("devicemotion", this._deviceMotionListener, false);
|
|
@@ -303,6 +319,11 @@ export class MSTPCameraSource extends Source {
|
|
|
303
319
|
this._gyroscope.removeEventListener('reading', this._gyroscopeReading);
|
|
304
320
|
delete this._gyroscope;
|
|
305
321
|
}
|
|
322
|
+
if (this._relativeOrientation) {
|
|
323
|
+
this._relativeOrientation.stop();
|
|
324
|
+
this._relativeOrientation.removeEventListener('reading', this._relativeOrientationReading);
|
|
325
|
+
delete this._relativeOrientation;
|
|
326
|
+
}
|
|
306
327
|
window.removeEventListener("devicemotion", this._deviceMotionListener);
|
|
307
328
|
}
|
|
308
329
|
uploadGL(info) {
|
package/lib/native.js
CHANGED
|
@@ -12,7 +12,7 @@ import { zappar_client } from "./gen/zappar-client";
|
|
|
12
12
|
import { drawPlane } from "./drawplane";
|
|
13
13
|
import { cameraRotationForScreenOrientation, projectionMatrixFromModelAndSize } from "./cameramodel";
|
|
14
14
|
import { mat4, vec3 } from "gl-matrix";
|
|
15
|
-
import {
|
|
15
|
+
import { launchCeresWorkers, launchWorker, messageManager } from "./worker-client";
|
|
16
16
|
import { permissionRequestUI, permissionGrantedAll, permissionGrantedCamera, permissionGrantedMotion, permissionDeniedAny, permissionDeniedCamera, permissionDeniedMotion, permissionRequestMotion, permissionRequestCamera, permissionRequestAll, permissionDeniedUI } from "./permission";
|
|
17
17
|
import { createFaceMesh, destroyFaceMesh, getFaceMesh } from "./facemesh";
|
|
18
18
|
import { Pipeline, applyScreenCounterRotation } from "./pipeline";
|
|
@@ -111,7 +111,7 @@ export function initialize(opts) {
|
|
|
111
111
|
break;
|
|
112
112
|
}
|
|
113
113
|
case "setupCeresWorker": {
|
|
114
|
-
|
|
114
|
+
launchCeresWorkers(msg.port0, msg.port1, opts === null || opts === void 0 ? void 0 : opts.ceresWorker0, opts === null || opts === void 0 ? void 0 : opts.ceresWorker1);
|
|
115
115
|
break;
|
|
116
116
|
}
|
|
117
117
|
case "_z_datadownload": {
|
|
@@ -315,8 +315,17 @@ export function initialize(opts) {
|
|
|
315
315
|
zcwarn("attempting to call custom_anchor_pose_raw on a destroyed zappar_custom_anchor_t");
|
|
316
316
|
return mat4.create();
|
|
317
317
|
}
|
|
318
|
-
if (entry.
|
|
318
|
+
if (entry.sessionNumber < client.world_tracker_session_number(entry.wt)) {
|
|
319
|
+
// Anchor was set in a previous session, so equivalent to having been reset
|
|
320
|
+
// Status will be reported as STOPPED, report pose the same as world_anchor
|
|
321
|
+
const world_anchor_raw = client.world_tracker_world_anchor_pose_raw(entry.wt).slice();
|
|
322
|
+
return world_anchor_raw;
|
|
323
|
+
}
|
|
324
|
+
// Report underlying pose if version matches expectation
|
|
325
|
+
if (entry.expectedPoseVersion == client.custom_anchor_pose_version(o)) {
|
|
319
326
|
return wtImpl.custom_anchor_pose_raw(o);
|
|
327
|
+
}
|
|
328
|
+
// Use an offset from world anchor until the right pose version is reported
|
|
320
329
|
const world_anchor_raw = client.world_tracker_world_anchor_pose_raw(entry.wt).slice();
|
|
321
330
|
const ret = mat4.create();
|
|
322
331
|
mat4.multiply(ret, world_anchor_raw, entry.poseRelativeToWorldAnchor);
|
|
@@ -327,10 +336,13 @@ export function initialize(opts) {
|
|
|
327
336
|
zcwarn("attempting to call custom_anchor_status on a destroyed zappar_custom_anchor_t");
|
|
328
337
|
return anchor_status_t.ANCHOR_STATUS_STOPPED;
|
|
329
338
|
}
|
|
330
|
-
if (entry.
|
|
339
|
+
if (entry.sessionNumber < client.world_tracker_session_number(entry.wt)) {
|
|
331
340
|
return anchor_status_t.ANCHOR_STATUS_STOPPED;
|
|
332
|
-
|
|
341
|
+
}
|
|
342
|
+
// Underlying status if the version and session match
|
|
343
|
+
if (entry.expectedPoseVersion == client.custom_anchor_pose_version(o)) {
|
|
333
344
|
return wtImpl.custom_anchor_status(o);
|
|
345
|
+
}
|
|
334
346
|
return anchor_status_t.ANCHOR_STATUS_INITIALIZING;
|
|
335
347
|
}, custom_anchor_pose_camera_relative: (o, mirror) => {
|
|
336
348
|
let res = applyScreenCounterRotation(undefined, client.custom_anchor_pose_raw(o));
|
|
@@ -353,7 +365,7 @@ export function initialize(opts) {
|
|
|
353
365
|
return res;
|
|
354
366
|
}, custom_anchor_create: (p, wt, id) => {
|
|
355
367
|
const ret = wtImpl.custom_anchor_create(p, wt, id);
|
|
356
|
-
customAnchors.set(ret, { id, wt, expectedPoseVersion: 0, poseRelativeToWorldAnchor: mat4.create() });
|
|
368
|
+
customAnchors.set(ret, { id, wt, sessionNumber: -1, expectedPoseVersion: 0, poseRelativeToWorldAnchor: mat4.create() });
|
|
357
369
|
return ret;
|
|
358
370
|
}, custom_anchor_id: (o) => {
|
|
359
371
|
var _a;
|
|
@@ -525,6 +537,7 @@ export function initialize(opts) {
|
|
|
525
537
|
zcwarn("attempting to call custom_anchor_pose_set on a destroyed zappar_custom_anchor_t");
|
|
526
538
|
return;
|
|
527
539
|
}
|
|
540
|
+
entry.sessionNumber = client.world_tracker_session_number(entry.wt);
|
|
528
541
|
entry.expectedPoseVersion++;
|
|
529
542
|
mat4.copy(entry.poseRelativeToWorldAnchor, pose);
|
|
530
543
|
wtImpl.custom_anchor_pose_set(o, pose);
|
|
@@ -534,6 +547,7 @@ export function initialize(opts) {
|
|
|
534
547
|
zcwarn("attempting to call custom_anchor_pose_set_with_parent on a destroyed zappar_custom_anchor_t");
|
|
535
548
|
return;
|
|
536
549
|
}
|
|
550
|
+
entry.sessionNumber = client.world_tracker_session_number(entry.wt);
|
|
537
551
|
entry.expectedPoseVersion++;
|
|
538
552
|
mat4.copy(entry.poseRelativeToWorldAnchor, pose);
|
|
539
553
|
wtImpl.custom_anchor_pose_set_with_parent(o, pose, anchor_id);
|
|
@@ -865,14 +879,6 @@ export function initialize(opts) {
|
|
|
865
879
|
const ret = wtImpl.world_tracker_create(pipeline);
|
|
866
880
|
pipelineByWorldTracker.set(ret, pipeline);
|
|
867
881
|
return ret;
|
|
868
|
-
}, world_tracker_reset: (wt) => {
|
|
869
|
-
for (const entry of customAnchors.values()) {
|
|
870
|
-
if (entry.wt === wt) {
|
|
871
|
-
mat4.identity(entry.poseRelativeToWorldAnchor);
|
|
872
|
-
entry.expectedPoseVersion = 0;
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
wtImpl.world_tracker_reset(wt);
|
|
876
882
|
}, world_tracker_points_data_matrix: (wt, screenWidth, screenHeight, mirror) => {
|
|
877
883
|
const pipeline = pipelineByWorldTracker.get(wt);
|
|
878
884
|
if (pipeline === undefined || !client)
|
package/lib/options.d.ts
CHANGED
package/lib/pipeline.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ export declare class Pipeline {
|
|
|
75
75
|
motionAccelerometerWithGravitySubmitInt(timestamp: number, interval: number, x: number, y: number, z: number): void;
|
|
76
76
|
motionRotationRateSubmitInt(timestamp: number, interval: number, x: number, y: number, z: number): void;
|
|
77
77
|
motionAttitudeSubmitInt(timestamp: number, interval: number, x: number, y: number, z: number): void;
|
|
78
|
+
motionRelativeOrientationSubmitInt(timestamp: number, interval: number, x: number, y: number, z: number, w: number): void;
|
|
78
79
|
motionRotationRateSubmit(timestamp: number, x: number, y: number, z: number): void;
|
|
79
80
|
motionAttitudeSubmit(timestamp: number, x: number, y: number, z: number): void;
|
|
80
81
|
motionAttitudeMatrix(m: Float32Array): void;
|
package/lib/pipeline.js
CHANGED
|
@@ -444,6 +444,19 @@ export class Pipeline {
|
|
|
444
444
|
};
|
|
445
445
|
this._mgr.postOutgoingMessage(msg, []);
|
|
446
446
|
}
|
|
447
|
+
motionRelativeOrientationSubmitInt(timestamp, interval, x, y, z, w) {
|
|
448
|
+
var _a;
|
|
449
|
+
(_a = this._sequenceRecorder) === null || _a === void 0 ? void 0 : _a.appendAttitudeInt(timestamp, interval, x, y, z);
|
|
450
|
+
const msg = {
|
|
451
|
+
t: 'sensorDataC2S',
|
|
452
|
+
sensor: 'relative_orientation',
|
|
453
|
+
interval,
|
|
454
|
+
timestamp,
|
|
455
|
+
x, y, z, w,
|
|
456
|
+
p: this._impl
|
|
457
|
+
};
|
|
458
|
+
this._mgr.postOutgoingMessage(msg, []);
|
|
459
|
+
}
|
|
447
460
|
motionRotationRateSubmit(timestamp, x, y, z) {
|
|
448
461
|
var _a;
|
|
449
462
|
if (!this._sequenceRecordDeviceAttitudeMatrices)
|
package/lib/profile.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as UAParser from "ua-parser-js";
|
|
2
2
|
import { camera_profile_t } from "./gen/zappar-native";
|
|
3
|
-
import { AndroidBridgeMessageHandler } from "./android-bridge-message-handler";
|
|
4
3
|
export var EmbeddedVideoImplementation;
|
|
5
4
|
(function (EmbeddedVideoImplementation) {
|
|
6
5
|
EmbeddedVideoImplementation[EmbeddedVideoImplementation["OBJECT_URL"] = 0] = "OBJECT_URL";
|
|
@@ -16,7 +15,7 @@ export let profile = {
|
|
|
16
15
|
videoHeight: 480,
|
|
17
16
|
getDataSize: (p) => p === camera_profile_t.HIGH ? [640, 480] : [320, 240],
|
|
18
17
|
videoElementInDOM: false,
|
|
19
|
-
preferMediaStreamTrackProcessorCamera:
|
|
18
|
+
preferMediaStreamTrackProcessorCamera: false,
|
|
20
19
|
preferImageBitmapCamera: false,
|
|
21
20
|
ios164CameraSelection: false,
|
|
22
21
|
relyOnConstraintsForCameraSelection: false,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CameraFrameData, CameraFrameDataRGB } from "./camera-frame-data";
|
|
2
|
+
import { zappar_face_mesh_t, zappar_face_tracker_t, zappar_world_tracker_t, zappar_pipeline_t, zappar_image_tracker_t, zappar_sequence_source_t } from "./gen/zappar";
|
|
3
|
+
export declare type zappar_html_element_source_t = number & {
|
|
4
|
+
_: 'zappar_html_element_source_t';
|
|
5
|
+
};
|
|
6
|
+
export interface PermissionRequestUIOptions {
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
button?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface PermissionDeniedUIOptions {
|
|
12
|
+
title?: string;
|
|
13
|
+
descriptionIOS?: string;
|
|
14
|
+
descriptionChrome?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
button?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface Additional {
|
|
19
|
+
pipeline_gl_context_set(pipeline: zappar_pipeline_t, gl: WebGLRenderingContext, texturePool?: WebGLTexture[]): void;
|
|
20
|
+
pipeline_gl_context_lost(pipeline: zappar_pipeline_t): void;
|
|
21
|
+
pipeline_draw_face(pipeline: zappar_pipeline_t, projectionMatrix: Float32Array, cameraMatrix: Float32Array, targetMatrix: Float32Array, o: zappar_face_mesh_t): void;
|
|
22
|
+
pipeline_draw_image_target_preview(pipeline: zappar_pipeline_t, projectionMatrix: Float32Array, cameraMatrix: Float32Array, targetMatrix: Float32Array, o: zappar_image_tracker_t, indx: number): void;
|
|
23
|
+
pipeline_draw_face_project(pipeline: zappar_pipeline_t, drawwMatrix: Float32Array, vertices: Float32Array, uvMatrix: Float32Array, uvs: Float32Array, indices: Uint16Array, texture: WebGLTexture): void;
|
|
24
|
+
pipeline_camera_frame_data_raw_enabled_set(pipeline: zappar_pipeline_t, enabled: boolean): void;
|
|
25
|
+
pipeline_camera_frame_data_raw(pipeline: zappar_pipeline_t): Promise<CameraFrameData | undefined>;
|
|
26
|
+
pipeline_camera_frame_data_rgb_enabled_set(pipeline: zappar_pipeline_t, enabled: boolean): void;
|
|
27
|
+
pipeline_camera_frame_data_rgb(pipeline: zappar_pipeline_t): CameraFrameDataRGB | undefined;
|
|
28
|
+
draw_plane(gl: WebGLRenderingContext, projectionMatrix: Float32Array, cameraMatrix: Float32Array, targetMatrix: Float32Array, texture: string): void;
|
|
29
|
+
draw_grid(gl: WebGLRenderingContext, projectionMatrix: Float32Array, cameraMatrix: Float32Array, targetMatrix: Float32Array): void;
|
|
30
|
+
draw_axis(gl: WebGLRenderingContext, projectionMatrix: Float32Array, cameraMatrix: Float32Array, targetMatrix: Float32Array): void;
|
|
31
|
+
image_tracker_target_image(o: zappar_image_tracker_t, indx: number): HTMLImageElement | undefined;
|
|
32
|
+
face_mesh_load_default(o: zappar_face_mesh_t): Promise<void>;
|
|
33
|
+
face_mesh_load_default_face(o: zappar_face_mesh_t, fillMouth: boolean, fillEyeL: boolean, fillEyeR: boolean): Promise<void>;
|
|
34
|
+
face_mesh_load_default_full_head_simplified(o: zappar_face_mesh_t, fillMouth: boolean, fillEyeL: boolean, fillEyeR: boolean, fillNeck: boolean): Promise<void>;
|
|
35
|
+
face_tracker_model_load_default(o: zappar_face_tracker_t): Promise<void>;
|
|
36
|
+
pipeline_camera_frame_draw_gl(pipeline: zappar_pipeline_t, screenWidth: number, screenHeight: number, mirror?: boolean): void;
|
|
37
|
+
permission_request_ui_promise(options?: PermissionRequestUIOptions): Promise<boolean>;
|
|
38
|
+
permission_denied_ui(options?: PermissionDeniedUIOptions): void;
|
|
39
|
+
html_element_source_create(pipeline: zappar_pipeline_t, element: HTMLVideoElement | HTMLImageElement): zappar_html_element_source_t;
|
|
40
|
+
html_element_source_start(o: zappar_html_element_source_t): void;
|
|
41
|
+
html_element_source_pause(o: zappar_html_element_source_t): void;
|
|
42
|
+
html_element_source_destroy(o: zappar_html_element_source_t): void;
|
|
43
|
+
browser_incompatible: () => boolean;
|
|
44
|
+
browser_incompatible_ui: () => void;
|
|
45
|
+
sequence_source_time_set: (o: zappar_sequence_source_t, ms: number) => void;
|
|
46
|
+
cookies_permitted: (p: boolean) => void;
|
|
47
|
+
world_tracker_points_data_matrix(wt: zappar_world_tracker_t, screenWidth: number, screenHeight: number, mirror: boolean): Float32Array;
|
|
48
|
+
in_app_clip: () => boolean;
|
|
49
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class AndroidBridgeMessageHandler {
|
|
2
|
+
private _nativePort;
|
|
3
|
+
private _messageId;
|
|
4
|
+
private _replyResolvers;
|
|
5
|
+
private _queuedMessages;
|
|
6
|
+
static IsSupported(): boolean;
|
|
7
|
+
private static _instance;
|
|
8
|
+
static SharedInstance(): AndroidBridgeMessageHandler;
|
|
9
|
+
postMessage(message: string): Promise<any>;
|
|
10
|
+
private _processMessage;
|
|
11
|
+
private _processStringMessage;
|
|
12
|
+
private _processArrayBufferMessage;
|
|
13
|
+
private _initRequested;
|
|
14
|
+
private _initPort;
|
|
15
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { camera_profile_t, zappar_camera_source_t, zappar_pipeline_t } from "./gen/zappar";
|
|
2
|
+
import { CameraFrameInfo, Source } from "./source";
|
|
3
|
+
import { zappar_custom_anchor_t } from "./gen/zappar-native";
|
|
4
|
+
export interface BridgeOptions {
|
|
5
|
+
worldTracking?: boolean;
|
|
6
|
+
horizontalPlaneDetection?: boolean;
|
|
7
|
+
verticalPlaneDetection?: boolean;
|
|
8
|
+
tracksData?: boolean;
|
|
9
|
+
projectionsData?: boolean;
|
|
10
|
+
meshAnchors?: boolean;
|
|
11
|
+
d3?: boolean;
|
|
12
|
+
d3MaxResolution?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class BridgedCameraSource extends Source {
|
|
15
|
+
private _impl;
|
|
16
|
+
private _pipeline;
|
|
17
|
+
private _deviceId;
|
|
18
|
+
static DEFAULT_DEVICE_ID: string;
|
|
19
|
+
private _messageHandler;
|
|
20
|
+
private _isPaused;
|
|
21
|
+
private _cameraToScreenRotation;
|
|
22
|
+
private _cameraToDeviceTransform;
|
|
23
|
+
private _cameraModel;
|
|
24
|
+
private _profile;
|
|
25
|
+
private _textureSizes;
|
|
26
|
+
private _yuvConversion;
|
|
27
|
+
private _decodeBuffers;
|
|
28
|
+
private _options;
|
|
29
|
+
private static _resetCount;
|
|
30
|
+
private _isAndroid;
|
|
31
|
+
static IsSupported(): boolean;
|
|
32
|
+
constructor(_impl: zappar_camera_source_t, _pipeline: zappar_pipeline_t, _deviceId: string);
|
|
33
|
+
destroy(): void;
|
|
34
|
+
pause(): void;
|
|
35
|
+
start(): void;
|
|
36
|
+
getFrame(currentlyProcessing: boolean): void;
|
|
37
|
+
private _frameInFlight;
|
|
38
|
+
private _processFrame;
|
|
39
|
+
uploadGL(info: CameraFrameInfo): void;
|
|
40
|
+
recycle(info: CameraFrameInfo): void;
|
|
41
|
+
setProfile(p: camera_profile_t): void;
|
|
42
|
+
private _anchorPoseFloat32;
|
|
43
|
+
private _anchorPoseUint16;
|
|
44
|
+
setCustomAnchorPose(anchor: zappar_custom_anchor_t, pose_version: number, pose: Float32Array): void;
|
|
45
|
+
resetTracking(): void;
|
|
46
|
+
private _convertToBitmask;
|
|
47
|
+
optionsUpdated(options: BridgeOptions): void;
|
|
48
|
+
private _lastTimestamp;
|
|
49
|
+
private _deviceMotionListener;
|
|
50
|
+
private _deviceOrientationListener;
|
|
51
|
+
private _startDeviceMotion;
|
|
52
|
+
private _stopDeviceMotion;
|
|
53
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BridgeOptions } from "./bridged-camera-source";
|
|
2
|
+
import { Pipeline } from "./pipeline";
|
|
3
|
+
import { Zappar } from ".";
|
|
4
|
+
export declare class BridgedD3Tracker {
|
|
5
|
+
static IsSupported(): boolean;
|
|
6
|
+
private static _sharedInstance;
|
|
7
|
+
static SharedInstance(): BridgedD3Tracker;
|
|
8
|
+
private _latestId;
|
|
9
|
+
private _d3StateById;
|
|
10
|
+
private _identityPose;
|
|
11
|
+
private _emptyArray;
|
|
12
|
+
private _getD3State;
|
|
13
|
+
private _getD3DataFromPipeline;
|
|
14
|
+
private _getD3Data;
|
|
15
|
+
private _notifyOptionsUpdated;
|
|
16
|
+
getCombinedOptionsForPipeline(p: Pipeline): BridgeOptions;
|
|
17
|
+
impl: Partial<Zappar>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BridgedMessage } from "./bridged-message";
|
|
2
|
+
export declare const BridgeArrayBufferHeader_u32: number;
|
|
3
|
+
export interface ParsedBridgeArrayBuffer {
|
|
4
|
+
replyID: number;
|
|
5
|
+
json: BridgedMessage;
|
|
6
|
+
uint8ArrayForBinaryBufferOffset: (offset: number, length: number) => Uint8Array;
|
|
7
|
+
uint32ArrayForBinaryBufferOffset: (offset: number, length: number) => Uint32Array;
|
|
8
|
+
floatArrayForBinaryBufferOffset: (offset: number, length: number) => Float32Array;
|
|
9
|
+
}
|
|
10
|
+
export declare function hasBridgeArrayBufferHeader(str: string): boolean;
|
|
11
|
+
export declare function replyIdFromBridgeArrayBuffer(str: string): number;
|
|
12
|
+
export declare function parseBridgeArrayBuffer(ab: ArrayBuffer): ParsedBridgeArrayBuffer | undefined;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { anchor_status_t, world_tracker_quality_t } from './gen/zappar-native';
|
|
2
|
+
import { UvLayout } from './yuv-conversion-gl';
|
|
3
|
+
export interface WTData {
|
|
4
|
+
session_number?: number;
|
|
5
|
+
world_anchor_status: anchor_status_t;
|
|
6
|
+
world_anchor_pose: Float32Array | number[];
|
|
7
|
+
ground_anchor_status: anchor_status_t;
|
|
8
|
+
ground_anchor_pose: Float32Array | number[];
|
|
9
|
+
plane_anchors: PlaneAnchorData[];
|
|
10
|
+
custom_anchors: CustomAnchorData[];
|
|
11
|
+
mesh_anchors: MeshAnchorData[];
|
|
12
|
+
quality: world_tracker_quality_t;
|
|
13
|
+
}
|
|
14
|
+
export interface PlaneAnchorData {
|
|
15
|
+
id: string;
|
|
16
|
+
horizontal: boolean;
|
|
17
|
+
status: anchor_status_t;
|
|
18
|
+
pose: Float32Array | number[];
|
|
19
|
+
boundary: Float32Array | number[];
|
|
20
|
+
boundaryVersion: number;
|
|
21
|
+
}
|
|
22
|
+
export interface CustomAnchorData {
|
|
23
|
+
id: number;
|
|
24
|
+
status: anchor_status_t;
|
|
25
|
+
pose: Float32Array | number[];
|
|
26
|
+
poseVersion: number;
|
|
27
|
+
}
|
|
28
|
+
export interface D3Data {
|
|
29
|
+
worldToCamera: Float32Array | number[];
|
|
30
|
+
detections: D3Detection[];
|
|
31
|
+
}
|
|
32
|
+
export interface D3Detection {
|
|
33
|
+
id: string;
|
|
34
|
+
type: number;
|
|
35
|
+
qr?: string;
|
|
36
|
+
dense?: number;
|
|
37
|
+
worldPoses: (Float32Array | number[])[];
|
|
38
|
+
landmarks: Float32Array | number[];
|
|
39
|
+
scale: number;
|
|
40
|
+
}
|
|
41
|
+
export interface MeshAnchorData {
|
|
42
|
+
id: string;
|
|
43
|
+
pose: Float32Array | number[];
|
|
44
|
+
status: anchor_status_t;
|
|
45
|
+
vertices: {
|
|
46
|
+
binaryOffset: number;
|
|
47
|
+
binaryLength: number;
|
|
48
|
+
offset: number;
|
|
49
|
+
stride: number;
|
|
50
|
+
count: number;
|
|
51
|
+
format: number;
|
|
52
|
+
componentsPerVector: number;
|
|
53
|
+
};
|
|
54
|
+
indices: {
|
|
55
|
+
binaryOffset: number;
|
|
56
|
+
binaryLength: number;
|
|
57
|
+
bytesPerIndex: number;
|
|
58
|
+
indexCountPerPrimitive: number;
|
|
59
|
+
count: number;
|
|
60
|
+
primitiveType: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export interface BridgedMessage {
|
|
64
|
+
frameNo: number;
|
|
65
|
+
cameraModel: Float32Array | [number, number, number, number, number, number];
|
|
66
|
+
dataWidth: number;
|
|
67
|
+
dataHeight: number;
|
|
68
|
+
dataBinaryBufferOffset: number;
|
|
69
|
+
dataBinaryBufferLength: number;
|
|
70
|
+
yWidth: number;
|
|
71
|
+
yHeight: number;
|
|
72
|
+
uvWidth: number;
|
|
73
|
+
uvHeight: number;
|
|
74
|
+
uvLayout?: UvLayout;
|
|
75
|
+
previewBinaryBufferOffset: number;
|
|
76
|
+
previewBinaryBufferLength: number;
|
|
77
|
+
wtData: WTData;
|
|
78
|
+
d3Data?: D3Data;
|
|
79
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Zappar } from ".";
|
|
2
|
+
import { BridgeOptions } from "./bridged-camera-source";
|
|
3
|
+
import { Pipeline } from "./pipeline";
|
|
4
|
+
export declare class BridgedWorldTracker {
|
|
5
|
+
static IsSupported(): boolean;
|
|
6
|
+
private static _sharedInstance;
|
|
7
|
+
static SharedInstance(): BridgedWorldTracker;
|
|
8
|
+
private _latestId;
|
|
9
|
+
private _wtStateById;
|
|
10
|
+
private _anchorStateById;
|
|
11
|
+
private _identityPose;
|
|
12
|
+
private _emptyArray;
|
|
13
|
+
private _getWtState;
|
|
14
|
+
private _getAnchorState;
|
|
15
|
+
private _getWtDataFromPipeline;
|
|
16
|
+
private _getWtData;
|
|
17
|
+
private _getFrameData;
|
|
18
|
+
private _notifyOptionsUpdated;
|
|
19
|
+
getCombinedOptionsForPipeline(p: Pipeline): BridgeOptions;
|
|
20
|
+
impl: Partial<Zappar>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface BaseFrameData {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
}
|
|
5
|
+
export interface CameraFrameData extends BaseFrameData {
|
|
6
|
+
data: ArrayBuffer;
|
|
7
|
+
}
|
|
8
|
+
export interface CameraFrameDataRGB extends BaseFrameData {
|
|
9
|
+
frame: ImageBitmap | any | ImageData;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BridgedCameraSource } from "./bridged-camera-source";
|
|
2
|
+
import { CameraSource } from "./camera-source";
|
|
3
|
+
import { zappar_camera_source_t, zappar_pipeline_t } from "./gen/zappar";
|
|
4
|
+
import { ImageBitmapCameraSource } from "./imagebitmap-camera-source";
|
|
5
|
+
import { MSTPCameraSource } from "./mstp-camera-source";
|
|
6
|
+
export declare type CameraSourceType = CameraSource | MSTPCameraSource | ImageBitmapCameraSource | BridgedCameraSource;
|
|
7
|
+
export declare function getNextCameraSourceId(): zappar_camera_source_t;
|
|
8
|
+
export declare function setCameraSourceId(id: zappar_camera_source_t, c: CameraSourceType): void;
|
|
9
|
+
export declare function getCameraSource(id: zappar_camera_source_t): CameraSourceType | undefined;
|
|
10
|
+
export declare function deleteCameraSource(id: zappar_camera_source_t): void;
|
|
11
|
+
export declare function createCameraSource(p: zappar_pipeline_t, deviceId: string): zappar_camera_source_t;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { zappar_camera_source_t, zappar_pipeline_t } from "./gen/zappar";
|
|
2
|
+
import { HTMLElementSource } from "./html-element-source";
|
|
3
|
+
export declare class CameraSource extends HTMLElementSource {
|
|
4
|
+
private _impl;
|
|
5
|
+
private _deviceId;
|
|
6
|
+
static USER_DEFAULT_DEVICE_ID: string;
|
|
7
|
+
static DEFAULT_DEVICE_ID: string;
|
|
8
|
+
private _currentStream;
|
|
9
|
+
private _activeDeviceId;
|
|
10
|
+
private _explicitUserCameraId;
|
|
11
|
+
private _explicitEnvironmentCameraId;
|
|
12
|
+
constructor(_impl: zappar_camera_source_t, pipeline: zappar_pipeline_t, _deviceId: string);
|
|
13
|
+
destroy(): void;
|
|
14
|
+
private _stop;
|
|
15
|
+
pause(): void;
|
|
16
|
+
start(): void;
|
|
17
|
+
private _getConstraints;
|
|
18
|
+
getFrame(allowRead: boolean): void;
|
|
19
|
+
private _getUserMedia;
|
|
20
|
+
private _syncCamera;
|
|
21
|
+
private _hasStartedOrientation;
|
|
22
|
+
private _lastTimestamp;
|
|
23
|
+
private _deviceMotionListener;
|
|
24
|
+
private _deviceOrientationListener;
|
|
25
|
+
private _startDeviceOrientation;
|
|
26
|
+
private _startDeviceMotion;
|
|
27
|
+
private _stopDeviceMotion;
|
|
28
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare function projectionMatrixFromModelAndSize(params: Float32Array, cameraDataWidth: number, cameraDataHeight: number, screenWidth: number, screenHeight: number, near?: number, far?: number): Float32Array;
|
|
2
|
+
export declare function cameraRotationForScreenOrientation(isUserFacing: boolean): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function launchCeresWorker(wasmUrl: string, module: WebAssembly.Module, port: MessagePort, instance: number): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type * as ZNM from "./zappar-cv";
|
|
2
|
+
export interface DataDownloadAPI {
|
|
3
|
+
data_download_clear: () => void;
|
|
4
|
+
data_download_size: () => number;
|
|
5
|
+
data_download: () => number;
|
|
6
|
+
data_should_record_set: (v: number) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function getDataDownloadAPI(mod: ZNM.Module): DataDownloadAPI;
|