Java Reference
In-Depth Information
private void setupShape3D(Shape3D shape3D, Model model) {
shape3D.setTranslateY(240.0d);
shape3D.setRotationAxis(new Point3D(1.0d, 1.0d, 1.0d));
shape3D.drawModeProperty().bind(model.drawModeProperty());
shape3D.cullFaceProperty().bind(model.cullFaceProperty());
shape3D.rotateProperty().bind(model.rotateProperty());
}
}
}
We create a sphere, a cylinder, and a box, give them distinct colors, and position them side by side. Because our
camera is looking into the screen from a negative z position, the projected view of the cylinder and the box are not
very interesting. So we rotate the 3D shapes around the (1, 1, 1) axis by 60 degrees. The control panel at the bottom
of the GUI allows you to change the drawing mode and face culling policies. It also allows you to change the rotation
angle.
When the program in Listing 10-3 is run, the Predefined 3D Shapes Example window in Figure 10-3 is displayed.
Figure 10-3. The Predefined3DShapesExample program
Figure 10-4 shows the three 3D shapes in wireframe form, with a different rotation angle.
 
Search WWH ::




Custom Search