import { XRSessionManager, IXRFrameEvent, ILocalizeAndMapDetails, IObjectTrackingResponse } from '../core/index.js'; import * as THREE from 'three'; interface IThreeAdapterOptions { session: XRSessionManager; renderer: THREE.WebGLRenderer; scene: THREE.Scene; camera: THREE.PerspectiveCamera; /** Show the map mesh after a successful localization. Default false. */ showMesh?: boolean; /** Show the transform gizmo after a successful localization. Default true. */ showGizmo?: boolean; /** * Mount the built-in START AR / STOP AR button. Default true. * Set to false to drive the session entirely via startSession() / stopSession(). * NOTE: startSession() must be called from within a user gesture (click/tap) * handler — browser security requires it to obtain a user activation token. */ useDefaultButton?: boolean; onButtonCreated?: (button: HTMLButtonElement) => void; buttonContainer?: HTMLElement; /** * Called every XR frame after camera matrices are synced and the world is * updated, but before the scene is rendered. Use this to update scene objects * in response to the current device pose. */ onXRFrame?: (event: IXRFrameEvent) => void; /** * Called after a successful localization. * * `worldFromMap` is a THREE.Matrix4 that transforms any point from VPS map * space into Three.js world space (the XR reference space). Use it to place * scene objects at known physical locations inside the scanned map: * * ```ts * onLocalizationSuccess: (result, worldFromMap) => { * const marker = new THREE.Mesh(geometry, material); * // mapPoint is a position you know from the scanned map (in metres) * const mapPoint = new THREE.Vector3(1.5, 0, -2.0); * marker.position.copy(mapPoint.applyMatrix4(worldFromMap)); * scene.add(marker); * } * ``` */ onLocalizationSuccess?: (result: ILocalizeAndMapDetails, worldFromMap: THREE.Matrix4) => void; /** Load and display a 3D outline mesh for each detected object. Default false. */ showObjectMeshes?: boolean; /** Called when a detected object's 3D mesh has been loaded and placed in the scene. */ onObjectMeshLoaded?: (objectCode: string) => void; } declare class ThreeAdapter { private readonly options; /** Returns true if the browser supports immersive-ar WebXR sessions. */ static isSupported(): Promise; private world; private previewRAFHandle; private resizeHandler; private xrRenderTarget; constructor(options: IThreeAdapterOptions); initialize(buttonContainer?: HTMLElement): HTMLButtonElement | null; isActive(): boolean; get isLocalizing(): boolean; startSession(): Promise; stopSession(): void; localizeFrame(): Promise; trackObjects(): Promise; clearObjectMeshes(): void; private onXRFrame; private syncCameraMatrices; private startPreviewLoop; private stopPreviewLoop; private handleLocalizationResult; dispose(): void; } export { type IThreeAdapterOptions, ThreeAdapter };