javaFX 2.x 中的环面 3d [英] Torus 3d in javaFX 2.x

查看:29
本文介绍了javaFX 2.x 中的环面 3d的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的舞台由拆分面板划分,我想在右侧窗格中创建一个 3D 圆环.第一:我不知道我可以创建什么圆环.第二:我不知道我可以在什么样的对象上创建这个环面.窗格足够吗?

I've Stage which is divided by Split Panel, and I wants on the right pane create a 3D torus. First: I don't know what can I create torus. Second: I don't know on what kind of obiect can I create this Torus. Pane enough?

请帮忙.

推荐答案

如果不进行大量自定义编码,您将无法使用 JavaFX 2.x 使用 Torus 创建嵌入式 3D 场景.但是,如果您使用 JavaFX 8 和第三方 3D 库 F(X)yz,这将变得容易:http://birdasaur.github.io/FXyz/

You won't be able to create an embedded 3D scene with a Torus using JavaFX 2.x without a lot of custom coding on your part. However this becomes easy if you use JavaFX 8 and the third party 3D library F(X)yz: http://birdasaur.github.io/FXyz/

F(X)yz 有一个圆环对象:

F(X)yz has a Torus object:

/src/org/fxyz/shapes/Torus.java

您可以通过提供的测试代码查看如何使用它:

You can see how to use it with the provided test code:

/src/org/fxyz/tests/TorusTest.java

您的部分问题是如何使用 Split Pane 将 3D 对象放置到您现有的 JavaFX 场景中.Split Pane 并不关心其内容是否为 3D,但您应该使用 SubScene 将 3D 内容嵌入到 3D 场景中.

Part of your question was how to place the 3D object into your existing JavaFX scene using the Split Pane. The Split Pane doesn't care if its content is 3D but you should use a SubScene to embed the 3D content into the 3D scene.

示例:

SubScene subScene = subScene = new SubScene(sceneRoot, sceneWidth, sceneHeight, true, SceneAntialiasing.BALANCED);
subScene.setFill(Color.STEELBLUE);
Camera 3DCamera = new PerspectiveCamera(true); 
3Dcamera.setNearClip(0.1);
3Dcamera.setFarClip(100000.0);
3Dcamera.setFieldOfView(35);
3Dcamera.setTranslateZ(cameraDistance);
subScene.setCamera(3Dcamera);
//Add the subscene to the SplitPane
mySplitPane.getChildren().add(subScene);

祝你好运.

这篇关于javaFX 2.x 中的环面 3d的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆