public static synchronized TextureKey getKey(final ResourceSource source, final boolean flipped, final TextureStoreFormat storeFormat, final Texture.MinificationFilter minFilter) { return getKey(source, flipped, storeFormat, null, minFilter); }
public static synchronized TextureKey getKey(final ResourceSource source, final boolean flipped, final TextureStoreFormat storeFormat, final Texture.MinificationFilter minFilter) { return getKey(source, flipped, storeFormat, null, minFilter); }
/** * Get a new unique TextureKey. This is meant for use by RTT and other situations where we know we are making a * unique texture. * * @param minFilter * our minification filter value. * @return the new TextureKey */ public static synchronized TextureKey getRTTKey(final MinificationFilter minFilter) { int val = _uniqueTK.addAndGet(1); if (val == Integer.MAX_VALUE) { _uniqueTK.set(Integer.MIN_VALUE); val = Integer.MIN_VALUE; } return getKey(null, false, TextureStoreFormat.GuessCompressedFormat, "RTT_" + val, minFilter); }
/** * Get a new unique TextureKey. This is meant for use by RTT and other situations where we know we are making a * unique texture. * * @param minFilter * our minification filter value. * @return the new TextureKey */ public static synchronized TextureKey getRTTKey(final MinificationFilter minFilter) { int val = _uniqueTK.addAndGet(1); if (val == Integer.MAX_VALUE) { _uniqueTK.set(Integer.MIN_VALUE); val = Integer.MIN_VALUE; } return getKey(null, false, TextureStoreFormat.GuessCompressedFormat, "RTT_" + val, minFilter); }
/** * Creates a texture from a given Ardor3D Image object. * * @param image * the Ardor3D image. * @param minFilter * the filter for the near values. Used to determine if we should generate mipmaps. * @param format * the specific format to use when storing this texture on the card. * @return the loaded texture. */ public static Texture loadFromImage(final Image image, final Texture.MinificationFilter minFilter, final TextureStoreFormat format) { final TextureKey key = TextureKey.getKey(null, false, format, "img_" + image.hashCode(), minFilter); return loadFromKey(key, image, null); }
/** * Creates a texture from a given Ardor3D Image object. * * @param image * the Ardor3D image. * @param minFilter * the filter for the near values. Used to determine if we should generate mipmaps. * @param format * the specific format to use when storing this texture on the card. * @return the loaded texture. */ public static Texture loadFromImage(final Image image, final Texture.MinificationFilter minFilter, final TextureStoreFormat format) { final TextureKey key = TextureKey.getKey(null, false, format, "img_" + image.hashCode(), minFilter); return loadFromKey(key, image, null); }
/** * Convenience Utility for loading a BufferedImage as an Ardor3D Texture. * * @param image * our buffered image * @param minFilter * the filter for the near values. Used to determine if we should generate mipmaps. * @param flipVertically * If true, the image is flipped vertically during image conversion. * @param storeFormat * the specific format to use when storing this texture on the card. * @return our new Texture. */ public static final Texture loadTexture(final BufferedImage image, final Texture.MinificationFilter minFilter, final TextureStoreFormat storeFormat, final boolean flipVertically) { final Image imageData = AWTImageLoader.makeArdor3dImage(image, flipVertically); final String fileType = (image != null) ? "" + image.hashCode() : null; final TextureKey tkey = TextureKey.getKey(null, flipVertically, storeFormat, fileType, minFilter); return TextureManager.loadFromKey(tkey, imageData, null); } }
/** * Convenience Utility for loading a BufferedImage as an Ardor3D Texture. * * @param image * our buffered image * @param minFilter * the filter for the near values. Used to determine if we should generate mipmaps. * @param flipVertically * If true, the image is flipped vertically during image conversion. * @param storeFormat * the specific format to use when storing this texture on the card. * @return our new Texture. */ public static final Texture loadTexture(final BufferedImage image, final Texture.MinificationFilter minFilter, final TextureStoreFormat storeFormat, final boolean flipVertically) { final Image imageData = AWTImageLoader.makeArdor3dImage(image, flipVertically); final String fileType = (image != null) ? "" + image.hashCode() : null; final TextureKey tkey = TextureKey.getKey(null, flipVertically, storeFormat, fileType, minFilter); return TextureManager.loadFromKey(tkey, imageData, null); } }
/** * Loads a texture from the given source. * * @param source * the source of the texture image. * @param minFilter * the filter for the near values. Used to determine if we should generate mipmaps. * @param format * the specific format to use when storing this texture on the card. * @param flipVertically * If true, the image is flipped vertically during image loading. * @return the loaded texture. */ public static Texture load(final ResourceSource source, final Texture.MinificationFilter minFilter, final TextureStoreFormat format, final boolean flipVertically) { if (null == source) { logger.warning("Could not load image... source was null. defaultTexture used."); return TextureState.getDefaultTexture(); } final TextureKey tkey = TextureKey.getKey(source, flipVertically, format, minFilter); return loadFromKey(tkey, null, null); }
/** * Loads a texture from the given source. * * @param source * the source of the texture image. * @param minFilter * the filter for the near values. Used to determine if we should generate mipmaps. * @param format * the specific format to use when storing this texture on the card. * @param flipVertically * If true, the image is flipped vertically during image loading. * @return the loaded texture. */ public static Texture load(final ResourceSource source, final Texture.MinificationFilter minFilter, final TextureStoreFormat format, final boolean flipVertically) { if (null == source) { logger.warning("Could not load image... source was null. defaultTexture used."); return TextureState.getDefaultTexture(); } final TextureKey tkey = TextureKey.getKey(source, flipVertically, format, minFilter); return loadFromKey(tkey, null, null); }
minFilter = Texture.MinificationFilter.Trilinear; final TextureKey tkey = TextureKey.getKey(texSrc, false, TextureStoreFormat.GuessNoCompressedFormat, minFilter); _pageTexture = TextureManager.loadFromKey(tkey, null, null);
minFilter = Texture.MinificationFilter.Trilinear; final TextureKey tkey = TextureKey.getKey(texSrc, false, TextureStoreFormat.GuessNoCompressedFormat, minFilter); _pageTexture = TextureManager.loadFromKey(tkey, null, null);
public void read(final InputCapsule capsule) throws IOException { _minificationFilter = capsule.readEnum("minificationFilter", MinificationFilter.class, MinificationFilter.NearestNeighborNoMipMaps); _image = (Image) capsule.readSavable("image", null); // pull our key, if exists final TextureKey key = (TextureKey) capsule.readSavable("textureKey", null); if (key != null) { _key = TextureKey.getKey(key.getSource(), key.isFlipped(), key.getFormat(), key.getId(), key.getMinificationFilter()); } else { // none set, so pop in a generated key _key = TextureKey.getRTTKey(_minificationFilter); } // pull texture image from resource, if possible. if (_image == null && _key != null && _key.getSource() != null) { TextureManager.loadFromKey(_key, null, this); } _borderColor.set((ColorRGBA) capsule.readSavable("borderColor", new ColorRGBA(ColorRGBA.BLACK_NO_ALPHA))); _hasBorder = capsule.readBoolean("hasBorder", false); _anisotropicFilterPercent = capsule.readFloat("anisotropicFilterPercent", 0.0f); _lodBias = capsule.readFloat("lodBias", 0.0f); _magnificationFilter = capsule.readEnum("magnificationFilter", MagnificationFilter.class, MagnificationFilter.Bilinear); _storeFormat = capsule.readEnum("storeFormat", TextureStoreFormat.class, TextureStoreFormat.RGBA8); _rttPixelDataType = capsule.readEnum("rttPixelDataType", PixelDataType.class, PixelDataType.UnsignedByte); }
_key = TextureKey.getKey(key.getSource(), key.isFlipped(), key.getFormat(), key.getId(), key.getMinificationFilter()); } else {