This object provides access to the GearVR interface.
Related sample code
Other related reference items
This function does not accept any parameters. |
This function does not return any values. |
clear_layers ( )
Clears all layers
|
This function does not accept any parameters. |
This function does not return any values. |
create_layer ( name, layer_rt )
Creates a monoscopic image that is displayed as a rectangle headlocked in front of the HMD.
|
name : | string |
The layer name. |
layer_rt : | string |
The layer render target name. |
This function does not return any values. |
This is useful for heads-up-displays, text information, object labels and so on.
enable ( enabled )
Enables or disables rendering to the GearVR device.
|
enabled : | boolean |
The enabled state flag. |
This function does not return any values. |
eye_info ( eye ) : table
Returns a table containing information on the specified eye.
|
eye : | integer |
The eye to query (stingray.GearVR.EYE_LEFT or stingray.GearVR.EYE_RIGHT) |
table |
Table populated with eye information. |
hmd_info ( ) : table
Returns a table containing HMD information.
|
This function does not accept any parameters. |
table |
Table populated with GearVR HMD information. |
hmd_local_pose ( ) : stingray.Matrix4x4, stingray.Matrix4x4, stingray.Matrix4x4
Returns the head, left eye and right eye local poses of the HMD.
|
This function does not accept any parameters. |
Head local pose | |
Left eye local pose | |
Right eye local pose |
hmd_world_pose ( ) : stingray.Matrix4x4, stingray.Matrix4x4, stingray.Matrix4x4
Returns the head, left eye and right eye world poses of the HMD.
|
This function does not accept any parameters. |
Head world pose | |
Left eye world pose | |
Right eye world pose |
If not tracked, identity matrices are returned.
initialize ( ) : boolean
Initializes GearVR system.
|
This function does not accept any parameters. |
boolean |
Returns true if GearVR was initialized properly, otherwise returns false. |
link_node_to_tracker ( unit, node, type, index, world )
Links a Unit node to be automatically updated by the VR tracker.
|
unit : |
Unit to link to tracker | |
node : | integer |
Scene graph node that is linked within the unit |
type : | integer |
Type of tracker link (GearVR.LINK_HMD) |
index : | integer |
Index of HMD (i.e. GearVR.EYE_LEFT or GearVR.EYE_RIGHT when using GearVR.LINK_HMD type) |
world : |
World containing the unit |
This function does not return any values. |
mobile_options ( ) : gearvr_mobile_options
Returns a table that contains the current mobile options.
|
This function does not accept any parameters. |
A table that contains the current values of the mobile options. For details on its fields and types, see gearvr_mobile_options. |
Other related reference items
profile ( ) : table
Returns a table containing the current active profile data.
|
This function does not accept any parameters. |
table |
Table populated with current profile data set using GearVR Configuration Utility. |
More specifically, it returns the player height, eye height, interpupillary and neck to eye distances in meters.
recenter ( )
Re-centers the sensor position and orientation.
|
This function does not accept any parameters. |
This function does not return any values. |
remove_layer ( name )
Removes the specified layer.
|
name : | string |
The layer name. |
This function does not return any values. |
setup_hmd ( left_eye_rt, right_eye_rt, left_eye_fov_left, left_eye_fov_right, left_eye_fov_down, left_eye_fov_up, right_eye_fov_left, right_eye_fov_right, right_eye_fov_down, right_eye_fov_up, flags )
Setup GearVR based on specified parameters.
|
left_eye_rt : | string |
The left eye render target name. |
right_eye_rt : | string |
The right eye render target name. |
left_eye_fov_left : | number |
The left eye left frustum angle. |
left_eye_fov_right : | number |
The left eye right frustum angle. |
left_eye_fov_down : | number |
The left eye down frustum angle. |
left_eye_fov_up : | number |
The left eye up frustum angle. |
right_eye_fov_left : | number |
The right eye left frustum angle. |
right_eye_fov_right : | number |
The right eye right frustum angle. |
right_eye_fov_down : | number |
The right eye down frustum angle. |
right_eye_fov_up : | number |
The right eye up frustum angle. |
flags : | integer? |
Optional; Setup flags. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
This function does not return any values. |
set_high_quality_layer ( name, hq_enabled )
Enable or disable 4x anisotropic sampling in the compositor for the specified layer.
|
name : | string |
The name of the layer to set to the high quality render path. |
hq_enabled : | boolean |
Whether or not this layer should use the high quality render path. |
This function does not return any values. |
set_layer_dimensions ( name, width, height )
Sets the dimensions of the layer quad.
|
name : | string |
The name of the layer to update. |
width : | number |
The layer quad width in meters |
height : | number |
The layer quad height in meters |
This function does not return any values. |
By default layers are rendered on a quad that is 1 meter across.
set_layer_pose ( name, pose, headlocked )
Sets the layer pose.
|
name : | string |
The name of the layer to update. |
pose : |
The layer center pose. | |
headlocked : | boolean |
Whether the layer pose is relative to the HMD (headlocked) or relative to the tracking origin. |
This function does not return any values. |
By default, the pose is headlocked 0.5m infront of the HMD.
set_layer_visibility ( name, visible )
Specify if a layer should be visible or hidden.
|
name : | string |
The name of the layer. |
visible : | boolean |
Whether or not this layer is visible. |
This function does not return any values. |
set_mobile_options ( options )
Sets the mobile options for the GearVR plugin that you specify in the options table.
|
options : |
A table that contains the options and values you want to set. For details on its fields and types, see gearvr_mobile_options. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
This function does not return any values. |
Call this function before [stingray.GearVR.setup()].
Other related reference items
set_tracking_space_pose ( pose )
Sets provided pose as the default tracking space pose
|
pose : |
Tracking space pose |
This function does not return any values. |
shutdown ( )
Shuts down GearVR system.
|
This function does not accept any parameters. |
This function does not return any values. |
unlink_node_from_tracker ( unit, node )
Unlinks a Unit node that is being automatically updated by the VR tracker.
|
unit : |
Unit to unlink from the VR tracker | |
node : | integer |
Scene graph node within the unit that is to be unlinked |
This function does not return any values. |
valid_session ( ) : boolean |
This function does not accept any parameters. |
boolean |
true if the device session is valid. On desktop this happens after GearVR.initialize, on mobile this happens after GearVR.enable |
These modes are used as frame parameters for the GearVR Mobile SDK.
You can set them in the extra_latency_mode field of the table that you pass to set_mobile_options(). For example:
local settings = { extra_latency_mode = stingray.GearVR.EXTRA_LATENCY_OFF } stingray.GearVR.set_mobile_options(settings)
EXTRA_LATENCY_DYNAMIC : integer
VRAPI_EXTRA_LATENCY_MODE_DYNAMIC
|
EXTRA_LATENCY_OFF : integer
VRAPI_EXTRA_LATENCY_MODE_OFF
|
Other related reference items
EXTRA_LATENCY_ON : integer
VRAPI_EXTRA_LATENCY_MODE_ON
|