use of com.jme3.input.controls.ActionListener in project jmonkeyengine by jMonkeyEngine.
the class TestLineWidthRenderState method simpleInitApp.
@Override
public void simpleInitApp() {
setDisplayFps(false);
setDisplayStatView(false);
cam.setLocation(new Vector3f(5.5826545f, 3.6192513f, 8.016988f));
cam.setRotation(new Quaternion(-0.04787097f, 0.9463123f, -0.16569641f, -0.27339742f));
Box b = new Box(1, 1, 1);
Geometry geom = new Geometry("Box", b);
mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Blue);
mat.getAdditionalRenderState().setWireframe(true);
mat.getAdditionalRenderState().setLineWidth(2);
geom.setMaterial(mat);
rootNode.attachChild(geom);
inputManager.addListener(new ActionListener() {
@Override
public void onAction(String name, boolean isPressed, float tpf) {
if (name.equals("up") && isPressed) {
mat.getAdditionalRenderState().setLineWidth(mat.getAdditionalRenderState().getLineWidth() + 1);
}
if (name.equals("down") && isPressed) {
mat.getAdditionalRenderState().setLineWidth(Math.max(mat.getAdditionalRenderState().getLineWidth() - 1, 1));
}
}
}, "up", "down");
inputManager.addMapping("up", new KeyTrigger(KeyInput.KEY_U));
inputManager.addMapping("down", new KeyTrigger(KeyInput.KEY_J));
}
use of com.jme3.input.controls.ActionListener in project jmonkeyengine by jMonkeyEngine.
the class TerrainTest method setupKeys.
private void setupKeys() {
flyCam.setMoveSpeed(50);
inputManager.addMapping("wireframe", new KeyTrigger(KeyInput.KEY_T));
inputManager.addListener(actionListener, "wireframe");
inputManager.addMapping("triPlanar", new KeyTrigger(KeyInput.KEY_P));
inputManager.addListener(actionListener, "triPlanar");
}
use of com.jme3.input.controls.ActionListener in project jmonkeyengine by jMonkeyEngine.
the class TerrainTestAdvanced method setupKeys.
private void setupKeys() {
flyCam.setMoveSpeed(50);
inputManager.addMapping("wireframe", new KeyTrigger(KeyInput.KEY_T));
inputManager.addListener(actionListener, "wireframe");
inputManager.addMapping("triPlanar", new KeyTrigger(KeyInput.KEY_P));
inputManager.addListener(actionListener, "triPlanar");
inputManager.addMapping("WardIso", new KeyTrigger(KeyInput.KEY_9));
inputManager.addListener(actionListener, "WardIso");
inputManager.addMapping("DetachControl", new KeyTrigger(KeyInput.KEY_0));
inputManager.addListener(actionListener, "DetachControl");
}
use of com.jme3.input.controls.ActionListener in project jmonkeyengine by jMonkeyEngine.
the class TerrainTestAndroid method setupKeys.
private void setupKeys() {
flyCam.setMoveSpeed(50);
inputManager.addMapping("wireframe", new KeyTrigger(KeyInput.KEY_T));
inputManager.addListener(actionListener, "wireframe");
inputManager.addMapping("triPlanar", new KeyTrigger(KeyInput.KEY_P));
inputManager.addListener(actionListener, "triPlanar");
}
use of com.jme3.input.controls.ActionListener in project jmonkeyengine by jMonkeyEngine.
the class TestBatchNodeTower method simpleInitApp.
@Override
public void simpleInitApp() {
timer = new NanoTimer();
bulletAppState = new BulletAppState();
bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
// bulletAppState.setEnabled(false);
stateManager.attach(bulletAppState);
bullet = new Sphere(32, 32, 0.4f, true, false);
bullet.setTextureMode(TextureMode.Projected);
bulletCollisionShape = new SphereCollisionShape(0.4f);
brick = new Box(brickWidth, brickHeight, brickDepth);
brick.scaleTextureCoordinates(new Vector2f(1f, .5f));
//bulletAppState.getPhysicsSpace().enableDebug(assetManager);
initMaterial();
initTower();
initFloor();
initCrossHairs();
this.cam.setLocation(new Vector3f(0, 25f, 8f));
cam.lookAt(Vector3f.ZERO, new Vector3f(0, 1, 0));
cam.setFrustumFar(80);
inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
inputManager.addListener(actionListener, "shoot");
rootNode.setShadowMode(ShadowMode.Off);
batchNode.batch();
batchNode.setShadowMode(ShadowMode.CastAndReceive);
rootNode.attachChild(batchNode);
shadowRenderer = new DirectionalLightShadowFilter(assetManager, 1024, 2);
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
shadowRenderer.setLight(dl);
shadowRenderer.setLambda(0.55f);
shadowRenderer.setShadowIntensity(0.6f);
shadowRenderer.setShadowCompareMode(CompareMode.Hardware);
shadowRenderer.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
fpp.addFilter(shadowRenderer);
viewPort.addProcessor(fpp);
}
Aggregations