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


Java TextureAtlasSprite.getInterpolatedU方法代碼示例

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


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

示例1: putVertex

import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入方法依賴的package包/類
private void putVertex(UnpackedBakedQuad.Builder builder, Vec3d normal, double x, double y, double z, TextureAtlasSprite sprite, float u, float v) {
    for (int e = 0; e < format.getElementCount(); e++) {
        switch (format.getElement(e).getUsage()) {
            case POSITION:
                builder.put(e, (float)x, (float)y, (float)z, 1.0f);
                break;
            case COLOR:
                builder.put(e, 1.0f, 1.0f, 1.0f, 1.0f);
                break;
            case UV:
                if (format.getElement(e).getIndex() == 0) {
                    u = sprite.getInterpolatedU(u);
                    v = sprite.getInterpolatedV(v);
                    builder.put(e, u, v, 0f, 1f);
                    break;
                }
            case NORMAL:
                builder.put(e, (float) normal.x, (float) normal.y, (float) normal.z, 0f);
                break;
            default:
                builder.put(e);
                break;
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:26,代碼來源:PressureGlassBakedModel.java

示例2: ribbon

import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入方法依賴的package包/類
private static void ribbon(float x1, float y1, float z1, float x2, float y2, float z2, float width, TextureAtlasSprite tas, float r, float g, float b, float light1, float light2) {
	
	
	Tessellator tess = Tessellator.getInstance();
	BufferBuilder vb = tess.getBuffer();
	
	float minU = tas.getInterpolatedU(4);
	float minV = tas.getInterpolatedV(4);
	float maxU = tas.getInterpolatedU(12);
	float maxV = tas.getInterpolatedV(12);
	
	//GlStateManager.color(r, g, b);
	
	//vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
	vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
	//if (renderSides) {
	
	vb.pos(x1, y1, z1).tex(minU, maxV).color(r*light1, g*light1, b*light1, 1.0f).endVertex();
	vb.pos(x2, y2, z2).tex(maxU, maxV).color(r*light2, g*light2, b*light2, 1.0f).endVertex();
	vb.pos(x2, y2+width, z2).tex(maxU, minV).color(r*light2, g*light2, b*light2, 1.0f).endVertex();
	vb.pos(x1, y1+width, z1).tex(minU, minV).color(r*light1, g*light1, b*light1, 1.0f).endVertex();

	tess.draw();
}
 
開發者ID:elytra,項目名稱:Thermionics,代碼行數:25,代碼來源:LayerScarf.java

示例3: genQuad

import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入方法依賴的package包/類
/**
 * Generates a Front/Back quad for an itemmodel. Therefore only supports facing NORTH and SOUTH.
 * Coordinates are [0,16] to match the usual coordinates used in TextureAtlasSprites
 */
public static UnpackedBakedQuad genQuad(VertexFormat format, TRSRTransformation transform, float x1, float y1, float x2, float y2, float z, TextureAtlasSprite sprite, EnumFacing facing, int color)
{
    float u1 = sprite.getInterpolatedU(x1);
    float v1 = sprite.getInterpolatedV(y1);
    float u2 = sprite.getInterpolatedU(x2);
    float v2 = sprite.getInterpolatedV(y2);

    x1 /= 16f;
    y1 /= 16f;
    x2 /= 16f;
    y2 /= 16f;

    float tmp = y1;
    y1 = 1f - y2;
    y2 = 1f - tmp;

    return putQuad(format, transform, facing, sprite, color, x1, y1, x2, y2, z, u1, v1, u2, v2);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:23,代碼來源:ItemTextureQuadConverter.java

示例4: putVertex

import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入方法依賴的package包/類
private void putVertex(UnpackedBakedQuad.Builder builder, Vector3 normal, double x, double y, double z, TextureAtlasSprite sprite, float u, float v, boolean hasBrightness) {
	for(int e = 0; e < format.getElementCount(); e++) {
		switch(format.getElement(e).getUsage()) {
			case POSITION:
				builder.put(e, (float) x, (float) y, (float) z, 1F);
				break;
			case COLOR:
				builder.put(e, 1F, 1F, 1F, 1F);
				break;
			case UV:
				if(!ClientProxy.isOptifineInstalled() && format.getElement(e).getIndex() == 1) {
					if(hasBrightness) {
						builder.put(e, 1F, 1F);
					} else {
						builder.put(e, 0F, 0F);
					}
					break;
				} else if(format.getElement(e).getIndex() == 0) {
					u = sprite.getInterpolatedU(u);
					v = sprite.getInterpolatedV(v);
					builder.put(e, u, v, 0F, 1F);
					break;
				}
			case NORMAL:
				if(!ClientProxy.isOptifineInstalled() && hasBrightness) {
					builder.put(e, 0F, 1F, 0F);
				} else {
					builder.put(e, (float) normal.x, (float) normal.y, (float) normal.z);
				}
				break;
			default:
				builder.put(e);
				break;
		}
	}
}
 
開發者ID:ArekkuusuJerii,項目名稱:Solar,代碼行數:37,代碼來源:QuadBuilder.java

示例5: putTiledTextureQuads

import net.minecraft.client.renderer.texture.TextureAtlasSprite; //導入方法依賴的package包/類
/** Adds a quad to the rendering pipeline. Call startDrawingQuads beforehand. You need to call draw() yourself. */
static void putTiledTextureQuads(BufferBuilder renderer, int x, int y, int width, int height, float depth, TextureAtlasSprite sprite) {
    float u1 = sprite.getMinU();
    float v1 = sprite.getMinV();

    // tile vertically
    do {
        int renderHeight = Math.min(sprite.getIconHeight(), height);
        height -= renderHeight;

        float v2 = sprite.getInterpolatedV((16f * renderHeight) / (float) sprite.getIconHeight());

        // we need to draw the quads per width too
        int x2 = x;
        int width2 = width;
        // tile horizontally
        do {
            int renderWidth = Math.min(sprite.getIconWidth(), width2);
            width2 -= renderWidth;

            float u2 = sprite.getInterpolatedU((16f * renderWidth) / (float) sprite.getIconWidth());

            renderer.pos(x2, y, depth).tex(u1, v1).endVertex();
            renderer.pos(x2, y + renderHeight, depth).tex(u1, v2).endVertex();
            renderer.pos(x2 + renderWidth, y + renderHeight, depth).tex(u2, v2).endVertex();
            renderer.pos(x2 + renderWidth, y, depth).tex(u2, v1).endVertex();

            x2 += renderWidth;
        } while(width2 > 0);

        y += renderHeight;
    } while(height > 0);
}
 
開發者ID:LasmGratel,項目名稱:FoodCraft-Reloaded,代碼行數:34,代碼來源:GuiUtils.java


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