Most visited

Recently visited

ViroViewGVR

public class ViroViewGVR
extends ViroView

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ com.viro.core.ViroView
           ↳ com.viro.core.ViroViewGVR


ViroViewGVR is a ViroView for rendering content in stereo for VR headsets using the Google GVR SDK. This includes both Google Cardboard and Daydream headsets. ViroViewGVR handles all GVR initialization.

Summary

Nested classes

enum ViroViewGVR.StartupError

Errors returned by the ViroViewGVR.StartupListener, in response to Viro failing to initialize. 

interface ViroViewGVR.StartupListener

Callback interface for responding to ViroViewGVR startup success or failure. 

Public constructors

ViroViewGVR(Context context, ViroViewGVR.StartupListener startupListener, Runnable vrExitListener)

Create a new ViroViewGVR with the default RendererConfiguration.

ViroViewGVR(Context context, ViroViewGVR.StartupListener startupListener, Runnable vrExitListener, RendererConfiguration config)

Create a new ViroViewGVR with the given RendererConfiguration, which determines the rendering techniques and rendering fidelity to use for this View.

ViroViewGVR(Context context, ViroViewGVR.StartupListener startupListener, Runnable vrExitListener, RendererConfiguration config, boolean vrMode)

Create a new ViroViewGVR with the given RendererConfiguration, which determines the rendering techniques and rendering fidelity to use for this View.

Public methods

void recenterTracking()

For VR applications, re-centers the head orientation.

void setScene(Scene scene)

Set the Scene this ViroView should render.

void setVRExitRunnable(Runnable vrExitRunnable)

Runnable to invoke when the user manually exits VR mode by tapping on GVR's close button.

void setVRModeEnabled(boolean vrModeEnabled)

For VR applications, set this to true to render in stereo mode.

Public constructors

ViroViewGVR

ViroViewGVR (Context context, 
                ViroViewGVR.StartupListener startupListener, 
                Runnable vrExitListener)

Create a new ViroViewGVR with the default RendererConfiguration.

Parameters
context Context: The activity context.

startupListener ViroViewGVR.StartupListener: Listener to respond to startup success or failure. Will be notified of any errors encountered while initializing Viro. Optional, may be null.

vrExitListener Runnable: Runnable to invoke when the user manually exits VR mode by tapping on GVR's close button. Optional, may be null.

ViroViewGVR

ViroViewGVR (Context context, 
                ViroViewGVR.StartupListener startupListener, 
                Runnable vrExitListener, 
                RendererConfiguration config)

Create a new ViroViewGVR with the given RendererConfiguration, which determines the rendering techniques and rendering fidelity to use for this View.

Parameters
context Context: The activity context.

startupListener ViroViewGVR.StartupListener: Listener to respond to startup success or failure. Will be notified of any errors encountered while initializing Viro. Optional, may be null.

vrExitListener Runnable: Runnable to invoke when the user manually exits VR mode by tapping on GVR's close button. Optional, may be null.

config RendererConfiguration: The RendererConfiguration to use.

ViroViewGVR

ViroViewGVR (Context context, 
                ViroViewGVR.StartupListener startupListener, 
                Runnable vrExitListener, 
                RendererConfiguration config, 
                boolean vrMode)

Create a new ViroViewGVR with the given RendererConfiguration, which determines the rendering techniques and rendering fidelity to use for this View.

Parameters
context Context: The activity context.

startupListener ViroViewGVR.StartupListener: Listener to respond to startup success or failure. Will be notified of any errors encountered while initializing Viro. Optional, may be null.

vrExitListener Runnable: Runnable to invoke when the user manually exits VR mode by tapping on GVR's close button. Optional, may be null.

config RendererConfiguration: The RendererConfiguration to use.

vrMode boolean: Whether to initialize this view in VR (stereo) mode or 360 (mono) mode.

Public methods

recenterTracking

void recenterTracking ()

For VR applications, re-centers the head orientation. This resets the yaw to zero, but leaves pitch and roll unmodified.

setScene

void setScene (Scene scene)

Set the Scene this ViroView should render. ARScene should be used for augmented reality applications.

Parameters
scene Scene: The Scene to render in this ViroView.

setVRExitRunnable

void setVRExitRunnable (Runnable vrExitRunnable)

Runnable to invoke when the user manually exits VR mode by tapping on GVR's close button.

Parameters
vrExitRunnable Runnable: Runnable

setVRModeEnabled

void setVRModeEnabled (boolean vrModeEnabled)

For VR applications, set this to true to render in stereo mode. Stereo renders two images: one for the left eye and one for the right, each perturbed slightly to simulate depth. This mode is meant to be used in a VR headset. Set to false to render to the entire screen, for use when users do not have a headset.

Defaults to true.

Parameters
vrModeEnabled boolean: True to enable VR mode.

Hooray!