本文整理汇总了Java中net.minecraft.client.renderer.texture.TextureAtlasSprite.getInterpolatedV方法的典型用法代码示例。如果您正苦于以下问题:Java TextureAtlasSprite.getInterpolatedV方法的具体用法?Java TextureAtlasSprite.getInterpolatedV怎么用?Java TextureAtlasSprite.getInterpolatedV使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.renderer.texture.TextureAtlasSprite
的用法示例。
在下文中一共展示了TextureAtlasSprite.getInterpolatedV方法的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;
}
}
}
示例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();
}
示例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);
}
示例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;
}
}
}
示例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);
}