List of usage examples for javax.media.j3d BranchGroup compile
public void compile()
From source file:HelloWorld.java
public static void main(String[] args) { Frame frame = new Frame(); frame.setSize(640, 480);//ww w. j a v a 2s . c o m frame.setLayout(new BorderLayout()); Canvas3D canvas = new Canvas3D(null); frame.add("Center", canvas); SimpleUniverse univ = new SimpleUniverse(canvas); univ.getViewingPlatform().setNominalViewingTransform(); BranchGroup scene = createSceneGraph(); scene.compile(); univ.addBranchGraph(scene); frame.show(); }
From source file:Rotation.java
public void init() { setLayout(new BorderLayout()); GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); canvas3D = new Canvas3D(config); add("Center", canvas3D); BranchGroup szene = macheSzene(); szene.compile(); universe = new SimpleUniverse(canvas3D); universe.getViewingPlatform().setNominalViewingTransform(); universe.addBranchGraph(szene);//from w w w. j av a 2s. c o m }
From source file:LitSphereApp.java
public LitSphereApp() { setLayout(new BorderLayout()); Canvas3D c = new Canvas3D(null); add("Center", c); BranchGroup scene = createScene(); scene.compile(); SimpleUniverse u = new SimpleUniverse(c); // This will move the ViewPlatform back a bit so the // objects in the scene can be viewed. u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(scene);/* w w w. j a va 2 s . co m*/ }
From source file:AxisApp.java
public BranchGroup createSceneGraph() { BranchGroup objRoot = new Axis().getBG(); // Let Java 3D perform optimizations on this scene graph. objRoot.compile(); return objRoot; }
From source file:LightScopeApp.java
public LightScopeApp() { setLayout(new BorderLayout()); Canvas3D c = new Canvas3D(null); add("Center", c); BranchGroup scene = createScene(); scene.compile(); SimpleUniverse u = new SimpleUniverse(c); // This will move the ViewPlatform back a bit so the // objects in the scene can be viewed. u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(scene);/*from w ww . j av a2s . c o m*/ }
From source file:Text2DTest.java
public void init() { setLayout(new BorderLayout()); GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); Canvas3D c = new Canvas3D(config); add("Center", c); // Create a simple scene and attach it to the virtual universe BranchGroup scene = createSceneGraph(); u = new SimpleUniverse(c); MoverBehavior navigator = new MoverBehavior(u.getViewingPlatform().getViewPlatformTransform()); scene.addChild(navigator);/*from w ww . j a v a2 s . c o m*/ // Have Java 3D perform optimizations on this scene graph. scene.compile(); // This will move the ViewPlatform back a bit so the // objects in the scene can be viewed. u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(scene); }
From source file:FPSCounterDemo.java
public void init() { setLayout(new BorderLayout()); GraphicsConfiguration config = SimpleUniverse .getPreferredConfiguration();// w w w . j ava 2 s . com Canvas3D c = new Canvas3D(config); add("Center", c); // Create a simple scene and attach it to the virtual universe BranchGroup scene = createSceneGraph(); // Parse the command line to set the various parameters // Have Java 3D perform optimizations on this scene graph. scene.compile(); u = new SimpleUniverse(c); // This will move the ViewPlatform back a bit so the // objects in the scene can be viewed. u.getViewingPlatform().setNominalViewingTransform(); u.addBranchGraph(scene); JOptionPane .showMessageDialog( this, "\nThis program measures the number of frames rendered per second.\nNote that the frame rate is limited by the refresh rate of the monitor.\nTo get the true frame rate you need to disable vertical retrace.\n\nOn Windows(tm) you do this through the Control Panel.\n\nOn Unix set the environment variable OGL_NO_VBLANK\n(i.e. type \"setenv OGL_NO_VBLANK\" at the command prompt)", "Frame Counter", JOptionPane.INFORMATION_MESSAGE); }
From source file:HelloJava3Db.java
public BranchGroup createSceneGraph() { // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); // rotate object has composited transformation matrix Transform3D rotate = new Transform3D(); Transform3D tempRotate = new Transform3D(); rotate.rotX(Math.PI / 4.0d);// ww w . j av a 2s. c om tempRotate.rotY(Math.PI / 5.0d); rotate.mul(tempRotate); TransformGroup objRotate = new TransformGroup(rotate); objRoot.addChild(objRotate); objRotate.addChild(new ColorCube(0.4)); // Let Java 3D perform optimizations on this scene graph. objRoot.compile(); return objRoot; }
From source file:HelloJava3Dbalt.java
public BranchGroup createSceneGraph() { // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); // rotate object has composited transformation matrix Transform3D rotate = new Transform3D(); Transform3D tempRotate = new Transform3D(); rotate.rotX(Math.PI / 4.0d);//from w ww.ja v a 2s .c o m tempRotate.rotY(Math.PI / 5.0d); tempRotate.mul(rotate); TransformGroup objRotate = new TransformGroup(tempRotate); objRoot.addChild(objRotate); objRotate.addChild(new ColorCube(0.4)); // Let Java 3D perform optimizations on this scene graph. objRoot.compile(); return objRoot; }
From source file:SimpleBehaviorApp.java
public BranchGroup createSceneGraph() { // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); TransformGroup objRotate = new TransformGroup(); objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objRoot.addChild(objRotate);// w ww . j av a2s .c om objRotate.addChild(new ColorCube(0.4)); SimpleBehavior myRotationBehavior = new SimpleBehavior(objRotate); myRotationBehavior.setSchedulingBounds(new BoundingSphere()); objRoot.addChild(myRotationBehavior); // Let Java 3D perform optimizations on this scene graph. objRoot.compile(); return objRoot; }