public Void call() throws Exception { Spatial spatial = serverApp.getAssetManager().loadModel(finalModel); serverApp.getRootNode().attachChild(spatial); return null; } });
public Void call(){ if (app instanceof SimpleApplication){ SimpleApplication simpleApp = (SimpleApplication) app; simpleApp.getFlyByCamera().setDragToRotate(true); simpleApp.getInputManager().setCursorVisible(true); } return null; } });
@Override protected void onEnable() { getApplication().setAppProfiler(prof); ((SimpleApplication) getApplication()).getGuiNode().attachChild(ui); }
@Override public void cleanup() { super.cleanup(); //detach everything when we are detached application.getRootNode().detachChild(rootNode); application.getStateManager().detach(physicsState); cleanupData(); }
@Override public void init(SimpleApplication app) { SpatialFactory.init(app.getAssetManager(), app.getRootNode()); AppStateManager stateManager = app.getStateManager(); app.getFlyByCamera().setMoveSpeed(10f); app.getCamera().setLocation(new Vector3f(0.2599395f, 2.7232018f, 3.373138f)); app.getCamera().setRotation(new Quaternion(-0.0035931943f, 0.9672268f, -0.25351822f, -0.013704466f)); app.getStateManager().attach(worldAppState); worldAppState.setCalendar(2013, 1, 1, 12, 0, 0); app.getStateManager().attach(houseAppState);
app.getFlyByCamera().setMoveSpeed(10f); app.getFlyByCamera().setDragToRotate(true); app.getCamera().setFrustumPerspective(45f, (float) app.getCamera().getWidth() / app.getCamera().getHeight(), 0.1f, 1000f); app.getCamera().setLocation(new Vector3f(6.2354145f, 18.598438f, 4.6557f)); app.getCamera().setRotation(new Quaternion(0.5041053f, -0.49580166f, 0.5068195f, 0.4931456f)); app.getGuiNode().addControl(screen); guimainMenu = new GUIMainMenuAppState(screen); guimainMenu.setDisplayFps(displayFps); guimainMenu.setStatView(statView); app.getStateManager().attach(guimainMenu); CameraControl cc = new CameraControl(app.getCamera(), CameraControl.ControlDirection.CameraToSpatial); camFollower.addControl(cc); app.getRootNode().attachChild(camFollower); audioConfig.getAudioAppState().setPCSpeakerTo(camFollower); app.getStateManager().attach(audioConfig.getAudioAppState()); app.getStateManager().attach(worldConfig.getWorldAppState()); app.getStateManager().attach(houseConfig.getHousedAppState()); app.getStateManager().attach(bodyConfig.getBodiesAppState()); app.getStateManager().attach(deviceConfig.getDevicesAppState());
@Override public void init(SimpleApplication app) { AppStateManager stateManager = app.getStateManager(); app.getFlyByCamera().setMoveSpeed(10f); camera = app.getCamera(); camera.setFrustumPerspective(45f, (float) camera.getWidth() / camera.getHeight(), 0.1f, 1000f); app.getCamera().setLocation(new Vector3f(4.497525f, 6.3693237f, 4.173162f)); app.getCamera().setRotation(new Quaternion(0.5199084f, 0.42191547f, -0.32954147f, 0.6656463f)); seAPI.getHouseAppState().runCommand(new CreateHouseCommand("House1", HouseFactory.HouseType.House3room2bath)); BulletAppState bulletAppState = app.getStateManager().getState(BulletAppState.class); SmartPhoneFactory.init(bulletAppState, app.getAssetManager(), app.getRenderManager(), app.getCamera(), app.getAudioRenderer());
@Override @Deprecated public Node getRootNode() { // should be using zUpNode now so that there is no axis flip flopping going on. return super.getRootNode(); }
/** Reads the colors of first column of an image and creates a gradient texture.*/ public static void testMain(SimpleApplication scene) { String shape = "shapes/public domain/tribal_star.png"; float height = 0.05f; //Apply image effects. BufferedImage shapeImage = ImageUtilities.loadImage(shape, scene.getAssetManager()); shapeImage = ImageUtilities.symmetrifyX(shapeImage, true, false); //Get shape. com.jme3.scene.Geometry g = createShape(shapeImage, height); g.setMaterial(Utilities.getUnshadedMaterial(scene.getAssetManager().loadTexture("Textures/CobbleStone.png"), null, BlendMode.Off, scene.getAssetManager())); g.scale(10f); g.rotate(FastMath.HALF_PI*3, 0, 0); scene.getRootNode().attachChild(g); scene.getViewPort().setBackgroundColor(new ColorRGBA(0.7f, 0.8f, 1f, 1f)); }
@Override public void initialize(AppStateManager stateManager, Application application) { System.out.println("Inititalize " + getClass().getSimpleName()); super.initialize(stateManager, application); this.app = (SimpleApplication) application; this.assetManager = application.getAssetManager(); worldAppState = app.getStateManager().getState(WorldAppState.class); houseAppState = app.getStateManager().getState(HouseAppState.class); bulletAppState = app.getStateManager().getState(BulletAppState.class); SmartPhoneFactory.init(bulletAppState, assetManager, app.getRenderManager(), app.getCamera(), app.getAudioRenderer()); }
@Override public void simpleUpdate(float tpf) { super.simpleUpdate(tpf); // teaGeom.move(new Vector3f(0.001f, 0, 0)); // pivot.rotate(0, 0.00001f, 0); // rootNode.updateGeometricState(); } // public void update() {
public JMEStereoSpriteGenerator(SimpleApplication jmeRenderer, ColorRGBA colorRGBA) { super("JMELidarFINALVisualizer"); this.jmeRenderer = jmeRenderer; pointCloudGenerator = new JMEPointCloudGenerator(jmeRenderer.getAssetManager()); defaultColor = colorRGBA; }
private void checkActiveChild(Vector3f vector3f) { AppStateManager stateManager = application.getStateManager(); if(vector3f == null){ if(currentActiveChild != null){ logger.log(Level.INFO, "Detach child {0}", currentActiveChild); stateManager.detach(currentActiveChild); currentActiveChild = null; } return; } if (currentActiveChild == null) { currentActiveChild = new InceptionLevel(this, vector3f); stateManager.attach(currentActiveChild); logger.log(Level.INFO, "Attach child {0}", currentActiveChild); } else if (!currentActiveChild.getPositionInParent().equals(vector3f)) { logger.log(Level.INFO, "Switching from child {0}", currentActiveChild); stateManager.detach(currentActiveChild); currentActiveChild = new InceptionLevel(this, vector3f); stateManager.attach(currentActiveChild); logger.log(Level.INFO, "Attach child {0}", currentActiveChild); } }
public void initScoreBoard() { SimpleApplication app = getApp(); // Should be from registry, not this way AppSettings settings = app.getContext().getSettings(); // Should be from registry, not this way int numScoreRows = 4; int rowHeight = 50; int boardWidth = settings.getWidth(); int baseX = 20; int baseY = settings.getHeight() - numScoreRows * rowHeight; float textSizeMult = 0.5f; ScoreBoard sb = new ScoreBoard(app.getAssetManager(), app.getGuiNode(), baseX, baseY, boardWidth, rowHeight, numScoreRows, textSizeMult); setScoreBoard(sb); // Goofy way to do it }
@Override public void init(SimpleApplication app) { AppStateManager stateManager = app.getStateManager(); app.getFlyByCamera().setMoveSpeed(10f); app.getCamera().setLocation(new Vector3f(4.497525f, 6.3693237f, 4.173162f)); app.getCamera().setRotation(new Quaternion(0.5199084f, 0.42191547f, -0.32954147f, 0.6656463f)); BulletAppState bulletAppState = new BulletAppState(); stateManager.attach(bulletAppState); //bulletAppState.setDebugEnabled(true); seAPI = SpatialEnvironmentAPI.createSpatialEnvironmentAPI(app); seAPI.getWorldAppState().setCalendar(2013, 1, 1, 12, 0, 0); seAPI.getWorldAppState().setLandType(WorldAppState.LandType.Basic); seAPI.getHouseAppState().runCommand(new CreateHouseCommand("House1", HouseFactory.HouseType.House3room2bath)); devicesAppState = new DevicesAppState(); stateManager.attach(devicesAppState); devicesAppState.runCommand(new CreateSmartphoneCommand("Smartphone1")); devicesAppState.runCommand(new SetDeviceOnFurnitureCommand("Smartphone1", "House1", "Table1")); } }
@Override public void update() { if (prof!=null) prof.appStep(AppStep.BeginFrame); super.update(); // makes sure to execute AppTasks if (speed == 0 || paused) { return; } float tpf = timer.getTimePerFrame() * speed; // update states if (prof!=null) prof.appStep(AppStep.StateManagerUpdate); stateManager.update(tpf); // simple update and root node simpleUpdate(tpf); if (prof!=null) prof.appStep(AppStep.SpatialUpdate); rootNode.updateLogicalState(tpf); guiNode.updateLogicalState(tpf); rootNode.updateGeometricState(); guiNode.updateGeometricState(); // render states if (prof!=null) prof.appStep(AppStep.StateManagerRender); stateManager.render(renderManager); if (prof!=null) prof.appStep(AppStep.RenderFrame); renderManager.render(tpf, context.isRenderable()); simpleRender(renderManager); stateManager.postRender(); if (prof!=null) prof.appStep(AppStep.EndFrame); }
@Override public void initialize(AppStateManager stateManager, Application application) { System.out.println("Inititalize " + getClass().getSimpleName()); super.initialize(stateManager, application); this.app = (SimpleApplication) application; this.assetManager = application.getAssetManager(); this.rootNode = app.getRootNode(); this.audioRenderer = app.getAudioRenderer(); this.listener = app.getListener(); PHATUtils.checkAndCreatePath("./assets/Sounds/"); assetManager.registerLocator("assets", FileLocator.class); AudioFactory.init(audioRenderer, assetManager, rootNode); }
public Void call(){ if (app instanceof SimpleApplication){ SimpleApplication simpleApp = (SimpleApplication) app; simpleApp.getFlyByCamera().setDragToRotate(true); } return null; } });
@Override public void start() { // set some default settings in-case // settings dialog is not shown boolean loadSettings = false; if (settings == null) { setSettings(new AppSettings(true)); loadSettings = true; } // show settings dialog if (showSettings) { if (!JmeSystem.showSettingsDialog(settings, loadSettings)) { return; } } //re-setting settings they can have been merged from the registry. setSettings(settings); super.start(); }
@Override public void init(SimpleApplication app) { SpatialFactory.init(app.getAssetManager(), app.getRootNode()); AppStateManager stateManager = app.getStateManager(); app.getFlyByCamera().setMoveSpeed(10f); app.getCamera().setLocation(new Vector3f(4.034334f, 3.8802402f, 6.621415f)); app.getCamera().setRotation(new Quaternion(-7.4161455E-4f, 0.97616464f, -0.21700443f, -0.0033340578f)); app.getFlyByCamera().setDragToRotate(true); app.getStateManager().attach(worldAppState); worldAppState.setCalendar(2013, 1, 1, 12, 0, 0); worldAppState.setLandType(WorldAppState.LandType.Basic); app.getStateManager().attach(devicesAppState); devicesAppState.runCommand(new CreateSmartphoneCommand("Smartphone1").setAttachCoordinateAxes(true)); devicesAppState.runCommand(new SetDeviceOnPartOfBodyCommand(