当前位置: 首页>>代码示例>>Java>>正文


Java Box.setMaterial方法代码示例

本文整理汇总了Java中javafx.scene.shape.Box.setMaterial方法的典型用法代码示例。如果您正苦于以下问题:Java Box.setMaterial方法的具体用法?Java Box.setMaterial怎么用?Java Box.setMaterial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.shape.Box的用法示例。


在下文中一共展示了Box.setMaterial方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AxisOrientation

import javafx.scene.shape.Box; //导入方法依赖的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);
}
 
开发者ID:adihubba,项目名称:javafx-3d-surface-chart,代码行数:23,代码来源:AxisOrientation.java

示例2: Face

import javafx.scene.shape.Box; //导入方法依赖的package包/类
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);
			}
		}
}
 
开发者ID:InfinityStudio,项目名称:minecraft-jfx-skin,代码行数:17,代码来源:SkinMultipleCubes.java

示例3: buildCubes

import javafx.scene.shape.Box; //导入方法依赖的package包/类
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);
}
 
开发者ID:cleberecht,项目名称:singa,代码行数:22,代码来源:StructureViewer.java

示例4: buildAxes

import javafx.scene.shape.Box; //导入方法依赖的package包/类
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;
}
 
开发者ID:sanke69,项目名称:fr.xs.jtk,代码行数:18,代码来源:SolarSystemTest.java

示例5: buildAxes

import javafx.scene.shape.Box; //导入方法依赖的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);
}
 
开发者ID:Jenna3715,项目名称:3D-Game,代码行数:25,代码来源:MoleculeSampleApp.java

示例6: makePedestal

import javafx.scene.shape.Box; //导入方法依赖的package包/类
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));
}
 
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:24,代码来源:ScadaApplication.java

示例7: Bone

import javafx.scene.shape.Box; //导入方法依赖的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));
}
 
开发者ID:jperedadnr,项目名称:RiggedHand,代码行数:18,代码来源:Bone.java

示例8: buildGroup

import javafx.scene.shape.Box; //导入方法依赖的package包/类
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;
    }
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:28,代码来源:SubSceneDepthTestApp.java

示例9: buildAxes

import javafx.scene.shape.Box; //导入方法依赖的package包/类
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);
}
 
开发者ID:gluonhq,项目名称:gluon-samples,代码行数:36,代码来源:ContentModel.java

示例10: setupSceneInternals

import javafx.scene.shape.Box; //导入方法依赖的package包/类
/**
 * <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);

}
 
开发者ID:eclipse,项目名称:eavp,代码行数:39,代码来源:FXViewer.java

示例11: setupSceneInternals

import javafx.scene.shape.Box; //导入方法依赖的package包/类
@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);

}
 
开发者ID:eclipse,项目名称:eavp,代码行数:34,代码来源:FXGeometryViewer.java

示例12: FXMeshAttachment

import javafx.scene.shape.Box; //导入方法依赖的package包/类
/**
 * <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);
}
 
开发者ID:eclipse,项目名称:eavp,代码行数:18,代码来源:FXMeshAttachment.java

示例13: Axis3D

import javafx.scene.shape.Box; //导入方法依赖的package包/类
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);
}
 
开发者ID:sanke69,项目名称:fr.xs.jtk,代码行数:28,代码来源:Axis3D.java

示例14: buildAxes

import javafx.scene.shape.Box; //导入方法依赖的package包/类
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);
}
 
开发者ID:sanke69,项目名称:fr.xs.jtk,代码行数:14,代码来源:PivotTest.java

示例15: createAxis

import javafx.scene.shape.Box; //导入方法依赖的package包/类
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);
}
 
开发者ID:opengl-8080,项目名称:classical-physics,代码行数:16,代码来源:Axis.java


注:本文中的javafx.scene.shape.Box.setMaterial方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。