本文整理汇总了Java中javafx.scene.paint.PhongMaterial类的典型用法代码示例。如果您正苦于以下问题:Java PhongMaterial类的具体用法?Java PhongMaterial怎么用?Java PhongMaterial使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PhongMaterial类属于javafx.scene.paint包,在下文中一共展示了PhongMaterial类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AxisOrientation
import javafx.scene.paint.PhongMaterial; //导入依赖的package包/类
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);
}
示例2: buildGroup
import javafx.scene.paint.PhongMaterial; //导入依赖的package包/类
@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;
}
示例3: initMaterials
import javafx.scene.paint.PhongMaterial; //导入依赖的package包/类
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));
}
示例4: buildGroup
import javafx.scene.paint.PhongMaterial; //导入依赖的package包/类
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;
}
示例5: buildGroup
import javafx.scene.paint.PhongMaterial; //导入依赖的package包/类
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();
}
示例6: getMaterial
import javafx.scene.paint.PhongMaterial; //导入依赖的package包/类
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());
}
}
}
示例7: modify
import javafx.scene.paint.PhongMaterial; //导入依赖的package包/类
@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);
}
}
示例8: setXYZData
import javafx.scene.paint.PhongMaterial; //导入依赖的package包/类
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);
}
}
示例9: buildAxes
import javafx.scene.paint.PhongMaterial; //导入依赖的package包/类
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);
}
示例10: Bone
import javafx.scene.paint.PhongMaterial; //导入依赖的package包/类
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));
}
示例11: Axes
import javafx.scene.paint.PhongMaterial; //导入依赖的package包/类
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));
}
示例12: load
import javafx.scene.paint.PhongMaterial; //导入依赖的package包/类
/**
* 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 + "]");
}
}
示例13: buildGroup
import javafx.scene.paint.PhongMaterial; //导入依赖的package包/类
@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;
}
示例14: buildGroup
import javafx.scene.paint.PhongMaterial; //导入依赖的package包/类
private Group buildGroup() {
mtrl = new PhongMaterial();
shapeGroup = new Group();
selectShapeType(ShapeType.Cone);
return shapeGroup;
}
示例15: initMaterial
import javafx.scene.paint.PhongMaterial; //导入依赖的package包/类
private void initMaterial() {
material = new PhongMaterial();
material.setDiffuseColor(Color.LIGHTGRAY);
material.setSpecularColor(Color.rgb(30, 30, 30));
shape.setMaterial(material);
}