编程语言
首页 > 编程语言> > 如何在JavaFX中将GUI叠加在3D场景上?

如何在JavaFX中将GUI叠加在3D场景上?

作者:互联网

我在JavaFX中有一个3D场景,需要在3D场景上叠加GUI.我尝试将按钮和文本添加到场景中,但它们总是作为3D对象出现在3d视图中.我环顾四周,还没找到怎么做.唯一的解决方法是创建一个全新的窗口并将设置放在那里,但在这种情况下这不是一个选项.谢谢您的帮助!!

像这样的东西
enter image description here
或这个
enter image description here

解决方法:

您正在寻找的最佳解决方案是SubScene,内置JavaFX container

The SubScene class is the container for content in a scene graph. SubScene provides separation of different parts of a scene, each of which can be rendered with a different camera, depth buffer, or scene anti-aliasing. A SubScene is embedded into the main scene or another sub-scene.

如果您看一下3DViewer项目,您会发现它就像您发布的图片:

3DViewer

您可以在此question中找到有关如何将subScene添加到常规场景的小样本.

标签:3d,java,javafx,javafx-3d
来源: https://codeday.me/bug/20190829/1757405.html