public void reshape(ViewPort vp, int w, int h) { dispPic.setPosition(w / 20f, h / 20f); dispPic.setWidth(w / 5f); dispPic.setHeight(h / 5f); } }
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); }
/** * Set the position of the picture in pixels. * The origin (0, 0) is at the bottom-left of the screen. * * @param x The x coordinate * @param y The y coordinate */ public void setPosition(float x, float y){ float z = getLocalTranslation().getZ(); setLocalTranslation(x, y, z); }
protected void displayMap(Renderer r, Picture pic, int left) { Camera cam = vp.getCamera(); rm.setCamera(cam, true); int h = cam.getHeight(); pic.setPosition(left, h / 20f); pic.setWidth(128); pic.setHeight(128); pic.updateGeometricState(); rm.renderGeometry(pic); rm.setCamera(cam, false); }
private void renderProcessing(Renderer r, FrameBuffer dst, Material mat){ if (dst == null){ fsQuad.setWidth(mainSceneFB.getWidth()); fsQuad.setHeight(mainSceneFB.getHeight()); fbCam.resize(mainSceneFB.getWidth(), mainSceneFB.getHeight(), true); }else{ fsQuad.setWidth(dst.getWidth()); fsQuad.setHeight(dst.getHeight()); fbCam.resize(dst.getWidth(), dst.getHeight(), true); } fsQuad.setMaterial(mat); fsQuad.updateGeometricState(); renderManager.setCamera(fbCam, true); r.setFrameBuffer(dst); r.clearBuffers(true, true, true); renderManager.renderGeometry(fsQuad); }
public void initialize(RenderManager rm, ViewPort vp) { this.rm = rm; this.vp = vp; loadTextures(manager); createTextures(); applyTextures(material); createPreViews(); material.setVector2("FrustumNearFar", new Vector2f(vp.getCamera().getFrustumNear(), vp.getCamera().getFrustumFar())); if (debug) { dispRefraction = new Picture("dispRefraction"); dispRefraction.setTexture(manager, refractionTexture, false); dispReflection = new Picture("dispRefraction"); dispReflection.setTexture(manager, reflectionTexture, false); dispDepth = new Picture("depthTexture"); dispDepth.setTexture(manager, depthTexture, false); } }
public Picture createDisplayQuad(/*int mode, Texture tex*/){ if (scene64 == null) return null; Material mat = new Material(manager, "Common/MatDefs/Hdr/LogLum.j3md"); // if (mode == LUMMODE_ENCODE_LUM) // mat.setBoolean("EncodeLum", true); // else if (mode == LUMMODE_DECODE_LUM) mat.setBoolean("DecodeLum", true); mat.setTexture("Texture", scene64); // mat.setTexture("Texture", tex); Picture dispQuad = new Picture("Luminance Display"); dispQuad.setMaterial(mat); return dispQuad; }
/** * Create a named picture. * * By default a picture's width and height are 1 * and its position is 0, 0. * * @param name the name of the picture in the scene graph * @param flipY If true, the Y coordinates of the texture will be flipped. */ public Picture(String name, boolean flipY){ super(name, new Quad(1, 1, flipY)); setQueueBucket(Bucket.Gui); setCullHint(CullHint.Never); }
@Override public void initialize() { logger.config("Initializing VR mouse manager."); // load default mouseimage mouseImage = new Picture("mouse"); setImage("Common/Util/mouse.png"); // hide default cursor by making it invisible MouseInput mi = environment.getApplication().getContext().getMouseInput(); if( mi instanceof GlfwMouseInputVR ){ ((GlfwMouseInputVR)mi).hideActiveCursor(); } centerMouse(); logger.config("Initialized VR mouse manager [SUCCESS]"); }
/** * Set the texture to put on the picture. * * @param assetManager The {@link AssetManager} to use to load the material. * @param tex The texture * @param useAlpha If true, the picture will appear transparent and allow * objects behind it to appear through. If false, the transparent * portions will be the image's color at that pixel. */ public void setTexture(AssetManager assetManager, Texture2D tex, boolean useAlpha){ if (getMaterial() == null){ Material mat = new Material(assetManager, "Common/MatDefs/Gui/Gui.j3md"); mat.setColor("Color", ColorRGBA.White); setMaterial(mat); } material.getAdditionalRenderState().setBlendMode(useAlpha ? BlendMode.Alpha : BlendMode.Off); material.setTexture("Texture", tex); }
/** * Set the image to put on the picture. * * @param assetManager The {@link AssetManager} to use to load the image. * @param imgName The image name. * @param useAlpha If true, the picture will appear transparent and allow * objects behind it to appear through. If false, the transparent * portions will be the image's color at that pixel. */ public void setImage(AssetManager assetManager, String imgName, boolean useAlpha){ TextureKey key = new TextureKey(imgName, true); Texture2D tex = (Texture2D) assetManager.loadTexture(key); setTexture(assetManager, tex, useAlpha); }
public void onMouseMotionEvent(MouseMotionEvent evt) { x += evt.getDX(); y += evt.getDY(); // Prevent mouse from leaving screen AppSettings settings = TestSoftwareMouse.this.settings; x = FastMath.clamp(x, 0, settings.getWidth()); y = FastMath.clamp(y, 0, settings.getHeight()); // adjust for hotspot cursor.setPosition(x, y - 64); } public void onMouseButtonEvent(MouseButtonEvent evt) {
/** * Set the width in pixels of the picture, if the width * does not match the texture's width, then the texture will * be scaled to fit the picture. * * @param width the width to set. */ public void setWidth(float width){ this.width = width; setLocalScale(new Vector3f(width, height, 1f)); }
private void switchMat(Spatial s) { if (s instanceof Node) { Node n = (Node) s; for (Spatial children : n.getChildren()) { switchMat(children); } } else if (s instanceof Geometry) { Geometry g = (Geometry) s; Material mat = g.getMaterial(); if (((Float) mat.getParam("Metallic").getValue()) == 1f) { mat.setFloat("Metallic", 0); mat.setColor("BaseColor", ColorRGBA.Black); ref.attachChild(refImg); } else { mat.setFloat("Metallic", 1); mat.setColor("BaseColor", ColorRGBA.White); refImg.removeFromParent(); } } }
protected void displayShadowMap(Renderer r) { Camera cam = viewPort.getCamera(); renderManager.setCamera(cam, true); int h = cam.getHeight(); for (int i = 0; i < dispPic.length; i++) { dispPic[i].setPosition((128 * i) + (150 + 64 * (i + 1)), h / 20f); dispPic[i].setWidth(128); dispPic[i].setHeight(128); dispPic[i].updateGeometricState(); renderManager.renderGeometry(dispPic[i]); } renderManager.setCamera(cam, false); }
public void simpleInitApp() { Picture p = new Picture("Picture"); p.move(0, 0, -1); // make it appear behind stats view p.setPosition(0, 0); p.setWidth(settings.getWidth()); p.setHeight(settings.getHeight()); p.setImage(assetManager, "Interface/Logo/Monkey.png", false); // attach geometry to orthoNode guiNode.attachChild(p); }
/** * Set the height in pixels of the picture, if the height * does not match the texture's height, then the texture will * be scaled to fit the picture. * * @param height the height to set. */ public void setHeight(float height){ this.height = height; setLocalScale(new Vector3f(width, height, 1f)); }
/** * For debugging purposes, display depth shadow maps. */ protected void displayShadowMap(Renderer r) { Camera cam = viewPort.getCamera(); renderManager.setCamera(cam, true); int h = cam.getHeight(); for (int i = 0; i < dispPic.length; i++) { dispPic[i].setPosition((128 * i) + (150 + 64 * (i + 1)), h / 20f); dispPic[i].setWidth(128); dispPic[i].setHeight(128); dispPic[i].updateGeometricState(); renderManager.renderGeometry(dispPic[i]); } renderManager.setCamera(cam, false); }
@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); }
/** * For debugging purposes, display depth shadow maps. */ protected void displayShadowMap(Renderer r) { Camera cam = viewPort.getCamera(); renderManager.setCamera(cam, true); int h = cam.getHeight(); for (int i = 0; i < dispPic.length; i++) { dispPic[i].setPosition((128 * i) + (150 + 64 * (i + 1)), h / 20f); dispPic[i].setWidth(128); dispPic[i].setHeight(128); dispPic[i].updateGeometricState(); renderManager.renderGeometry(dispPic[i]); } renderManager.setCamera(cam, false); }