Search in sources :

Example 21 with Picture

use of com.jme3.ui.Picture in project jmonkeyengine by jMonkeyEngine.

the class TestOnlineJar method simpleInitApp.

@Override
public void simpleInitApp() {
    // create a simple plane/quad
    Quad quadMesh = new Quad(1, 1);
    quadMesh.updateGeometry(1, 1, true);
    Geometry quad = new Geometry("Textured Quad", quadMesh);
    assetManager.registerLocator("https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/jmonkeyengine/town.zip", HttpZipLocator.class);
    assetManager.registerLocator("https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/jmonkeyengine/wildhouse.zip", HttpZipLocator.class);
    Picture pic1 = new Picture("Picture1");
    pic1.move(0, 0, -1);
    pic1.setPosition(0, 0);
    pic1.setWidth(128);
    pic1.setHeight(128);
    pic1.setImage(assetManager, "grass.jpg", false);
    guiNode.attachChild(pic1);
    Picture pic2 = new Picture("Picture1");
    pic2.move(0, 0, -1);
    pic2.setPosition(128, 0);
    pic2.setWidth(128);
    pic2.setHeight(128);
    pic2.setImage(assetManager, "glasstile2.png", false);
    guiNode.attachChild(pic2);
}
Also used : Geometry(com.jme3.scene.Geometry) Quad(com.jme3.scene.shape.Quad) Picture(com.jme3.ui.Picture)

Example 22 with Picture

use of com.jme3.ui.Picture in project jmonkeyengine by jMonkeyEngine.

the class TestZOrder method simpleInitApp.

public void simpleInitApp() {
    Picture p = new Picture("Picture1");
    p.move(0, 0, -1);
    p.setPosition(100, 100);
    p.setWidth(100);
    p.setHeight(100);
    p.setImage(assetManager, "Interface/Logo/Monkey.png", false);
    guiNode.attachChild(p);
    Picture p2 = new Picture("Picture2");
    p2.move(0, 0, 1.001f);
    p2.setPosition(150, 150);
    p2.setWidth(100);
    p2.setHeight(100);
    p2.setImage(assetManager, "Interface/Logo/Monkey.png", false);
    guiNode.attachChild(p2);
}
Also used : Picture(com.jme3.ui.Picture)

Example 23 with Picture

use of com.jme3.ui.Picture in project jmonkeyengine by jMonkeyEngine.

the class RefEnv method simpleInitApp.

@Override
public void simpleInitApp() {
    cam.setLocation(new Vector3f(-2.3324413f, 2.9567573f, 4.6054406f));
    cam.setRotation(new Quaternion(0.06310794f, 0.9321281f, -0.29613864f, 0.1986369f));
    Spatial sc = assetManager.loadModel("Scenes/PBR/spheres.j3o");
    rootNode.attachChild(sc);
    rootNode.getChild("Scene").setCullHint(Spatial.CullHint.Always);
    ref = new Node("reference pictures");
    refDE = new Picture("refDE");
    refDE.setHeight(cam.getHeight());
    refDE.setWidth(cam.getWidth());
    refDE.setImage(assetManager, "jme3test/light/pbr/spheresRefDE.png", false);
    refM = new Picture("refM");
    refM.setImage(assetManager, "jme3test/light/pbr/spheresRefM.png", false);
    refM.setHeight(cam.getHeight());
    refM.setWidth(cam.getWidth());
    ref.attachChild(refDE);
    stateManager.attach(new EnvironmentCamera());
    inputManager.addMapping("tex", new KeyTrigger(KeyInput.KEY_SPACE));
    inputManager.addMapping("switch", new KeyTrigger(KeyInput.KEY_RETURN));
    inputManager.addMapping("ref", new KeyTrigger(KeyInput.KEY_R));
    inputManager.addListener(new ActionListener() {

        @Override
        public void onAction(String name, boolean isPressed, float tpf) {
            if (name.equals("tex") && isPressed) {
                if (tex == null) {
                    return;
                }
                if (tex.getParent() == null) {
                    guiNode.attachChild(tex);
                } else {
                    tex.removeFromParent();
                }
            }
            if (name.equals("switch") && isPressed) {
                switchMat(rootNode.getChild("Scene"));
            }
            if (name.equals("ref") && isPressed) {
                if (ref.getParent() == null) {
                    guiNode.attachChild(ref);
                } else {
                    ref.removeFromParent();
                }
            }
        }
    }, "tex", "switch", "ref");
}
Also used : ActionListener(com.jme3.input.controls.ActionListener) Quaternion(com.jme3.math.Quaternion) Spatial(com.jme3.scene.Spatial) EnvironmentCamera(com.jme3.environment.EnvironmentCamera) Picture(com.jme3.ui.Picture) Vector3f(com.jme3.math.Vector3f) Node(com.jme3.scene.Node) KeyTrigger(com.jme3.input.controls.KeyTrigger)

Example 24 with Picture

use of com.jme3.ui.Picture in project jmonkeyengine by jMonkeyEngine.

the class TestFBOPassthrough method simpleInitApp.

@Override
public void simpleInitApp() {
    int w = settings.getWidth();
    int h = settings.getHeight();
    //setup framebuffer
    fb = new FrameBuffer(w, h, 1);
    Texture2D fbTex = new Texture2D(w, h, Format.RGBA8);
    fb.setDepthBuffer(Format.Depth);
    fb.setColorTexture(fbTex);
    // setup framebuffer's scene
    Sphere sphMesh = new Sphere(20, 20, 1);
    Material solidColor = assetManager.loadMaterial("Common/Materials/RedColor.j3m");
    Geometry sphere = new Geometry("sphere", sphMesh);
    sphere.setMaterial(solidColor);
    fbNode.attachChild(sphere);
    //setup main scene
    Picture p = new Picture("Picture");
    p.setPosition(0, 0);
    p.setWidth(w);
    p.setHeight(h);
    p.setTexture(assetManager, fbTex, false);
    rootNode.attachChild(p);
}
Also used : Sphere(com.jme3.scene.shape.Sphere) Geometry(com.jme3.scene.Geometry) Texture2D(com.jme3.texture.Texture2D) Picture(com.jme3.ui.Picture) Material(com.jme3.material.Material) FrameBuffer(com.jme3.texture.FrameBuffer)

Example 25 with Picture

use of com.jme3.ui.Picture in project jmonkeyengine by jMonkeyEngine.

the class TestWriteToTexture method simpleInitApp.

@Override
public void simpleInitApp() {
    initOpenCL1();
    tex = new Texture2D(settings.getWidth(), settings.getHeight(), 1, com.jme3.texture.Image.Format.RGBA8);
    Picture pic = new Picture("julia");
    pic.setTexture(assetManager, tex, true);
    pic.setPosition(0, 0);
    pic.setWidth(settings.getWidth());
    pic.setHeight(settings.getHeight());
    guiNode.attachChild(pic);
    initCounter = 0;
    flyCam.setEnabled(false);
    inputManager.setCursorVisible(true);
    inputManager.addMapping("right", new MouseAxisTrigger(MouseInput.AXIS_X, false));
    inputManager.addMapping("left", new MouseAxisTrigger(MouseInput.AXIS_X, true));
    inputManager.addMapping("up", new MouseAxisTrigger(MouseInput.AXIS_Y, false));
    inputManager.addMapping("down", new MouseAxisTrigger(MouseInput.AXIS_Y, true));
    inputManager.addMapping("drag", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addListener(this, "right", "left", "up", "down", "drag");
    dragging = false;
}
Also used : Texture2D(com.jme3.texture.Texture2D) Picture(com.jme3.ui.Picture) MouseAxisTrigger(com.jme3.input.controls.MouseAxisTrigger) MouseButtonTrigger(com.jme3.input.controls.MouseButtonTrigger)

Aggregations

Picture (com.jme3.ui.Picture)22 Texture2D (com.jme3.texture.Texture2D)11 Material (com.jme3.material.Material)9 Geometry (com.jme3.scene.Geometry)5 FrameBuffer (com.jme3.texture.FrameBuffer)5 Quaternion (com.jme3.math.Quaternion)4 Vector3f (com.jme3.math.Vector3f)4 Node (com.jme3.scene.Node)4 Image (com.jme3.texture.Image)4 ViewPort (com.jme3.renderer.ViewPort)3 Quad (com.jme3.scene.shape.Quad)3 ActionListener (com.jme3.input.controls.ActionListener)2 KeyTrigger (com.jme3.input.controls.KeyTrigger)2 Matrix4f (com.jme3.math.Matrix4f)2 Camera (com.jme3.renderer.Camera)2 Sphere (com.jme3.scene.shape.Sphere)2 Format (com.jme3.texture.Image.Format)2 ByteBuffer (java.nio.ByteBuffer)2 TextureKey (com.jme3.asset.TextureKey)1 EnvironmentCamera (com.jme3.environment.EnvironmentCamera)1