/** * Creates a new three-dimensional texture using the given image. * @param img The image to use. */ public Texture3D(Image img) { super(); setImage(img); if (img.getFormat().isDepthFormat()) { setMagFilter(MagFilter.Nearest); setMinFilter(MinFilter.NearestNoMipMaps); } }
/** * Creates a new two-dimensional texture using the given image. * @param img The image to use. */ public Texture2D(Image img){ super(); setImage(img); if (img.getData(0) == null) { setMagFilter(MagFilter.Nearest); setMinFilter(MinFilter.NearestNoMipMaps); } }
public void setDepthTexture(TextureArray tex, int layer){ if (id != -1) throw new UnsupportedOperationException("FrameBuffer already initialized."); Image img = tex.getImage(); checkSetTexture(tex, true); depthBuf = new RenderBuffer(); depthBuf.slot = img.getFormat().isDepthStencilFormat() ? SLOT_DEPTH_STENCIL : SLOT_DEPTH; depthBuf.tex = tex; depthBuf.format = img.getFormat(); depthBuf.layer = layer; }
@Override public void applyToTexture(final String option, final Texture texture) { final int separatorPosition = option.indexOf("_"); if (separatorPosition >= option.length() - 2) { final String axis = option.substring(separatorPosition + 1); final String mode = option.substring(0, separatorPosition); final Texture.WrapAxis wrapAxis = Texture.WrapAxis.valueOf(axis); texture.setWrap(wrapAxis, Texture.WrapMode.valueOf(mode)); } else { texture.setWrap(Texture.WrapMode.valueOf(option)); } } },
/** * initialize the Irradiancemap * @param size the size of the map * @param imageFormat the format of the image * @return the initialized Irradiance map */ public static TextureCubeMap createIrradianceMap(int size, Image.Format imageFormat) { TextureCubeMap irrMap = new TextureCubeMap(size, size, imageFormat); irrMap.setMagFilter(Texture.MagFilter.Bilinear); irrMap.setMinFilter(Texture.MinFilter.BilinearNoMipMaps); irrMap.getImage().setColorSpace(ColorSpace.Linear); return irrMap; }
protected static String formatWrapMode(Texture texVal, Texture.WrapAxis axis) { WrapMode mode; try { mode = texVal.getWrap(axis); } catch (IllegalArgumentException e) { //this axis doesn't exist on the texture return ""; } if (mode != WrapMode.EdgeClamp) { return "Wrap" + mode.name() + "_" + axis.name() + " "; } return ""; }
@Override public void applyToTexture(final String option, final Texture texture) { texture.setMinFilter(Texture.MinFilter.valueOf(option)); } },
@Override public void applyToTexture(final String option, final Texture texture) { texture.setMagFilter(Texture.MagFilter.valueOf(option)); } },
@Override public boolean equals(Object other) { if (!(other instanceof Texture2D)) { return false; } Texture2D that = (Texture2D) other; if (this.getWrap(WrapAxis.S) != that.getWrap(WrapAxis.S)) return false; if (this.getWrap(WrapAxis.T) != that.getWrap(WrapAxis.T)) return false; return super.equals(other); }
@Override public boolean equals(Object other) { if (!(other instanceof TextureCubeMap)) { return false; } TextureCubeMap that = (TextureCubeMap) other; if (this.getWrap(WrapAxis.S) != that.getWrap(WrapAxis.S)) return false; if (this.getWrap(WrapAxis.T) != that.getWrap(WrapAxis.T)) return false; if (this.getWrap(WrapAxis.R) != that.getWrap(WrapAxis.R)) return false; return super.equals(other); }
private String getWrapMode(Texture texVal, Texture.WrapAxis axis) { WrapMode mode = WrapMode.EdgeClamp; try{ mode = texVal.getWrap(axis); }catch (IllegalArgumentException e){ //this axis doesn't exist on the texture return ""; } if(mode != WrapMode.EdgeClamp){ return"Wrap"+ mode.name() + "_" + axis.name() + " "; } return ""; }