/** * @param multiSamples Set the number of samples to use for this image, * setting this to a value higher than 1 turns this image/texture * into a multisample texture (on OpenGL3.1 and higher). */ public void setMultiSamples(int multiSamples) { if (multiSamples <= 0) throw new IllegalArgumentException("multiSamples must be > 0"); if (getData(0) != null) throw new IllegalArgumentException("Cannot upload data as multisample texture"); if (hasMipmaps()) throw new IllegalArgumentException("Multisample textures do not support mipmaps"); this.multiSamples = multiSamples; }
@Override public String toString(){ StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append("[size=").append(width).append("x").append(height); if (depth > 1) sb.append("x").append(depth); sb.append(", format=").append(format.name()); if (hasMipmaps()) sb.append(", mips"); if (getId() >= 0) sb.append(", id=").append(id); sb.append("]"); return sb.toString(); }
/** * @param minificationFilter * the new MinificationFilterMode for this texture. * @throws IllegalArgumentException * if minificationFilter is null */ public void setMinFilter(MinFilter minificationFilter) { if (minificationFilter == null) { throw new IllegalArgumentException( "minificationFilter can not be null."); } this.minificationFilter = minificationFilter; if (minificationFilter.usesMipMapLevels() && image != null && !image.isGeneratedMipmapsRequired() && !image.hasMipmaps()) { image.setNeedGeneratedMipmaps(); } }
/** * Sets the update needed flag, while also checking if mipmaps * need to be regenerated. */ @Override public void setUpdateNeeded() { super.setUpdateNeeded(); if (isGeneratedMipmapsRequired() && !hasMipmaps()) { // Mipmaps are no longer valid, since the image was changed. setMipmapsGenerated(false); } }
protected static String formatMatParamTexture(MatParamTexture param) { StringBuilder ret = new StringBuilder(); Texture tex = (Texture) param.getValue(); TextureKey key; if (tex != null) { key = (TextureKey) tex.getKey(); if (key != null && key.isFlipY()) { ret.append("Flip "); } ret.append(formatWrapMode(tex, Texture.WrapAxis.S)); ret.append(formatWrapMode(tex, Texture.WrapAxis.T)); ret.append(formatWrapMode(tex, Texture.WrapAxis.R)); //Min and Mag filter Texture.MinFilter def = Texture.MinFilter.BilinearNoMipMaps; if (tex.getImage().hasMipmaps() || (key != null && key.isGenerateMips())) { def = Texture.MinFilter.Trilinear; } if (tex.getMinFilter() != def) { ret.append("Min").append(tex.getMinFilter().name()).append(" "); } if (tex.getMagFilter() != Texture.MagFilter.Bilinear) { ret.append("Mag").append(tex.getMagFilter().name()).append(" "); } ret.append("\"").append(key.getName()).append("\""); } return ret.toString(); }
if (image.hasMipmaps()) { numberOfMipmapLevels = image.getMipMapSizes().length; if (image.hasMipmaps()) { imageSize = image.getMipMapSizes()[mipLevel]; } else {
public MipMapImageRaster(Image image, int slice) { this.image = image; this.slice = slice; this.buffer = image.getData(slice); this.codec = ImageCodec.lookup(image.getFormat()); if (image.hasMipmaps()) { int nbMipMap = image.getMipMapSizes().length; this.width = new int[nbMipMap]; this.height = new int[nbMipMap]; this.offsets = new int[nbMipMap]; for (int i = 0; i < nbMipMap; i++) { width[i] = Math.max(1, image.getWidth() >> i); height[i] = Math.max(1, image.getHeight() >> i); if (i > 0) { offsets[i] = image.getMipMapSizes()[i - 1] + offsets[i - 1]; } } } else { throw new IllegalArgumentException("Image must have MipMapSizes initialized."); } if (codec instanceof ByteAlignedImageCodec || codec instanceof ByteOffsetImageCodec) { this.temp = new byte[codec.bpp]; } else { this.temp = null; } }
/** * Creates a CubeMapWrapper for the given cube map * Note that the cube map must be initialized, and the mipmaps sizes should * be set if relevant for them to be readable/writable * @param cubeMap the cubemap to wrap. */ public CubeMapWrapper(TextureCubeMap cubeMap) { image = cubeMap.getImage(); if (image.hasMipmaps()) { int nbMipMaps = image.getMipMapSizes().length; sizes = new int[nbMipMaps]; mipMapRaster = new MipMapImageRaster(image, 0); for (int i = 0; i < nbMipMaps; i++) { sizes[i] = Math.max(1, image.getWidth() >> i); } } else { sizes = new int[1]; sizes[0] = image.getWidth(); } raster = new DefaultImageRaster(image, 0,0 , false); }
if (image.hasMipmaps()) { this.width = Math.max(1, image.getWidth() >> mipMapLevel); this.height = Math.max(1, image.getHeight() >> mipMapLevel);
if (!sourceEnvMap.getImage().hasMipmaps() || sourceEnvMap.getImage().getMipMapSizes().length < nbMipMap) { throw new IllegalArgumentException("The input cube map must have at least " + nbMipMap + "mip maps");
if (!img.hasMipmaps() && img.isGeneratedMipmapsRequired()) { if (img.hasMipmaps()) { if (img.isGeneratedMipmapsRequired() || img.hasMipmaps()) { throw new RendererException("Multisample textures do not support mipmaps"); if (!img.hasMipmaps() && img.isGeneratedMipmapsRequired() && img.getData(0) != null) { glfbo.glGenerateMipmapEXT(target); img.setMipmapsGenerated(true);
if (img.hasMipmaps() || texKey.isGenerateMips()) { tex.setMinFilter(Texture.MinFilter.Trilinear);
if(texVal.getImage().hasMipmaps() || texKey.isGenerateMips()){ def = Texture.MinFilter.Trilinear;
haveMips = image.isGeneratedMipmapsRequired() || image.hasMipmaps();
/** * @param multiSamples Set the number of samples to use for this image, * setting this to a value higher than 1 turns this image/texture * into a multisample texture (on OpenGL3.1 and higher). */ public void setMultiSamples(int multiSamples) { if (multiSamples <= 0) throw new IllegalArgumentException("multiSamples must be > 0"); if (getData(0) != null) throw new IllegalArgumentException("Cannot upload data as multisample texture"); if (hasMipmaps()) throw new IllegalArgumentException("Multisample textures do not support mipmaps"); this.multiSamples = multiSamples; }
/** * @param multiSamples Set the number of samples to use for this image, * setting this to a value higher than 1 turns this image/texture * into a multisample texture (on OpenGL3.1 and higher). */ public void setMultiSamples(int multiSamples) { if (multiSamples <= 0) throw new IllegalArgumentException("multiSamples must be > 0"); if (getData(0) != null) throw new IllegalArgumentException("Cannot upload data as multisample texture"); if (hasMipmaps()) throw new IllegalArgumentException("Multisample textures do not support mipmaps"); this.multiSamples = multiSamples; }
@Override public String toString(){ StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append("[size=").append(width).append("x").append(height); if (depth > 1) sb.append("x").append(depth); sb.append(", format=").append(format.name()); if (hasMipmaps()) sb.append(", mips"); if (getId() >= 0) sb.append(", id=").append(id); sb.append("]"); return sb.toString(); }
@Override public String toString(){ StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append("[size=").append(width).append("x").append(height); if (depth > 1) sb.append("x").append(depth); sb.append(", format=").append(format.name()); if (hasMipmaps()) sb.append(", mips"); if (getId() >= 0) sb.append(", id=").append(id); sb.append("]"); return sb.toString(); }
/** * @param minificationFilter * the new MinificationFilterMode for this texture. * @throws IllegalArgumentException * if minificationFilter is null */ public void setMinFilter(MinFilter minificationFilter) { if (minificationFilter == null) { throw new IllegalArgumentException( "minificationFilter can not be null."); } this.minificationFilter = minificationFilter; if (minificationFilter.usesMipMapLevels() && image != null && !image.isGeneratedMipmapsRequired() && !image.hasMipmaps()) { image.setNeedGeneratedMipmaps(); } }
/** * Sets the update needed flag, while also checking if mipmaps * need to be regenerated. */ @Override public void setUpdateNeeded() { super.setUpdateNeeded(); if (isGeneratedMipmapsRequired() && !hasMipmaps()) { // Mipmaps are no longer valid, since the image was changed. setMipmapsGenerated(false); } }