public static void renderTexturedQuad(float par1, float par2, float par3, float par4) { Tessellator par0Tessellator = Tessellator.getInstance(); VertexBuffer renderer = par0Tessellator.getBuffer(); renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM); renderer.pos(0, 0, 0).tex((double) par1, (double) par4).normal(0, 0, 1).endVertex(); renderer.pos(1, 0, 0).tex((double) par3, (double) par4).normal(0, 0, 1).endVertex(); renderer.pos(1, 1, 0).tex((double) par3, (double) par2).normal(0, 0, 1).endVertex(); renderer.pos(0, 1, 0).tex((double) par1, (double) par2).normal(0, 0, 1).endVertex(); par0Tessellator.draw(); }
buffer.pos(bounds.minX, bounds.minY, bounds.minZ).color(r, g, b, a).tex(minU, minV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); buffer.pos(bounds.maxX, bounds.minY, bounds.minZ).color(r, g, b, a).tex(maxU, minV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); buffer.pos(bounds.maxX, bounds.minY, bounds.maxZ).color(r, g, b, a).tex(maxU, maxV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); buffer.pos(bounds.minX, bounds.minY, bounds.maxZ).color(r, g, b, a).tex(minU, maxV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); break; case UP: buffer.pos(bounds.minX, bounds.maxY, bounds.minZ).color(r, g, b, a).tex(minU, minV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); buffer.pos(bounds.minX, bounds.maxY, bounds.maxZ).color(r, g, b, a).tex(minU, maxV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); buffer.pos(bounds.maxX, bounds.maxY, bounds.maxZ).color(r, g, b, a).tex(maxU, maxV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); buffer.pos(bounds.maxX, bounds.maxY, bounds.minZ).color(r, g, b, a).tex(maxU, minV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); break; case NORTH: buffer.pos(bounds.minX, bounds.minY, bounds.minZ).color(r, g, b, a).tex(minU, maxV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); buffer.pos(bounds.minX, bounds.maxY, bounds.minZ).color(r, g, b, a).tex(minU, minV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); buffer.pos(bounds.maxX, bounds.maxY, bounds.minZ).color(r, g, b, a).tex(maxU, minV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); buffer.pos(bounds.maxX, bounds.minY, bounds.minZ).color(r, g, b, a).tex(maxU, maxV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); break; case SOUTH: buffer.pos(bounds.minX, bounds.minY, bounds.maxZ).color(r, g, b, a).tex(maxU, maxV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); buffer.pos(bounds.maxX, bounds.minY, bounds.maxZ).color(r, g, b, a).tex(minU, maxV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); buffer.pos(bounds.maxX, bounds.maxY, bounds.maxZ).color(r, g, b, a).tex(minU, minV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); buffer.pos(bounds.minX, bounds.maxY, bounds.maxZ).color(r, g, b, a).tex(maxU, minV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); break; case WEST: buffer.pos(bounds.minX, bounds.minY, bounds.minZ).color(r, g, b, a).tex(maxU, maxV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); buffer.pos(bounds.minX, bounds.minY, bounds.maxZ).color(r, g, b, a).tex(minU, maxV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); buffer.pos(bounds.minX, bounds.maxY, bounds.maxZ).color(r, g, b, a).tex(minU, minV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); buffer.pos(bounds.minX, bounds.maxY, bounds.minZ).color(r, g, b, a).tex(maxU, minV).lightmap(brightnessHighBits, brightnessLowBits).endVertex(); break;
private void drawChar(final float x, final char ch, final VertexBuffer buffer) { if (Character.isWhitespace(ch) || Character.isISOControl(ch)) { return; } final int index = getCharIndex(ch); final int column = index % COLUMNS; final int row = index / COLUMNS; final float u = column * U_STEP; final float v = row * V_STEP; buffer.pos(x, getCharHeight(), 0).tex(u, v + V_SIZE).endVertex(); buffer.pos(x + getCharWidth(), getCharHeight(), 0).tex(u + U_SIZE, v + V_SIZE).endVertex(); buffer.pos(x + getCharWidth(), 0, 0).tex(u + U_SIZE, v).endVertex(); buffer.pos(x, 0, 0).tex(u, v).endVertex(); }
/** * Draw a full one-by-one, untextured quad. * * @param x the x position of the quad. * @param y the y position of the quad. * @param w the width of the quad. * @param h the height of the quad. */ @SideOnly(Side.CLIENT) public static void drawUntexturedQuad(final float x, final float y, final float w, final float h) { final Tessellator tessellator = Tessellator.getInstance(); final VertexBuffer buffer = tessellator.getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); buffer.pos(x, y + h, 0).endVertex(); buffer.pos(x + w, y + h, 0).endVertex(); buffer.pos(x + w, y, 0).endVertex(); buffer.pos(x, y, 0).endVertex(); tessellator.draw(); }
vertexbuffer.setTranslation(-d0, -d1, -d2); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); vertexbuffer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); int k3 = j3 >> 16 & 65535; int l3 = j3 & 65535; vertexbuffer.pos((double)l1 - d3 + 0.5D, (double)l2, (double)k1 - d4 + 0.5D).tex(0.0D, (double)k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex(); vertexbuffer.pos((double)l1 + d3 + 0.5D, (double)l2, (double)k1 + d4 + 0.5D).tex(1.0D, (double)k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex(); vertexbuffer.pos((double)l1 + d3 + 0.5D, (double)k2, (double)k1 + d4 + 0.5D).tex(1.0D, (double)l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex(); vertexbuffer.pos((double)l1 - d3 + 0.5D, (double)k2, (double)k1 - d4 + 0.5D).tex(0.0D, (double)l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex(); } else { if (j1 != 1) { vertexbuffer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); int j4 = i4 >> 16 & 65535; int k4 = i4 & 65535; vertexbuffer.pos((double)l1 - d3 + 0.5D, (double)l2, (double)k1 - d4 + 0.5D).tex(0.0D + d9, (double)k2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex(); vertexbuffer.pos((double)l1 + d3 + 0.5D, (double)l2, (double)k1 + d4 + 0.5D).tex(1.0D + d9, (double)k2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex(); vertexbuffer.pos((double)l1 + d3 + 0.5D, (double)k2, (double)k1 + d4 + 0.5D).tex(1.0D + d9, (double)l2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex(); vertexbuffer.pos((double)l1 - d3 + 0.5D, (double)k2, (double)k1 - d4 + 0.5D).tex(0.0D + d9, (double)l2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex(); vertexbuffer.setTranslation(0.0D, 0.0D, 0.0D); GlStateManager.enableCull(); GlStateManager.disableBlend();
@Override protected void setupRender(BuildingAccess world) { for (BlockRenderLayer layer: BlockRenderLayer.values()) { VertexBuffer buffer = renderer.getWorldRendererByLayer(layer); buffer.begin(7, DefaultVertexFormats.BLOCK); world.getBlockMap().entrySet().stream().filter(placeable -> placeable.getKey().getY() != 0) .forEach(placeable -> addRender(world, placeable.getValue(), placeable.getKey(), layer, buffer)); } } }
worldRendererIn.begin(7, DefaultVertexFormats.BLOCK); worldRendererIn.setTranslation(-d0, -d1, -d2); worldRendererIn.noColor(); worldRendererIn.setTranslation(0.0D, 0.0D, 0.0D); renderGlobal.postRenderDamagedBlocks();
vb.begin(GL_QUADS, DefaultVertexFormats.BLOCK); double ty = -blockpos.getY(); double tz = -blockpos.getZ() - 0.5; vb.setTranslation(tx, ty, tz); vb.setTranslation(0, 0, 0);
/** * Draws a horizontal line of the specified height. * * @param height the height of the line to draw. */ @SideOnly(Side.CLIENT) private static void drawLine(final int height) { GlStateManager.depthMask(false); GlStateManager.disableTexture2D(); final Tessellator tessellator = Tessellator.getInstance(); final VertexBuffer buffer = tessellator.getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); buffer.pos(-0.5f, height + 0.5f, 0).endVertex(); buffer.pos(71.5f, height + 0.5f, 0).endVertex(); buffer.pos(71.5f, -0.5f, 0).endVertex(); buffer.pos(-0.5f, -0.5f, 0).endVertex(); tessellator.draw(); GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); }
protected void setupRender(BuildingAccess world) { for (BlockRenderLayer layer: BlockRenderLayer.values()) { VertexBuffer buffer = renderer.getWorldRendererByLayer(layer); buffer.begin(7, DefaultVertexFormats.BLOCK); for (Entry<BlockPos, IBlockState> placeable: world.getBlockMap().entrySet()) { addRender(world, placeable.getValue(), placeable.getKey(), layer, buffer); } } }
/** * Draws a textured rectangle at the stored z-value. Args: x, y, u, v, width, height */ public void drawTexturedModalRect(Tessellator tessellator, int x, int y, int width, int height, int zLevel) { tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); tessellator.getBuffer().pos((double) (x), (double) (y + height), (double) zLevel).tex(0F, 1F).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y + height), (double) zLevel).tex(1F, 1F).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y), (double) zLevel).tex(1F, 0F).endVertex(); tessellator.getBuffer().pos((double) (x), (double) (y), (double) zLevel).tex(0F, 0F).endVertex(); tessellator.draw(); }
public static void drawRect2(int x1, int y1, int x2, int y2, int colour) { int j1; if (x1 < x2) { j1 = x1; x1 = x2; x2 = j1; } if (y1 < y2) { j1 = y1; y1 = y2; y2 = j1; } float f = (float)(colour >> 24 & 255) / 255.0F; float f1 = (float)(colour >> 16 & 255) / 255.0F; float f2 = (float)(colour >> 8 & 255) / 255.0F; float f3 = (float)(colour & 255) / 255.0F; Tessellator tessellator = Tessellator.getInstance(); GlStateManager.color(f1, f2, f3, f); tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); tessellator.getBuffer().pos((double) x1, (double) y2, 0).endVertex(); tessellator.getBuffer().pos((double) x2, (double) y2, 0).endVertex(); tessellator.getBuffer().pos((double) x2, (double) y1, 0).endVertex(); tessellator.getBuffer().pos((double) x1, (double) y1, 0).endVertex(); tessellator.draw(); }
public void drawString(final CharSequence value, final int maxChars) { GlStateManager.pushMatrix(); GlStateManager.depthMask(false); Minecraft.getMinecraft().getTextureManager().bindTexture(getTextureLocation()); final Tessellator tessellator = Tessellator.getInstance(); final VertexBuffer buffer = tessellator.getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); float tx = 0f; final int end = Math.min(maxChars, value.length()); for (int i = 0; i < end; i++) { final char ch = value.charAt(i); drawChar(tx, ch, buffer); tx += getCharWidth() + getGapU(); } tessellator.draw(); GlStateManager.depthMask(true); GlStateManager.popMatrix(); }
private void setupRender(int xBase, int yBase, int uBase, int vBase) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); minecraft.getTextureManager().bindTexture(Gui.statIcons); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer wr = tessellator.getBuffer(); wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); wr.pos((double) (xBase), (double) (yBase + 18), zLevel).tex((double) ((float) (uBase) * 0.0078125F), (double) ((float) (vBase + 18) * 0.0078125F)).endVertex(); wr.pos((double) (xBase + 18), (double) (yBase + 18), zLevel).tex((double) ((float) (uBase + 18) * 0.0078125F), (double) ((float) (vBase + 18) * 0.0078125F)).endVertex(); wr.pos((double) (xBase + 18), (double) (yBase), zLevel).tex((double) ((float) (uBase + 18) * 0.0078125F), (double) ((float) (vBase) * 0.0078125F)).endVertex(); wr.pos((double) (xBase), (double) (yBase), zLevel).tex((double) ((float) (uBase) * 0.0078125F), (double) ((float) (vBase) * 0.0078125F)).endVertex(); wr.finishDrawing(); } }
GlStateManager.enableColorLogic(); GlStateManager.colorLogicOp(GlStateManager.LogicOp.OR_REVERSE); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); buffer.pos((double) startX, (double) endY, 0.0D).endVertex(); buffer.pos((double) endX, (double) endY, 0.0D).endVertex(); buffer.pos((double) endX, (double) startY, 0.0D).endVertex(); buffer.pos((double) startX, (double) startY, 0.0D).endVertex(); tessellator.draw(); GlStateManager.disableColorLogic();
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()) { 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()) {
public void drawTexturedModalRect(int x, int y, int width, int height, int tex_x, int tex_y, int tex_width, int tex_height) { Tessellator tessellator = Tessellator.getInstance(); tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); tessellator.getBuffer().pos((double) (x + 0), (double) (y + height), (double) this.zLevel).tex((double) ((float) (tex_x + 0)), (double) ((float) (tex_y + tex_height))).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y + height), (double) this.zLevel).tex((double) ((float) (tex_x + tex_width)), (double) ((float) (tex_y + tex_height))).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y + 0), (double) this.zLevel).tex((double) ((float) (tex_x + tex_width)), (double) ((float) (tex_y + 0))).endVertex(); tessellator.getBuffer().pos((double) (x + 0), (double) (y + 0), (double) this.zLevel).tex((double) ((float) (tex_x + 0)), (double) ((float) (tex_y + 0))).endVertex(); tessellator.draw(); }
VertexBuffer buffer = tessellator.getBuffer(); bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
public void drawTexturedModalRect(int x, int y, int width, int height, int tex_x, int tex_y, int tex_width, int tex_height) { Tessellator tessellator = Tessellator.getInstance(); tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); tessellator.getBuffer().pos((double) (x + 0), (double) (y + height), (double) this.zLevel).tex((double) ((float) (tex_x + 0)), (double) ((float) (tex_y + tex_height))).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y + height), (double) this.zLevel).tex((double) ((float) (tex_x + tex_width)), (double) ((float) (tex_y + tex_height))).endVertex(); tessellator.getBuffer().pos((double) (x + width), (double) (y + 0), (double) this.zLevel).tex((double) ((float) (tex_x + tex_width)), (double) ((float) (tex_y + 0))).endVertex(); tessellator.getBuffer().pos((double) (x + 0), (double) (y + 0), (double) this.zLevel).tex((double) ((float) (tex_x + 0)), (double) ((float) (tex_y + 0))).endVertex(); tessellator.draw(); } }
vertexbuffer.begin(7, DefaultVertexFormats.BLOCK); BlockPos blockpos = new BlockPos(entity.posX, entity.getEntityBoundingBox().maxY, entity.posZ); GlStateManager.translate((float)(x - (double)blockpos.getX() - 0.5D), (float)(y - (double)blockpos.getY() + 0.5F), (float)(z - (double)blockpos.getZ() - 0.5D));