Search in sources :

Example 26 with Application

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);
    }
}
Also used : Geometry(com.jme3.scene.Geometry) KeyTrigger(com.jme3.input.controls.KeyTrigger) Mesh(com.jme3.scene.Mesh) Material(com.jme3.material.Material) InputManager(com.jme3.input.InputManager)

Example 27 with Application

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);
}
Also used : InputManager(com.jme3.input.InputManager)

Example 28 with Application

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();
}
Also used : Node(com.jme3.scene.Node) CameraNode(com.jme3.scene.CameraNode)

Example 29 with Application

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);
    }
}
Also used : KeyTrigger(com.jme3.input.controls.KeyTrigger)

Example 30 with Application

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);
}
Also used : Node(com.jme3.scene.Node)

Aggregations

AppSettings (com.jme3.system.AppSettings)11 Material (com.jme3.material.Material)10 Vector2f (com.jme3.math.Vector2f)8 ViewPort (com.jme3.renderer.ViewPort)8 Geometry (com.jme3.scene.Geometry)8 Camera (com.jme3.renderer.Camera)6 Spatial (com.jme3.scene.Spatial)6 Texture2D (com.jme3.texture.Texture2D)6 Node (com.jme3.scene.Node)5 FrameBuffer (com.jme3.texture.FrameBuffer)5 KeyTrigger (com.jme3.input.controls.KeyTrigger)4 InputManager (com.jme3.input.InputManager)3 OSVR (com.jme3.input.vr.OSVR)3 VRAPI (com.jme3.input.vr.VRAPI)3 Application (ca.uhn.hl7v2.app.Application)2 BitmapText (com.jme3.font.BitmapText)2 MouseInput (com.jme3.input.MouseInput)2 ActionListener (com.jme3.input.controls.ActionListener)2 MouseButtonTrigger (com.jme3.input.controls.MouseButtonTrigger)2 Vector3f (com.jme3.math.Vector3f)2