API Reference

Class List

pc.VrDisplay

Represents a single Display for VR content. This could be a Head Mounted display that can present content on a separate screen or a phone which can display content full screen on the same screen. This object contains the native `navigator.VRDisplay` object from the WebVR API.

Summary

Properties

capabilitiesReturns the displayThe native VRDisplay object from the WebVR API
idAn identifier for this distinct VRDisplay
presentingTrue if this display is currently presenting VR content

Methods

destroyDestroy this display object
exitPresentTry to stop presenting VR content on this display
getFrameDataReturn the current frame data that is updated during polling.
pollCalled once per frame to update the current status from the display.
requestAnimationFrameUsed in the main application loop instead of the regular `window.
requestPresentTry to present full screen VR content on this display
resetCalled to reset the pose of the pc.
setClipPlanesSet the near and far depth plans of the display.
submitFrameCalled when animation update is complete and the frame is ready to be sent to the display.

Details

Constructor

VrDisplay()

Represents a single Display for VR content. This could be a Head Mounted display that can present content on a separate screen or a phone which can display content full screen on the same screen. This object contains the native `navigator.VRDisplay` object from the WebVR API.

Returns

pc.VrDisplay A new pc.VrDisplay.

Properties

VRDisplayCapabilitiescapabilities

Returns the VRDisplayCapabilities object from the VRDisplay. This can be used to determine what features are available on this display.

VRDisplaydisplay

The native VRDisplay object from the WebVR API

Numberid

An identifier for this distinct VRDisplay

Booleanpresenting

True if this display is currently presenting VR content

Methods

destroy()

Destroy this display object

exitPresent(callback)

Try to stop presenting VR content on this display

Parameters

callbackfunctionCalled when the request is completed. Callback takes a single argument (err) that is the error message return if presenting fails, or null if the call succeeds. Usually called by pc.CameraComponent#exitVr.

getFrameData()

Return the current frame data that is updated during polling.

Returns

VRFrameData The frame data object

poll()

Called once per frame to update the current status from the display. Usually called by pc.VrManager.

requestAnimationFrame(fn)

Used in the main application loop instead of the regular `window.requestAnimationFrame`. Usually only called from inside pc.Application

Parameters

fnfunctionFunction called when it is time to update the frame.

requestPresent(callback)

Try to present full screen VR content on this display

Parameters

callbackfunctionCalled when the request is completed. Callback takes a single argument (err) that is the error message return if presenting fails, or null if the call succeeds. Usually called by pc.CameraComponent#enterVr.

reset()

Called to reset the pose of the pc.VrDisplay. Treating its current pose as the origin/zero. This should only be called in 'sitting' experiences.

setClipPlanes(n, f)

Set the near and far depth plans of the display. This enables mapping of values in the render target depth attachment to scene coordinates

Parameters

nNumberThe near depth distance
fNumberThe far depth distance

submitFrame()

Called when animation update is complete and the frame is ready to be sent to the display. Usually only called from inside pc.Application.