Java Code Examples for javafx.scene.shape.Box#setMaterial()

The following examples show how to use javafx.scene.shape.Box#setMaterial() . 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: ThreeDOM.java    From scenic-view with GNU General Public License v3.0 6 votes vote down vote up
private void buildAxes(Group world) {
    PhongMaterial redMaterial = new PhongMaterial();
    redMaterial.setDiffuseColor(Color.DARKRED);
    redMaterial.setSpecularColor(Color.RED);
    PhongMaterial greenMaterial = new PhongMaterial();
    greenMaterial.setDiffuseColor(Color.DARKGREEN);
    greenMaterial.setSpecularColor(Color.GREEN);
    PhongMaterial blueMaterial = new PhongMaterial();
    blueMaterial.setDiffuseColor(Color.DARKBLUE);
    blueMaterial.setSpecularColor(Color.BLUE);

    Box xAxis = new Box(AXES_SIZE, 1, 1);
    xAxis.setMaterial(redMaterial);
    Box yAxis = new Box(1, AXES_SIZE, 1);
    yAxis.setMaterial(greenMaterial);
    Box zAxis = new Box(1, 1, AXES_SIZE);
    zAxis.setMaterial(blueMaterial);

    Group group = new Group();
    group.getChildren().addAll(xAxis, yAxis, zAxis);
    group.setVisible(true);
    world.getChildren().addAll(group);
    group.visibleProperty().bind(checkBoxAxes.selectedProperty());
}
 
Example 2
Source File: Viewer3d.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
private Xform buildAxes()
{
    Xform axes = new Xform();
    final PhongMaterial red = new PhongMaterial();
    red.setDiffuseColor(Color.RED);
    red.setSpecularColor(Color.DARKRED);

    final PhongMaterial green = new PhongMaterial();
    green.setDiffuseColor(Color.GREEN);
    green.setSpecularColor(Color.DARKGREEN);

    final PhongMaterial blue = new PhongMaterial();
    blue.setDiffuseColor(Color.BLUE);
    blue.setSpecularColor(Color.DARKBLUE);

    final Box xAxis = new Box(AXIS_LENGTH, 1, 1);
    final Box yAxis = new Box(1, AXIS_LENGTH, 1);
    final Box zAxis = new Box(1, 1, AXIS_LENGTH);

    xAxis.setTranslateX(AXIS_LENGTH/2 + 0.5);
    yAxis.setTranslateY(AXIS_LENGTH/2 + 0.5);
    zAxis.setTranslateZ(AXIS_LENGTH/2 + 0.5);

    xAxis.setMaterial(red);
    yAxis.setMaterial(green);
    zAxis.setMaterial(blue);

    axes.getChildren().addAll(xAxis, yAxis, zAxis);

    return axes;
}
 
Example 3
Source File: ContentModel.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void buildAxes() {
    double length = 2d * dimModel;
    double width = dimModel / 100d;
    double radius = 2d * dimModel / 100d;
    final PhongMaterial redMaterial = new PhongMaterial();
    redMaterial.setDiffuseColor(Color.DARKRED);
    redMaterial.setSpecularColor(Color.RED);
    final PhongMaterial greenMaterial = new PhongMaterial();
    greenMaterial.setDiffuseColor(Color.DARKGREEN);
    greenMaterial.setSpecularColor(Color.GREEN);
    final PhongMaterial blueMaterial = new PhongMaterial();
    blueMaterial.setDiffuseColor(Color.DARKBLUE);
    blueMaterial.setSpecularColor(Color.BLUE);
    
    Sphere xSphere = new Sphere(radius);
    Sphere ySphere = new Sphere(radius);
    Sphere zSphere = new Sphere(radius);
    xSphere.setMaterial(redMaterial);
    ySphere.setMaterial(greenMaterial);
    zSphere.setMaterial(blueMaterial);
    
    xSphere.setTranslateX(dimModel);
    ySphere.setTranslateY(dimModel);
    zSphere.setTranslateZ(dimModel);
    
    Box xAxis = new Box(length, width, width);
    Box yAxis = new Box(width, length, width);
    Box zAxis = new Box(width, width, length);
    xAxis.setMaterial(redMaterial);
    yAxis.setMaterial(greenMaterial);
    zAxis.setMaterial(blueMaterial);
    
    autoScalingGroup.getChildren().addAll(xAxis, yAxis, zAxis);
    autoScalingGroup.getChildren().addAll(xSphere, ySphere, zSphere);
}
 
Example 4
Source File: ContentModel.java    From RubikFX with GNU General Public License v3.0 5 votes vote down vote up
private void buildAxes() {
    double length = 2d*dimModel;
    double width = dimModel/100d;
    double radius = 2d*dimModel/100d;
    final PhongMaterial redMaterial = new PhongMaterial();
    redMaterial.setDiffuseColor(Color.DARKRED);
    redMaterial.setSpecularColor(Color.RED);
    final PhongMaterial greenMaterial = new PhongMaterial();
    greenMaterial.setDiffuseColor(Color.DARKGREEN);
    greenMaterial.setSpecularColor(Color.GREEN);
    final PhongMaterial blueMaterial = new PhongMaterial();
    blueMaterial.setDiffuseColor(Color.DARKBLUE);
    blueMaterial.setSpecularColor(Color.BLUE);
    
    Sphere xSphere = new Sphere(radius);
    Sphere ySphere = new Sphere(radius);
    Sphere zSphere = new Sphere(radius);
    xSphere.setMaterial(redMaterial);
    ySphere.setMaterial(greenMaterial);
    zSphere.setMaterial(blueMaterial);
    
    xSphere.setTranslateX(dimModel);
    ySphere.setTranslateY(dimModel);
    zSphere.setTranslateZ(dimModel);
    
    Box xAxis = new Box(length, width, width);
    Box yAxis = new Box(width, length, width);
    Box zAxis = new Box(width, width, length);
    xAxis.setMaterial(redMaterial);
    yAxis.setMaterial(greenMaterial);
    zAxis.setMaterial(blueMaterial);
    
    autoScalingGroup.getChildren().addAll(xAxis, yAxis, zAxis);
    autoScalingGroup.getChildren().addAll(xSphere, ySphere, zSphere);
}