@zappar/zappar-cv 0.4.0-beta.1 → 0.4.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +79 -34
  2. package/README.md +2 -2
  3. package/lib/additional.d.ts +2 -1
  4. package/lib/camera-source-map.d.ts +10 -0
  5. package/lib/camera-source-map.js +40 -0
  6. package/lib/camera-source.d.ts +2 -5
  7. package/lib/camera-source.js +3 -13
  8. package/lib/compatibility.js +1 -1
  9. package/lib/drawcamera.js +2 -1
  10. package/lib/gen/zappar-client.js +6 -16
  11. package/lib/gen/zappar-cwrap.js +37 -28
  12. package/lib/gen/zappar-native.d.ts +11 -1
  13. package/lib/gen/zappar-native.js +13 -1
  14. package/lib/gen/zappar-server.js +1 -5
  15. package/lib/gen/zappar.d.ts +12 -0
  16. package/lib/gen/zappar.js +5 -3
  17. package/lib/gfx.d.ts +1 -0
  18. package/lib/gfx.js +4 -0
  19. package/lib/gl-state-manager.d.ts +9 -0
  20. package/lib/gl-state-manager.js +35 -0
  21. package/lib/html-element-source.d.ts +3 -20
  22. package/lib/html-element-source.js +19 -263
  23. package/lib/image-process-gl.d.ts +37 -0
  24. package/lib/image-process-gl.js +298 -0
  25. package/lib/imagebitmap-camera-source.d.ts +36 -0
  26. package/lib/imagebitmap-camera-source.js +277 -0
  27. package/lib/imagetracker.d.ts +28 -0
  28. package/lib/imagetracker.js +119 -0
  29. package/lib/index.d.ts +1 -1
  30. package/lib/mstp-camera-source.d.ts +29 -0
  31. package/lib/mstp-camera-source.js +230 -0
  32. package/lib/native.js +119 -8
  33. package/lib/pipeline.d.ts +13 -3
  34. package/lib/pipeline.js +95 -26
  35. package/lib/profile.d.ts +2 -0
  36. package/lib/profile.js +55 -44
  37. package/lib/riff-reader.d.ts +18 -0
  38. package/lib/riff-reader.js +56 -0
  39. package/lib/sequencerecorder.d.ts +1 -0
  40. package/lib/sequencerecorder.js +11 -0
  41. package/lib/sequencesource.d.ts +7 -1
  42. package/lib/sequencesource.js +89 -47
  43. package/lib/source.d.ts +6 -4
  44. package/lib/version.d.ts +1 -1
  45. package/lib/version.js +1 -1
  46. package/lib/worker-client.js +0 -5
  47. package/lib/worker-imagebitmap.d.ts +5 -0
  48. package/lib/worker-imagebitmap.js +63 -0
  49. package/lib/worker-server.d.ts +0 -5
  50. package/lib/worker-server.js +120 -30
  51. package/lib/workerinterface.d.ts +47 -1
  52. package/lib/zcv.js +117 -135
  53. package/lib/zcv.wasm +0 -0
  54. package/package.json +34 -31
  55. package/umd/e9486c1cdadb21608a4f7e2fa3be9517.wasm +0 -0
  56. package/umd/zappar-cv.js +1 -9
  57. package/umd/zappar-cv.worker.js +1 -1
  58. package/lib/bundleworker-mainthread.d.ts +0 -2
  59. package/lib/bundleworker-mainthread.js +0 -36
  60. package/lib/bundleworker-worker.d.ts +0 -3
  61. package/lib/bundleworker-worker.js +0 -47
  62. package/umd/5dd5cacd27e6e7da828f.bundleworker.js +0 -1
  63. package/umd/a20150d17b0290cadaa6cb9911ab9500.wasm +0 -0
package/CHANGELOG.md CHANGED
@@ -1,130 +1,175 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.14] - 2021-10-25
4
+
5
+ ### Changed
6
+
7
+ - Pinned dependencies to exact versions
8
+
9
+ ## [0.3.13] - 2021-10-11
10
+
11
+ ### Fixed
12
+
13
+ - A broken licencing url.
14
+
15
+ ## [0.3.12] - 2021-09-28
16
+
17
+ ### Fixed
18
+
19
+ - Safari logo not appearing on incompatible browser screen
20
+ - Issues with iPad devices
21
+
22
+ ## [0.3.11] - 2021-09-17
23
+
24
+ ### Fixed
25
+
26
+ - Issues with other browsers on iOS, including social browsers
27
+
28
+ ## [0.3.10] - 2021-09-17
29
+
30
+ ### Added
31
+ - loaded() function which returns true once the library is fully loaded and available for use
32
+
33
+ ### Changed
34
+
35
+ - Bucket 172.* IP address range into one license check.
36
+
3
37
  ## [0.3.9] - 2021-04-22
38
+
4
39
  ### Added
5
- - `projection_matrix_from_camera_model_ext` that exposes near and far clipping planes.
40
+
41
+ - `projection_matrix_from_camera_model_ext` that exposes near and far clipping planes.
6
42
 
7
43
  ## [0.3.8] - 2021-02-18
8
44
 
9
45
  ### Added
10
- - pipeline_gl_context_lost to indicate that the GL context is lost
11
- - log_level and log_level_set to customize volume of log output
46
+
47
+ - pipeline_gl_context_lost to indicate that the GL context is lost
48
+ - log_level and log_level_set to customize volume of log output
12
49
 
13
50
  ### Changed
14
- - License checks now only happen on first pipeline construction
51
+
52
+ - License checks now only happen on first pipeline construction
15
53
 
16
54
  ### Fixed
17
- - pipeline_gl_context_set correctly handles multiple invocations
18
55
 
56
+ - pipeline_gl_context_set correctly handles multiple invocations
19
57
 
20
58
  ## [0.3.7] - 2021-02-03
21
59
 
22
60
  ### Fixed
23
- - Issues on Chrome for iOS
24
- - NPM audit dependency updates
61
+
62
+ - Issues on Chrome for iOS
63
+ - NPM audit dependency updates
25
64
 
26
65
  ## [0.3.6] - 2021-01-18
27
66
 
28
67
  ### Fixed
29
- - Issue where wasm would not load on some webpack versions
30
68
 
69
+ - Issue where wasm would not load on some webpack versions
31
70
 
32
71
  ## [0.3.5] - 2020-11-26
33
72
 
34
73
  ### Added
35
- - This changelog :-)
36
- - Console log the version when the library is initialized
74
+
75
+ - This changelog :-)
76
+ - Console log the version when the library is initialized
37
77
 
38
78
  ### Fixed
39
- - Prevent flickering when there are no new camera frames
40
- - Fixed building with recent versions of `worker-loader`
79
+
80
+ - Prevent flickering when there are no new camera frames
81
+ - Fixed building with recent versions of `worker-loader`
41
82
 
42
83
  ### Changed
43
- - Dependencies update
44
- - Remove unnecessary console logging
45
84
 
85
+ - Dependencies update
86
+ - Remove unnecessary console logging
46
87
 
47
88
  ## [0.3.4] - 2020-11-18
48
89
 
49
90
  ### Fixed
50
- - Ensure internal GL usage correctly sets the expected active texture
51
91
 
92
+ - Ensure internal GL usage correctly sets the expected active texture
52
93
 
53
94
  ## [0.3.3] - 2020-11-04
54
95
 
55
96
  ### Added
56
- - Browser compatibility API and UI
97
+
98
+ - Browser compatibility API and UI
57
99
 
58
100
  ### Changed
59
- - Modifications to browser compatibility API
60
101
 
102
+ - Modifications to browser compatibility API
61
103
 
62
104
  ## [0.3.2] - 2020-11-04
63
105
 
64
106
  ### Added
65
- - Browser compatibility API and UI
107
+
108
+ - Browser compatibility API and UI
66
109
 
67
110
  ### Fixed
68
- - Support for Firefox
69
111
 
112
+ - Support for Firefox
70
113
 
71
114
  ## [0.3.1] - 2020-11-03
72
115
 
73
116
  ### Fixed
74
- - Various enums are now available as objects
75
- - Removed unnecessary TypeScript files included in deployment
76
117
 
118
+ - Various enums are now available as objects
119
+ - Removed unnecessary TypeScript files included in deployment
77
120
 
78
121
  ## [0.3.0] - 2020-11-02
79
122
 
80
123
  ### Added
81
- - Support for face landmarks
82
- - Greatly improved face tracking model
124
+
125
+ - Support for face landmarks
126
+ - Greatly improved face tracking model
83
127
 
84
128
  ### Fixed
85
- - Fixes to iPad support
129
+
130
+ - Fixes to iPad support
86
131
 
87
132
  ### Changed
88
- - Dependencies update
89
133
 
134
+ - Dependencies update
90
135
 
91
136
  ## [0.2.12] - 2020-10-19
92
137
 
93
138
  ### Fixed
94
- - Fixes to iPad support
139
+
140
+ - Fixes to iPad support
95
141
 
96
142
  ### Changed
97
- - Dependencies update
98
143
 
144
+ - Dependencies update
99
145
 
100
146
  ## [0.2.11] - 2020-09-15
101
147
 
102
148
  ### Fixed
103
- - Fix issues with iOS 14
149
+
150
+ - Fix issues with iOS 14
104
151
 
105
152
  ### Changed
106
- - Dependencies update
107
153
 
154
+ - Dependencies update
108
155
 
109
156
  ## [0.2.9] - 2020-07-08
110
157
 
111
158
  ### Fixed
112
- - Tweaks to computer vision algorithms
113
159
 
160
+ - Tweaks to computer vision algorithms
114
161
 
115
162
  ## [0.2.6] - 2020-06-09
116
163
 
117
164
  ### Added
118
- - Support for full head meshes
119
-
120
165
 
166
+ - Support for full head meshes
121
167
 
122
168
  ## [0.2.4] - 2020-06-02
123
169
 
124
170
  ### Added
125
- - Support for NGROK
126
-
127
171
 
172
+ - Support for NGROK
128
173
 
129
174
  ## [0.2.3] - 2020-05-26
130
175
 
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.4.0-beta.1/zappar-cv.js"></script>
21
+ <script src="https://libs.zappar.com/zappar-cv/0.4.0-beta.10/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.4.0-beta.1/zappar-cv.zip](https://libs.zappar.com/zappar-cv/0.4.0-beta.1/zappar-cv.zip)
25
+ [https://libs.zappar.com/zappar-cv/0.4.0-beta.10/zappar-cv.zip](https://libs.zappar.com/zappar-cv/0.4.0-beta.10/zappar-cv.zip)
@@ -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;
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>;
@@ -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,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCameraSource = exports.deleteCameraSource = exports.getCameraSource = exports.setCameraSourceId = exports.getNextCameraSourceId = void 0;
4
+ const camera_source_1 = require("./camera-source");
5
+ const imagebitmap_camera_source_1 = require("./imagebitmap-camera-source");
6
+ const loglevel_1 = require("./loglevel");
7
+ const mstp_camera_source_1 = require("./mstp-camera-source");
8
+ const profile_1 = require("./profile");
9
+ let latest = 1;
10
+ let byId = new Map();
11
+ function getNextCameraSourceId() {
12
+ return (latest++);
13
+ }
14
+ exports.getNextCameraSourceId = getNextCameraSourceId;
15
+ function setCameraSourceId(id, c) {
16
+ byId.set(id, c);
17
+ }
18
+ exports.setCameraSourceId = setCameraSourceId;
19
+ function getCameraSource(id) {
20
+ return byId.get(id);
21
+ }
22
+ exports.getCameraSource = getCameraSource;
23
+ function deleteCameraSource(id) {
24
+ byId.delete(id);
25
+ }
26
+ exports.deleteCameraSource = deleteCameraSource;
27
+ function createCameraSource(p, deviceId) {
28
+ let ret = getNextCameraSourceId();
29
+ if (profile_1.profile.preferMediaStreamTrackProcessorCamera &&
30
+ 'MediaStreamTrackProcessor' in window &&
31
+ 'MediaStreamTrackGenerator' in window)
32
+ setCameraSourceId(ret, new mstp_camera_source_1.MSTPCameraSource(ret, p, deviceId));
33
+ else if (profile_1.profile.preferImageBitmapCamera && typeof OffscreenCanvas !== "undefined")
34
+ setCameraSourceId(ret, new imagebitmap_camera_source_1.ImageBitmapCameraSource(ret, p, deviceId));
35
+ else
36
+ setCameraSourceId(ret, new camera_source_1.CameraSource(ret, p, deviceId));
37
+ loglevel_1.zcout("camera_source_t initialized");
38
+ return ret;
39
+ }
40
+ exports.createCameraSource = createCameraSource;
@@ -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
- static create(p: zappar_pipeline_t, deviceId: string): zappar_camera_source_t;
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): CameraFrameInfo | undefined;
16
+ getFrame(allowRead: boolean): void;
20
17
  private _getUserMedia;
21
18
  private _syncCamera;
22
19
  private _hasStartedOrientation;
@@ -15,8 +15,7 @@ const profile_1 = require("./profile");
15
15
  const pipeline_1 = require("./pipeline");
16
16
  const cameramodel_1 = require("./cameramodel");
17
17
  const loglevel_1 = require("./loglevel");
18
- let latest = 1;
19
- let byId = new Map();
18
+ const camera_source_map_1 = require("./camera-source-map");
20
19
  let _videoSingleton = document.createElement("video");
21
20
  _videoSingleton.setAttribute('playsinline', '');
22
21
  _videoSingleton.setAttribute('webkit-playsinline', '');
@@ -56,17 +55,8 @@ class CameraSource extends html_element_source_1.HTMLElementSource {
56
55
  }
57
56
  };
58
57
  }
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
58
  destroy() {
69
- byId.delete(this._impl);
59
+ camera_source_map_1.deleteCameraSource(this._impl);
70
60
  super.destroy();
71
61
  }
72
62
  _stop() {
@@ -140,7 +130,7 @@ class CameraSource extends html_element_source_1.HTMLElementSource {
140
130
  }
141
131
  getFrame(allowRead) {
142
132
  this._cameraToScreenRotation = cameramodel_1.cameraRotationForScreenOrientation(false);
143
- return super.getFrame(allowRead);
133
+ super.getFrame(allowRead);
144
134
  }
145
135
  _getUserMedia() {
146
136
  return __awaiter(this, void 0, void 0, function* () {
@@ -39,7 +39,7 @@ function getUnsupportedMessage() {
39
39
  background-repeat: no-repeat;
40
40
  }
41
41
  .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='%23fffffft' 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");
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='%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
43
  }
44
44
  .zee-launcher-unsupported-message {
45
45
  text-align: center;
package/lib/drawcamera.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cameraFrameTextureMatrix = exports.CameraDraw = void 0;
4
4
  const shader_1 = require("./shader");
5
5
  const gl_matrix_1 = require("gl-matrix");
6
+ let identity = gl_matrix_1.mat4.create();
6
7
  class CameraDraw {
7
8
  constructor(_gl) {
8
9
  this._gl = _gl;
@@ -47,7 +48,7 @@ class CameraDraw {
47
48
  let vbo = this._generate(gl, i);
48
49
  gl.activeTexture(gl.TEXTURE0);
49
50
  gl.useProgram(shader.prog);
50
- gl.uniformMatrix4fv(shader.unif_skinTexTransform, false, cameraFrameTextureMatrix(i.dataWidth, i.dataHeight, screenWidth, screenHeight, i.uvTransform, mirror));
51
+ gl.uniformMatrix4fv(shader.unif_skinTexTransform, false, cameraFrameTextureMatrix(i.dataWidth, i.dataHeight, screenWidth, screenHeight, i.uvTransform || identity, mirror));
51
52
  gl.uniform1i(shader.unif_skinSampler, 0);
52
53
  gl.bindTexture(gl.TEXTURE_2D, i.texture);
53
54
  gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
@@ -100,10 +100,15 @@ class zappar_client {
100
100
  m.int(height);
101
101
  m.int(user_data);
102
102
  m.matrix4x4(camera_to_device_transform);
103
- m.matrix4x4(camera_model);
103
+ m.cameraModel(camera_model);
104
104
  m.bool(user_facing);
105
105
  });
106
106
  },
107
+ pipeline_camera_frame_submit_raw_pointer: (o, data, dataLength, format, width, height, user_data, camera_to_device_transform, rotation, camera_model, user_facing) => {
108
+ let s = this._pipeline_state_by_instance.get(o);
109
+ if (!s)
110
+ throw new Error("This object has been destroyed");
111
+ },
107
112
  pipeline_camera_frame_camera_attitude: (o) => {
108
113
  let s = this._pipeline_state_by_instance.get(o);
109
114
  if (!s)
@@ -208,7 +213,6 @@ class zappar_client {
208
213
  let s = {
209
214
  enabled: true,
210
215
  target_loaded_version: -1,
211
- target_count: 0,
212
216
  anchor_count: 0,
213
217
  anchor_id: [],
214
218
  anchor_pose: [],
@@ -244,12 +248,6 @@ class zappar_client {
244
248
  throw new Error("This object has been destroyed");
245
249
  return s.target_loaded_version;
246
250
  },
247
- image_tracker_target_count: (o) => {
248
- let s = this._image_tracker_state_by_instance.get(o);
249
- if (!s)
250
- throw new Error("This object has been destroyed");
251
- return s.target_count;
252
- },
253
251
  image_tracker_enabled: (o) => {
254
252
  let s = this._image_tracker_state_by_instance.get(o);
255
253
  if (!s)
@@ -610,14 +608,6 @@ class zappar_client {
610
608
  inst.target_loaded_version = msg.int();
611
609
  break;
612
610
  }
613
- case 21: {
614
- let handle = msg.type();
615
- let inst = this._image_tracker_state_by_instance.get(handle);
616
- if (!inst)
617
- return;
618
- inst.target_count = msg.int();
619
- break;
620
- }
621
611
  case 1: {
622
612
  let handle = msg.type();
623
613
  let inst = this._image_tracker_state_by_instance.get(handle);
@@ -27,6 +27,10 @@ function getRuntimeObject(mod) {
27
27
  "number",
28
28
  "number", "number", "number", "number", "number", "number", "number", "number"
29
29
  ]);
30
+ let pipeline_camera_frame_submit_raw_pointer_wrapped = mod.cwrap("zappar_pipeline_camera_frame_submit_raw_pointer", null, [
31
+ "number",
32
+ "number", "number", "number", "number", "number", "number", "number", "number", "number", "number"
33
+ ]);
30
34
  let pipeline_camera_frame_camera_attitude_wrapped = mod.cwrap("zappar_pipeline_camera_frame_camera_attitude", "number", [
31
35
  "number"
32
36
  ]);
@@ -62,9 +66,6 @@ function getRuntimeObject(mod) {
62
66
  let image_tracker_target_loaded_version_wrapped = mod.cwrap("zappar_image_tracker_target_loaded_version", "number", [
63
67
  "number"
64
68
  ]);
65
- let image_tracker_target_count_wrapped = mod.cwrap("zappar_image_tracker_target_count", "number", [
66
- "number"
67
- ]);
68
69
  let image_tracker_enabled_wrapped = mod.cwrap("zappar_image_tracker_enabled", "number", [
69
70
  "number"
70
71
  ]);
@@ -176,6 +177,17 @@ function getRuntimeObject(mod) {
176
177
  let dataArrayArg = mod._malloc(dataArrayArgLength);
177
178
  let floatDataArrayArgLength = 16 * 4;
178
179
  let floatDataArrayArg = mod._malloc(floatDataArrayArgLength);
180
+ let floatDataArraysByArgIndex = new Map();
181
+ let getFloatDataArrayForArgIndex = (indx, len) => {
182
+ let existing = floatDataArraysByArgIndex.get(indx);
183
+ if (!existing || existing[0] < len) {
184
+ if (existing)
185
+ mod._free(existing[1]);
186
+ existing = [len, mod._malloc(len)];
187
+ floatDataArraysByArgIndex.set(indx, existing);
188
+ }
189
+ return existing[1];
190
+ };
179
191
  return {
180
192
  log_level: () => {
181
193
  let ret = log_level_wrapped();
@@ -228,24 +240,30 @@ function getRuntimeObject(mod) {
228
240
  let arg_width = width;
229
241
  let arg_height = height;
230
242
  let arg_user_data = user_data;
231
- if (floatDataArrayArgLength < camera_to_device_transform.byteLength) {
232
- mod._free(floatDataArrayArgLength);
233
- floatDataArrayArgLength = camera_to_device_transform.byteLength;
234
- floatDataArrayArg = mod._malloc(floatDataArrayArgLength);
235
- }
236
- let arg_camera_to_device_transform = floatDataArrayArg;
237
- mod.HEAPF32.set(camera_to_device_transform, floatDataArrayArg / 4);
238
- if (floatDataArrayArgLength < camera_model.byteLength) {
239
- mod._free(floatDataArrayArgLength);
240
- floatDataArrayArgLength = camera_model.byteLength;
241
- floatDataArrayArg = mod._malloc(floatDataArrayArgLength);
242
- }
243
- let arg_camera_model = floatDataArrayArg;
244
- mod.HEAPF32.set(camera_model, floatDataArrayArg / 4);
243
+ let arg_camera_to_device_transform = getFloatDataArrayForArgIndex(4, camera_to_device_transform.byteLength);
244
+ mod.HEAPF32.set(camera_to_device_transform, arg_camera_to_device_transform / 4);
245
+ let arg_camera_model = getFloatDataArrayForArgIndex(5, camera_model.byteLength);
246
+ mod.HEAPF32.set(camera_model, arg_camera_model / 4);
245
247
  let arg_user_facing = user_facing ? 1 : 0;
246
248
  let ret = pipeline_camera_frame_submit_wrapped(o, arg_data, arg_len_data, arg_width, arg_height, arg_user_data, arg_camera_to_device_transform, arg_camera_model, arg_user_facing);
247
249
  return ret;
248
250
  },
251
+ pipeline_camera_frame_submit_raw_pointer: (o, data, dataLength, format, width, height, user_data, camera_to_device_transform, rotation, camera_model, user_facing) => {
252
+ let arg_data = data;
253
+ let arg_dataLength = dataLength;
254
+ let arg_format = format;
255
+ let arg_width = width;
256
+ let arg_height = height;
257
+ let arg_user_data = user_data;
258
+ let arg_camera_to_device_transform = getFloatDataArrayForArgIndex(6, camera_to_device_transform.byteLength);
259
+ mod.HEAPF32.set(camera_to_device_transform, arg_camera_to_device_transform / 4);
260
+ let arg_rotation = rotation;
261
+ let arg_camera_model = getFloatDataArrayForArgIndex(8, camera_model.byteLength);
262
+ mod.HEAPF32.set(camera_model, arg_camera_model / 4);
263
+ let arg_user_facing = user_facing ? 1 : 0;
264
+ let ret = pipeline_camera_frame_submit_raw_pointer_wrapped(o, arg_data, arg_dataLength, arg_format, arg_width, arg_height, arg_user_data, arg_camera_to_device_transform, arg_rotation, arg_camera_model, arg_user_facing);
265
+ return ret;
266
+ },
249
267
  pipeline_camera_frame_camera_attitude: (o) => {
250
268
  let ret = pipeline_camera_frame_camera_attitude_wrapped(o);
251
269
  let ab = new Float32Array(16);
@@ -285,13 +303,8 @@ function getRuntimeObject(mod) {
285
303
  return ret;
286
304
  },
287
305
  pipeline_motion_attitude_matrix_submit: (o, mat) => {
288
- if (floatDataArrayArgLength < mat.byteLength) {
289
- mod._free(floatDataArrayArgLength);
290
- floatDataArrayArgLength = mat.byteLength;
291
- floatDataArrayArg = mod._malloc(floatDataArrayArgLength);
292
- }
293
- let arg_mat = floatDataArrayArg;
294
- mod.HEAPF32.set(mat, floatDataArrayArg / 4);
306
+ let arg_mat = getFloatDataArrayForArgIndex(0, mat.byteLength);
307
+ mod.HEAPF32.set(mat, arg_mat / 4);
295
308
  let ret = pipeline_motion_attitude_matrix_submit_wrapped(o, arg_mat);
296
309
  return ret;
297
310
  },
@@ -333,10 +346,6 @@ function getRuntimeObject(mod) {
333
346
  let ret = image_tracker_target_loaded_version_wrapped(o);
334
347
  return ret;
335
348
  },
336
- image_tracker_target_count: (o) => {
337
- let ret = image_tracker_target_count_wrapped(o);
338
- return ret;
339
- },
340
349
  image_tracker_enabled: (o) => {
341
350
  let ret = image_tracker_enabled_wrapped(o);
342
351
  ret = ret === 1;
@@ -46,6 +46,16 @@ export declare enum log_level_t {
46
46
  LOG_LEVEL_WARNING = 2,
47
47
  LOG_LEVEL_VERBOSE = 3
48
48
  }
49
+ export declare enum frame_pixel_format_t {
50
+ FRAME_PIXEL_FORMAT_I420 = 0,
51
+ FRAME_PIXEL_FORMAT_I420A = 1,
52
+ FRAME_PIXEL_FORMAT_I422 = 2,
53
+ FRAME_PIXEL_FORMAT_I444 = 3,
54
+ FRAME_PIXEL_FORMAT_NV12 = 4,
55
+ FRAME_PIXEL_FORMAT_RGBA = 5,
56
+ FRAME_PIXEL_FORMAT_BGRA = 6,
57
+ FRAME_PIXEL_FORMAT_Y = 7
58
+ }
49
59
  export declare type zappar_pipeline_t = number & {
50
60
  _: 'zappar_pipeline_t';
51
61
  };
@@ -84,6 +94,7 @@ export interface zappar_cwrap {
84
94
  pipeline_camera_model(o: zappar_pipeline_t): Float32Array;
85
95
  pipeline_camera_frame_user_data(o: zappar_pipeline_t): number;
86
96
  pipeline_camera_frame_submit(o: zappar_pipeline_t, data: ArrayBuffer, width: number, height: number, user_data: number, camera_to_device_transform: Float32Array, camera_model: Float32Array, user_facing: boolean): void;
97
+ pipeline_camera_frame_submit_raw_pointer(o: zappar_pipeline_t, data: number, dataLength: number, format: frame_pixel_format_t, width: number, height: number, user_data: number, camera_to_device_transform: Float32Array, rotation: number, camera_model: Float32Array, user_facing: boolean): void;
87
98
  pipeline_camera_frame_camera_attitude(o: zappar_pipeline_t): Float32Array;
88
99
  pipeline_camera_frame_device_attitude(o: zappar_pipeline_t): Float32Array;
89
100
  pipeline_motion_accelerometer_submit(o: zappar_pipeline_t, time: number, x: number, y: number, z: number): void;
@@ -98,7 +109,6 @@ export interface zappar_cwrap {
98
109
  image_tracker_destroy(o: zappar_image_tracker_t): void;
99
110
  image_tracker_target_load_from_memory(o: zappar_image_tracker_t, data: ArrayBuffer): void;
100
111
  image_tracker_target_loaded_version(o: zappar_image_tracker_t): number;
101
- image_tracker_target_count(o: zappar_image_tracker_t): number;
102
112
  image_tracker_enabled(o: zappar_image_tracker_t): boolean;
103
113
  image_tracker_enabled_set(o: zappar_image_tracker_t, enabled: boolean): void;
104
114
  image_tracker_anchor_count(o: zappar_image_tracker_t): number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.log_level_t = exports.instant_world_tracker_transform_orientation_t = exports.face_landmark_name_t = exports.barcode_format_t = void 0;
3
+ exports.frame_pixel_format_t = exports.log_level_t = exports.instant_world_tracker_transform_orientation_t = exports.face_landmark_name_t = exports.barcode_format_t = void 0;
4
4
  var barcode_format_t;
5
5
  (function (barcode_format_t) {
6
6
  barcode_format_t[barcode_format_t["UNKNOWN"] = 131072] = "UNKNOWN";
@@ -57,3 +57,15 @@ var log_level_t;
57
57
  log_level_t[log_level_t["LOG_LEVEL_VERBOSE"] = 3] = "LOG_LEVEL_VERBOSE";
58
58
  })(log_level_t = exports.log_level_t || (exports.log_level_t = {}));
59
59
  ;
60
+ var frame_pixel_format_t;
61
+ (function (frame_pixel_format_t) {
62
+ frame_pixel_format_t[frame_pixel_format_t["FRAME_PIXEL_FORMAT_I420"] = 0] = "FRAME_PIXEL_FORMAT_I420";
63
+ frame_pixel_format_t[frame_pixel_format_t["FRAME_PIXEL_FORMAT_I420A"] = 1] = "FRAME_PIXEL_FORMAT_I420A";
64
+ frame_pixel_format_t[frame_pixel_format_t["FRAME_PIXEL_FORMAT_I422"] = 2] = "FRAME_PIXEL_FORMAT_I422";
65
+ frame_pixel_format_t[frame_pixel_format_t["FRAME_PIXEL_FORMAT_I444"] = 3] = "FRAME_PIXEL_FORMAT_I444";
66
+ frame_pixel_format_t[frame_pixel_format_t["FRAME_PIXEL_FORMAT_NV12"] = 4] = "FRAME_PIXEL_FORMAT_NV12";
67
+ frame_pixel_format_t[frame_pixel_format_t["FRAME_PIXEL_FORMAT_RGBA"] = 5] = "FRAME_PIXEL_FORMAT_RGBA";
68
+ frame_pixel_format_t[frame_pixel_format_t["FRAME_PIXEL_FORMAT_BGRA"] = 6] = "FRAME_PIXEL_FORMAT_BGRA";
69
+ frame_pixel_format_t[frame_pixel_format_t["FRAME_PIXEL_FORMAT_Y"] = 7] = "FRAME_PIXEL_FORMAT_Y";
70
+ })(frame_pixel_format_t = exports.frame_pixel_format_t || (exports.frame_pixel_format_t = {}));
71
+ ;
@@ -72,7 +72,7 @@ class zappar_server {
72
72
  let obj = this._pipeline_by_instance.get(clientId);
73
73
  if (obj === undefined)
74
74
  return;
75
- this._impl.pipeline_camera_frame_submit(obj, msg.dataWithLength(), msg.int(), msg.int(), msg.int(), msg.matrix4x4(), msg.matrix4x4(), msg.bool());
75
+ this._impl.pipeline_camera_frame_submit(obj, msg.dataWithLength(), msg.int(), msg.int(), msg.int(), msg.matrix4x4(), msg.cameraModel(), msg.bool());
76
76
  break;
77
77
  }
78
78
  case 10: {
@@ -378,10 +378,6 @@ class zappar_server {
378
378
  msg.type(k);
379
379
  msg.int(this._impl.image_tracker_target_loaded_version(v));
380
380
  });
381
- serializer.sendMessage(21, msg => {
382
- msg.type(k);
383
- msg.int(this._impl.image_tracker_target_count(v));
384
- });
385
381
  serializer.sendMessage(1, msg => {
386
382
  msg.type(k);
387
383
  msg.int(this._impl.image_tracker_anchor_count(v));