@webarkit/ar-nft
Advanced tools
Comparing version 0.14.2 to 0.14.3
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ # Contributor Covenant Code of Conduct |
@@ -0,0 +0,0 @@ # Welcome to ARnft contributing guide <!-- omit in toc --> |
{ | ||
"name": "@webarkit/ar-nft", | ||
"version": "0.14.2", | ||
"version": "0.14.3", | ||
"main": "dist/ARnft.js", | ||
@@ -41,16 +41,16 @@ "types": "types/src/index.d.ts", | ||
"@types/stats.js": "^0.17.0", | ||
"@types/uuid": "^8.3.4", | ||
"prettier": "^2.7.1", | ||
"@types/uuid": "^9.0.0", | ||
"prettier": "^2.8.1", | ||
"rimraf": "^3.0.2", | ||
"stats.js": "^0.17.0", | ||
"ts-loader": "^9.4.1", | ||
"typedoc": "^0.23.21", | ||
"typescript": "^4.8.4", | ||
"ts-loader": "^9.4.2", | ||
"typedoc": "^0.23.22", | ||
"typescript": "^4.9.4", | ||
"webpack": "^5.75.0", | ||
"webpack-cli": "^4.10.0", | ||
"webpack-cli": "^5.0.1", | ||
"worker-loader": "^3.0.8" | ||
}, | ||
"scripts": { | ||
"build-ts": "rimraf ./build && tsc && webpack --mode production", | ||
"dev-ts": "rimraf ./build && tsc && webpack --mode development --progress --watch", | ||
"build-ts": "rimraf ./dist && tsc && webpack --mode production", | ||
"dev-ts": "rimraf ./dist && tsc && webpack --mode development --progress --watch", | ||
"docs": "typedoc", | ||
@@ -63,3 +63,3 @@ "format-check": "prettier --check .", | ||
"dependencies": { | ||
"@webarkit/jsartoolkit-nft": "^1.1.6", | ||
"@webarkit/jsartoolkit-nft": "^1.2.0", | ||
"terser-webpack-plugin": "^5.3.6", | ||
@@ -66,0 +66,0 @@ "uuid": "^9.0.0" |
@@ -0,0 +0,0 @@ import Container from "./utils/html/Container"; |
export {}; | ||
//# sourceMappingURL=ConfigData.js.map |
@@ -0,0 +0,0 @@ import ARnft from "./ARnft"; |
@@ -0,0 +0,0 @@ import Worker from "worker-loader?inline=no-fallback!./Worker"; |
@@ -0,0 +0,0 @@ export class CameraViewRenderer { |
@@ -0,0 +0,0 @@ const target = window || global; |
@@ -0,0 +0,0 @@ export default class Container { |
@@ -25,3 +25,3 @@ import jsartoolkitnft from "jsartoolkitnft"; | ||
let markerResult = null; | ||
const load = (msg) => { | ||
const load = async (msg) => { | ||
const basePath = self.origin; | ||
@@ -32,3 +32,3 @@ let cameraParamUrl; | ||
console.debug("Base path:", basePath); | ||
const onLoad = (arController) => { | ||
const onLoad = async (arController) => { | ||
ar = arController; | ||
@@ -65,10 +65,16 @@ const cameraMatrix = ar.getCameraMatrix(); | ||
console.debug("Loading NFT marker at: ", nftMarkerUrls); | ||
ar.loadNFTMarkers(nftMarkerUrls, (id) => { | ||
let marker = ar.getNFTData(ar.id, 0); | ||
await ar | ||
.loadNFTMarkers(nftMarkerUrls, (id) => { | ||
var m = 0; | ||
let marker = ar.getNFTData(id[m], 0); | ||
ctx.postMessage({ type: "markerInfos", marker: marker }); | ||
ar.trackNFTMarkerId(id); | ||
console.log("loadNFTMarker -> ", id); | ||
console.log(id); | ||
ar.trackNFTMarkerId(id[m]); | ||
console.log("loadNFTMarker -> ", id[m]); | ||
console.log(id[m]); | ||
ctx.postMessage({ type: "endLoading", end: true }); | ||
}).catch((err) => { | ||
m++; | ||
}, (err) => { | ||
console.error("Error: ", err, " loading marker in loadNFTMarkers!"); | ||
}) | ||
.catch((err) => { | ||
console.error("Error in loading marker on Worker", err); | ||
@@ -75,0 +81,0 @@ }); |
{ | ||
"name": "@webarkit/ar-nft", | ||
"version": "0.14.2", | ||
"version": "0.14.3", | ||
"main": "dist/ARnft.js", | ||
@@ -41,16 +41,16 @@ "types": "types/src/index.d.ts", | ||
"@types/stats.js": "^0.17.0", | ||
"@types/uuid": "^8.3.4", | ||
"prettier": "^2.7.1", | ||
"@types/uuid": "^9.0.0", | ||
"prettier": "^2.8.1", | ||
"rimraf": "^3.0.2", | ||
"stats.js": "^0.17.0", | ||
"ts-loader": "^9.4.1", | ||
"typedoc": "^0.23.21", | ||
"typescript": "^4.8.4", | ||
"ts-loader": "^9.4.2", | ||
"typedoc": "^0.23.22", | ||
"typescript": "^4.9.4", | ||
"webpack": "^5.75.0", | ||
"webpack-cli": "^4.10.0", | ||
"webpack-cli": "^5.0.1", | ||
"worker-loader": "^3.0.8" | ||
}, | ||
"scripts": { | ||
"build-ts": "rimraf ./build && tsc && webpack --mode production", | ||
"dev-ts": "rimraf ./build && tsc && webpack --mode development --progress --watch", | ||
"build-ts": "rimraf ./dist && tsc && webpack --mode production", | ||
"dev-ts": "rimraf ./dist && tsc && webpack --mode development --progress --watch", | ||
"docs": "typedoc", | ||
@@ -63,3 +63,3 @@ "format-check": "prettier --check .", | ||
"dependencies": { | ||
"@webarkit/jsartoolkit-nft": "^1.1.6", | ||
"@webarkit/jsartoolkit-nft": "^1.2.0", | ||
"terser-webpack-plugin": "^5.3.6", | ||
@@ -66,0 +66,0 @@ "uuid": "^9.0.0" |
@@ -0,0 +0,0 @@  |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -42,3 +42,3 @@ /* | ||
private markerURL: any; | ||
private markerURL: Array<string>; | ||
@@ -211,3 +211,3 @@ private _processing: boolean = false; | ||
public found(msg: any) { | ||
let world: any; | ||
let world: Float64Array; | ||
if (!msg) { | ||
@@ -242,3 +242,3 @@ // commenting out this routine see https://github.com/webarkit/ARnft/pull/184#issuecomment-853400903 | ||
public getMarkerUrl(): string { | ||
public getMarkerUrl(): Array<string> { | ||
return this.markerURL; | ||
@@ -245,0 +245,0 @@ } |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -39,5 +39,7 @@ /* eslint-env worker */ | ||
const { ARControllerNFT } = jsartoolkitnft; | ||
import { AbstractARControllerNFT } from "@webarkit/jsartoolkit-nft/types/src/abstractions/AbstractARControllerNFT"; | ||
import { IImageObj } from "@webarkit/jsartoolkit-nft/types/src/abstractions/CommonInterfaces"; | ||
const ctx: Worker = self as any; | ||
ctx.onmessage = (e) => { | ||
ctx.onmessage = (e: MessageEvent<any>) => { | ||
const msg = e.data; | ||
@@ -60,8 +62,27 @@ switch (msg.type) { | ||
let next: any = null; | ||
type GetNftMarkerData = { | ||
index: number; | ||
type: number; | ||
marker: { | ||
id: number; | ||
error: number; | ||
found: boolean; | ||
pose: number[]; | ||
}; | ||
matrix: Float64Array; | ||
matrixGL_RH: Float64Array; | ||
}; | ||
type GetNftMarkerEventArgs = { | ||
name: "getNFTMarker"; | ||
data: GetNftMarkerData; | ||
target: any; | ||
}; | ||
let next: IImageObj = null; | ||
let lastFrame: number = 0; | ||
let ar: any = null; | ||
let ar: AbstractARControllerNFT | null = null; | ||
let markerResult: any = null; | ||
const load = (msg: any) => { | ||
const load = async (msg: any) => { | ||
const basePath = self.origin; | ||
@@ -72,7 +93,7 @@ let cameraParamUrl: string; | ||
console.debug("Base path:", basePath); | ||
const onLoad = (arController: any) => { | ||
const onLoad = async (arController: AbstractARControllerNFT) => { | ||
ar = arController; | ||
const cameraMatrix = ar.getCameraMatrix(); | ||
ar.addEventListener("getNFTMarker", (ev: any) => { | ||
ar.addEventListener("getNFTMarker", (ev: GetNftMarkerEventArgs) => { | ||
markerResult = { | ||
@@ -107,12 +128,22 @@ type: "found", | ||
ar.loadNFTMarkers(nftMarkerUrls, (id: number) => { | ||
let marker = ar.getNFTData(ar.id, 0); | ||
ctx.postMessage({ type: "markerInfos", marker: marker }); | ||
ar.trackNFTMarkerId(id); | ||
console.log("loadNFTMarker -> ", id); | ||
console.log(id); | ||
ctx.postMessage({ type: "endLoading", end: true }); | ||
}).catch((err: any) => { | ||
console.error("Error in loading marker on Worker", err); | ||
}); | ||
await ar | ||
.loadNFTMarkers( | ||
nftMarkerUrls, | ||
(id: number[]) => { | ||
var m = 0; | ||
let marker = ar.getNFTData(id[m], 0); | ||
ctx.postMessage({ type: "markerInfos", marker: marker }); | ||
ar.trackNFTMarkerId(id[m]); | ||
console.log("loadNFTMarker -> ", id[m]); | ||
console.log(id[m]); | ||
ctx.postMessage({ type: "endLoading", end: true }); | ||
m++; | ||
}, | ||
(err: number) => { | ||
console.error("Error: ", err, " loading marker in loadNFTMarkers!"); | ||
} | ||
) | ||
.catch((err: string) => { | ||
console.error("Error in loading marker on Worker", err); | ||
}); | ||
@@ -145,3 +176,3 @@ ctx.postMessage({ type: "loaded", proj: JSON.stringify(cameraMatrix) }); | ||
const process = (next: any, frame: number) => { | ||
const process = (next: IImageObj, frame: number) => { | ||
if (frame !== lastFrame) { | ||
@@ -148,0 +179,0 @@ markerResult = null; |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ import { ConfigData } from "./config/ConfigData"; |
@@ -0,0 +0,0 @@ export interface ConfigData { |
@@ -0,0 +0,0 @@ import ARnft from "./ARnft"; |
@@ -20,5 +20,5 @@ export default class NFTWorker { | ||
getName(): string; | ||
getMarkerUrl(): string; | ||
getMarkerUrl(): Array<string>; | ||
getEventTarget(): EventTarget; | ||
destroy(): void; | ||
} |
@@ -0,0 +0,0 @@ import { VideoSettingData } from "../config/ConfigData"; |
@@ -0,0 +0,0 @@ export declare function degreesToRadians(degrees: number): number; |
@@ -0,0 +0,0 @@ import { ConfigData } from "../../config/ConfigData"; |
export {}; |
@@ -0,0 +0,0 @@ const path = require('path') |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1
2036361
45
5465