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


Java BufferBuilder.addVertexData方法代碼示例

本文整理匯總了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();
}
 
開發者ID:BenjaminSutter,項目名稱:genera,代碼行數:12,代碼來源:ModelHandle.java

示例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);
}
 
開發者ID:the-realest-stu,項目名稱:Etheric,代碼行數:57,代碼來源:RenderUtil.java


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