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);
}
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);
}
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");
}
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);
}
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;
}
Aggregations