@zappar/zappar-cv 0.4.0-beta.4 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +91 -34
- package/README.md +2 -2
- package/lib/additional.d.ts +2 -1
- package/lib/additional.js +1 -2
- package/lib/camera-source-map.d.ts +10 -0
- package/lib/camera-source-map.js +32 -0
- package/lib/camera-source.d.ts +2 -5
- package/lib/camera-source.js +18 -32
- package/lib/cameramodel.js +18 -23
- package/lib/compatibility.js +2 -4
- package/lib/deserializer.js +1 -5
- package/lib/direct.js +12 -16
- package/lib/drawcamera.js +27 -31
- package/lib/drawface.js +5 -9
- package/lib/drawfaceproject.js +5 -9
- package/lib/drawplane.js +6 -11
- package/lib/event.js +5 -13
- package/lib/facelandmark.d.ts +1 -2
- package/lib/facelandmark.js +11 -18
- package/lib/facelandmarkdata.js +1 -4
- package/lib/facelandmarkinterface.js +1 -2
- package/lib/facemesh.js +10 -17
- package/lib/gen/zappar-client.js +11 -25
- package/lib/gen/zappar-cwrap.js +38 -33
- package/lib/gen/zappar-native.d.ts +11 -1
- package/lib/gen/zappar-native.js +20 -11
- package/lib/gen/zappar-server.js +6 -14
- package/lib/gen/zappar.d.ts +12 -0
- package/lib/gen/zappar.js +5 -11
- package/lib/gfx.d.ts +1 -0
- package/lib/gfx.js +1 -0
- package/lib/gl-state-manager.d.ts +9 -0
- package/lib/gl-state-manager.js +31 -0
- package/lib/html-element-source.d.ts +3 -20
- package/lib/html-element-source.js +39 -287
- package/lib/image-process-gl.d.ts +37 -0
- package/lib/image-process-gl.js +306 -0
- package/lib/imagebitmap-camera-source.d.ts +36 -0
- package/lib/imagebitmap-camera-source.js +273 -0
- package/lib/imagetracker.d.ts +28 -0
- package/lib/imagetracker.js +115 -0
- package/lib/index-standalone.d.ts +3 -0
- package/lib/index-standalone.js +5 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -27
- package/lib/landmarkdatagenerate.js +25 -30
- package/lib/loglevel.js +9 -16
- package/lib/messages.js +4 -8
- package/lib/mstp-camera-source.d.ts +29 -0
- package/lib/mstp-camera-source.js +226 -0
- package/lib/native.d.ts +2 -1
- package/lib/native.js +229 -130
- package/lib/options.d.ts +3 -0
- package/lib/options.js +1 -0
- package/lib/permission.js +13 -27
- package/lib/pipeline.d.ts +14 -5
- package/lib/pipeline.js +125 -61
- package/lib/profile.d.ts +2 -0
- package/lib/profile.js +59 -53
- package/lib/riff-reader.d.ts +18 -0
- package/lib/riff-reader.js +52 -0
- package/lib/sequencerecorder.d.ts +1 -0
- package/lib/sequencerecorder.js +17 -11
- package/lib/sequencesource.d.ts +7 -1
- package/lib/sequencesource.js +102 -64
- package/lib/serializer.js +1 -5
- package/lib/shader.js +2 -7
- package/lib/source.d.ts +6 -4
- package/lib/source.js +1 -5
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -4
- package/lib/worker-client.d.ts +1 -1
- package/lib/worker-client.js +9 -26
- package/lib/worker-imagebitmap.d.ts +5 -0
- package/lib/worker-imagebitmap.js +59 -0
- package/lib/worker-server.d.ts +0 -5
- package/lib/worker-server.js +133 -41
- package/lib/worker.js +6 -10
- package/lib/workerinterface.d.ts +47 -1
- package/lib/workerinterface.js +1 -2
- package/lib/zcv.js +117 -135
- package/lib/zcv.wasm +0 -0
- package/package.json +33 -32
- package/umd/169.zappar-cv.js +1 -0
- package/umd/{482727c0e7dd40d73f5aae47f238ad61.zbin → 482727c0e7dd40d73f5a.zbin} +0 -0
- package/umd/6a8309f88f836a752c68.wasm +0 -0
- package/umd/752.zappar-cv.js +1 -0
- package/umd/{b4f46e148a3b3b5aef90717d8d60e3fc.zbin → b4f46e148a3b3b5aef90.zbin} +0 -0
- package/umd/{f7b62a3a53b5c9b3222ba8dc53cb8b11.zbin → f7b62a3a53b5c9b3222b.zbin} +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 -6
- package/lib/bundleworker-worker.js +0 -34
- package/lib/zcv-slam.js +0 -16
- package/lib/zcv-slam.wasm +0 -0
- package/umd/1ec038c18c27f4adf35917a8175401f0.wasm +0 -0
- package/umd/9c0b0dcf514b48c05541.bundleworker.js +0 -1
- package/umd/d115e485cffe500afc4f7c1272ea8f62.wasm +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,130 +1,187 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.16] - 2021-02-07
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- External WebGL state is preserved during `process_gl` calls
|
|
8
|
+
|
|
9
|
+
## [0.3.15] - 2021-01-25
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Issues on iPad Pro
|
|
14
|
+
|
|
15
|
+
## [0.3.14] - 2021-10-25
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Pinned dependencies to exact versions
|
|
20
|
+
|
|
21
|
+
## [0.3.13] - 2021-10-11
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- A broken licencing url.
|
|
26
|
+
|
|
27
|
+
## [0.3.12] - 2021-09-28
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- Safari logo not appearing on incompatible browser screen
|
|
32
|
+
- Issues with iPad devices
|
|
33
|
+
|
|
34
|
+
## [0.3.11] - 2021-09-17
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- Issues with other browsers on iOS, including social browsers
|
|
39
|
+
|
|
40
|
+
## [0.3.10] - 2021-09-17
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
- loaded() function which returns true once the library is fully loaded and available for use
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- Bucket 172.* IP address range into one license check.
|
|
48
|
+
|
|
3
49
|
## [0.3.9] - 2021-04-22
|
|
50
|
+
|
|
4
51
|
### Added
|
|
5
|
-
|
|
52
|
+
|
|
53
|
+
- `projection_matrix_from_camera_model_ext` that exposes near and far clipping planes.
|
|
6
54
|
|
|
7
55
|
## [0.3.8] - 2021-02-18
|
|
8
56
|
|
|
9
57
|
### Added
|
|
10
|
-
|
|
11
|
-
|
|
58
|
+
|
|
59
|
+
- pipeline_gl_context_lost to indicate that the GL context is lost
|
|
60
|
+
- log_level and log_level_set to customize volume of log output
|
|
12
61
|
|
|
13
62
|
### Changed
|
|
14
|
-
|
|
63
|
+
|
|
64
|
+
- License checks now only happen on first pipeline construction
|
|
15
65
|
|
|
16
66
|
### Fixed
|
|
17
|
-
- pipeline_gl_context_set correctly handles multiple invocations
|
|
18
67
|
|
|
68
|
+
- pipeline_gl_context_set correctly handles multiple invocations
|
|
19
69
|
|
|
20
70
|
## [0.3.7] - 2021-02-03
|
|
21
71
|
|
|
22
72
|
### Fixed
|
|
23
|
-
|
|
24
|
-
|
|
73
|
+
|
|
74
|
+
- Issues on Chrome for iOS
|
|
75
|
+
- NPM audit dependency updates
|
|
25
76
|
|
|
26
77
|
## [0.3.6] - 2021-01-18
|
|
27
78
|
|
|
28
79
|
### Fixed
|
|
29
|
-
- Issue where wasm would not load on some webpack versions
|
|
30
80
|
|
|
81
|
+
- Issue where wasm would not load on some webpack versions
|
|
31
82
|
|
|
32
83
|
## [0.3.5] - 2020-11-26
|
|
33
84
|
|
|
34
85
|
### Added
|
|
35
|
-
|
|
36
|
-
|
|
86
|
+
|
|
87
|
+
- This changelog :-)
|
|
88
|
+
- Console log the version when the library is initialized
|
|
37
89
|
|
|
38
90
|
### Fixed
|
|
39
|
-
|
|
40
|
-
|
|
91
|
+
|
|
92
|
+
- Prevent flickering when there are no new camera frames
|
|
93
|
+
- Fixed building with recent versions of `worker-loader`
|
|
41
94
|
|
|
42
95
|
### Changed
|
|
43
|
-
- Dependencies update
|
|
44
|
-
- Remove unnecessary console logging
|
|
45
96
|
|
|
97
|
+
- Dependencies update
|
|
98
|
+
- Remove unnecessary console logging
|
|
46
99
|
|
|
47
100
|
## [0.3.4] - 2020-11-18
|
|
48
101
|
|
|
49
102
|
### Fixed
|
|
50
|
-
- Ensure internal GL usage correctly sets the expected active texture
|
|
51
103
|
|
|
104
|
+
- Ensure internal GL usage correctly sets the expected active texture
|
|
52
105
|
|
|
53
106
|
## [0.3.3] - 2020-11-04
|
|
54
107
|
|
|
55
108
|
### Added
|
|
56
|
-
|
|
109
|
+
|
|
110
|
+
- Browser compatibility API and UI
|
|
57
111
|
|
|
58
112
|
### Changed
|
|
59
|
-
- Modifications to browser compatibility API
|
|
60
113
|
|
|
114
|
+
- Modifications to browser compatibility API
|
|
61
115
|
|
|
62
116
|
## [0.3.2] - 2020-11-04
|
|
63
117
|
|
|
64
118
|
### Added
|
|
65
|
-
|
|
119
|
+
|
|
120
|
+
- Browser compatibility API and UI
|
|
66
121
|
|
|
67
122
|
### Fixed
|
|
68
|
-
- Support for Firefox
|
|
69
123
|
|
|
124
|
+
- Support for Firefox
|
|
70
125
|
|
|
71
126
|
## [0.3.1] - 2020-11-03
|
|
72
127
|
|
|
73
128
|
### Fixed
|
|
74
|
-
- Various enums are now available as objects
|
|
75
|
-
- Removed unnecessary TypeScript files included in deployment
|
|
76
129
|
|
|
130
|
+
- Various enums are now available as objects
|
|
131
|
+
- Removed unnecessary TypeScript files included in deployment
|
|
77
132
|
|
|
78
133
|
## [0.3.0] - 2020-11-02
|
|
79
134
|
|
|
80
135
|
### Added
|
|
81
|
-
|
|
82
|
-
|
|
136
|
+
|
|
137
|
+
- Support for face landmarks
|
|
138
|
+
- Greatly improved face tracking model
|
|
83
139
|
|
|
84
140
|
### Fixed
|
|
85
|
-
|
|
141
|
+
|
|
142
|
+
- Fixes to iPad support
|
|
86
143
|
|
|
87
144
|
### Changed
|
|
88
|
-
- Dependencies update
|
|
89
145
|
|
|
146
|
+
- Dependencies update
|
|
90
147
|
|
|
91
148
|
## [0.2.12] - 2020-10-19
|
|
92
149
|
|
|
93
150
|
### Fixed
|
|
94
|
-
|
|
151
|
+
|
|
152
|
+
- Fixes to iPad support
|
|
95
153
|
|
|
96
154
|
### Changed
|
|
97
|
-
- Dependencies update
|
|
98
155
|
|
|
156
|
+
- Dependencies update
|
|
99
157
|
|
|
100
158
|
## [0.2.11] - 2020-09-15
|
|
101
159
|
|
|
102
160
|
### Fixed
|
|
103
|
-
|
|
161
|
+
|
|
162
|
+
- Fix issues with iOS 14
|
|
104
163
|
|
|
105
164
|
### Changed
|
|
106
|
-
- Dependencies update
|
|
107
165
|
|
|
166
|
+
- Dependencies update
|
|
108
167
|
|
|
109
168
|
## [0.2.9] - 2020-07-08
|
|
110
169
|
|
|
111
170
|
### Fixed
|
|
112
|
-
- Tweaks to computer vision algorithms
|
|
113
171
|
|
|
172
|
+
- Tweaks to computer vision algorithms
|
|
114
173
|
|
|
115
174
|
## [0.2.6] - 2020-06-09
|
|
116
175
|
|
|
117
176
|
### Added
|
|
118
|
-
- Support for full head meshes
|
|
119
|
-
|
|
120
177
|
|
|
178
|
+
- Support for full head meshes
|
|
121
179
|
|
|
122
180
|
## [0.2.4] - 2020-06-02
|
|
123
181
|
|
|
124
182
|
### Added
|
|
125
|
-
- Support for NGROK
|
|
126
|
-
|
|
127
183
|
|
|
184
|
+
- Support for NGROK
|
|
128
185
|
|
|
129
186
|
## [0.2.3] - 2020-05-26
|
|
130
187
|
|
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/0.
|
|
21
|
+
<script src="https://libs.zappar.com/zappar-cv/2.0.0-beta.0/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/0.
|
|
25
|
+
[https://libs.zappar.com/zappar-cv/2.0.0-beta.0/zappar-cv.zip](https://libs.zappar.com/zappar-cv/2.0.0-beta.0/zappar-cv.zip)
|
package/lib/additional.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { zappar_face_mesh_t, zappar_face_tracker_t, zappar_pipeline_t } from "./gen/zappar";
|
|
1
|
+
import { zappar_face_mesh_t, zappar_face_tracker_t, zappar_pipeline_t, zappar_image_tracker_t } from "./gen/zappar";
|
|
2
2
|
export declare type zappar_html_element_source_t = number & {
|
|
3
3
|
_: 'zappar_html_element_source_t';
|
|
4
4
|
};
|
|
@@ -8,6 +8,7 @@ export interface Additional {
|
|
|
8
8
|
pipeline_draw_face(pipeline: zappar_pipeline_t, projectionMatrix: Float32Array, cameraMatrix: Float32Array, targetMatrix: Float32Array, o: zappar_face_mesh_t): void;
|
|
9
9
|
pipeline_draw_face_project(pipeline: zappar_pipeline_t, drawwMatrix: Float32Array, vertices: Float32Array, uvMatrix: Float32Array, uvs: Float32Array, indices: Uint16Array, texture: WebGLTexture): void;
|
|
10
10
|
draw_plane(gl: WebGLRenderingContext, projectionMatrix: Float32Array, cameraMatrix: Float32Array, targetMatrix: Float32Array, texture: string): void;
|
|
11
|
+
image_tracker_target_image(o: zappar_image_tracker_t, indx: number): HTMLImageElement | undefined;
|
|
11
12
|
face_mesh_load_default(o: zappar_face_mesh_t): Promise<void>;
|
|
12
13
|
face_mesh_load_default_face(o: zappar_face_mesh_t, fillMouth: boolean, fillEyeL: boolean, fillEyeR: boolean): Promise<void>;
|
|
13
14
|
face_mesh_load_default_full_head_simplified(o: zappar_face_mesh_t, fillMouth: boolean, fillEyeL: boolean, fillEyeR: boolean, fillNeck: boolean): Promise<void>;
|
package/lib/additional.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CameraSource } from "./camera-source";
|
|
2
|
+
import { zappar_camera_source_t, zappar_pipeline_t } from "./gen/zappar";
|
|
3
|
+
import { ImageBitmapCameraSource } from "./imagebitmap-camera-source";
|
|
4
|
+
import { MSTPCameraSource } from "./mstp-camera-source";
|
|
5
|
+
export declare type CameraSourceType = CameraSource | MSTPCameraSource | ImageBitmapCameraSource;
|
|
6
|
+
export declare function getNextCameraSourceId(): zappar_camera_source_t;
|
|
7
|
+
export declare function setCameraSourceId(id: zappar_camera_source_t, c: CameraSourceType): void;
|
|
8
|
+
export declare function getCameraSource(id: zappar_camera_source_t): CameraSourceType | undefined;
|
|
9
|
+
export declare function deleteCameraSource(id: zappar_camera_source_t): void;
|
|
10
|
+
export declare function createCameraSource(p: zappar_pipeline_t, deviceId: string): zappar_camera_source_t;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CameraSource } from "./camera-source";
|
|
2
|
+
import { ImageBitmapCameraSource } from "./imagebitmap-camera-source";
|
|
3
|
+
import { zcout } from "./loglevel";
|
|
4
|
+
import { MSTPCameraSource } from "./mstp-camera-source";
|
|
5
|
+
import { profile } from "./profile";
|
|
6
|
+
let latest = 1;
|
|
7
|
+
let byId = new Map();
|
|
8
|
+
export function getNextCameraSourceId() {
|
|
9
|
+
return (latest++);
|
|
10
|
+
}
|
|
11
|
+
export function setCameraSourceId(id, c) {
|
|
12
|
+
byId.set(id, c);
|
|
13
|
+
}
|
|
14
|
+
export function getCameraSource(id) {
|
|
15
|
+
return byId.get(id);
|
|
16
|
+
}
|
|
17
|
+
export function deleteCameraSource(id) {
|
|
18
|
+
byId.delete(id);
|
|
19
|
+
}
|
|
20
|
+
export function createCameraSource(p, deviceId) {
|
|
21
|
+
let ret = getNextCameraSourceId();
|
|
22
|
+
if (profile.preferMediaStreamTrackProcessorCamera &&
|
|
23
|
+
'MediaStreamTrackProcessor' in window &&
|
|
24
|
+
'MediaStreamTrackGenerator' in window)
|
|
25
|
+
setCameraSourceId(ret, new MSTPCameraSource(ret, p, deviceId));
|
|
26
|
+
else if (profile.preferImageBitmapCamera && typeof OffscreenCanvas !== "undefined")
|
|
27
|
+
setCameraSourceId(ret, new ImageBitmapCameraSource(ret, p, deviceId));
|
|
28
|
+
else
|
|
29
|
+
setCameraSourceId(ret, new CameraSource(ret, p, deviceId));
|
|
30
|
+
zcout("camera_source_t initialized");
|
|
31
|
+
return ret;
|
|
32
|
+
}
|
package/lib/camera-source.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { zappar_camera_source_t, zappar_pipeline_t } from "./gen/zappar";
|
|
2
2
|
import { HTMLElementSource } from "./html-element-source";
|
|
3
|
-
import { CameraFrameInfo } from "./source";
|
|
4
3
|
export declare class CameraSource extends HTMLElementSource {
|
|
5
4
|
private _impl;
|
|
6
5
|
private _deviceId;
|
|
@@ -8,15 +7,13 @@ export declare class CameraSource extends HTMLElementSource {
|
|
|
8
7
|
static DEFAULT_DEVICE_ID: string;
|
|
9
8
|
private _currentStream;
|
|
10
9
|
private _activeDeviceId;
|
|
11
|
-
|
|
12
|
-
static get(m: zappar_camera_source_t): CameraSource | undefined;
|
|
13
|
-
private constructor();
|
|
10
|
+
constructor(_impl: zappar_camera_source_t, pipeline: zappar_pipeline_t, _deviceId: string);
|
|
14
11
|
destroy(): void;
|
|
15
12
|
private _stop;
|
|
16
13
|
pause(): void;
|
|
17
14
|
start(): void;
|
|
18
15
|
private _getConstraints;
|
|
19
|
-
getFrame(allowRead: boolean):
|
|
16
|
+
getFrame(allowRead: boolean): void;
|
|
20
17
|
private _getUserMedia;
|
|
21
18
|
private _syncCamera;
|
|
22
19
|
private _hasStartedOrientation;
|
package/lib/camera-source.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,24 +7,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const loglevel_1 = require("./loglevel");
|
|
18
|
-
let latest = 1;
|
|
19
|
-
let byId = new Map();
|
|
10
|
+
import { HTMLElementSource } from "./html-element-source";
|
|
11
|
+
import { profile } from "./profile";
|
|
12
|
+
import { Pipeline } from "./pipeline";
|
|
13
|
+
import { cameraRotationForScreenOrientation } from "./cameramodel";
|
|
14
|
+
import { zcout } from "./loglevel";
|
|
15
|
+
import { deleteCameraSource } from "./camera-source-map";
|
|
20
16
|
let _videoSingleton = document.createElement("video");
|
|
21
17
|
_videoSingleton.setAttribute('playsinline', '');
|
|
22
18
|
_videoSingleton.setAttribute('webkit-playsinline', '');
|
|
23
|
-
if (
|
|
19
|
+
if (profile.videoElementInDOM) {
|
|
24
20
|
_videoSingleton.style.width = "0px";
|
|
25
21
|
_videoSingleton.style.height = "0px";
|
|
26
22
|
document.body.appendChild(_videoSingleton);
|
|
27
23
|
}
|
|
28
|
-
class CameraSource extends
|
|
24
|
+
export class CameraSource extends HTMLElementSource {
|
|
29
25
|
constructor(_impl, pipeline, _deviceId) {
|
|
30
26
|
super(_videoSingleton, pipeline);
|
|
31
27
|
this._impl = _impl;
|
|
@@ -34,7 +30,7 @@ class CameraSource extends html_element_source_1.HTMLElementSource {
|
|
|
34
30
|
this._activeDeviceId = null;
|
|
35
31
|
this._hasStartedOrientation = false;
|
|
36
32
|
this._deviceMotionListener = (ev) => {
|
|
37
|
-
let pipeline =
|
|
33
|
+
let pipeline = Pipeline.get(this._pipeline);
|
|
38
34
|
if (!pipeline)
|
|
39
35
|
return;
|
|
40
36
|
let timeStamp = (ev.timeStamp !== undefined && ev.timeStamp !== null) ? ev.timeStamp : performance.now();
|
|
@@ -42,7 +38,7 @@ class CameraSource extends html_element_source_1.HTMLElementSource {
|
|
|
42
38
|
ev.accelerationIncludingGravity.x !== null &&
|
|
43
39
|
ev.accelerationIncludingGravity.y !== null &&
|
|
44
40
|
ev.accelerationIncludingGravity.z !== null) {
|
|
45
|
-
pipeline.motionAccelerometerSubmit(timeStamp, ev.accelerationIncludingGravity.x *
|
|
41
|
+
pipeline.motionAccelerometerSubmit(timeStamp, ev.accelerationIncludingGravity.x * profile.deviceMotionMutliplier, ev.accelerationIncludingGravity.y * profile.deviceMotionMutliplier, ev.accelerationIncludingGravity.z * profile.deviceMotionMutliplier);
|
|
46
42
|
}
|
|
47
43
|
if (ev.rotationRate !== null &&
|
|
48
44
|
ev.rotationRate.alpha !== null &&
|
|
@@ -56,17 +52,8 @@ class CameraSource extends html_element_source_1.HTMLElementSource {
|
|
|
56
52
|
}
|
|
57
53
|
};
|
|
58
54
|
}
|
|
59
|
-
static create(p, deviceId) {
|
|
60
|
-
let ret = (latest++);
|
|
61
|
-
byId.set(ret, new CameraSource(ret, p, deviceId));
|
|
62
|
-
loglevel_1.zcout("camera_source_t initialized");
|
|
63
|
-
return ret;
|
|
64
|
-
}
|
|
65
|
-
static get(m) {
|
|
66
|
-
return byId.get(m);
|
|
67
|
-
}
|
|
68
55
|
destroy() {
|
|
69
|
-
|
|
56
|
+
deleteCameraSource(this._impl);
|
|
70
57
|
super.destroy();
|
|
71
58
|
}
|
|
72
59
|
_stop() {
|
|
@@ -102,9 +89,9 @@ class CameraSource extends html_element_source_1.HTMLElementSource {
|
|
|
102
89
|
audio: false,
|
|
103
90
|
video: {
|
|
104
91
|
facingMode: facingMode,
|
|
105
|
-
width:
|
|
106
|
-
height:
|
|
107
|
-
frameRate:
|
|
92
|
+
width: profile.videoWidth,
|
|
93
|
+
height: profile.videoHeight,
|
|
94
|
+
frameRate: profile.requestHighFrameRate ? 60 : undefined,
|
|
108
95
|
deviceId: deviceId
|
|
109
96
|
}
|
|
110
97
|
};
|
|
@@ -132,15 +119,15 @@ class CameraSource extends html_element_source_1.HTMLElementSource {
|
|
|
132
119
|
return constraints;
|
|
133
120
|
}
|
|
134
121
|
if (typeof constraints.video === "object") {
|
|
135
|
-
|
|
122
|
+
zcout("choosing device ID", devices[devices.length - 1].deviceId);
|
|
136
123
|
constraints.video.deviceId = devices[devices.length - 1].deviceId;
|
|
137
124
|
}
|
|
138
125
|
return constraints;
|
|
139
126
|
});
|
|
140
127
|
}
|
|
141
128
|
getFrame(allowRead) {
|
|
142
|
-
this._cameraToScreenRotation =
|
|
143
|
-
|
|
129
|
+
this._cameraToScreenRotation = cameraRotationForScreenOrientation(false);
|
|
130
|
+
super.getFrame(allowRead);
|
|
144
131
|
}
|
|
145
132
|
_getUserMedia() {
|
|
146
133
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -189,7 +176,7 @@ class CameraSource extends html_element_source_1.HTMLElementSource {
|
|
|
189
176
|
return;
|
|
190
177
|
this._hasStartedOrientation = true;
|
|
191
178
|
this._deviceOrientationListener = (ev) => {
|
|
192
|
-
let pipeline =
|
|
179
|
+
let pipeline = Pipeline.get(this._pipeline);
|
|
193
180
|
if (!pipeline)
|
|
194
181
|
return;
|
|
195
182
|
let timeStamp = (ev.timeStamp !== undefined && ev.timeStamp !== null) ? ev.timeStamp : performance.now();
|
|
@@ -208,6 +195,5 @@ class CameraSource extends html_element_source_1.HTMLElementSource {
|
|
|
208
195
|
window.removeEventListener("deviceorientation", this._deviceOrientationListener);
|
|
209
196
|
}
|
|
210
197
|
}
|
|
211
|
-
exports.CameraSource = CameraSource;
|
|
212
198
|
CameraSource.USER_DEFAULT_DEVICE_ID = "Simulated User Default Device ID: a908df7f-5661-4d20-b227-a1c15d2fdb4b";
|
|
213
199
|
CameraSource.DEFAULT_DEVICE_ID = "Simulated Default Device ID: a908df7f-5661-4d20-b227-a1c15d2fdb4b";
|
package/lib/cameramodel.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.cameraRotationForScreenOrientation = exports.projectionMatrix = void 0;
|
|
4
|
-
const gl_matrix_1 = require("gl-matrix");
|
|
5
|
-
function projectionMatrix(params, screenWidth, screenHeight, near = 0.01, far = 100.0) {
|
|
1
|
+
import { mat4, vec3 } from "gl-matrix";
|
|
2
|
+
export function projectionMatrix(params, screenWidth, screenHeight, near = 0.01, far = 100.0) {
|
|
6
3
|
let cam_x = params[2] * 2;
|
|
7
4
|
let cam_y = params[3] * 2;
|
|
8
|
-
let projection =
|
|
9
|
-
|
|
5
|
+
let projection = mat4.create();
|
|
6
|
+
mat4.frustum(projection, near * (-0.5 - params[2]) / params[0], near * (cam_x - 0.5 - params[2]) / params[0], near * (cam_y - 0.5 - params[3]) / params[1], near * (-0.5 - params[3]) / params[1], near, far);
|
|
10
7
|
// Flip camera y axis (before any other transformations) - converts from
|
|
11
8
|
// the y axis downwards of the tracking camera models to the y axis upwards
|
|
12
9
|
// of rendering coordinate systems
|
|
@@ -14,18 +11,18 @@ function projectionMatrix(params, screenWidth, screenHeight, near = 0.01, far =
|
|
|
14
11
|
projection[5] *= -1.0;
|
|
15
12
|
projection[6] *= -1.0;
|
|
16
13
|
projection[7] *= -1.0;
|
|
17
|
-
let mult =
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
let mult = mat4.create();
|
|
15
|
+
mat4.fromScaling(mult, [0.5 * cam_x, 0.5 * cam_y, 1]);
|
|
16
|
+
mat4.multiply(projection, mult, projection);
|
|
20
17
|
// If it's user facing or not doesn't matter here as long as we apply the same-but-opposite
|
|
21
18
|
// rotation at the end of the function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
let vec =
|
|
19
|
+
mat4.fromRotation(mult, cameraRotationForScreenOrientation(false) * Math.PI / 180.0, [0, 0, 1]);
|
|
20
|
+
mat4.multiply(projection, mult, projection);
|
|
21
|
+
let vec = vec3.create();
|
|
25
22
|
vec[0] = cam_x;
|
|
26
23
|
vec[1] = cam_y;
|
|
27
24
|
vec[2] = 0;
|
|
28
|
-
|
|
25
|
+
vec3.transformMat4(vec, vec, mult);
|
|
29
26
|
let absWidth = Math.abs(vec[0]);
|
|
30
27
|
let absHeight = Math.abs(vec[1]);
|
|
31
28
|
let scaleFactor = 1;
|
|
@@ -35,16 +32,15 @@ function projectionMatrix(params, screenWidth, screenHeight, near = 0.01, far =
|
|
|
35
32
|
else {
|
|
36
33
|
scaleFactor = screenWidth / absWidth;
|
|
37
34
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
mat4.fromScaling(mult, [scaleFactor, scaleFactor, 1]);
|
|
36
|
+
mat4.multiply(projection, mult, projection);
|
|
37
|
+
mat4.fromScaling(mult, [2 / screenWidth, 2 / screenHeight, 1]);
|
|
38
|
+
mat4.multiply(projection, mult, projection);
|
|
39
|
+
mat4.fromRotation(mult, cameraRotationForScreenOrientation(false) * Math.PI / -180.0, [0, 0, 1]);
|
|
40
|
+
mat4.multiply(projection, projection, mult);
|
|
44
41
|
return projection;
|
|
45
42
|
}
|
|
46
|
-
|
|
47
|
-
function cameraRotationForScreenOrientation(isUserFacing) {
|
|
43
|
+
export function cameraRotationForScreenOrientation(isUserFacing) {
|
|
48
44
|
if (window.screen.orientation) {
|
|
49
45
|
switch (window.screen.orientation.type) {
|
|
50
46
|
case "portrait-primary":
|
|
@@ -67,4 +63,3 @@ function cameraRotationForScreenOrientation(isUserFacing) {
|
|
|
67
63
|
}
|
|
68
64
|
return 0;
|
|
69
65
|
}
|
|
70
|
-
exports.cameraRotationForScreenOrientation = cameraRotationForScreenOrientation;
|
package/lib/compatibility.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
function getUnsupportedMessage() {
|
|
4
2
|
let ret = document.createElement("div");
|
|
5
3
|
let idealBrowser = "a recent web browser";
|
|
@@ -39,7 +37,7 @@ function getUnsupportedMessage() {
|
|
|
39
37
|
background-repeat: no-repeat;
|
|
40
38
|
}
|
|
41
39
|
.zee-launcher-browser-safari .zee-launcher-browser-logo {
|
|
42
|
-
background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg version='1.1' viewBox='0 0 211 211' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg transform='translate(-82 -146)' fill-rule='nonzero' stroke='%
|
|
40
|
+
background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg version='1.1' viewBox='0 0 211 211' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg transform='translate(-82 -146)' fill-rule='nonzero' stroke='%23ffffff' stroke-width='2'%3E%3Cpath d='m180 251.86c0-4.0385 2.9377-7.855 7.2552-7.855 3.9614 0 7.7448 2.8402 7.7448 7.145 0 4.0385-2.8487 7.855-7.1662 7.855-4.0059 0-7.8338-2.9734-7.8338-7.145zm112-0.35503c0 57.728-46.772 104.5-104.5 104.5s-104.5-46.772-104.5-104.5 46.772-104.5 104.5-104.5 104.5 46.772 104.5 104.5zm-12-1c0-51.649-41.851-93.5-93.5-93.5s-93.5 41.851-93.5 93.5 41.851 93.5 93.5 93.5 93.5-41.851 93.5-93.5zm-30.624 40.983c0 1.5095 5.4495 4.2768 6.8328 5.1154-11.486 17.401-29.26 29.938-49.423 34.928l-1.8444-7.757c-0.12576-1.0482-0.79646-1.174-1.7606-1.174-0.79646 0-1.2576 1.174-1.1737 1.7611l1.8444 7.8828c-5.5753 1.174-11.234 1.7611-16.935 1.7611-15.217 0-30.182-4.2768-43.177-12.202 0.71263-1.174 5.1141-7.5474 5.1141-8.4698 0-0.79666-0.71263-1.5095-1.5091-1.5095-1.6348 0-5.1141 6.9603-6.1621 8.344-17.522-11.615-30.182-29.602-35.044-50.148l8.0066-1.761c0.92222-0.25158 1.1737-0.92246 1.1737-1.7611 0-0.79667-1.1737-1.2579-1.8444-1.174l-7.8389 1.803c-1.048-5.3251-1.6348-10.692-1.6348-16.143 0-15.556 4.4015-30.86 12.66-43.984 1.1737 0.71281 6.749 4.5284 7.6712 4.5284 0.79646 0 1.5091-0.58702 1.5091-1.3837 0-1.6353-6.1621-4.7381-7.5455-5.7024 11.821-17.275 29.805-29.728 50.219-34.34l1.7606 7.757c0.25152 0.92246 0.92222 1.174 1.7606 1.174 0.83838 0 1.2576-1.174 1.1737-1.8449l-1.7606-7.6732c5.1141-0.92246 10.312-1.5095 15.552-1.5095 15.552 0 30.727 4.4026 43.973 12.663-0.79646 1.174-4.5273 6.6249-4.5273 7.5474 0 0.79667 0.58687 1.5095 1.3833 1.5095 1.6348 0 4.7369-6.0379 5.5753-7.4216 17.187 11.615 29.469 29.351 34.248 49.561l-6.4975 1.3837c-1.048 0.25158-1.1737 0.92246-1.1737 1.8449 0 0.79667 1.1737 1.2579 1.7606 1.174l6.6232-1.5095c1.048 5.3251 1.6348 10.776 1.6348 16.227 0 15.221-4.1919 30.189-12.073 43.062-1.1737-0.58702-6.0364-4.0672-6.9586-4.0672-0.8803 0-1.5929 0.71281-1.5929 1.5095zm-14.876-98.483c-5.2178 4.88-53.863 49.48-55.228 51.8l-38.772 64.2c5.0974-4.76 53.863-49.6 55.108-51.72l38.892-64.28z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
|
|
43
41
|
}
|
|
44
42
|
.zee-launcher-unsupported-message {
|
|
45
43
|
text-align: center;
|
|
@@ -160,7 +158,7 @@ function isSupportedBrowser() {
|
|
|
160
158
|
return false;
|
|
161
159
|
return true;
|
|
162
160
|
}
|
|
163
|
-
|
|
161
|
+
export default {
|
|
164
162
|
incompatible: () => !isSupportedBrowser(),
|
|
165
163
|
incompatible_ui: incompatibleUI,
|
|
166
164
|
};
|
package/lib/deserializer.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageDeserializer = void 0;
|
|
4
|
-
class MessageDeserializer {
|
|
1
|
+
export class MessageDeserializer {
|
|
5
2
|
constructor() {
|
|
6
3
|
this._buffer = new ArrayBuffer(0);
|
|
7
4
|
this._i32View = new Int32Array(this._buffer);
|
|
@@ -113,4 +110,3 @@ class MessageDeserializer {
|
|
|
113
110
|
}
|
|
114
111
|
}
|
|
115
112
|
}
|
|
116
|
-
exports.MessageDeserializer = MessageDeserializer;
|
package/lib/direct.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,25 +7,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports.messageManager = new messages_1.MsgManager();
|
|
17
|
-
function launchWorker(wasm) {
|
|
10
|
+
import { MsgManager } from "./messages";
|
|
11
|
+
import { launchWorkerServer } from "./worker-server";
|
|
12
|
+
import { messageManager as workerMessageManager } from "./worker-server";
|
|
13
|
+
export let messageManager = new MsgManager();
|
|
14
|
+
export function launchWorker(wasm) {
|
|
18
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
|
|
20
|
-
let msgs =
|
|
16
|
+
messageManager.onOutgoingMessage.bind(() => {
|
|
17
|
+
let msgs = messageManager.getOutgoingMessages();
|
|
21
18
|
for (let msg of msgs)
|
|
22
|
-
|
|
19
|
+
workerMessageManager.postIncomingMessage(msg.msg);
|
|
23
20
|
});
|
|
24
|
-
|
|
25
|
-
let msgs =
|
|
21
|
+
workerMessageManager.onOutgoingMessage.bind(() => {
|
|
22
|
+
let msgs = workerMessageManager.getOutgoingMessages();
|
|
26
23
|
for (let msg of msgs)
|
|
27
|
-
|
|
24
|
+
messageManager.postIncomingMessage(msg.msg);
|
|
28
25
|
});
|
|
29
|
-
|
|
26
|
+
launchWorkerServer(wasm);
|
|
30
27
|
});
|
|
31
28
|
}
|
|
32
|
-
exports.launchWorker = launchWorker;
|