當前位置: 首頁>>代碼示例>>Java>>正文


Java Application.getCamera方法代碼示例

本文整理匯總了Java中com.jme3.app.Application.getCamera方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.getCamera方法的具體用法?Java Application.getCamera怎麽用?Java Application.getCamera使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.jme3.app.Application的用法示例。


在下文中一共展示了Application.getCamera方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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();
}
 
開發者ID:SkidRunner,項目名稱:jME3-Examples,代碼行數:53,代碼來源:LoadingScreen.java

示例2: init

import com.jme3.app.Application; //導入方法依賴的package包/類
@Override
public void init(Application app) {
    camControl = new CameraControl(app.getCamera());
}
 
開發者ID:dwhuang,項目名稱:SMILE,代碼行數:5,代碼來源:CamNavWindowController.java


注:本文中的com.jme3.app.Application.getCamera方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。