Java Code Examples for net.minecraft.client.renderer.VertexBuffer#begin()
The following examples show how to use
net.minecraft.client.renderer.VertexBuffer#begin() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PotionNeuropozyne.java From Cyberware with MIT License | 6 votes |
@SideOnly(Side.CLIENT) private void render(int x, int y, float alpha) { Minecraft.getMinecraft().renderEngine.bindTexture(resource); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer buf = tessellator.getBuffer(); buf.begin(7, DefaultVertexFormats.POSITION_TEX); GlStateManager.color(1, 1, 1, alpha); int textureX = iconIndex % 8 * 18; int textureY = 198 + iconIndex / 8 * 18; buf.pos(x, y + 18, 0).tex(textureX * 0.00390625, (textureY + 18) * 0.00390625).endVertex(); buf.pos(x + 18, y + 18, 0).tex((textureX + 18) * 0.00390625, (textureY + 18) * 0.00390625).endVertex(); buf.pos(x + 18, y, 0).tex((textureX + 18) * 0.00390625, textureY * 0.00390625).endVertex(); buf.pos(x, y, 0).tex(textureX * 0.00390625, textureY * 0.00390625).endVertex(); tessellator.draw(); }
Example 2
Source File: ParticleAnvil.java From TFC2 with GNU General Public License v3.0 | 6 votes |
@Override public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { Tessellator tessellator = Tessellator.getInstance(); Core.bindTexture(getTexture()); if(((float)this.particleAge/(float)this.particleMaxAge) > 1) return; float scale = particleScale-(particleScale/2f)*((float)this.particleAge/(float)this.particleMaxAge); float posX = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) partialTicks - interpPosX); float posY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) partialTicks - interpPosY); float posZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTicks - interpPosZ); //rotationXY = 0; //rotationXZ = 0.05f; height = 1f; worldRendererIn.begin(7, getVertexFormat()); worldRendererIn.pos((double) (posX - rotationX * scale - rotationXY * scale), (posY - rotationZ * scale * height), (double) (posZ - rotationYZ * scale - rotationXZ * scale)).tex((double) 1, (double) 1).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).endVertex(); worldRendererIn.pos((double) (posX - rotationX * scale + rotationXY * scale), (posY + rotationZ * scale * height), (double) (posZ - rotationYZ * scale + rotationXZ * scale)).tex((double) 1, (double) 0).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).endVertex(); worldRendererIn.pos((double) (posX + rotationX * scale + rotationXY * scale), (posY + rotationZ * scale * height), (double) (posZ + rotationYZ * scale + rotationXZ * scale)).tex((double) 0, (double) 0).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).endVertex(); worldRendererIn.pos((double) (posX + rotationX * scale - rotationXY * scale), (posY - rotationZ * scale * height), (double) (posZ + rotationYZ * scale - rotationXZ * scale)).tex((double) 0, (double) 1).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).endVertex(); tessellator.draw(); }
Example 3
Source File: RenderCyberlimbHand.java From Cyberware with MIT License | 5 votes |
private void renderMapFirstPerson(ItemStack stack) { GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); GlStateManager.scale(0.38F, 0.38F, 0.38F); GlStateManager.disableLighting(); this.mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); GlStateManager.translate(-0.5F, -0.5F, 0.0F); GlStateManager.scale(0.0078125F, 0.0078125F, 0.0078125F); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX); vertexbuffer.pos(-7.0D, 135.0D, 0.0D).tex(0.0D, 1.0D).endVertex(); vertexbuffer.pos(135.0D, 135.0D, 0.0D).tex(1.0D, 1.0D).endVertex(); vertexbuffer.pos(135.0D, -7.0D, 0.0D).tex(1.0D, 0.0D).endVertex(); vertexbuffer.pos(-7.0D, -7.0D, 0.0D).tex(0.0D, 0.0D).endVertex(); tessellator.draw(); if (stack != null) { MapData mapdata = Items.FILLED_MAP.getMapData(stack, Minecraft.getMinecraft().theWorld); if (mapdata != null) { this.mc.entityRenderer.getMapItemRenderer().renderMap(mapdata, false); } } GlStateManager.enableLighting(); }
Example 4
Source File: GuiInventoryButton.java From TFC2 with GNU General Public License v3.0 | 5 votes |
public void drawIcon(int x, int y, int textureX, int textureY, int width, int height) { float f = 0.00390625F; float f1 = 0.00390625F; Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX); vertexbuffer.pos((double)(x + 0), (double)(y + 16), (double)this.zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex(); vertexbuffer.pos((double)(x + 16), (double)(y + 16), (double)this.zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex(); vertexbuffer.pos((double)(x + 16), (double)(y + 0), (double)this.zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex(); vertexbuffer.pos((double)(x + 0), (double)(y + 0), (double)this.zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex(); tessellator.draw(); }
Example 5
Source File: GuiKnappingButton.java From TFC2 with GNU General Public License v3.0 | 5 votes |
protected void drawLocal() { float f = 0.00390625F; float f1 = 0.00390625F; Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexBuffer = tessellator.getBuffer(); vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX); vertexBuffer.pos(xPosition + 0, yPosition + 16, this.zLevel).tex(0, 1).endVertex(); vertexBuffer.pos(xPosition + 16, yPosition + 16, this.zLevel).tex(1, 1).endVertex(); vertexBuffer.pos(xPosition + 16, yPosition + 0, this.zLevel).tex(1, 0).endVertex(); vertexBuffer.pos(xPosition + 0, yPosition + 0, this.zLevel).tex(0, 0).endVertex(); tessellator.draw(); }
Example 6
Source File: UICharComponent.java From TFC2 with GNU General Public License v3.0 | 5 votes |
protected float renderUnicodeChar(char ch, boolean italic) { int i = this.glyphWidth[ch] & 255; if (i == 0) { return 0.0F; } else { int j = ch / 256; this.loadGlyphTexture(j); int k = i >>> 4; int l = i & 15; float f = (float)k; float f1 = (float)(l + 1); float f2 = (float)(ch % 16 * 16) + f; float f3 = (float)((ch & 255) / 16 * 16); float f4 = f1 - f - 0.02F; float f5 = italic ? 1.0F : 0.0F; Tessellator tess = Tessellator.getInstance(); VertexBuffer buffer = tess.getBuffer(); GlStateManager.enableTexture2D(); buffer.begin(GL11.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_TEX); buffer.pos(this.xPos + (f4 / 2.0F + f5)*scale, this.yPos, zPos+zLevel).tex((f2 + f4) / 256.0F, (f3 + 15.98F) / 256.0F).endVertex(); buffer.pos(this.xPos + (f4 / 2.0F - f5)*scale, this.yPos + (7.99F)*scale, zPos+zLevel).tex((f2 + f4) / 256.0F, (f3) / 256.0F).endVertex(); buffer.pos(this.xPos + (f5)*scale, this.yPos, zPos+zLevel).tex(f2 / 256.0F, (f3 + 15.98F) / 256.0F).endVertex(); buffer.pos(this.xPos - (f5)*scale, this.yPos + (7.99F)*scale, zPos+zLevel).tex(f2 / 256.0F, (f3) / 256.0F).endVertex(); tess.draw(); xPos += ((f1 - f) / 2.0F + 1.0F)*scale; return (f1 - f) / 2.0F + 1.0F; } }
Example 7
Source File: RenderOverlayHandler.java From TFC2 with GNU General Public License v3.0 | 5 votes |
public void drawTexturedModalRect(float xCoord, float yCoord, int minU, int minV, int maxU, int maxV) { float f = 0.00390625F; float f1 = 0.00390625F; Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vb = tessellator.getBuffer(); vb.begin(7, DefaultVertexFormats.POSITION_TEX); vb.pos(xCoord + 0.0F, yCoord + maxV, 0).tex((minU + 0) * f, (minV + maxV) * f1).endVertex(); vb.pos(xCoord + maxU, yCoord + maxV, 0).tex((minU + maxU) * f, (minV + maxV) * f1).endVertex(); vb.pos(xCoord + maxU, yCoord + 0.0F, 0).tex((minU + maxU) * f, (minV + 0) * f1).endVertex(); vb.pos(xCoord + 0.0F, yCoord + 0.0F, 0).tex((minU + 0) * f, (minV + 0) * f1).endVertex(); tessellator.draw(); }
Example 8
Source File: AnvilHighlightHandler.java From TFC2 with GNU General Public License v3.0 | 5 votes |
public static void drawOutlinedBox(AxisAlignedBB aabb) { Tessellator tessellator = Tessellator.getInstance(); VertexBuffer buffer = tessellator.getBuffer(); buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION); buffer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex(); buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex(); buffer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex(); buffer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex(); buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex(); buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex(); tessellator.draw(); }
Example 9
Source File: RenderSieve.java From ExNihiloAdscensio with MIT License | 5 votes |
@Override public void renderTileEntityAt(TileSieve te, double x, double y, double z, float partialTicks, int destroyStage) { Tessellator tes = Tessellator.getInstance(); VertexBuffer wr = tes.getBuffer(); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); if (te.getTexture() != null) { TextureAtlasSprite icon = te.getTexture(); double minU = (double) icon.getMinU(); double maxU = (double) icon.getMaxU(); double minV = (double) icon.getMinV(); double maxV = (double) icon.getMaxV(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); double height = (100.0-te.getProgress()) / 100; float fillAmount = (float) (0.15625*height + 0.84375); wr.pos(0.0625f,fillAmount,0.0625f).tex(minU, minV).normal(0, 1, 0).endVertex(); wr.pos(0.0625f,fillAmount,0.9375f).tex(minU,maxV).normal(0, 1, 0).endVertex(); wr.pos(0.9375f,fillAmount,0.9375f).tex(maxU,maxV).normal(0, 1, 0).endVertex(); wr.pos(0.9375f,fillAmount,0.0625f).tex(maxU,minV).normal(0, 1, 0).endVertex(); tes.draw(); } GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); }
Example 10
Source File: RenderProjectileStone.java From ExNihiloAdscensio with MIT License | 5 votes |
@Override public void doRender(ProjectileStone entity, double x, double y, double z, float entityYaw, float partialTicks) { TextureAtlasSprite texture = getTexture(Blocks.STONE.getDefaultState()); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer buffer = tessellator.getBuffer(); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); double minU = (double) texture.getMinU(); double maxU = (double) texture.getMaxU(); double minV = (double) texture.getMinV(); double maxV = (double) texture.getMaxV(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); double size = 0.5; //bufferCuboid(buffer, 1, minU, minV, maxU, maxV, -8, -8, -8, 8, 8, 8); bufferCuboid(buffer, size, minU, minV, maxU, maxV, -4, -2, -2, -2, 2, 2); bufferCuboid(buffer, size, minU, minV, maxU, maxV, 4, 2, 2, 2, -2, -2); bufferCuboid(buffer, size, minU, minV, maxU, maxV, -2, -4, -2, 2, -2, 2); bufferCuboid(buffer, size, minU, minV, maxU, maxV, 2, 4, 2, -2, 2, -2); bufferCuboid(buffer, size, minU, minV, maxU, maxV, -2, -2, -4, 2, 2, -2); bufferCuboid(buffer, size, minU, minV, maxU, maxV, 2, 2, 4, -2, -2, 2); tessellator.draw(); GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); }
Example 11
Source File: UIComponent.java From TFC2 with GNU General Public License v3.0 | 5 votes |
public void draw(Tessellator tess, VertexBuffer buffer) { setupGL(); buffer.begin(GLMode, format); for(Vertex v : vertexList) { v.addVertex(buffer); } tess.draw(); }
Example 12
Source File: ClientUtils.java From Cyberware with MIT License | 5 votes |
public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height) { float zLevel = -10; float f = 0.00390625F; float f1 = 0.00390625F; Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX); vertexbuffer.pos((double)(x + 0), (double)(y + height), (double)zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex(); vertexbuffer.pos((double)(x + width), (double)(y + height), (double)zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex(); vertexbuffer.pos((double)(x + width), (double)(y + 0), (double)zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex(); vertexbuffer.pos((double)(x + 0), (double)(y + 0), (double)zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex(); tessellator.draw(); }
Example 13
Source File: RenderBarrel.java From ExNihiloAdscensio with MIT License | 4 votes |
@Override public void renderTileEntityAt(TileBarrel tile, double x, double y, double z, float partialTicks, int destroyStage) { Tessellator tessellator = Tessellator.getInstance(); VertexBuffer buffer = tessellator.getBuffer(); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); if (tile.getMode() != null) { float fillAmount = tile.getMode().getFilledLevelForRender(tile); if (fillAmount > 0) { Color color = tile.getMode().getColorForRender(); if (color == null) { color = Util.whiteColor; } TextureAtlasSprite icon = tile.getMode().getTextureForRender(tile); if (icon == null) icon = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite(); double minU = (double) icon.getMinU(); double maxU = (double) icon.getMaxU(); double minV = (double) icon.getMinV(); double maxV = (double) icon.getMaxV(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); buffer.pos(0.125f, fillAmount, 0.125f).tex(minU, minV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex(); buffer.pos(0.125f, fillAmount, 0.875f).tex(minU, maxV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex(); buffer.pos(0.875f, fillAmount, 0.875f).tex(maxU, maxV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex(); buffer.pos(0.875f, fillAmount, 0.125f).tex(maxU, minV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex(); tessellator.draw(); } } GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); }
Example 14
Source File: GuiVertTextField.java From pycode-minecraft with MIT License | 4 votes |
/** * Draws the current selection and a vertical line cursor in the text box. */ private void drawCursorVertical(int startX, int startY, int endX, int endY) { if (startX < endX) { int i = startX; startX = endX; endX = i; } if (startY < endY) { int j = startY; startY = endY; endY = j; } if (endX > this.xPosition + this.width) { endX = this.xPosition + this.width; } if (startX > this.xPosition + this.width) { startX = this.xPosition + this.width; } Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); GlStateManager.color(0.0F, 0.0F, 255.0F, 255.0F); GlStateManager.disableTexture2D(); GlStateManager.enableColorLogic(); GlStateManager.colorLogicOp(GlStateManager.LogicOp.OR_REVERSE); vertexbuffer.begin(7, DefaultVertexFormats.POSITION); vertexbuffer.pos((double)startX, (double)endY, 0.0D).endVertex(); vertexbuffer.pos((double)endX, (double)endY, 0.0D).endVertex(); vertexbuffer.pos((double)endX, (double)startY, 0.0D).endVertex(); vertexbuffer.pos((double)startX, (double)startY, 0.0D).endVertex(); tessellator.draw(); GlStateManager.disableColorLogic(); GlStateManager.enableTexture2D(); }
Example 15
Source File: AnvilHighlightHandler.java From TFC2 with GNU General Public License v3.0 | 4 votes |
public static void drawBox(AxisAlignedBB aabb, float[] color) { Tessellator tessellator = Tessellator.getInstance(); VertexBuffer buffer = tessellator.getBuffer(); //Top buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); //Bottom buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); //-x buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); //+x buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); //-z buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); //+z buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); }
Example 16
Source File: RenderInfestedLeaves.java From ExNihiloAdscensio with MIT License | 4 votes |
@Override public void renderTileEntityAt(TileInfestedLeaves tile, double x, double y, double z, float partialTicks, int destroyStage) { if(tile != null) { long seed = tile.getWorld().rand.nextLong(); int color = tile.getColor(); IBlockState leafBlock = tile.getLeafBlock(); IBakedModel leafModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(leafBlock); if(leafModel == null) { leafModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(Blocks.LEAVES.getDefaultState()); } List<BakedQuad> leafQuads = Lists.newArrayList(); for(EnumFacing side : EnumFacing.VALUES) { if(leafBlock.shouldSideBeRendered(tile.getWorld(), tile.getPos(), side)) { leafQuads.addAll(leafModel.getQuads(leafBlock, side, seed)); } } Tessellator tessellator = Tessellator.getInstance(); VertexBuffer buffer = tessellator.getBuffer(); bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); RenderHelper.disableStandardItemLighting(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM); for(BakedQuad quad : leafQuads) { LightUtil.renderQuadColor(buffer, quad, color); } tessellator.draw(); RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); } }
Example 17
Source File: SmallVesselHighlightHandler.java From TFC2 with GNU General Public License v3.0 | 4 votes |
public static void drawBox(AxisAlignedBB aabb, float[] color) { Tessellator tessellator = Tessellator.getInstance(); VertexBuffer buffer = tessellator.getBuffer(); //Top buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); //Bottom buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); //-x buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); //+x buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); //-z buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); //+z buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); }
Example 18
Source File: ParticleRenderer.java From Logistics-Pipes-2 with MIT License | 4 votes |
public void renderParticles(EntityPlayer aPlayer, float pTicks) { float f = ActiveRenderInfo.getRotationX(); float f1 = ActiveRenderInfo.getRotationZ(); float f2 = ActiveRenderInfo.getRotationYZ(); float f3 = ActiveRenderInfo.getRotationXY(); float f4 = ActiveRenderInfo.getRotationXZ(); EntityPlayer player = Minecraft.getMinecraft().player; if(player!=null) { Particle.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * pTicks; Particle.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * pTicks; Particle.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * pTicks; Particle.cameraViewDir = player.getLook(pTicks); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.alphaFunc(516, 0.003921569F); GlStateManager.disableCull(); GlStateManager.depthMask(false); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Tessellator tess = Tessellator.getInstance(); VertexBuffer buffer = tess.getBuffer(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); for(int i = 0; i < particles.size(); i ++) { if(!((ILP2Particle) particles.get(i)).isAdditive()) { particles.get(i).renderParticle(buffer, player, pTicks, f, f4, f1, f2, f3); } } tess.draw(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); for(int i = 0; i < particles.size(); i ++) { if(((ILP2Particle) particles.get(i)).isAdditive()) { particles.get(i).renderParticle(buffer, player, pTicks, f, f4, f1, f2, f3); } } tess.draw(); GlStateManager.enableCull(); GlStateManager.depthMask(true); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.disableBlend(); GlStateManager.alphaFunc(516, 0.1F); } }
Example 19
Source File: SmallVesselHighlightHandler.java From TFC2 with GNU General Public License v3.0 | 4 votes |
public static void drawFace(AxisAlignedBB aabb, float[] color, EnumFacing facing) { //TODO: Add UV coords for other faces Tessellator tessellator = Tessellator.getInstance(); VertexBuffer buffer = tessellator.getBuffer(); if(facing == EnumFacing.UP) { buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).tex(0, 1).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).tex(0, 0).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).tex(1, 0).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).tex(1, 1).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); } else if(facing == EnumFacing.DOWN) { buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); } else if(facing == EnumFacing.WEST) { buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); } else if(facing == EnumFacing.EAST) { buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); } else if(facing == EnumFacing.NORTH) { buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); } else if(facing == EnumFacing.SOUTH) { buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex(); tessellator.draw(); } }
Example 20
Source File: TextureHelper.java From malmo with MIT License | 4 votes |
public void render(float partialTicks, WorldClient world, Minecraft mc) { // Adapted from the End sky renderer - just fill with solid colour. GlStateManager.disableFog(); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); RenderHelper.disableStandardItemLighting(); GlStateManager.depthMask(false); GlStateManager.disableTexture2D(); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); for (int i = 0; i < 6; ++i) { GlStateManager.pushMatrix(); if (i == 1) { GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); } if (i == 2) { GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); } if (i == 3) { GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); } if (i == 4) { GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F); } if (i == 5) { GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F); } vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR); vertexbuffer.pos(-100.0D, -100.0D, -100.0D).color(this.r, this.g, this.b, 255).endVertex(); vertexbuffer.pos(-100.0D, -100.0D, 100.0D).color(this.r, this.g, this.b, 255).endVertex(); vertexbuffer.pos(100.0D, -100.0D, 100.0D).color(this.r, this.g, this.b, 255).endVertex(); vertexbuffer.pos(100.0D, -100.0D, -100.0D).color(this.r, this.g, this.b, 255).endVertex(); tessellator.draw(); GlStateManager.popMatrix(); } GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); GlStateManager.enableAlpha(); }