Java Code Examples for javafx.scene.shape.MeshView#getMesh()

The following examples show how to use javafx.scene.shape.MeshView#getMesh() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OrthoSliceMeshFX.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
public void setTexCoords(final RealLocalizable texCoordMin, final RealLocalizable texCoordMax)
{
	final List<RealPoint> texCoordsPoints = calculateTexCoords(texCoordMin, texCoordMax);
	for (int row = 0; row < 2; ++row) {
		for (int col = 0; col < 2; ++col) {
			final MeshView meshView = meshViews.get(2 * row + col);
			if (meshView == null)
				continue;
			final TriangleMesh mesh = (TriangleMesh) meshView.getMesh();

			mesh.getTexCoords().clear();
			final int[] pointIndices = getPointIndicesForQuadrant(row, col);
			for (final int ptIndex : pointIndices) {
				texCoordsPoints.get(ptIndex).localize(buf2D);
				mesh.getTexCoords().addAll(buf2D);
			}
		}
	}
}
 
Example 2
Source File: Utils.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static Point3D getMeshNormal(MeshView mesh){
    TriangleMesh tm = (TriangleMesh) mesh.getMesh();
    float[] fPoints = new float[tm.getPoints().size()];
    tm.getPoints().toArray(fPoints);
    Point3D BA = new Point3D(fPoints[3] - fPoints[0], fPoints[4] - fPoints[1], fPoints[5] - fPoints[2]);
    Point3D CA = new Point3D(fPoints[6] - fPoints[0], fPoints[7] - fPoints[1], fPoints[8] - fPoints[2]);
    Point3D normal = BA.crossProduct(CA);
    Affine a = new Affine(mesh.getTransforms().get(0));
    return a.transform(normal.normalize());
}
 
Example 3
Source File: Utils.java    From RubikFX with GNU General Public License v3.0 5 votes vote down vote up
private static Point3D getMeshNormal(MeshView mesh){
    TriangleMesh tm=(TriangleMesh)mesh.getMesh();
    float[] fPoints=new float[tm.getPoints().size()];
    tm.getPoints().toArray(fPoints);
    Point3D BA=new Point3D(fPoints[3]-fPoints[0],fPoints[4]-fPoints[1],fPoints[5]-fPoints[2]);
    Point3D CA=new Point3D(fPoints[6]-fPoints[0],fPoints[7]-fPoints[1],fPoints[8]-fPoints[2]);
    Point3D normal=BA.crossProduct(CA);
    Affine a=new Affine(mesh.getTransforms().get(0));
    return a.transform(normal.normalize());
}