ViroVRSceneNavigator is the entry point for VR applications. Please see the Scene Navigation Guide for more information on how to properly navigate between scenes.
Example use:
import React from 'react';
import { Viro3DSceneNavigator } from '@reactvision/react-viro';
import MyScene from './MyScene';
function ViroSceneNav() {
return (
<Viro3DSceneNavigator
initialScene={{ scene: MyStartScene }}
/>
);
}
Props
initialScene (* required)
Type
Description
{ scene: React.Component }
The initial scene to display for your application on application start.
bloomEnabled
Type
Description
boolean
Enable or disable bloom. Bloom adds a soft glow to bright areas in scene, simulating the way bright highlights appear to the human eye. To make an object bloom, this property must be enabled, and the objects's threshold for bloom must be set via its material's bloomThreshold property.
debug
Type
Description
boolean
Used to enable the Dev menu on Android Nougat devices with Cardboard.
hdrEnabled
Type
Description
boolean
When HDR rendering is enabled, Viro uses a deeper color space and renders to a floating point texture, then applies a tone-mapping algorithm to preserve fine details in both bright and dark regions of the scene. If HDR is disabled, then features like Bloom and PBR will not work, and tone-mapping will be disabled. HDR is not supported on all devices.
onExitViro
Type
Description
Function
Called if the user presses the "X" button to exit.
pbrEnabled
Type
Description
boolean
Enable or disable physically-based rendering. Physically based rendering, or PBR, produces more realistic lighting results for your scenes, and provides a more intuitive workflow for artists. To use PBR, this property must be enabled, and materials must use the physicallyBased lighting model. PBR is controlled by a variety of properties, see PBR for details.
shadowsEnabled
Type
Description
boolean
Enable or disable rendering dynamic shadows. If shadows are disabled here, shadow casting lights will simply not cast a shadow.
viroAppProps
Type
Description
Object
A Javascript object containing properties for this Viro app. This can be used to pass in properties from native if you're using a hybrid application.
vrModeEnabled
Type
Description
boolean
vrModeEnabled allows switching to and from VR mode. When set to false, it transitions back to pre-VR (mono) mode. When set to true, we set the view into a full VR mode. This is set to true by default.
Methods
The following functions are available on the ViroVRSceneNavigator component. You can get the handle to the Viro3DSceneNavigator in 2 ways:
Use the built-in React Native ref property to grab a reference
From your ViroScene. Each ViroScene added to a ViroVRSceneNavigator provides its parent navigator in the variable: this.props.sceneNavigator.
Move to the given scene in the stack, removing it from its current position in the stack and placing it on top, thereby displaying it to the user. If the scene is not already on the stack, this method pushes the scene to the top of the stack, displaying it to the user. This is best used in applications where the user jumps between a set of scenes frequently.
Argument
Type
Description
scene
ViroARScene
Scene that will be moved or pushed to the top of the stack and displayed to the user
Replace the currently displayed scene (the scene at the top of the stack) with the given scene, displaying it to the user. This leaves the remainder of the stack unchanged.
Argument
Type
Description
scene
ViroARScene
Scene that will replace the scene at the top of stack and be displayed to the user
passProps
Object
Props to pass to the rendered scene
recenterTracking()
Reorients the virtual world such that directly forward of the user is [0, 0, -1] by rotating the scene by the user's y-rotation.