Problem
This form consists of 6 separate figures. Four triangles meet at point A. And the rectangle below, because these are triangles, you need two triangles to create a rectangle. The following figure shows a top view of this form.

As you can see, we have 5 points. Therefore, they must be added to the points of the TriangleMesh. One point consists of a teapel of three float values ββ(x, y, z). Thus, this array always consists of sizes 3, 6, 9, ..., 15, etc.
Textures
If you have an image as the material of your grid (like you), you need to get the coordinates of the texture and add the coordinates of the images to them. But what have you added here? These are the 2D coordinates of your image that you want to set as material. It starts with (0.0, 0.0) (u0, v0) and rises to (1.0, 1.0) (u1, v1). This is the 2D coordination of the part of the image that you want to display on your 3D grid. Since you only have a noisy image, you can do from 0.0 to 1.1, but you need 3 points for the triangle.
Facing
Now you need to make the lining. This is similar to the fact that you want to place some plates in the space between the lines of your shape. As you have already seen, you must add four parts for the triangles and two parts for the bottom.
The face is a tuple of six values. Since we draw triangles, it is always something like: from a point, point, point. Thus, a tuple consists of 6 values. p0, t0, p1, t1, p2, t2. These values ββare indices for points and texture arrays. p0 points to the first tuple of the point array tree, t0 points to the first two sets of texture coordinates array.
(counter) clockwise
My explanation may not be entirely correct, but here is how I understood it:
The JavaFX camera by default works counterclockwise, so if you place faces counterclockwise, your faces will be visible to the camera. Individuals do not access, this is done internally in JavaFX for performance issues. The reverse face will not be displayed by any material unless you set the reject back.
To view the bottom of this triangle, the camera must change its perspective, so it is clockwise. And again the same thing with a face in front and behind.
In your example, I named the points, because now you can see which faces I displayed first and which finally. For example:
ABC is the first person for me, it is the triangle between points A, B and C. These points get their texture from the image coordinates of the material.
For more details, see the blog post by Jose Pereda: http://jperedadnr.blogspot.de/2015/01/creating-and-texturing-javafx-3d-shapes.html
I hope you understand everything, and then below you will find my solution.
Decision
import java.util.Random; import javafx.application.Application; import javafx.geometry.Point3D; import javafx.scene.Group; import javafx.scene.PerspectiveCamera; import javafx.scene.Scene; import javafx.scene.SceneAntialiasing; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.image.PixelWriter; import javafx.scene.image.WritableImage; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.scene.paint.PhongMaterial; import javafx.scene.shape.Box; import javafx.scene.shape.DrawMode; import javafx.scene.shape.MeshView; import javafx.scene.shape.TriangleMesh; import javafx.scene.transform.Rotate; import javafx.stage.Stage; public class Test extends Application { private double mousePosX, mousePosY; private double mouseOldX, mouseOldY; private final Rotate rotateX = new Rotate(20, Rotate.X_AXIS); private final Rotate rotateY = new Rotate(-45, Rotate.Y_AXIS); @Override public void start(Stage primaryStage) {
