本文整理匯總了Java中net.minecraft.client.renderer.VertexBuffer類的典型用法代碼示例。如果您正苦於以下問題:Java VertexBuffer類的具體用法?Java VertexBuffer怎麽用?Java VertexBuffer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
VertexBuffer類屬於net.minecraft.client.renderer包,在下文中一共展示了VertexBuffer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: renderBoxOutline
import net.minecraft.client.renderer.VertexBuffer; //導入依賴的package包/類
private static void renderBoxOutline(BlockPos pos) {
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
Minecraft.getMinecraft().entityRenderer.disableLightmap();
GlStateManager.disableTexture2D();
GlStateManager.disableBlend();
GlStateManager.disableLighting();
GlStateManager.disableAlpha();
GlStateManager.glLineWidth(2);
GlStateManager.color(1, 1, 1);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
float mx = pos.getX();
float my = pos.getY();
float mz = pos.getZ();
buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
RenderHelper.renderHighLightedBlocksOutline(buffer, mx, my, mz, .9f, .7f, 0, 1);
tessellator.draw();
Minecraft.getMinecraft().entityRenderer.enableLightmap();
GlStateManager.enableTexture2D();
}
示例2: pushEntity
import net.minecraft.client.renderer.VertexBuffer; //導入依賴的package包/類
public static void pushEntity(IBlockState blockState, BlockPos blockPos, IBlockAccess blockAccess, VertexBuffer wrr)
{
Block block = blockState.getBlock();
int i;
int j;
if (blockState instanceof BlockStateBase)
{
BlockStateBase blockstatebase = (BlockStateBase)blockState;
i = blockstatebase.getBlockId();
j = blockstatebase.getMetadata();
}
else
{
i = Block.getIdFromBlock(block);
j = block.getMetaFromState(blockState);
}
i = BlockAliases.getMappedBlockId(i, j);
int i1 = block.getRenderType(blockState).ordinal();
int k = ((i1 & 65535) << 16) + (i & 65535);
int l = j & 65535;
wrr.sVertexBuilder.pushEntity(((long)l << 32) + (long)k);
}
示例3: endAddVertex
import net.minecraft.client.renderer.VertexBuffer; //導入依賴的package包/類
public static void endAddVertex(VertexBuffer wrr)
{
SVertexBuilder svertexbuilder = wrr.sVertexBuilder;
if (svertexbuilder.vertexSize == 14)
{
if (wrr.drawMode == 7 && wrr.vertexCount % 4 == 0)
{
svertexbuilder.calcNormal(wrr, wrr.getBufferSize() - 4 * svertexbuilder.vertexSize);
}
long i = svertexbuilder.entityData[svertexbuilder.entityDataIndex];
int j = wrr.getBufferSize() - 14 + 12;
wrr.rawIntBuffer.put(j, (int)i);
wrr.rawIntBuffer.put(j + 1, (int)(i >> 32));
}
}
示例4: renderBox
import net.minecraft.client.renderer.VertexBuffer; //導入依賴的package包/類
private void renderBox(Tessellator p_190055_1_, VertexBuffer p_190055_2_, double p_190055_3_, double p_190055_5_, double p_190055_7_, double p_190055_9_, double p_190055_11_, double p_190055_13_, int p_190055_15_, int p_190055_16_, int p_190055_17_)
{
GlStateManager.glLineWidth(2.0F);
p_190055_2_.begin(3, DefaultVertexFormats.POSITION_COLOR);
p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_7_).color((float)p_190055_16_, (float)p_190055_16_, (float)p_190055_16_, 0.0F).endVertex();
p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_7_).color(p_190055_16_, p_190055_17_, p_190055_17_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_7_).color(p_190055_17_, p_190055_17_, p_190055_16_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_7_).color(p_190055_17_, p_190055_16_, p_190055_17_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_7_).color((float)p_190055_16_, (float)p_190055_16_, (float)p_190055_16_, 0.0F).endVertex();
p_190055_1_.draw();
GlStateManager.glLineWidth(1.0F);
}
示例5: renderQuadColorSlow
import net.minecraft.client.renderer.VertexBuffer; //導入依賴的package包/類
public static void renderQuadColorSlow(VertexBuffer wr, BakedQuad quad, int auxColor)
{
ItemConsumer cons;
if(wr == Tessellator.getInstance().getBuffer())
{
cons = getItemConsumer();
}
else
{
cons = new ItemConsumer(new VertexBufferConsumer(wr));
}
float b = (float)(auxColor & 0xFF) / 0xFF;
float g = (float)((auxColor >>> 8) & 0xFF) / 0xFF;
float r = (float)((auxColor >>> 16) & 0xFF) / 0xFF;
float a = (float)((auxColor >>> 24) & 0xFF) / 0xFF;
cons.setAuxColor(r, g, b, a);
quad.pipe(cons);
}
示例6: renderParticle
import net.minecraft.client.renderer.VertexBuffer; //導入依賴的package包/類
/**
* Renders the particle
*/
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = this.particleTexture.getMinU();
float f1 = this.particleTexture.getMaxU();
float f2 = this.particleTexture.getMinV();
float f3 = this.particleTexture.getMaxV();
float f4 = 0.5F;
float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
int i = this.getBrightnessForRender(partialTicks);
int j = i >> 16 & 65535;
int k = i & 65535;
worldRendererIn.pos((double)(f5 - rotationX * 0.5F - rotationXY * 0.5F), (double)(f6 - rotationZ * 0.5F), (double)(f7 - rotationYZ * 0.5F - rotationXZ * 0.5F)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
worldRendererIn.pos((double)(f5 - rotationX * 0.5F + rotationXY * 0.5F), (double)(f6 + rotationZ * 0.5F), (double)(f7 - rotationYZ * 0.5F + rotationXZ * 0.5F)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
worldRendererIn.pos((double)(f5 + rotationX * 0.5F + rotationXY * 0.5F), (double)(f6 + rotationZ * 0.5F), (double)(f7 + rotationYZ * 0.5F + rotationXZ * 0.5F)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
worldRendererIn.pos((double)(f5 + rotationX * 0.5F - rotationXY * 0.5F), (double)(f6 - rotationZ * 0.5F), (double)(f7 + rotationYZ * 0.5F - rotationXZ * 0.5F)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
}
示例7: renderLitParticles
import net.minecraft.client.renderer.VertexBuffer; //導入依賴的package包/類
public void renderLitParticles(Entity entityIn, float partialTick)
{
float f = 0.017453292F;
float f1 = MathHelper.cos(entityIn.rotationYaw * 0.017453292F);
float f2 = MathHelper.sin(entityIn.rotationYaw * 0.017453292F);
float f3 = -f2 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F);
float f4 = f1 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F);
float f5 = MathHelper.cos(entityIn.rotationPitch * 0.017453292F);
for (int i = 0; i < 2; ++i)
{
Queue<Particle> queue = this.fxLayers[3][i];
if (!queue.isEmpty())
{
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
for (Particle particle : queue)
{
particle.renderParticle(vertexbuffer, entityIn, partialTick, f1, f5, f2, f3, f4);
}
}
}
}
示例8: drawItemBackground
import net.minecraft.client.renderer.VertexBuffer; //導入依賴的package包/類
private void drawItemBackground(int x, int z, int textureX, int textureY)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(Gui.STAT_ICONS);
float f = 0.0078125F;
float f1 = 0.0078125F;
int i = 18;
int j = 18;
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
vertexbuffer.pos((double)(x + 0), (double)(z + 18), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(textureX + 0) * 0.0078125F), (double)((float)(textureY + 18) * 0.0078125F)).endVertex();
vertexbuffer.pos((double)(x + 18), (double)(z + 18), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(textureX + 18) * 0.0078125F), (double)((float)(textureY + 18) * 0.0078125F)).endVertex();
vertexbuffer.pos((double)(x + 18), (double)(z + 0), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(textureX + 18) * 0.0078125F), (double)((float)(textureY + 0) * 0.0078125F)).endVertex();
vertexbuffer.pos((double)(x + 0), (double)(z + 0), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(textureX + 0) * 0.0078125F), (double)((float)(textureY + 0) * 0.0078125F)).endVertex();
tessellator.draw();
}
示例9: compileDisplayList
import net.minecraft.client.renderer.VertexBuffer; //導入依賴的package包/類
/**
* Compiles a GL display list for this model
*/
private void compileDisplayList(float scale)
{
if (this.displayList == 0)
{
this.savedScale = scale;
this.displayList = GLAllocation.generateDisplayLists(1);
}
GlStateManager.glNewList(this.displayList, 4864);
VertexBuffer vertexbuffer = Tessellator.getInstance().getBuffer();
for (int i = 0; i < this.cubeList.size(); ++i)
{
((ModelBox)this.cubeList.get(i)).render(vertexbuffer, scale);
}
for (int j = 0; j < this.spriteList.size(); ++j)
{
ModelSprite modelsprite = (ModelSprite)this.spriteList.get(j);
modelsprite.render(Tessellator.getInstance(), scale);
}
GlStateManager.glEndList();
this.compiled = true;
}
示例10: drawSprite
import net.minecraft.client.renderer.VertexBuffer; //導入依賴的package包/類
/**
* Draws a sprite from assets/textures/gui/container/stats_icons.png
*/
private void drawSprite(int p_146527_1_, int p_146527_2_, int p_146527_3_, int p_146527_4_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(STAT_ICONS);
float f = 0.0078125F;
float f1 = 0.0078125F;
int i = 18;
int j = 18;
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
vertexbuffer.pos((double)(p_146527_1_ + 0), (double)(p_146527_2_ + 18), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 0) * 0.0078125F), (double)((float)(p_146527_4_ + 18) * 0.0078125F)).endVertex();
vertexbuffer.pos((double)(p_146527_1_ + 18), (double)(p_146527_2_ + 18), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 18) * 0.0078125F), (double)((float)(p_146527_4_ + 18) * 0.0078125F)).endVertex();
vertexbuffer.pos((double)(p_146527_1_ + 18), (double)(p_146527_2_ + 0), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 18) * 0.0078125F), (double)((float)(p_146527_4_ + 0) * 0.0078125F)).endVertex();
vertexbuffer.pos((double)(p_146527_1_ + 0), (double)(p_146527_2_ + 0), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 0) * 0.0078125F), (double)((float)(p_146527_4_ + 0) * 0.0078125F)).endVertex();
tessellator.draw();
}
示例11: renderPathLine
import net.minecraft.client.renderer.VertexBuffer; //導入依賴的package包/類
public void renderPathLine(float p_190067_1_, Path p_190067_2_)
{
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
for (int i = 0; i < p_190067_2_.getCurrentPathLength(); ++i)
{
PathPoint pathpoint = p_190067_2_.getPathPointFromIndex(i);
if (this.addDistanceToPlayer(pathpoint) <= 40.0F)
{
float f = (float)i / (float)p_190067_2_.getCurrentPathLength() * 0.33F;
int j = i == 0 ? 0 : MathHelper.hsvToRGB(f, 0.9F, 0.9F);
int k = j >> 16 & 255;
int l = j >> 8 & 255;
int i1 = j & 255;
vertexbuffer.pos((double)pathpoint.xCoord - this.xo + 0.5D, (double)pathpoint.yCoord - this.yo + 0.5D, (double)pathpoint.zCoord - this.zo + 0.5D).color(k, l, i1, 255).endVertex();
}
}
tessellator.draw();
}
示例12: renderParticle
import net.minecraft.client.renderer.VertexBuffer; //導入依賴的package包/類
/**
* Renders the particle
*/
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
f = MathHelper.clamp_float(f, 0.0F, 1.0F);
this.particleScale = this.oSize * f;
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
示例13: renderOverlay
import net.minecraft.client.renderer.VertexBuffer; //導入依賴的package包/類
/**
* Utility method for rendering a texture as the front-side overlay
* over a specified horizontal area.
*
* @param texture the texture to use to render the overlay.
* @param u0 the lower end of the vertical area to render at.
* @param u1 the upper end of the vertical area to render at.
*/
public void renderOverlay(final ResourceLocation texture, final float u0, final float u1) {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
final Tessellator t = Tessellator.getInstance();
final VertexBuffer r = t.getBuffer();
r.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
r.pos(u0, v1, 0).tex(u0, v1).endVertex();
r.pos(u1, v1, 0).tex(u1, v1).endVertex();
r.pos(u1, v0, 0).tex(u1, v0).endVertex();
r.pos(u0, v0, 0).tex(u0, v0).endVertex();
t.draw();
}
示例14: renderOverlayFromAtlas
import net.minecraft.client.renderer.VertexBuffer; //導入依賴的package包/類
/**
* Utility method for rendering an atlas texture as the front-side overlay
* over a specified horizontal area.
*
* @param texture the atlas texture to use to render the overlay.
* @param u0 the lower end of the vertical area to render at.
* @param u1 the upper end of the vertical area to render at.
*/
public void renderOverlayFromAtlas(final ResourceLocation texture, final float u0, final float u1) {
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
final TextureAtlasSprite icon = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(texture.toString());
final Tessellator t = Tessellator.getInstance();
final VertexBuffer r = t.getBuffer();
r.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
r.pos(u0, v1, 0).tex(icon.getInterpolatedU(u0 * 16), icon.getInterpolatedV(v1 * 16)).endVertex();
r.pos(u1, v1, 0).tex(icon.getInterpolatedU(u1 * 16), icon.getInterpolatedV(v1 * 16)).endVertex();
r.pos(u1, v0, 0).tex(icon.getInterpolatedU(u1 * 16), icon.getInterpolatedV(v0 * 16)).endVertex();
r.pos(u0, v0, 0).tex(icon.getInterpolatedU(u0 * 16), icon.getInterpolatedV(v0 * 16)).endVertex();
t.draw();
}
示例15: drawTexturedModalRect
import net.minecraft.client.renderer.VertexBuffer; //導入依賴的package包/類
/**
* Draws a texture rectangle using the texture currently bound to the TextureManager
*/
public void drawTexturedModalRect(int xCoord, int yCoord, TextureAtlasSprite textureSprite, int widthIn, int heightIn)
{
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
vertexbuffer.pos((double)(xCoord + 0), (double)(yCoord + heightIn), (double)this.zLevel).tex((double)textureSprite.getMinU(), (double)textureSprite.getMaxV()).endVertex();
vertexbuffer.pos((double)(xCoord + widthIn), (double)(yCoord + heightIn), (double)this.zLevel).tex((double)textureSprite.getMaxU(), (double)textureSprite.getMaxV()).endVertex();
vertexbuffer.pos((double)(xCoord + widthIn), (double)(yCoord + 0), (double)this.zLevel).tex((double)textureSprite.getMaxU(), (double)textureSprite.getMinV()).endVertex();
vertexbuffer.pos((double)(xCoord + 0), (double)(yCoord + 0), (double)this.zLevel).tex((double)textureSprite.getMinU(), (double)textureSprite.getMinV()).endVertex();
tessellator.draw();
}