samer@1: import samer.core.*; samer@1: import javax.media.j3d.*; samer@1: import javax.vecmath.*; samer@1: import com.sun.j3d.utils.universe.*; samer@1: import com.sun.j3d.utils.behaviors.keyboard.*; samer@1: samer@1: public class hello3 extends util samer@1: { samer@1: BranchGroup root=new BranchGroup(); samer@1: Bounds bounds=new BoundingSphere(); samer@1: Canvas3D canvas=new Canvas3D(null); samer@1: samer@1: public static void main(String[] args) samer@1: { samer@1: new samer.core.shells.AppShell(args); samer@1: hello3 app=new hello3(); samer@1: samer@1: Shell.Window win; samer@1: win=Shell.getWindow("hello"); samer@1: win.addWindowListener(Shell.exitListener()); samer@1: win.container().setLayout(new java.awt.BorderLayout()); samer@1: win.container().add(app.canvas); samer@1: win.expose(); samer@1: } samer@1: samer@1: public hello3() samer@1: { samer@1: SimpleUniverse U = new SimpleUniverse(canvas); samer@1: TransformGroup tg = new TransformGroup(); samer@1: samer@1: addRotator(tg); samer@1: addBackground(root,new Background(0.1f,0.2f,0.15f)); samer@1: tg.addChild(createObject()); samer@1: root.addChild(tg); samer@1: samer@1: KeyNavigatorBehavior keyNavBeh = new KeyNavigatorBehavior( samer@1: U.getViewingPlatform().getViewPlatformTransform()); samer@1: keyNavBeh.setSchedulingBounds(bounds); samer@1: root.addChild(keyNavBeh); samer@1: root.compile(); samer@1: samer@1: U.getViewingPlatform().setNominalViewingTransform(); samer@1: U.addBranchGraph(root); samer@1: } samer@1: samer@1: public static Group createObject() samer@1: { samer@1: Shape3D faces=new Shape3D(); samer@1: Shape3D edges=new Shape3D(); samer@1: Geometry geom=yoyoGeometryInfo(20).getGeometryArray(); samer@1: samer@1: faces.setGeometry(geom); samer@1: edges.setGeometry(geom); samer@1: samer@1: faces.setAppearance(translucent()); samer@1: edges.setAppearance(pointy()); samer@1: samer@1: BranchGroup bg = new BranchGroup(); samer@1: bg.addChild(faces); samer@1: bg.addChild(edges); samer@1: samer@1: return bg; samer@1: } samer@1: }