SimpleUniverse u = new SimpleUniverse(); // create a BranchGroup. A BranchGroup is a node in // a Tree data structure that can have child nodes BranchGroup bgRoot = new BranchGroup(); // create the Background node and add it to the SimpleUniverse u.addBranchGraph( createBackground() );
public Panel createPanel() { Panel p = new Panel(); p.setPreferredSize(new Dimension(512, 512)); p.setLayout(new BorderLayout()); Canvas3D canvas3D = new Canvas3D( SimpleUniverse.getPreferredConfiguration()); p.add("Center", canvas3D); BranchGroup scene = createSceneGraph(); scene.compile(); SimpleUniverse simpleU = new SimpleUniverse(canvas3D); simpleU.getViewingPlatform().setNominalViewingTransform(); simpleU.addBranchGraph(scene); return p; } // end of HelloJava3Dd (constructor)
SimpleUniverse u=new SimpleUniverse();
public Test() { SimpleUniverse universe = new SimpleUniverse(); BranchGroup group = new BranchGroup(); TransformGroup rootTransformGroup = new TransformGroup(); group.addChild(rootTransformGroup); rootTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); rootTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); ColorCube colorCube = new ColorCube(.3); rootTransformGroup.addChild(colorCube); BoundingSphere boundingSphere = new BoundingSphere(new Point3d(0, 0, 0), 1000); MouseRotate mouseRotate = new MouseRotate(); mouseRotate.setTransformGroup(rootTransformGroup); mouseRotate.setSchedulingBounds(boundingSphere); group.addChild(mouseRotate); MouseTranslate mouseTrans = new MouseTranslate(); mouseTrans.setTransformGroup(rootTransformGroup); mouseTrans.setSchedulingBounds(boundingSphere); group.addChild(mouseTrans); universe.getViewingPlatform().setNominalViewingTransform(); universe.addBranchGraph(group); }
SimpleUniverse u=new SimpleUniverse();
SimpleUniverse universe = new SimpleUniverse(); BranchGroup group = new BranchGroup(); group.addChild(createModel());