本文整理汇总了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();
}