Mercurial > hg > jslab
comparison examples/java3d/hello2.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 | |
7 public class hello2 | |
8 { | |
9 public static void main(String[] args) | |
10 { | |
11 new samer.core.shells.SwingShell(); | |
12 run(); | |
13 } | |
14 | |
15 | |
16 public static void run() | |
17 { | |
18 BranchGroup root=new BranchGroup(); | |
19 Transform3D xform=new Transform3D(); | |
20 Transform3D axis=new Transform3D(); | |
21 | |
22 axis.set(new Vector3d(0.5,0,0)); | |
23 | |
24 TransformGroup tg = new TransformGroup(xform); | |
25 | |
26 Alpha alpha = new Alpha(-1, 4000); | |
27 Behavior rotator = new RotationInterpolator(alpha, tg, axis, 0f, (float)(2*Math.PI)); | |
28 | |
29 rotator.setSchedulingBounds(new BoundingSphere()); | |
30 tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); | |
31 tg.addChild(rotator); | |
32 tg.addChild(new ColorCube(0.5)); | |
33 | |
34 root.addChild(tg); | |
35 root.compile(); | |
36 | |
37 Canvas3D canvas=new Canvas3D(null); | |
38 SimpleUniverse U = new SimpleUniverse(canvas); | |
39 U.getViewingPlatform().setNominalViewingTransform(); | |
40 U.addBranchGraph(root); | |
41 | |
42 Shell.Window win; | |
43 win=Shell.getWindow("hello"); | |
44 win.addWindowListener(Shell.exitListener()); | |
45 win.container().setLayout(new java.awt.BorderLayout()); | |
46 win.container().add(canvas); | |
47 win.expose(); | |
48 } | |
49 } |