@ar-js-org/artoolkit5-ts 0.1.0 → 0.2.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 CHANGED
@@ -1,65 +1,190 @@
1
- # Changelog
2
-
3
- All notable changes to this project are documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [Unreleased]
9
-
10
- ## [0.1.0] - 2026-08-16
11
-
12
- ### Added
13
-
14
- - `createARToolKitState` / `disposeARToolKitState` lifecycle. Dispose calls
15
- the core's `teardown()` and then Embind's `delete()`; skipping the first leaks
16
- the ARToolKit handles the instance owns. Idempotent.
17
- - `ARToolKitError`, thrown by every operation called on a disposed state, so a
18
- use-after-dispose names the misused function instead of crashing somewhere
19
- inside the WASM module.
20
- - `loadPatternMarker` and `trackMarker` for registering markers.
21
- - `processFrame`, returning `{ detected, lost }`.
22
- - `getCameraProjectionMatrix`, `transMatToGLMat` and `arglCameraViewRHf`.
23
- - Vitest suite covering the matrix maths, the visibility state machine and the
24
- dispose lifecycle, running without WASM or a browser against a mocked core.
25
- - CI on Node 22 and 24: typecheck, test, build, and a packaging check.
26
- - Release workflow, run manually with a version. It runs the checks, sets the
27
- version, promotes this changelog, derives notes from the commits, tags,
28
- creates the GitHub Release and publishes to npm with provenance. A `dry_run`
29
- input rehearses all of it without tagging or publishing.
30
- - `scripts/release-notes.mjs`, which groups Conventional Commits since the
31
- previous tag so release notes reflect what actually landed, and
32
- `scripts/promote-changelog.mjs`, which promotes the Unreleased section.
33
- - Webcam example: camera to Three.js cube overlay.
34
- - This changelog.
35
-
36
- ### Changed
37
-
38
- - `processFrame` returns `{ detected, lost }` rather than `MarkerPose[]`. The
39
- visibility transition was already computed internally and then discarded,
40
- forcing consumers to diff successive results to recover it.
41
- - Named `@ar-js-org/artoolkit5-ts`, matching the rest of the organisation.
42
- - Depends on `@ar-js-org/artoolkit5-wasm@^0.1.3` from npm rather than a pinned
43
- git commit. `three` moved to `devDependencies`; only the examples use it.
44
-
45
- ### Fixed
46
-
47
- - `arglCameraViewRHf` allocated a `Float64Array` while every type declaration
48
- promised `Float32Array`. Consumers reading `matrixGL` would have received a
49
- different array type than the published types described, and the AR.js-next
50
- marker event contract specifies `Float32Array(16)`.
51
- - `processFrame` allocated roughly three typed arrays per marker per frame. Both
52
- matrix helpers now write into caller-supplied buffers, with one module-scoped
53
- scratch array for the intermediate 4×4.
54
- - Debug logging removed from `src/`, which dumped the entire WASM module to the
55
- console on every marker load and every `trackMarker` call.
56
- - `favicon.svg` and orphaned `.d.ts.map` files no longer ship in the package.
57
-
58
- ### Notes
59
-
60
- Pattern markers only. Barcode support is planned; NFT is out of scope for this
61
- project. Worker compatibility is untested — nothing in `src/` touches the DOM,
62
- which is necessary but not proof.
63
-
64
- [Unreleased]: https://github.com/AR-js-org/artoolkit5-ts/compare/v0.1.0...HEAD
65
- [0.1.0]: https://github.com/AR-js-org/artoolkit5-ts/releases/tag/v0.1.0
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.2.0] - 2026-09-17
11
+
12
+ ### Upgrading from 0.1.0
13
+
14
+ Three changes need action. Each is described in full further down; this is the
15
+ short list for anyone upgrading.
16
+
17
+ 1. **`state.markers` is gone**, replaced by `state.patternMarkers` and
18
+ `state.barcodeMarkers`. Read the one matching the family you registered.
19
+ 2. **`FrameResult.lost` now holds objects, not numbers** — `LostMarker`
20
+ (`{ id, type }`) rather than a bare ID. This is the one to look for: it does
21
+ not throw, so `lost.forEach((id) => hide(id))` keeps running and silently
22
+ stops matching anything. Use `lost.forEach(({ id }) => hide(id))`, and note
23
+ that `id` alone is no longer unique across families.
24
+ 3. **Several `configureDetector` option values were respelled** see the table
25
+ under Changed. TypeScript catches these; plain JavaScript gets a thrown
26
+ `ARToolKitError` naming the option and listing the valid values.
27
+
28
+ ### Added
29
+
30
+ - `configureDetector(state, opts)` detector tuning: `detectionMode`, `matrixCodeType`,
31
+ `threshold`, `thresholdMode`, `labelingMode`, `imageProcMode`, `patternRatio`,
32
+ `nearPlane`, `farPlane`, and `minConfidence` (described below). Applies only the
33
+ keys present, so a later call can adjust a single setting mid-session.
34
+ - `@ar-js-org/artoolkit5-constants` as a direct dependency (`^0.3.0`). All ARToolKit5
35
+ integers used internally come from it — `src/config.ts` is the only module in
36
+ the codebase that imports one.
37
+ - `trackBarcodeMarker(state, barcodeId, markerWidth?)` — registers a barcode
38
+ (matrix code) marker. Unlike a pattern marker there is nothing to load first:
39
+ the ID is encoded in the marker's geometry, not assigned by the engine.
40
+ - `MarkerType` (`'pattern' | 'barcode'`) on `MarkerPose`, and `LostMarker`
41
+ (`{ id, type }`) as the element type of `FrameResult.lost`.
42
+ - **Independent ID spaces for the two marker families.** `ARToolKitState` now holds
43
+ separate `patternMarkers` and `barcodeMarkers` registries instead of a single
44
+ `markers` map, so a pattern marker and a barcode marker may both be registered
45
+ as `7` and tracked simultaneously. Pattern IDs are engine-assigned from 0 while
46
+ barcode IDs are chosen by whoever printed the marker, so collisions are ordinary
47
+ rather than exceptional — `patt.hiro` is ID `0`. The engine reports each family
48
+ through its own field (`idPatt` / `idMatrix`), and each is matched only against
49
+ its own registry. This mirrors `artoolkit5-js`, which has kept the two separate
50
+ all along. ([#36](https://github.com/AR-js-org/artoolkit5-ts/issues/36))
51
+ - **Combined pattern+barcode detection.** `'color_and_matrix'` and `'mono_and_matrix'` detect
52
+ both marker families in a single frame, verified against a real camera rather than a
53
+ mock. This required a fix in the WASM binding, which exposed only a field the engine
54
+ leaves unassigned in those modes
55
+ ([artoolkit5-wasm#23](https://github.com/AR-js-org/artoolkit5-wasm/issues/23)); see
56
+ `docs/DESIGN-detector-and-barcode.md` §9 for the full analysis. `examples/barcode/`
57
+ gained a detection-mode switcher and a per-frame detection log demonstrating it.
58
+ - **Match confidence, and a per-family `minConfidence` filter.** `MarkerPose` gains
59
+ `confidence` (0–1, read from the matching family's own `cfPatt`/`cfMatrix`), and
60
+ `configureDetector` gains `minConfidence: { pattern?, barcode? }`.
61
+
62
+ Unlike every other detector option this one never reaches the engine: ARToolKit's
63
+ confidence cutoff is a compile-time constant with no setter, so the threshold is
64
+ applied by `processFrame` and can only ever be stricter than the built-in 0.5.
65
+
66
+ The families take separate thresholds because their confidences are not comparable,
67
+ and **both default to `0`** — nothing is filtered unless you ask for it. Measured on a
68
+ real camera, the genuine and false ranges overlap for both families: a genuine pattern
69
+ match scored `0.506` against a false one at `0.554`, and a genuine barcode scored
70
+ `0.500` at an awkward angle while a phantom barcode reached `0.867`. The same barcode
71
+ marker ranged `0.500`–`0.967` across viewing angles. Confidence is a continuous quality
72
+ score for both families rather than a verdict, so no threshold avoids both missed
73
+ markers and admitted phantoms; the README documents the measurements and the trade-off.
74
+ ([#38](https://github.com/AR-js-org/artoolkit5-ts/issues/38))
75
+ - `examples/barcode/`, tracking a 3x3 matrix code marker. `examples/index.html`
76
+ now links to both examples.
77
+
78
+ ### Changed
79
+
80
+ - **`configureDetector`'s option values now use spellings also used by AR.js.** This is a
81
+ deliberate public-vocabulary choice; the `artoolkit5-js` peer exposes raw numeric modes
82
+ rather than these strings:
83
+
84
+ | was | now |
85
+ |---|---|
86
+ | `'color+matrix'` | `'color_and_matrix'` |
87
+ | `'mono+matrix'` | `'mono_and_matrix'` |
88
+ | `'black-region'` / `'white-region'` | `'black_region'` / `'white_region'` |
89
+ | `'auto-median'` / `'auto-otsu'` / `'auto-bracketing'` | `'auto_median'` / `'auto_otsu'` / `'auto_bracketing'` |
90
+ | `'3x3_hamming63'`, `'4x4_bch_13_9_3'`, … | `'3x3_HAMMING63'`, `'4x4_BCH_13_9_3'`, … |
91
+ | option `pattRatio` | option `patternRatio` |
92
+
93
+ `'matrix'` keeps its name — AR.js exposes no equivalent. `thresholdMode` and
94
+ `imageProcMode` have no AR.js counterpart at all, so their values simply follow
95
+ the same snake_case convention for internal consistency.
96
+
97
+ This deliberately inherits one wart from AR.js: snake_case for mode names but
98
+ SCREAMING_SNAKE for matrix algorithm suffixes. Matching the ecosystem was judged
99
+ worth more than tidiness in isolation. ([#34](https://github.com/AR-js-org/artoolkit5-ts/issues/34))
100
+
101
+ - **`FrameResult.lost` is now `LostMarker[]` rather than `number[]`.** It carries
102
+ `type` alongside `id` because the two families have independent ID spaces, so an
103
+ ID on its own can no longer say which marker disappeared. Unlike the respellings
104
+ above this one is silent in plain JavaScript — the array is still iterable and
105
+ still the right length, the elements are simply objects now.
106
+
107
+ - Depends on `@ar-js-org/artoolkit5-wasm@^0.3.0`, up from `^0.1.3`. `0.3.0` is required,
108
+ not merely preferred: it is the first release to bind `idPatt`/`idMatrix`, without
109
+ which the combined detection modes silently report nothing or the wrong marker.
110
+
111
+ ### Removed
112
+
113
+ - **`ARToolKitState.markers`**, replaced by the `patternMarkers` and `barcodeMarkers`
114
+ registries described under Added. There is no combined view: the two families have
115
+ independent ID spaces, so merging them back into one map is exactly the collision
116
+ the split exists to prevent.
117
+
118
+ ### Notes
119
+
120
+ `thresholdMode: 'auto_adaptive'` is not offered: the WebARKitLib build this
121
+ library ships compiles that mode's implementation out, and passing it would
122
+ silently degrade to `'manual'`.
123
+
124
+ `matrixCodeType: 'global_id'` is not offered either. The engine decodes that
125
+ mode into `markerInfo->globalID`, a 64-bit field the WASM binding does not
126
+ expose ([artoolkit5-wasm#29](https://github.com/AR-js-org/artoolkit5-wasm/issues/29)),
127
+ so nothing here can read the result. Worse than unreadable, it would alias:
128
+ the engine also reports the code through `idMatrix`, where a global ID below
129
+ 32768 arrives as itself but every larger one arrives as `0`. A barcode
130
+ registered as `0` would match every large global-ID marker in view. Re-adding
131
+ the option once the field is bound is a non-breaking addition.
132
+ ([#41](https://github.com/AR-js-org/artoolkit5-ts/issues/41))
133
+
134
+ ## [0.1.0] - 2026-08-16
135
+
136
+ ### Added
137
+
138
+ - `createARToolKitState` / `disposeARToolKitState` — lifecycle. Dispose calls
139
+ the core's `teardown()` and then Embind's `delete()`; skipping the first leaks
140
+ the ARToolKit handles the instance owns. Idempotent.
141
+ - `ARToolKitError`, thrown by every operation called on a disposed state, so a
142
+ use-after-dispose names the misused function instead of crashing somewhere
143
+ inside the WASM module.
144
+ - `loadPatternMarker` and `trackMarker` for registering markers.
145
+ - `processFrame`, returning `{ detected, lost }`.
146
+ - `getCameraProjectionMatrix`, `transMatToGLMat` and `arglCameraViewRHf`.
147
+ - Vitest suite covering the matrix maths, the visibility state machine and the
148
+ dispose lifecycle, running without WASM or a browser against a mocked core.
149
+ - CI on Node 22 and 24: typecheck, test, build, and a packaging check.
150
+ - Release workflow, run manually with a version. It runs the checks, sets the
151
+ version, promotes this changelog, derives notes from the commits, tags,
152
+ creates the GitHub Release and publishes to npm with provenance. A `dry_run`
153
+ input rehearses all of it without tagging or publishing.
154
+ - `scripts/release-notes.mjs`, which groups Conventional Commits since the
155
+ previous tag so release notes reflect what actually landed, and
156
+ `scripts/promote-changelog.mjs`, which promotes the Unreleased section.
157
+ - Webcam example: camera to Three.js cube overlay.
158
+ - This changelog.
159
+
160
+ ### Changed
161
+
162
+ - `processFrame` returns `{ detected, lost }` rather than `MarkerPose[]`. The
163
+ visibility transition was already computed internally and then discarded,
164
+ forcing consumers to diff successive results to recover it.
165
+ - Named `@ar-js-org/artoolkit5-ts`, matching the rest of the organisation.
166
+ - Depends on `@ar-js-org/artoolkit5-wasm@^0.1.3` from npm rather than a pinned
167
+ git commit. `three` moved to `devDependencies`; only the examples use it.
168
+
169
+ ### Fixed
170
+
171
+ - `arglCameraViewRHf` allocated a `Float64Array` while every type declaration
172
+ promised `Float32Array`. Consumers reading `matrixGL` would have received a
173
+ different array type than the published types described, and the AR.js-next
174
+ marker event contract specifies `Float32Array(16)`.
175
+ - `processFrame` allocated roughly three typed arrays per marker per frame. Both
176
+ matrix helpers now write into caller-supplied buffers, with one module-scoped
177
+ scratch array for the intermediate 4×4.
178
+ - Debug logging removed from `src/`, which dumped the entire WASM module to the
179
+ console on every marker load and every `trackMarker` call.
180
+ - `favicon.svg` and orphaned `.d.ts.map` files no longer ship in the package.
181
+
182
+ ### Notes
183
+
184
+ Pattern markers only. Barcode support is planned; NFT is out of scope for this
185
+ project. Worker compatibility is untested — nothing in `src/` touches the DOM,
186
+ which is necessary but not proof.
187
+
188
+ [Unreleased]: https://github.com/AR-js-org/artoolkit5-ts/compare/v0.2.0...HEAD
189
+ [0.2.0]: https://github.com/AR-js-org/artoolkit5-ts/compare/v0.1.0...v0.2.0
190
+ [0.1.0]: https://github.com/AR-js-org/artoolkit5-ts/releases/tag/v0.1.0
package/LICENSE CHANGED
@@ -1,28 +1,28 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 AR-js-org
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
22
-
23
- ---
24
-
25
- This library wraps a WebAssembly build of ARToolkit5 (WebARKitLib), which is
26
- licensed under the GNU Lesser General Public License v3.0. Redistributing a
27
- build that includes the ARToolkit5 (WebARKitLib) WebAssembly binary carries the
28
- obligations of that licence in addition to the terms above.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AR-js-org
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ This library wraps a WebAssembly build of ARToolkit5 (WebARKitLib), which is
26
+ licensed under the GNU Lesser General Public License v3.0. Redistributing a
27
+ build that includes the ARToolkit5 (WebARKitLib) WebAssembly binary carries the
28
+ obligations of that licence in addition to the terms above.