@Override public void run() { app.enqueue(new Callable<Void>() { @Override public Void call() throws Exception { listener.start(); return null; } }); store = generatePrefilteredEnvMap(sourceMap, targetMapSize, fixSeamsMethod, store); app.enqueue(new Callable<Void>() { @Override public Void call() throws Exception { listener.done(face); return null; } }); }
/** * Takes a snapshot of the surrounding scene. * * @param scene the scene to snapshot. * @param done a callback to call when the snapshot is done. */ public void snapshot(final Spatial scene, final JobProgressListener<TextureCubeMap> done) { getApplication().enqueue(new Callable<Void>() { @Override public Void call() throws Exception { SnapshotJob job = new SnapshotJob(done, scene); jobs.add(job); return null; } }); }
@Override public void run() { app.enqueue(new Callable<Void>() { @Override public Void call() throws Exception { listener.start(); return null; } }); try { Vector3f[] shCoeffs = EnvMapUtils.getSphericalHarmonicsCoefficents(sourceMap); EnvMapUtils.prepareShCoefs(shCoeffs); store.setShCoeffs(shCoeffs); } catch (Exception e) { e.printStackTrace(); } app.enqueue(new Callable<Void>() { @Override public Void call() throws Exception { listener.done(6); return null; } }); }
public void setScale(final Vector3D scaleFactor) { checkIfNotImmutable(); application.enqueue(new Callable<Object>() { public Object call() throws Exception { scale.setLocalScale((float) scaleFactor.getX(), (float) scaleFactor.getY(), (float) scaleFactor.getZ()); return null; } }); } });
public void setScale(final Vector3d scaleFactor) { checkIfNotImmutable(); application.enqueue(new Callable<Object>() { public Object call() throws Exception { scale.setLocalScale((float) scaleFactor.getX(), (float) scaleFactor.getY(), (float) scaleFactor.getZ()); return null; } }); } });
public void extrusionChanged(final BufferedImage newImage, final double thickness) { checkIfNotImmutable(); application.enqueue(new Callable<Object>() { public Object call() throws Exception { textHolder.detachAllChildren(); Geometry textGeometry = getExtrusionGeometry(newImage, thickness, graphics3dObjectAddExtrusion.getAppearance()); textHolder.attachChild(textGeometry); addAppearanceChangedListener(graphics3dObjectAddExtrusion, textGeometry); return null; } }); } });
public void appearanceChanged(final AppearanceDefinition newAppearance) { checkIfNotImmutable(); if (newAppearance != null) { application.enqueue(new Callable<Object>() { public Material call() throws Exception { setGeometryMaterialBasedOnAppearance(spatial, newAppearance); return null; } }); } } });
public Future<ImmutablePair<Long, Node>> enqueueRootNodeExtracter(final TimestampProvider timestampProvider) { return application.enqueue(new Callable<ImmutablePair<Long, Node>>() { public ImmutablePair<Long, Node> call() throws Exception { long time = System.nanoTime(); long timestamp = timestampProvider != null ? timestampProvider.getTimestamp() : 0; Node newRoot = rayCollisionAdapter.cloneRootNode(); if (DEBUG) { System.out.println("JMEMultiRayTracer: elapsed time in RenderThread has been " + (System.nanoTime() - time) * 1.0e-9 + " seconds."); } return new ImmutablePair<Long, Node>(timestamp, newRoot); } }); }
public void appearanceChanged(final AppearanceDefinition newAppearance) { checkIfNotImmutable(); if (newAppearance != null) { application.enqueue(new Callable<Object>() { public Material call() throws Exception { setGeometryMaterialBasedOnAppearance(spatial, newAppearance); return null; } }); } } });
public void extrusionChanged(final BufferedImage newImage, final double thickness) { checkIfNotImmutable(); application.enqueue(new Callable<Object>() { public Object call() throws Exception { textHolder.detachAllChildren(); Geometry textGeometry = getExtrusionGeometry(newImage, thickness, graphics3dObjectAddExtrusion.getAppearance()); textHolder.attachChild(textGeometry); addAppearanceChangedListener(graphics3dObjectAddExtrusion, textGeometry); return null; } }); } });
public Future<ImmutablePair<Long, Node>> enqueueRootNodeExtracter(final TimestampProvider timestampProvider) { return application.enqueue(new Callable<ImmutablePair<Long, Node>>() { public ImmutablePair<Long, Node> call() throws Exception { long time = System.nanoTime(); long timestamp = timestampProvider != null ? timestampProvider.getTimestamp() : 0; Node newRoot = rayCollisionAdapter.cloneRootNode(); if (DEBUG) { System.out.println("JMEMultiRayTracer: elapsed time in RenderThread has been " + (System.nanoTime() - time) * 1.0e-9 + " seconds."); } return new ImmutablePair<Long, Node>(timestamp, newRoot); } }); }
@Override public void run() { app.enqueue(new Callable<Void>() { @Override public Void call() throws Exception { listener.start(); return null; } }); store = generatePrefilteredEnvMap(sourceMap, targetMapSize, fixSeamsMethod, store); app.enqueue(new Callable<Void>() { @Override public Void call() throws Exception { listener.done(face); return null; } }); }
/** * Takes a snapshot of the surrounding scene. * * @param scene the scene to snapshot. * @param done a callback to call when the snapshot is done. */ public void snapshot(final Spatial scene, final JobProgressListener<TextureCubeMap> done) { getApplication().enqueue(new Callable<Void>() { @Override public Void call() throws Exception { SnapshotJob job = new SnapshotJob(done, scene); jobs.add(job); return null; } }); }
private void updateListerners() { stateManager.getApplication().enqueue(() -> { for (Map.Entry<Type, Label> entry : listeners.entrySet()) { String text = ""; Label label = entry.getValue(); switch (entry.getKey()) { case CURRENT: text = String.format("%s", manaCurrent); break; case GAIN: text = String.format("%s", manaGain); break; case LOSE: text = String.format("- %s", manaLose); break; } label.setText(text); } return null; }); }
@Override public void onMapChanged(String mapName) { if (lobbyState.isRenderThread()) { listener.onMapChanged(mapName); } else { lobbyState.app.enqueue(() -> { listener.onMapChanged(mapName); }); } } }
@Override public void setTypeAvailable(Room type, boolean available) { // Skip non-buildables, I don't know what purpose they serve if (!type.getFlags().contains(Room.RoomFlag.BUILDABLE)) { return; } super.setTypeAvailable(type, available); // Notify listeners if (roomAvailabilityListeners != null) { application.enqueue(() -> { for (IRoomAvailabilityListener listener : roomAvailabilityListeners) { listener.onChange(); } }); } }
@Override public void onStateChange(CreatureControl creature, CreatureState newState, CreatureState oldState) { if (isImp(creature)) { updateWorkerListeners(); } else { if (creatureListeners != null) { application.enqueue(() -> { for (CreatureListener listener : creatureListeners) { listener.onStateChange(creature, newState, oldState); } }); } } }
@Override public void onPlayerListChanged(List<ClientInfo> players) { if (lobbyState.isRenderThread()) { listener.onPlayerListChanged(players); } else { lobbyState.app.enqueue(() -> { listener.onPlayerListChanged(players); }); } // Start game if we are all ready for (ClientInfo clientInfo : players) { if (!clientInfo.isReady()) { return; } } lobbyState.startGame(players); }
private void startGame(List<ClientInfo> players) { // TODO: I don't really know how, but at least now to allow the skirmish to work GameState gameState = new GameState(mapSelector.getMap().getMap(), players.stream().map(ClientInfo::getKeeper).collect(toList())); if (isRenderThread()) { stateManager.getState(MainMenuState.class).setEnabled(false); } else { app.enqueue(() -> { stateManager.getState(MainMenuState.class).setEnabled(false); }); } stateManager.getState(MainMenuState.class).setEnabled(false); stateManager.attach(gameState); stateManager.detach(this); }
private void dropPortalGem() { if (hasPortalGem) { Point p = getCreatureCoordinates(); worldState.getGameState().getApplication().enqueue(() -> { worldState.getThingLoader().addObject(p, worldState.getLevelData().getLevelGem().getObjectId(), ownerId); }); } }