use of com.jme3.app.Application in project jmonkeyengine by jMonkeyEngine.
the class BasicProfilerState method initialize.
@Override
protected void initialize(Application app) {
graph = new Geometry("profiler", profiler.getMesh());
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setBoolean("VertexColor", true);
graph.setMaterial(mat);
graph.setLocalTranslation(0, 300, 0);
graph.setLocalScale(1, scale, 1);
Mesh mesh = new Mesh();
background = new Geometry("profiler.background", mesh);
mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setBoolean("VertexColor", true);
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
background.setMaterial(mat);
background.setLocalTranslation(0, 300, -1);
background.setLocalScale(1, scale, 1);
refreshBackground();
InputManager inputManager = app.getInputManager();
if (inputManager != null) {
inputManager.addMapping(INPUT_MAPPING_PROFILER_TOGGLE, new KeyTrigger(KeyInput.KEY_F6));
inputManager.addListener(keyListener, INPUT_MAPPING_PROFILER_TOGGLE);
}
}
use of com.jme3.app.Application in project jmonkeyengine by jMonkeyEngine.
the class BasicProfilerState method cleanup.
@Override
protected void cleanup(Application app) {
InputManager inputManager = app.getInputManager();
if (inputManager.hasMapping(INPUT_MAPPING_PROFILER_TOGGLE)) {
inputManager.deleteMapping(INPUT_MAPPING_PROFILER_TOGGLE);
}
inputManager.removeListener(keyListener);
}
use of com.jme3.app.Application in project jmonkeyengine by jMonkeyEngine.
the class ChaseCameraAppState method initialize.
@Override
public void initialize(AppStateManager stateManager, Application app) {
super.initialize(stateManager, app);
this.inputManager = app.getInputManager();
target = new Node("ChaseCamTarget");
camNode.setCamera(app.getCamera());
camNode.setControlDir(CameraControl.ControlDirection.SpatialToCamera);
target.attachChild(camNode);
camNode.setLocalTranslation(0, 0, distance);
upVector = app.getCamera().getUp().clone();
leftVector = app.getCamera().getLeft().clone();
registerWithInput();
rotateCamera();
}
use of com.jme3.app.Application in project jmonkeyengine by jMonkeyEngine.
the class DebugKeysAppState method initialize.
@Override
public void initialize(AppStateManager stateManager, Application app) {
super.initialize(stateManager, app);
this.app = app;
this.inputManager = app.getInputManager();
if (app.getInputManager() != null) {
inputManager.addMapping(INPUT_MAPPING_CAMERA_POS, new KeyTrigger(KeyInput.KEY_C));
inputManager.addMapping(INPUT_MAPPING_MEMORY, new KeyTrigger(KeyInput.KEY_M));
inputManager.addListener(keyListener, INPUT_MAPPING_CAMERA_POS, INPUT_MAPPING_MEMORY);
}
}
use of com.jme3.app.Application in project jmonkeyengine by jMonkeyEngine.
the class RootNodeAppState method initialize.
@Override
public void initialize(AppStateManager stateManager, Application app) {
if (rootNode == null) {
rootNode = new Node("Root Node");
}
if (viewPort == null) {
viewPort = app.getViewPort();
}
viewPort.attachScene(rootNode);
super.initialize(stateManager, app);
}
Aggregations