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


Java FrustumMesh类代码示例

本文整理汇总了Java中org.fxyz.shapes.primitives.FrustumMesh的典型用法代码示例。如果您正苦于以下问题:Java FrustumMesh类的具体用法?Java FrustumMesh怎么用?Java FrustumMesh使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: makeGauge

import org.fxyz.shapes.primitives.FrustumMesh; //导入依赖的package包/类
private Group makeGauge(double ratio) {
	Group group = new Group();
	ObservableList<Node> children = group.getChildren();
	CSG outer = new eu.mihosoft.vrl.v3d.Cylinder(1 * ratio, 1.5, 100).toCSG();
	eu.mihosoft.vrl.v3d.Cylinder inner = new eu.mihosoft.vrl.v3d.Cylinder(0.93 * ratio, 0.3, 100);
	CSG sg = outer.difference(inner.toCSG());

	double scales = 12;
	double dt = 360 / scales;
	// if do cylinder union verrrry slow
	CSG c = new Cube(0.1, 0.93 * 2 * ratio, 0.1).toCSG();
	CSG result = null;
	// because the cube bar is symmetrical
	for (int i = 0; i < scales / 2; i++) {
		if (result == null) result = c.transformed(unity().rotZ(dt * i));
		else result = result.union(c.transformed(unity().rotZ(dt * i)));
	}
	// remove inner of scale label
	inner = new eu.mihosoft.vrl.v3d.Cylinder(0.6 * ratio, 0.3, 100);
	result = result.transformed(unity().translateZ(0.15)).difference(inner.toCSG());
	// center pol

	CSGMesh pol = new CSGMesh(sg);
	// PhongMaterial mat = new PhongMaterial();
	// mat.setDiffuseColor(materialColor);
	// Image image = FXUtil.loadImage("/images/cw.png");
	// // mat.setBumpMap(image);
	// mat.setSpecularMap(image);
	// mat.setSpecularPower(64);
	// // mat.setSelfIlluminationMap(image);//no effect
	// pol.setMaterial(mat);
	pol.setMaterial(material);
	children.add(pol);

	CSGMesh scal = new CSGMesh(result);
	scal.setMaterial(material2);
	children.add(scal);

	Torus ring = new Torus(0.885 * ratio, 0.21);
	ring.mesh.setMaterial(material2);
	ring.getTransforms().addAll(new Translate(0, 0, 0.1));
	children.add(ring);

	String fontName=		Font.getFontNames().get(0);

	double radius = 0.93 * ratio * 14;
	for (int i = 1; i <= 12; i++) {
		// Museo Slab 500
		// Museo Sans 500
		// Museo 500
		Text3DMesh scaleLabel = new Text3DMesh(String.valueOf(i), fontName, 11, true, 0.1, 0, 1);
		// final int count=i;
		// scaleLabel.setTextureModeVertices3D(1530,p->(double)(p.y/(20+count))*(p.x/(10+count)));
		scaleLabel.setTextureModeNone(Color.ROYALBLUE);
		scaleLabel.getTransforms().add(new Scale(0.040346851, 0.040346851));
		double rad = Math.toRadians(dt * i);
		double deltax = i < 10 ? 3 : 5;
		double deltay = i == 10 ? 6 : 4;
		scaleLabel.getTransforms().add(new Translate(-radius * Math.sin(rad) + deltax, //
				radius * Math.cos(rad) * 0.95 - deltay, 0.1));
		scaleLabel.getTransforms().add(new Rotate(180, Rotate.Z_AXIS));
		children.add(scaleLabel);
	}

	CSGMesh center = new CSGMesh(new Sphere(0.2, 40, 10).toCSG().transformed(unity().translateZ(0.15)));
	center.setMaterial(material2);
	children.add(center);

	FrustumMesh needle = new FrustumMesh(0.1, 0.035, 0.6 * ratio);
	needle.setMaterial(material2);

	needleTranslate = new Translate(0, -0.6, 0.05);
	needleRotate = new Rotate(0, Rotate.Z_AXIS);
	needle.getTransforms().addAll(needleTranslate, needleRotate);

	children.add(needle);

	return group;
}
 
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:80,代码来源:ScadaApplication.java


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