Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@webarkit/ar-nft

Package Overview
Dependencies
Maintainers
0
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webarkit/ar-nft - npm Package Compare versions

Comparing version 0.14.9 to 0.14.10

2

CONTRIBUTING.md

@@ -48,3 +48,3 @@ # Welcome to ARnft contributing guide <!-- omit in toc -->

3. Install or update to **Node.js v14**.
3. Install or update to **Node.js v20**.

@@ -51,0 +51,0 @@ 4. Create a working branch from the dev branch and start with your changes!

{
"name": "@webarkit/ar-nft",
"version": "0.14.9",
"version": "0.14.10",
"main": "dist/ARnft.js",

@@ -39,12 +39,12 @@ "types": "types/src/index.d.ts",

"devDependencies": {
"@types/node": "22.7.5",
"@types/node": "22.10.1",
"@types/stats.js": "^0.17.3",
"@types/uuid": "10.0.0",
"prettier": "^3.3.3",
"prettier": "^3.4.2",
"rimraf": "6.0.1",
"stats.js": "^0.17.0",
"ts-loader": "^9.5.1",
"typedoc": "0.26.11",
"typescript": "^5.5.4",
"webpack": "5.96.1",
"typedoc": "0.27.4",
"typescript": "^5.7.2",
"webpack": "5.97.1",
"webpack-cli": "^5.1.4",

@@ -63,4 +63,4 @@ "worker-loader": "^3.0.8"

"dependencies": {
"@webarkit/jsartoolkit-nft": "^1.7.1",
"@webarkit/oneeurofilter-ts": "^0.1.0",
"@webarkit/jsartoolkit-nft": "^1.7.2",
"@webarkit/oneeurofilter-ts": "^0.1.1",
"terser-webpack-plugin": "^5.3.10",

@@ -67,0 +67,0 @@ "uuid": "11.0.3"

@@ -97,3 +97,3 @@ import Container from "./utils/html/Container";

}
var containerEvent = new Event("containerEvent");
const containerEvent = new Event("containerEvent");
document.dispatchEvent(containerEvent);

@@ -153,3 +153,3 @@ this.controllers = [];

}
var containerEvent = new Event("containerEvent");
const containerEvent = new Event("containerEvent");
document.dispatchEvent(containerEvent);

@@ -210,3 +210,3 @@ this.controllers = [];

let terminateWorker = "terminateWorker-" + name;
var event = new Event(terminateWorker);
const event = new Event(terminateWorker);
this.target.dispatchEvent(event);

@@ -222,3 +222,3 @@ }

this.cameraView.destroy();
var event = new Event("stopVideoStreaming");
const event = new Event("stopVideoStreaming");
this.target.dispatchEvent(event);

@@ -225,0 +225,0 @@ }

@@ -66,3 +66,3 @@ import Container from "./utils/html/Container";

else {
throw "markerUrls or entities can't be undefined";
throw new Error("markerUrls or entities can't be undefined");
}

@@ -98,3 +98,3 @@ return await _arnft._initialize(markerUrls, names, params.stats);

}
var containerEvent = new Event("containerEvent");
const containerEvent = new Event("containerEvent");
document.dispatchEvent(containerEvent);

@@ -154,3 +154,3 @@ this.controllers = [];

}
var containerEvent = new Event("containerEvent");
const containerEvent = new Event("containerEvent");
document.dispatchEvent(containerEvent);

@@ -211,3 +211,3 @@ this.controllers = [];

let terminateWorker = "terminateWorker-" + name;
var event = new Event(terminateWorker);
const event = new Event(terminateWorker);
this.target.dispatchEvent(event);

@@ -223,3 +223,3 @@ }

this.cameraView.destroy();
var event = new Event("stopVideoStreaming");
const event = new Event("stopVideoStreaming");
this.target.dispatchEvent(event);

@@ -226,0 +226,0 @@ }

@@ -0,0 +0,0 @@ import ARnft from "./ARnft.simd";

@@ -54,6 +54,6 @@ import Worker from "worker-loader?inline=no-fallback!./Worker";

this.worker.onmessage = (ev) => {
var msg = ev.data;
const msg = ev.data;
switch (msg.type) {
case "loaded": {
var proj = JSON.parse(msg.proj);
const proj = JSON.parse(msg.proj);
const ratioW = pw / w;

@@ -60,0 +60,0 @@ const ratioH = ph / h;

@@ -54,6 +54,6 @@ import Worker from "worker-loader?inline=no-fallback!./Worker.simd";

this.worker.onmessage = (ev) => {
var msg = ev.data;
const msg = ev.data;
switch (msg.type) {
case "loaded": {
var proj = JSON.parse(msg.proj);
const proj = JSON.parse(msg.proj);
const ratioW = pw / w;

@@ -60,0 +60,0 @@ const ratioH = ph / h;

@@ -85,3 +85,3 @@ export class CameraViewRenderer {

this.vh = this._video.videoHeight;
var pscale = 320 / Math.max(this.vw, (this.vh / 3) * 4);
const pscale = 320 / Math.max(this.vw, (this.vh / 3) * 4);
this.w = Math.floor(this.vw * pscale);

@@ -125,4 +125,3 @@ this.h = Math.floor(this.vh * pscale);

}
const stream = await navigator.mediaDevices.getUserMedia(hint);
this._video.srcObject = stream;
this._video.srcObject = await navigator.mediaDevices.getUserMedia(hint);
this._video = await new Promise((resolve) => {

@@ -129,0 +128,0 @@ this._video.onloadedmetadata = () => resolve(this._video);

@@ -6,16 +6,10 @@ const target = window || global;

export function isMobile() {
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
return true;
}
return false;
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
}
export function isIOS() {
if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
return true;
}
return false;
return /iPhone|iPad|iPod/i.test(navigator.userAgent);
}
export function getWindowSize(vw, vh) {
var pscale = 320 / Math.max(vw, (vh / 3) * 4);
var sscale = isMobile() ? window.outerWidth / vw : 1;
const pscale = 320 / Math.max(vw, (vh / 3) * 4);
const sscale = isMobile() ? window.outerWidth / vw : 1;
let sw = vw * sscale;

@@ -35,3 +29,3 @@ let sh = vh * sscale;

}
return response.json();
return await response.json();
}

@@ -38,0 +32,0 @@ catch (error) {

@@ -33,3 +33,3 @@ import { ARControllerNFT } from "jsartoolkitnft";

tickCount += 1;
var mat;
let mat;
if (tickCount > WARM_UP_TOLERANCE) {

@@ -68,3 +68,3 @@ mat = filter.filter(Date.now(), matrixGL_RH);

const reM = regexM.test(msg.marker);
for (var i = 0; i < markerLength; i++) {
for (let i = 0; i < markerLength; i++) {
let nftMarkerUrl;

@@ -92,3 +92,3 @@ if (reM == true) {

.loadNFTMarkers(nftMarkerUrls, (id) => {
var m = 0;
let m = 0;
let marker = ar.getNFTData(id[m], 0);

@@ -95,0 +95,0 @@ ctx.postMessage({ type: "markerInfos", marker: marker });

@@ -33,3 +33,3 @@ import { ARControllerNFT } from "@webarkit/jsartoolkit-nft/dist/ARToolkitNFT_simd";

tickCount += 1;
var mat;
let mat;
if (tickCount > WARM_UP_TOLERANCE) {

@@ -68,3 +68,3 @@ mat = filter.filter(Date.now(), matrixGL_RH);

const reM = regexM.test(msg.marker);
for (var i = 0; i < markerLength; i++) {
for (let i = 0; i < markerLength; i++) {
let nftMarkerUrl;

@@ -92,3 +92,3 @@ if (reM == true) {

.loadNFTMarkers(nftMarkerUrls, (id) => {
var m = 0;
let m = 0;
let marker = ar.getNFTData(id[m], 0);

@@ -95,0 +95,0 @@ ctx.postMessage({ type: "markerInfos", marker: marker });

{
"name": "@webarkit/ar-nft",
"version": "0.14.9",
"version": "0.14.10",
"main": "dist/ARnft.js",

@@ -39,12 +39,12 @@ "types": "types/src/index.d.ts",

"devDependencies": {
"@types/node": "22.7.5",
"@types/node": "22.10.1",
"@types/stats.js": "^0.17.3",
"@types/uuid": "10.0.0",
"prettier": "^3.3.3",
"prettier": "^3.4.2",
"rimraf": "6.0.1",
"stats.js": "^0.17.0",
"ts-loader": "^9.5.1",
"typedoc": "0.26.11",
"typescript": "^5.5.4",
"webpack": "5.96.1",
"typedoc": "0.27.4",
"typescript": "^5.7.2",
"webpack": "5.97.1",
"webpack-cli": "^5.1.4",

@@ -63,4 +63,4 @@ "worker-loader": "^3.0.8"

"dependencies": {
"@webarkit/jsartoolkit-nft": "^1.7.1",
"@webarkit/oneeurofilter-ts": "^0.1.0",
"@webarkit/jsartoolkit-nft": "^1.7.2",
"@webarkit/oneeurofilter-ts": "^0.1.1",
"terser-webpack-plugin": "^5.3.10",

@@ -67,0 +67,0 @@ "uuid": "11.0.3"

@@ -118,3 +118,3 @@ ![github releases](https://flat.badgen.net/github/release/webarkit/ARnft)

- `arNFT_autoupdate_example.html` Example with the autopdate routine.
- `arNFT_autoupdate_example.html` Example with the autoupdate routine.
- `arNFT_container_example.html` Example with an alternative container.

@@ -133,2 +133,3 @@ - `arNFT_event_example.html` Example with objVisibility and eventListener.

- `arNFT_video_example.html` Example showing a video.
- `arNFT_zft_example.html` Example showing a simple cube, loading a .zft file.

@@ -149,2 +150,3 @@ You can try also a live example with React at this link: [kalwalt.github.io/ARnft-ES6-react/](https://kalwalt.github.io/ARnft-ES6-react/)

- **NFT** (**N**atural **F**eature **T**racking) Markers, read my article: [NFT natural feature tracking with jsartoolkit5](https://www.kalwaltart.com/blog/2020/01/21/nft-natural-feature-tracking-with-jsartoolkit5/)
- **ZFT** compressed **NFT** markers with .zft extension, with faster loading time.
- **SIMD** (Single Instruction, Multiple Data) support for enhanced performance.

@@ -151,0 +153,0 @@ - **ES6** standard. You can install it as a npm package and use it as a module (experimental). Install it with npm:

@@ -31,3 +31,3 @@ /*

*
* Copyright 2021 WebARKit.
* Copyright 2021-2024 WebARKit.
*

@@ -50,3 +50,3 @@ * Author(s): Walter Perdan @kalwalt https://github.com/kalwalt

* @param name the name of hte Entity
* @param markerUrl the marker url asscociated
* @param markerUrl the marker url associated
*/

@@ -173,3 +173,3 @@ interface IEntity {

/**
* The initWithEntities function let set-up the NFT markers with a Entity object.
* The initWithEntities function let set up the NFT markers with an Entity object.
* We set an Array of Entity for multiple NFT markers. An Entity is composed of a unique name and

@@ -195,2 +195,22 @@ * a markerUrl.

}
/**
* Initializes the ARnft instance with the provided configuration.
* This method can accept either marker URLs and names or an array of entities.
* It sets up the necessary resources, including the HTML container, stats,
* camera renderer, and NFT workers. Used internally by the initWithEntities method.
*
* @param params - The configuration parameters for initialization.
* @param params.width - The width in pixels of the video camera.
* @param params.height - The height in pixels of the video camera.
* @param params.configUrl - The URL of the config.json file.
* @param params.stats - Optional. True if you want the stats.
* @param params.autoUpdate - Optional. False if you want to maintain it yourself.
* @param params.markerUrls - Optional. An array of arrays of marker URLs.
* @param params.names - Optional. An array of arrays of entity names.
* @param params.entities - Optional. An array of entities.
*
* @returns A promise that resolves to the ARnft object.
*
* @throws Will throw an error if neither markerUrls nor entities are provided.
*/

@@ -220,3 +240,3 @@ static async initWithConfig(params: INameInitConfig | IEntityInitConfig) {

} else {
throw "markerUrls or entities can't be undefined";
throw new Error("markerUrls or entities can't be undefined");
}

@@ -233,3 +253,3 @@ return await _arnft._initialize(markerUrls, names, params.stats);

/**
* Used internally by the init static function. It create the html Container,
* Used internally by the init static function. It creates the html Container,
* stats, initialize the CameraRenderer for the video stream, and the NFTWorker.

@@ -239,3 +259,3 @@ * @param markerUrls the url Array of the markers.

* @param stats choose if you want the stats.
* @returns the ARnft object.
* @returns {Promise<this>} A promise that resolves to the ARnft object
*/

@@ -274,3 +294,3 @@ private async _initialize(

var containerEvent = new Event("containerEvent");
const containerEvent = new Event("containerEvent");
document.dispatchEvent(containerEvent);

@@ -326,3 +346,3 @@

/**
* Used for a custom initialization of the camera and mediaStream. It create the html Container,
* Used for a custom initialization of the camera and mediaStream. It creates the html Container,
* stats, initialize the CameraRenderer for the video stream, and the NFTWorker. You must provide

@@ -334,3 +354,3 @@ * your own cameraView based on the ICameraViewRenderer interface.

* @param stats choose if you want the stats.
* @returns the ARnft object.
* @returns {Promise<this>} A promise that resolves to the ARnft object
*/

@@ -370,3 +390,3 @@ public async initializeRaw(

var containerEvent = new Event("containerEvent");
const containerEvent = new Event("containerEvent");
document.dispatchEvent(containerEvent);

@@ -460,3 +480,3 @@

let terminateWorker = "terminateWorker-" + name;
var event = new Event(terminateWorker);
const event = new Event(terminateWorker);
this.target.dispatchEvent(event);

@@ -480,5 +500,5 @@ }

this.cameraView.destroy();
var event = new Event("stopVideoStreaming");
const event = new Event("stopVideoStreaming");
this.target.dispatchEvent(event);
}
}

@@ -31,3 +31,3 @@ /*

*
* Copyright 2021 WebARKit.
* Copyright 2021-2024 WebARKit.
*

@@ -50,3 +50,3 @@ * Author(s): Walter Perdan @kalwalt https://github.com/kalwalt

* @param name the name of hte Entity
* @param markerUrl the marker url asscociated
* @param markerUrl the marker url associated
*/

@@ -195,2 +195,22 @@ interface IEntity {

/**
* Initializes the ARnft instance with the provided configuration.
* This method can accept either marker URLs and names or an array of entities.
* It sets up the necessary resources, including the HTML container, stats,
* camera renderer, and NFT workers. Used internally by the initWithEntities method.
*
* @param params - The configuration parameters for initialization.
* @param params.width - The width in pixels of the video camera.
* @param params.height - The height in pixels of the video camera.
* @param params.configUrl - The URL of the config.json file.
* @param params.stats - Optional. True if you want the stats.
* @param params.autoUpdate - Optional. False if you want to maintain it yourself.
* @param params.markerUrls - Optional. An array of arrays of marker URLs.
* @param params.names - Optional. An array of arrays of entity names.
* @param params.entities - Optional. An array of entities.
*
* @returns A promise that resolves to the ARnft object.
*
* @throws Will throw an error if neither markerUrls nor entities are provided.
*/
static async initWithConfig(params: INameInitConfig | IEntityInitConfig) {

@@ -231,3 +251,3 @@ const _arnft = new ARnft(params.width, params.height, params.configUrl);

/**
* Used internally by the init static function. It create the html Container,
* Used internally by the init static function. It creates the html Container,
* stats, initialize the CameraRenderer for the video stream, and the NFTWorker.

@@ -237,3 +257,3 @@ * @param markerUrls the url Array of the markers.

* @param stats choose if you want the stats.
* @returns the ARnft object.
* @returns {Promise<this>} A promise that resolves to the ARnft object
*/

@@ -272,3 +292,3 @@ private async _initialize(

var containerEvent = new Event("containerEvent");
const containerEvent = new Event("containerEvent");
document.dispatchEvent(containerEvent);

@@ -324,3 +344,3 @@

/**
* Used for a custom initialization of the camera and mediaStream. It create the html Container,
* Used for a custom initialization of the camera and mediaStream. It creates the html Container,
* stats, initialize the CameraRenderer for the video stream, and the NFTWorker. You must provide

@@ -332,3 +352,3 @@ * your own cameraView based on the ICameraViewRenderer interface.

* @param stats choose if you want the stats.
* @returns the ARnft object.
* @returns {Promise<this>} A promise that resolves to the ARnft object
*/

@@ -368,3 +388,3 @@ public async initializeRaw(

var containerEvent = new Event("containerEvent");
const containerEvent = new Event("containerEvent");
document.dispatchEvent(containerEvent);

@@ -458,3 +478,3 @@

let terminateWorker = "terminateWorker-" + name;
var event = new Event(terminateWorker);
const event = new Event(terminateWorker);
this.target.dispatchEvent(event);

@@ -478,5 +498,5 @@ }

this.cameraView.destroy();
var event = new Event("stopVideoStreaming");
const event = new Event("stopVideoStreaming");
this.target.dispatchEvent(event);
}
}

@@ -31,3 +31,3 @@ /*

*
* Copyright 2021 WebARKit.
* Copyright 2021-2024 WebARKit.
*

@@ -34,0 +34,0 @@ * Author(s): Walter Perdan @kalwalt https://github.com/kalwalt

@@ -31,3 +31,3 @@ /*

*
* Copyright 2021 WebARKit.
* Copyright 2021-2024 WebARKit.
*

@@ -34,0 +34,0 @@ * Author(s): Walter Perdan @kalwalt https://github.com/kalwalt

@@ -31,3 +31,3 @@ /*

*
* Copyright 2021 WebARKit.
* Copyright 2021-2024 WebARKit.
*

@@ -34,0 +34,0 @@ * Author(s): Walter Perdan @kalwalt https://github.com/kalwalt

declare module "@webarkit/jsartoolkit-nft/dist/ARToolkitNFT_simd";

@@ -31,3 +31,3 @@ /*

*
* Copyright 2021 WebARKit.
* Copyright 2021-2024 WebARKit.
*

@@ -60,6 +60,8 @@ * Author(s): Walter Perdan @kalwalt https://github.com/kalwalt

* The NFTWorker constructor, to create a new instance of the NFTWorker class.
* @param markerURL the marker url of the NFT marker.
* @param markerURL An array of strings representing the URLs of the NFT markers.
* @param w the width of the camera.
* @param h the height of the camera.
* @param uuid the uuid of the marker assigned by the ARnft constructor.
* @param uuid the UUID of the marker assigned by the ARnft constructor.
* @param name the name of the marker.
* @param addPath the additional path for the marker.
*/

@@ -78,10 +80,9 @@ constructor(markerURL: Array<string>, w: number, h: number, uuid: string, name: string, addPath: string) {

/**
* Initialize the NFTWorker instance, you need to provide the camera_para.dat Url,
* the ImageData from the video stream and the renderUpdate and trackUpdate functions for the stats.
* @param cameraURL
* @param imageData
* @param renderUpdate
* @param trackUpdate
* @param oef
* @returns true if succesfull.
* Initialize the NFTWorker instance. You need to provide the camera\_para.dat URL,
* the renderUpdate and trackUpdate functions for the stats, and a boolean for filtering the matrix.
* @param cameraURL The URL of the camera\_para.dat file.
* @param renderUpdate The function to call for rendering updates.
* @param trackUpdate The function to call for tracking updates.
* @param oef A boolean for filtering the matrix.
* @returns A promise that resolves to true if successful.
*/

@@ -105,4 +106,5 @@ public async initialize(

/**
* This is the function that will pass the video stream to the worker.
* @param imageData the image data from the video stream.
* Passes the video stream to the worker for processing.
* @param imagedata The image data from the video stream.
* @param frame The current frame number.
* @returns void

@@ -121,8 +123,7 @@ */

* Load the resources from the ARnft instance into the worker.
* @param cameraURL camera_para.dat url
* @param imageData image data from the video stream.
* @param renderUpdate renderUpdate function for the stats.
* @param trackUpdate trackUpdate function for the stats.
* @param oef oef boolean for filtering the matrix.
* @returns true if succesfull.
* @param cameraURL The URL of the camera\_para.dat file.
* @param renderUpdate The function to call for rendering updates.
* @param trackUpdate The function to call for tracking updates.
* @param oef A boolean for filtering the matrix.
* @returns A promise that resolves to true if successful.
*/

@@ -151,6 +152,6 @@ protected load(

this.worker.onmessage = (ev: any) => {
var msg = ev.data;
const msg = ev.data;
switch (msg.type) {
case "loaded": {
var proj = JSON.parse(msg.proj);
const proj = JSON.parse(msg.proj);
const ratioW = pw / w;

@@ -224,3 +225,3 @@ const ratioH = ph / h;

/**
* dispatch an event listener if the marker is lost or the matrix of the marker
* Dispatch an event listener if the marker is lost or the matrix of the marker
* if found.

@@ -252,2 +253,3 @@ * @param msg message from the worker.

}
public getUuid(): string {

@@ -254,0 +256,0 @@ return this.uuid;

@@ -31,3 +31,3 @@ /*

*
* Copyright 2021 WebARKit.
* Copyright 2021-2024 WebARKit.
*

@@ -60,6 +60,8 @@ * Author(s): Walter Perdan @kalwalt https://github.com/kalwalt

* The NFTWorker constructor, to create a new instance of the NFTWorker class.
* @param markerURL the marker url of the NFT marker.
* @param markerURL An array of strings representing the URLs of the NFT markers.
* @param w the width of the camera.
* @param h the height of the camera.
* @param uuid the uuid of the marker assigned by the ARnft constructor.
* @param uuid the UUID of the marker assigned by the ARnft constructor.
* @param name the name of the marker.
* @param addPath the additional path for the marker.
*/

@@ -78,10 +80,9 @@ constructor(markerURL: Array<string>, w: number, h: number, uuid: string, name: string, addPath: string) {

/**
* Initialize the NFTWorker instance, you need to provide the camera_para.dat Url,
* the ImageData from the video stream and the renderUpdate and trackUpdate functions for the stats.
* @param cameraURL
* @param imageData
* @param renderUpdate
* @param trackUpdate
* @param oef
* @returns true if succesfull.
* Initialize the NFTWorker instance. You need to provide the camera\_para.dat URL,
* the renderUpdate and trackUpdate functions for the stats, and a boolean for filtering the matrix.
* @param cameraURL The URL of the camera\_para.dat file.
* @param renderUpdate The function to call for rendering updates.
* @param trackUpdate The function to call for tracking updates.
* @param oef A boolean for filtering the matrix.
* @returns A promise that resolves to true if successful.
*/

@@ -105,4 +106,5 @@ public async initialize(

/**
* This is the function that will pass the video stream to the worker.
* @param imageData the image data from the video stream.
* Passes the video stream to the worker for processing.
* @param imagedata The image data from the video stream.
* @param frame The current frame number.
* @returns void

@@ -121,8 +123,7 @@ */

* Load the resources from the ARnft instance into the worker.
* @param cameraURL camera_para.dat url
* @param imageData image data from the video stream.
* @param renderUpdate renderUpdate function for the stats.
* @param trackUpdate trackUpdate function for the stats.
* @param oef oef boolean for filtering the matrix.
* @returns true if succesfull.
* @param cameraURL The URL of the camera\_para.dat file.
* @param renderUpdate The function to call for rendering updates.
* @param trackUpdate The function to call for tracking updates.
* @param oef A boolean for filtering the matrix.
* @returns A promise that resolves to true if successful.
*/

@@ -151,6 +152,6 @@ protected load(

this.worker.onmessage = (ev: any) => {
var msg = ev.data;
const msg = ev.data;
switch (msg.type) {
case "loaded": {
var proj = JSON.parse(msg.proj);
const proj = JSON.parse(msg.proj);
const ratioW = pw / w;

@@ -224,3 +225,3 @@ const ratioH = ph / h;

/**
* dispatch an event listener if the marker is lost or the matrix of the marker
* Dispatch an event listener if the marker is lost or the matrix of the marker
* if found.

@@ -252,2 +253,3 @@ * @param msg message from the worker.

}
public getUuid(): string {

@@ -254,0 +256,0 @@ return this.uuid;

@@ -31,3 +31,3 @@ /*

*
* Copyright 2021 WebARKit.
* Copyright 2021-2024 WebARKit.
*

@@ -156,3 +156,3 @@ * Author(s): Walter Perdan @kalwalt https://github.com/kalwalt

var pscale = 320 / Math.max(this.vw, (this.vh / 3) * 4);
const pscale = 320 / Math.max(this.vw, (this.vh / 3) * 4);

@@ -202,5 +202,3 @@ // Void float point

}
const stream = await navigator.mediaDevices.getUserMedia(hint);
this._video.srcObject = stream;
this._video.srcObject = await navigator.mediaDevices.getUserMedia(hint);
this._video = await new Promise<HTMLVideoElement>((resolve) => {

@@ -207,0 +205,0 @@ this._video.onloadedmetadata = () => resolve(this._video);

@@ -31,3 +31,3 @@ /*

*
* Copyright 2021 WebARKit.
* Copyright 2021-2024 WebARKit.
*

@@ -52,8 +52,3 @@ * Author(s): Walter Perdan @kalwalt https://github.com/kalwalt

export function isMobile(): boolean {
//return /Android|mobile|iPad|iPhone/i.test(navigator.userAgent)
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
// true for mobile device
return true;
}
return false;
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
}

@@ -66,7 +61,3 @@

export function isIOS(): boolean {
if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
// true for mobile device
return true;
}
return false;
return /iPhone|iPad|iPod/i.test(navigator.userAgent);
}

@@ -77,8 +68,8 @@

* @param vw the video width
* @param hv the video height
* @param vh the video height
* @returns an array of values.
*/
export function getWindowSize(vw: number, vh: number): Array<number> {
var pscale = 320 / Math.max(vw, (vh / 3) * 4);
var sscale = isMobile() ? window.outerWidth / vw : 1;
const pscale = 320 / Math.max(vw, (vh / 3) * 4);
const sscale = isMobile() ? window.outerWidth / vw : 1;

@@ -107,3 +98,3 @@ let sw = vw * sscale;

}
return response.json();
return await response.json();
} catch (error) {

@@ -110,0 +101,0 @@ return Promise.reject(error);

@@ -31,3 +31,3 @@ /*

*
* Copyright 2021 WebARKit.
* Copyright 2021-2024 WebARKit.
*

@@ -34,0 +34,0 @@ * Author(s): Walter Perdan @kalwalt https://github.com/kalwalt

@@ -32,3 +32,3 @@ /* eslint-env worker */

*
* Copyright 2021 WebARKit.
* Copyright 2021-2024 WebARKit.
*

@@ -97,3 +97,3 @@ * Author(s): Walter Perdan @kalwalt https://github.com/kalwalt

tickCount += 1;
var mat;
let mat;
if (tickCount > WARM_UP_TOLERANCE) {

@@ -135,3 +135,3 @@ mat = filter.filter(Date.now(), matrixGL_RH);

for (var i = 0; i < markerLength; i++) {
for (let i = 0; i < markerLength; i++) {
let nftMarkerUrl: string;

@@ -159,3 +159,3 @@ if (reM == true) {

(id: number[]) => {
var m = 0;
let m = 0;
let marker = ar.getNFTData(id[m], 0);

@@ -162,0 +162,0 @@ ctx.postMessage({ type: "markerInfos", marker: marker });

@@ -32,3 +32,3 @@ /* eslint-env worker */

*
* Copyright 2021 WebARKit.
* Copyright 2021-2024 WebARKit.
*

@@ -96,3 +96,3 @@ * Author(s): Walter Perdan @kalwalt https://github.com/kalwalt

tickCount += 1;
var mat;
let mat;
if (tickCount > WARM_UP_TOLERANCE) {

@@ -134,3 +134,3 @@ mat = filter.filter(Date.now(), matrixGL_RH);

for (var i = 0; i < markerLength; i++) {
for (let i = 0; i < markerLength; i++) {
let nftMarkerUrl: string;

@@ -158,3 +158,3 @@ if (reM == true) {

(id: number[]) => {
var m = 0;
let m = 0;
let marker = ar.getNFTData(id[m], 0);

@@ -161,0 +161,0 @@ ctx.postMessage({ type: "markerInfos", marker: marker });

@@ -0,0 +0,0 @@ import { ConfigData } from "./config/ConfigData";

@@ -0,0 +0,0 @@ import ARnft from "./ARnft.simd";

@@ -0,0 +0,0 @@ export default class NFTWorker {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc