UNPKG

@needle-tools/engine

Version:

Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.

45 lines (44 loc) 2.11 kB
import { Mesh, Texture } from "three"; import type { NeedleXREventArgs } from "../../engine/engine_xr.js"; import { RGBAColor } from "../../engine/js-extensions/index.js"; import { Behaviour } from "../Component.js"; /** * WebARCameraBackground is a component that allows to display the camera feed as a background in an AR session to more easily blend the real world with the virtual world or applying effects to the camera feed. * * This component automatically requests `camera-access` permission when entering AR mode, which is required to: * - Display the real-world camera feed as a background * - Include the camera feed in AR screenshots taken with {@link screenshot2} * * **Note**: If you want to take AR screenshots with the camera feed but don't need to display it as a background, * you can still add this component to your scene (it will request camera access) or manually request the * `camera-access` feature in your `onBeforeXR` method. * * - Example: https://samples.needle.tools/ar-camera-background * * @summary Displays the camera feed as background in WebAR sessions * @category XR * @group Components * @see {@link screenshot2} for taking screenshots in AR (requires camera access for camera feed compositing) */ export declare class WebARCameraBackground extends Behaviour { /** @internal */ onBeforeXR(_mode: XRSessionMode, args: XRSessionInit): void; /** @internal */ onEnterXR(_args: NeedleXREventArgs): void; /** @internal */ onLeaveXR(_args: NeedleXREventArgs): void; /** * The tint color of the camera feed */ backgroundTint: RGBAColor; get background(): Mesh<import("three").BufferGeometry<import("three").NormalBufferAttributes>, import("three").Material | import("three").Material[], import("three").Object3DEventMap> | undefined; private backgroundPlane?; private threeTexture?; private forceTextureInitialization; /** @internal */ private preRender; /** @internal */ onBeforeRender(_frame: XRFrame | null): void; private updateFromFrame; setTexture(texture: Texture): void; }