declare type Constructor < T = object > = { new ( ... args ) : T ; prototype : T ; } ; declare type XRReferenceSpaceType = 'local' | 'local-floor' | 'bounded-floor' | 'unbounded' | 'viewer' ; declare type XREnvironmentBlendMode = 'opaque' | 'additive' | 'alpha-blend' ; declare type XRVisibilityState = 'visible' | 'visible-blurred' | 'hidden' ; declare type XRSessionMode = 'inline' | 'immersive-ar' | 'immersive-vr' ; declare interface XRPresentationContext { readonly canvas : HTMLCanvasElement ; } declare interface XRHitTestSource { cancel ( ) : void ; } declare interface XRTransientInputHitTestSource { cancel ( ) : void ; } declare interface XRHitResult { hitMatrix : Float32Array ; } declare interface XRHitTestResult { getPose ( baseSpace ) : XRPose | null ; } declare interface XRTransientInputHitTestResult { readonly inputSource : XRInputSource ; readonly results : Array < XRHitTestResult > ; } declare interface XR extends EventTarget { requestSession ( mode , options ? ) : Promise < XRSession > ; isSessionSupported ( mode ) : Promise < boolean > ; } declare interface XRRigidTransform { readonly position : DOMPointReadOnly ; readonly orientation : DOMPointReadOnly ; readonly matrix : Float32Array ; readonly inverse : XRRigidTransform ; } declare interface XRSpace extends EventTarget { } declare interface XRReferenceSpace extends XRSpace { getOffsetReferenceSpace ( originOffset ) : XRReferenceSpace ; onreset : any ; } type XREye = 'left' | 'right' ; declare interface XRView { readonly eye : XREye ; readonly projectionMatrix : Float32Array ; readonly viewMatrix : Float32Array ; readonly transform : XRRigidTransform ; } declare interface XRViewerPose { readonly transform : XRRigidTransform ; readonly views : Array < XRView > ; } declare interface XRRayDirectionInit { x ? : number ; y ? : number ; z ? : number ; w ? : number ; } declare class XRRay { readonly origin : DOMPointReadOnly ; readonly direction : XRRayDirectionInit ; matrix : Float32Array ; constructor ( origin , direction ) ; } declare interface XRPose { readonly emulatedPosition : boolean ; readonly transform : XRRigidTransform ; } type XRHandedness = '' | 'left' | 'right' ; type XRTargetRayMode = 'gaze' | 'tracked-pointer' | 'screen' ; declare interface XRInputSource { readonly handedness : XRHandedness ; readonly targetRayMode : XRTargetRayMode ; readonly targetRaySpace : XRSpace ; readonly gripSpace ? : XRSpace ; readonly profiles : Array < String > ; readonly gamepad : Gamepad ; } declare interface XRInputSourceEvent extends Event { readonly frame : XRFrame ; readonly inputSource : XRInputSource ; } declare interface XRFrame { readonly session : XRSession ; getViewerPose ( referenceSpace ? ) : XRViewerPose ; getPose ( space , referenceSpace ) : XRPose ; getHitTestResults ( hitTestSource ) : Array < XRHitTestResult > ; getHitTestResultsForTransientInput ( hitTestSource ) : Array < XRTransientInputHitTestResult > ; } type XRFrameRequestCallback = ( time : number , frame : XRFrame ) => void ; declare interface XRRenderState { readonly depthNear : number ; readonly depthFar : number ; readonly inlineVerticalFieldOfView ? : number ; readonly baseLayer ? : XRWebGLLayer ; } declare interface XRRenderStateInit { depthNear ? : number ; depthFar ? : number ; inlineVerticalFieldOfView ? : number ; baseLayer ? : XRWebGLLayer ; } declare interface XRHitTestOptionsInit { space : XRSpace ; offsetRay ? : XRRay ; } declare interface XRTransientInputHitTestOptionsInit { profile : string ; offsetRay ? : XRRay ; } declare interface XRSession extends EventTarget { requestReferenceSpace ( type ) : Promise < XRReferenceSpace > ; updateRenderState ( renderStateInit ) : Promise < void > ; requestAnimationFrame ( callback ) : number ; cancelAnimationFrame ( id ) : void ; end ( ) : Promise < void > ; renderState : XRRenderState ; inputSources : Array < XRInputSource > ; environmentBlendMode : XREnvironmentBlendMode ; visibilityState : XRVisibilityState ; requestHitTestSource ( options ) : Promise < XRHitTestSource > ; requestHitTestSourceForTransientInput ( options ) : Promise < XRTransientInputHitTestSource > ; requestHitTest ( ray , referenceSpace ) : Promise < XRHitResult [ ] > ; updateWorldTrackingState ( options ) : void ; } declare interface XRViewport { readonly x : number ; readonly y : number ; readonly width : number ; readonly height : number ; } declare interface XRLayer { } declare interface XRWebGLLayerInit { antialias ? : boolean ; depth ? : boolean ; stencil ? : boolean ; alpha ? : boolean ; ignoreDepthValues ? : boolean ; framebufferScaleFactor ? : number ; } declare class XRWebGLLayer implements XRLayer { public framebuffer : WebGLFramebuffer ; public framebufferWidth : number ; public framebufferHeight : number ; constructor ( session , gl , options ) ; getViewport ( view ) ; } declare interface Window { XRSession ? : Constructor < XRSession > ; XR ? : Constructor < XR > ; } declare interface Navigator { xr ? : XR ; } declare interface WebGLRenderingContext { makeXRCompatible ( ) : Promise < void > ; }