import { ReactThreeFiber } from '@react-three/fiber'; import * as ZapparThree from '@zappar/zappar-threejs'; import * as THREE from 'three'; import { ForwardRefComponent } from './util/utils.js'; /** * The pose modes that determine how the camera moves around in the scene. * * default - The camera sits, stationary, at the origin of world space, and points down the negative Z axis. * In this mode, tracked anchors move in world space as the user moves the device or tracked objects in the real world. * * Attitude - The camera sits at the origin of world space, 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. * In this mode, tracked anchors move in world space as the user moves the device or tracked objects in the real world. * * anchor-origin - In this case the camera moves and rotates in world space around the anchor at the origin. */ export type PoseMode = 'anchor-origin' | 'attitude' | 'default'; /** * The mirror modes that may be used. * * none - No mirroring. * * 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. * * 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. */ export type MirrorMode = 'poses' | 'css' | 'none'; /** * The source of frames. */ export type Source = HTMLVideoElement | HTMLImageElement | string; /** * Rear and user camera source options. */ export type VideoSource = { rearCamera?: Source; userCamera?: Source; }; declare module '@react-three/fiber' { interface ThreeElements { ZapparCamera: ReactThreeFiber.Object3DNode; } } export interface ZapparCameraProps extends Omit { /** The near clipping plane of the camera. Defaults to 0.01. */ near?: number; /** The far clipping plane of the camera. Defaults to 100. */ far?: number; /** The mirror mode that is going to be used for the user camera. */ userCameraMirrorMode?: MirrorMode; /** The mirror mode that is going to be used for the rear camera. */ rearCameraMirrorMode?: MirrorMode; /** The pipeline that this component will operate within. */ pipeline?: ZapparThree.Pipeline; /** The pose modes that determine how the camera moves around in the scene. */ poseMode?: PoseMode; /** The anchor to use as the origin when in anchor-origin pose mode. */ poseAnchorOrigin?: THREE.Object3D; /** If true, starts the user facing camera. (selfie) */ userFacing?: boolean; /** The source of frames. */ sources?: VideoSource; /** Sets the camera as the default scene camera. */ makeDefault?: boolean; /** Sets the render priority. */ renderPriority?: number; /** * Applies an automatically generated environment map to the scene. * Useful for materials that support reflections. */ environmentMap?: boolean; /** Show Zappar's built-in UI to request camera permissions if enabled. */ permissionRequest?: boolean; /** Emitted after the first frame is processed. */ onFirstFrame?: () => void; /** Should the camera be automatically started? */ start?: boolean; /** Props that are passed into the camera's background image. */ backgroundImageProps?: Partial; } /** * Creates a camera that you can use instead of a perspective camera. * * @see https://docs.zap.works/universal-ar/web-libraries/react-threejs/camera-setup/ */ declare const ZapparCamera: ForwardRefComponent; export default ZapparCamera;