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

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

问题描述

我的舞台被分割面板分割,我希望在右侧窗格中创建一个3D圆环。
第一:我不知道我能创造什么东西。
第二:我不知道我可以用什么样的对象创建这个Torus。 Pane够吗?

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有一个Torus对象:

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

您的部分问题是如何使用拆分窗格将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天全站免登陆