@zappar/zappar
Advanced tools
Comparing version 3.0.1-alpha.17 to 3.0.1-alpha.18
@@ -12,6 +12,9 @@ export { ImageTracker, ImageAnchor } from "./imagetracker"; | ||
export { Anchor } from "./anchor"; | ||
export { WorldTracker, WorldTrackerQuality, WorldAnchor, PlaneAnchor } from './worldtracker'; | ||
export { WorldTracker, WorldTrackerQuality, WorldAnchor, PlaneAnchor, TransformOrientation, AnchorStatus, PlaneOrientation } from './worldtracker'; | ||
export { CustomAnchor } from './customanchor'; | ||
export { WorldTrackerUI } from './worldtrackerui'; | ||
export { generateMeshForPlanePolygon, PlaneMesh, PlaneMeshOptions } from './planemesh'; | ||
export { permissionDeniedUI, permissionGranted, permissionDenied, permissionRequest, permissionRequestUI, Permission } from "./permission"; | ||
export { LogLevel, setLogLevel, logLevel } from "./loglevel"; | ||
export { Event, Event1 } from "./event"; | ||
export { cameraDefaultDeviceID, invert, drawPlane, projectionMatrixFromCameraModel, browserIncompatible, browserIncompatibleUI, loaded, loadedPromise, cookiesPermitted } from "./zappar"; | ||
export { cameraDefaultDeviceID, invert, drawPlane, drawAxis, projectionMatrixFromCameraModel, browserIncompatible, browserIncompatibleUI, loaded, loadedPromise, cookiesPermitted } from "./zappar"; |
@@ -11,6 +11,9 @@ export { ImageTracker } from "./imagetracker"; | ||
export { FaceLandmarkName, FaceLandmark } from "./facelandmark"; | ||
export { WorldTracker, WorldTrackerQuality } from './worldtracker'; | ||
export { WorldTracker, WorldTrackerQuality, TransformOrientation, AnchorStatus, PlaneOrientation } from './worldtracker'; | ||
export { CustomAnchor } from './customanchor'; | ||
export { WorldTrackerUI } from './worldtrackerui'; | ||
export { generateMeshForPlanePolygon } from './planemesh'; | ||
export { permissionDeniedUI, permissionGranted, permissionDenied, permissionRequest, permissionRequestUI, Permission } from "./permission"; | ||
export { LogLevel, setLogLevel, logLevel } from "./loglevel"; | ||
export { Event, Event1 } from "./event"; | ||
export { cameraDefaultDeviceID, invert, drawPlane, projectionMatrixFromCameraModel, browserIncompatible, browserIncompatibleUI, loaded, loadedPromise, cookiesPermitted } from "./zappar"; | ||
export { cameraDefaultDeviceID, invert, drawPlane, drawAxis, projectionMatrixFromCameraModel, browserIncompatible, browserIncompatibleUI, loaded, loadedPromise, cookiesPermitted } from "./zappar"; |
/** | ||
* SDK version. | ||
*/ | ||
export declare const VERSION = "3.0.1-alpha.17"; | ||
export declare const VERSION = "3.0.1-alpha.18"; |
/** | ||
* SDK version. | ||
*/ | ||
export const VERSION = "3.0.1-alpha.17"; | ||
export const VERSION = "3.0.1-alpha.18"; |
@@ -1,13 +0,17 @@ | ||
import { world_tracker_quality_t as WorldTrackerQuality } from "@zappar/zappar-cv"; | ||
import { world_tracker_quality_t as WorldTrackerQuality, zappar_world_tracker_t, plane_orientation_t as PlaneOrientation, anchor_status_t as AnchorStatus } from "@zappar/zappar-cv"; | ||
import { Pipeline } from "./pipeline"; | ||
import { Anchor } from "./anchor"; | ||
import { Event, Event1 } from "./event"; | ||
import { CustomAnchor } from "./customanchor"; | ||
export { world_tracker_quality_t as WorldTrackerQuality, transform_orientation_t as TransformOrientation, plane_orientation_t as PlaneOrientation, anchor_status_t as AnchorStatus, } from "@zappar/zappar-cv"; | ||
export interface WorldAnchor extends Anchor { | ||
valid: boolean; | ||
id: string; | ||
status: AnchorStatus; | ||
} | ||
export interface PlaneAnchor extends Anchor { | ||
visible: boolean; | ||
export interface PlaneAnchor extends WorldAnchor { | ||
polygon: Float32Array; | ||
polygonVersion: number; | ||
orientation: PlaneOrientation; | ||
firstPlane: boolean; | ||
} | ||
export { world_tracker_quality_t as WorldTrackerQuality } from "@zappar/zappar-cv"; | ||
/** | ||
@@ -18,7 +22,6 @@ * Attaches content to a point on a surface in front of the user as it moves around in the camera view. | ||
export declare class WorldTracker { | ||
private _pipeline; | ||
onQuality: Event1<WorldTrackerQuality>; | ||
onInitializing: Event; | ||
onQualityGood: Event; | ||
onQualityOrientationOnly: Event; | ||
onQualityLimited: Event; | ||
quality: WorldTrackerQuality; | ||
@@ -28,4 +31,9 @@ worldAnchor: WorldAnchor; | ||
planes: Map<string, PlaneAnchor>; | ||
customAnchors: Map<string, CustomAnchor>; | ||
/** @internal */ | ||
readonly _pipeline: Pipeline; | ||
/** @internal */ | ||
_impl: zappar_world_tracker_t; | ||
private _z; | ||
private _impl; | ||
private _hadFirstPlane; | ||
/** | ||
@@ -35,3 +43,3 @@ * Constructs a new WorldTracker. | ||
*/ | ||
constructor(_pipeline: Pipeline); | ||
constructor(pipeline: Pipeline); | ||
/** | ||
@@ -49,4 +57,7 @@ * Destroys the world tracker. | ||
set enabled(e: boolean); | ||
get planeDetectionEnabled(): boolean; | ||
set planeDetectionEnabled(v: boolean); | ||
get horizontalPlaneDetectionEnabled(): boolean; | ||
set horizontalPlaneDetectionEnabled(v: boolean); | ||
get verticalPlaneDetectionEnabled(): boolean; | ||
set verticalPlaneDetectionEnabled(v: boolean); | ||
get verticalPlaneDetectionSupported(): boolean; | ||
get tracksDataEnabled(): boolean; | ||
@@ -53,0 +64,0 @@ set tracksDataEnabled(v: boolean); |
@@ -1,5 +0,5 @@ | ||
import { world_tracker_quality_t as WorldTrackerQuality } from "@zappar/zappar-cv"; | ||
import { world_tracker_quality_t as WorldTrackerQuality, plane_orientation_t as PlaneOrientation, anchor_status_t as AnchorStatus } from "@zappar/zappar-cv"; | ||
import { z } from "./zappar"; | ||
import { Event, Event1 } from "./event"; | ||
export { world_tracker_quality_t as WorldTrackerQuality } from "@zappar/zappar-cv"; | ||
export { world_tracker_quality_t as WorldTrackerQuality, transform_orientation_t as TransformOrientation, plane_orientation_t as PlaneOrientation, anchor_status_t as AnchorStatus, } from "@zappar/zappar-cv"; | ||
/** | ||
@@ -14,38 +14,55 @@ * Attaches content to a point on a surface in front of the user as it moves around in the camera view. | ||
*/ | ||
constructor(_pipeline) { | ||
this._pipeline = _pipeline; | ||
constructor(pipeline) { | ||
this.onQuality = new Event1(); | ||
this.onInitializing = new Event(); | ||
this.onQualityGood = new Event(); | ||
this.onQualityOrientationOnly = new Event(); | ||
this.onQualityLimited = new Event(); | ||
this.quality = WorldTrackerQuality.WORLD_TRACKER_QUALITY_INITIALIZING; | ||
this.worldAnchor = { | ||
id: "world", | ||
poseCameraRelative: mirror => this._z.world_tracker_world_anchor_pose_camera_relative(this._impl, mirror !== null && mirror !== void 0 ? mirror : false), | ||
pose: (cameraPose, mirror) => this._z.world_tracker_world_anchor_pose(this._impl, cameraPose, mirror !== null && mirror !== void 0 ? mirror : false), | ||
valid: false | ||
status: AnchorStatus.ANCHOR_STATUS_INITIALIZING, | ||
}; | ||
this.groundAnchor = { | ||
id: "ground", | ||
poseCameraRelative: mirror => this._z.world_tracker_ground_anchor_pose_camera_relative(this._impl, mirror !== null && mirror !== void 0 ? mirror : false), | ||
pose: (cameraPose, mirror) => this._z.world_tracker_ground_anchor_pose(this._impl, cameraPose, mirror !== null && mirror !== void 0 ? mirror : false), | ||
valid: false | ||
status: AnchorStatus.ANCHOR_STATUS_INITIALIZING, | ||
}; | ||
this.planes = new Map(); | ||
this.customAnchors = new Map(); | ||
this._hadFirstPlane = false; | ||
this._frameUpdate = () => { | ||
this.worldAnchor.valid = this._z.world_tracker_world_anchor_valid(this._impl); | ||
this.groundAnchor.valid = this._z.world_tracker_ground_anchor_valid(this._impl); | ||
const planeCount = this._z.world_tracker_plane_count(this._impl); | ||
this.worldAnchor.status = this._z.world_tracker_world_anchor_status(this._impl); | ||
this.worldAnchor.id = this._z.world_tracker_world_anchor_id(this._impl); | ||
this.groundAnchor.status = this._z.world_tracker_ground_anchor_status(this._impl); | ||
this.groundAnchor.id = this._z.world_tracker_ground_anchor_id(this._impl); | ||
for (const anchor of this.planes.values()) { | ||
anchor.status = AnchorStatus.ANCHOR_STATUS_STOPPED; | ||
} | ||
const planeCount = this._z.world_tracker_plane_anchor_count(this._impl); | ||
for (let i = 0; i < planeCount; i++) { | ||
const id = i.toString(); | ||
const id = this._z.world_tracker_plane_anchor_id(this._impl, i); | ||
let anchor = this.planes.get(id); | ||
if (!anchor) { | ||
anchor = { | ||
visible: true, | ||
poseCameraRelative: mirror => this._z.world_tracker_plane_pose_camera_relative(this._impl, i, mirror !== null && mirror !== void 0 ? mirror : false), | ||
pose: (cameraPose, mirror) => this._z.world_tracker_plane_pose(this._impl, i, cameraPose, mirror !== null && mirror !== void 0 ? mirror : false), | ||
id, | ||
status: AnchorStatus.ANCHOR_STATUS_INITIALIZING, | ||
poseCameraRelative: mirror => this._z.world_tracker_plane_anchor_pose_camera_relative(this._impl, i, mirror !== null && mirror !== void 0 ? mirror : false), | ||
pose: (cameraPose, mirror) => this._z.world_tracker_plane_anchor_pose(this._impl, i, cameraPose, mirror !== null && mirror !== void 0 ? mirror : false), | ||
polygon: new Float32Array(), | ||
polygonVersion: 0, | ||
orientation: PlaneOrientation.PLANE_ORIENTATION_HORIZONTAL, | ||
firstPlane: !this._hadFirstPlane | ||
}; | ||
this._hadFirstPlane = true; | ||
this.planes.set(id, anchor); | ||
} | ||
anchor.visible = this._z.world_tracker_plane_visible(this._impl, i); | ||
anchor.polygon = this._z.world_tracker_plane_polygon_data(this._impl, i); | ||
anchor.poseCameraRelative = mirror => this._z.world_tracker_plane_anchor_pose_camera_relative(this._impl, i, mirror !== null && mirror !== void 0 ? mirror : false); | ||
anchor.pose = (cameraPose, mirror) => this._z.world_tracker_plane_anchor_pose(this._impl, i, cameraPose, mirror !== null && mirror !== void 0 ? mirror : false); | ||
anchor.status = this._z.world_tracker_plane_anchor_status(this._impl, i); | ||
anchor.polygon = this._z.world_tracker_plane_anchor_polygon_data(this._impl, i); | ||
anchor.polygonVersion = this._z.world_tracker_plane_anchor_polygon_version(this._impl, i); | ||
anchor.orientation = this._z.world_tracker_plane_anchor_orientation(this._impl, i); | ||
} | ||
@@ -62,4 +79,4 @@ const lastQuality = this.quality; | ||
break; | ||
case WorldTrackerQuality.WORLD_TRACKER_QUALITY_ORIENTATION_ONLY: | ||
this.onQualityOrientationOnly.emit(); | ||
case WorldTrackerQuality.WORLD_TRACKER_QUALITY_LIMITED: | ||
this.onQualityLimited.emit(); | ||
break; | ||
@@ -71,4 +88,7 @@ } | ||
this._z = z(); | ||
this._pipeline = pipeline; | ||
this._pipeline._onFrameUpdateInternal.bind(this._frameUpdate); | ||
this._impl = this._z.world_tracker_create(this._pipeline._getImpl()); | ||
this.worldAnchor.id = this._z.world_tracker_world_anchor_id(this._impl); | ||
this.groundAnchor.id = this._z.world_tracker_ground_anchor_id(this._impl); | ||
} | ||
@@ -95,8 +115,17 @@ /** | ||
} | ||
get planeDetectionEnabled() { | ||
return this._z.world_tracker_plane_detection_enabled(this._impl); | ||
get horizontalPlaneDetectionEnabled() { | ||
return this._z.world_tracker_horizontal_plane_detection_enabled(this._impl); | ||
} | ||
set planeDetectionEnabled(v) { | ||
this._z.world_tracker_plane_detection_enabled_set(this._impl, v); | ||
set horizontalPlaneDetectionEnabled(v) { | ||
this._z.world_tracker_horizontal_plane_detection_enabled_set(this._impl, v); | ||
} | ||
get verticalPlaneDetectionEnabled() { | ||
return this._z.world_tracker_vertical_plane_detection_enabled(this._impl); | ||
} | ||
set verticalPlaneDetectionEnabled(v) { | ||
this._z.world_tracker_vertical_plane_detection_enabled_set(this._impl, v); | ||
} | ||
get verticalPlaneDetectionSupported() { | ||
return this._z.world_tracker_vertical_plane_detection_supported(this._impl); | ||
} | ||
get tracksDataEnabled() { | ||
@@ -103,0 +132,0 @@ return this._z.world_tracker_tracks_data_enabled(this._impl); |
@@ -36,2 +36,6 @@ import { Zappar } from "@zappar/zappar-cv"; | ||
/** | ||
* @ignore | ||
*/ | ||
export declare function drawAxis(gl: WebGLRenderingContext, projectionMatrix: Float32Array, cameraMatrix: Float32Array, targetMatrix: Float32Array): void; | ||
/** | ||
* Detects if your page is running in a browser that's not supported | ||
@@ -38,0 +42,0 @@ * @returns 'true' if the browser is incompatible. |
@@ -68,2 +68,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
/** | ||
* @ignore | ||
*/ | ||
export function drawAxis(gl, projectionMatrix, cameraMatrix, targetMatrix) { | ||
z().draw_axis(gl, projectionMatrix, cameraMatrix, targetMatrix); | ||
} | ||
/** | ||
* Detects if your page is running in a browser that's not supported | ||
@@ -70,0 +76,0 @@ * @returns 'true' if the browser is incompatible. |
{ | ||
"name": "@zappar/zappar", | ||
"version": "3.0.1-alpha.17", | ||
"version": "3.0.1-alpha.18", | ||
"description": "Zappar's computer vision for JavaScript, supporting image, face and instant world tracking, and barcode scanning.", | ||
@@ -55,5 +55,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@zappar/zappar-cv": "3.0.1-alpha.16", | ||
"@zappar/zappar-cv": "3.0.1-alpha.17", | ||
"gl-matrix": "3.4.3" | ||
} | ||
} |
@@ -18,3 +18,3 @@ # Zappar for JavaScript/TypeScript | ||
<!-- Added by: zapparadmin, at: Mon 29 Apr 2024 16:13:47 BST --> | ||
<!-- Added by: zapparadmin, at: Thu 23 May 2024 11:15:41 BST --> | ||
@@ -31,3 +31,3 @@ <!--te--> | ||
Download the bundle from this link: | ||
https://libs.zappar.com/zappar-js/3.0.1-alpha.17/zappar-js.zip | ||
https://libs.zappar.com/zappar-js/3.0.1-alpha.18/zappar-js.zip | ||
@@ -43,3 +43,3 @@ Unzip into your web project and reference from your HTML like this: | ||
```html | ||
<script src="https://libs.zappar.com/zappar-js/3.0.1-alpha.17/zappar.js"></script> | ||
<script src="https://libs.zappar.com/zappar-js/3.0.1-alpha.18/zappar.js"></script> | ||
``` | ||
@@ -46,0 +46,0 @@ |
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
56
2941
12279434
+ Added@zappar/zappar-cv@3.0.1-alpha.17(transitive)
- Removed@zappar/zappar-cv@3.0.1-alpha.16(transitive)