javafx-3d

JavaFX 8 3D scene intersection point

允我心安 提交于 2019-12-05 03:21:28
Is it possible in a JavaFX 8 3D scene to find points along a ray (e.g. PickRay), starting at an arbitrary point in 3D space with some 3D direction vector, where the ray intersects the triangles in a mesh (TriangleMesh inside a MeshView)? I know this is done in the Camera/MouseHandler for mouse picking but I can't see any way for doing it for arbitrary rays. As @jdub1581 suggests, a ray is just a geometric vector, so in order to find a list of triangles intersected by this vector we need to solve problems of the kind 'line intersects plane' and 'line intersects plane within the triangle borders

customizing javafx 3d box or rotating stackpane

北城余情 提交于 2019-12-04 17:34:54
My goal is a game played with dice. I am using javafx. First question: Is there an easy way to customize the 3d box in javafx. It doesn't matter to me, if I have to add an image to every side of the die or if I use just one image which wraps around the box. (After lots of research I didn't find anything about it.) In the code below I created a stackpane, which is a 3d cube. It is build from 6 Rectangles, each of the is filled with one side of a die (1 to 6). If I rotate the stackpane by 180 degrees, the Rectangle which should be in the foreground is in the background and the one which was

Showing texts over the face of a Box based on the visible area on zooming in/out

谁都会走 提交于 2019-12-04 14:23:07
I have a sample 3D application (built by taking reference from the Javafx sample 3DViewer) which has a table created by laying out Boxes and Panes: The table is centered wrt (0,0,0) coordinates and camera is at -z position initially. It has the zoom-in/out based on the camera z position from the object. On zooming in/out the object's boundsInParent increases/decreases i.e. area of the face increases/decreases. So the idea is to put more text when we have more area (always confining within the face) and lesser text or no text when the face area is too less. I am able to to do that using this

How to overlay GUI over 3D scene in JavaFX?

拥有回忆 提交于 2019-12-04 14:13:15
I have a 3D scene in JavaFX and need to overlay GUI over the 3D scene. I have tried adding buttons and text to the scene but they always appear in the 3d view as 3D objects. I have looked around and haven't found how to do it. The only workaround would be creating a whole new window and putting the settings there but that isn't an option in this case. Thanks for the help!! Something like this Or this José Pereda The best solution for what you are looking for is the SubScene , a built-in JavaFX container : The SubScene class is the container for content in a scene graph. SubScene provides

Restricting a 3D object mouse drag movement to a plane in JavaFX

谁说我不能喝 提交于 2019-12-04 06:59:01
I'm using JavaFX to move 3D cubes around by mouse drag. The cube should stay on the plane spanned by x and z axis. My solution works fairly well, however if I move the cube too fast with my mouse or when it encounters an object with a certain depth (y-Axis), it is assumed, that the mouse is moving on the y-Axis and the cube starts jumping forward or backwards. Is there a way to restrict the mouse to the xz-plane? A more complicated solution would be projecting the y length back to the xz-plane, but I got no clue how. I looked at JavaFX Moving 3D Objects , but couldn't adapt it to my case. My

How to create a Video Wall like in the JavaFX 2.0 demo?

白昼怎懂夜的黑 提交于 2019-12-03 20:42:13
How do you create a video wall like in the JavaFX 2.0 demo here: https://www.youtube.com/watch?v=UXSmJYFrulY#t=411 For a start it doesn't have to be videos, it can be images as well. All I'd like to have is to place the nodes like they are in the video, i. e. in a curved shape like the insides of a cylinder or a sphere. Or is the source of that demo available somewhere? Thank you very much. I researched and found a very awesome site with the relevant information: http://paulbourke.net/geometry/transformationprojection/ The relevant part was the Coordinate System Transformation, in particular

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

天涯浪子 提交于 2019-12-03 18:10:15
问题 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

Javafx Quadrilateral Mesh

时光总嘲笑我的痴心妄想 提交于 2019-12-02 05:24:55
问题 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. 回答1: 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

How to fill a JavaFX Sphere with two Colors

吃可爱长大的小学妹 提交于 2019-12-02 04:28:34
问题 How can I fill in JavaFX a 3D Sphere with a linear gradient like a 2d Circle? I work with the JavaFX Scene Builder. 回答1: As @mohsenmadi has pointed out, the diffuse color doesn't allow you using other than one single color. But you can have different colors on the sphere by using an image as a diffuse map. Based on your first image, I've created this texture image (called diffuse.jpg , and placed under the same folder as the JavaFX class): You can create now your bicolored sphere: @Override

How to fill a JavaFX Sphere with two Colors

亡梦爱人 提交于 2019-12-02 02:42:54
How can I fill in JavaFX a 3D Sphere with a linear gradient like a 2d Circle? I work with the JavaFX Scene Builder. As @mohsenmadi has pointed out, the diffuse color doesn't allow you using other than one single color. But you can have different colors on the sphere by using an image as a diffuse map. Based on your first image, I've created this texture image (called diffuse.jpg , and placed under the same folder as the JavaFX class): You can create now your bicolored sphere: @Override public void start(Stage primaryStage) throws Exception { // 3D Sphere sphere = new Sphere(5); PhongMaterial