javafx-3d

JavaFX 3D: Transforming Cylinder to defined start and end points

此生再无相见时 提交于 2019-12-12 01:45:35
问题 Suppose that I want a Cylinder to start in some 3D point and to end in some other 3D point. As far as I know, the way to do that, is to compute the Euclidian distance between the 2 points and to create a Cylinder with the same length. Then, the cylinder should be translated and rotated, such that it really starts at the start point and ends at the end point. I get messed up with these transformation and do not succeed to place the Cylinder in its correct place. Could you please share some

clipping of MeshView scalafx/javafx

折月煮酒 提交于 2019-12-11 11:14:30
问题 I have the following test code, where I try to clip a MeshView with a circle. I also tried putting the meshView into a group then clipping that, but this result in a black circle. Is there a way to clip a MeshView, preferably without putting it into a group? import scalafx.application.JFXApp import scalafx.application.JFXApp.PrimaryStage import scalafx.scene.image.Image import scalafx.scene.paint.{Color, PhongMaterial} import scalafx.scene.shape.{TriangleMesh, Circle, MeshView} import scalafx

Memory leaks when removing objects in JavaFX 3D

不羁的心 提交于 2019-12-11 03:23:50
问题 I have written an N-Body-simulation JavaFX-program which displays the simulated bodies as spheres. Unfortunately I'm struggling with memory leaks. I figured out that the memory allocated for the spheres is not freed when the spheres are deleted from their container even if NO references (at least from my code) to the spheres exist. It is easy to reproduce the behavior: The following code is essentially the JavaFX code generated automatically by Eclipse when a JavaFX project is created. I

javafx 3d performance large data set

六月ゝ 毕业季﹏ 提交于 2019-12-11 02:53:29
问题 I have a data set which compromises of the order of a million cuboids. I render it as a single node, using TriangleMesh. This seems OK, rotation is fast. But I also want to do slicing of it, so I implemented code to recalculate the faces and apply these. It works, but is a bit slow - not in calculating the faces indices, but it seems in the rendering. Each cuboid consists of 12 triangles I then tried it with having a separate node for each cuboid, and setting the nodes visible/invisible.

Place MeshVIew in Scene

旧巷老猫 提交于 2019-12-11 02:28:21
问题 I want to display a 3D figures on a MeshView in JavaFX. Since I want to build a simple model viewer I created tabs for clarity. One of them contains a group (meshGroup) where I add a SubScene (with the MeshView in a group) on runtime. I'm not able to place that model in the middle of the AnchorPane in full available size. ( I also tried Pane & HBox ). Image <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.*?> <?import javafx.scene.control.*?> <?import java.lang.*?> <?import javafx

javafx shape3d texturing: Don't strectch the image

落花浮王杯 提交于 2019-12-11 02:24:22
问题 I'm working now with javafx to build a maze and I want the walls to be textured with some seamless texture (that can be repeated). The maze is randomly generated so I don't know the size of any walls. I started by using a PhongMaterial with the desired texture, but it expand the image to fill the whole wall (a Box), so my texture is totally stretched. Is there any way to force the Material to replicate the texture as needed ? The code is like: Image img = new Image(new FileInputStream("img

JavaFX 2D shapes in 3D space

随声附和 提交于 2019-12-11 02:19:48
问题 I know that if I rotate an object, which extends javafx.scene.shape.Shape , I can transform it into 3D space, even though it was primarily designed to be in 2D (at least as far as I know). Let's say I have a 3D scene (perspective camera and depth buffer are used), where various MeshView s occur. Some are used for areas, others for lines. In both cases those shapes must be triangulated in order to draw them with a TriangleMesh , which is often nontrivial. Now when I change the drawing of these

applying texture to mesh in javafx

孤街浪徒 提交于 2019-12-10 22:51:31
问题 I was having trouble applying a texture to a mesh using JavaFX and FXyz 0.1.1. I found this question and even with the detailed answer there could not figure it out. I started over from scratch, copying the code from the answer exactly and the scene is black with no visible icosohedron. I'm using Java 8. The provided image is a gif and the code references it as a png. I've tried it with both png and gif versions of the file. As far as I can tell everything else is exactly as the code in the

JavafX 8 3D Z Order. Overlapping shape behaviour is wrong.

给你一囗甜甜゛ 提交于 2019-12-10 21:54:50
问题 I have a JavaFX 3D scene with a bunch of boxes and spheres added at random locations. It seems like the depth order is all wrong and I'm not sure why. I have tried to use myNode.setDepthTest(DepthTest.ENABLE) but that doesn't seem to help. I've attached an application which should demonstrate the problem. Any idea what I might be doing wrong here? Any help much appreciated. import javafx.application.Application; import javafx.application.ConditionalFeature; import javafx.application.Platform;

Drawing 3d surfaces in JavaFX

旧巷老猫 提交于 2019-12-10 18:49:51
问题 How to draw 3d graphs in JavaFX using a mathematical equation, basically 2 variable functions, for example: z=2xy and other 3D figures? Is there any way to do it in JavaFX or do I need another Java library for that. 回答1: As @Roland points out, JavaFX 3D API doesn't include other than the basic elements, like TriangleMesh, which you can use to create complex shapes, like 3D graphs. In fact, plotting 2D functions f=f(x,y) is be a very good use case for understanding how TriangleMesh works.