如何在 JavaFX 中将 GUI 覆盖在 3D 场景上?
How to overlay GUI over 3D scene in JavaFX?
我在 JavaFX 中有一个 3D 场景,需要在 3D 场景上覆盖 GUI。我曾尝试将按钮和文本添加到场景中,但它们始终作为 3D 对象出现在 3d 视图中。我环顾四周,还没有找到如何去做。唯一的解决方法是创建一个全新的 window 并将设置放在那里,但在这种情况下这不是一个选项。感谢您的帮助!!
像这样
或这个
您正在寻找的最佳解决方案是 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 项目,你会发现它就像你发布的图片:
您可以在此 question.
中找到有关如何将子场景添加到常规场景的小示例
我在 JavaFX 中有一个 3D 场景,需要在 3D 场景上覆盖 GUI。我曾尝试将按钮和文本添加到场景中,但它们始终作为 3D 对象出现在 3d 视图中。我环顾四周,还没有找到如何去做。唯一的解决方法是创建一个全新的 window 并将设置放在那里,但在这种情况下这不是一个选项。感谢您的帮助!!
像这样
您正在寻找的最佳解决方案是 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 项目,你会发现它就像你发布的图片:
您可以在此 question.
中找到有关如何将子场景添加到常规场景的小示例