本文整理汇总了Java中net.minecraft.client.renderer.BufferBuilder.addVertexData方法的典型用法代码示例。如果您正苦于以下问题:Java BufferBuilder.addVertexData方法的具体用法?Java BufferBuilder.addVertexData怎么用?Java BufferBuilder.addVertexData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.renderer.BufferBuilder
的用法示例。
在下文中一共展示了BufferBuilder.addVertexData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderModel
import net.minecraft.client.renderer.BufferBuilder; //导入方法依赖的package包/类
private static void renderModel(IBakedModel model, VertexFormat fmt)
{
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
worldrenderer.begin(GL11.GL_QUADS, fmt);
for (BakedQuad bakedquad : model.getQuads(null, null, 0))
{
worldrenderer.addVertexData(bakedquad.getVertexData());
}
tessellator.draw();
}
示例2: addCuboid
import net.minecraft.client.renderer.BufferBuilder; //导入方法依赖的package包/类
public static void addCuboid(BufferBuilder buffer, BlockPos pos, float x1, float y1, float z1, float x2, float y2, float z2, TextureAtlasSprite sprite, int red, int green, int blue, int alpha) {
int color = (alpha & 0x0ff) << 24 | (blue & 0x0ff) << 16 | (green & 0x0ff) << 8 | (red & 0x0ff);
float spriteW = 16;
float spriteH = 16;
int b = 240;
// north
buffer.addVertexData(Ints.concat(
vertexToInts(x2, y2, z1, color, sprite, x2 * spriteW, y1 * spriteH),
vertexToInts(x2, y1, z1, color, sprite, x2 * spriteW, y2 * spriteH),
vertexToInts(x1, y1, z1, color, sprite, x1 * spriteW, y2 * spriteH),
vertexToInts(x1, y2, z1, color, sprite, x1 * spriteW, y1 * spriteH)));
buffer.putPosition(pos.getX(), pos.getY(), pos.getZ());
buffer.putBrightness4(b, b, b, b);
// south
buffer.addVertexData(Ints.concat(
vertexToInts(x1, y2, z2, color, sprite, x1 * spriteW, y1 * spriteH),
vertexToInts(x1, y1, z2, color, sprite, x1 * spriteW, y2 * spriteH),
vertexToInts(x2, y1, z2, color, sprite, x2 * spriteW, y2 * spriteH),
vertexToInts(x2, y2, z2, color, sprite, x2 * spriteW, y1 * spriteH)));
buffer.putPosition(pos.getX(), pos.getY(), pos.getZ());
buffer.putBrightness4(b, b, b, b);
// west
buffer.addVertexData(Ints.concat(
vertexToInts(x1, y2, z1, color, sprite, z1 * spriteW, y1 * spriteH),
vertexToInts(x1, y1, z1, color, sprite, z1 * spriteW, y2 * spriteH),
vertexToInts(x1, y1, z2, color, sprite, z2 * spriteW, y2 * spriteH),
vertexToInts(x1, y2, z2, color, sprite, z2 * spriteW, y1 * spriteH)));
buffer.putPosition(pos.getX(), pos.getY(), pos.getZ());
buffer.putBrightness4(b, b, b, b);
// east
buffer.addVertexData(Ints.concat(
vertexToInts(x2, y2, z2, color, sprite, z2 * spriteW, y1 * spriteH),
vertexToInts(x2, y1, z2, color, sprite, z2 * spriteW, y2 * spriteH),
vertexToInts(x2, y1, z1, color, sprite, z1 * spriteW, y2 * spriteH),
vertexToInts(x2, y2, z1, color, sprite, z1 * spriteW, y1 * spriteH)));
buffer.putPosition(pos.getX(), pos.getY(), pos.getZ());
buffer.putBrightness4(b, b, b, b);
// down
buffer.addVertexData(Ints.concat(
vertexToInts(x2, y1, z1, color, sprite, x2 * spriteW, z1 * spriteH),
vertexToInts(x2, y1, z2, color, sprite, x2 * spriteW, z2 * spriteH),
vertexToInts(x1, y1, z2, color, sprite, x1 * spriteW, z2 * spriteH),
vertexToInts(x1, y1, z1, color, sprite, x1 * spriteW, z1 * spriteH)));
buffer.putPosition(pos.getX(), pos.getY(), pos.getZ());
buffer.putBrightness4(b, b, b, b);
// up
buffer.addVertexData(Ints.concat(
vertexToInts(x1, y2, z1, color, sprite, x1 * spriteW, z1 * spriteH),
vertexToInts(x1, y2, z2, color, sprite, x1 * spriteW, z2 * spriteH),
vertexToInts(x2, y2, z2, color, sprite, x2 * spriteW, z2 * spriteH),
vertexToInts(x2, y2, z1, color, sprite, x2 * spriteW, z1 * spriteH)));
buffer.putPosition(pos.getX(), pos.getY(), pos.getZ());
buffer.putBrightness4(b, b, b, b);
}