Java Reference
In-Depth Information
mesh.getFaceSmoothingGroups().addAll(
0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5
);
return mesh;
}
@Override
public void start(Stage stage) {
stage.setTitle("MeshCubePickDemo");
Image diffuseMap = new Image(MeshCubePickDemo.class
.getResource("cbGn_pof-bm.png").toExternalForm());
PhongMaterial earthMaterial = new PhongMaterial();
earthMaterial.setDiffuseMap(diffuseMap);
MeshView cube =
new MeshView(createMesh(EDGE_LENGTH, EDGE_LENGTH, EDGE_LENGTH));
cube.setMaterial(earthMaterial);
final Group parent = new Group(cube);
parent.setTranslateX(320);
parent.setTranslateY(240);
parent.setTranslateZ(0);
Rotate xRotate;
Rotate yRotate;
parent.getTransforms().setAll(
xRotate = new Rotate(0, Rotate.X_AXIS),
yRotate = new Rotate(0, Rotate.Y_AXIS)
);
xRotate.angleProperty().bind(angleX);
yRotate.angleProperty().bind(angleY);
final Group root = new Group(parent);
final Scene scene = new Scene(root, 640, 480, true);
scene.setFill(Color.WHITE);
scene.setOnMousePressed((MouseEvent event) -> {
anchorX = event.getSceneX();
anchorY = event.getSceneY();
anchorAngleX = angleX.get();
anchorAngleY = angleY.get();
PickResult pr = event.getPickResult();
facePickedLabel.setText("Face picked: "
+ pr.getIntersectedFace());
});
Search WWH ::




Custom Search