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