Skip to content

Commit

Permalink
latest changes before release 1.6.1
Browse files Browse the repository at this point in the history
- improving docs and prettifying
  • Loading branch information
kalwalt committed Nov 22, 2023
1 parent 6d5ee50 commit 7a9524e
Show file tree
Hide file tree
Showing 15 changed files with 123 additions and 124 deletions.
11 changes: 3 additions & 8 deletions js/artoolkitNFT_ES6_custom.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,9 @@ function load(msg) {
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
ARControllerNFT.customInit(
msg.pw,
msg.ph,
msg.camera_para,
function () {
console.log("Message from the callback.");
}
)
ARControllerNFT.customInit(msg.pw, msg.ph, msg.camera_para, function () {
console.log("Message from the callback.");
})
.then(onLoad)
.catch(onError);
}
Expand Down
6 changes: 1 addition & 5 deletions js/artoolkitNFT_ES6_gray.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,7 @@ function load(msg) {
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
ARControllerNFT.initWithDimensions(
width,
height,
msg.camera_para
)
ARControllerNFT.initWithDimensions(width, height, msg.camera_para)
.then(onLoad)
.catch(onError);
}
Expand Down
20 changes: 10 additions & 10 deletions js/artoolkitNFT_multi_ES6.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,21 @@ function load(msg) {
ar.loadNFTMarkers(msg.marker, function (ids) {
for (var i = 0; i < ids.length; i++) {
ar.trackNFTMarkerId(i);
nftMarkers.push_back(ar.getNFTData(i,i));
nftMarkers.push_back(ar.getNFTData(i, i));
}

marker1 = ar.getNFTData(ids[0], 0);
marker2 = ar.getNFTData(ids[1], 1);
marker3 = ar.getNFTData(ids[2], 2);

nftMarkers.push_back(marker1);

console.log("Array of nftData: ", [nftMarkers.get(0), nftMarkers.get(1), nftMarkers.get(2)]);

console.log("Array of nftData: ", [
nftMarkers.get(0),
nftMarkers.get(1),
nftMarkers.get(2),
]);

postMessage({
type: "markerInfos",
marker1: marker1,
Expand All @@ -120,11 +124,7 @@ function load(msg) {
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
ARControllerNFT.initWithDimensions(
msg.pw,
msg.ph,
msg.camera_para
)
ARControllerNFT.initWithDimensions(msg.pw, msg.ph, msg.camera_para)
.then(onLoad)
.catch(onError);
}
Expand Down
20 changes: 10 additions & 10 deletions src/ARControllerNFT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
static async initWithDimensions(
width: number,
height: number,
cameraParam: string
cameraParam: string,
): Promise<ARControllerNFT> {
// directly init with given width / height
const arControllerNFT = new ARControllerNFT(width, height, cameraParam);
Expand Down Expand Up @@ -198,7 +198,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
*/
static async initWithImage(
image: IImageObj,
cameraParam: string
cameraParam: string,
): Promise<ARControllerNFT> {
const width = image.videoWidth || image.width;
const height = image.videoHeight || image.height;
Expand Down Expand Up @@ -237,7 +237,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
width: number,
height: number,
cameraParam: string,
callback: () => void
callback: () => void,
): Promise<ARControllerNFT> {
const arControllerNFT = new ARControllerNFT(width, height, cameraParam);
callback();
Expand Down Expand Up @@ -495,7 +495,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
transMatToGLMat(
transMat: Float64Array,
glMat: Float64Array,
scale?: number
scale?: number,
): Float64Array {
if (glMat == undefined) {
glMat = new Float64Array(16);
Expand Down Expand Up @@ -538,7 +538,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
arglCameraViewRHf(
glMatrix: Float64Array,
glRhMatrix?: Float64Array,
scale?: number
scale?: number,
): Float64Array {
let m_modelview;
if (glRhMatrix == undefined) {
Expand Down Expand Up @@ -746,15 +746,15 @@ export class ARControllerNFT implements AbstractARControllerNFT {
async loadNFTMarker(
urlOrData: string,
onSuccess: (ids: number) => void,
onError: (err: number) => void
onError: (err: number) => void,
): Promise<number[]> {
let nft = await this.artoolkitNFT.addNFTMarkers(
[urlOrData],
(ids: number[]) => {
this.nftMarkerCount += ids.length;
onSuccess(ids[0]);
},
onError
onError,
);
return nft;
}
Expand All @@ -766,15 +766,15 @@ export class ARControllerNFT implements AbstractARControllerNFT {
async loadNFTMarkers(
urlOrData: Array<string>,
onSuccess: (ids: number[]) => void,
onError: (err: number) => void
onError: (err: number) => void,
): Promise<number[]> {
let nft = await this.artoolkitNFT.addNFTMarkers(
urlOrData,
(ids: number[]) => {
this.nftMarkerCount += ids.length;
onSuccess(ids);
},
onError
onError,
);
return nft;
}
Expand Down Expand Up @@ -851,7 +851,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
console.log(
"[ARControllerNFT]",
"Camera params loaded with ID",
this.cameraId
this.cameraId,
);

// setup
Expand Down
20 changes: 10 additions & 10 deletions src/ARControllerNFT_simd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
static async initWithDimensions(
width: number,
height: number,
cameraParam: string
cameraParam: string,
): Promise<ARControllerNFT> {
// directly init with given width / height
const arControllerNFT = new ARControllerNFT(width, height, cameraParam);
Expand Down Expand Up @@ -198,7 +198,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
*/
static async initWithImage(
image: IImageObj,
cameraParam: string
cameraParam: string,
): Promise<ARControllerNFT> {
const width = image.videoWidth || image.width;
const height = image.videoHeight || image.height;
Expand Down Expand Up @@ -237,7 +237,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
width: number,
height: number,
cameraParam: string,
callback: () => void
callback: () => void,
): Promise<ARControllerNFT> {
const arControllerNFT = new ARControllerNFT(width, height, cameraParam);
callback();
Expand Down Expand Up @@ -495,7 +495,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
transMatToGLMat(
transMat: Float64Array,
glMat: Float64Array,
scale?: number
scale?: number,
): Float64Array {
if (glMat == undefined) {
glMat = new Float64Array(16);
Expand Down Expand Up @@ -538,7 +538,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
arglCameraViewRHf(
glMatrix: Float64Array,
glRhMatrix?: Float64Array,
scale?: number
scale?: number,
): Float64Array {
let m_modelview;
if (glRhMatrix == undefined) {
Expand Down Expand Up @@ -746,15 +746,15 @@ export class ARControllerNFT implements AbstractARControllerNFT {
async loadNFTMarker(
urlOrData: string,
onSuccess: (ids: number) => void,
onError: (err: number) => void
onError: (err: number) => void,
): Promise<number[]> {
let nft = await this.artoolkitNFT.addNFTMarkers(
[urlOrData],
(ids: number[]) => {
this.nftMarkerCount += ids.length;
onSuccess(ids[0]);
},
onError
onError,
);
return nft;
}
Expand All @@ -766,15 +766,15 @@ export class ARControllerNFT implements AbstractARControllerNFT {
async loadNFTMarkers(
urlOrData: Array<string>,
onSuccess: (ids: number[]) => void,
onError: (err: number) => void
onError: (err: number) => void,
): Promise<number[]> {
let nft = await this.artoolkitNFT.addNFTMarkers(
urlOrData,
(ids: number[]) => {
this.nftMarkerCount += ids.length;
onSuccess(ids);
},
onError
onError,
);
return nft;
}
Expand Down Expand Up @@ -851,7 +851,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
console.log(
"[ARControllerNFT]",
"Camera params loaded with ID",
this.cameraId
this.cameraId,
);

// setup
Expand Down
20 changes: 10 additions & 10 deletions src/ARControllerNFT_td.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
static async initWithDimensions(
width: number,
height: number,
cameraParam: string
cameraParam: string,
): Promise<ARControllerNFT> {
// directly init with given width / height
const arControllerNFT = new ARControllerNFT(width, height, cameraParam);
Expand Down Expand Up @@ -198,7 +198,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
*/
static async initWithImage(
image: IImageObj,
cameraParam: string
cameraParam: string,
): Promise<ARControllerNFT> {
const width = image.videoWidth || image.width;
const height = image.videoHeight || image.height;
Expand Down Expand Up @@ -237,7 +237,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
width: number,
height: number,
cameraParam: string,
callback: () => void
callback: () => void,
): Promise<ARControllerNFT> {
const arControllerNFT = new ARControllerNFT(width, height, cameraParam);
callback();
Expand Down Expand Up @@ -495,7 +495,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
transMatToGLMat(
transMat: Float64Array,
glMat: Float64Array,
scale?: number
scale?: number,
): Float64Array {
if (glMat == undefined) {
glMat = new Float64Array(16);
Expand Down Expand Up @@ -538,7 +538,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
arglCameraViewRHf(
glMatrix: Float64Array,
glRhMatrix?: Float64Array,
scale?: number
scale?: number,
): Float64Array {
let m_modelview;
if (glRhMatrix == undefined) {
Expand Down Expand Up @@ -746,15 +746,15 @@ export class ARControllerNFT implements AbstractARControllerNFT {
async loadNFTMarker(
urlOrData: string,
onSuccess: (ids: number) => void,
onError: (err: number) => void
onError: (err: number) => void,
): Promise<number[]> {
let nft = await this.artoolkitNFT.addNFTMarkers(
[urlOrData],
(ids: number[]) => {
this.nftMarkerCount += ids.length;
onSuccess(ids[0]);
},
onError
onError,
);
return nft;
}
Expand All @@ -766,15 +766,15 @@ export class ARControllerNFT implements AbstractARControllerNFT {
async loadNFTMarkers(
urlOrData: Array<string>,
onSuccess: (ids: number[]) => void,
onError: (err: number) => void
onError: (err: number) => void,
): Promise<number[]> {
let nft = await this.artoolkitNFT.addNFTMarkers(
urlOrData,
(ids: number[]) => {
this.nftMarkerCount += ids.length;
onSuccess(ids);
},
onError
onError,
);
return nft;
}
Expand Down Expand Up @@ -851,7 +851,7 @@ export class ARControllerNFT implements AbstractARControllerNFT {
console.log(
"[ARControllerNFT]",
"Camera params loaded with ID",
this.cameraId
this.cameraId,
);

// setup
Expand Down
Loading

0 comments on commit 7a9524e

Please sign in to comment.