@babylonjs/core
Version:
Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.
84 lines (83 loc) • 2.81 kB
TypeScript
import type { WebXRSessionManager } from "../webXRSessionManager.js";
import { WebXRAbstractFeature } from "./WebXRAbstractFeature.js";
import { Observable } from "../../Misc/observable.js";
import { BaseTexture } from "../../Materials/Textures/baseTexture.js";
/**
* Options for raw camera access
*/
export interface IWebXRRawCameraAccessOptions {
/**
* Keep the created textures and metadata when detaching the feature.
*/
doNotDisposeOnDetach?: boolean;
}
/**
* WebXR Feature for WebXR raw camera access
* @since 6.31.0
* @see https://immersive-web.github.io/raw-camera-access/
*/
export declare class WebXRRawCameraAccess extends WebXRAbstractFeature {
readonly options: IWebXRRawCameraAccessOptions;
private _cachedInternalTextures;
/**
* This is an array of camera views
* Note that mostly the array will contain a single view
* If you want to know the order of the views, use the `viewIndex` array
*/
texturesData: BaseTexture[];
/**
* If needed, this array will contain the eye definition of each texture in `texturesArray`
*/
viewIndex: string[];
/**
* If needed, this array will contain the camera's intrinsics
* You can use this data to convert from camera space to screen space and vice versa
*/
cameraIntrinsics: {
u0: number;
v0: number;
ax: number;
ay: number;
gamma: number;
width: number;
height: number;
viewportX: number;
viewportY: number;
}[];
/**
* An observable that will notify when the camera's textures are updated
*/
onTexturesUpdatedObservable: Observable<BaseTexture[]>;
private _glBinding?;
private _glContext;
/**
* The module's name
*/
static readonly Name = "xr-raw-camera-access";
/**
* The (Babylon) version of this module.
* This is an integer representing the implementation version.
* This number does not correspond to the WebXR specs version
*/
static readonly Version = 1;
/**
* Creates a new instance of the feature
* @param _xrSessionManager the WebXRSessionManager
* @param options options for the Feature
*/
constructor(_xrSessionManager: WebXRSessionManager, options?: IWebXRRawCameraAccessOptions);
attach(force?: boolean): boolean;
detach(): boolean;
/**
* Dispose this feature and all of the resources attached
*/
dispose(): void;
/**
* @see https://github.com/immersive-web/raw-camera-access/blob/main/explainer.md
* @param view the XRView to update
* @param index the index of the view in the views array
*/
private _updateCameraIntrinsics;
private _updateInternalTextures;
protected _onXRFrame(_xrFrame: XRFrame): void;
}