@zappar/zappar-cv 0.4.0-beta.1 → 0.4.0-beta.10
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/CHANGELOG.md +79 -34
- 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 +2 -5
- package/lib/camera-source.js +3 -13
- package/lib/compatibility.js +1 -1
- package/lib/drawcamera.js +2 -1
- package/lib/gen/zappar-client.js +6 -16
- package/lib/gen/zappar-cwrap.js +37 -28
- package/lib/gen/zappar-native.d.ts +11 -1
- package/lib/gen/zappar-native.js +13 -1
- package/lib/gen/zappar-server.js +1 -5
- package/lib/gen/zappar.d.ts +12 -0
- 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 +3 -20
- package/lib/html-element-source.js +19 -263
- 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 +119 -8
- package/lib/pipeline.d.ts +13 -3
- package/lib/pipeline.js +95 -26
- package/lib/profile.d.ts +2 -0
- package/lib/profile.js +55 -44
- package/lib/riff-reader.d.ts +18 -0
- package/lib/riff-reader.js +56 -0
- package/lib/sequencerecorder.d.ts +1 -0
- package/lib/sequencerecorder.js +11 -0
- package/lib/sequencesource.d.ts +7 -1
- package/lib/sequencesource.js +89 -47
- package/lib/source.d.ts +6 -4
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/worker-client.js +0 -5
- package/lib/worker-imagebitmap.d.ts +5 -0
- package/lib/worker-imagebitmap.js +63 -0
- package/lib/worker-server.d.ts +0 -5
- package/lib/worker-server.js +120 -30
- package/lib/workerinterface.d.ts +47 -1
- package/lib/zcv.js +117 -135
- package/lib/zcv.wasm +0 -0
- package/package.json +34 -31
- package/umd/e9486c1cdadb21608a4f7e2fa3be9517.wasm +0 -0
- package/umd/zappar-cv.js +1 -9
- package/umd/zappar-cv.worker.js +1 -1
- package/lib/bundleworker-mainthread.d.ts +0 -2
- package/lib/bundleworker-mainthread.js +0 -36
- package/lib/bundleworker-worker.d.ts +0 -3
- package/lib/bundleworker-worker.js +0 -47
- package/umd/5dd5cacd27e6e7da828f.bundleworker.js +0 -1
- package/umd/a20150d17b0290cadaa6cb9911ab9500.wasm +0 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImageTracker = void 0;
|
|
4
|
+
const riff_reader_1 = require("./riff-reader");
|
|
5
|
+
let byId = new Map();
|
|
6
|
+
const decoder = new TextDecoder();
|
|
7
|
+
class ImageTracker {
|
|
8
|
+
constructor(_client, _impl) {
|
|
9
|
+
this._client = _client;
|
|
10
|
+
this._impl = _impl;
|
|
11
|
+
this._targets = [];
|
|
12
|
+
}
|
|
13
|
+
static create(pipeline, client) {
|
|
14
|
+
let ret = client.image_tracker_create(pipeline);
|
|
15
|
+
byId.set(ret, new ImageTracker(client, ret));
|
|
16
|
+
return ret;
|
|
17
|
+
}
|
|
18
|
+
static get(p) {
|
|
19
|
+
return byId.get(p);
|
|
20
|
+
}
|
|
21
|
+
destroy() {
|
|
22
|
+
this._client.image_tracker_destroy(this._impl);
|
|
23
|
+
byId.delete(this._impl);
|
|
24
|
+
}
|
|
25
|
+
loadFromMemory(data) {
|
|
26
|
+
this._targets.push({ data });
|
|
27
|
+
this._client.image_tracker_target_load_from_memory(this._impl, data);
|
|
28
|
+
}
|
|
29
|
+
targetCount() {
|
|
30
|
+
return this._targets.length;
|
|
31
|
+
}
|
|
32
|
+
getTargetInfo(i) {
|
|
33
|
+
let current = this._targets[i];
|
|
34
|
+
if (current && current.info)
|
|
35
|
+
return current.info;
|
|
36
|
+
current.info = {
|
|
37
|
+
topRadius: -1,
|
|
38
|
+
bottomRadius: -1,
|
|
39
|
+
sideLength: -1,
|
|
40
|
+
physicalScaleFactor: -1
|
|
41
|
+
};
|
|
42
|
+
try {
|
|
43
|
+
const reader = new riff_reader_1.RiffReader(current.data, false);
|
|
44
|
+
const imgChunk = reader.find("IMG ");
|
|
45
|
+
if (imgChunk) {
|
|
46
|
+
let mimeType = "image/png";
|
|
47
|
+
const mimeTypeChunk = reader.find("IMGM");
|
|
48
|
+
if (mimeTypeChunk)
|
|
49
|
+
mimeType = decoder.decode(mimeTypeChunk.data);
|
|
50
|
+
current.info.preview = { mimeType, compressed: imgChunk.data };
|
|
51
|
+
}
|
|
52
|
+
const odleChunk = reader.find("ODLE");
|
|
53
|
+
if (odleChunk) {
|
|
54
|
+
const odle = decoder.decode(odleChunk.data);
|
|
55
|
+
this._parseOdle(odle, current.info);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (err) { }
|
|
59
|
+
return current.info;
|
|
60
|
+
}
|
|
61
|
+
_parseOdle(data, info) {
|
|
62
|
+
let currentOffset = 0;
|
|
63
|
+
let version = "0";
|
|
64
|
+
[version, currentOffset] = readLine(currentOffset, data);
|
|
65
|
+
if (version === "3") {
|
|
66
|
+
let treeOrFlat = "0";
|
|
67
|
+
[treeOrFlat, currentOffset] = readLine(currentOffset, data);
|
|
68
|
+
if (treeOrFlat !== "0" && treeOrFlat !== "1")
|
|
69
|
+
return;
|
|
70
|
+
let numberTargets = "0";
|
|
71
|
+
[numberTargets, currentOffset] = readLine(currentOffset, data);
|
|
72
|
+
const parsedTargets = parseInt(numberTargets);
|
|
73
|
+
if (isNaN(parsedTargets) || parsedTargets < 1)
|
|
74
|
+
return;
|
|
75
|
+
let emptyLine = "";
|
|
76
|
+
[emptyLine, currentOffset] = readLine(currentOffset, data);
|
|
77
|
+
if (emptyLine.length !== 0)
|
|
78
|
+
return;
|
|
79
|
+
let infoLine = "";
|
|
80
|
+
[infoLine, currentOffset] = readLine(currentOffset, data);
|
|
81
|
+
const infoLineParts = infoLine.split(" ");
|
|
82
|
+
if (infoLineParts.length < 7)
|
|
83
|
+
return;
|
|
84
|
+
info.physicalScaleFactor = parseFloat(infoLineParts[6]);
|
|
85
|
+
if (isNaN(info.physicalScaleFactor))
|
|
86
|
+
info.physicalScaleFactor = -1;
|
|
87
|
+
if (infoLineParts.length >= 8) {
|
|
88
|
+
info.topRadius = parseFloat(infoLineParts[7]);
|
|
89
|
+
if (isNaN(info.topRadius))
|
|
90
|
+
info.topRadius = -1;
|
|
91
|
+
info.bottomRadius = info.topRadius;
|
|
92
|
+
}
|
|
93
|
+
if (infoLineParts.length >= 9) {
|
|
94
|
+
info.bottomRadius = parseFloat(infoLineParts[8]);
|
|
95
|
+
if (isNaN(info.bottomRadius))
|
|
96
|
+
info.bottomRadius = -1;
|
|
97
|
+
}
|
|
98
|
+
if (infoLineParts.length >= 10) {
|
|
99
|
+
info.sideLength = parseFloat(infoLineParts[9]);
|
|
100
|
+
if (isNaN(info.sideLength))
|
|
101
|
+
info.sideLength = -1;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
getDecodedPreview(i) {
|
|
106
|
+
const info = this.getTargetInfo(i);
|
|
107
|
+
if (!info.preview)
|
|
108
|
+
return new Image();
|
|
109
|
+
const blob = new Blob([info.preview.compressed], { type: info.preview.mimeType });
|
|
110
|
+
const image = new Image();
|
|
111
|
+
image.src = URL.createObjectURL(blob);
|
|
112
|
+
return image;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.ImageTracker = ImageTracker;
|
|
116
|
+
function readLine(offset, str) {
|
|
117
|
+
let indx = str.indexOf("\n", offset);
|
|
118
|
+
return [str.substring(offset, indx >= 0 ? indx : undefined).replace("\r", ""), indx + 1];
|
|
119
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import { zappar } from "./gen/zappar";
|
|
|
2
2
|
import { Additional } from "./additional";
|
|
3
3
|
export declare type Zappar = zappar & Additional;
|
|
4
4
|
export declare function initialize(): Zappar;
|
|
5
|
-
export { zappar_image_tracker_t, zappar_instant_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 } from "./gen/zappar";
|
|
5
|
+
export { zappar_image_tracker_t, zappar_instant_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 } from "./gen/zappar";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { zappar_camera_source_t, zappar_pipeline_t } from "./gen/zappar";
|
|
2
|
+
import { CameraFrameInfo, Source } from "./source";
|
|
3
|
+
export declare class MSTPCameraSource extends Source {
|
|
4
|
+
private _impl;
|
|
5
|
+
private _pipeline;
|
|
6
|
+
private _deviceId;
|
|
7
|
+
static USER_DEFAULT_DEVICE_ID: string;
|
|
8
|
+
static DEFAULT_DEVICE_ID: string;
|
|
9
|
+
private _currentStream;
|
|
10
|
+
private _activeDeviceId;
|
|
11
|
+
private _isPaused;
|
|
12
|
+
private _isUserFacing;
|
|
13
|
+
private _cameraToScreenRotation;
|
|
14
|
+
constructor(_impl: zappar_camera_source_t, _pipeline: zappar_pipeline_t, _deviceId: string);
|
|
15
|
+
destroy(): void;
|
|
16
|
+
private _stop;
|
|
17
|
+
pause(): void;
|
|
18
|
+
start(): void;
|
|
19
|
+
private _getConstraints;
|
|
20
|
+
getFrame(allowRead: boolean): void;
|
|
21
|
+
private _getUserMedia;
|
|
22
|
+
private _syncCamera;
|
|
23
|
+
private _hasStartedOrientation;
|
|
24
|
+
private _deviceMotionListener;
|
|
25
|
+
private _startDeviceOrientation;
|
|
26
|
+
private _startDeviceMotion;
|
|
27
|
+
private _stopDeviceMotion;
|
|
28
|
+
uploadGL(info: CameraFrameInfo): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MSTPCameraSource = void 0;
|
|
13
|
+
const profile_1 = require("./profile");
|
|
14
|
+
const pipeline_1 = require("./pipeline");
|
|
15
|
+
const source_1 = require("./source");
|
|
16
|
+
const cameramodel_1 = require("./cameramodel");
|
|
17
|
+
const loglevel_1 = require("./loglevel");
|
|
18
|
+
const camera_source_map_1 = require("./camera-source-map");
|
|
19
|
+
class MSTPCameraSource extends source_1.Source {
|
|
20
|
+
constructor(_impl, _pipeline, _deviceId) {
|
|
21
|
+
super();
|
|
22
|
+
this._impl = _impl;
|
|
23
|
+
this._pipeline = _pipeline;
|
|
24
|
+
this._deviceId = _deviceId;
|
|
25
|
+
this._currentStream = null;
|
|
26
|
+
this._activeDeviceId = null;
|
|
27
|
+
this._isPaused = true;
|
|
28
|
+
this._isUserFacing = false;
|
|
29
|
+
this._cameraToScreenRotation = 0;
|
|
30
|
+
this._hasStartedOrientation = false;
|
|
31
|
+
this._deviceMotionListener = (ev) => {
|
|
32
|
+
let pipeline = pipeline_1.Pipeline.get(this._pipeline);
|
|
33
|
+
if (!pipeline)
|
|
34
|
+
return;
|
|
35
|
+
let timeStamp = (ev.timeStamp !== undefined && ev.timeStamp !== null) ? ev.timeStamp : performance.now();
|
|
36
|
+
if (ev.accelerationIncludingGravity !== null &&
|
|
37
|
+
ev.accelerationIncludingGravity.x !== null &&
|
|
38
|
+
ev.accelerationIncludingGravity.y !== null &&
|
|
39
|
+
ev.accelerationIncludingGravity.z !== null) {
|
|
40
|
+
pipeline.motionAccelerometerSubmit(timeStamp, ev.accelerationIncludingGravity.x * profile_1.profile.deviceMotionMutliplier, ev.accelerationIncludingGravity.y * profile_1.profile.deviceMotionMutliplier, ev.accelerationIncludingGravity.z * profile_1.profile.deviceMotionMutliplier);
|
|
41
|
+
}
|
|
42
|
+
if (ev.rotationRate !== null &&
|
|
43
|
+
ev.rotationRate.alpha !== null &&
|
|
44
|
+
ev.rotationRate.beta !== null &&
|
|
45
|
+
ev.rotationRate.gamma !== null && !this._hasStartedOrientation) {
|
|
46
|
+
ev.timeStamp;
|
|
47
|
+
pipeline.motionRotationRateSubmit(timeStamp, ev.rotationRate.alpha * Math.PI / -180.0, ev.rotationRate.beta * Math.PI / -180.0, ev.rotationRate.gamma * Math.PI / -180.0);
|
|
48
|
+
}
|
|
49
|
+
else if (!this._hasStartedOrientation) {
|
|
50
|
+
this._startDeviceOrientation();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
loglevel_1.zcout("Using MSTP camera source");
|
|
54
|
+
}
|
|
55
|
+
destroy() {
|
|
56
|
+
this.pause();
|
|
57
|
+
camera_source_map_1.deleteCameraSource(this._impl);
|
|
58
|
+
}
|
|
59
|
+
_stop() {
|
|
60
|
+
if (!this._currentStream)
|
|
61
|
+
return;
|
|
62
|
+
let tracks = this._currentStream.getTracks();
|
|
63
|
+
tracks.forEach(t => t.stop());
|
|
64
|
+
this._currentStream = null;
|
|
65
|
+
}
|
|
66
|
+
pause() {
|
|
67
|
+
this._isPaused = true;
|
|
68
|
+
let p = pipeline_1.Pipeline.get(this._pipeline);
|
|
69
|
+
if (p && p.currentCameraSource === this)
|
|
70
|
+
p.currentCameraSource = undefined;
|
|
71
|
+
this._stopDeviceMotion();
|
|
72
|
+
this._syncCamera();
|
|
73
|
+
}
|
|
74
|
+
start() {
|
|
75
|
+
var _a;
|
|
76
|
+
let p = pipeline_1.Pipeline.get(this._pipeline);
|
|
77
|
+
if (p && p.currentCameraSource !== this) {
|
|
78
|
+
(_a = p.currentCameraSource) === null || _a === void 0 ? void 0 : _a.pause();
|
|
79
|
+
p.currentCameraSource = this;
|
|
80
|
+
}
|
|
81
|
+
this._isPaused = false;
|
|
82
|
+
this._startDeviceMotion();
|
|
83
|
+
this._syncCamera();
|
|
84
|
+
}
|
|
85
|
+
_getConstraints() {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
let deviceId;
|
|
88
|
+
let facingMode;
|
|
89
|
+
if (this._deviceId !== MSTPCameraSource.DEFAULT_DEVICE_ID &&
|
|
90
|
+
this._deviceId !== MSTPCameraSource.USER_DEFAULT_DEVICE_ID) {
|
|
91
|
+
// Custom device
|
|
92
|
+
deviceId = this._deviceId;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
facingMode = (this._deviceId === MSTPCameraSource.DEFAULT_DEVICE_ID) ? "environment" : "user";
|
|
96
|
+
}
|
|
97
|
+
let constraints = {
|
|
98
|
+
audio: false,
|
|
99
|
+
video: {
|
|
100
|
+
facingMode: facingMode,
|
|
101
|
+
width: profile_1.profile.videoWidth,
|
|
102
|
+
height: profile_1.profile.videoHeight,
|
|
103
|
+
frameRate: profile_1.profile.requestHighFrameRate ? 60 : 30,
|
|
104
|
+
deviceId: deviceId
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
if (deviceId)
|
|
108
|
+
return constraints;
|
|
109
|
+
if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices)
|
|
110
|
+
return constraints;
|
|
111
|
+
let devices = yield navigator.mediaDevices.enumerateDevices();
|
|
112
|
+
let hasHadCapabilities = false;
|
|
113
|
+
devices = devices.filter(val => {
|
|
114
|
+
// Remove non-video devices
|
|
115
|
+
if (val.kind !== "videoinput")
|
|
116
|
+
return false;
|
|
117
|
+
// If the media info object contains capabilities, use it to filter to the correct facing cameras
|
|
118
|
+
if (val.getCapabilities) {
|
|
119
|
+
hasHadCapabilities = true;
|
|
120
|
+
let capabilities = val.getCapabilities();
|
|
121
|
+
if (capabilities && capabilities.facingMode && capabilities.facingMode.indexOf(facingMode === "user" ? "user" : "environment") < 0)
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
});
|
|
126
|
+
// If none of the devices had capability info, or we have no devices left, fall back to the standard constraints
|
|
127
|
+
if (!hasHadCapabilities || devices.length === 0) {
|
|
128
|
+
return constraints;
|
|
129
|
+
}
|
|
130
|
+
if (typeof constraints.video === "object") {
|
|
131
|
+
loglevel_1.zcout("choosing device ID", devices[devices.length - 1].deviceId);
|
|
132
|
+
constraints.video.deviceId = devices[devices.length - 1].deviceId;
|
|
133
|
+
}
|
|
134
|
+
return constraints;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
getFrame(allowRead) {
|
|
138
|
+
var _a, _b;
|
|
139
|
+
let rotation = cameramodel_1.cameraRotationForScreenOrientation(false);
|
|
140
|
+
if (rotation != this._cameraToScreenRotation) {
|
|
141
|
+
(_b = (_a = pipeline_1.Pipeline.get(this._pipeline)) === null || _a === void 0 ? void 0 : _a.sendCameraToScreenRotationToWorker) === null || _b === void 0 ? void 0 : _b.call(_a, rotation);
|
|
142
|
+
this._cameraToScreenRotation = rotation;
|
|
143
|
+
}
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
_getUserMedia() {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
let constraints = yield this._getConstraints();
|
|
149
|
+
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia)
|
|
150
|
+
return yield navigator.mediaDevices.getUserMedia(constraints);
|
|
151
|
+
return yield new Promise((resolve, reject) => {
|
|
152
|
+
navigator.getUserMedia(constraints, resolve, reject);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
_syncCamera() {
|
|
157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
if (this._currentStream && this._isPaused) {
|
|
159
|
+
this._stop();
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (this._currentStream && this._activeDeviceId !== this._deviceId)
|
|
163
|
+
this._stop();
|
|
164
|
+
if (!this._isPaused) {
|
|
165
|
+
this._activeDeviceId = this._deviceId;
|
|
166
|
+
this._currentStream = yield this._getUserMedia();
|
|
167
|
+
if (this._isPaused) {
|
|
168
|
+
yield this._syncCamera();
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
this._isUserFacing = false;
|
|
172
|
+
if (this._currentStream) {
|
|
173
|
+
let videoTracks = this._currentStream.getVideoTracks();
|
|
174
|
+
if (videoTracks.length > 0) {
|
|
175
|
+
this._isUserFacing = videoTracks[0].getSettings().facingMode === "user";
|
|
176
|
+
let processor = new MediaStreamTrackProcessor({
|
|
177
|
+
track: videoTracks[0]
|
|
178
|
+
});
|
|
179
|
+
let p = pipeline_1.Pipeline.get(this._pipeline);
|
|
180
|
+
if (p)
|
|
181
|
+
p.sendCameraStreamToWorker(this._impl, processor.readable, this._isUserFacing);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
_startDeviceOrientation() {
|
|
188
|
+
if (this._hasStartedOrientation)
|
|
189
|
+
return;
|
|
190
|
+
this._hasStartedOrientation = true;
|
|
191
|
+
window.addEventListener("deviceorientation", (ev) => {
|
|
192
|
+
let pipeline = pipeline_1.Pipeline.get(this._pipeline);
|
|
193
|
+
if (!pipeline)
|
|
194
|
+
return;
|
|
195
|
+
let timeStamp = (ev.timeStamp !== undefined && ev.timeStamp !== null) ? ev.timeStamp : performance.now();
|
|
196
|
+
if (ev.alpha === null || ev.beta === null || ev.gamma === null)
|
|
197
|
+
return;
|
|
198
|
+
pipeline.motionAttitudeSubmit(timeStamp, ev.alpha, ev.beta, ev.gamma);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
_startDeviceMotion() {
|
|
202
|
+
window.addEventListener("devicemotion", this._deviceMotionListener, false);
|
|
203
|
+
}
|
|
204
|
+
_stopDeviceMotion() {
|
|
205
|
+
window.removeEventListener("devicemotion", this._deviceMotionListener);
|
|
206
|
+
}
|
|
207
|
+
uploadGL(info) {
|
|
208
|
+
const pipeline = pipeline_1.Pipeline.get(this._pipeline);
|
|
209
|
+
const gl = pipeline === null || pipeline === void 0 ? void 0 : pipeline.glContext;
|
|
210
|
+
if (!info ||
|
|
211
|
+
info.texture ||
|
|
212
|
+
!info.frame ||
|
|
213
|
+
!pipeline ||
|
|
214
|
+
!gl)
|
|
215
|
+
return;
|
|
216
|
+
let texture = pipeline.getVideoTexture();
|
|
217
|
+
if (!texture)
|
|
218
|
+
return;
|
|
219
|
+
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
220
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
|
221
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, info.frame);
|
|
222
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
223
|
+
info.texture = texture;
|
|
224
|
+
info.frame.close();
|
|
225
|
+
delete info.frame;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
exports.MSTPCameraSource = MSTPCameraSource;
|
|
229
|
+
MSTPCameraSource.USER_DEFAULT_DEVICE_ID = "Simulated User Default Device ID: a908df7f-5661-4d20-b227-a1c15d2fdb4b";
|
|
230
|
+
MSTPCameraSource.DEFAULT_DEVICE_ID = "Simulated Default Device ID: a908df7f-5661-4d20-b227-a1c15d2fdb4b";
|
package/lib/native.js
CHANGED
|
@@ -24,13 +24,18 @@ const facelandmark_1 = require("./facelandmark");
|
|
|
24
24
|
const compatibility_1 = require("./compatibility");
|
|
25
25
|
const loglevel_1 = require("./loglevel");
|
|
26
26
|
const sequencesource_1 = require("./sequencesource");
|
|
27
|
-
|
|
27
|
+
const camera_source_map_1 = require("./camera-source-map");
|
|
28
|
+
const gfx_1 = require("./gfx");
|
|
29
|
+
const imagetracker_1 = require("./imagetracker");
|
|
28
30
|
let client;
|
|
29
31
|
function initialize() {
|
|
30
32
|
if (client)
|
|
31
33
|
return client;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
let loaded = false;
|
|
35
|
+
worker_client_1.launchWorker().then(() => {
|
|
36
|
+
loglevel_1.zcout("Fully loaded");
|
|
37
|
+
loaded = true;
|
|
38
|
+
});
|
|
34
39
|
let c = new zappar_client_1.zappar_client(ab => {
|
|
35
40
|
worker_client_1.messageManager.postOutgoingMessage({
|
|
36
41
|
t: "zappar",
|
|
@@ -43,7 +48,7 @@ function initialize() {
|
|
|
43
48
|
c.impl.analytics_project_id_set(".wiz" + pathParts[1]);
|
|
44
49
|
}
|
|
45
50
|
worker_client_1.messageManager.onIncomingMessage.bind(msg => {
|
|
46
|
-
var _a, _b;
|
|
51
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
47
52
|
switch (msg.t) {
|
|
48
53
|
case "zappar":
|
|
49
54
|
(_a = pipeline_1.Pipeline.get(msg.p)) === null || _a === void 0 ? void 0 : _a.pendingMessages.push(msg.d);
|
|
@@ -51,10 +56,21 @@ function initialize() {
|
|
|
51
56
|
case "buf":
|
|
52
57
|
c.serializer.bufferReturn(msg.d);
|
|
53
58
|
break;
|
|
54
|
-
case "cameraFrameRecycleS2C":
|
|
59
|
+
case "cameraFrameRecycleS2C": {
|
|
60
|
+
let msgt = msg;
|
|
61
|
+
(_c = (_b = pipeline_1.Pipeline.get(msgt.p)) === null || _b === void 0 ? void 0 : _b.cameraTokenReturn) === null || _c === void 0 ? void 0 : _c.call(_b, msg);
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case "videoFrameS2C": {
|
|
55
65
|
let msgt = msg;
|
|
56
|
-
(
|
|
66
|
+
(_e = (_d = pipeline_1.Pipeline.get(msgt.p)) === null || _d === void 0 ? void 0 : _d.videoFrameFromWorker) === null || _e === void 0 ? void 0 : _e.call(_d, msgt);
|
|
57
67
|
break;
|
|
68
|
+
}
|
|
69
|
+
case "imageBitmapS2C": {
|
|
70
|
+
let msgt = msg;
|
|
71
|
+
(_g = (_f = pipeline_1.Pipeline.get(msgt.p)) === null || _f === void 0 ? void 0 : _f.imageBitmapFromWorker) === null || _g === void 0 ? void 0 : _g.call(_f, msgt);
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
58
74
|
case "licerr": {
|
|
59
75
|
let div = document.createElement("div");
|
|
60
76
|
div.innerHTML = "Visit <a href='https://docs.zap.works/universal-ar/licensing/' style='color: white;'>our licensing page</a> to find out about hosting on your own domain.";
|
|
@@ -80,9 +96,31 @@ function initialize() {
|
|
|
80
96
|
}, 1000);
|
|
81
97
|
document.body.append(div);
|
|
82
98
|
}
|
|
99
|
+
case "gfx": {
|
|
100
|
+
let div = document.createElement("div");
|
|
101
|
+
div.innerHTML = gfx_1.gfx;
|
|
102
|
+
div.style.position = "absolute";
|
|
103
|
+
div.style.bottom = "20px";
|
|
104
|
+
div.style.width = "250px";
|
|
105
|
+
div.style.left = "50%";
|
|
106
|
+
div.style.marginLeft = "-125px";
|
|
107
|
+
div.style.zIndex = Number.MAX_SAFE_INTEGER.toString();
|
|
108
|
+
div.style.opacity = "0";
|
|
109
|
+
div.style.transition = "opacity 0.5s";
|
|
110
|
+
document.body.append(div);
|
|
111
|
+
setTimeout(function () {
|
|
112
|
+
div.style.opacity = "1";
|
|
113
|
+
}, 500);
|
|
114
|
+
setTimeout(function () {
|
|
115
|
+
div.style.opacity = "0";
|
|
116
|
+
}, 3000);
|
|
117
|
+
setTimeout(function () {
|
|
118
|
+
div.remove();
|
|
119
|
+
}, 4000);
|
|
120
|
+
}
|
|
83
121
|
}
|
|
84
122
|
});
|
|
85
|
-
client = Object.assign(Object.assign({}, c.impl), { camera_default_device_id: userFacing => userFacing ? camera_source_1.CameraSource.USER_DEFAULT_DEVICE_ID : camera_source_1.CameraSource.DEFAULT_DEVICE_ID, camera_source_create: (p, deviceId) =>
|
|
123
|
+
client = Object.assign(Object.assign({}, c.impl), { loaded: () => loaded, camera_default_device_id: userFacing => userFacing ? camera_source_1.CameraSource.USER_DEFAULT_DEVICE_ID : camera_source_1.CameraSource.DEFAULT_DEVICE_ID, camera_source_create: (p, deviceId) => camera_source_map_1.createCameraSource(p, deviceId), camera_source_destroy: cam => { var _a; return (_a = camera_source_map_1.getCameraSource(cam)) === null || _a === void 0 ? void 0 : _a.destroy(); }, camera_source_pause: cam => { var _a; return (_a = camera_source_map_1.getCameraSource(cam)) === null || _a === void 0 ? void 0 : _a.pause(); }, camera_source_start: cam => { var _a; return (_a = camera_source_map_1.getCameraSource(cam)) === null || _a === void 0 ? void 0 : _a.start(); }, pipeline_create: () => pipeline_1.Pipeline.create(c.impl, worker_client_1.messageManager), pipeline_frame_update: (p) => { var _a; return (_a = pipeline_1.Pipeline.get(p)) === null || _a === void 0 ? void 0 : _a.frameUpdate(c); }, pipeline_camera_frame_draw_gl: (pipeline, screenWidth, screenHeight, mirror) => {
|
|
86
124
|
var _a;
|
|
87
125
|
(_a = pipeline_1.Pipeline.get(pipeline)) === null || _a === void 0 ? void 0 : _a.cameraFrameDrawGL(screenWidth, screenHeight, mirror);
|
|
88
126
|
}, draw_plane: (gl, projectionMatrix, cameraMatrix, targetMatrix, texture) => {
|
|
@@ -130,6 +168,79 @@ function initialize() {
|
|
|
130
168
|
let rawVec = gl_matrix_1.vec3.create();
|
|
131
169
|
gl_matrix_1.vec3.transformMat4(rawVec, [x, y, z], rotationMat);
|
|
132
170
|
c.impl.instant_world_tracker_anchor_pose_set_from_camera_offset_raw(o, rawVec[0], rawVec[1], rawVec[2], orientation);
|
|
171
|
+
}, image_tracker_create: pipeline => imagetracker_1.ImageTracker.create(pipeline, c.impl), image_tracker_destroy: t => { var _a; return (_a = imagetracker_1.ImageTracker.get(t)) === null || _a === void 0 ? void 0 : _a.destroy(); }, image_tracker_target_count: t => {
|
|
172
|
+
let obj = imagetracker_1.ImageTracker.get(t);
|
|
173
|
+
if (!obj) {
|
|
174
|
+
loglevel_1.zcwarn("attempting to call image_tracker_target_count on a destroyed zappar_image_tracker_t");
|
|
175
|
+
return 0;
|
|
176
|
+
}
|
|
177
|
+
return obj.targetCount();
|
|
178
|
+
}, image_tracker_target_load_from_memory: (t, data) => {
|
|
179
|
+
let obj = imagetracker_1.ImageTracker.get(t);
|
|
180
|
+
if (!obj) {
|
|
181
|
+
loglevel_1.zcwarn("attempting to call image_tracker_target_load_from_memory on a destroyed zappar_image_tracker_t");
|
|
182
|
+
return 0;
|
|
183
|
+
}
|
|
184
|
+
obj.loadFromMemory(data);
|
|
185
|
+
}, image_tracker_target_preview_compressed: (t, i) => {
|
|
186
|
+
var _a;
|
|
187
|
+
let obj = imagetracker_1.ImageTracker.get(t);
|
|
188
|
+
if (!obj) {
|
|
189
|
+
loglevel_1.zcwarn("attempting to call image_tracker_target_preview_compressed on a destroyed zappar_image_tracker_t");
|
|
190
|
+
return new Uint8Array(0);
|
|
191
|
+
}
|
|
192
|
+
return ((_a = obj.getTargetInfo(i).preview) === null || _a === void 0 ? void 0 : _a.compressed) || new Uint8Array(0);
|
|
193
|
+
}, image_tracker_target_preview_compressed_mimetype: (t, i) => {
|
|
194
|
+
var _a;
|
|
195
|
+
let obj = imagetracker_1.ImageTracker.get(t);
|
|
196
|
+
if (!obj) {
|
|
197
|
+
loglevel_1.zcwarn("attempting to call image_tracker_target_preview_compressed_mimetype on a destroyed zappar_image_tracker_t");
|
|
198
|
+
return "";
|
|
199
|
+
}
|
|
200
|
+
return ((_a = obj.getTargetInfo(i).preview) === null || _a === void 0 ? void 0 : _a.mimeType) || "";
|
|
201
|
+
}, image_tracker_target_preview_compressed_size: (t, i) => {
|
|
202
|
+
var _a, _b;
|
|
203
|
+
let obj = imagetracker_1.ImageTracker.get(t);
|
|
204
|
+
if (!obj) {
|
|
205
|
+
loglevel_1.zcwarn("attempting to call image_tracker_target_preview_compressed_size on a destroyed zappar_image_tracker_t");
|
|
206
|
+
return 0;
|
|
207
|
+
}
|
|
208
|
+
return ((_b = (_a = obj.getTargetInfo(i).preview) === null || _a === void 0 ? void 0 : _a.compressed) === null || _b === void 0 ? void 0 : _b.byteLength) || 0;
|
|
209
|
+
}, image_tracker_target_physical_scale_factor: (t, i) => {
|
|
210
|
+
let obj = imagetracker_1.ImageTracker.get(t);
|
|
211
|
+
if (!obj) {
|
|
212
|
+
loglevel_1.zcwarn("attempting to call image_tracker_target_physical_scale_factor on a destroyed zappar_image_tracker_t");
|
|
213
|
+
return 0;
|
|
214
|
+
}
|
|
215
|
+
return obj.getTargetInfo(i).physicalScaleFactor;
|
|
216
|
+
}, image_tracker_target_radius_top: (t, i) => {
|
|
217
|
+
let obj = imagetracker_1.ImageTracker.get(t);
|
|
218
|
+
if (!obj) {
|
|
219
|
+
loglevel_1.zcwarn("attempting to call image_tracker_target_radius_top on a destroyed zappar_image_tracker_t");
|
|
220
|
+
return 0;
|
|
221
|
+
}
|
|
222
|
+
return obj.getTargetInfo(i).topRadius;
|
|
223
|
+
}, image_tracker_target_radius_bottom: (t, i) => {
|
|
224
|
+
let obj = imagetracker_1.ImageTracker.get(t);
|
|
225
|
+
if (!obj) {
|
|
226
|
+
loglevel_1.zcwarn("attempting to call image_tracker_target_radius_bottom on a destroyed zappar_image_tracker_t");
|
|
227
|
+
return 0;
|
|
228
|
+
}
|
|
229
|
+
return obj.getTargetInfo(i).bottomRadius;
|
|
230
|
+
}, image_tracker_target_side_length: (t, i) => {
|
|
231
|
+
let obj = imagetracker_1.ImageTracker.get(t);
|
|
232
|
+
if (!obj) {
|
|
233
|
+
loglevel_1.zcwarn("attempting to call image_tracker_target_side_length on a destroyed zappar_image_tracker_t");
|
|
234
|
+
return 0;
|
|
235
|
+
}
|
|
236
|
+
return obj.getTargetInfo(i).sideLength;
|
|
237
|
+
}, image_tracker_target_image: (t, i) => {
|
|
238
|
+
let obj = imagetracker_1.ImageTracker.get(t);
|
|
239
|
+
if (!obj) {
|
|
240
|
+
loglevel_1.zcwarn("attempting to call image_tracker_target_image on a destroyed zappar_image_tracker_t");
|
|
241
|
+
return new Image();
|
|
242
|
+
}
|
|
243
|
+
return obj.getDecodedPreview(i);
|
|
133
244
|
}, image_tracker_anchor_pose_camera_relative: (o, indx, mirror) => {
|
|
134
245
|
let res = pipeline_1.applyScreenCounterRotation(undefined, c.impl.image_tracker_anchor_pose_raw(o, indx));
|
|
135
246
|
if (mirror) {
|
|
@@ -302,7 +413,7 @@ function initialize() {
|
|
|
302
413
|
return gl_matrix_1.mat4.create();
|
|
303
414
|
}
|
|
304
415
|
return obj.anchor_pose;
|
|
305
|
-
}, html_element_source_create: (pipeline, elm) => html_element_source_1.HTMLElementSource.createVideoElementSource(pipeline, elm), html_element_source_start: o => { var _a; return (_a = html_element_source_1.HTMLElementSource.getVideoElementSource(o)) === null || _a === void 0 ? void 0 : _a.start(); }, html_element_source_pause: o => { var _a; return (_a = html_element_source_1.HTMLElementSource.getVideoElementSource(o)) === null || _a === void 0 ? void 0 : _a.pause(); }, html_element_source_destroy: o => { var _a; return (_a = html_element_source_1.HTMLElementSource.getVideoElementSource(o)) === null || _a === void 0 ? void 0 : _a.destroy(); }, sequence_source_create: p => sequencesource_1.SequenceSource.create(p), sequence_source_load_from_memory: (o, data) => { var _a; return (_a = sequencesource_1.SequenceSource.get(o)) === null || _a === void 0 ? void 0 : _a.loadFromMemory(data); }, sequence_source_pause: o => { var _a; return (_a = sequencesource_1.SequenceSource.get(o)) === null || _a === void 0 ? void 0 : _a.pause(); }, sequence_source_start: o => { var _a; return (_a = sequencesource_1.SequenceSource.get(o)) === null || _a === void 0 ? void 0 : _a.start(); }, sequence_source_destroy: o => { var _a; return (_a = sequencesource_1.SequenceSource.get(o)) === null || _a === void 0 ? void 0 : _a.destroy(); }, permission_granted_all: permission_1.permissionGrantedAll, permission_granted_camera: permission_1.permissionGrantedCamera, permission_granted_motion: permission_1.permissionGrantedMotion, permission_denied_any: permission_1.permissionDeniedAny, permission_denied_camera: permission_1.permissionDeniedCamera, permission_denied_motion: permission_1.permissionDeniedMotion, permission_request_motion: permission_1.permissionRequestMotion, permission_request_camera: permission_1.permissionRequestCamera, permission_request_all: permission_1.permissionRequestAll, permission_request_ui: permission_1.permissionRequestUI, permission_request_ui_promise: permission_1.permissionRequestUI, permission_denied_ui: permission_1.permissionDeniedUI, browser_incompatible: compatibility_1.default.incompatible, browser_incompatible_ui: compatibility_1.default.incompatible_ui, log_level_set: l => {
|
|
416
|
+
}, html_element_source_create: (pipeline, elm) => html_element_source_1.HTMLElementSource.createVideoElementSource(pipeline, elm), html_element_source_start: o => { var _a; return (_a = html_element_source_1.HTMLElementSource.getVideoElementSource(o)) === null || _a === void 0 ? void 0 : _a.start(); }, html_element_source_pause: o => { var _a; return (_a = html_element_source_1.HTMLElementSource.getVideoElementSource(o)) === null || _a === void 0 ? void 0 : _a.pause(); }, html_element_source_destroy: o => { var _a; return (_a = html_element_source_1.HTMLElementSource.getVideoElementSource(o)) === null || _a === void 0 ? void 0 : _a.destroy(); }, sequence_source_create: p => sequencesource_1.SequenceSource.create(p), sequence_source_load_from_memory: (o, data) => { var _a; return (_a = sequencesource_1.SequenceSource.get(o)) === null || _a === void 0 ? void 0 : _a.loadFromMemory(data); }, sequence_source_pause: o => { var _a; return (_a = sequencesource_1.SequenceSource.get(o)) === null || _a === void 0 ? void 0 : _a.pause(); }, sequence_source_start: o => { var _a; return (_a = sequencesource_1.SequenceSource.get(o)) === null || _a === void 0 ? void 0 : _a.start(); }, sequence_source_max_playback_fps_set: (o, fps) => { var _a; return (_a = sequencesource_1.SequenceSource.get(o)) === null || _a === void 0 ? void 0 : _a.maxPlaybackFpsSet(fps); }, sequence_source_destroy: o => { var _a; return (_a = sequencesource_1.SequenceSource.get(o)) === null || _a === void 0 ? void 0 : _a.destroy(); }, permission_granted_all: permission_1.permissionGrantedAll, permission_granted_camera: permission_1.permissionGrantedCamera, permission_granted_motion: permission_1.permissionGrantedMotion, permission_denied_any: permission_1.permissionDeniedAny, permission_denied_camera: permission_1.permissionDeniedCamera, permission_denied_motion: permission_1.permissionDeniedMotion, permission_request_motion: permission_1.permissionRequestMotion, permission_request_camera: permission_1.permissionRequestCamera, permission_request_all: permission_1.permissionRequestAll, permission_request_ui: permission_1.permissionRequestUI, permission_request_ui_promise: permission_1.permissionRequestUI, permission_denied_ui: permission_1.permissionDeniedUI, browser_incompatible: compatibility_1.default.incompatible, browser_incompatible_ui: compatibility_1.default.incompatible_ui, log_level_set: l => {
|
|
306
417
|
loglevel_1.setLogLevel(l);
|
|
307
418
|
c.impl.log_level_set(l);
|
|
308
419
|
} });
|
package/lib/pipeline.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="dom-webcodecs" />
|
|
2
|
+
import { zappar_pipeline_t, zappar_camera_source_t } from "./gen/zappar";
|
|
2
3
|
import { zappar_cwrap } from "./gen/zappar-native";
|
|
3
4
|
import { zappar_client } from "./gen/zappar-client";
|
|
4
5
|
import { MsgManager } from "./messages";
|
|
5
6
|
import { mat4 } from "gl-matrix";
|
|
6
7
|
import { Source, CameraFrameInfo } from "./source";
|
|
7
|
-
import { CameraFrameReturnS2C } from "./workerinterface";
|
|
8
|
+
import { CameraFrameReturnS2C, ImageBitmapS2C, VideoFrameS2C } from "./workerinterface";
|
|
8
9
|
import { FaceMesh } from "./facemesh";
|
|
9
10
|
import { Event } from "./event";
|
|
10
11
|
export declare class Pipeline {
|
|
@@ -24,11 +25,13 @@ export declare class Pipeline {
|
|
|
24
25
|
private _faceProjectDraw;
|
|
25
26
|
private _sequenceRecorder;
|
|
26
27
|
private _sequenceRecordDeviceAttitudeMatrices;
|
|
28
|
+
private _sequenceRecorderFirstCameraToken;
|
|
27
29
|
onGLContextReset: Event;
|
|
28
30
|
static create(client: zappar_cwrap, mgr: MsgManager): zappar_pipeline_t;
|
|
29
31
|
static get(p: zappar_pipeline_t): Pipeline | undefined;
|
|
30
32
|
private constructor();
|
|
31
33
|
frameUpdate(client: zappar_client): void;
|
|
34
|
+
cleanOldFrames(): void;
|
|
32
35
|
cameraTokenReturn(msg: CameraFrameReturnS2C): void;
|
|
33
36
|
sequenceRecordStart(expectedFrames: number): void;
|
|
34
37
|
sequenceRecordStop(): void;
|
|
@@ -47,11 +50,18 @@ export declare class Pipeline {
|
|
|
47
50
|
cameraFrameTextureMatrix(sw: number, sh: number, mirror: boolean): Float32Array;
|
|
48
51
|
cameraFrameUserFacing(): boolean;
|
|
49
52
|
cameraPoseWithAttitude(mirror: boolean): Float32Array;
|
|
53
|
+
videoFrameFromWorker(msg: VideoFrameS2C): void;
|
|
54
|
+
imageBitmapFromWorker(msg: ImageBitmapS2C): void;
|
|
55
|
+
uploadGL(): void;
|
|
56
|
+
registerToken(info: CameraFrameInfo): number;
|
|
50
57
|
processGL(): void;
|
|
51
58
|
motionAccelerometerSubmit(timestamp: number, x: number, y: number, z: number): void;
|
|
52
59
|
motionRotationRateSubmit(timestamp: number, x: number, y: number, z: number): void;
|
|
53
60
|
motionAttitudeSubmit(timestamp: number, x: number, y: number, z: number): void;
|
|
54
61
|
motionAttitudeMatrix(m: Float32Array): void;
|
|
55
|
-
|
|
62
|
+
sendCameraStreamToWorker(source: zappar_camera_source_t, stream: ReadableStream<VideoFrame>, userFacing: boolean): void;
|
|
63
|
+
sendCameraToScreenRotationToWorker(rot: number): void;
|
|
64
|
+
sendImageBitmapToWorker(img: ImageBitmap, rot: number, userFacing: boolean, tokenId: number, cameraModel: Float32Array, cameraToDevice: Float32Array): void;
|
|
65
|
+
sendDataToWorker(data: ArrayBuffer, token: number, width: number, height: number, userFacing: boolean, cameraToDevice: Float32Array, cameraModel: Float32Array): void;
|
|
56
66
|
}
|
|
57
67
|
export declare function applyScreenCounterRotation(info: CameraFrameInfo | undefined, inp: Float32Array): mat4;
|