JavaFX 3D surface painting example

Ғылым және технология

Demonstrating drawing a crosshair on a JavaFX 3D trianglemesh by manipulating the underlying PhongMaterial Diffuse Image pixels.
FXyz3D SurfacePlotMesh on the left is a grid of randomized data. SurfacePlotMesh on the right is a copy of the vertices but with the faces and texture coordinates mapped to a WritableImage. This image object is used as the Diffuse Image.
As the mouse moves over the actual surface mesh, the location in the data grid is calculated and the diffuse image pixels are altered to show a crosshair centered at the mouse location. This gives the illusion of an animated crosshair that is "clamped" to the surface. At each mouse movement the image is painted Color.TRANSPARENT prior to illuminating the crosshair to allow the underlying colors of another mesh (the actual) to show through.

Пікірлер

    Келесі