当前位置: 首页>>代码示例>>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;未经允许,请勿转载。