Java Reference
In-Depth Information
mesh.getFaceSmoothingGroups().addAll(0, 0, 0, 0);
return mesh;
}
}
}
The createSimplex() method of the View class constructs a very simple TriangleMesh called a simplex . It has
four vertices at O ( 0 , 0 , 0 ), A ( length , 0 , 0 ), B ( 0 , length , 0 ), and C ( 0 , 0 , length ), and four faces, OBA , OCB , OAC , and ABC .
No face smoothing groups are defined for this TriangleMesh .
When the program in Listing 10-4 is run, the MeshView Example window in Figure 10-5 is displayed. You can
change the material , drawMode , and cullFace properties from the control panel. You can also rotate around the (1, 1, 1)
axis to see different faces of the simplex.
Figure 10-5. The MeshViewExample program
Now that we understand the predefined and user-defined 3D shapes, we move on to the other important classes
in the JavaFX 3D graphics API.
Adding Cameras to JavaFX 3D Scenes
So far in this chapter, we have not added our own cameras to our JavaFX 3D scenes. We have been relying on the
default camera that the JavaFX runtime supplies to the scenes. It allows us to look at our scene from a negative z
position. To look at our scenes from any other angle, we need to supply our own camera.
The class hierarchy for cameras consists of a Camera abstract base class, and its concrete subclasses
ParallelCamera and PerspectiveCamera . They belong to the javafx.scene package. The ParallelCamera is the
camera that the JavaFX runtime supplies when we do not set our own camera. It always displays objects at the
 
Search WWH ::




Custom Search