JavaFX 3D国际象棋场上的单独透视图 [英] JavaFX Separate Perspective View on a 3D Chess Field

查看:107
本文介绍了JavaFX 3D国际象棋场上的单独透视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了以下游戏窗口: http://www.directupload.net/file/d/3598/b48lqpur_png. htm (抱歉,无法在此处发布img)

I got following game-window: http://www.directupload.net/file/d/3598/b48lqpur_png.htm (Sorry cant post img here)

红色框是VBox(或其他容器,我尚无法确定). 我想设置3D透视Chessfield而不是星星. 但是,如果我将框架(如Java-Tutorial MoleculeSampleApp)加载到容器中,则会得到4个结果:

The red Box is a VBox (or an other Container, i cant decide yet). And i wanna set a 3D perspective Chessfield instead of the star. But if i load the Framework (like the Java-Tutorial MoleculeSampleApp) in to the Container, i get 4 results:

  • 第一个:我看到了3D国际象棋界,但都在我的容器外面 与Chessfield一起旋转.
  • 第二个:我看不到国际象棋场(但是我的控制台输出说明了所有 正确创建国际象棋场的步骤)
  • 第三个:我看到一个没有任何透视图的黑匣子.
  • 最后一个:我只看到Chessfield的框架
  • The first: i see the 3D chessfield but all outside my Container rotates with the Chessfield.
  • The second: i see no chessfield (but my console-outputs says all steps of creating chessfield are correctly done)
  • The third: i see one black Box without any perspective.
  • The last: i only see the Framework of the Chessfield

我的代码是:

Stage stage = new Stage();
        stage.setScene(
                createScene(loadPane(ContentManager.DEFAULT_SCREEN_FXML, ContentManager.GAME_SCREEN_FXML))
        );
        FieldLayerController flc = new FieldLayerController();
        flc.setFieldSize(6);
        flc.buildField();
        flc.buildScene();
        flc.buildCamera();
        Scene scene = new Scene(flc.root, 1024, 768, true);
        flc.handleKeyboard(scene, (Node)flc.world);
        flc.handleMouse(scene, (Node)flc.world);
        Node node = stage.getScene().lookup("#game_box");
        ((VBox)node).getChildren().add(flc.root);
    stage.show();

此代码产生您在图片上看到的窗口.

This Code produce the Window you see on the picture.

是否可以仅在一个容器中获得透视图?

Is it possible to get a perspective view only in one Container?

我希望我能描述我的问题是可以理解的. (例如 JavaFX 3D-如何为具有3D对象的组和具有UI控件的SubScene设置不同的摄像机?)

I hope I could describe my problem understandable. (like JavaFX 3D - How to set different cameras for Group with 3D object and SubScene with UI Controls?)

推荐答案

查看我们的项目.. F(X) yz 这是一个JavaFX 3D库.有一个CameraView类和一个Cutaway类(CameraView包裹在可拖动框架中),可以在您需要的时候使用.克隆项目并运行CameraViewTest.主场景和cameraView都具有用于移动的鼠标处理程序,因此可以在其中玩耍..另一个示例在BillboardBehaviorTest类中.

Check out our project .. F(X)yz it's a JavaFX 3D library.. There is a CameraView class and a Cutaway class (CameraView wrapped in a dragable frame) that may do as you are looking for. Clone the project and run the CameraViewTest. Both the main scene, and cameraView have mouse handlers for movement so play around.. Another example of it is in the BillboardBehaviorTest class.

希望这会有所帮助!

这篇关于JavaFX 3D国际象棋场上的单独透视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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