import { ContextManager, Observable } from '@zcomponent/core'; import * as THREE from 'three'; import { Camera, CameraConstructorProps } from '@zcomponent/three/lib/components/cameras/Camera'; import { PropType } from '../StaticObject3D'; import { CameraTexture } from './CameraTexture'; export declare enum CameraPoseMode { Default = "default", Attitude = "attitude", AnchorOrigin = "anchorOrigin" } export declare enum CameraMirrorMode { None = "none", Poses = "poses", CSS = "CSS" } export declare enum CameraDirection { None = "none", User = "user", Rear = "rear" } export declare enum CameraProfile { Default = "default", High = "high", Full = "full" } export interface ZapparCameraConstructorProps extends CameraConstructorProps { /** * @zui * @zdefault default */ profile: CameraProfile; } /** @zcomponent * A Camera node which sets the scene's background to a THREE.Texture object containing the camera feed. * @zgroup AR * @zicon camera * @ztag three/Object3D/Group/Zappar/Camera * @ztag three/Object3D/Camera/ZapparCamera * @ztag three/Object3D/Group/ZapparCamera * @zparents three/Object3D/Group/Group */ export declare class ZapparCamera extends Camera { protected constructorProps: ZapparCameraConstructorProps; element: THREE.PerspectiveCamera; backgroundTexture: THREE.Texture | CameraTexture; isPerspectiveCamera: boolean; /** * Mode for the camera to move around in the ThreeJS scene. The correct choice of camera pose will depend on your given use case and content. * * **Default** * * In this mode the camera stays at the origin of the scene, pointing down the negative Z axis. Any tracked anchors will move around in your scene as the user moves the physical camera and real-world tracked objects. * * **Attitude** * * The camera stays at the origin of the scene, but rotates as the user rotates the physical device. When the Zappar library initializes, the negative Z axis of world space points forward in front of the user. * * **AnchorOrigin** * * In this mode, the origin of the scene is the center of the anchor specified by the camera's `originAnchor` parameter. The camera moves and rotates in world space around the anchor at the origin. If no `originAnchor` is * specified, the camera will pick an anchor automatically to become the origin of the scene. * * @zprop * @zgroup Camera * @zgrouppriority 21 * @zdefault anchorOrigin */ poseMode: Observable; /** * The anchor to use as the origin of the camera's pose when `poseMode` is set to `anchorOrigin`. * * @zprop * @zgroup Camera * @zgrouppriority 21 * @zvalues nodelabels three/Object3D/Group/Zappar/Anchor */ originAnchor: Observable; /** * The mirror mode for the rear-facing camera. * * - **Poses**: this mode mirrors the background camera texture and ensures content still appears correctly tracked. In this mode your content itself isn't flipped, so any text in your tracked content doesn't appear mirrored. This is the default mode for the user-facing camera. * - **CSS**: in this mode, the Zappar camera applies a scaleX(-1) CSS transform to your whole canvas. This way both the camera and your content appear mirrored. * - **None**: no mirroring is performed. This is the default mode for the rear-facing camera. * * @zprop * @zgroup Camera * @zgrouppriority 21 * @zdefault none */ rearMirrorMode: Observable; /** * * The mirror mode for the user-facing camera. * * - **Poses**: this mode mirrors the background camera texture and ensures content still appears correctly tracked. In this mode your content itself isn't flipped, so any text in your tracked content doesn't appear mirrored. This is the default mode for the user-facing camera. * - **CSS**: in this mode, the Zappar camera applies a scaleX(-1) CSS transform to your whole canvas. This way both the camera and your content appear mirrored. * - **None**: no mirroring is performed. This is the default mode for the rear-facing camera. * * @zprop * @zgroup Camera * @zgrouppriority 21 * @zdefault poses */ userMirrorMode: Observable; /** * Which of rear or user facing cameras to use. This property can be changed at runtime to flip between the cameras. * * @zprop * @zgroup Camera * @zgrouppriority 20 * @zdefault none */ cameraDirection: Observable; /** * The far clipping plane of the camera. * * @zprop * @zgroup Camera * @zgrouppriority 21 * @zdefault 2000 */ far: Observable; /** * The near clipping plane of the camera. * * @zprop * @zgroup Camera * @zgrouppriority 21 * @zdefault 0.1 */ near: Observable; private _updatePreferredResolution; /** * Set the preferred resolution to open the camera at. * * @zprop * @zgroup Camera * @zgrouppriority 21 */ preferredResolution: Observable<[w: number, h: number] | undefined, never>; private _hasSetCSSScaleX; private _permissionGranted; private _context; private _cameraTexture; private _rearCameraSource?; private _userCameraSource?; private _currentCameraSource?; private _currentMirrorMode; private _previousBackground; constructor(ctx: ContextManager, constructorProps: ZapparCameraConstructorProps); private _updateCamera; private _load; private _frame; get currentMirrorMode(): CameraMirrorMode; _updateProjectionMatrix(): void; private getActiveAnchor; private getOriginPose; /** @zignore */ position: PropType, 'position'>; /** @zignore */ scale: PropType, 'scale'>; /** @zignore */ rotation: PropType, 'rotation'>; dispose(): never; }