Java 类javafx.scene.shape.Box 实例源码

项目:javafx-3d-surface-chart    文件:AxisOrientation.java   
public AxisOrientation(int size) {
    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);
    final Box xAxis = new Box(size + 100, 2, 2);
    final Box yAxis = new Box(2, size + 100, 2);
    final Box zAxis = new Box(2, 2, size + 100);

    xAxis.setMaterial(redMaterial);
    yAxis.setMaterial(greenMaterial);
    zAxis.setMaterial(blueMaterial);

    this.getChildren().addAll(xAxis, yAxis, zAxis);
}
项目:minecraft-jfx-skin    文件:SkinMultipleCubes.java   
public Face(Image image, int startX, int startY, int width, int height, int interval, boolean reverseX, boolean reverseY,
        Supplier<Box> supplier, BiConsumer<Box, Point2D> consumer) {
    PixelReader reader = image.getPixelReader();
    for (int x = 0; x < width; x++)
        for (int y = 0; y < height; y++) {
            int argb;
            if ((argb = reader.getArgb(startX + (reverseX ? width - x - 1 : x) * interval,
                    startY + (reverseY ? height - y - 1 : y) * interval)) != 0) {
                Box pixel = supplier.get();
                consumer.accept(pixel, new Point2D(x, y));
                pixel.setMaterial(createMaterial(Color.rgb(
                        (argb >> 16) & 0xFF, (argb >> 8) & 0xFF, (argb >> 0) & 0xFF)));
                getChildren().add(pixel);
            }
        }
}
项目:openjfx-8u-dev-tests    文件:ShapesPickingAbstractApp.java   
@Override
protected void initKeys(Scene scene) {
    scene.addEventHandler(KeyEvent.ANY, new EventHandler<KeyEvent>() {
        @Override
        public void handle(KeyEvent t) {
            switch (t.getText()) {
                case "1":
                    setShape(Shape.Sphere);
                    break;
                case "2":
                    setShape(Shape.Box);
                    break;
                case "3":
                    setShape(Shape.Cylinder);
                    break;
            }
        }
    });
}
项目:openjfx-8u-dev-tests    文件:LightScopeTestApp.java   
private Group buildMultipleShapes3D() {
    Box box = new Box(100, 100, 100);
    Sphere sphere = new Sphere(50);
    Cylinder cyl = new Cylinder(50, 100);
    Cone cone = new Cone(50, 100);
    box.setTranslateX(-100);
    box.setTranslateY(-150);

    sphere.setTranslateX(100);
    sphere.setTranslateY(-50);

    cyl.setTranslateX(-100);
    cyl.setTranslateY(50);

    cone.getMesh().setTranslateX(100);
    cone.getMesh().setTranslateY(150);

    nodes.add(box);
    nodes.add(sphere);
    nodes.add(cyl);
    nodes.add(cone.getMesh());
    return new Group(box, sphere, cyl, cone.getMesh());
}
项目:singa    文件:StructureViewer.java   
private void buildCubes(ActionEvent event) {
    world = new XForm();
    moleculeGroup = new XForm();
    for (Cube cube : cubes) {

        Box boxShape = new Box(cube.getSideLength(), cube.getSideLength(), cube.getSideLength());
        boxShape.setMaterial(MaterialProvider.crateMaterialFromColor(Color.LIGHTSALMON));
        boxShape.setTranslateX(cube.getCenter().getX());
        boxShape.setTranslateY(cube.getCenter().getY());
        boxShape.setTranslateZ(cube.getCenter().getZ());

        // add tooltip
        Tooltip tooltip = new Tooltip(cube.toString());
        Tooltip.install(boxShape, tooltip);

        moleculeGroup.getChildren().add(boxShape);
    }
    world.getChildren().add(moleculeGroup);
    displayGroup.getChildren().retainAll();
    displayGroup.getChildren().add(world);
}
项目:fr.xs.jtk    文件:SolarSystemTest.java   
private Group buildAxes(Pivot p, double _l) {
    Group group = new Group();

    final Box xAxis = new Box(_l, 4, 4);
    final Box yAxis = new Box(4, _l, 4);
    final Box zAxis = new Box(4, 4, _l);

    xAxis.setMaterial(PhongPhactory.fromColour(Color.RED));
    yAxis.setMaterial(PhongPhactory.fromColour(Color.GREEN));
    zAxis.setMaterial(PhongPhactory.fromColour(Color.BLUE));

    p.getChildren().addAll(xAxis, yAxis, zAxis);
    p.setVisible(true);
    group.getChildren().addAll(p);

    return group;
}
项目:classical-physics    文件:Axis.java   
private void createPlane(double length) {
    Box xzPlane = new Box(length, PLANE_THICKNESS, length);
    xzPlane.setDrawMode(DrawMode.LINE);
    xzPlane.setTranslateX(length / 2.0);
    xzPlane.setTranslateZ(length / 2.0);

    Box xyPlane = new Box(length, length, PLANE_THICKNESS);
    xyPlane.setDrawMode(DrawMode.LINE);
    xyPlane.setTranslateX(length / 2.0);
    xyPlane.setTranslateY(length / 2.0);

    Box yzPlane = new Box(PLANE_THICKNESS, length, length);
    yzPlane.setDrawMode(DrawMode.LINE);
    yzPlane.setTranslateY(length / 2.0);
    yzPlane.setTranslateZ(length / 2.0);

    this.group.getChildren().addAll(xzPlane, xyPlane, yzPlane);
}
项目:3D-Game    文件:MoleculeSampleApp.java   
private void buildAxes() {
    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);

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

    xAxis.setMaterial(redMaterial);
    yAxis.setMaterial(greenMaterial);
    zAxis.setMaterial(blueMaterial);

    axisGroup.getChildren().addAll(xAxis, yAxis, zAxis);
    world.getChildren().addAll(axisGroup);
}
项目:FX3DAndroid    文件:ScadaApplication.java   
private void makePedestal(ObservableList<Node> g) {
    // pedestal
    Box box = new Box(5.5, 0.2, 5);
    box.setMaterial(material2);
    // box.setTranslateY(3);

    double length1 = 4.2;
    // outlet dispatch tube
    Capsule t1 = new Capsule(0.3, length1);
    t1.setCullFace(CullFace.BACK);
    t1.setMaterial(material);
    t1.getTransforms().addAll(new Rotate(90, X_AXIS), new Translate(0, -length1 / 2, -0.4));

    double length2 = 4.4;
    // outlet endpoint supply tube
    Group tg = makePump(length2, 0.3, 0.35, material);
    tg.getTransforms().addAll(new Rotate(90, X_AXIS), new Translate(-2.8, 0, -1.5));

    g.addAll(t1, tg, box);

    // TriangleMesh mesh = createToroidMesh(2f, 0.5f, 100, 100);
    // g.addAll(new MeshView(mesh));
}
项目:RiggedHand    文件:Bone.java   
public Bone(double scale, Point3D posJoint) {
    Box origin=new Box(10,10,10);
    origin.setMaterial(new PhongMaterial(Color.ORANGE));

    Cylinder bone = new Cylinder(5, posJoint.magnitude()/scale);
    double angle = Math.toDegrees(Math.acos((new Point3D(0,1,0)).dotProduct(posJoint)/posJoint.magnitude()));
    Point3D axis = (new Point3D(0,1,0)).crossProduct(posJoint);
    bone.getTransforms().addAll(new Rotate(angle,0,0,0,axis), new Translate(0,posJoint.magnitude()/2d/scale, 0));
    bone.setMaterial(new PhongMaterial(Color.CADETBLUE));

    Sphere end = new Sphere(6);
    end.getTransforms().addAll(new Translate(posJoint.getX()/scale,posJoint.getY()/scale,posJoint.getZ()/scale));
    end.setMaterial(new PhongMaterial(Color.YELLOW));

    getChildren().addAll(origin, bone, end);
    getTransforms().add(new Scale(scale, scale, scale));
}
项目:Gargoyle    文件:Drag3DObject.java   
@Override
public void start(Stage stage) {
    Box floor = new Box(1000, 10, 1000);
    floor.setTranslateY(150);
    root.getChildren().add(floor);

    Sphere s = new Sphere(150);
    s.setTranslateX(5);
    s.setPickOnBounds(true);
    root.getChildren().add(s);

    showStage(stage);
}
项目:openjfx-8u-dev-tests    文件:SubSceneDepthTestApp.java   
private static Group buildGroup() {
        Group grp = new Group();
        Sphere s = new Sphere();
        Box b = new Box();
        s.setScaleX(SCALE);
        s.setScaleY(SCALE);
        s.setScaleZ(SCALE);
        s.setTranslateX(-130);
        b.setScaleX(SCALE);
        b.setScaleY(SCALE);
        b.setScaleZ(SCALE);
        b.setTranslateX(130);
        PhongMaterial material = new PhongMaterial();
        material.setDiffuseColor(Color.LIGHTGRAY);
        material.setSpecularColor(Color.rgb(30, 30, 30));
        s.setMaterial(material);
        b.setMaterial(material);
        PointLight pl = new PointLight(Color.AQUA);
        pl.setTranslateZ(-1000);
        Sphere lightBalance = new Sphere();
//        lightBalance.setScaleX(0.1);
//        lightBalance.setScaleX(0.1);
//        lightBalance.setScaleX(0.1);
        lightBalance.setTranslateZ(1000);
        grp.getChildren().addAll(s, b,pl,lightBalance);
        return grp;
    }
项目:openjfx-8u-dev-tests    文件:DepthTestApp.java   
@Override
protected Shape3D[] getShapes() {
    Shape3D[] result = {
        new Box(2, 2, 2),
        new Box(2, 2, 2)
    };
    result[1].setTranslateX(1.5);
    result[0].setTranslateX(-1.5);
    return result;
}
项目:openjfx-8u-dev-tests    文件:IntersectionTestApp.java   
@Override
protected Shape3D[] getShapes() {
    Shape3D[] result = {
        new Box(4, 4, 1),
        new Box(2, 2, 2)
    };
    result[0].setRotationAxis(Rotate.Y_AXIS);
    result[0].setRotate(45);
    result[1].setRotationAxis(Rotate.X_AXIS);
    result[1].setRotate(45);

    return result;
}
项目:openjfx-8u-dev-tests    文件:IntersectionTestApp.java   
@Override
protected Shape3D[] getShapes() {
    Shape3D[] result = {
        new Box(2, 2, 2),
        new Cylinder(1, 4)
    };
    result[0].setTranslateX(1);
    result[0].setRotationAxis(Rotate.Y_AXIS);
    result[0].setRotate(45);
    result[1].setRotationAxis(Rotate.X_AXIS);
    result[1].setRotate(45);
    return result;
}
项目:openjfx-8u-dev-tests    文件:IntersectionTestApp.java   
@Override
protected Shape3D[] getShapes() {
    Shape3D[] result = {
        new Box(2, 2, 2),
        new Sphere(2)
    };
    result[1].setTranslateX(1);
    result[1].setTranslateY(1);
    result[0].setRotationAxis(Rotate.Y_AXIS);
    result[0].setRotate(45);
    return result;
}
项目:openjfx-8u-dev-tests    文件:LightScopeTestApp.java   
public void initTestCase(TestCaseType type) {
    if (isThereTestCase) {
        root.getChildren().clear();
        nodes.clear();
        lights.clear();
        movers.clear();
    }
    switch (type) {
        case SINGLE_SPHERE_CASE:
            root.getChildren().add(buildSingle(new Sphere(50)));
            break;
        case SINGLE_BOX_CASE:
            root.getChildren().add(buildSingle(new Box(100, 100, 100)));
            break;
        case SINGLE_CYLINDER_CASE:
            root.getChildren().add(buildSingle(new Cylinder(50, 100)));
            break;
        case SINGLE_MESH_CASE:
            Cone cone = new Cone(50, 100);
            root.getChildren().add(buildSingle(cone.getMesh()));
            break;
        case MULTIPLE_SHAPE3D_CASE:
            root.getChildren().add(buildMultipleShapes3D());
            break;
        case MULTIPLE_SHAPE_CASE:
            root.getChildren().add(buildMultipleShapes());
            break;
    }
    isThereTestCase = true;
}
项目:openjfx-8u-dev-tests    文件:LightScopeTestApp.java   
private Group buildMultipleShapes() {
    Box box = new Box(100, 100, 100);
    Sphere sphere = new Sphere(50);
    Cylinder cyl = new Cylinder(50, 100);
    Cone cone = new Cone(50, 100);
    Rectangle rect = new Rectangle(50, 50);
    rect.setFill(Color.WHITESMOKE);
    box.setTranslateX(-100);
    box.setTranslateY(-150);

    sphere.setTranslateX(100);
    sphere.setTranslateY(-50);

    cyl.setTranslateX(-100);
    cyl.setTranslateY(50);

    cone.getMesh().setTranslateX(100);
    cone.getMesh().setTranslateY(150);

    rect.setTranslateX(-25);
    rect.setTranslateY(-25);
    rect.setRotationAxis(Rotate.Y_AXIS);
    rect.setRotate(45);

    nodes.add(box);
    nodes.add(sphere);
    nodes.add(cyl);
    nodes.add(cone.getMesh());
    nodes.add(rect);

    return new Group(box, sphere, cyl, cone.getMesh(), rect);
}
项目:gluon-samples    文件:ContentModel.java   
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);
}
项目:eavp    文件:TestGizmo.java   
/**
 * Gets the three axes displayed by the gizmo.
 * 
 * @return An ArrayList containing the three Box shapes used to represent
 *         the axes, in the order x, y, z.
 */
public ArrayList<Box> getAxes() {
    ArrayList<Box> axes = new ArrayList<Box>();

    axes.add(axisX);
    axes.add(axisY);
    axes.add(axisZ);

    return axes;
}
项目:eavp    文件:FXViewer.java   
/**
 * <p>
 * Creates scene elements that aren't meant to be manipulated by the user
 * (markers, camera, etc.)
 * </p>
 */
protected void setupSceneInternals(Group parent) {
    // Create scene plane for frame of reference.
    Box box = new Box(1000, 0, 1000);
    box.setMouseTransparent(true);
    box.setDrawMode(DrawMode.LINE);
    box.setMaterial(new PhongMaterial(Color.ANTIQUEWHITE));

    AmbientLight ambientLight = new AmbientLight(Color.rgb(100, 100, 100));

    PointLight light1 = new PointLight(Color.ANTIQUEWHITE);
    light1.setMouseTransparent(true);
    light1.setTranslateY(-350);

    PointLight light2 = new PointLight(Color.ANTIQUEWHITE);
    light2.setMouseTransparent(true);
    light2.setTranslateZ(350);

    PointLight light3 = new PointLight(Color.ANTIQUEWHITE);
    light3.setMouseTransparent(true);
    light3.setTranslateZ(-350);

    PointLight light4 = new PointLight(Color.ANTIQUEWHITE);
    light4.setMouseTransparent(true);
    light4.setTranslateZ(350);

    TransformGizmo gizmo = new TransformGizmo(1000);
    gizmo.showHandles(false);

    parent.getChildren().addAll(gizmo, box, light1, light2, light3, light4,
            ambientLight);

}
项目:eavp    文件:FXGeometryViewer.java   
@Override
protected void setupSceneInternals(Group parent) {
    // Create scene plane for frame of reference.
    plane = new Box(1000, 0, 1000);
    plane.setMouseTransparent(true);
    plane.setDrawMode(DrawMode.LINE);
    plane.setMaterial(new PhongMaterial(Color.ANTIQUEWHITE));

    AmbientLight ambientLight = new AmbientLight(Color.rgb(100, 100, 100));

    PointLight light1 = new PointLight(Color.ANTIQUEWHITE);
    light1.setMouseTransparent(true);
    light1.setTranslateY(-350);

    PointLight light2 = new PointLight(Color.ANTIQUEWHITE);
    light2.setMouseTransparent(true);
    light2.setTranslateZ(350);

    PointLight light3 = new PointLight(Color.ANTIQUEWHITE);
    light3.setMouseTransparent(true);
    light3.setTranslateZ(-350);

    PointLight light4 = new PointLight(Color.ANTIQUEWHITE);
    light4.setMouseTransparent(true);
    light4.setTranslateZ(350);

    axes = new TransformGizmo(1000);
    axes.showHandles(false);

    parent.getChildren().addAll(axes, plane, light1, light2, light3, light4,
            ambientLight);

}
项目:eavp    文件:FXMeshAttachment.java   
/**
 * <p>
 * Creates an FXGeometryAttachment instance.
 * </p>
 * 
 * @param manager
 *            the manager that created this instance.
 */
public FXMeshAttachment(BasicAttachmentManager manager) {
    super(manager);

    // Create a grey background box
    background = new Box(96, 48, 1);
    PhongMaterial backgroundMaterial = new PhongMaterial();
    backgroundMaterial.setDiffuseColor(Color.GRAY);
    background.setMaterial(backgroundMaterial);
}
项目:fr.xs.jtk    文件:Histogram.java   
private Node createDefaultNode(double barWidth, double barHeight) {
    switch (defaultNodeType) {
        case CYLINDER:
            return new Cylinder(barWidth / 2, barHeight);
        case CUBE:
            return new Box(barWidth, barHeight, barWidth);
        default:
            return new Box(barWidth, barHeight, barWidth);
    }
}
项目:fr.xs.jtk    文件:ScatterPlot.java   
private Shape3D createDefaultNode(double radius) {
    switch(defaultNodeType) {
        case SPHERE: return new Sphere(radius);
        case CUBE: return new Box(radius, radius, radius);
        default: return new Box(radius, radius, radius);    
    }
}
项目:fr.xs.jtk    文件:Axis3D.java   
public Axis3D() {
    super();

       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);
       final Sphere red = new Sphere(50);
       red.setMaterial(redMaterial);
       final Sphere blue = new Sphere(50);
       blue.setMaterial(blueMaterial);


       xAxis = new Box(24.0, 0.05, 0.05);
       yAxis = new Box(0.05, 24.0, 0.05);
       zAxis = new Box(0.05, 0.05, 24.0);
       xAxis.setMaterial(redMaterial);
       yAxis.setMaterial(greenMaterial);
       zAxis.setMaterial(blueMaterial);

       getChildren().addAll(xAxis,yAxis,zAxis);
}
项目:fr.xs.jtk    文件:PivotTest.java   
private void buildAxes(Pivot p) {
    final Box xAxis = new Box(AXIS_LENGTH, 4, 4);
    final Box yAxis = new Box(4, AXIS_LENGTH, 4);
    final Box zAxis = new Box(4, 4, AXIS_LENGTH);

    xAxis.setMaterial(PhongPhactory.fromColour(Color.RED));
    yAxis.setMaterial(PhongPhactory.fromColour(Color.GREEN));
    zAxis.setMaterial(PhongPhactory.fromColour(Color.BLUE));

    p.getChildren().addAll(xAxis, yAxis, zAxis);
    p.setVisible(true);
    root.getChildren().addAll(p);
}
项目:FXyzLib    文件:Histogram.java   
private Node createDefaultNode(double barWidth, double barHeight) {
    switch (defaultNodeType) {
        case CYLINDER:
            return new Cylinder(barWidth / 2, barHeight);
        case CUBE:
            return new Box(barWidth, barHeight, barWidth);
        default:
            return new Box(barWidth, barHeight, barWidth);
    }
}
项目:FXyzLib    文件:ScatterPlot.java   
private Shape3D createDefaultNode(double radius) {
    switch(defaultNodeType) {
        case SPHERE: return new Sphere(radius);
        case CUBE: return new Box(radius, radius, radius);
        default: return new Box(radius, radius, radius);    
    }
}
项目:FXyzLib    文件:Drag3DObject.java   
@Override
public void start(Stage stage) {
    Box floor = new Box(1000, 10, 1000);
    floor.setTranslateY(150);
    root.getChildren().add(floor);

    Sphere s = new Sphere(150);
    s.setTranslateX(5);
    s.setPickOnBounds(true);
    root.getChildren().add(s);

    showStage(stage);
}
项目:javafx-dpi-scaling    文件:AdjusterTest.java   
@Test
public void testGetBoxAdjuster() {
    Adjuster adjuster = Adjuster.getAdjuster(Box.class);

    assertThat(adjuster, is(instanceOf(NodeAdjuster.class)));
    assertThat(adjuster.getNodeClass(), is(sameInstance(Node.class)));
}
项目:classical-physics    文件:Axis.java   
private void createAxis(double length) {
    Box x = new Box(length, AXIS_THICKNESS, AXIS_THICKNESS);
    x.setMaterial(new PhongMaterial(Color.BLUE));
    x.setTranslateX(length / 2.0);

    Box y = new Box(AXIS_THICKNESS, length, AXIS_THICKNESS);
    y.setMaterial(new PhongMaterial(Color.RED));
    y.setTranslateY(length / 2.0);

    Box z = new Box(AXIS_THICKNESS, AXIS_THICKNESS, length);
    z.setMaterial(new PhongMaterial(Color.GREEN));
    z.setTranslateZ(length / 2.0);

    this.group.getChildren().addAll(x, y, z);
}
项目:COrnLathe    文件:AxesGrid.java   
/**
 * Construct a new axes and grid in 3D.
 *
 * @param length length of the axis and grid
 */
public AxesGrid(double length) {
  redMaterial.setDiffuseColor(Color.RED);
  redMaterial.setSpecularColor(Color.PINK);

  greenMaterial.setDiffuseColor(Color.GREEN);
  greenMaterial.setSpecularColor(Color.LIGHTGREEN);

  blueMaterial.setDiffuseColor(Color.BLUE);
  blueMaterial.setSpecularColor(Color.LIGHTBLUE);

  blackMaterial.setDiffuseColor(Color.BLACK);
  blackMaterial.setSpecularColor(Color.BLACK);

  final Box xAxis = new Box(length, AXES_THICKNESS, AXES_THICKNESS);
  xAxis.setTranslateX(length / 2.0);
  xAxis.setMaterial(redMaterial);

  final Box yAxis = new Box(AXES_THICKNESS, length, AXES_THICKNESS);
  yAxis.setTranslateY(length / 2.0);
  yAxis.setMaterial(greenMaterial);

  final Box zAxis = new Box(AXES_THICKNESS, AXES_THICKNESS, length);
  zAxis.setTranslateZ(length / 2.0);
  zAxis.setMaterial(blueMaterial);

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

  for (int i = (int) -length; i <= length; i++) {
    addXLine(length * 2, i);
  }
  for (int i = (int) -length; i <= length; i++) {
    addYLine(length * 2, i);
  }
}
项目:FX3DAndroid    文件:Histogram.java   
private Node createDefaultNode(double barWidth, double barHeight) {
    switch (defaultNodeType) {
        case CYLINDER:
            return new Cylinder(barWidth / 2, barHeight);
        case CUBE:
            return new Box(barWidth, barHeight, barWidth);
        default:
            return new Box(barWidth, barHeight, barWidth);
    }
}
项目:FX3DAndroid    文件:ScatterPlot.java   
private Shape3D createDefaultNode(double radius) {
    switch(defaultNodeType) {
        case SPHERE: return new Sphere(radius);
        case CUBE: return new Box(radius, radius, radius);
        default: return new Box(radius, radius, radius);    
    }
}
项目:RubikFX    文件:ContentModel.java   
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);
}
项目:LiteRubikFX    文件:ContentModel.java   
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);
}
项目:minecraft-jfx-skin    文件:SkinMultipleCubes.java   
public void updateSkin(Image skin) {
    getChildren().clear();
    int start_x = (int) (startX * skin.getWidth()), start_y = (int) (startY * skin.getHeight()),
            interval = (int) Math.max(skin.getWidth() / 64, 1),
            width_interval = width * interval, height_interval = height * interval, depth_interval = depth * interval;
    // FRONT
    getChildren().add(new Face(skin, start_x + depth_interval, start_y + depth_interval, width, height, interval, false, false,
            () -> new Box(length, length, thick), (b, p) -> {
        b.setTranslateX(((width - 1) / 2.0 - p.getX()) * b.getWidth());
        b.setTranslateY(-((height - 1) / 2.0 - p.getY()) * b.getHeight());
        b.setTranslateZ((depth * length + thick) / 2.0);
    }));
    // BACK
    getChildren().add(new Face(skin, start_x + width_interval + depth_interval * 2, start_y + depth_interval, width, height, interval, true, false,
            () -> new Box(length, length, thick), (b, p) -> {
        b.setTranslateX(((width - 1) / 2.0 - p.getX()) * b.getWidth());
        b.setTranslateY(-((height - 1) / 2.0 - p.getY()) * b.getHeight());
        b.setTranslateZ(-(depth * length + thick) / 2.0);
    }));
    // LEFT
    getChildren().add(new Face(skin, start_x + width_interval + depth_interval, start_y + depth_interval, depth, height, interval, false, false,
            () -> new Box(thick, length, length), (b, p) -> {
        b.setTranslateX((width * length + thick) / 2.0);
        b.setTranslateY(-((height - 1) / 2.0 - p.getY()) * b.getHeight());
        b.setTranslateZ(((depth - 1) / 2.0 - p.getX()) * b.getDepth());
    }));
    // RIGHT
    getChildren().add(new Face(skin, start_x, start_y + depth_interval, depth, height, interval, true, false,
            () -> new Box(thick, length, length), (b, p) -> {
        b.setTranslateX(-(width * length + thick) / 2.0);
        b.setTranslateY(-((height - 1) / 2.0 - p.getY()) * b.getHeight());
        b.setTranslateZ(((depth - 1) / 2.0 - p.getX()) * b.getDepth());
    }));
    // TOP
    getChildren().add(new Face(skin, start_x + depth_interval, start_y, width, depth, interval, false, false,
            () -> new Box(length, thick, length), (b, p) -> {
        b.setTranslateX(((width - 1) / 2.0 - p.getX()) * b.getWidth());
        b.setTranslateY(-(height * length + thick) / 2.0);
        b.setTranslateZ(-((depth - 1) / 2.0 - p.getY()) * b.getDepth());
    }));
    // BOTTOM
    getChildren().add(new Face(skin, start_x + width_interval + depth_interval, start_y, width, depth, interval, false, false,
            () -> new Box(length, thick, length), (b, p) -> {
        b.setTranslateX(((width - 1) / 2.0 - p.getX()) * b.getWidth());
        b.setTranslateY((height * length + thick) / 2.0);
        b.setTranslateZ(-((depth - 1) / 2.0 - p.getY()) * b.getDepth());
    }));
}
项目:openjfx-8u-dev-tests    文件:LodTestAbstractApp.java   
@Override
public void handle(KeyEvent t) {
    System.out.println(t.getText());
    switch (t.getText()) {
        case "1":
            selectType(ShapeType.Box);
            break;
        case "2":
            selectType(ShapeType.Cone);
            break;
        case "3":
            selectType(ShapeType.Plane);
            break;
        case "4":
            selectType(ShapeType.SemiSphere);
            break;
        case "5":
            selectType(ShapeType.Sphere);
            break;
        case "6":
            selectType(ShapeType.Cylinder);
            break;
        case "l":
            setLight(true);
            break;
        case "k":
            setLight(false);
            break;
        case "z":
            moveObject(-100);
            break;
        case "x":
            moveObject(100);
            break;
        case "c":
            moveGroup(-100);
            break;
        case "v":
            moveGroup(100);
            break;
        case "a":
            moveCamera(-100);
            break;
        case "s":
            moveCamera(100);
            break;
        case "d":
            moveCameraGroup(-100);
            break;
        case "f":
            moveCameraGroup(100);
            break;
    }
}
项目:openjfx-8u-dev-tests    文件:BoxTestApp.java   
@Override
public Shape3D getShape() {
    box = new Box(2, 2, 2);
    return box;
}