Java 类javafx.scene.paint.PhongMaterial 实例源码

项目: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);
}
项目:openjfx-8u-dev-tests    文件:MeshPickingAbstractApp.java   
@Override
protected Group buildGroup() {
    mb = new MeshBuilder();
    triangleMesh = mb.getTriangleMesh();
    meshView = new MeshView(triangleMesh);
    material = new PhongMaterial();
    material.setDiffuseColor(Color.LIGHTGRAY);
    material.setSpecularColor(Color.rgb(30, 30, 30));
    meshView.setMaterial(material);
    //Set Wireframe mode
    meshView.setDrawMode(DrawMode.FILL);
    meshView.setCullFace(CullFace.BACK);
    meshView.setScaleX(SCALE);
    meshView.setScaleY(SCALE);
    meshView.setScaleZ(SCALE);
    grp = new Group(meshView);
    return grp;

}
项目:openjfx-8u-dev-tests    文件:CameraTestGroupBuilder.java   
private void initMaterials() {
    topMtrl = new PhongMaterial();
    topMtrl.setDiffuseColor(Color.LIGHTGRAY);
    topMtrl.setSpecularColor(Color.rgb(30, 30, 30));
    bottomMtrl = new PhongMaterial();
    bottomMtrl.setDiffuseColor(Color.RED);
    bottomMtrl.setSpecularColor(Color.rgb(30, 30, 30));
    leftMtrl = new PhongMaterial();
    leftMtrl.setDiffuseColor(Color.YELLOW);
    leftMtrl.setSpecularColor(Color.rgb(30, 30, 30));
    rightMtrl = new PhongMaterial();
    rightMtrl.setDiffuseColor(Color.BLUE);
    rightMtrl.setSpecularColor(Color.rgb(30, 30, 30));
    frontMtrl = new PhongMaterial();
    frontMtrl.setDiffuseColor(Color.GREEN);
    frontMtrl.setSpecularColor(Color.rgb(30, 30, 30));
    backMtrl = new PhongMaterial();
    backMtrl.setDiffuseColor(Color.AQUA);
    backMtrl.setSpecularColor(Color.rgb(30, 30, 30));
    borderMtrl = new PhongMaterial();
    borderMtrl.setDiffuseColor(Color.BLACK);
    borderMtrl.setSpecularColor(Color.rgb(30, 30, 30));
}
项目:openjfx-8u-dev-tests    文件:SubSceneBasicPropsTestApp.java   
private static Group buildGroup() {
        Sphere s = new Sphere();
        s.setScaleX(SCALE);
        s.setScaleY(SCALE);
        s.setScaleZ(SCALE);
        PhongMaterial material = new PhongMaterial();
        material.setDiffuseColor(Color.LIGHTGRAY);
        material.setSpecularColor(Color.rgb(30, 30, 30));
        s.setMaterial(material);
//        PointLight pl = new PointLight(Color.AQUA);
//        pl.setTranslateZ(-1000);
        Group group = new Group(/*pl,*/ s);
        group.setTranslateX(SS_WIDTH / 2);
        group.setTranslateY(SS_HEIGHT / 2);
        return group;
    }
项目:openjfx-8u-dev-tests    文件:MultipleLightingTestApp.java   
protected Group buildGroup() {
        material = new PhongMaterial();
        material.setDiffuseColor(Color.ANTIQUEWHITE);
        material.setSpecularColor(Color.rgb(255, 255, 255));
        material.setSpecularPower(4);
        ss = new SemiSphere(2, 120, 120);
        Shape3D sh = ss.getMesh();
//        Shape3D sh = new Sphere();
        sh.setMaterial(material);
        sh.setScaleX(SCALE);
        sh.setScaleY(SCALE);
        sh.setScaleZ(SCALE);
        light1Group = new Group();
        light2Group = new Group();
        light1mv = new GroupMover(light1Group);
        light2mv = new GroupMover(light2Group);
        root = new Group(light1mv.getGroup(), light2mv.getGroup(), ss.getGroup());
        rootmv = new GroupMover(root);
        return rootmv.getGroup();
    }
项目:singa    文件:StructureViewer.java   
private PhongMaterial getMaterial(LeafSubstructure origin, Atom atom) {
    switch (colorScheme) {
        case BY_ELEMENT:
            return MaterialProvider.getDefaultMaterialForElement(atom.getElement());
        case BY_FAMILY:
            return MaterialProvider.getMaterialForType(origin.getFamily());
        default:
            String chain = origin.getIdentifier().getChainIdentifier();
            if (chainMaterials.containsKey(chain)) {
                return chainMaterials.get(chain);
            } else {
                return getMaterialForChain(origin.getIdentifier().getChainIdentifier());
            }
    }

}
项目:eavp    文件:FXColorOption.java   
@Override
public void modify(Group element) {

    // Get the properties
    int red = (int) parent.getProperty(PROPERTY_NAME_RED);
    int green = (int) parent.getProperty(PROPERTY_NAME_GREEN);
    int blue = (int) parent.getProperty(PROPERTY_NAME_BLUE);

    // If all properties are valid, set the group's color
    if (red >= 0 && green >= 0 && blue >= 0) {

        // Create a material of the specified color and set it.
        PhongMaterial material = new PhongMaterial(
                Color.rgb(red, green, blue));
        material.setSpecularColor(Color.WHITE);

        // Set the material for the group and pass it along
        setMaterial(element, material);
    }
}
项目:fr.xs.jtk    文件:ScatterPlot.java   
public void setXYZData(List<Double> xData, List<Double> yData, List<Double> zData, List<Color> colors) {
    xAxisData = xData;
    yAxisData = yData;
    zAxisData = zData;
    scatterDataGroup.getChildren().clear();
    //for now we will always default to x axis
    //later we could maybe dynamically determine the smallest axis and then
    //uses 0's for the other axes that are larger.
    for(int i=0;i<xAxisData.size();i++) {
        final Shape3D dataSphere = createDefaultNode(nodeRadius);
        double translateY = 0.0;
        double translateZ = 0.0;            
        if(!yAxisData.isEmpty() && yAxisData.size() > i)
            translateY = yAxisData.get(i);
        if(!zAxisData.isEmpty() && zAxisData.size() > i)
            translateZ = zAxisData.get(i);
        dataSphere.setTranslateX(xAxisData.get(i));
        dataSphere.setTranslateY(translateY);
        dataSphere.setTranslateZ(translateZ);
        dataSphere.setMaterial(new PhongMaterial(colors.get(i)));
        scatterDataGroup.getChildren().add(dataSphere);
    }        
}
项目:FXyzLib    文件:ScatterPlot.java   
public void setXYZData(List<Double> xData, List<Double> yData, List<Double> zData, List<Color> colors) {
    xAxisData = xData;
    yAxisData = yData;
    zAxisData = zData;
    scatterDataGroup.getChildren().clear();
    //for now we will always default to x axis
    //later we could maybe dynamically determine the smallest axis and then
    //uses 0's for the other axes that are larger.
    for(int i=0;i<xAxisData.size();i++) {
        final Shape3D dataSphere = createDefaultNode(nodeRadius);
        double translateY = 0.0;
        double translateZ = 0.0;            
        if(!yAxisData.isEmpty() && yAxisData.size() > i)
            translateY = yAxisData.get(i);
        if(!zAxisData.isEmpty() && zAxisData.size() > i)
            translateZ = zAxisData.get(i);
        dataSphere.setTranslateX(xAxisData.get(i));
        dataSphere.setTranslateY(translateY);
        dataSphere.setTranslateZ(translateZ);
        dataSphere.setMaterial(new PhongMaterial(colors.get(i)));
        scatterDataGroup.getChildren().add(dataSphere);
    }        
}
项目: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    文件:ScatterPlot.java   
public void setXYZData(List<Double> xData, List<Double> yData, List<Double> zData, List<Color> colors) {
    xAxisData = xData;
    yAxisData = yData;
    zAxisData = zData;
    scatterDataGroup.getChildren().clear();
    //for now we will always default to x axis
    //later we could maybe dynamically determine the smallest axis and then
    //uses 0's for the other axes that are larger.
    for(int i=0;i<xAxisData.size();i++) {
        final Shape3D dataSphere = createDefaultNode(nodeRadius);
        double translateY = 0.0;
        double translateZ = 0.0;            
        if(!yAxisData.isEmpty() && yAxisData.size() > i)
            translateY = yAxisData.get(i);
        if(!zAxisData.isEmpty() && zAxisData.size() > i)
            translateZ = zAxisData.get(i);
        dataSphere.setTranslateX(xAxisData.get(i));
        dataSphere.setTranslateY(translateY);
        dataSphere.setTranslateZ(translateZ);
        dataSphere.setMaterial(new PhongMaterial(colors.get(i)));
        scatterDataGroup.getChildren().add(dataSphere);
    }        
}
项目: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));
}
项目:RiggedHand    文件:Axes.java   
public Axes(double scale) {
    Cylinder axisX = new Cylinder(3, 60);
    axisX.getTransforms().addAll(new Rotate(90, Rotate.Z_AXIS), new Translate(0, 30, 0));
    axisX.setMaterial(new PhongMaterial(Color.RED));

    Cylinder axisY = new Cylinder(3, 60);
    axisY.getTransforms().add(new Translate(0, 30, 0));
    axisY.setMaterial(new PhongMaterial(Color.GREEN));

    Cylinder axisZ = new Cylinder(3, 60);
    axisZ.setMaterial(new PhongMaterial(Color.BLUE));
    axisZ.getTransforms().addAll(new Rotate(90, Rotate.X_AXIS), new Translate(0, 30, 0));

    getChildren().addAll(axisX, axisY, axisZ);
    getTransforms().add(new Scale(scale, scale, scale));
}
项目:JavaFX3DImporterViewer    文件:Importer3D.java   
/**
 * Load a 3D file, always loaded as TriangleMesh.
 * 
 * @param fileUrl the url of the 3D file to load
 * @return the loaded Node which could be a MeshView or a Group
 * @throws IOException if there is a problem loading the file
 */
public static Group load(final String fileUrl) throws IOException {

    final int dot = fileUrl.lastIndexOf('.');
    if (dot <= 0) {
        throw new IOException("Unknown 3D file format, url missing extension [" + fileUrl + "]");
    }
    final String extension = fileUrl.substring(dot + 1, fileUrl.length()).toLowerCase();

    switch (extension) {
    case "3ds":
        ModelImporter tdsImporter = new TdsModelImporter();
        tdsImporter.read(fileUrl);
        final Node[] tdsMesh = (Node[]) tdsImporter.getImport();
        tdsImporter.close();
        return new Group(tdsMesh);
    case "stl":
        StlMeshImporter stlImporter = new StlMeshImporter();
        stlImporter.read(fileUrl);
        // STL includes only geometry data
        TriangleMesh cylinderHeadMesh = stlImporter.getImport();

        stlImporter.close();

        // Create Shape3D
        MeshView cylinderHeadMeshView = new MeshView();
        cylinderHeadMeshView.setMaterial(new PhongMaterial(Color.GRAY));
        cylinderHeadMeshView.setMesh(cylinderHeadMesh);

        stlImporter.close();
        return new Group(cylinderHeadMeshView);
    default:
        throw new IOException("Unsupported 3D file format [" + extension + "]");
    }
}
项目:openjfx-8u-dev-tests    文件:ShapesPickingAbstractApp.java   
@Override
protected Group buildGroup() {
    material = new PhongMaterial();
    material.setDiffuseColor(Color.LIGHTGRAY);
    material.setSpecularColor(Color.rgb(30, 30, 30));
    grp = new Group();
    setShape(Shape.Sphere);
    return grp;
}
项目:openjfx-8u-dev-tests    文件:LodTestAbstractApp.java   
private Group buildGroup() {
    mtrl = new PhongMaterial();
    shapeGroup = new Group();
    selectShapeType(ShapeType.Cone);

    return shapeGroup;
}
项目:openjfx-8u-dev-tests    文件:ShapesTestCase.java   
private void initMaterial() {
    material = new PhongMaterial();
    material.setDiffuseColor(Color.LIGHTGRAY);
    material.setSpecularColor(Color.rgb(30, 30, 30));
    shape.setMaterial(material);

}
项目: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    文件:SingleLightingTestApp.java   
protected Group buildGroup() {
    material = new PhongMaterial(Color.RED);
    ss = new SemiSphere();
    Shape3D sh = ss.getMesh();
    sh.setMaterial(material);
    sh.setScaleX(SCALE);
    sh.setScaleY(SCALE);
    sh.setScaleZ(SCALE);
    lightGroup = new Group();
    lightmv = new GroupMover(lightGroup);
    root = new Group(lightmv.getGroup(), ss.getGroup());
    rootmv = new GroupMover(root);
    return rootmv.getGroup();
}
项目: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);
}
项目:gluon-samples    文件:Utils.java   
public static PhongMaterial getMaterial(String face){
    PhongMaterial arrowMat = new PhongMaterial();
    arrowMat.setSpecularColor(Color.WHITESMOKE);
    Color color = Color.WHITE;
    switch(face){
        case "F": 
        case "Fi":  color = Color.BLUE.brighter();
                    break;
        case "B": 
        case "Bi":  color = Color.BLUE.brighter();
                    break;
        case "R":  
        case "Ri":  color = Color.RED.brighter();
                    break;
        case "L":  
        case "Li":  color = Color.RED.brighter();
                    break;
        case "U":   
        case "Ui":  color = Color.FORESTGREEN.brighter();
                    break;
        case "D": 
        case "Di":  color = Color.FORESTGREEN.brighter();
                    break;
        case "Z": 
        case "Zi":  color = Color.BLUE.brighter();
                    break;
        case "X":  
        case "Xi":  color = Color.RED.brighter();
                    break;
        case "Y":   
        case "Yi":  color = Color.FORESTGREEN.brighter();
                    break;
    }
    arrowMat.setDiffuseColor(color);
    return arrowMat;
}
项目:singa    文件:MaterialProvider.java   
public static PhongMaterial getDefaultMaterialForElement(Element element) {
    switch (element.getSymbol()) {
        case "C":
            return CARBON;
        case "N":
            return NITROGEN;
        case "O":
            return OXYGEN;
        case "H":
            return HYDROGEN;
        default:
            return OTHER_ELEMENT;
    }
}
项目:singa    文件:MaterialProvider.java   
public static PhongMaterial getMaterialForType(StructuralFamily structuralFamily) {
    if (structuralFamily instanceof NucleotideFamily) {
        return NUCLEOTIDE;
    } else if (structuralFamily instanceof AminoAcidFamily) {
        return AMINOACID;
    } else {
        return OTHER_TYPE;
    }
}
项目:singa    文件:StructureViewer.java   
private PhongMaterial getMaterial(LeafSubstructure origin, OakBond edge) {
    switch (colorScheme) {
        case BY_ELEMENT:
            return MaterialProvider.CARBON;
        case BY_FAMILY:
            return MaterialProvider.getMaterialForType(origin.getFamily());
        default:
            return getMaterialForChain(origin.getIdentifier().getChainIdentifier());
    }
}
项目:singa    文件:StructureViewer.java   
private PhongMaterial getMaterial(Chain origin, OakBond edge) {
    if (colorScheme == ColorScheme.BY_ELEMENT) {
        return MaterialProvider.CARBON;
    } else {
        return getMaterialForChain(origin.getChainIdentifier());
    }
}
项目:singa    文件:StructureViewer.java   
private PhongMaterial getMaterialForChain(String chain) {
    if (chainMaterials.containsKey(chain)) {
        return chainMaterials.get(chain);
    } else {
        PhongMaterial material = MaterialProvider.crateMaterialFromColor(Color.color(Math.random(), Math.random(), Math.random()));
        chainMaterials.put(chain, material);
        return material;
    }
}
项目:mars-sim    文件:MarsViewer.java   
private Group buildScene() {
        Sphere mars = new Sphere(MARS_RADIUS);
        mars.setTranslateX(VIEWPORT_SIZE / 2d);
        mars.setTranslateY(VIEWPORT_SIZE / 2d);

        PhongMaterial material = new PhongMaterial();
        material.setDiffuseMap(
          new Image(this.getClass().getResource(DIFFUSE_MAP).toExternalForm(),
            MAP_WIDTH,
            MAP_HEIGHT,
            true,
            true
          )
        );

        material.setBumpMap(
          new Image(this.getClass().getResource(NORMAL_MAP).toExternalForm(),
            MAP_WIDTH,
            MAP_HEIGHT,
            true,
            true
          )
        );
/*
        material.setSpecularMap(
          new Image(this.getClass().getResource(SPECULAR_MAP).toExternalForm(),
            MAP_WIDTH,
            MAP_HEIGHT,
            true,
            true
          )
        );
*/
        mars.setMaterial(
            material
        );

        return new Group(mars);
    }
项目: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    文件:ActionImportGeometry.java   
/**
 * Sets the specified nodes with the materials given in the map
 * 
 * @param nodes
 *            The nodes to set the materials for
 * @param materialMap
 *            A mapping of the material name to the acctual material
 */
private void setMaterials(List<INode> nodes,
        Map<String, Material> materialMap) {
    if (nodes != null && !nodes.isEmpty()
            && !materialMap.keySet().isEmpty()) {
        // Get the set of render elements from the view
        IRenderElementHolder holder = view.getHolder();
        for (INode node : nodes) {
            // Get the render of the new shape
            IRenderElement render = holder.getRender(node);

            if (render.getBase() instanceof Shape) {
                // Get the material
                PhongMaterial newMat = new PhongMaterial();
                Material readMat = materialMap
                        .get(((Shape) render.getBase()).getMaterial()
                                .getPhongMatName());
                if (readMat != null) {
                    // Convert values to the phong material
                    newMat.setDiffuseColor(
                            convertColor(readMat.getDiffuse()));
                    newMat.setSpecularColor(
                            convertColor(readMat.getSpecular()));
                    newMat.setSpecularPower(readMat.getSpecularExponent());
                    render.setProperty("material", newMat);
                }
            }
        }
    }
}
项目: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);
}
项目:eavp    文件:FXLinearEdgeView.java   
/**
 * The nullary constructor.
 */
public FXLinearEdgeView() {
    super();

    // Instantiate the class variables
    node = new Group();

    // Create the materials
    defaultMaterial = new PhongMaterial(Color.rgb(80, 30, 140));
    selectedMaterial = new PhongMaterial(Color.rgb(0, 127, 255));
    constructingMaterial = new PhongMaterial(Color.rgb(0, 255, 0));

}
项目:eavp    文件:FXVertexView.java   
/**
 * The nullary constructor.
 */
public FXVertexView() {
    super();

    // Instantiate the class variables
    node = new Group();
    scale = 1;

    // Create the materials
    defaultMaterial = new PhongMaterial(Color.rgb(80, 30, 140));
    selectedMaterial = new PhongMaterial(Color.rgb(0, 127, 255));
    constructingMaterial = new PhongMaterial(Color.rgb(0, 255, 0));

}
项目:fr.xs.jtk    文件:ShapeContainer.java   
public ShapeContainer(T shape) {
    this.shape = shape;
    this.material = new PhongMaterial();
    this.emissive = new PointLight();
    this.selfIllumination = new AmbientLight();

    this.selfIllumination.getScope().add(ShapeContainer.this);
    initialize();
}
项目:fr.xs.jtk    文件:TriangleMeshHelper.java   
public Material getMaterialWithColor(Color color, String image){
        PhongMaterial mat = new PhongMaterial(color);
        if(image!=null && !image.isEmpty()){
            Image img = new Image(image);
            mat.setDiffuseMap(img);
            NormalMap normal = new NormalMap(img);
//            normal.setIntensity(10);
//            normal.setIntensityScale(2);
            mat.setBumpMap(normal);
        }
        mat.setSpecularPower(32);
        mat.setSpecularColor(Color.WHITE);
        return mat;
    }
项目:fr.xs.jtk    文件:TriangleMeshHelper.java   
private void clearMaterialAndSetDiffMap(PhongMaterial mat, Image diff){
    mat.setBumpMap(null);
    mat.setSpecularMap(null);
    mat.setSelfIlluminationMap(null);

    mat.setDiffuseColor(DEFAULT_DIFFUSE_COLOR);
    mat.setSpecularColor(DEFAULT_SPECULAR_COLOR);

    mat.setDiffuseMap(diff);        
}
项目:fr.xs.jtk    文件:TriangleMeshHelper.java   
private void clearMaterialAndSetColor(PhongMaterial mat, Color col){
    mat.setBumpMap(null);
    mat.setSpecularMap(null);
    mat.setSelfIlluminationMap(null);
    mat.setDiffuseMap(null);

    mat.setDiffuseColor(col);
}
项目:fr.xs.jtk    文件:PlanetoidEnlightment.java   
public static void setMaterial(final Planetoid _planetoid, final String _phongFile) {
    final PhongMaterial material = new PhongMaterial();

    String diffFile = "", normFile = "", specFile = "";
    try {
        URL url = MediaHelper.getURLForMedia(_phongFile);

        JSONParser parser = new JSONParser();

        MediaHelper.addToSearchPath(url.getPath().substring(0, url.getPath().lastIndexOf('/')));

        Object obj = parser.parse(MediaHelper.getContentAsString(url));
        if(obj == null)
            return;

        JSONObject jsonObject = (JSONObject) obj;

        if((diffFile = (String) jsonObject.get("diffuse")) != null)
            material.setDiffuseMap(new Image(MediaHelper.getURLForFile(diffFile).toExternalForm(), MAP_WIDTH, MAP_HEIGHT, true, true));
        if((normFile = (String) jsonObject.get("normal")) != null)
            material.setBumpMap(new Image(MediaHelper.getURLForFile(normFile).toExternalForm(), MAP_WIDTH, MAP_HEIGHT, true, true));
        if((specFile = (String) jsonObject.get("specular")) != null)
            material.setSpecularMap(new Image(MediaHelper.getURLForFile(specFile).toExternalForm(), MAP_WIDTH, MAP_HEIGHT, true, true));
    } catch(ParseException e) { e.printStackTrace(); }

    _planetoid.setMaterial(material);
}
项目:fr.xs.jtk    文件:PlanetoidEnlightment.java   
public static void setTexture(final Planetoid _planetoid, final String _textureFile) {
        final Image         texture  = new Image(MediaHelper.getURLForFile(_textureFile).toExternalForm(), MAP_WIDTH, MAP_HEIGHT, true, true);
        final PhongMaterial material = new PhongMaterial();

        material.setDiffuseMap(texture);
//      material.setBumpMap(texture);
//      material.setSpecularMap(texture);
//      material.setSelfIlluminationMap(texture);
//      material.setDiffuseColor(Color.WHITE);
        material.setSpecularColor(Color.WHITE);

        _planetoid.setMaterial(material);
    }
项目:fr.xs.jtk    文件:Axes.java   
public Axes(double scale) {
    Cylinder axisX = new Cylinder(3, 60);
    axisX.getTransforms().addAll(new Rotate(90, Rotate.Z_AXIS), new Translate(0, 30, 0));
    axisX.setMaterial(new PhongMaterial(Color.RED));
    Cylinder axisY = new Cylinder(3, 60);
    axisY.getTransforms().add(new Translate(0, 30, 0));
    axisY.setMaterial(new PhongMaterial(Color.GREEN));
    Cylinder axisZ = new Cylinder(3, 60);
    axisZ.setMaterial(new PhongMaterial(Color.BLUE));
    axisZ.getTransforms().addAll(new Rotate(90, Rotate.X_AXIS), new Translate(0, 30, 0));
    getChildren().addAll(axisX, axisY, axisZ);
    getTransforms().add(new Scale(scale, scale, scale));
}