本文整理匯總了Java中com.jme3.app.Application.getViewPort方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.getViewPort方法的具體用法?Java Application.getViewPort怎麽用?Java Application.getViewPort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.jme3.app.Application
的用法示例。
在下文中一共展示了Application.getViewPort方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: load
import com.jme3.app.Application; //導入方法依賴的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();
}