annotate examples/java3d/hello1.java @ 8:5e3cbbf173aa tip

Reorganise some more
author samer
date Fri, 05 Apr 2019 22:41:58 +0100
parents 5df24c91468d
children
rev   line source
samer@1 1 import samer.core.*;
samer@1 2 import javax.media.j3d.*;
samer@1 3 import javax.vecmath.*;
samer@1 4 import com.sun.j3d.utils.universe.*;
samer@1 5 import com.sun.j3d.utils.geometry.ColorCube;
samer@1 6 import java.awt.*;
samer@1 7
samer@1 8 public class hello1
samer@1 9 {
samer@1 10 public static void main(String[] args)
samer@1 11 {
samer@1 12 new samer.core.shells.SwingShell();
samer@1 13
samer@1 14 BranchGroup root=new BranchGroup();
samer@1 15 Transform3D x1=new Transform3D();
samer@1 16 Transform3D x2=new Transform3D();
samer@1 17 x1.rotZ(Math.PI/8);
samer@1 18 x2.set(new Vector3d(0.4,0,0));
samer@1 19 x2.mul(x1);
samer@1 20
samer@1 21 Group tg = new TransformGroup(x2);
samer@1 22 tg.addChild(new ColorCube(0.5));
samer@1 23 root.addChild(tg);
samer@1 24 root.compile();
samer@1 25
samer@1 26 Canvas3D canvas=new Canvas3D(null);
samer@1 27 SimpleUniverse U = new SimpleUniverse(canvas);
samer@1 28 U.getViewingPlatform().setNominalViewingTransform();
samer@1 29 U.addBranchGraph(root);
samer@1 30
samer@1 31 Shell.Window win;
samer@1 32 win=Shell.getWindow("hello");
samer@1 33 win.addWindowListener(Shell.exitListener());
samer@1 34 win.container().setLayout(new BorderLayout());
samer@1 35 win.container().add(canvas);
samer@1 36 win.expose();
samer@1 37 }
samer@1 38 }