@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; }
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); }
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(); } }); }
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); }
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); }
@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; }
@Override public Group testObject3D() { Group group = new Group(); SurfacePlotMesh surface = new SurfacePlotMesh(p -> Math.sin(p.magnitude() + 0.00000000000000001) / (p.magnitude() + 0.00000000000000001), 10, 10, 10, 10, 5d); // PhongMaterial matTorus = new PhongMaterial(Color.FIREBRICK); // torus.setMaterial(matTorus); // surface.setDrawMode(DrawMode.LINE); surface.setCullFace(CullFace.NONE); // NONE // surface.setTextureModeNone(Color.FORESTGREEN); // IMAGE // torus.setTextureModeImage(getClass().getResource("res/grid1.png").toExternalForm()); // banner.setTextureModeImage(getClass().getResource("res/Duke3DprogressionSmall.jpg").toExternalForm()); // PATTERN surface.setTextureModePattern(CarbonPatterns.CARBON_KEVLAR, 1.0d); // DENSITY // surface.setTextureModeVertices3D(1530,dens); // FACES // torus.setTextureModeFaces(256*256); group.getChildren().addAll(surface); return group; }
/** * 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); } }
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; }
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)); }
private Group getGroup() { shape = getShape(); shape.setScaleX(SCALE); shape.setScaleY(SCALE); shape.setScaleZ(SCALE); shape.setCullFace(CullFace.NONE); rb = new GroupMover(shape); return rb.getGroup(); }
@Override public void setCullFace(final CullFace face) { new GetAction() { @Override public void run(Object... os) throws Exception { getShapesApp().setCullFace(face); } }.dispatch(Root.ROOT.getEnvironment()); }
public MeshView buildMeshView(String key) { MeshView meshView = new MeshView(); meshView.setId(key); meshView.setMaterial(materials.get(key)); meshView.setMesh(meshes.get(key)); meshView.setCullFace(CullFace.NONE); return meshView; }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
public TetrahedraMesh(double height, int level, Point3D center){ setHeight(height); setLevel(level); setCenter(center); updateMesh(); setCullFace(CullFace.BACK); setDrawMode(DrawMode.FILL); setDepthTest(DepthTest.ENABLE); }
@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; }
public CuboidMesh(double width, double height, double depth, int level){ setWidth(width); setHeight(height); setDepth(depth); setLevel(level); updateMesh(); setCullFace(CullFace.BACK); setDrawMode(DrawMode.FILL); setDepthTest(DepthTest.ENABLE); }
public SurfacePlotMesh(Function<Point2D,Number> function, double rangeX, double rangeY, int divisionsX, int divisionsY, double scale) { setFunction2D(function); setRangeX(rangeX); setRangeY(rangeY); setDivisionsX(divisionsX); setDivisionsY(divisionsY); setScale(scale); updateMesh(); setCullFace(CullFace.BACK); setDrawMode(DrawMode.FILL); setDepthTest(DepthTest.ENABLE); }
public SegmentedSphereMesh(int tDivs, int cropX, int cropY, double radius) { setRadiusDivisions(tDivs); setRadiusCropX(cropX); setRadiusCropY(cropY); setRadius(radius); setzOffset(1); updateMesh(); setCullFace(CullFace.BACK); setDrawMode(DrawMode.FILL); setDepthTest(DepthTest.ENABLE); }
public DevoxxBillboardLogo() { this.mat.setDiffuseMap(image); this.mesh = createMesh(); this.setMesh(mesh); this.setMaterial(mat); this.setCullFace(CullFace.NONE); this.updateThread.setRunnable(() -> { if (isAnimated() && updateThread.getCurrentTime() >= (updateThread.getUpdateDelay())) { updateMesh(); updateThread.setUpdateDelay((updateThread.getCurrentTime() + 80000000)); } }); updateThread.start(); this.sceneProperty().addListener(new ChangeListener<Scene>() { @Override public void changed(ObservableValue<? extends Scene> observable, Scene oldValue, Scene newValue) { if (newValue != null) { otherNode = getScene().getCamera(); startBillboardBehavior(); sceneProperty().removeListener(this); } } }); }
/** * Construct the Bowl from the given Surface. * * @param surface surface */ public BowlShape(Surface surface) { bowlMaterial.setDiffuseColor(Color.PERU); // defaults are overwritten in refresh() bowlMaterial.setSpecularColor(Color.WHITE); // seems to be shinier with white bowlMaterial1.setSpecularColor(Color.WHITE); // seems to be shinier with white bowlMaterial2.setSpecularColor(Color.WHITE); // seems to be shinier with white //The MeshView allows you to control how the TriangleMesh is rendered // meshView.setDrawMode(DrawMode.LINE); // show lines only meshView.setDrawMode(DrawMode.FILL); meshView.setCullFace(CullFace.NONE); // no culling // meshView.setCullFace(CullFace.BACK); meshView.setMaterial(bowlMaterial); this.getChildren().add(meshView); meshView1.setDrawMode(DrawMode.FILL); meshView1.setCullFace(CullFace.NONE); // no culling meshView1.setMaterial(bowlMaterial1); this.getChildren().add(meshView1); meshView2.setDrawMode(DrawMode.FILL); meshView2.setCullFace(CullFace.NONE); // no culling meshView2.setMaterial(bowlMaterial2); this.getChildren().add(meshView2); //for now we'll just make an empty texCoordinate group mesh.getTexCoords().setAll(0, 0); mesh1.getTexCoords().setAll(0, 0); mesh2.getTexCoords().setAll(0, 0); if (surface != null) { refresh(surface); } }