import org.jdesktop.lg3d.sg.*; import org.jdesktop.lg3d.utils.eventaction.*; import org.jdesktop.lg3d.utils.layoutmanager.*; import org.jdesktop.lg3d.utils.shape.*; import org.jdesktop.lg3d.wg.Component3D; import org.jdesktop.lg3d.wg.Container3D; import org.jdesktop.lg3d.wg.Frame3D; public class ShapesFactory { public ShapesFactory() { Frame3D frame = new Frame3D(); Container3D container = new Container3D(); container.setLayout(new BookshelfLayout(true, 0.0f, 0.01f, 0.03f)); // F‚̔ container.addChild(createColorCube()); // container.addChild(createBox()); // Op container.addChild(createCone()); // ~ container.addChild(createCylinder()); // ~ container.addChild(createDisc()); // container.addChild(createSphere()); new ComponentMover(frame); frame.addChild(container); frame.setCapabilities(); frame.setActive(true); frame.setVisible(true); } private Component3D createColorCube() { ColorCube cube = new ColorCube(0.01); Component3D comp = new Component3D(); comp.addChild(cube); return comp; } private Component3D createBox() { Appearance app = new SimpleAppearance(1.0f, 0.6f, 0.6f, 1.0f, SimpleAppearance.DISABLE_CULLING); Box box = new Box(0.01f, 0.02f, 0.005f, app); Component3D comp = new Component3D(); comp.addChild(box); return comp; } private Component3D createCone() { Appearance app = new SimpleAppearance(0.6f, 1.0f, 0.6f, 1.0f, SimpleAppearance.DISABLE_CULLING); Cone cone = new Cone(0.01f, 0.01f, app); Component3D comp = new Component3D(); comp.addChild(cone); return comp; } private Component3D createCylinder() { Appearance app = new SimpleAppearance(0.6f, 0.6f, 1.0f, 1.0f, SimpleAppearance.DISABLE_CULLING); Cylinder cylinder = new Cylinder(0.01f, 0.01f, app); Component3D comp = new Component3D(); comp.addChild(cylinder); return comp; } private Component3D createDisc() { Appearance app = new SimpleAppearance(1.0f, 1.0f, 0.6f, 1.0f, SimpleAppearance.DISABLE_CULLING); Disc disc = new Disc(0.02f, 20, app); Component3D comp = new Component3D(); comp.addChild(disc); return comp; } private Component3D createSphere() { Appearance app = new SimpleAppearance(1.0f, 0.6f, 1.0f, 1.0f, SimpleAppearance.DISABLE_CULLING); Sphere sphere = new Sphere(0.01f, app); Component3D comp = new Component3D(); comp.addChild(sphere); return comp; } public static void main(String[] args) { new ShapesFactory(); } }