My goal is a game played with dice. I am using javafx.
First question: Is there an easy way to customize the 3d box in javafx. It doesn\'t matter
The problem with Box
, as you may have already noticed, is that if you apply an image as diffuse map, it will be applied equally to all its 6 faces.
If you have a look at FXyz project, there's an implementation of a similar 3D shape, CuboidMesh
.
Having full access to its 'TriangleMesh` it's easy to customize the way the texture is mapped to a diffuse image. In this case, the way its implemented is by using the net of the cube:
So now you just need to provide your own net. For instance, this one:
from here
Just rotate it 180º and crop it to its border, and with this short code you will have your dice:
CuboidMesh cuboid = new CuboidMesh(10f,10f,10f);
cuboid.setTextureModeImage(getClass().getResource("rotated_image014.jpg").toExternalForm());