/** * 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); }
mouseImage.setHeight(ySize); mouseImage.setWidth(tex.getImage().getWidth()); mouseImage.getMaterial().getAdditionalRenderState().setBlendMode(BlendMode.Alpha); mouseImage.getMaterial().getAdditionalRenderState().setDepthWrite(false); } else { Texture tex = environment.getApplication().getAssetManager().loadTexture(texture); mouseImage.setHeight(ySize); mouseImage.setWidth(tex.getImage().getWidth()); mouseImage.getMaterial().getAdditionalRenderState().setBlendMode(BlendMode.Alpha); mouseImage.getMaterial().getAdditionalRenderState().setDepthWrite(false);
/** * 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 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); }