當前位置: 首頁>>代碼示例>>Java>>正文


Java TextureFilter.Nearest方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.Texture.TextureFilter.Nearest方法的典型用法代碼示例。如果您正苦於以下問題:Java TextureFilter.Nearest方法的具體用法?Java TextureFilter.Nearest怎麽用?Java TextureFilter.Nearest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.graphics.Texture.TextureFilter的用法示例。


在下文中一共展示了TextureFilter.Nearest方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: read

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
@Override
public void read (Json json, JsonValue jsonData) {
	super.read(json, jsonData);
	if (jsonData.has("width"))
		width = jsonData.getFloat("width");
	if (jsonData.has("height"))
		height = jsonData.getFloat("height");
	if (jsonData.has("texture"))
		texturePath = jsonData.getString("texture");
	if (jsonData.has("srcX")) {
		useCustomSrc = true;
		srcX = jsonData.getInt("srcX");
	}
	if (jsonData.has("srcY"))
		srcY = jsonData.getInt("srcY");
	if (jsonData.has("srcWidth"))
		srcWidth = jsonData.getInt("srcWidth");
	if (jsonData.has("srcHeight"))
		srcHeight = jsonData.getInt("srcHeight");
	if (jsonData.has("originX"))
		originX = jsonData.getFloat("originX");
	if (jsonData.has("originY"))
		originY = jsonData.getFloat("originY");
	if (jsonData.has("minFilter"))
		minFilter = jsonData.getString("minFilter").equals("Linear") ? TextureFilter.Linear : TextureFilter.Nearest;
	if (jsonData.has("magFilter"))
		magFilter = jsonData.getString("magFilter").equals("Linear") ? TextureFilter.Linear : TextureFilter.Nearest;
	if (jsonData.has("tint"))
		setColor(JsonUtil.readColorFromJson(jsonData, "tint"));
	if (jsonData.has("uWrap")) {
		String uWrapStrings = jsonData.getString("uWrap");
		uWrap = uWrapStrings.equals("ClampToEdge") ? TextureWrap.ClampToEdge
			: uWrapStrings.equals("Repeat") ? TextureWrap.Repeat : TextureWrap.MirroredRepeat;
	}
	if (jsonData.has("vWrap")) {
		String vWrapStrings = jsonData.getString("vWrap");
		vWrap = vWrapStrings.equals("ClampToEdge") ? TextureWrap.ClampToEdge
			: vWrapStrings.equals("Repeat") ? TextureWrap.Repeat : TextureWrap.MirroredRepeat;
	}
}
 
開發者ID:Quexten,項目名稱:RavTech,代碼行數:41,代碼來源:SpriteRenderer.java

示例2: toGdxFilter

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
/**
 * Converts {@link GLScaleFilter} to its equivalent {@link TextureFilter}.
 */
public static TextureFilter toGdxFilter(GLScaleFilter filter) {
    switch (filter) {
    case NEAREST: return TextureFilter.Nearest;
    case NEAREST_MIPMAP: return TextureFilter.MipMapNearestLinear;
    case LINEAR: return TextureFilter.Linear;
    case LINEAR_MIPMAP: return TextureFilter.MipMapLinearLinear;
    }

    throw new IllegalArgumentException("Unsupported filter type: " + filter);
}
 
開發者ID:anonl,項目名稱:nvlist,代碼行數:14,代碼來源:GdxTextureUtil.java

示例3: Cubemap

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
/** Construct a Cubemap with the specified {@link TextureData}'s for the sides */
public Cubemap (TextureData positiveX, TextureData negativeX, TextureData positiveY, TextureData negativeY,
	TextureData positiveZ, TextureData negativeZ) {
	super(GL20.GL_TEXTURE_CUBE_MAP);
	minFilter = TextureFilter.Nearest;
	magFilter = TextureFilter.Nearest;
	uWrap = TextureWrap.ClampToEdge;
	vWrap = TextureWrap.ClampToEdge;
	data = new FacedCubemapData(positiveX, negativeX, positiveY, negativeY, positiveZ, negativeZ);
	load(data);
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:12,代碼來源:Cubemap.java

示例4: drawFont

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
private int drawFont (BitmapFont font, String description, boolean linearFiltering, boolean useShader, float smoothing, int x) {
	int y = 10;
	float maxWidth = 0;

	spriteBatch.setShader(null);
	descriptionFont.drawMultiLine(spriteBatch, description, x, y);
	spriteBatch.flush();
	y += 10 + 2 * descriptionFont.getLineHeight();

	// set filters for each page
	TextureFilter minFilter = linearFiltering ? TextureFilter.MipMapLinearNearest : TextureFilter.Nearest;
	TextureFilter magFilter = linearFiltering ? TextureFilter.Linear : TextureFilter.Nearest;
	for (int i = 0; i < font.getRegions().length; i++) {
		font.getRegion(i).getTexture().setFilter(minFilter, magFilter);
	}

	if (useShader) {
		spriteBatch.setShader(distanceFieldShader);
	} else {
		spriteBatch.setShader(null);
	}

	for (float scale : SCALES) {
		font.setScale(scale);
		maxWidth = Math.max(maxWidth, font.getBounds(TEXT).width);
		if (useShader) {
			distanceFieldShader.setSmoothing(smoothing / scale);
		}
		font.draw(spriteBatch, TEXT, x, y + scale * getBaselineShift(font));
		y += font.getLineHeight();
		spriteBatch.flush();
	}
	return (int)Math.ceil(maxWidth);
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:35,代碼來源:BitmapFontDistanceFieldTest.java

示例5: SmartTexture

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
public SmartTexture( GdxTexture bitmap ) {
	this( bitmap, TextureFilter.Nearest, TextureWrap.ClampToEdge );
}
 
開發者ID:kurtyu,項目名稱:PixelDungeonTC,代碼行數:4,代碼來源:SmartTexture.java

示例6: packImagesToTextureAtlas

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
/**
 * Pack the images from Folder into a Atlas and Load the Image from Atlas
 */
private void packImagesToTextureAtlas(String ImagePath, boolean reziseHeight) {
    if (isPacking)
        return;
    isPacking = true;

    de.longri.cachebox3.utils.texturepacker.Settings textureSettings = new de.longri.cachebox3.utils.texturepacker.Settings();

    textureSettings.pot = true;
    textureSettings.paddingX = 2;
    textureSettings.paddingY = 2;
    textureSettings.duplicatePadding = true;
    textureSettings.edgePadding = true;
    textureSettings.rotation = false;
    textureSettings.minWidth = 16;
    textureSettings.minHeight = 16;
    textureSettings.maxWidth = 2048;
    textureSettings.maxHeight = 2048;
    textureSettings.stripWhitespaceX = false;
    textureSettings.stripWhitespaceY = false;
    textureSettings.alphaThreshold = 0;
    textureSettings.filterMin = TextureFilter.Nearest;
    textureSettings.filterMag = TextureFilter.Nearest;
    textureSettings.wrapX = TextureWrap.ClampToEdge;
    textureSettings.wrapY = TextureWrap.ClampToEdge;
    textureSettings.format = Format.RGBA8888;
    textureSettings.alias = true;
    textureSettings.outputFormat = "png";
    textureSettings.jpegQuality = 0.9f;
    textureSettings.ignoreBlankImages = true;
    textureSettings.fast = false;
    textureSettings.debug = false;

    String inputFolder = Utils.GetDirectoryName(ImagePath);
    String outputFolder = Settings.ImageCacheFolder.getValue();
    String Name = getCachedAtlasName(inputFolder);

    try {
        TexturePacker_Base.process(textureSettings, inputFolder, outputFolder, Name);
    } catch (Exception e) {
        e.printStackTrace();
        ImageLoadError = true;
    }

    Sprite spt = tryToLoadFromCreatedAtlas(ImagePath);
    if (spt != null)
        setSprite(spt, reziseHeight);

    isPacking = false;
}
 
開發者ID:Longri,項目名稱:cachebox3.0,代碼行數:53,代碼來源:ImageLoader.java

示例7: genAtlas

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
private void genAtlas() {
	String outdir = Ctx.project.getAssetPath() + Project.ATLASES_PATH;
	List<String> res = Ctx.project.getResolutions();
	String name = this.name.getText();
	String fMin = filterMin.getText();
	String fMag = filterMag.getText();

	TextureFilter filterMin = null, filterMag = null;

	if (fMin.equals("Linear"))
		filterMin = TextureFilter.Linear;
	else if (fMin.equals("Nearest"))
		filterMin = TextureFilter.Nearest;
	else if (fMin.equals("MipMap"))
		filterMin = TextureFilter.MipMap;
	else if (fMin.equals("MipMapLinearLinear"))
		filterMin = TextureFilter.MipMapLinearLinear;
	else if (fMin.equals("MipMapLinearNearest"))
		filterMin = TextureFilter.MipMapLinearNearest;
	else if (fMin.equals("MipMapNearestLinear"))
		filterMin = TextureFilter.MipMapNearestLinear;
	else if (fMin.equals("MipMapNearestNearest"))
		filterMin = TextureFilter.MipMapNearestNearest;

	if (fMag.equals("Linear"))
		filterMag = TextureFilter.Linear;
	else if (fMag.equals("Nearest"))
		filterMag = TextureFilter.Nearest;
	else if (fMag.equals("MipMap"))
		filterMag = TextureFilter.MipMap;
	else if (fMag.equals("MipMapLinearLinear"))
		filterMag = TextureFilter.MipMapLinearLinear;
	else if (fMag.equals("MipMapLinearNearest"))
		filterMag = TextureFilter.MipMapLinearNearest;
	else if (fMag.equals("MipMapNearestLinear"))
		filterMag = TextureFilter.MipMapNearestLinear;
	else if (fMag.equals("MipMapNearestNearest"))
		filterMag = TextureFilter.MipMapNearestNearest;

	for (String r : res) {
		float scale = Float.parseFloat(r);

		try {
			ImageUtils.createAtlas(dir.getText(), outdir + "/" + r, name + ".atlas", scale, filterMin, filterMag,
					outputFormat.getText());
		} catch (IOException e) {
			EditorLogger.error(e.getMessage());
			Message.showMsgDialog(getStage(), "Error creating atlas", e.getMessage());
			return;
		}
	}

	Message.hideMsg();
}
 
開發者ID:bladecoder,項目名稱:bladecoder-adventure-engine,代碼行數:55,代碼來源:CreateAtlasDialog.java

示例8: load

import com.badlogic.gdx.graphics.Texture.TextureFilter; //導入方法依賴的package包/類
public static void load() {
	if (Thread.currentThread() != Shadow.thread) {
		Gdx.app.postRunnable(new Runnable() {
			public void run() {
				load();
			}
		});
		return;
	}

	//atlasPacker = new PixmapPacker(1024, 1024, Pixmap.Format.RGBA8888, 2, true);
	//atlas = atlasPacker.generateTextureAtlas(TextureFilter.MipMapNearestNearest, TextureFilter.Nearest, true);

	FreeTypeFontParameter params = new FreeTypeFontParameter();
	params.size = 0;
	params.flip = false;
	//TODO generate glyphs on our own when using a shared PixmapPacker
	//params.packer = atlasPacker;
	params.packer = null;
	params.minFilter = TextureFilter.Nearest;
	params.magFilter = TextureFilter.Nearest;
	params.genMipMaps = true;

	FreeTypeFontGenerator gen_bold = new FreeTypeFontGenerator(Gdx.files.internal(path_bold));
	params.size = 16;
	bold_small = gen_bold.generateFont(params);
	params.size = 32;
	bold_normal = gen_bold.generateFont(params);
	params.size = 64;
	bold_large = gen_bold.generateFont(params);
	gen_bold.dispose();
	
	FreeTypeFontGenerator gen_light = new FreeTypeFontGenerator(Gdx.files.internal(path_light));
	params.size = 16;
	light_small = gen_light.generateFont(params);
	params.size = 32;
	light_normal = gen_light.generateFont(params);
	params.size = 64;
	light_large = gen_light.generateFont(params);
	gen_light.dispose();
}
 
開發者ID:0x0ade,項目名稱:shadow-engine,代碼行數:42,代碼來源:Fonts.java


注:本文中的com.badlogic.gdx.graphics.Texture.TextureFilter.Nearest方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。