/** * Adds an image panel group to a simple frame from a given image panel * group. * @param ipg an image panel group. * @return the attached image panel group. */ public ImagePanelGroup addImagePanels(ImagePanelGroup ipg) { _world.addChild(ipg); return ipg; }
/** * Adds a triangle group to a simple frame from a given triangle group. * @param tg a triangle group. * @return the attached triangle group. */ public TriangleGroup addTriangles(TriangleGroup tg) { _world.addChild(tg); return tg; }
private static void show(Node node) { World world = new World(); world.addChild(node); SimpleFrame sf = new SimpleFrame(world); sf.getOrbitView().setScale(2.0); } }
private static void show(Node node) { StateSet states = StateSet.forTwoSidedShinySurface(Color.CYAN); node.setStates(states); World world = new World(); world.addChild(node); SimpleFrame sf = new SimpleFrame(world); }
/** * Demos the default behavior. */ private static void demo0() { 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); sf.setTitle("OrbitViewLighting Demo: Default lighting"); }
/** * 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"); }
public static void main(String[] args) { StateSet states = new StateSet(); MaterialState ms = new MaterialState(); ms.setColorMaterialFront(GL_AMBIENT_AND_DIFFUSE); ms.setSpecularFront(Color.white); ms.setShininessFront(100.0f); states.add(ms); ColorCubeDemo cc1 = new ColorCubeDemo(); ColorCubeDemo cc2 = new ColorCubeDemo(); cc1.setStates(states); cc2.setStates(states); TransformGroup tg1 = new TransformGroup(Matrix44.translate(-2,0,0)); TransformGroup tg2 = new TransformGroup(Matrix44.translate( 2,0,0)); tg1.addChild(cc1); tg2.addChild(cc2); World world = new World(); world.addChild(tg1); world.addChild(tg2); DemoFrame frame = new DemoFrame(world); frame.setVisible(true); } }
public static void main(String[] args) { int n1 = 101; int n2 = 121; int n3 = 141; double d1 = 1.0/(n1-1); double d2 = d1; double d3 = d1; double f1 = 0.0; double f2 = 0.0; double f3 = 0.0; Sampling s1 = new Sampling(n1,d1,f1); Sampling s2 = new Sampling(n2,d2,f2); Sampling s3 = new Sampling(n3,d3,f3); float k1 = 4.0f*FLT_PI*(float)d1; float k2 = 4.0f*FLT_PI*(float)d2; float k3 = 4.0f*FLT_PI*(float)d3; float[][][] fb = rampfloat(0.0f,k1,k2,k3,n1,n2,n3); float[][][] fa = sin(fb); ImagePanelGroup2 ipg = new ImagePanelGroup2(s1,s2,s3,fa,fb); ipg.setPercentiles1(1,99); World world = new World(); world.addChild(ipg); DemoFrame frame = new DemoFrame(world); frame.setVisible(true); } }
public static void main(String[] args) { float[] xyz = makeSineWave(); xyz = addBulge(xyz); xyz = addTear(xyz); float[] rgb = makeColors(xyz); System.out.println("Making QuadGroup ..."); QuadGroup tg = new QuadGroup(true,xyz,rgb); System.out.println("QuadGroup bounding sphere =\n" + tg.getBoundingSphere(true)); StateSet states = new StateSet(); ColorState cs = new ColorState(); cs.setColor(Color.CYAN); states.add(cs); LightModelState lms = new LightModelState(); lms.setTwoSide(true); states.add(lms); MaterialState ms = new MaterialState(); ms.setColorMaterial(GL_AMBIENT_AND_DIFFUSE); ms.setSpecular(Color.white); ms.setShininess(100.0f); states.add(ms); tg.setStates(states); World world = new World(); world.addChild(tg); DemoFrame frame = new DemoFrame(world); OrbitView view = frame.getOrbitView(); view.setWorldSphere(new BoundingSphere(5,5,5,5)); frame.setSize(new Dimension(800,600)); frame.setVisible(true); }
public static void go() { float[] xyz = makeSineWave(); xyz = addBulge(xyz); xyz = addTear(xyz); float[] rgb = makeColors(xyz); TriangleGroup tg = new TriangleGroup(true,xyz,rgb); System.out.println("TriangleGroup bounding sphere =\n" + tg.getBoundingSphere(true)); StateSet states = new StateSet(); ColorState cs = new ColorState(); cs.setColor(Color.CYAN); states.add(cs); LightModelState lms = new LightModelState(); lms.setTwoSide(true); states.add(lms); MaterialState ms = new MaterialState(); ms.setColorMaterial(GL_AMBIENT_AND_DIFFUSE); ms.setSpecular(Color.WHITE); ms.setShininess(100.0f); states.add(ms); tg.setStates(states); World world = new World(); world.addChild(tg); DemoFrame frame = new DemoFrame(world); OrbitView view = frame.getOrbitView(); view.setWorldSphere(new BoundingSphere(5,5,5,5)); frame.setSize(new Dimension(800,600)); frame.setVisible(true); }
world.addChild(pg);
world.addChild(aaq);
ipg.setPercentiles(1,99); World world = new World(); world.addChild(ipg); final DemoFrame frame = new DemoFrame(world); frame.getOrbitView().setScale(2.0);
/** * 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"); }