/** * 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); } }
/** * 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); }
/** * 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); }
private TextureState readTextureStateFromCurrent() { final Element el = _currentElem; TextureState ret = null; try { ret = (TextureState) readSavableFromCurrentElem(null); final Savable[] savs = readSavableArray("texture", new Texture[0]); for (int i = 0; i < savs.length; i++) { Texture t = (Texture) savs[i]; final TextureKey tKey = t.getTextureKey(); t = TextureManager.loadFromKey(tKey, null, t); ret.setTexture(t, i); } } catch (final Exception e) { Logger.getLogger(DOMInputCapsule.class.getName()).log(Level.SEVERE, null, e); } _currentElem = el; return ret; }
private TextureState readTextureStateFromCurrent() { final Element el = _currentElem; TextureState ret = null; try { ret = (TextureState) readSavableFromCurrentElem(null); final Savable[] savs = readSavableArray("texture", new Texture[0]); for (int i = 0; i < savs.length; i++) { Texture t = (Texture) savs[i]; final TextureKey tKey = t.getTextureKey(); t = TextureManager.loadFromKey(tKey, null, t); ret.setTexture(t, i); } } catch (final Exception e) { Logger.getLogger(DOMInputCapsule.class.getName()).log(Level.SEVERE, null, e); } _currentElem = el; return ret; }
_pageTexture = TextureManager.loadFromKey(tkey, null, null); _pageTexture.setMagnificationFilter(magFilter);
_pageTexture = TextureManager.loadFromKey(tkey, null, null); _pageTexture.setMagnificationFilter(magFilter);
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); }
TextureManager.loadFromKey(_key, null, this);