@zappar/zappar-cv 2.0.0-beta.2 → 2.0.0-beta.5
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/gen/zappar-native.d.ts +5 -0
- package/lib/gen/zappar-native.js +7 -0
- package/lib/gen/zappar.d.ts +3 -0
- package/lib/gen/zappar.js +1 -0
- package/lib/imagetracker-previewmesh.d.ts +2 -0
- package/lib/imagetracker-previewmesh.js +205 -0
- package/lib/imagetracker.d.ts +16 -2
- package/lib/imagetracker.js +81 -40
- package/lib/native.js +10 -2
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/zcv.js +18 -18
- package/lib/zcv.wasm +0 -0
- package/package.json +1 -1
- package/umd/752.zappar-cv.js +1 -1
- package/umd/{557cf735d27efb96e262.wasm → d623b76c14719b88c180.wasm} +0 -0
- package/umd/zappar-cv.js +1 -1
- package/umd/zappar-cv.worker.js +1 -1
package/README.md
CHANGED
|
@@ -18,8 +18,8 @@ npm i @zappar/zappar-cv
|
|
|
18
18
|
|
|
19
19
|
You can use our CDN from within your HTML:
|
|
20
20
|
```
|
|
21
|
-
<script src="https://libs.zappar.com/zappar-cv/2.0.0-beta.
|
|
21
|
+
<script src="https://libs.zappar.com/zappar-cv/2.0.0-beta.5/zappar-cv.js"></script>
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
Or you can download and host our standalone JavaScript bundle:
|
|
25
|
-
[https://libs.zappar.com/zappar-cv/2.0.0-beta.
|
|
25
|
+
[https://libs.zappar.com/zappar-cv/2.0.0-beta.5/zappar-cv.zip](https://libs.zappar.com/zappar-cv/2.0.0-beta.5/zappar-cv.zip)
|
|
@@ -56,6 +56,11 @@ export declare enum frame_pixel_format_t {
|
|
|
56
56
|
FRAME_PIXEL_FORMAT_BGRA = 6,
|
|
57
57
|
FRAME_PIXEL_FORMAT_Y = 7
|
|
58
58
|
}
|
|
59
|
+
export declare enum image_target_type_t {
|
|
60
|
+
IMAGE_TRACKER_TYPE_PLANAR = 0,
|
|
61
|
+
IMAGE_TRACKER_TYPE_CYLINDRICAL = 1,
|
|
62
|
+
IMAGE_TRACKER_TYPE_CONICAL = 2
|
|
63
|
+
}
|
|
59
64
|
export declare type zappar_pipeline_t = number & {
|
|
60
65
|
_: 'zappar_pipeline_t';
|
|
61
66
|
};
|
package/lib/gen/zappar-native.js
CHANGED
|
@@ -66,3 +66,10 @@ export var frame_pixel_format_t;
|
|
|
66
66
|
frame_pixel_format_t[frame_pixel_format_t["FRAME_PIXEL_FORMAT_Y"] = 7] = "FRAME_PIXEL_FORMAT_Y";
|
|
67
67
|
})(frame_pixel_format_t || (frame_pixel_format_t = {}));
|
|
68
68
|
;
|
|
69
|
+
export var image_target_type_t;
|
|
70
|
+
(function (image_target_type_t) {
|
|
71
|
+
image_target_type_t[image_target_type_t["IMAGE_TRACKER_TYPE_PLANAR"] = 0] = "IMAGE_TRACKER_TYPE_PLANAR";
|
|
72
|
+
image_target_type_t[image_target_type_t["IMAGE_TRACKER_TYPE_CYLINDRICAL"] = 1] = "IMAGE_TRACKER_TYPE_CYLINDRICAL";
|
|
73
|
+
image_target_type_t[image_target_type_t["IMAGE_TRACKER_TYPE_CONICAL"] = 2] = "IMAGE_TRACKER_TYPE_CONICAL";
|
|
74
|
+
})(image_target_type_t || (image_target_type_t = {}));
|
|
75
|
+
;
|
package/lib/gen/zappar.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ import { instant_world_tracker_transform_orientation_t } from "./zappar-native";
|
|
|
7
7
|
export { instant_world_tracker_transform_orientation_t } from "./zappar-native";
|
|
8
8
|
import { log_level_t } from "./zappar-native";
|
|
9
9
|
export { log_level_t } from "./zappar-native";
|
|
10
|
+
import { image_target_type_t } from "./zappar-native";
|
|
11
|
+
export { image_target_type_t } from "./zappar-native";
|
|
10
12
|
export declare type zappar_pipeline_t = number & {
|
|
11
13
|
_: 'zappar_pipeline_t';
|
|
12
14
|
};
|
|
@@ -95,6 +97,7 @@ export interface zappar {
|
|
|
95
97
|
image_tracker_target_load_from_memory(o: zappar_image_tracker_t, data: ArrayBuffer): void;
|
|
96
98
|
image_tracker_target_loaded_version(o: zappar_image_tracker_t): number;
|
|
97
99
|
image_tracker_target_count(o: zappar_image_tracker_t): number;
|
|
100
|
+
image_tracker_target_type(o: zappar_image_tracker_t, indx: number): image_target_type_t;
|
|
98
101
|
image_tracker_target_radius_top(o: zappar_image_tracker_t, indx: number): number;
|
|
99
102
|
image_tracker_target_radius_bottom(o: zappar_image_tracker_t, indx: number): number;
|
|
100
103
|
image_tracker_target_side_length(o: zappar_image_tracker_t, indx: number): number;
|
package/lib/gen/zappar.js
CHANGED
|
@@ -3,3 +3,4 @@ export { face_landmark_name_t } from "./zappar-native";
|
|
|
3
3
|
export { frame_pixel_format_t } from "./zappar-native";
|
|
4
4
|
export { instant_world_tracker_transform_orientation_t } from "./zappar-native";
|
|
5
5
|
export { log_level_t } from "./zappar-native";
|
|
6
|
+
export { image_target_type_t } from "./zappar-native";
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { vec2 } from "gl-matrix";
|
|
2
|
+
import { image_target_type_t } from "./gen/zappar-native";
|
|
3
|
+
export function getPreviewMesh(info) {
|
|
4
|
+
switch (info.type) {
|
|
5
|
+
case image_target_type_t.IMAGE_TRACKER_TYPE_PLANAR: return planar(info);
|
|
6
|
+
case image_target_type_t.IMAGE_TRACKER_TYPE_CYLINDRICAL: return cylindrical(info);
|
|
7
|
+
case image_target_type_t.IMAGE_TRACKER_TYPE_CONICAL: return conical(info);
|
|
8
|
+
}
|
|
9
|
+
return defaultMesh();
|
|
10
|
+
}
|
|
11
|
+
function planar(info) {
|
|
12
|
+
const aspectRatio = info.trainedWidth / info.trainedHeight;
|
|
13
|
+
if (isNaN(aspectRatio))
|
|
14
|
+
return defaultMesh();
|
|
15
|
+
const vertices = new Float32Array([
|
|
16
|
+
-1.0 * aspectRatio, -1, 0,
|
|
17
|
+
-1.0 * aspectRatio, 1, 0,
|
|
18
|
+
aspectRatio, 1, 0,
|
|
19
|
+
aspectRatio, -1, 0
|
|
20
|
+
]);
|
|
21
|
+
const indices = new Uint16Array([0, 2, 1, 0, 3, 2]);
|
|
22
|
+
const uvs = new Float32Array([
|
|
23
|
+
0, 0,
|
|
24
|
+
0, 1,
|
|
25
|
+
1, 1,
|
|
26
|
+
1, 0
|
|
27
|
+
]);
|
|
28
|
+
const normals = new Float32Array([
|
|
29
|
+
0, 0, 1,
|
|
30
|
+
0, 0, 1,
|
|
31
|
+
0, 0, 1,
|
|
32
|
+
0, 0, 1,
|
|
33
|
+
]);
|
|
34
|
+
return { vertices, indices, uvs, normals };
|
|
35
|
+
}
|
|
36
|
+
function defaultMesh() {
|
|
37
|
+
return {
|
|
38
|
+
indices: new Uint16Array(0),
|
|
39
|
+
vertices: new Float32Array(0),
|
|
40
|
+
normals: new Float32Array(0),
|
|
41
|
+
uvs: new Float32Array(0)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function cylindrical(info) {
|
|
45
|
+
return generalConical(info, 2, false, 0, 0, 0, vec2.create(), info.trainedWidth / info.trainedHeight);
|
|
46
|
+
}
|
|
47
|
+
function conical(info) {
|
|
48
|
+
const radius_diff = info.topRadius - info.bottomRadius;
|
|
49
|
+
const height_3d = Math.sqrt(info.sideLength * info.sideLength - radius_diff * radius_diff);
|
|
50
|
+
const flip = info.bottomRadius > info.topRadius;
|
|
51
|
+
let aspect_ratio = info.trainedWidth / info.trainedHeight;
|
|
52
|
+
if (isNaN(aspect_ratio))
|
|
53
|
+
aspect_ratio = 1;
|
|
54
|
+
const cone = !(info.bottomRadius > 0) || !(info.topRadius > 0);
|
|
55
|
+
const wide = info.sideLength < (2 * Math.abs(info.topRadius - info.bottomRadius));
|
|
56
|
+
const top_corner = vec2.create();
|
|
57
|
+
const bottom_corner = vec2.create();
|
|
58
|
+
const rotation_center = vec2.create();
|
|
59
|
+
if (cone) {
|
|
60
|
+
if (wide) {
|
|
61
|
+
if (flip) {
|
|
62
|
+
rotation_center[1] = aspect_ratio - 1;
|
|
63
|
+
const omega = Math.acos((2 - aspect_ratio) / aspect_ratio);
|
|
64
|
+
top_corner[0] = aspect_ratio * Math.sin(omega);
|
|
65
|
+
top_corner[1] = (aspect_ratio - 1) + aspect_ratio * Math.cos(omega);
|
|
66
|
+
vec2.copy(bottom_corner, rotation_center);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
rotation_center[1] = 1.0 - aspect_ratio;
|
|
70
|
+
const omega = Math.PI + Math.acos((2 - aspect_ratio) / aspect_ratio);
|
|
71
|
+
top_corner[0] = aspect_ratio * Math.sin(omega);
|
|
72
|
+
top_corner[1] = (1 - aspect_ratio) + aspect_ratio * Math.cos(omega);
|
|
73
|
+
vec2.copy(bottom_corner, rotation_center);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
if (flip) {
|
|
78
|
+
rotation_center[1] = 1;
|
|
79
|
+
vec2.copy(bottom_corner, rotation_center);
|
|
80
|
+
top_corner[0] = aspect_ratio;
|
|
81
|
+
top_corner[1] = 1 - Math.sqrt(4 - Math.pow(aspect_ratio, 2));
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
rotation_center[1] = -1;
|
|
85
|
+
vec2.copy(bottom_corner, rotation_center);
|
|
86
|
+
top_corner[0] = -aspect_ratio;
|
|
87
|
+
top_corner[1] = Math.sqrt(4 - Math.pow(aspect_ratio, 2)) - 1;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
if (wide) {
|
|
93
|
+
if (flip) {
|
|
94
|
+
rotation_center[1] = aspect_ratio - 1;
|
|
95
|
+
const omega = Math.acos((2 - aspect_ratio) / aspect_ratio);
|
|
96
|
+
top_corner[0] = aspect_ratio * Math.sin(omega);
|
|
97
|
+
top_corner[1] = (aspect_ratio - 1) + aspect_ratio * Math.cos(omega);
|
|
98
|
+
bottom_corner[0] = (aspect_ratio - info.sideLength) * Math.sin(omega);
|
|
99
|
+
bottom_corner[1] = (aspect_ratio - 1) + (aspect_ratio - info.sideLength) * Math.cos(omega);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
rotation_center[1] = 1.0 - aspect_ratio;
|
|
103
|
+
const omega = Math.PI + Math.acos((2 - aspect_ratio) / aspect_ratio);
|
|
104
|
+
top_corner[0] = aspect_ratio * Math.sin(omega);
|
|
105
|
+
top_corner[1] = (1 - aspect_ratio) + aspect_ratio * Math.cos(omega);
|
|
106
|
+
bottom_corner[0] = (aspect_ratio - info.sideLength) * Math.sin(omega);
|
|
107
|
+
bottom_corner[1] = (1 - aspect_ratio) + (aspect_ratio - info.sideLength) * Math.cos(omega);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
const radius_ratio = flip ? (info.topRadius / info.bottomRadius) : (info.bottomRadius / info.topRadius);
|
|
112
|
+
if (flip) {
|
|
113
|
+
bottom_corner[0] = radius_ratio * aspect_ratio;
|
|
114
|
+
bottom_corner[1] = 1;
|
|
115
|
+
top_corner[0] = aspect_ratio;
|
|
116
|
+
top_corner[1] = 1 - Math.sqrt((info.sideLength * info.sideLength) - ((bottom_corner[0] - top_corner[0]) * (bottom_corner[0] - top_corner[0])));
|
|
117
|
+
rotation_center[1] = top_corner[1] + (top_corner[0] / (top_corner[0] - bottom_corner[0])) * (bottom_corner[1] - top_corner[1]);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
bottom_corner[0] = -radius_ratio * aspect_ratio;
|
|
121
|
+
bottom_corner[1] = -1;
|
|
122
|
+
top_corner[0] = -aspect_ratio;
|
|
123
|
+
top_corner[1] = Math.sqrt((info.sideLength * info.sideLength) - ((bottom_corner[0] - top_corner[0]) * (bottom_corner[0] - top_corner[0]))) - 1;
|
|
124
|
+
rotation_center[1] = top_corner[1] - (-top_corner[0] / (bottom_corner[0] - top_corner[0])) * (top_corner[1] - bottom_corner[1]);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const top_from_center = vec2.create();
|
|
129
|
+
vec2.subtract(top_from_center, top_corner, rotation_center);
|
|
130
|
+
const bottom_from_center = vec2.create();
|
|
131
|
+
vec2.subtract(bottom_from_center, bottom_corner, rotation_center);
|
|
132
|
+
const top_2d_radius = vec2.length(top_from_center);
|
|
133
|
+
const bottom_2d_radius = vec2.length(bottom_from_center);
|
|
134
|
+
let theta = Math.abs(Math.atan(top_from_center[0] / top_from_center[1]));
|
|
135
|
+
if (wide)
|
|
136
|
+
theta = Math.PI - theta;
|
|
137
|
+
return generalConical(info, height_3d, flip, theta, bottom_2d_radius, top_2d_radius, rotation_center, aspect_ratio);
|
|
138
|
+
}
|
|
139
|
+
function generalConical(info, height_3d, flip, theta, bottom_2d_radius, top_2d_radius, rotation_center, aspect_ratio) {
|
|
140
|
+
if (isNaN(aspect_ratio))
|
|
141
|
+
aspect_ratio = 1;
|
|
142
|
+
const vertices = [];
|
|
143
|
+
const uvs = [];
|
|
144
|
+
const scale_factor = 2.0 / height_3d;
|
|
145
|
+
const subdivisons = 64;
|
|
146
|
+
for (let s = 0; s <= subdivisons; ++s) {
|
|
147
|
+
const angle = s * 2.0 * Math.PI / subdivisons;
|
|
148
|
+
const bx = info.bottomRadius * Math.sin(angle) * scale_factor;
|
|
149
|
+
const bz = info.bottomRadius * Math.cos(angle) * scale_factor;
|
|
150
|
+
const tx = info.topRadius * Math.sin(angle) * scale_factor;
|
|
151
|
+
const tz = info.topRadius * Math.cos(angle) * scale_factor;
|
|
152
|
+
const btm = -1;
|
|
153
|
+
const top = 1;
|
|
154
|
+
if (flip) {
|
|
155
|
+
vertices.push(bx, btm, bz);
|
|
156
|
+
vertices.push(tx, top, tz);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
vertices.push(tx, top, -tz);
|
|
160
|
+
vertices.push(bx, btm, -bz);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
for (let s = 0; s <= subdivisons; ++s) {
|
|
164
|
+
if (info.type == image_target_type_t.IMAGE_TRACKER_TYPE_CYLINDRICAL) {
|
|
165
|
+
const offset = 1 - (s / subdivisons);
|
|
166
|
+
uvs.push(offset, 1);
|
|
167
|
+
uvs.push(offset, 0);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
let angle_2d = -((s / subdivisons) - 0.5) * 2 * theta;
|
|
171
|
+
if (flip) {
|
|
172
|
+
angle_2d = -angle_2d + theta;
|
|
173
|
+
if (angle_2d > theta)
|
|
174
|
+
angle_2d = -theta + (angle_2d - theta);
|
|
175
|
+
}
|
|
176
|
+
const direction = vec2.create();
|
|
177
|
+
direction[0] = Math.sin(angle_2d);
|
|
178
|
+
direction[1] = Math.cos(angle_2d);
|
|
179
|
+
if (flip)
|
|
180
|
+
direction[1] *= -1;
|
|
181
|
+
const bottom_px = vec2.create();
|
|
182
|
+
vec2.copy(bottom_px, direction);
|
|
183
|
+
vec2.scale(bottom_px, bottom_px, bottom_2d_radius);
|
|
184
|
+
vec2.add(bottom_px, rotation_center, bottom_px);
|
|
185
|
+
const top_px = vec2.create();
|
|
186
|
+
vec2.copy(top_px, direction);
|
|
187
|
+
vec2.scale(top_px, top_px, top_2d_radius);
|
|
188
|
+
vec2.add(top_px, rotation_center, top_px);
|
|
189
|
+
uvs.push((top_px[0] + aspect_ratio) / (2 * aspect_ratio), 1 - ((-top_px[1] + 1) / 2));
|
|
190
|
+
uvs.push((bottom_px[0] + aspect_ratio) / (2 * aspect_ratio), 1 - ((-bottom_px[1] + 1) / 2));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const indices = [];
|
|
194
|
+
for (let i = 0; i < subdivisons; ++i) {
|
|
195
|
+
const bi = i * 2;
|
|
196
|
+
indices.push(bi + 1, bi + 2, bi + 3);
|
|
197
|
+
indices.push(bi + 0, bi + 2, bi + 1);
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
vertices: new Float32Array(vertices),
|
|
201
|
+
indices: new Uint16Array(indices),
|
|
202
|
+
normals: new Float32Array(0),
|
|
203
|
+
uvs: new Float32Array(uvs)
|
|
204
|
+
};
|
|
205
|
+
}
|
package/lib/imagetracker.d.ts
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import { zappar_image_tracker_t, zappar_pipeline_t } from "./gen/zappar";
|
|
2
|
-
import { zappar_cwrap } from "./gen/zappar-native";
|
|
2
|
+
import { image_target_type_t, zappar_cwrap } from "./gen/zappar-native";
|
|
3
3
|
interface PreviewInfo {
|
|
4
4
|
compressed: Uint8Array;
|
|
5
5
|
mimeType: string;
|
|
6
|
+
image?: HTMLImageElement;
|
|
6
7
|
}
|
|
7
|
-
interface
|
|
8
|
+
export interface PreviewMesh {
|
|
9
|
+
indices: Uint16Array;
|
|
10
|
+
vertices: Float32Array;
|
|
11
|
+
normals: Float32Array;
|
|
12
|
+
uvs: Float32Array;
|
|
13
|
+
}
|
|
14
|
+
export interface ParsedTargetInfo {
|
|
8
15
|
preview?: PreviewInfo;
|
|
16
|
+
previewMesh?: PreviewMesh;
|
|
9
17
|
physicalScaleFactor: number;
|
|
10
18
|
topRadius: number;
|
|
11
19
|
bottomRadius: number;
|
|
12
20
|
sideLength: number;
|
|
21
|
+
type: image_target_type_t;
|
|
22
|
+
trainedWidth: number;
|
|
23
|
+
trainedHeight: number;
|
|
13
24
|
}
|
|
14
25
|
export declare class ImageTracker {
|
|
15
26
|
private _client;
|
|
@@ -23,6 +34,9 @@ export declare class ImageTracker {
|
|
|
23
34
|
targetCount(): number;
|
|
24
35
|
getTargetInfo(i: number): ParsedTargetInfo;
|
|
25
36
|
private _parseOdle;
|
|
37
|
+
private _parseOdleV1;
|
|
38
|
+
private _parseOdleV3;
|
|
26
39
|
getDecodedPreview(i: number): HTMLImageElement | undefined;
|
|
40
|
+
getPreviewMesh(i: number): PreviewMesh;
|
|
27
41
|
}
|
|
28
42
|
export {};
|
package/lib/imagetracker.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { image_target_type_t } from "./gen/zappar-native";
|
|
2
|
+
import { getPreviewMesh } from "./imagetracker-previewmesh";
|
|
1
3
|
import { RiffReader } from "./riff-reader";
|
|
2
4
|
let byId = new Map();
|
|
3
5
|
const decoder = new TextDecoder();
|
|
@@ -34,7 +36,10 @@ export class ImageTracker {
|
|
|
34
36
|
topRadius: -1,
|
|
35
37
|
bottomRadius: -1,
|
|
36
38
|
sideLength: -1,
|
|
37
|
-
physicalScaleFactor: -1
|
|
39
|
+
physicalScaleFactor: -1,
|
|
40
|
+
trainedWidth: 0,
|
|
41
|
+
trainedHeight: 0,
|
|
42
|
+
type: image_target_type_t.IMAGE_TRACKER_TYPE_PLANAR
|
|
38
43
|
};
|
|
39
44
|
try {
|
|
40
45
|
const reader = new RiffReader(current.data, false);
|
|
@@ -59,54 +64,90 @@ export class ImageTracker {
|
|
|
59
64
|
let currentOffset = 0;
|
|
60
65
|
let version = "0";
|
|
61
66
|
[version, currentOffset] = readLine(currentOffset, data);
|
|
62
|
-
if (version === "
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
67
|
+
if (version === "1")
|
|
68
|
+
return this._parseOdleV1(data, currentOffset, info);
|
|
69
|
+
else if (version === "3")
|
|
70
|
+
return this._parseOdleV3(data, currentOffset, info);
|
|
71
|
+
}
|
|
72
|
+
_parseOdleV1(data, currentOffset, info) {
|
|
73
|
+
let treeOrFlat = "0";
|
|
74
|
+
[treeOrFlat, currentOffset] = readLine(currentOffset, data);
|
|
75
|
+
if (treeOrFlat !== "0" && treeOrFlat !== "1")
|
|
76
|
+
return;
|
|
77
|
+
let emptyLine = "";
|
|
78
|
+
[emptyLine, currentOffset] = readLine(currentOffset, data);
|
|
79
|
+
if (emptyLine.length !== 0)
|
|
80
|
+
return;
|
|
81
|
+
let infoLine = "";
|
|
82
|
+
[infoLine, currentOffset] = readLine(currentOffset, data);
|
|
83
|
+
const infoLineParts = infoLine.split(" ");
|
|
84
|
+
if (infoLineParts.length < 5)
|
|
85
|
+
return;
|
|
86
|
+
info.trainedWidth = parseInt(infoLineParts[3].replace("[", ""));
|
|
87
|
+
info.trainedHeight = parseInt(infoLineParts[4].replace("]", ""));
|
|
88
|
+
}
|
|
89
|
+
_parseOdleV3(data, currentOffset, info) {
|
|
90
|
+
let treeOrFlat = "0";
|
|
91
|
+
[treeOrFlat, currentOffset] = readLine(currentOffset, data);
|
|
92
|
+
if (treeOrFlat !== "0" && treeOrFlat !== "1")
|
|
93
|
+
return;
|
|
94
|
+
let numberTargets = "0";
|
|
95
|
+
[numberTargets, currentOffset] = readLine(currentOffset, data);
|
|
96
|
+
const parsedTargets = parseInt(numberTargets);
|
|
97
|
+
if (isNaN(parsedTargets) || parsedTargets < 1)
|
|
98
|
+
return;
|
|
99
|
+
let emptyLine = "";
|
|
100
|
+
[emptyLine, currentOffset] = readLine(currentOffset, data);
|
|
101
|
+
if (emptyLine.length !== 0)
|
|
102
|
+
return;
|
|
103
|
+
let infoLine = "";
|
|
104
|
+
[infoLine, currentOffset] = readLine(currentOffset, data);
|
|
105
|
+
const infoLineParts = infoLine.split(" ");
|
|
106
|
+
if (infoLineParts.length < 6)
|
|
107
|
+
return;
|
|
108
|
+
const targetType = parseInt(infoLineParts[0]);
|
|
109
|
+
if (targetType === 0 || targetType === 1 || targetType === 2)
|
|
110
|
+
info.type = targetType;
|
|
111
|
+
info.trainedWidth = parseInt(infoLineParts[4].replace("[", ""));
|
|
112
|
+
info.trainedHeight = parseInt(infoLineParts[5].replace("]", ""));
|
|
113
|
+
if (infoLineParts.length >= 7) {
|
|
81
114
|
info.physicalScaleFactor = parseFloat(infoLineParts[6]);
|
|
82
115
|
if (isNaN(info.physicalScaleFactor))
|
|
83
116
|
info.physicalScaleFactor = -1;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
info.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
117
|
+
}
|
|
118
|
+
if (infoLineParts.length >= 8) {
|
|
119
|
+
info.topRadius = parseFloat(infoLineParts[7]);
|
|
120
|
+
if (isNaN(info.topRadius))
|
|
121
|
+
info.topRadius = -1;
|
|
122
|
+
info.bottomRadius = info.topRadius;
|
|
123
|
+
}
|
|
124
|
+
if (infoLineParts.length >= 9) {
|
|
125
|
+
info.bottomRadius = parseFloat(infoLineParts[8]);
|
|
126
|
+
if (isNaN(info.bottomRadius))
|
|
127
|
+
info.bottomRadius = -1;
|
|
128
|
+
}
|
|
129
|
+
if (infoLineParts.length >= 10) {
|
|
130
|
+
info.sideLength = parseFloat(infoLineParts[9]);
|
|
131
|
+
if (isNaN(info.sideLength))
|
|
132
|
+
info.sideLength = -1;
|
|
100
133
|
}
|
|
101
134
|
}
|
|
102
135
|
getDecodedPreview(i) {
|
|
103
136
|
const info = this.getTargetInfo(i);
|
|
104
137
|
if (!info.preview)
|
|
105
138
|
return undefined;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
139
|
+
if (!info.preview.image) {
|
|
140
|
+
const blob = new Blob([info.preview.compressed], { type: info.preview.mimeType });
|
|
141
|
+
info.preview.image = new Image();
|
|
142
|
+
info.preview.image.src = URL.createObjectURL(blob);
|
|
143
|
+
}
|
|
144
|
+
return info.preview.image;
|
|
145
|
+
}
|
|
146
|
+
getPreviewMesh(i) {
|
|
147
|
+
const info = this.getTargetInfo(i);
|
|
148
|
+
if (!info.previewMesh)
|
|
149
|
+
info.previewMesh = getPreviewMesh(info);
|
|
150
|
+
return info.previewMesh;
|
|
110
151
|
}
|
|
111
152
|
}
|
|
112
153
|
function readLine(offset, str) {
|
package/lib/native.js
CHANGED
|
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
import { image_target_type_t } from "./gen/zappar";
|
|
10
11
|
import { zappar_client } from "./gen/zappar-client";
|
|
11
12
|
import { drawPlane } from "./drawplane";
|
|
12
13
|
import { cameraRotationForScreenOrientation, projectionMatrix } from "./cameramodel";
|
|
@@ -39,7 +40,7 @@ export function initialize(opts) {
|
|
|
39
40
|
d: ab
|
|
40
41
|
}, [ab]);
|
|
41
42
|
});
|
|
42
|
-
if (window.location.hostname.toLowerCase().indexOf(".zappar.io") > 0) {
|
|
43
|
+
if (window.location.hostname.toLowerCase().indexOf(".zappar.io") > 0 || window.location.hostname.toLowerCase().indexOf(".webar.run") > 0) {
|
|
43
44
|
let pathParts = window.location.pathname.split("/");
|
|
44
45
|
if (pathParts.length > 1 && pathParts[1].length > 0)
|
|
45
46
|
c.impl.analytics_project_id_set(".wiz" + pathParts[1]);
|
|
@@ -165,7 +166,14 @@ export function initialize(opts) {
|
|
|
165
166
|
let rawVec = vec3.create();
|
|
166
167
|
vec3.transformMat4(rawVec, [x, y, z], rotationMat);
|
|
167
168
|
c.impl.instant_world_tracker_anchor_pose_set_from_camera_offset_raw(o, rawVec[0], rawVec[1], rawVec[2], orientation);
|
|
168
|
-
}, image_tracker_create: pipeline => ImageTracker.create(pipeline, c.impl), image_tracker_destroy: t => { var _a; return (_a = ImageTracker.get(t)) === null || _a === void 0 ? void 0 : _a.destroy(); },
|
|
169
|
+
}, image_tracker_create: pipeline => ImageTracker.create(pipeline, c.impl), image_tracker_destroy: t => { var _a; return (_a = ImageTracker.get(t)) === null || _a === void 0 ? void 0 : _a.destroy(); }, image_tracker_target_type: (t, i) => {
|
|
170
|
+
let obj = ImageTracker.get(t);
|
|
171
|
+
if (!obj) {
|
|
172
|
+
zcwarn("attempting to call image_tracker_target_type on a destroyed zappar_image_tracker_t");
|
|
173
|
+
return image_target_type_t.IMAGE_TRACKER_TYPE_PLANAR;
|
|
174
|
+
}
|
|
175
|
+
return obj.getTargetInfo(i).type;
|
|
176
|
+
}, image_tracker_target_count: t => {
|
|
169
177
|
let obj = ImageTracker.get(t);
|
|
170
178
|
if (!obj) {
|
|
171
179
|
zcwarn("attempting to call image_tracker_target_count on a destroyed zappar_image_tracker_t");
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.0-beta.
|
|
1
|
+
export declare const VERSION = "2.0.0-beta.5";
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.0.0-beta.
|
|
1
|
+
export const VERSION = "2.0.0-beta.5";
|
package/lib/zcv.js
CHANGED
|
@@ -18,7 +18,7 @@ function Ea(){var a=la.buffer;Aa=a;e.HEAP8=D=new Int8Array(a);e.HEAP16=Ba=new In
|
|
|
18
18
|
function Oa(){Ka--;e.monitorRunDependencies&&e.monitorRunDependencies(Ka);if(0==Ka&&(null!==La&&(clearInterval(La),La=null),Ma)){var a=Ma;Ma=null;a()}}e.preloadedImages={};e.preloadedAudios={};function x(a){if(e.onAbort)e.onAbort(a);n(a);ma=!0;na=1;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}var Pa="zcv.wasm";
|
|
19
19
|
if(String.prototype.startsWith?!Pa.startsWith("data:application/octet-stream;base64,"):0!==Pa.indexOf("data:application/octet-stream;base64,")){var Qa=Pa;Pa=e.locateFile?e.locateFile(Qa,m):m+Qa}
|
|
20
20
|
function Ra(a){var b=Pa;try{a:{try{if(b==Pa&&ka){var c=new Uint8Array(ka);break a}if(fa){c=fa(b);break a}throw"sync fetching of the wasm failed: you can preload it to Module['wasmBinary'] manually, or emcc.py will do that for you when generating HTML (but not JS)";}catch(g){x(g)}c=void 0}var d=new WebAssembly.Module(c);var f=new WebAssembly.Instance(d,a)}catch(g){throw a=g.toString(),n("failed to compile wasm module: "+a),(0<=a.indexOf("imported Memory")||0<=a.indexOf("memory import"))&&n("Memory size incompatibility issues may be due to changing INITIAL_MEMORY at runtime to something too large. Use ALLOW_MEMORY_GROWTH to allow any size memory (and also make sure not to set INITIAL_MEMORY at runtime to something smaller than it was at compile time)."),
|
|
21
|
-
g;}return[f,d]}var K,M,Sa={
|
|
21
|
+
g;}return[f,d]}var K,M,Sa={489656:function(){if(self.crypto&&self.crypto.getRandomValues){var a=new Uint32Array(1);self.crypto.getRandomValues(a);return a[0]}return 9007199254740991*Math.random()}};function Ta(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.md;"number"===typeof c?void 0===b.Fc?I.get(c)():I.get(c)(b.Fc):c(void 0===b.Fc?null:b.Fc)}}}var Ua;Ua=function(){return performance.now()};
|
|
22
22
|
function Va(a,b){if(0===a)a=Date.now();else if(1===a||4===a)a=Ua();else return G[Wa()>>2]=28,-1;G[b>>2]=a/1E3|0;G[b+4>>2]=a%1E3*1E6|0;return 0}function Xa(a){this.yc=a-16;this.Dd=function(b){G[this.yc+8>>2]=b};this.Ad=function(b){G[this.yc+0>>2]=b};this.Bd=function(){G[this.yc+4>>2]=0};this.zd=function(){D[this.yc+12>>0]=0};this.Cd=function(){D[this.yc+13>>0]=0};this.pd=function(b,c){this.Dd(b);this.Ad(c);this.Bd();this.zd();this.Cd()}}var Za=0;
|
|
23
23
|
function $a(a,b){for(var c=0,d=a.length-1;0<=d;d--){var f=a[d];"."===f?a.splice(d,1):".."===f?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a}function ab(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=$a(a.split("/").filter(function(d){return!!d}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a}
|
|
24
24
|
function bb(a){var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b}function cb(a){if("/"===a)return"/";a=ab(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)}
|
|
@@ -97,24 +97,24 @@ U("/home/web_user");(function(){U("/dev");hb(259,{read:function(){return 0},writ
|
|
|
97
97
|
e.resumeMainLoop=function(){hc++;var a=Zb,b=$b,c=ac;ac=null;gc(c);Yb(a,b);cc()};e.getUserMedia=function(){window.getUserMedia||(window.getUserMedia=navigator.getUserMedia||navigator.mozGetUserMedia);window.getUserMedia(void 0)};e.createContext=function(a,b,c,d){return yc(a,b,c,d)};
|
|
98
98
|
(function(a,b){try{var c=indexedDB.open("emscripten_filesystem",1)}catch(d){b(d);return}c.onupgradeneeded=function(d){d=d.target.result;d.objectStoreNames.contains("FILES")&&d.deleteObjectStore("FILES");d.createObjectStore("FILES")};c.onsuccess=function(d){a(d.target.result)};c.onerror=function(d){b(d)}})(function(a){Qc=a;Oa()},function(){Qc=!1;Oa()});"undefined"!==typeof ENVIRONMENT_IS_FETCH_WORKER&&ENVIRONMENT_IS_FETCH_WORKER||Na();var Cc;
|
|
99
99
|
function jb(a,b){var c=Array(wa(a)+1);a=z(a,c,0,c.length);b&&(c.length=a);return c}
|
|
100
|
-
var ud={
|
|
101
|
-
N||x(g),-g.mc}},
|
|
102
|
-
G[b+a>>2]=M[0];G[b+a+4>>2]=M[1];M=[280*(q+1)>>>0,(K=280*(q+1),1<=+Math.abs(K)?0<K?(Math.min(+Math.floor(K/4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)];G[b+a+8>>2]=M[0];G[b+a+12>>2]=M[1];Ba[b+a+16>>1]=280;D[b+a+18>>0]=t;z(r,A,b+a+19,256);a+=280;q+=1}Ob(d,280*q,0);return a}catch(C){return"undefined"!==typeof V&&C instanceof N||x(C),-C.mc}},
|
|
103
|
-
0:-59;case 21519:if(!d.lc)return-59;var f=Wb();return G[f>>2]=0;case 21520:return d.lc?-28:-59;case 21531:a=f=Wb();if(!d.jc.rd)throw new N(59);return d.jc.rd(d,b,a);case 21523:return d.lc?0:-59;case 21524:return d.lc?0:-59;default:x("bad ioctl syscall "+b)}}catch(g){return"undefined"!==typeof V&&g instanceof N||x(g),-g.mc}},
|
|
104
|
-
f).tc}catch(g){return"undefined"!==typeof V&&g instanceof N||x(g),-g.mc}},
|
|
105
|
-
a+b.release);za("#1",a+b.version);za("wasm32",a+b.machine);return 0}catch(c){return"undefined"!==typeof V&&c instanceof N||x(c),-c.mc}},
|
|
106
|
-
p.message)}b.hc.Nc(b,c);var q=xb(d.parent.id,d.name);if(Q[q]===d)Q[q]=d.wc;else for(var r=Q[q];r;){if(r.wc===d){r.wc=d.wc;break}r=r.wc}try{if(R.onDeletePath)R.onDeletePath(a)}catch(p){n("FS.trackingDelegate['onDeletePath']('"+a+"') threw an exception: "+p.message)}return 0}catch(p){return"undefined"!==typeof V&&p instanceof N||x(p),-p.mc}},
|
|
100
|
+
var ud={I:function(a,b){return Va(a,b)},a:function(a){return ya(a+16)+16},b:function(a,b,c){(new Xa(a)).pd(b,c);Za++;throw a;},e:function(a,b,c){Vb=c;try{var d=Xb(a);switch(b){case 0:var f=Wb();return 0>f?-28:Mb(d.path,d.flags,0,f).tc;case 1:case 2:return 0;case 3:return d.flags;case 4:return f=Wb(),d.flags|=f,0;case 12:return f=Wb(),Ba[f+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return G[Wa()>>2]=28,-1;default:return-28}}catch(g){return"undefined"!==typeof V&&g instanceof
|
|
101
|
+
N||x(g),-g.mc}},K:function(a,b,c){try{var d=Xb(a);if(!d.uc){var f=T(d.path,{Gc:!0}).node;if(!f.hc.Ic)throw new N(54);var g=f.hc.Ic(f);d.uc=g}a=0;for(var k=Ob(d,0,1),q=Math.floor(k/280);q<d.uc.length&&a+280<=c;){var r=d.uc[q];if("."===r[0]){var p=1;var t=4}else{var w=pb(d.node,r);p=w.id;t=8192===(w.mode&61440)?2:16384===(w.mode&61440)?4:40960===(w.mode&61440)?10:8}M=[p>>>0,(K=p,1<=+Math.abs(K)?0<K?(Math.min(+Math.floor(K/4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)];
|
|
102
|
+
G[b+a>>2]=M[0];G[b+a+4>>2]=M[1];M=[280*(q+1)>>>0,(K=280*(q+1),1<=+Math.abs(K)?0<K?(Math.min(+Math.floor(K/4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)];G[b+a+8>>2]=M[0];G[b+a+12>>2]=M[1];Ba[b+a+16>>1]=280;D[b+a+18>>0]=t;z(r,A,b+a+19,256);a+=280;q+=1}Ob(d,280*q,0);return a}catch(C){return"undefined"!==typeof V&&C instanceof N||x(C),-C.mc}},o:function(){return 42},G:function(a,b,c){Vb=c;try{var d=Xb(a);switch(b){case 21509:case 21505:return d.lc?0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return d.lc?
|
|
103
|
+
0:-59;case 21519:if(!d.lc)return-59;var f=Wb();return G[f>>2]=0;case 21520:return d.lc?-28:-59;case 21531:a=f=Wb();if(!d.jc.rd)throw new N(59);return d.jc.rd(d,b,a);case 21523:return d.lc?0:-59;case 21524:return d.lc?0:-59;default:x("bad ioctl syscall "+b)}}catch(g){return"undefined"!==typeof V&&g instanceof N||x(g),-g.mc}},H:function(a,b){try{return a=E(a),Ub(Lb,a,b)}catch(c){return"undefined"!==typeof V&&c instanceof N||x(c),-c.mc}},q:function(a,b,c){Vb=c;try{var d=E(a),f=c?Wb():0;return Mb(d,b,
|
|
104
|
+
f).tc}catch(g){return"undefined"!==typeof V&&g instanceof N||x(g),-g.mc}},J:function(a,b){try{return a=E(a),Ub(Kb,a,b)}catch(c){return"undefined"!==typeof V&&c instanceof N||x(c),-c.mc}},D:function(a,b){try{return a=E(a),b=E(b),Jb(a,b),0}catch(c){return"undefined"!==typeof V&&c instanceof N||x(c),-c.mc}},C:function(a){try{if(!a)return-21;var b={__size__:390,domainname:325,machine:260,nodename:65,release:130,sysname:0,version:195};za("Emscripten",a+b.sysname);za("emscripten",a+b.nodename);za("1.0",
|
|
105
|
+
a+b.release);za("#1",a+b.version);za("wasm32",a+b.machine);return 0}catch(c){return"undefined"!==typeof V&&c instanceof N||x(c),-c.mc}},E:function(a){try{a=E(a);var b=T(a,{parent:!0}).node,c=cb(a),d=pb(b,c);a:{try{var f=pb(b,c)}catch(p){var g=p.mc;break a}var k=yb(b,"wx");g=k?k:16384===(f.mode&61440)?31:0}if(g)throw new N(g);if(!b.hc.Nc)throw new N(63);if(d.Bc)throw new N(10);try{R.willDeletePath&&R.willDeletePath(a)}catch(p){n("FS.trackingDelegate['willDeletePath']('"+a+"') threw an exception: "+
|
|
106
|
+
p.message)}b.hc.Nc(b,c);var q=xb(d.parent.id,d.name);if(Q[q]===d)Q[q]=d.wc;else for(var r=Q[q];r;){if(r.wc===d){r.wc=d.wc;break}r=r.wc}try{if(R.onDeletePath)R.onDeletePath(a)}catch(p){n("FS.trackingDelegate['onDeletePath']('"+a+"') threw an exception: "+p.message)}return 0}catch(p){return"undefined"!==typeof V&&p instanceof N||x(p),-p.mc}},L:function(a){delete Pc[a-1]},c:function(){x()},h:Va,P:function(a,b){return a-b},R:function(){self.postMessage({t:"gfx"})},t:function(){var a=(new URL(location.origin)).hostname;
|
|
107
107
|
0===a.length&&(a=(new URL(location.href.replace("blob:",""))).hostname);if(/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(a))0===a.indexOf("10.")&&(a="10.*"),0===a.indexOf("192.168.")&&(a="192.168.*"),0===a.indexOf("172.")&&(a="172.*"),0===a.indexOf("127.")&&(a="127.*");else{var b=new RegExp("("+String.fromCharCode(92)+".ngrok"+String.fromCharCode(92)+".io)$","i");b.test(a)&&(a="*.ngrok.io");
|
|
108
|
-
b=new RegExp("("+String.fromCharCode(92)+".arweb"+String.fromCharCode(92)+".app)$","i");b.test(a)&&(a="*.arweb.app")}b=wa(a)+1;var c=ya(b);z(a,A,c,b+1);return c},S:function(){self.postMessage({t:"licerr"})},
|
|
109
|
-
A.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0<d%65536&&(d+=65536-d%65536);a:{try{la.grow(Math.min(2147483648,d)-Aa.byteLength+65535>>>16);Ea();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},
|
|
110
|
-
I.get(S)(B):f&&f(B)})}function p(B){X(function(){y?I.get(y)(B):c&&c(B)})}function t(B){X(function(){J?I.get(J)(B):d&&d(B)})}function w(B){X(function(){u?I.get(u)(B):b&&b(B)})}var C=a+112,h=E(C),u=H[C+36>>2],y=H[C+40>>2],J=H[C+44>>2],S=H[C+48>>2],W=H[C+52>>2],Ya=!!(W&4),v=!!(W&32);W=!!(W&16);if("EM_IDB_STORE"===h)h=H[C+84>>2],Tc(a,A.slice(h,h+H[C+88>>2]),w,p);else if("EM_IDB_DELETE"===h)Vc(a,w,p);else if(W){if(v)return 0;Rc(a,Ya?k:w,p,t,r)}else Uc(a,w,v?p:Ya?g:q);return a},
|
|
111
|
-
0;Xc().forEach(function(d,f){var g=b+c;G[a+4*f>>2]=g;za(d,g);c+=d.length+1});return 0}catch(d){return"undefined"!==typeof V&&d instanceof N||x(d),d.mc}},
|
|
112
|
-
null;return 0}catch(c){return"undefined"!==typeof V&&c instanceof N||x(c),c.mc}},
|
|
113
|
-
var u=h;if(0>u){var y=-1;break a}a+=u;if(u<k)break}y=a}G[d>>2]=y;return 0}catch(J){return"undefined"!==typeof V&&J instanceof N||x(J),J.mc}},
|
|
114
|
-
typeof V&&k instanceof N||x(k),k.mc}},
|
|
115
|
-
R.onWriteToFile)R.onWriteToFile(k.path)}catch(y){n("FS.trackingDelegate['onWriteToFile']('"+k.path+"') threw an exception: "+y.message)}var h=C;if(0>h){var u=-1;break a}a+=h}u=a}G[d>>2]=u;return 0}catch(y){return"undefined"!==typeof V&&y instanceof N||x(y),y.mc}},f:function(a){var b=Date.now();G[a>>2]=b/1E3|0;G[a+4>>2]=b%1E3*1E3|0;return 0},
|
|
116
|
-
2]=f}},
|
|
117
|
-
G[b+20>>2]=a.getFullYear()-1900;G[b+24>>2]=a.getDay();var c=new Date(a.getFullYear(),0,1);G[b+28>>2]=(a.getTime()-c.getTime())/864E5|0;G[b+36>>2]=-(60*a.getTimezoneOffset());var d=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();c=c.getTimezoneOffset();a=(d!=c&&a.getTimezoneOffset()==Math.min(c,d))|0;G[b+32>>2]=a;a=G[md()+(a?4:0)>>2];G[b+40>>2]=a;return b},
|
|
108
|
+
b=new RegExp("("+String.fromCharCode(92)+".arweb"+String.fromCharCode(92)+".app)$","i");b.test(a)&&(a="*.arweb.app")}b=wa(a)+1;var c=ya(b);z(a,A,c,b+1);return c},S:function(){self.postMessage({t:"licerr"})},m:function(a,b,c){td.length=0;var d;for(c>>=2;d=A[b++];)(d=105>d)&&c&1&&c++,td.push(d?Da[c++>>1]:G[c]),++c;return Sa[a].apply(null,td)},l:function(a,b,c){function d(){I.get(a)(b)}0<=c?xc(d,c):Mc(d)},x:function(){return 2147483648},N:Oc,v:function(a,b,c){A.copyWithin(a,b,b+c)},w:function(a){var b=
|
|
109
|
+
A.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0<d%65536&&(d+=65536-d%65536);a:{try{la.grow(Math.min(2147483648,d)-Aa.byteLength+65535>>>16);Ea();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},M:function(a,b,c,d,f){function g(B){Rc(B,k,p,t,r)}function k(B,O){Tc(B,O.response,function(L){X(function(){u?I.get(u)(L):b&&b(L)})},function(L){X(function(){u?I.get(u)(L):b&&b(L)})})}function q(B){Rc(B,w,p,t,r)}function r(B){X(function(){S?
|
|
110
|
+
I.get(S)(B):f&&f(B)})}function p(B){X(function(){y?I.get(y)(B):c&&c(B)})}function t(B){X(function(){J?I.get(J)(B):d&&d(B)})}function w(B){X(function(){u?I.get(u)(B):b&&b(B)})}var C=a+112,h=E(C),u=H[C+36>>2],y=H[C+40>>2],J=H[C+44>>2],S=H[C+48>>2],W=H[C+52>>2],Ya=!!(W&4),v=!!(W&32);W=!!(W&16);if("EM_IDB_STORE"===h)h=H[C+84>>2],Tc(a,A.slice(h,h+H[C+88>>2]),w,p);else if("EM_IDB_DELETE"===h)Vc(a,w,p);else if(W){if(v)return 0;Rc(a,Ya?k:w,p,t,r)}else Uc(a,w,v?p:Ya?g:q);return a},A:function(a,b){try{var c=
|
|
111
|
+
0;Xc().forEach(function(d,f){var g=b+c;G[a+4*f>>2]=g;za(d,g);c+=d.length+1});return 0}catch(d){return"undefined"!==typeof V&&d instanceof N||x(d),d.mc}},B:function(a,b){try{var c=Xc();G[a>>2]=c.length;var d=0;c.forEach(function(f){d+=f.length+1});G[b>>2]=d;return 0}catch(f){return"undefined"!==typeof V&&f instanceof N||x(f),f.mc}},O:function(a){ic(a)},g:function(a){try{var b=Xb(a);if(null===b.tc)throw new N(8);b.uc&&(b.uc=null);try{b.jc.close&&b.jc.close(b)}catch(c){throw c;}finally{sb[b.tc]=null}b.tc=
|
|
112
|
+
null;return 0}catch(c){return"undefined"!==typeof V&&c instanceof N||x(c),c.mc}},F:function(a,b,c,d){try{a:{for(var f=Xb(a),g=a=0;g<c;g++){var k=G[b+(8*g+4)>>2],q=f,r=G[b+8*g>>2],p=k,t=void 0,w=D;if(0>p||0>t)throw new N(28);if(null===q.tc)throw new N(8);if(1===(q.flags&2097155))throw new N(8);if(16384===(q.node.mode&61440))throw new N(31);if(!q.jc.read)throw new N(28);var C="undefined"!==typeof t;if(!C)t=q.position;else if(!q.seekable)throw new N(70);var h=q.jc.read(q,w,r,p,t);C||(q.position+=h);
|
|
113
|
+
var u=h;if(0>u){var y=-1;break a}a+=u;if(u<k)break}y=a}G[d>>2]=y;return 0}catch(J){return"undefined"!==typeof V&&J instanceof N||x(J),J.mc}},u:function(a,b,c,d,f){try{var g=Xb(a);a=4294967296*c+(b>>>0);if(-9007199254740992>=a||9007199254740992<=a)return-61;Ob(g,a,d);M=[g.position>>>0,(K=g.position,1<=+Math.abs(K)?0<K?(Math.min(+Math.floor(K/4294967296),4294967295)|0)>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)];G[f>>2]=M[0];G[f+4>>2]=M[1];g.uc&&0===a&&0===d&&(g.uc=null);return 0}catch(k){return"undefined"!==
|
|
114
|
+
typeof V&&k instanceof N||x(k),k.mc}},k:function(a,b,c,d){try{a:{for(var f=Xb(a),g=a=0;g<c;g++){var k=f,q=G[b+8*g>>2],r=G[b+(8*g+4)>>2],p=void 0,t=D;if(0>r||0>p)throw new N(28);if(null===k.tc)throw new N(8);if(0===(k.flags&2097155))throw new N(8);if(16384===(k.node.mode&61440))throw new N(31);if(!k.jc.write)throw new N(28);k.seekable&&k.flags&1024&&Ob(k,0,2);var w="undefined"!==typeof p;if(!w)p=k.position;else if(!k.seekable)throw new N(70);var C=k.jc.write(k,t,q,r,p,void 0);w||(k.position+=C);try{if(k.path&&
|
|
115
|
+
R.onWriteToFile)R.onWriteToFile(k.path)}catch(y){n("FS.trackingDelegate['onWriteToFile']('"+k.path+"') threw an exception: "+y.message)}var h=C;if(0>h){var u=-1;break a}a+=h}u=a}G[d>>2]=u;return 0}catch(y){return"undefined"!==typeof V&&y instanceof N||x(y),y.mc}},f:function(a){var b=Date.now();G[a>>2]=b/1E3|0;G[a+4>>2]=b%1E3*1E3|0;return 0},n:function(a,b){Cc.bindTexture(a,cd[b])},p:function(a,b){for(var c=0;c<a;c++){var d=Cc.createTexture(),f=d&&dd(cd);d?(d.name=f,cd[f]=d):gd||(gd=1282);G[b+4*c>>
|
|
116
|
+
2]=f}},i:function(a,b,c,d,f,g,k,q,r){var p=Cc,t=p.texImage2D;if(r){var w=q-5120;w=1==w?A:4==w?G:6==w?Ca:5==w||28922==w?H:F;var C=31-Math.clz32(w.BYTES_PER_ELEMENT);r=w.subarray(r>>C,r+f*(d*({5:3,6:4,8:2,29502:3,29504:4}[k-6402]||1)*(1<<C)+4-1&-4)>>C)}else r=null;t.call(p,a,b,c,d,f,g,k,q,r)},j:function(a,b,c){Cc.texParameteri(a,b,c)},s:hd,r:function(a,b){id();a=new Date(1E3*G[a>>2]);G[b>>2]=a.getSeconds();G[b+4>>2]=a.getMinutes();G[b+8>>2]=a.getHours();G[b+12>>2]=a.getDate();G[b+16>>2]=a.getMonth();
|
|
117
|
+
G[b+20>>2]=a.getFullYear()-1900;G[b+24>>2]=a.getDay();var c=new Date(a.getFullYear(),0,1);G[b+28>>2]=(a.getTime()-c.getTime())/864E5|0;G[b+36>>2]=-(60*a.getTimezoneOffset());var d=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();c=c.getTimezoneOffset();a=(d!=c&&a.getTimezoneOffset()==Math.min(c,d))|0;G[b+32>>2]=a;a=G[md()+(a?4:0)>>2];G[b+40>>2]=a;return b},Q:function(){return 6},y:function(){return 28},z:function(a,b,c,d){return sd(a,b,c,d)},d:function(a){var b=Date.now()/1E3|0;a&&(G[a>>2]=b);
|
|
118
118
|
return b}},Z=function(){function a(c){e.asm=c.exports;la=e.asm.T;Ea();I=e.asm.Y;Ga.unshift(e.asm.U);Oa()}var b={a:ud};Na();if(e.instantiateWasm)try{return e.instantiateWasm(b,a)}catch(c){return n("Module.instantiateWasm callback failed with error: "+c),!1}b=Ra(b);a(b[0]);return e.asm}();e.___wasm_call_ctors=Z.U;e._zappar_has_initialized=Z.V;e._zappar_invert=Z.W;e._zappar_loaded=Z.X;e._zappar_pipeline_create=Z.Z;e._zappar_pipeline_destroy=Z._;e._zappar_pipeline_camera_frame_submit=Z.$;
|
|
119
119
|
e._zappar_pipeline_camera_frame_submit_raw_pointer=Z.aa;e._zappar_pipeline_frame_update=Z.ba;e._zappar_pipeline_camera_frame_user_data=Z.ca;e._zappar_pipeline_camera_model=Z.da;e._zappar_pipeline_frame_number=Z.ea;e._zappar_pipeline_motion_accelerometer_submit=Z.fa;e._zappar_pipeline_motion_rotation_rate_submit=Z.ga;e._zappar_pipeline_motion_attitude_submit=Z.ha;e._zappar_pipeline_motion_attitude_matrix_submit=Z.ia;e._zappar_pipeline_camera_frame_user_facing=Z.ja;
|
|
120
120
|
e._zappar_pipeline_camera_frame_texture_matrix=Z.ka;e._zappar_pipeline_camera_pose_with_attitude=Z.la;e._zappar_pipeline_camera_pose_with_origin=Z.ma;e._zappar_pipeline_camera_frame_camera_attitude=Z.na;e._zappar_pipeline_camera_frame_device_attitude=Z.oa;e._zappar_pipeline_camera_frame_texture_gl=Z.pa;e._zappar_pipeline_camera_frame_upload_gl=Z.qa;e._zappar_pipeline_sequence_record_start=Z.ra;e._zappar_pipeline_sequence_record_stop=Z.sa;e._zappar_pipeline_sequence_record_clear=Z.ta;
|
package/lib/zcv.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED