javafx-3d

Javafx Quadrilateral Mesh

走远了吗. 提交于 2019-12-02 01:37:10
I need to display a quadrilateral mesh in javafx each mesh face having 4 points i have tried some triangle mesh examples from fxyz library , but not sure how does it work for quadrilaterals, Can someone help pointing to examples in javafx for quadrilateral mesh. The 3DViewer project that is available at the OpenJFX repository , contains already a PolygonalMesh implementation , that allows any number of points per face, so any polygon can be a face. You can use them that mesh implementation in a PolygonMeshView , instead of the regular MeshView . Since a triangle is a valid polygon, any

How to add text to each face of a box [JavaFX]

血红的双手。 提交于 2019-11-29 15:28:08
I create a box which I can rotate and what will do ~some action~ when clicked. The problem I'm having is display text on all the faces of this box, for example; 1 on the front, 2 on the top, 3 on the back, 4 on the bottom, 5 on the left and 6 on the right. I understand that StackPane can be used to overlay a text box on-top of the cube but I don't think that'd really help in this scenario. Since box is essentially a pre-constructed TriangleMesh, is this possible to do? As far as seen, box doesn't have any in-built functionality to do this. static double mousePosX; static double mousePosY;

How to get 2D coordinates on window for 3D object in javafx

我的未来我决定 提交于 2019-11-29 15:19:44
In javafx if we have 2D HUD (made of Pane and then out of it we create SubScene object for 2D Hud) and 3D SubScene and inside 3D scene we have some object with coordinates (x,y,z) - how can we get 2D coordinates in our HUD of the object if it is in visual field of our perspective camera? I tried to get first Scene coordinates of the object and then convert it (sceneToScreen) coordinates and the same for point (0,0) of Pane and then to subtract first point from second point but i don't get right result. Sorry because of my bad English.Can Someone help with this? There is a way to convert the 3D

JavaFX 3D Transparency

青春壹個敷衍的年華 提交于 2019-11-29 10:41:52
I'm looking for a way to render a transparent object in JavaFX 3D. So far, nothing. I found issue https://bugs.openjdk.java.net/browse/JDK-8090548 . Is there a workaround or is this just something I can't use? Will I need something besides JavaFX (like Java3D) if I need a transparent object? Since JDK8u60 b14 transparency is enabled in 3D shapes. This is a quick test done with it: A cylinder with diffuse color Color.web("#ffff0080") , is added on top of a box and two spheres. group.getChildren().addAll(sphere1, sphere2, box, cylinder); There's no depth sort algorithm though, meaning that order

JavaFx 2D part in 3D application

被刻印的时光 ゝ 提交于 2019-11-29 08:45:44
I have a small problem with an Application I write. I want to have to have a 3D field and on the right side a toolbar that contains 2D-Components like buttons. I tried to simply add these Components to my root-Group, but then it is impossible to read the text and they move with all the others. So, how can I seperate these two areas? Possibly with two scenes? Thank you for every hint you can give :) The best approach is using a SubScene for the 3D nodes. You can keep all the 2D content on top of it without rendering problems. You can read about the SubScene API here . This is a small sample of

Rotate a 3D object on 3 axis in JavaFX properly

风流意气都作罢 提交于 2019-11-28 08:47:27
So the method that I've used so far to rotate objects in JavaFX was that I layered it in 3 groups, each of them with a Rotate attached and locked to a single axis like so: Rotate heading, roll, pitch; Group normalrotate, rollrotate, verticalrotate; heading.setAxis(new Point3D(0,1,0)); normalrotate.getTransforms().add(heading); roll.setAxis(new Point3D(0,0,1)); rollrotate.getTransforms().add(roll); pitch.setAxis(new Point3D(1,0,0)); verticalrotate.getTransforms().add(pitch); and did a setAngle() for each time I needed to rotate the object. This worked very well for only heading and roll until i

JavaFX Moving 3D objects with mouse on a virtual plane

爱⌒轻易说出口 提交于 2019-11-28 07:03:41
As I was creating my first 3D game in JavaFX - where you would be able to assemble ships from parts using the mouse. This presents a problem since JAVAFX seems to have no native metods that work for converting PerspectiveCamera screen 2D coordinates into the scene's 3D space. Here is a representation of what I'm trying to acheive. A block moved by the mouse should move on an imaginary plane that is always rotated 90 in relation to the camera: I've tried to solve the problem with trigonometry without much success. I've not attached a code snippet as I'm looking for a more generic mathematical

JavaFX 3D Transparency

孤街醉人 提交于 2019-11-28 04:22:19
问题 I'm looking for a way to render a transparent object in JavaFX 3D. So far, nothing. I found issue https://bugs.openjdk.java.net/browse/JDK-8090548. Is there a workaround or is this just something I can't use? Will I need something besides JavaFX (like Java3D) if I need a transparent object? 回答1: Since JDK8u60 b14 transparency is enabled in 3D shapes. This is a quick test done with it: A cylinder with diffuse color Color.web("#ffff0080") , is added on top of a box and two spheres. group

JavaFx 2D part in 3D application

≯℡__Kan透↙ 提交于 2019-11-28 02:04:36
问题 I have a small problem with an Application I write. I want to have to have a 3D field and on the right side a toolbar that contains 2D-Components like buttons. I tried to simply add these Components to my root-Group, but then it is impossible to read the text and they move with all the others. So, how can I seperate these two areas? Possibly with two scenes? Thank you for every hint you can give :) 回答1: The best approach is using a SubScene for the 3D nodes. You can keep all the 2D content on

JavaFX 2D text with background in 3D scene

依然范特西╮ 提交于 2019-11-27 06:19:08
问题 For my project, I need 2D text inside a 3D scene (not as overlay!). So I've tried adding a BorderPane with Label / Text nodes to my scene: The problem is however, that the white background of the panel is at times overlapping with the label (they have the same depth apparently) when I zoom in, out or fly around with my camera. Is there a way to "elevate" the label from its panel? I've tried setting setDepthTest(true); with no effect. Here is a simple example showing the problem. The Xform