/** * Returns a new simple frame with an image panel group. * @param ipg an image panel group. * @return the simple frame. */ public static SimpleFrame asImagePanels(ImagePanelGroup ipg) { SimpleFrame sf = new SimpleFrame(); sf.addImagePanels(ipg); sf.getOrbitView().setWorldSphere(ipg.getBoundingSphere(true)); return sf; }
private static void show(Node node) { World world = new World(); world.addChild(node); SimpleFrame sf = new SimpleFrame(world); sf.getOrbitView().setScale(2.0); } }
/** * Returns a new simple frame with a triangle group. * @param tg a triangle group. * @return the simple frame. */ public static SimpleFrame asTriangles(TriangleGroup tg) { SimpleFrame sf = new SimpleFrame(); sf.addTriangles(tg); sf.getOrbitView().setWorldSphere(tg.getBoundingSphere(true)); return sf; }
/** * Demos re-positioning the light source to the top-right corner. */ private static void demo1() { Sphere sphere = new Sphere(); StateSet states = StateSet.forTwoSidedShinySurface(Color.WHITE); sphere.setStates(states); World world = new World(); world.addChild(sphere); SimpleFrame sf = new SimpleFrame(world); OrbitViewLighting ovl = new OrbitViewLighting(); ovl.setPosition(0,1.0f,1.0f,0.0f); ovl.setLightSourceType(LightSourceType.DIRECTIONAL); sf.getOrbitView().setOrbitViewLighting(ovl); sf.setTitle("OrbitViewLighting Demo: Re-positioned primary light"); }
/** * Demos activating all three lights and assigning colors. */ private static void demo2() { Sphere sphere = new Sphere(); StateSet states = StateSet.forTwoSidedShinySurface(Color.WHITE); sphere.setStates(states); World world = new World(); world.addChild(sphere); SimpleFrame sf = new SimpleFrame(world); OrbitViewLighting ovl = new OrbitViewLighting(); ovl.setPosition(0,-2.0f, 2.0f,0.0f); ovl.setPosition(1, 2.0f, 2.0f,0.0f); ovl.setPosition(2, 0.0f,-2.0f,0.0f); ovl.setLightSourceType(0, LightSourceType.POSITIONAL); ovl.setLightSourceType(1, LightSourceType.POSITIONAL); ovl.setLightSourceType(2, LightSourceType.POSITIONAL); ovl.setDiffuse(0,RED); ovl.setDiffuse(1,GREEN); ovl.setDiffuse(2,BLUE); ovl.toggleLight(1); ovl.toggleLight(2); sf.getOrbitView().setOrbitViewLighting(ovl); sf.setTitle("OrbitViewLighting Demo: Three Lights"); }