Display a geometry in ViewerVR
From JReality Wiki
First of all we create an instance of ViewerVR through the static factory method ViewerVR.createDefaultViewerVR(String[][] loadableResources).
package de.jreality.tutorial; import de.jreality.geometry.Primitives; import de.jreality.scene.SceneGraphComponent; import de.jreality.ui.viewerapp.ViewerApp; import de.jreality.vr.ViewerVR; public class IcosahedronVR { public static void main(String[] args) { ViewerVR vvr=ViewerVR.createDefaultViewerVR(null);
Then we set its content to a new SceneGraphComponent.
SceneGraphComponent sgc = new SceneGraphComponent("Icosahedron"); vvr.setContent(sgc);
The geometry of this SceneGraphComponent is now set to an icosahedron.
sgc.setGeometry(Primitives.icosahedron());
Finally we ask the ViewerVR to initialize a ViewerApp and make it visible:
final ViewerApp vapp=vvr.initialize(); vapp.update(); vapp.display(); } }
Screenshot
To get the environment (sky box) of the screenshot above you need to put vrData.jar into your classpath (see downloads) and switch to the emerald environment.
|