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

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

问题描述

我得到了以下游戏窗口:http://www.directupload.net/file/d/3598/b48lqpur_png.htm(抱歉不能在这里发图片)

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(但我的控制台输出说明了所有创建棋盘的步骤正确完成)
  • 第三个:我看到一个没有任何透视的黑盒子.
  • 最后一个:我只看到了国际象棋领域的框架

我的源代码是:

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.

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

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

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

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.

希望这有帮助!

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

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