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