Constructor
new VrDisplay(app, display)
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.
Parameters:
Name | Type | Description |
---|---|---|
app |
pc.Application | The application outputting to this VR display. |
display |
VRDisplay | The native VRDisplay object from the WebVR API. |
Properties:
Name | Type | Description |
---|---|---|
id |
Number | An identifier for this distinct VRDisplay |
display |
VRDisplay | The native VRDisplay object from the WebVR API |
presenting |
Boolean | True if this display is currently presenting VR content |
capabilities |
VRDisplayCapabilities | Returns the VRDisplayCapabilities object from the VRDisplay. This can be used to determine what features are available on this display. |
- Source:
Methods
destroy()
Destroy this display object
- Source:
exitPresent(callback)
Try to stop presenting VR content on this display
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | Called 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. |
- Source:
getFrameData() → {VRFrameData}
Return the current frame data that is updated during polling.
- Source:
Returns:
The frame data object
- Type
- VRFrameData
poll()
Called once per frame to update the current status from the display. Usually called by pc.VrManager.
- Source:
requestAnimationFrame(fn)
Used in the main application loop instead of the regular `window.requestAnimationFrame`. Usually only called from inside pc.Application
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | Function called when it is time to update the frame. |
- Source:
requestPresent(callback)
Try to present full screen VR content on this display
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | Called 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. |
- Source:
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.
- Source:
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:
Name | Type | Description |
---|---|---|
n |
Number | The near depth distance |
f |
Number | The far depth distance |
- Source:
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.
- Source: