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


Java TextureUtil.uploadTextureImageAllocate方法代碼示例

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


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

示例1: loadTexture

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
public void loadTexture(IResourceManager resourceManager) throws IOException
{
    this.deleteGlTexture();
    InputStream inputstream = Shaders.getShaderPackResourceStream(this.texturePath);

    if (inputstream == null)
    {
        throw new FileNotFoundException("Shader texture not found: " + this.texturePath);
    }
    else
    {
        try
        {
            BufferedImage bufferedimage = TextureUtil.readBufferedImage(inputstream);
            TextureMetadataSection texturemetadatasection = this.loadTextureMetadataSection();
            TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, texturemetadatasection.getTextureBlur(), texturemetadatasection.getTextureClamp());
        }
        finally
        {
            IOUtils.closeQuietly(inputstream);
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:24,代碼來源:SimpleShaderTexture.java

示例2: loadTexture

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
@Override
public void loadTexture(IResourceManager resourceManager) throws IOException
{
    TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), image, false, false);

    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
    tasi = new TextureAtlasSpriteBufferedImage(this.rl, this.image);
    tasi.load(Minecraft.getMinecraft().getResourceManager(), rl);
    builder.addAll(ItemLayerModel.getQuadsForSprite(0, tasi, DefaultVertexFormats.ITEM, Optional.empty()));
    quads = builder.build();
}
 
開發者ID:iChun,項目名稱:Clef,代碼行數:12,代碼來源:Instrument.java

示例3: loadTexture

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
@Override
public void loadTexture(IResourceManager var1) throws IOException
{
    imageEffect.load(var1);
    BufferedImage image = IvTextureCreatorMC.getImage(var1, resourceLocation, logger);

    if (image == null)
        throw new IOException();

    BufferedImage modified = IvTextureCreator.applyEffect(image, imageEffect);

    TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), modified, false, false);
}
 
開發者ID:Ivorforce,項目名稱:IvToolkit,代碼行數:14,代碼來源:ModifiedTexture.java

示例4: addPlayerClothing

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
public static void addPlayerClothing(PlayerClothing clothing) {
	players.put(clothing.player, clothing);
	try {
		if(clothing.glTextureID == -1) {
			clothing.glTextureID = TextureUtil.glGenTextures();
		}
		clothing.createClothingFile(clothingDir, clothingFileDir);
		BufferedImage image = ImageIO.read(clothing.getClothingFile(clothingFileDir));
		TextureUtil.uploadTextureImageAllocate(clothing.glTextureID, image, false, false);
	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:AgeCraft,項目名稱:AgeCraft-Old,代碼行數:14,代碼來源:PlayerClothingClient.java

示例5: updatePlayerClothing

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
public static void updatePlayerClothing(String username) {
	if(players.containsKey(username)) {
		try {
			PlayerClothing clothing = players.get(username);
			if(clothing.glTextureID == -1) {
				clothing.glTextureID = TextureUtil.glGenTextures();
			}
			clothing.createClothingFile(clothingDir, clothingFileDir);
			BufferedImage image = ImageIO.read(clothing.getClothingFile(clothingFileDir));
			TextureUtil.uploadTextureImageAllocate(clothing.glTextureID, image, false, false);
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
}
 
開發者ID:AgeCraft,項目名稱:AgeCraft-Old,代碼行數:16,代碼來源:PlayerClothingClient.java

示例6: loadTexture

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
@Override
public void loadTexture(IResourceManager arg0) throws IOException
{
    deleteGlTexture();

    TextureUtil.uploadTextureImageAllocate(getGlTextureId(), skin.image, false, false);
    SkinData.store.put(location, skin);
}
 
開發者ID:zlainsama,項目名稱:OfflineSkins,代碼行數:9,代碼來源:SkinData.java

示例7: setupTexture

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
private void setupTexture(final boolean antiAlias)
{
	if(font.getSize() <= 15)
	{
		IMAGE_WIDTH = 256;
		IMAGE_HEIGHT = 256;
	}
	if(font.getSize() <= 43)
	{
		IMAGE_WIDTH = 512;
		IMAGE_HEIGHT = 512;
	}else if(font.getSize() <= 91)
	{
		IMAGE_WIDTH = 1024;
		IMAGE_HEIGHT = 1024;
	}else
	{
		IMAGE_WIDTH = 2048;
		IMAGE_HEIGHT = 2048;
	}
	
	final BufferedImage img = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT,
		BufferedImage.TYPE_INT_ARGB);
	final Graphics2D g = (Graphics2D)img.getGraphics();
	g.setFont(font);
	
	g.setColor(new Color(255, 255, 255, 0));
	g.fillRect(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT);
	g.setColor(Color.white);
	
	int rowHeight = 0;
	int positionX = 0;
	int positionY = 0;
	for(int i = 0; i < 2048; i++)
	{
		final char ch = (char)i;
		final BufferedImage fontImage = getFontImage(ch, antiAlias);
		
		final IntObject newIntObject = new IntObject();
		
		newIntObject.width = fontImage.getWidth();
		newIntObject.height = fontImage.getHeight();
		
		if(positionX + newIntObject.width >= IMAGE_WIDTH)
		{
			positionX = 0;
			positionY += rowHeight;
			rowHeight = 0;
		}
		
		newIntObject.storedX = positionX;
		newIntObject.storedY = positionY;
		
		if(newIntObject.height > fontHeight)
			fontHeight = newIntObject.height;
		
		if(newIntObject.height > rowHeight)
			rowHeight = newIntObject.height;
		chars[i] = newIntObject;
		g.drawImage(fontImage, positionX, positionY, null);
		
		positionX += newIntObject.width;
	}
	
	try
	{
		texID = TextureUtil.uploadTextureImageAllocate(
			TextureUtil.glGenTextures(), img, true, true);
	}catch(final NullPointerException e)
	{
		e.printStackTrace();
	}
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:74,代碼來源:WurstFont.java

示例8: setupTexture

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
private void setupTexture(final boolean antiAlias) {
	if (font.getSize() <= 15) {
		IMAGE_WIDTH = 256;
		IMAGE_HEIGHT = 256;
	}
	if (font.getSize() <= 43) {
		IMAGE_WIDTH = 512;
		IMAGE_HEIGHT = 512;
	} else if (font.getSize() <= 91) {
		IMAGE_WIDTH = 1024;
		IMAGE_HEIGHT = 1024;
	} else {
		IMAGE_WIDTH = 2048;
		IMAGE_HEIGHT = 2048;
	}

	final BufferedImage img = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_ARGB);
	final Graphics2D g = (Graphics2D) img.getGraphics();
	g.setFont(font);

	g.setColor(new Color(255, 255, 255, 0));
	g.fillRect(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT);
	g.setColor(Color.white);

	int rowHeight = 0;
	int positionX = 0;
	int positionY = 0;
	for (int i = 0; i < 2048; i++) {
		final char ch = (char) i;
		final BufferedImage fontImage = getFontImage(ch, antiAlias);

		final IntObject newIntObject = new IntObject();

		newIntObject.width = fontImage.getWidth();
		newIntObject.height = fontImage.getHeight();

		if (positionX + newIntObject.width >= IMAGE_WIDTH) {
			positionX = 0;
			positionY += rowHeight;
			rowHeight = 0;
		}

		newIntObject.storedX = positionX;
		newIntObject.storedY = positionY;

		if (newIntObject.height > fontHeight)
			fontHeight = newIntObject.height;

		if (newIntObject.height > rowHeight)
			rowHeight = newIntObject.height;
		chars[i] = newIntObject;
		g.drawImage(fontImage, positionX, positionY, null);

		positionX += newIntObject.width;
	}

	try {
		texID = TextureUtil.uploadTextureImageAllocate(TextureUtil.glGenTextures(), img, true, true);
	} catch (final NullPointerException e) {
		e.printStackTrace();
	}
}
 
開發者ID:Moudoux,項目名稱:EMC,代碼行數:63,代碼來源:IFont.java

示例9: loadTexture

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
@Override
public void loadTexture(IResourceManager p_110551_1_) throws IOException {
    TextureUtil.uploadTextureImageAllocate(getGlTextureId(), image, false, false);
}
 
開發者ID:AlmuraDev,項目名稱:AlmuraSDK-Legacy,代碼行數:5,代碼來源:FileSystem.java

示例10: loadTexture

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
@Override
public void loadTexture(IResourceManager resourceManager) throws IOException {
    this.deleteGlTexture();
    InputStream inputstream = null;

    try
    {
        IResource iresource = resourceManager.getResource(this.textureLocation);
        inputstream = iresource.getInputStream();
        BufferedImage bufferedimage = manipulateImage(resourceManager, ImageIO.read(inputstream));

        boolean flag = false;
        boolean flag1 = false;

        if (iresource.hasMetadata())
        {
            try
            {
                TextureMetadataSection texturemetadatasection = (TextureMetadataSection)iresource.getMetadata("texture");

                if (texturemetadatasection != null)
                {
                    flag = texturemetadatasection.getTextureBlur();
                    flag1 = texturemetadatasection.getTextureClamp();
                }
            }
            catch (RuntimeException runtimeexception)
            {
                LOGGER.warn("Failed reading metadata of: " + this.textureLocation, runtimeexception);
            }
        }

        TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1);
    }
    finally
    {
        if (inputstream != null)
        {
            inputstream.close();
        }
    }
}
 
開發者ID:makeoo,項目名稱:Gadomancy,代碼行數:43,代碼來源:GolemGuiTexture.java

示例11: loadTexture

import net.minecraft.client.renderer.texture.TextureUtil; //導入方法依賴的package包/類
@Override
public void loadTexture(IResourceManager var1) throws IOException
{
    TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedImage, false, false);
}
 
開發者ID:Ivorforce,項目名稱:IvToolkit,代碼行數:6,代碼來源:PreBufferedTexture.java


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