Skip to content

Commit

Permalink
improved README and prettifying
Browse files Browse the repository at this point in the history
  • Loading branch information
kalwalt committed Feb 14, 2023
1 parent c71a79e commit 0021c3d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 38 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Try the example !! [www.webarkit.org/examples/artoolkitnft_es6_example](https://
## Features
### Markers Types

**JSARToolKitNFT** support only this types of markers:
**JSARToolKitNFT** support only this type of markers:

- NFT (natural feature tracking) markers ✅ 🎉 🎨
- Multi NFT markers !!!
Expand All @@ -40,7 +40,7 @@ has **WASM** embedded in a single file!
## Using the library 💥
You can use raw.githack.com links:

**WASM** version of the library:
**WASM** version of the library (deprecated it will be removed in a future release):

```html
<script src="https://raw.githack.com/webarkit/jsartoolkitNFT/master/build/artoolkitNFT_wasm.js">
Expand All @@ -58,7 +58,7 @@ You can use raw.githack.com links:
<script src="https://raw.githack.com/webarkit/jsartoolkitNFT/master/build/artoolkitNFT_embed_ES6_wasm.js">
```
**NO WASM** minified (deprecated):
**NO WASM** minified (deprecated it will be removed in a future release):
```html
<script src="https://raw.githack.com/webarkit/jsartoolkitNFT/master/build/artoolkitNFT.min.js">
Expand Down Expand Up @@ -93,7 +93,7 @@ or you can clone the repository with git, follow the instructions below:
- create a link in the `jsartoolkitNFT/emscripten/` directory that points to WebARKitLib (`jsartoolkitNFT/emscripten/WebARKitLib`) (Linux and macOS only)
- or, set the `WEBARKITLIB_ROOT` environment variable to point to your WebARKitLib clone
- or, change the `tools/makem.js` file to point to your WebARKitLib clone (line 32)
- or, change the `tools/makem.js` file to point to your WebARKitLib clone (line 32-33)
## Documentation
Expand Down
64 changes: 32 additions & 32 deletions js/artoolkitNFT.embed_ES6_worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ARToolkitNFT from "../build/artoolkitNFT_embed_ES6_wasm.js"
import ARToolkitNFT from "../build/artoolkitNFT_embed_ES6_wasm.js";

self.onmessage = function (e) {
var msg = e.data;
Expand All @@ -23,44 +23,44 @@ var marker;
async function load(msg) {
const arTK = await ARToolkitNFT();
//self.addEventListener("artoolkitNFT-loaded", function () {
console.debug("Loading marker at: ", msg.marker);
console.log(arTK);
console.debug("Loading marker at: ", msg.marker);
console.log(arTK);

var onLoad = function () {
ar = new arTK.ARControllerNFT(msg.pw, msg.ph, param);
console.log(ar);
var cameraMatrix = ar.getCameraMatrix();
var onLoad = function () {
ar = new arTK.ARControllerNFT(msg.pw, msg.ph, param);
console.log(ar);
var cameraMatrix = ar.getCameraMatrix();

ar.addEventListener("getNFTMarker", function (ev) {
markerResult = {
type: "found",
matrixGL_RH: JSON.stringify(ev.data.matrixGL_RH),
};
});
ar.addEventListener("getNFTMarker", function (ev) {
markerResult = {
type: "found",
matrixGL_RH: JSON.stringify(ev.data.matrixGL_RH),
};
});

ar.loadNFTMarker(msg.marker, function (id) {
ar.trackNFTMarkerId(id);
let marker = ar.getNFTData(id, 0);
console.log("nftMarker data: ", marker);
postMessage({ type: "markerInfos", marker: marker });
console.log("loadNFTMarker -> ", id);
postMessage({ type: "endLoading", end: true }),
function (err) {
console.error("Error in loading marker on Worker", err);
};
});
ar.loadNFTMarker(msg.marker, function (id) {
ar.trackNFTMarkerId(id);
let marker = ar.getNFTData(id, 0);
console.log("nftMarker data: ", marker);
postMessage({ type: "markerInfos", marker: marker });
console.log("loadNFTMarker -> ", id);
postMessage({ type: "endLoading", end: true }),
function (err) {
console.error("Error in loading marker on Worker", err);
};
});

postMessage({ type: "loaded", proj: JSON.stringify(cameraMatrix) });
};
postMessage({ type: "loaded", proj: JSON.stringify(cameraMatrix) });
};

var onError = function (error) {
console.error(error);
};
var onError = function (error) {
console.error(error);
};

console.debug("Loading camera at:", msg.camera_para);
console.debug("Loading camera at:", msg.camera_para);

// we cannot pass the entire ARControllerNFT, so we re-create one inside the Worker, starting from camera_param
var param = new arTK.ARCameraParamNFT(msg.camera_para, onLoad, onError);
// we cannot pass the entire ARControllerNFT, so we re-create one inside the Worker, starting from camera_param
var param = new arTK.ARCameraParamNFT(msg.camera_para, onLoad, onError);
//});//event listener
}

Expand Down
2 changes: 1 addition & 1 deletion src/ARControllerNFT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ export default class ARControllerNFT implements AbstractARControllerNFT {
data = sourceImage.data;
}

// Here we have access to the unmodified video image. We now need to add the videoLuma chanel to be able to serve the underlying ARTK API
// Here we have access to the unmodified video image. We now need to add the videoLuma chanel to be able to serve the underlying ARTK API
if (this.videoLuma) {
if (this.grayscaleEnabled == false) {
let q = 0;
Expand Down
3 changes: 2 additions & 1 deletion tools/makem.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ FLAGS += " -s ALLOW_MEMORY_GROWTH=1";
var WASM_FLAGS = " -s SINGLE_FILE=1";
var SIMD128_FLAGS = " -msimd128";
var ES6_FLAGS = " -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0 -s MODULARIZE=1";
var ES6_EMBED_ES6_FLAGS = " -s EXPORT_ES6=1 -s EXPORT_NAME='ARToolkitNFT' -s MODULARIZE=1";
var ES6_EMBED_ES6_FLAGS =
" -s EXPORT_ES6=1 -s EXPORT_NAME='ARToolkitNFT' -s MODULARIZE=1";

var PRE_FLAGS =
" --pre-js " + path.resolve(__dirname, "../js/artoolkitNFT.api.js");
Expand Down

0 comments on commit 0021c3d

Please sign in to comment.