Java 类javafx.scene.shape.DrawMode 实例源码
项目:javafx-3d-surface-chart
文件:MeshControlPanel.java
private void initListeners() {
ValueChangedListener listener = (lastValue, newValue, source) -> {
if (newValue != lastValue) {
control.showOrientationCross(showOrientationcross.isYesSelected());
control.setDrawMode(interpolateValues.isYesSelected() ? DrawMode.FILL : DrawMode.LINE);
control.setLeftWallVisible(showLeftWall.isYesSelected());
control.setRightWallVisible(showRightWall.isYesSelected());
control.setTopWallVisible(showTopWall.isYesSelected());
control.setBottomWallVisible(showBottomWall.isYesSelected());
control.setFrontWallVisible(showFrontWall.isYesSelected());
control.setBackWallVisible(showBackWall.isYesSelected());
control.activateDynamicWalls(dynamicWalls.isYesSelected());
updateControls();
}
};
dynamicWalls.addValueChangedListener(listener);
showOrientationcross.addValueChangedListener(listener);
interpolateValues.addValueChangedListener(listener);
showLeftWall.addValueChangedListener(listener);
showRightWall.addValueChangedListener(listener);
showTopWall.addValueChangedListener(listener);
showBottomWall.addValueChangedListener(listener);
showFrontWall.addValueChangedListener(listener);
showBackWall.addValueChangedListener(listener);
}
项目: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;
}
项目:eavp
文件:FXWireframeOption.java
/**
* Set all the MeshViews in the group to the given draw mode, as well as the
* children of any child groups.
*
* @param group
* The group whose children will have their draw modes set.
* @param mode
* The mode to be set to the group's children.
*/
private void setMode(Group group, DrawMode mode) {
// 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).setDrawMode(mode);
}
// Otherwise, recursively handle the child group
else if (node.getClass() == Group.class) {
setMode((Group) node, mode);
}
}
}
项目:fr.xs.jtk
文件:KnotMesh.java
public KnotMesh(double majorRadius, double minorRadius, double wireRadius, double p, double q,
int rDivs, int tDivs, int lengthCrop, int wireCrop) {
setMajorRadius(majorRadius);
setMinorRadius(minorRadius);
setWireRadius(wireRadius);
setP(p);
setQ(q);
setLengthDivisions(rDivs);
setWireDivisions(tDivs);
setLengthCrop(lengthCrop);
setWireCrop(wireCrop);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:fr.xs.jtk
文件:IcosahedronMesh.java
public IcosahedronMesh(int level, float diameter){
setLevel(level);
setDiameter(diameter);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
diameterProperty().addListener((obs,f0,f1)->{
if(mesh!=null && f0!=null && f1!=null && f0.floatValue()>0 && f1.floatValue()>0){
updateVertices(f1.floatValue()/f0.floatValue());
}
});
levelProperty().addListener((obs,i0,i1)->{
if(mesh!=null && i1!=null && i1.intValue()>=0){
updateMesh();
}
});
}
项目:fr.xs.jtk
文件:CurvedSpringMesh.java
public CurvedSpringMesh(double majorRadius, double minorRadius, double wireRadius, double pitch, double length,
int rDivs, int tDivs, int lengthCrop, int wireCrop) {
setMajorRadius(majorRadius);
setMinorRadius(minorRadius);
setWireRadius(wireRadius);
setPitch(pitch);
setLength(length);
setLengthDivisions(rDivs);
setWireDivisions(tDivs);
setLengthCrop(lengthCrop);
setWireCrop(wireCrop);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:fr.xs.jtk
文件:SpringMesh.java
public SpringMesh(double meanRadius, double wireRadius, double pitch, double length,
int rDivs, int tDivs, int lengthCrop, int wireCrop) {
setMeanRadius(meanRadius);
setWireRadius(wireRadius);
setPitch(pitch);
setLength(length);
factor=length/pitch;
setLengthDivisions(rDivs);
setWireDivisions(tDivs);
setLengthCrop(lengthCrop);
setWireCrop(wireCrop);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:fr.xs.jtk
文件:TetrahedraTest.java
@Override
public Group testObject3D() {
Group group = new Group();
TetrahedraMesh tetra = new TetrahedraMesh(10, 7, null);
// cylinder = new PrismMesh(0.2,2,3); //,new Point3D(-5,5,0),new
// Point3D(0,0,5));
tetra.setDrawMode(DrawMode.LINE);
tetra.setCullFace(CullFace.NONE);
// NONE
// cylinder.setTextureModeNone(Color.ROYALBLUE);
// IMAGE
// tetra.setTextureModeImage(getClass().getResource("res/steel-mesh.jpg").toExternalForm());
// tetra.setTextureModeVertices1D(6, t->t);
// cylinder.setColorPalette(ColorPalette.GREEN);
// DENSITY
tetra.setTextureModeVertices3D(1530, p -> p.magnitude());
// cylinder.setTextureModeVertices3D(1530,p->(double)cylinder.unTransform(p).magnitude());
// FACES
// tetra.setTextureModeFaces(1530);
group.getChildren().add(tetra);
return group;
}
项目:FXyzLib
文件:KnotMesh.java
public KnotMesh(double majorRadius, double minorRadius, double wireRadius, double p, double q,
int rDivs, int tDivs, int lengthCrop, int wireCrop) {
setMajorRadius(majorRadius);
setMinorRadius(minorRadius);
setWireRadius(wireRadius);
setP(p);
setQ(q);
setLengthDivisions(rDivs);
setWireDivisions(tDivs);
setLengthCrop(lengthCrop);
setWireCrop(wireCrop);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:FXyzLib
文件:IcosahedronMesh.java
public IcosahedronMesh(int level, float diameter){
setLevel(level);
setDiameter(diameter);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
diameterProperty().addListener((obs,f0,f1)->{
if(mesh!=null && f0!=null && f1!=null && f0.floatValue()>0 && f1.floatValue()>0){
updateVertices(f1.floatValue()/f0.floatValue());
}
});
levelProperty().addListener((obs,i0,i1)->{
if(mesh!=null && i1!=null && i1.intValue()>=0){
updateMesh();
}
});
}
项目:FXyzLib
文件:CurvedSpringMesh.java
public CurvedSpringMesh(double majorRadius, double minorRadius, double wireRadius, double pitch, double length,
int rDivs, int tDivs, int lengthCrop, int wireCrop) {
setMajorRadius(majorRadius);
setMinorRadius(minorRadius);
setWireRadius(wireRadius);
setPitch(pitch);
setLength(length);
setLengthDivisions(rDivs);
setWireDivisions(tDivs);
setLengthCrop(lengthCrop);
setWireCrop(wireCrop);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:FXyzLib
文件:SpringMesh.java
public SpringMesh(double meanRadius, double wireRadius, double pitch, double length,
int rDivs, int tDivs, int lengthCrop, int wireCrop) {
setMeanRadius(meanRadius);
setWireRadius(wireRadius);
setPitch(pitch);
setLength(length);
factor=length/pitch;
setLengthDivisions(rDivs);
setWireDivisions(tDivs);
setLengthCrop(lengthCrop);
setWireCrop(wireCrop);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:classical-physics
文件:Axis.java
private void createPlane(double length) {
Box xzPlane = new Box(length, PLANE_THICKNESS, length);
xzPlane.setDrawMode(DrawMode.LINE);
xzPlane.setTranslateX(length / 2.0);
xzPlane.setTranslateZ(length / 2.0);
Box xyPlane = new Box(length, length, PLANE_THICKNESS);
xyPlane.setDrawMode(DrawMode.LINE);
xyPlane.setTranslateX(length / 2.0);
xyPlane.setTranslateY(length / 2.0);
Box yzPlane = new Box(PLANE_THICKNESS, length, length);
yzPlane.setDrawMode(DrawMode.LINE);
yzPlane.setTranslateY(length / 2.0);
yzPlane.setTranslateZ(length / 2.0);
this.group.getChildren().addAll(xzPlane, xyPlane, yzPlane);
}
项目:COrnLathe
文件:MultiLine3D.java
/**
* Construct a new MultiLine3D object.
*
* @param lines list of lines
*/
public MultiLine3D(List<Line3D> lines) {
lineMaterial.setDiffuseColor(color);
lineMaterial.setSpecularColor(color);
//The MeshView allows you to control how the TriangleMesh is rendered
meshView.setDrawMode(DrawMode.FILL); //Fill so that the line shows width
// meshView.setDrawMode(DrawMode.LINE); // only show lines
meshView.setCullFace(CullFace.NONE); // no culling (backs are black)
meshView.setMaterial(lineMaterial);
this.getChildren().add(meshView);
// add dummy Texture Coordinate
mesh.getTexCoords().addAll(0, 0);
setDepthTest(DepthTest.INHERIT);
if (!lines.isEmpty()) {
refresh(lines);
}
}
项目:FX3DAndroid
文件:KnotMesh.java
public KnotMesh(double majorRadius, double minorRadius, double wireRadius, double p, double q,
int rDivs, int tDivs, int lengthCrop, int wireCrop) {
setMajorRadius(majorRadius);
setMinorRadius(minorRadius);
setWireRadius(wireRadius);
setP(p);
setQ(q);
setLengthDivisions(rDivs);
setWireDivisions(tDivs);
setLengthCrop(lengthCrop);
setWireCrop(wireCrop);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:FX3DAndroid
文件:IcosahedronMesh.java
public IcosahedronMesh(int level, float diameter){
setLevel(level);
setDiameter(diameter);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
diameterProperty().addListener((obs,f0,f1)->{
if(mesh!=null && f0!=null && f1!=null && f0.floatValue()>0 && f1.floatValue()>0){
updateVertices(f1.floatValue()/f0.floatValue());
}
});
levelProperty().addListener((obs,i0,i1)->{
if(mesh!=null && i1!=null && i1.intValue()>=0){
updateMesh();
}
});
}
项目:FX3DAndroid
文件:CurvedSpringMesh.java
public CurvedSpringMesh(double majorRadius, double minorRadius, double wireRadius, double pitch, double length,
int rDivs, int tDivs, int lengthCrop, int wireCrop) {
setMajorRadius(majorRadius);
setMinorRadius(minorRadius);
setWireRadius(wireRadius);
setPitch(pitch);
setLength(length);
setLengthDivisions(rDivs);
setWireDivisions(tDivs);
setLengthCrop(lengthCrop);
setWireCrop(wireCrop);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:FX3DAndroid
文件:SpringMesh.java
public SpringMesh(double meanRadius, double wireRadius, double pitch, double length,
int rDivs, int tDivs, int lengthCrop, int wireCrop) {
setMeanRadius(meanRadius);
setWireRadius(wireRadius);
setPitch(pitch);
setLength(length);
factor=length/pitch;
setLengthDivisions(rDivs);
setWireDivisions(tDivs);
setLengthCrop(lengthCrop);
setWireCrop(wireCrop);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:javafx-3d-surface-chart
文件:Mesh3DChartPanel.java
private void updateControlPanel() {
if (controlPanel != null) {
SwingUtilities.invokeLater(() -> {
controlPanel.setDynamicWalls(dynamicWallsEnabled);
controlPanel.setLeftWallVisible(cube.isLeftWallVisible());
controlPanel.setRightWallVisible(cube.isRightWallVisible());
controlPanel.setTopWallVisible(cube.isTopWallVisible());
controlPanel.setBottomWallVisible(cube.isBottomWallVisible());
controlPanel.setFrontWallVisible(cube.isFrontWallVisible());
controlPanel.setBackWallVisible(cube.isBackWallVisible());
controlPanel.setInterpolateValues(drawMode == DrawMode.FILL);
controlPanel.setShowOrientationCross(axisOrientation.isVisible());
});
}
}
项目:openjfx-8u-dev-tests
文件:Shape3DTestFunctions.java
@Override
public void setDrawMode(final DrawMode mode) {
new GetAction() {
@Override
public void run(Object... os) throws Exception {
getShapesApp().setDrawMode(mode);
}
}.dispatch(Root.ROOT.getEnvironment());
}
项目:eavp
文件:FXVertexViewTester.java
/**
* Test that the vertex can be drawn in wireframe mode
*/
@Test @Ignore
public void checkWireframe() {
// Create a view for a vertex
FXVertexView view = new FXVertexView(new Vertex(0, 0, 0));
// The view should start off opaque
assertFalse(view.isWireframe());
// Make the view transparent
view.setWireframeMode(true);
// Check that the transparency flag is set
assertTrue(view.isWireframe());
// Whether a sphere shape has been found while searching the JavaFX
// node's children.
boolean sphereFound = false;
// Get the group containing the node
Representation<Group> representation = view.getRepresentation();
// Search all of the node's children
for (Node node : (representation.getData()).getChildren()) {
// If the child is a 3D shape, it should be transparent
if (node instanceof Shape3D) {
assertTrue(((Shape3D) node).getDrawMode() == DrawMode.LINE);
sphereFound = true;
break;
}
}
// A child sphere corresponding to the vertex should have been found
assertTrue(sphereFound);
}
项目: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
文件:FXWireframeOptionTester.java
/**
* Check that the decorator will set the object's material correctly.
*/
@Test @Ignore
public void checkMesh() {
// Create a render object
Shape shape = GeometryFactory.eINSTANCE.createShape();
FXRenderObject object = new FXRenderObject(shape, new FXMeshCache());
// Create an opacity decorator for it
FXWireframeOption decorator = new FXWireframeOption(object);
// Set the shape as a wireframe
object.setProperty(WireframeOptionImpl.PROPERTY_NAME_WIREFRAME, true);
// The child's draw mode should have been changed
assertTrue(((MeshView) object.getMesh().getChildren().get(0))
.getDrawMode() == DrawMode.LINE);
// Make the shape solid again and check that it was reset
object.setProperty(WireframeOptionImpl.PROPERTY_NAME_WIREFRAME, false);
assertTrue(((MeshView) object.getMesh().getChildren().get(0))
.getDrawMode() == DrawMode.FILL);
// Sending an update from the shape should also set the wireframe mode
shape.changeDecoratorProperty(
WireframeOptionImpl.PROPERTY_NAME_WIREFRAME, true);
assertTrue(((MeshView) object.getMesh().getChildren().get(0))
.getDrawMode() == DrawMode.LINE);
// Deactivating the option should leave the object filled in
decorator.setActive(false);
assertTrue(((MeshView) object.getMesh().getChildren().get(0))
.getDrawMode() == DrawMode.FILL);
}
项目: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
文件:FXWireframeOption.java
@Override
public void modify(Group element) {
boolean wireframe = (boolean) parent
.getProperty(PROPERTY_NAME_WIREFRAME);
// Set the group's children to the correct drawing mode.
if (!wireframe) {
setMode(element, DrawMode.FILL);
} else {
setMode(element, DrawMode.LINE);
}
}
项目:eavp
文件:FXLinearEdgeView.java
@Override
public void setWireframeMode(boolean on) {
wireframe = on;
// Set the mesh to the correct draw mode
if (mesh != null) {
if (on) {
mesh.setDrawMode(DrawMode.LINE);
} else {
mesh.setDrawMode(DrawMode.FILL);
}
}
}
项目:eavp
文件:FXVertexView.java
/**
* The default constructor.
*
* @param model
* The model which this view will display
*/
public FXVertexView(Vertex model) {
this();
// Set the node's name
node.setId(model.getProperty(MeshProperty.NAME));
// Get the model's transformation
Transformation localTransform = model.getTransformation();
// Flatten the sphere into a circle
localTransform.setScale(1, 1, 0.75);
// Set the node's transformation
node.getTransforms().setAll(Util.convertTransformation(localTransform));
// Create a Shape3D for the model
mesh = new Sphere(1);
// Set the sphere to the correct wireframe and opacity states
if (transparent) {
mesh.setOpacity(0d);
}
if (wireframe) {
mesh.setDrawMode(DrawMode.LINE);
}
// Set the sphere to be the constructing material by default
mesh.setMaterial(constructingMaterial);
node.getChildren().add(mesh);
}
项目:eavp
文件:FXVertexView.java
@Override
public void setWireframeMode(boolean on) {
wireframe = on;
// Set the mesh to the correct draw mode
if (mesh != null) {
if (wireframe) {
mesh.setDrawMode(DrawMode.LINE);
} else {
mesh.setDrawMode(DrawMode.FILL);
}
}
}
项目:fr.xs.jtk
文件:CuboidMesh.java
public CuboidMesh(double width, double height, double depth, int level, Point3D center){
setWidth(width);
setHeight(height);
setDepth(depth);
setLevel(level);
setCenter(center);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:fr.xs.jtk
文件:SurfacePlotMesh.java
public SurfacePlotMesh(Function<Point2D,Number> function, double rangeX, double rangeY, int divisionsX, int divisionsY, double functionScale) {
setFunction2D(function);
setRangeX(rangeX);
setRangeY(rangeY);
setDivisionsX(divisionsX);
setDivisionsY(divisionsY);
setFunctionScale(functionScale);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:fr.xs.jtk
文件:PrismMesh.java
public PrismMesh(double radius, double height, int level, Point3D pIni, Point3D pEnd){
setAxisOrigin(pIni==null?new Point3D(0,(float)height/2f,0):pIni);
setAxisEnd(pEnd==null?new Point3D(0,-(float)height/2f,0):pEnd);
setRadius(radius);
setHeight(getAxisEnd().substract(getAxisOrigin()).magnitude());
setLevel(level);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:fr.xs.jtk
文件:SegmentedTorusMesh.java
public SegmentedTorusMesh(int rDivs, int tDivs, int crop, double majorRadius, double minorRadius) {
setMajorRadiusDivisions(rDivs);
setMinorRadiusDivisions(tDivs);
setMajorRadiusCrop(crop);
setMajorRadius(majorRadius);
setMinorRadius(minorRadius);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:fr.xs.jtk
文件:BezierMesh.java
public BezierMesh(BezierHelper spline, double wireRadius,
int rDivs, int tDivs, int lengthCrop, int wireCrop) {
setSpline(spline);
setWireRadius(wireRadius);
setLengthDivisions(rDivs);
setWireDivisions(tDivs);
setLengthCrop(lengthCrop);
setWireCrop(wireCrop);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:fr.xs.jtk
文件:SegmentedSphereMesh.java
public SegmentedSphereMesh(int tDivs, int cropX, int cropY, double radius, Point3D center) {
setRadiusDivisions(tDivs);
setRadiusCropX(cropX);
setRadiusCropY(cropY);
setRadius(radius);
setzOffset(1);
setCenter(center);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:fr.xs.jtk
文件:FrustumMesh.java
public FrustumMesh(double majorRadius, double minorRadius, double height, int level, Point3D pIni, Point3D pEnd){
setAxisOrigin(pIni==null?new Point3D(0,(float)height/2f,0):pIni);
setAxisEnd(pEnd==null?new Point3D(0,-(float)height/2f,0):pEnd);
setMajorRadius(majorRadius);
setMinorRadius(minorRadius);
setLevel(level);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:fr.xs.jtk
文件:TetrahedraMesh.java
public TetrahedraMesh(double height, int level, Point3D center){
setHeight(height);
setLevel(level);
setCenter(center);
updateMesh();
setCullFace(CullFace.BACK);
setDrawMode(DrawMode.FILL);
setDepthTest(DepthTest.ENABLE);
}
项目:fr.xs.jtk
文件:ClothMeshTest.java
@Override
public Group testObject3D() {
Group group = new Group();
ClothMesh cloth = new ClothMesh();
cloth.setPerPointMass(10);
cloth.setBendStrength(0.5);
cloth.setStretchStrength(1.0);
cloth.setShearStrength(0.55);
cloth.setDrawMode(DrawMode.LINE);
cloth.setCullFace(CullFace.NONE);
// cloth.setDiffuseMap(new Image("https://kenai.com/attachments/wiki_images/duke/Duke3DprogressionSmall.jpg"));
cloth.setSpecularPower(5);
PointLight light2 = new PointLight(Color.GAINSBORO);
light2.setTranslateZ(-1500);
PointLight light3 = new PointLight(Color.AZURE);
light3.setTranslateZ(2500);
Group g = new Group();
g.getChildren().addAll(cloth, light2, light3);
group.getChildren().add(g);
group.setPickOnBounds(false);
cloth.startSimulation();
return group;
}
项目:fr.xs.jtk
文件:ABunchOfMeshTest.java
protected static Group aBunchOfCapsules() {
Group capsuleGroup = new Group();
for(int i = 0; i < 50; i++) {
Random r = new Random();
float randomRadius = (float) ((r.nextFloat() * 100) + 25);
float randomHeight = (float) ((r.nextFloat() * 300) + 75);
Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
Capsule cap = new Capsule(randomRadius, randomHeight, randomColor);
cap.setEmissiveLightingColor(randomColor);
cap.setEmissiveLightingOn(r.nextBoolean());
cap.setDrawMode(r.nextBoolean() ? DrawMode.FILL : DrawMode.LINE);
double translationX = Math.random() * 1024 * 1.95;
if(Math.random() >= 0.5) {
translationX *= -1;
}
double translationY = Math.random() * 1024 * 1.95;
if(Math.random() >= 0.5) {
translationY *= -1;
}
double translationZ = Math.random() * 1024 * 1.95;
if(Math.random() >= 0.5) {
translationZ *= -1;
}
Translate translate = new Translate(translationX, translationY, translationZ);
Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);
cap.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
capsuleGroup.getChildren().add(cap);
}
return capsuleGroup;
}
项目:fr.xs.jtk
文件:ABunchOfMeshTest.java
protected static Group aBunchOfCones() {
Group coneGroup = new Group();
for (int i = 0; i < 100; i++) {
Random r = new Random();
//A lot of magic numbers in here that just artificially constrain the math
float randomRadius = (float) ((r.nextFloat()*100) + 25);
float randomHeight = (float) ((r.nextFloat()*300)+ 75);
int randomDivisions = (int) ((r.nextFloat()*50) + 5);
Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
Cone cone = new Cone(randomDivisions, randomRadius, randomHeight, randomColor);
cone.setEmissiveLightingColor(randomColor);
cone.setEmissiveLightingOn(r.nextBoolean());
cone.setDrawMode(r.nextBoolean() ? DrawMode.FILL : DrawMode.LINE);
double translationX = Math.random() * 1024;
if (Math.random() >= 0.5) {
translationX *= -1;
}
double translationY = Math.random() * 1024;
if (Math.random() >= 0.5) {
translationY *= -1;
}
double translationZ = Math.random() * 1024;
if (Math.random() >= 0.5) {
translationZ *= -1;
}
Translate translate = new Translate(translationX, translationY, translationZ);
Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);
cone.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
coneGroup.getChildren().add(cone);
}
return coneGroup;
}
项目:fr.xs.jtk
文件:ABunchOfMeshTest.java
protected static Group aBunchOfSpheroid() {
Group spheroidGroup = new Group();
for(int i = 0; i < 50; i++) {
Random r = new Random();
// A lot of magic numbers in here that just artificially constrain
// the math
float randomMajorRadius = (float) ((r.nextFloat() * 300) + 50);
float randomMinorRadius = (float) ((r.nextFloat() * 300) + 50);
int randomDivisions = (int) ((r.nextFloat() * 64) + 1);
Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
Spheroid sm = new Spheroid(randomDivisions, randomMajorRadius, randomMinorRadius, randomColor);
sm.setDrawMode(DrawMode.LINE);
double translationX = Math.random() * 1024 * 1.95;
if(Math.random() >= 0.5) {
translationX *= -1;
}
double translationY = Math.random() * 1024 * 1.95;
if(Math.random() >= 0.5) {
translationY *= -1;
}
double translationZ = Math.random() * 1024 * 1.95;
if(Math.random() >= 0.5) {
translationZ *= -1;
}
Translate translate = new Translate(translationX, translationY, translationZ);
Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);
sm.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
spheroidGroup.getChildren().add(sm);
}
return spheroidGroup;
}