import { Entity } from "@galacean/engine"; import { XRFeature } from "./feature/XRFeature"; import { XRCameraManager } from "./feature/camera/XRCameraManager"; import { XRInputManager } from "./input/XRInputManager"; import { XRSessionManager } from "./session/XRSessionManager"; import { XRSessionMode } from "./session/XRSessionMode"; export interface IXRListener { fn: (...args: any[]) => any; destroyed?: boolean; } type TFeatureConstructor = new (xrManager: XRManagerExtended, ...args: any[]) => T; type TFeatureConstructorArguments XRFeature> = T extends new (xrManager: XRManagerExtended, ...args: infer P) => XRFeature ? P : never; declare module "@galacean/engine" { interface XRManager { /** Input manager for XR. */ inputManager: XRInputManager; /** Session manager for XR. */ sessionManager: XRSessionManager; /** Camera manager for XR. */ cameraManager: XRCameraManager; /** Initialized features. */ get features(): XRFeature[]; /** * The current origin of XR space. * @remarks The connection point between the virtual world and the real world ( XR Space ) */ get origin(): Entity; set origin(value: Entity); /** * Check if the specified feature is supported. * @param type - The type of the feature * @returns If the feature is supported */ isSupportedFeature(feature: TFeatureConstructor): boolean; /** * Add feature based on the xr feature type. * @param type - The type of the feature * @param args - The constructor params of the feature * @returns The feature which has been added */ addFeature XRFeature>(type: T, ...args: TFeatureConstructorArguments): InstanceType | null; /** * Get feature which match the type. * @param type - The type of the feature * @returns The feature which match type */ getFeature(type: TFeatureConstructor): T | null; /** * Enter XR immersive mode, when you call this method, it will initialize and display the XR virtual world. * @param sessionMode - The mode of the session * @param autoRun - Whether to automatically run the session, when `autoRun` is set to true, xr will start working immediately after initialization. Otherwise, you need to call `sessionManager.run` later to work. * @returns A promise that resolves if the XR virtual world is entered, otherwise rejects */ enterXR(sessionMode: XRSessionMode, autoRun?: boolean): Promise; /** * Exit XR immersive mode, when you call this method, it will destroy the XR virtual world. * @returns A promise that resolves if the XR virtual world is destroyed, otherwise rejects */ exitXR(): Promise; } } export {};