当前位置: 首页>>代码示例>>Java>>正文


Java ViewPort.getScenes方法代码示例

本文整理汇总了Java中com.jme3.renderer.ViewPort.getScenes方法的典型用法代码示例。如果您正苦于以下问题:Java ViewPort.getScenes方法的具体用法?Java ViewPort.getScenes怎么用?Java ViewPort.getScenes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.renderer.ViewPort的用法示例。


在下文中一共展示了ViewPort.getScenes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import com.jme3.renderer.ViewPort; //导入方法依赖的package包/类
private void load() {
    Application application = getApplication();
    AppStateManager stateManager = application.getStateManager();
    AssetManager assetManager = application.getAssetManager();
    ViewPort viewPort = application.getViewPort();
    Camera camera = application.getCamera();
    
    for (Spatial scene : viewPort.getScenes()) {
        if (scene instanceof Node) {
            ((Node) scene).attachChild(gameRoot);
            break;
        }
    }
    
    new Thread(() -> {
        try {
            progress = 25;
            progressBar.setText("Initializint camera...");
            CameraNode cameraNode = new CameraNode("camera", camera);
            progress = 30;
            progressBar.setText("Initializint skybox...");
            Spatial skyBox = assetManager.loadModel("Models/Skybox.j3o");
            skyBox.setLocalScale(camera.getFrustumFar());
            cameraNode.attachChild(skyBox);
            progress = 40;
            progressBar.setText("Initializint sunlight...");
            DirectionalLight sun = new DirectionalLight();
            sun.setDirection((new Vector3f(-0.5f, -0.5f, -0.5f)).normalizeLocal());
            sun.setColor(ColorRGBA.White);
            progress = 50;
            progressBar.setText("Initializint shadows...");
            DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer(assetManager, 1024, 2);
            dlsr.setLight(sun);
            progress = 70;
            progressBar.setText("Initializint Bullet...");
            BulletAppState bulletAppState = new BulletAppState();
            stateManager.attach(bulletAppState);
            progress = 99;
            progressBar.setText("Queueing Changes...");
            application.enqueue(() -> {
                gameRoot.attachChild(cameraNode);
                gameRoot.addLight(sun);
                viewPort.addProcessor(dlsr);
                progress = 100;
                return null;
            }).get();
            
        } catch (InterruptedException | ExecutionException ex) {
            Logger.getLogger(LoadingScreen.class.getName()).log(Level.SEVERE, null, ex);
        }
    }).start();
}
 
开发者ID:SkidRunner,项目名称:jME3-Examples,代码行数:53,代码来源:LoadingScreen.java


注:本文中的com.jme3.renderer.ViewPort.getScenes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。