本文整理汇总了Java中javafx.scene.paint.Material类的典型用法代码示例。如果您正苦于以下问题:Java Material类的具体用法?Java Material怎么用?Java Material使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Material类属于javafx.scene.paint包,在下文中一共展示了Material类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMtrl
import javafx.scene.paint.Material; //导入依赖的package包/类
private Material getMtrl(int x, int y, int z) {
if (((x == 0 || x == side - 1) && (y == 0 || y == side - 1))
|| ((x == 0 || x == side - 1) && (z == 0 || z == side - 1))
|| ((z == 0 || z == side - 1) && (y == 0 || y == side - 1))) {
return borderMtrl;
}
if (x == 0) {
return leftMtrl;
} else if (x == side - 1) {
return rightMtrl;
} else if (y == 0) {
return topMtrl;
} else if (y == side - 1) {
return bottomMtrl;
} else if (z == 0) {
return frontMtrl;
} else if (z == side - 1) {
return backMtrl;
}
return null;
}
示例2: setMaterial
import javafx.scene.paint.Material; //导入依赖的package包/类
/**
* Set all the MeshViews in the group to the given material, as well as the
* children of any child groups.
*
* @param group
* The group whose children will have their material set.
* @param material
* The material to be set to the group's children.
*/
private void setMaterial(Group group, Material material) {
// Handle each of the group's children
for (Node node : group.getChildren()) {
// If the node is a mesh view, set its material
if (node.getClass() == MeshView.class) {
((MeshView) node).setMaterial(material);
}
// Otherwise, recursively handle the child group
else if (node.getClass() == Group.class) {
setMaterial((Group) node, material);
}
}
}
示例3: getAsMeshViews
import javafx.scene.paint.Material; //导入依赖的package包/类
public List<MeshView> getAsMeshViews() {
List<MeshView> result = new ArrayList<>(meshes.size());
for (int i = 0; i < meshes.size(); i++) {
Mesh mesh = meshes.get(i);
Material mat = materials.get(i);
MeshView view = new MeshView(mesh);
view.setMaterial(mat);
view.setCullFace(CullFace.NONE);
result.add(view);
}
return result;
}
示例4: bindMaterial
import javafx.scene.paint.Material; //导入依赖的package包/类
protected void bindMaterial(Group group) {
Material material = createMaterial();
for (Node node : group.getChildren())
if (node instanceof Shape3D)
((Shape3D) node).setMaterial(material);
else if (node instanceof SkinMultipleCubes)
((SkinMultipleCubes) node).updateSkin(skin);
else if (node instanceof Group)
bindMaterial((Group) node);
}
示例5: getMaterialWithColor
import javafx.scene.paint.Material; //导入依赖的package包/类
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;
}
示例6: addSphere
import javafx.scene.paint.Material; //导入依赖的package包/类
public void addSphere(double x, double y, double z, Material material) {
Sphere sphere = new Sphere(RADIUS);
sphere.setTranslateX(x * SCALE_FACTOR);
sphere.setTranslateY(y * SCALE_FACTOR);
sphere.setTranslateZ(z * SCALE_FACTOR);
sphere.setMaterial(material);
getChildren().add(sphere);
}
示例7: getMaterialWithPattern
import javafx.scene.paint.Material; //导入依赖的package包/类
public Material getMaterialWithPattern(){
PhongMaterial mat = new PhongMaterial();
mat.setDiffuseMap(getPatternImage());
mat.setSpecularPower(32);
mat.setDiffuseColor(Color.WHITE);
mat.setSpecularColor(Color.WHITE);
return mat;
}
示例8: getMaterialWithPalette
import javafx.scene.paint.Material; //导入依赖的package包/类
public Material getMaterialWithPalette(){
PhongMaterial mat = new PhongMaterial();
mat.setDiffuseMap(getPaletteImage());
mat.setSpecularPower(20);
mat.setDiffuseColor(Color.WHITE);
mat.setSpecularColor(Color.WHITE);
return mat;
}
示例9: createSphere
import javafx.scene.paint.Material; //导入依赖的package包/类
private Sphere createSphere(Physical ball) {
Sphere sphere = new Sphere(this.radius);
ViewPoint location = ViewPoint.of(ball.getLocation());
sphere.setTranslateX(location.x);
sphere.setTranslateY(location.y);
sphere.setTranslateZ(location.z);
Material material = new PhongMaterial(this.color);
sphere.setMaterial(material);
return sphere;
}
示例10: MeshContainer
import javafx.scene.paint.Material; //导入依赖的package包/类
MeshContainer(Vector3d min, Vector3d max, List<Mesh> meshes, List<Material> materials) {
this.meshes = meshes;
this.materials = materials;
this.bounds = new Bounds(min, max);
this.width = bounds.getBounds().x;
this.height = bounds.getBounds().y;
this.depth = bounds.getBounds().z;
if (materials.size() != meshes.size()) {
throw new IllegalArgumentException("Mesh list and Material list must not differ in size!");
}
}
示例11: createMaterial
import javafx.scene.paint.Material; //导入依赖的package包/类
protected Material createMaterial(Color color) {
return new PhongMaterial(color);
}
示例12: createMaterial
import javafx.scene.paint.Material; //导入依赖的package包/类
protected Material createMaterial() {
PhongMaterial material = new PhongMaterial();
material.setDiffuseMap(skin);
return material;
}
示例13: getMaterials
import javafx.scene.paint.Material; //导入依赖的package包/类
public Map<String, Material> getMaterials() {
return Collections.unmodifiableMap(materials);
}
示例14: getMaterial
import javafx.scene.paint.Material; //导入依赖的package包/类
public Material getMaterial() {
return materials.values().iterator().next();
}
示例15: setMaterial
import javafx.scene.paint.Material; //导入依赖的package包/类
public final void setMaterial(Material value) {
mesh.setMaterial(value);
}