@zappar/zappar-cv 3.0.1-alpha.8 → 3.0.1-beta.1
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 +17 -2
- package/lib/deserializer.d.ts +5 -1
- package/lib/deserializer.js +12 -0
- package/lib/direct.js +1 -1
- package/lib/drawaxis.d.ts +2 -0
- package/lib/drawaxis.js +137 -0
- package/lib/drawgrid.js +5 -2
- package/lib/drawpoints.d.ts +1 -0
- package/lib/drawpoints.js +2 -2
- package/lib/drawpointswithtype.d.ts +13 -0
- package/lib/drawpointswithtype.js +190 -0
- package/lib/drawpolygon.d.ts +5 -0
- package/lib/drawpolygon.js +94 -0
- package/lib/gen/zappar-bridge.d.ts +44 -11
- package/lib/gen/zappar-bridge.js +3 -0
- package/lib/gen/zappar-client.d.ts +1 -0
- package/lib/gen/zappar-client.js +347 -47
- package/lib/gen/zappar-cwrap.js +251 -41
- package/lib/gen/zappar-native.d.ts +56 -13
- package/lib/gen/zappar-native.js +23 -1
- package/lib/gen/zappar-server.d.ts +3 -0
- package/lib/gen/zappar-server.js +166 -21
- package/lib/gen/zappar.d.ts +51 -13
- package/lib/gen/zappar.js +3 -0
- package/lib/html-element-source.d.ts +4 -0
- package/lib/html-element-source.js +30 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/mstp-camera-source.js +2 -1
- package/lib/native.js +59 -4
- package/lib/permission.d.ts +3 -2
- package/lib/permission.js +52 -23
- package/lib/pipeline.d.ts +1 -1
- package/lib/pipeline.js +3 -2
- package/lib/sequencesource.js +1 -1
- package/lib/serializer.d.ts +5 -1
- package/lib/serializer.js +4 -0
- package/lib/tr.js +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/worker-client.js +4 -1
- package/lib/worker-imagebitmap.js +1 -1
- package/lib/worker-server.d.ts +1 -1
- package/lib/worker-server.js +5 -5
- package/lib/worker.js +1 -1
- package/lib/workerinterface.d.ts +1 -0
- package/lib/zappar-cv.js +1 -212
- package/lib/zappar-cv.wasm +0 -0
- package/package.json +1 -1
- package/umd/751.zappar-cv.js +1 -1
- package/umd/867.zappar-cv.js +1 -1
- package/umd/{5a86c8fa5c139c48ad64.wasm → ad30381eac4454d1944a.wasm} +0 -0
- package/umd/zappar-cv.js +1 -1
- package/umd/zappar-cv.worker.js +1 -1
package/lib/permission.js
CHANGED
|
@@ -74,7 +74,8 @@ export function permissionRequestMotion() {
|
|
|
74
74
|
_permissionDeniedMotion = false;
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
-
export function permissionRequestUI() {
|
|
77
|
+
export function permissionRequestUI(options) {
|
|
78
|
+
var _a, _b, _c;
|
|
78
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
80
|
yield checkForCameraPermission();
|
|
80
81
|
if (permissionGrantedAll()) {
|
|
@@ -82,6 +83,7 @@ export function permissionRequestUI() {
|
|
|
82
83
|
}
|
|
83
84
|
let div = document.createElement("div");
|
|
84
85
|
div.classList.add("zappar-permission-request");
|
|
86
|
+
div.classList.add("zappar-permission-request-without-button");
|
|
85
87
|
div.innerHTML = `
|
|
86
88
|
<style>
|
|
87
89
|
.zappar-permission-request {
|
|
@@ -99,7 +101,21 @@ export function permissionRequestUI() {
|
|
|
99
101
|
align-items: center;
|
|
100
102
|
justify-content: center;
|
|
101
103
|
}
|
|
104
|
+
.zappar-permission-request-without-button {
|
|
105
|
+
justify-content: flex-start;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.zappar-permission-request-without-button #zappar-permission-request-button {
|
|
109
|
+
display: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.zappar-permission-request-without-button .zappar-inner {
|
|
113
|
+
max-width: 300px;
|
|
114
|
+
}
|
|
115
|
+
|
|
102
116
|
.zappar-inner {
|
|
117
|
+
margin-top: 30%;
|
|
118
|
+
margin-bottom: 30%;
|
|
103
119
|
max-width: 400px;
|
|
104
120
|
text-align: center;
|
|
105
121
|
}
|
|
@@ -121,46 +137,58 @@ export function permissionRequestUI() {
|
|
|
121
137
|
}
|
|
122
138
|
</style>
|
|
123
139
|
<div class="zappar-inner">
|
|
124
|
-
<div class="zappar-title">${tr(STRINGS.PermissionTitle)}</div>
|
|
125
|
-
<div class="zappar-text">${tr(STRINGS.PermissionDescription)}</div>
|
|
126
|
-
<button id="zappar-permission-request-button">${tr(STRINGS.PermissionButton)}</button>
|
|
140
|
+
<div class="zappar-title">${(_a = options === null || options === void 0 ? void 0 : options.title) !== null && _a !== void 0 ? _a : tr(STRINGS.PermissionTitle)}</div>
|
|
141
|
+
<div class="zappar-text">${(_b = options === null || options === void 0 ? void 0 : options.description) !== null && _b !== void 0 ? _b : tr(STRINGS.PermissionDescription)}</div>
|
|
142
|
+
<button id="zappar-permission-request-button">${(_c = options === null || options === void 0 ? void 0 : options.button) !== null && _c !== void 0 ? _c : tr(STRINGS.PermissionButton)}</button>
|
|
127
143
|
</div>
|
|
128
144
|
`;
|
|
129
145
|
document.body.append(div);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
button === null || button === void 0 ? void 0 : button.addEventListener("click", () => __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
function attempt() {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
133
148
|
yield permissionRequestAll();
|
|
134
149
|
div.remove();
|
|
135
150
|
while (true) {
|
|
136
151
|
yield nextFrame();
|
|
137
152
|
if (permissionDeniedAny()) {
|
|
138
|
-
|
|
139
|
-
return;
|
|
153
|
+
return false;
|
|
140
154
|
}
|
|
141
155
|
if (permissionGrantedAll()) {
|
|
142
|
-
|
|
143
|
-
return;
|
|
156
|
+
return true;
|
|
144
157
|
}
|
|
145
158
|
}
|
|
159
|
+
return false;
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
return yield attempt();
|
|
164
|
+
}
|
|
165
|
+
catch (err) {
|
|
166
|
+
// We may need a user interaction
|
|
167
|
+
div.classList.remove("zappar-permission-request-without-button");
|
|
168
|
+
let button = div.querySelector("#zappar-permission-request-button");
|
|
169
|
+
return yield new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
button === null || button === void 0 ? void 0 : button.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
|
|
171
|
+
resolve(yield attempt());
|
|
172
|
+
}));
|
|
146
173
|
}));
|
|
147
|
-
}
|
|
174
|
+
}
|
|
148
175
|
});
|
|
149
176
|
}
|
|
150
177
|
function nextFrame() {
|
|
151
178
|
return new Promise(resolve => requestAnimationFrame(() => resolve()));
|
|
152
179
|
}
|
|
153
|
-
export function permissionDeniedUI() {
|
|
180
|
+
export function permissionDeniedUI(options) {
|
|
154
181
|
switch (parser.getBrowser().name) {
|
|
155
182
|
case "Chrome":
|
|
156
|
-
permissionDeniedUIChrome();
|
|
183
|
+
permissionDeniedUIChrome(options);
|
|
157
184
|
break;
|
|
158
185
|
default:
|
|
159
|
-
permissionDeniedUIIOS();
|
|
186
|
+
permissionDeniedUIIOS(options);
|
|
160
187
|
break;
|
|
161
188
|
}
|
|
162
189
|
}
|
|
163
|
-
function permissionDeniedUIIOS() {
|
|
190
|
+
function permissionDeniedUIIOS(options) {
|
|
191
|
+
var _a, _b, _c, _d;
|
|
164
192
|
let div = document.createElement("div");
|
|
165
193
|
div.classList.add("zappar-permission-request");
|
|
166
194
|
div.innerHTML = `
|
|
@@ -202,16 +230,17 @@ function permissionDeniedUIIOS() {
|
|
|
202
230
|
}
|
|
203
231
|
</style>
|
|
204
232
|
<div class="zappar-inner">
|
|
205
|
-
<div class="zappar-title"
|
|
206
|
-
<div class="zappar-text"
|
|
207
|
-
<button id="zappar-permission-reload-button"
|
|
233
|
+
<div class="zappar-title">${(_a = options === null || options === void 0 ? void 0 : options.title) !== null && _a !== void 0 ? _a : 'Permission is Needed'}</div>
|
|
234
|
+
<div class="zappar-text">${(_c = (_b = options === null || options === void 0 ? void 0 : options.descriptionIOS) !== null && _b !== void 0 ? _b : options === null || options === void 0 ? void 0 : options.description) !== null && _c !== void 0 ? _c : "Permission to access your device's camera and motion sensors is necessary for this experience. Please reload the page to try again."}</div>
|
|
235
|
+
<button id="zappar-permission-reload-button">${(_d = options === null || options === void 0 ? void 0 : options.button) !== null && _d !== void 0 ? _d : 'Reload'}</button>
|
|
208
236
|
</div>
|
|
209
237
|
`;
|
|
210
238
|
document.body.append(div);
|
|
211
239
|
let button = div.querySelector("#zappar-permission-reload-button");
|
|
212
240
|
button === null || button === void 0 ? void 0 : button.addEventListener("click", () => window.location.reload());
|
|
213
241
|
}
|
|
214
|
-
function permissionDeniedUIChrome() {
|
|
242
|
+
function permissionDeniedUIChrome(options) {
|
|
243
|
+
var _a, _b, _c, _d;
|
|
215
244
|
let div = document.createElement("div");
|
|
216
245
|
div.classList.add("zappar-permission-request");
|
|
217
246
|
div.innerHTML = `
|
|
@@ -253,9 +282,9 @@ function permissionDeniedUIChrome() {
|
|
|
253
282
|
}
|
|
254
283
|
</style>
|
|
255
284
|
<div class="zappar-inner">
|
|
256
|
-
<div class="zappar-title"
|
|
257
|
-
<div class="zappar-text"
|
|
258
|
-
<button id="zappar-permission-reload-button"
|
|
285
|
+
<div class="zappar-title">${(_a = options === null || options === void 0 ? void 0 : options.title) !== null && _a !== void 0 ? _a : 'Permission is Needed'}</div>
|
|
286
|
+
<div class="zappar-text">${(_c = (_b = options === null || options === void 0 ? void 0 : options.descriptionChrome) !== null && _b !== void 0 ? _b : options === null || options === void 0 ? void 0 : options.description) !== null && _c !== void 0 ? _c : `Permission to access your device's camera and motion sensors is necessary for this experience.<br/><br/>To grant access, please tap the <svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 -960 960 960" width="16px" fill="white"><path d="M696-144q-60.48 0-102.24-41.76T552-288q0-60.48 41.76-102.24T696-432q60.48 0 102.24 41.76T840-288q0 60.48-41.76 102.24T696-144Zm.12-72Q726-216 747-237.12q21-21.12 21-51T746.88-339q-21.12-21-51-21T645-338.88q-21 21.12-21 51T645.12-237q21.12 21 51 21ZM168-252v-72h312v72H168Zm96-276q-60.48 0-102.24-41.76T120-672q0-60.48 41.76-102.24T264-816q60.48 0 102.24 41.76T408-672q0 60.48-41.76 102.24T264-528Zm.12-72Q294-600 315-621.12q21-21.12 21-51T314.88-723q-21.12-21-51-21T213-722.88q-21 21.12-21 51T213.12-621q21.12 21 51 21ZM480-636v-72h312v72H480Zm216 348ZM264-672Z"/></svg> button in the address bar of your browser, then "Permissions", and finally "Reset permissions". You can then reload the page to try again.`}</div>
|
|
287
|
+
<button id="zappar-permission-reload-button">${(_d = options === null || options === void 0 ? void 0 : options.button) !== null && _d !== void 0 ? _d : 'Reload'}</button>
|
|
259
288
|
</div>
|
|
260
289
|
`;
|
|
261
290
|
document.body.append(div);
|
package/lib/pipeline.d.ts
CHANGED
|
@@ -78,6 +78,6 @@ export declare class Pipeline {
|
|
|
78
78
|
sendCameraProfileToWorker(source: zappar_camera_source_t, profile: camera_profile_t): void;
|
|
79
79
|
sendCameraToScreenRotationToWorker(rot: number): void;
|
|
80
80
|
sendImageBitmapToWorker(img: ImageBitmap, rot: number, userFacing: boolean, tokenId: number, cameraModel: Float32Array, cameraToDevice: Float32Array, cp: camera_profile_t): void;
|
|
81
|
-
sendDataToWorker(data: ArrayBuffer, token: number, width: number, height: number, userFacing: boolean, cameraToDevice: Float32Array, cameraModel: Float32Array): void;
|
|
81
|
+
sendDataToWorker(data: ArrayBuffer, token: number, width: number, height: number, userFacing: boolean, cameraToDevice: Float32Array, cameraModel: Float32Array, captureTime: number): void;
|
|
82
82
|
}
|
|
83
83
|
export declare function applyScreenCounterRotation(info: CameraFrameInfo | undefined, inp: Float32Array): Float32Array;
|
package/lib/pipeline.js
CHANGED
|
@@ -479,14 +479,15 @@ export class Pipeline {
|
|
|
479
479
|
};
|
|
480
480
|
this._mgr.postOutgoingMessage(msg, [img]);
|
|
481
481
|
}
|
|
482
|
-
sendDataToWorker(data, token, width, height, userFacing, cameraToDevice, cameraModel) {
|
|
482
|
+
sendDataToWorker(data, token, width, height, userFacing, cameraToDevice, cameraModel, captureTime) {
|
|
483
483
|
let msg = {
|
|
484
484
|
d: data,
|
|
485
485
|
p: this._impl,
|
|
486
486
|
width, height, token, userFacing,
|
|
487
487
|
c2d: cameraToDevice,
|
|
488
488
|
cm: cameraModel,
|
|
489
|
-
t: "cameraFrameC2S"
|
|
489
|
+
t: "cameraFrameC2S",
|
|
490
|
+
captureTime
|
|
490
491
|
};
|
|
491
492
|
this._mgr.postOutgoingMessage(msg, [data]);
|
|
492
493
|
}
|
package/lib/sequencesource.js
CHANGED
|
@@ -97,7 +97,7 @@ export class SequenceSource extends Source {
|
|
|
97
97
|
// updates will be one frame later
|
|
98
98
|
this._submitMotionUpdates(pipeline);
|
|
99
99
|
const token = pipeline.registerToken(info);
|
|
100
|
-
pipeline.sendDataToWorker(info.data || new ArrayBuffer(0), token, info.dataWidth, info.dataHeight, info.userFacing, info.cameraToDevice, info.cameraModel);
|
|
100
|
+
pipeline.sendDataToWorker(info.data || new ArrayBuffer(0), token, info.dataWidth, info.dataHeight, info.userFacing, info.cameraToDevice, info.cameraModel, -1);
|
|
101
101
|
}
|
|
102
102
|
destroy() {
|
|
103
103
|
byId.delete(this._impl);
|
package/lib/serializer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { barcode_format_t, face_landmark_name_t, instant_world_tracker_transform_orientation_t, log_level_t } from "./gen/zappar-native";
|
|
1
|
+
import { barcode_format_t, face_landmark_name_t, instant_world_tracker_transform_orientation_t, transform_orientation_t, log_level_t, plane_orientation_t, anchor_status_t } from "./gen/zappar-native";
|
|
2
2
|
export interface MessageAppender {
|
|
3
3
|
int: (i: number) => void;
|
|
4
4
|
bool: (i: boolean) => void;
|
|
@@ -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
|
+
ucharArray: (a: Uint8Array) => void;
|
|
11
12
|
floatArray: (a: Float32Array) => void;
|
|
12
13
|
cameraModel: (a: Float32Array) => void;
|
|
13
14
|
identityCoefficients: (a: Float32Array) => void;
|
|
@@ -16,6 +17,9 @@ export interface MessageAppender {
|
|
|
16
17
|
barcodeFormat: (f: barcode_format_t) => void;
|
|
17
18
|
faceLandmarkName: (f: face_landmark_name_t) => void;
|
|
18
19
|
instantTrackerTransformOrientation: (f: instant_world_tracker_transform_orientation_t) => void;
|
|
20
|
+
transformOrientation: (f: transform_orientation_t) => void;
|
|
21
|
+
planeOrientation: (f: plane_orientation_t) => void;
|
|
22
|
+
anchorStatus: (f: anchor_status_t) => void;
|
|
19
23
|
logLevel: (f: log_level_t) => void;
|
|
20
24
|
}
|
|
21
25
|
export declare class MessageSerializer {
|
package/lib/serializer.js
CHANGED
|
@@ -23,6 +23,7 @@ export class MessageSerializer {
|
|
|
23
23
|
matrix4x4: i => this.float32ArrayBuffer(i),
|
|
24
24
|
matrix3x3: i => this.float32ArrayBuffer(i),
|
|
25
25
|
floatArray: i => this.float32ArrayBuffer(i),
|
|
26
|
+
ucharArray: i => this.uint8ArrayBuffer(i),
|
|
26
27
|
identityCoefficients: i => this.float32ArrayBuffer(i),
|
|
27
28
|
expressionCoefficients: i => this.float32ArrayBuffer(i),
|
|
28
29
|
cameraModel: i => this.float32ArrayBuffer(i),
|
|
@@ -30,6 +31,9 @@ export class MessageSerializer {
|
|
|
30
31
|
barcodeFormat: i => this.int(i),
|
|
31
32
|
faceLandmarkName: i => this.int(i),
|
|
32
33
|
instantTrackerTransformOrientation: i => this.int(i),
|
|
34
|
+
transformOrientation: i => this.int(i),
|
|
35
|
+
planeOrientation: i => this.int(i),
|
|
36
|
+
anchorStatus: i => this.int(i),
|
|
33
37
|
logLevel: i => this.int(i),
|
|
34
38
|
};
|
|
35
39
|
this._freeBufferPool.push(new ArrayBuffer(16));
|
package/lib/tr.js
CHANGED
|
@@ -35,7 +35,7 @@ export function tr(str) {
|
|
|
35
35
|
}
|
|
36
36
|
switch (str) {
|
|
37
37
|
case STRINGS.PermissionTitle: return "Almost there...";
|
|
38
|
-
case STRINGS.PermissionDescription: return "In order to provide this
|
|
38
|
+
case STRINGS.PermissionDescription: return "In order to provide this immersive experience, we need access to your device's camera and motion sensors.";
|
|
39
39
|
case STRINGS.PermissionButton: return "Grant Access";
|
|
40
40
|
}
|
|
41
41
|
return "";
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.0.1-
|
|
1
|
+
export declare const VERSION = "3.0.1-beta.1";
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "3.0.1-
|
|
1
|
+
export const VERSION = "3.0.1-beta.1";
|
package/lib/worker-client.js
CHANGED
|
@@ -7,8 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
var _a;
|
|
10
11
|
import { MsgManager } from "./messages";
|
|
11
12
|
export let messageManager = new MsgManager();
|
|
13
|
+
const params = new URLSearchParams(window.location.search);
|
|
14
|
+
const shouldRecordData = parseInt((_a = params.get('_zrecorddata')) !== null && _a !== void 0 ? _a : '0');
|
|
12
15
|
const wasmModule = (() => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
16
|
const response = yield fetch(new URL("./zappar-cv.wasm", import.meta.url).toString());
|
|
14
17
|
const module = yield WebAssembly.compileStreaming(response);
|
|
@@ -22,7 +25,7 @@ export function launchWorker(worker) {
|
|
|
22
25
|
t: "wasm",
|
|
23
26
|
url: new URL("./zappar-cv.wasm", import.meta.url).toString(),
|
|
24
27
|
module: yield wasmModule,
|
|
25
|
-
shouldRecordData
|
|
28
|
+
shouldRecordData
|
|
26
29
|
});
|
|
27
30
|
yield waitForLoad(worker);
|
|
28
31
|
function sendOutgoing() {
|
|
@@ -53,7 +53,7 @@ export function handleImageBitmap(m, r, server, mgr) {
|
|
|
53
53
|
mgr.postOutgoingMessage(msg, [m.i]);
|
|
54
54
|
let pipeline = server._pipeline_by_instance.get(m.p);
|
|
55
55
|
if (pipeline) {
|
|
56
|
-
r.pipeline_camera_frame_submit(pipeline, pixels, info.dataWidth, info.dataHeight, m.tokenId, m.cameraToDevice, m.cameraModel, info.userFacing);
|
|
56
|
+
r.pipeline_camera_frame_submit(pipeline, pixels, info.dataWidth, info.dataHeight, m.tokenId, m.cameraToDevice, m.cameraModel, info.userFacing, performance.now());
|
|
57
57
|
r.pipeline_frame_update(pipeline);
|
|
58
58
|
server.exploreState();
|
|
59
59
|
}
|
package/lib/worker-server.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MsgManager } from "./messages";
|
|
2
2
|
export declare let messageManager: MsgManager;
|
|
3
|
-
export declare function launchWorkerServer(wasmUrl: string, module: WebAssembly.Module, shouldRecordData:
|
|
3
|
+
export declare function launchWorkerServer(wasmUrl: string, module: WebAssembly.Module, shouldRecordData: number): Promise<void>;
|
package/lib/worker-server.js
CHANGED
|
@@ -39,8 +39,8 @@ export function launchWorkerServer(wasmUrl, module, shouldRecordData) {
|
|
|
39
39
|
onRuntimeInitialized: () => {
|
|
40
40
|
let r = getRuntimeObject(mod);
|
|
41
41
|
const workerMessageAPI = getWorkerMessageAPI(mod);
|
|
42
|
-
const dataDownloadAPI = shouldRecordData ? getDataDownloadAPI(mod) : undefined;
|
|
43
|
-
dataDownloadAPI === null || dataDownloadAPI === void 0 ? void 0 : dataDownloadAPI.data_should_record_set(
|
|
42
|
+
const dataDownloadAPI = (shouldRecordData > 0) ? getDataDownloadAPI(mod) : undefined;
|
|
43
|
+
dataDownloadAPI === null || dataDownloadAPI === void 0 ? void 0 : dataDownloadAPI.data_should_record_set(shouldRecordData); // Only happens if dataDownloadAPI is defined
|
|
44
44
|
let server = new zappar_server(r, (pipelineId, ab) => {
|
|
45
45
|
messageManager.postOutgoingMessage({
|
|
46
46
|
p: pipelineId,
|
|
@@ -64,7 +64,7 @@ export function launchWorkerServer(wasmUrl, module, shouldRecordData) {
|
|
|
64
64
|
let pipeline = server._pipeline_by_instance.get(msgt.p);
|
|
65
65
|
let att;
|
|
66
66
|
if (pipeline) {
|
|
67
|
-
r.pipeline_camera_frame_submit(pipeline, msgt.d, msgt.width, msgt.height, msgt.token, msgt.c2d, msgt.cm, msgt.userFacing);
|
|
67
|
+
r.pipeline_camera_frame_submit(pipeline, msgt.d, msgt.width, msgt.height, msgt.token, msgt.c2d, msgt.cm, msgt.userFacing, msgt.captureTime);
|
|
68
68
|
r.pipeline_frame_update(pipeline);
|
|
69
69
|
att = r.pipeline_camera_frame_device_attitude(pipeline);
|
|
70
70
|
server.exploreState();
|
|
@@ -266,7 +266,7 @@ function consumeReader(mod, r, reader, p, userFacing, server, source, workerMess
|
|
|
266
266
|
mat4.fromScaling(cameraToDeviceTransform, [-1, 1, -1]);
|
|
267
267
|
else
|
|
268
268
|
mat4.identity(cameraToDeviceTransform);
|
|
269
|
-
let focalLength =
|
|
269
|
+
let focalLength = 240.0 * dataWidth / 320.0;
|
|
270
270
|
cameraModel[0] = focalLength;
|
|
271
271
|
cameraModel[1] = focalLength;
|
|
272
272
|
cameraModel[2] = dataWidth * 0.5;
|
|
@@ -288,7 +288,7 @@ function consumeReader(mod, r, reader, p, userFacing, server, source, workerMess
|
|
|
288
288
|
const pipeline = server._pipeline_by_instance.get(p);
|
|
289
289
|
if (pipeline) {
|
|
290
290
|
try {
|
|
291
|
-
r.pipeline_camera_frame_submit_raw_pointer(pipeline, streamDataBufferPointer, size, framePixelFormatFromFormat(frame.format), width, height, token, cameraToDeviceTransform, latestCameraToScreenRotation, cameraModel, userFacing, (_b = frame.timestamp) !== null && _b !== void 0 ? _b : -1, downSample);
|
|
291
|
+
r.pipeline_camera_frame_submit_raw_pointer(pipeline, streamDataBufferPointer, size, framePixelFormatFromFormat(frame.format), width, height, token, cameraToDeviceTransform, latestCameraToScreenRotation, cameraModel, userFacing, ((_b = frame.timestamp) !== null && _b !== void 0 ? _b : -1) * 1e-6, downSample);
|
|
292
292
|
handleMessages(mod, workerMessageAPI);
|
|
293
293
|
if (dataDownloadAPI)
|
|
294
294
|
handleDataDownload(mod, dataDownloadAPI);
|
package/lib/worker.js
CHANGED
|
@@ -10,7 +10,7 @@ let launchHandler = (evt) => {
|
|
|
10
10
|
var _a;
|
|
11
11
|
if (evt && evt.data && evt.data.t === "wasm") {
|
|
12
12
|
let url = location.href.startsWith("blob") ? evt.data.url : new URL("./zappar-cv.wasm", import.meta.url).toString();
|
|
13
|
-
launchWorkerServer(url, evt.data.module, (_a = evt.data.shouldRecordData) !== null && _a !== void 0 ? _a :
|
|
13
|
+
launchWorkerServer(url, evt.data.module, (_a = evt.data.shouldRecordData) !== null && _a !== void 0 ? _a : 0);
|
|
14
14
|
ctx.removeEventListener("message", launchHandler);
|
|
15
15
|
}
|
|
16
16
|
};
|