Add VR functionality
Source file: JRViewerVR
To obtain virtual reality environment in JRViewer, you should first create an instance of JRViewer through the standard constructor.
JRViewer v = new JRViewer();
Then activate the basicUI plugin set. This set includes
- a scene graph navigator,
- a bean shell,
- tool bar,
- export capabilities, and
- a few other nice features.
Then activate the VR plugin set. This set includes
- an avatar for navigating the
- terrain, and
- a skybox.
The next two lines describe the content type. In this case, we use the type TERRAIN_ALIGNED to indicate that content should be scaled and positioned to fit into the terrain. The scaling factor is consistent with an avatar with a height of 1.7 units. We also add the plugin name ContentAppearance which provides a convenient inspector for the appearance attached to the content.
v.addContentSupport(ContentType.TerrainAligned); v.registerPlugin(new ContentAppearance());
Finally set the content itself:
All that's left is to call startup() on the JRViewer instance. We turn off display of the menu bar to simulate the function of the simple JRViewer as much as possible.
Finally, encompass the scene by typing the 'e' key once you have the focus in the graphics window.