Java Reference
In-Depth Information
Figure 10-4. The Predefined3DShapesExample program, in wireframe form
Creating User-Defined 3D Shapes
The MeshView class is a Node that allows arbitrary user-defined 3D shapes to be incorporated into JavaFX scenes. It has
the following constructors:
MeshView()
MeshView(Mesh mesh)
The default constructor creates a MeshView without a Mesh . The one-parameter constructor creates a MeshView
with the specified mesh . The mesh is available as a read-write object property. The Mesh abstract class and its
TriangleMesh concrete subclass are where the geometric information of the 3D shape is stored. The geometric
information in a TriangleMesh includes
The three-dimensional coordinates of all the vertices, or points, of the 3D shape
The two-dimensional texture coordinates used by the 3D shape
The faces of the 3D shape, each one a triangle with vertices that are from the vertices list and
texture coordinates that are from the texture coordinates list
The face smoothing groups, which cause the JavaFX runtime to connect faces in the same
smoothing group smoothly across their common edges, and to leave the edges between faces
not in the same smoothing group as hard edges
For efficiency reasons, the TriangleMesh class stores this information in observable arrays. The following public
methods allow you to access these observable arrays and their sizes:
ObservableFloatArray getPoints()
ObservableFloatArray getTexCoords()
 
Search WWH ::




Custom Search