/** * <code>setCorrectionType</code> sets the image correction type for this texture state. * * @param type * the correction type for this texture. * @throws IllegalArgumentException * if type is null */ public void setCorrectionType(final CorrectionType type) { if (type == null) { throw new IllegalArgumentException("type can not be null."); } _correctionType = type; setNeedsRefresh(true); }
/** * <code>setTexture</code> sets a single texture to the first texture unit. * * @param texture * the texture to set. */ public void setTexture(final Texture texture) { if (_texture.size() == 0) { _texture.add(texture); } else { _texture.set(0, texture); } setNeedsRefresh(true); }
/** * <code>setTexture</code> sets a single texture to the first texture unit. * * @param texture * the texture to set. */ public void setTexture(final Texture texture) { if (_texture.size() == 0) { _texture.add(texture); } else { _texture.set(0, texture); } setNeedsRefresh(true); }
/** * <code>setTexture</code> sets the texture object to be used by the state. The texture unit that this texture uses * is set, if the unit is not valid, i.e. less than zero or greater than the number of texture units supported by * the graphics card, it is ignored. * * @param texture * the texture to be used by the state. * @param textureUnit * the texture unit this texture will fill. */ public void setTexture(final Texture texture, final int textureUnit) { if (textureUnit >= 0 && textureUnit < MAX_TEXTURES) { while (textureUnit >= _texture.size()) { _texture.add(null); } _texture.set(textureUnit, texture); } setNeedsRefresh(true); }
/** * <code>setTexture</code> sets the texture object to be used by the state. The texture unit that this texture uses * is set, if the unit is not valid, i.e. less than zero or greater than the number of texture units supported by * the graphics card, it is ignored. * * @param texture * the texture to be used by the state. * @param textureUnit * the texture unit this texture will fill. */ public void setTexture(final Texture texture, final int textureUnit) { if (textureUnit >= 0 && textureUnit < MAX_TEXTURES) { while (textureUnit >= _texture.size()) { _texture.add(null); } _texture.set(textureUnit, texture); } setNeedsRefresh(true); }
public void createAtlases(final AtlasTextureParameter atlasTextureParameter) { for (final ByteBuffer data : dataBuffers) { data.rewind(); final ImageDataFormat fmt = useAlpha ? ImageDataFormat.RGBA : ImageDataFormat.RGB; final Image image = new Image(fmt, PixelDataType.UnsignedByte, atlasWidth, atlasHeight, data, null); final TextureStoreFormat format = atlasTextureParameter.compress ? TextureStoreFormat.GuessCompressedFormat : TextureStoreFormat.GuessNoCompressedFormat; final Texture texture = TextureManager.loadFromImage(image, atlasTextureParameter.minificationFilter, format); texture.setMagnificationFilter(atlasTextureParameter.magnificationFilter); texture.setWrap(atlasTextureParameter.wrapMode); textures.add(texture); } for (final List<TextureParameter> paramList : cachedAtlases.values()) { for (final TextureParameter param : paramList) { final Texture texture = textures.get(param.getAtlasIndex()); final TextureState ts = (TextureState) param.getMesh().getLocalRenderState(StateType.Texture); ts.setTexture(texture, param.getTargetTextureIndex()); ts.setNeedsRefresh(true); } } TexturePacker.logger.info(nrTextures + " textures packed into " + packers.size() + " atlases."); }