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(); }
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); }
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)); } }
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); }
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); }
/** * 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(); }
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); } } } }
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(); }
/** * 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; }
/** * 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(); }
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(); }
/** * 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); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * Draw with the WorldRenderer */ public void draw(int posX, int posY, int texU, int texV, int width, int height, int red, int green, int blue, int alpha) { VertexBuffer vertexbuffer = Tessellator.getInstance().getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); float f = 0.00390625F; float f1 = 0.00390625F; vertexbuffer.pos((double)posX, (double)(posY + height), 0.0D).tex((double)((float)texU * 0.00390625F), (double)((float)(texV + height) * 0.00390625F)).color(red, green, blue, alpha).endVertex(); vertexbuffer.pos((double)(posX + width), (double)(posY + height), 0.0D).tex((double)((float)(texU + width) * 0.00390625F), (double)((float)(texV + height) * 0.00390625F)).color(red, green, blue, alpha).endVertex(); vertexbuffer.pos((double)(posX + width), (double)posY, 0.0D).tex((double)((float)(texU + width) * 0.00390625F), (double)((float)texV * 0.00390625F)).color(red, green, blue, alpha).endVertex(); vertexbuffer.pos((double)posX, (double)posY, 0.0D).tex((double)((float)texU * 0.00390625F), (double)((float)texV * 0.00390625F)).color(red, green, blue, alpha).endVertex(); Tessellator.getInstance().draw(); }
private void drawArrow(int x, int y, int colour) { TextureUtils.changeTexture("wrcbe:textures/gui/arrow.png"); new ColourARGB(colour).glColour(); Tessellator t = Tessellator.getInstance(); VertexBuffer buffer = t.getBuffer(); buffer.begin(7, DefaultVertexFormats.POSITION_TEX); buffer.pos(x + 0, y + 8, zLevel).tex( arrowdirection * 0.25, 1).endVertex(); buffer.pos(x + 8, y + 8, zLevel).tex( (arrowdirection + 1) * 0.25, 1).endVertex(); buffer.pos(x + 8, y + 0, zLevel).tex( (arrowdirection + 1) * 0.25, 0).endVertex(); buffer.pos(x + 0, y + 0, zLevel).tex( arrowdirection * 0.25, 0).endVertex(); t.draw(); }
@SideOnly(Side.CLIENT) public void tessellate(VertexBuffer vb){ vb.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_TEX_NORMAL); for (Triple<Point3i, Point3i, Point3i> face : faces) { vb.pos(vertices.get(face.getLeft().x).x, vertices.get(face.getLeft().x).y, vertices.get(face.getLeft().x).z) .tex(uvs.get(face.getLeft().y).x, uvs.get(face.getLeft().y).y) .normal(normals.get(face.getLeft().z).x, normals.get(face.getLeft().z).y, normals.get(face.getLeft().z).z).endVertex(); vb.pos(vertices.get(face.getMiddle().x).x, vertices.get(face.getMiddle().x).y, vertices.get(face.getMiddle().x).z) .tex(uvs.get(face.getMiddle().y).x, uvs.get(face.getMiddle().y).y) .normal(normals.get(face.getMiddle().z).x, normals.get(face.getMiddle().z).y, normals.get(face.getMiddle().z).z).endVertex(); vb.pos(vertices.get(face.getRight().x).x, vertices.get(face.getRight().x).y, vertices.get(face.getRight().x).z) .tex(uvs.get(face.getRight().y).x, uvs.get(face.getRight().y).y) .normal(normals.get(face.getRight().z).x, normals.get(face.getRight().z).y, normals.get(face.getRight().z).z).endVertex(); } }
private void draw(VertexBuffer renderer, int x, int y, int width, int height, int red, int green, int blue, int alpha) { renderer.begin(7, DefaultVertexFormats.POSITION_COLOR); renderer.pos(x + 0, y + 0, 0.0D).color(red, green, blue, alpha).endVertex(); renderer.pos(x + 0, y + height, 0.0D).color(red, green, blue, alpha).endVertex(); renderer.pos(x + width, y + height, 0.0D).color(red, green, blue, alpha).endVertex(); renderer.pos(x + width, y + 0, 0.0D).color(red, green, blue, alpha).endVertex(); Tessellator.getInstance().draw(); }
/** * Draws the screen and all the components in it. */ public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); this.list.drawScreen(mouseX, mouseY, partialTicks); this.drawCenteredString(this.fontRendererObj, this.title, this.width / 2, 2, 16777215); this.drawCenteredString(this.fontRendererObj, this.subtitle, this.width / 2, 12, 16777215); this.drawCenteredString(this.fontRendererObj, this.pageTitle, this.width / 2, 22, 16777215); super.drawScreen(mouseX, mouseY, partialTicks); if (this.confirmMode != 0) { drawRect(0, 0, this.width, this.height, Integer.MIN_VALUE); this.drawHorizontalLine(this.width / 2 - 91, this.width / 2 + 90, 99, -2039584); this.drawHorizontalLine(this.width / 2 - 91, this.width / 2 + 90, 185, -6250336); this.drawVerticalLine(this.width / 2 - 91, 99, 185, -2039584); this.drawVerticalLine(this.width / 2 + 90, 99, 185, -6250336); float f = 85.0F; float f1 = 180.0F; GlStateManager.disableLighting(); GlStateManager.disableFog(); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); this.mc.getTextureManager().bindTexture(OPTIONS_BACKGROUND); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); float f2 = 32.0F; vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); vertexbuffer.pos((double)(this.width / 2 - 90), 185.0D, 0.0D).tex(0.0D, 2.65625D).color(64, 64, 64, 64).endVertex(); vertexbuffer.pos((double)(this.width / 2 + 90), 185.0D, 0.0D).tex(5.625D, 2.65625D).color(64, 64, 64, 64).endVertex(); vertexbuffer.pos((double)(this.width / 2 + 90), 100.0D, 0.0D).tex(5.625D, 0.0D).color(64, 64, 64, 64).endVertex(); vertexbuffer.pos((double)(this.width / 2 - 90), 100.0D, 0.0D).tex(0.0D, 0.0D).color(64, 64, 64, 64).endVertex(); tessellator.draw(); this.drawCenteredString(this.fontRendererObj, I18n.format("createWorld.customize.custom.confirmTitle", new Object[0]), this.width / 2, 105, 16777215); this.drawCenteredString(this.fontRendererObj, I18n.format("createWorld.customize.custom.confirm1", new Object[0]), this.width / 2, 125, 16777215); this.drawCenteredString(this.fontRendererObj, I18n.format("createWorld.customize.custom.confirm2", new Object[0]), this.width / 2, 135, 16777215); this.confirm.drawButton(this.mc, mouseX, mouseY); this.cancel.drawButton(this.mc, mouseX, mouseY); } }
public static IVertexConsumer getTessellator() { if(tessellator == null) { Tessellator tes = Tessellator.getInstance(); VertexBuffer wr = tes.getBuffer(); tessellator = new VertexBufferConsumer(wr); } return tessellator; }
/** * Draws a solid color rectangle with the specified coordinates and color. */ public static void drawRect(int left, int top, int right, int bottom, int color) { if (left < right) { int i = left; left = right; right = i; } if (top < bottom) { int j = top; top = bottom; bottom = j; } float f3 = (float)(color >> 24 & 255) / 255.0F; float f = (float)(color >> 16 & 255) / 255.0F; float f1 = (float)(color >> 8 & 255) / 255.0F; float f2 = (float)(color & 255) / 255.0F; Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.color(f, f1, f2, f3); vertexbuffer.begin(7, DefaultVertexFormats.POSITION); vertexbuffer.pos((double)left, (double)bottom, 0.0D).endVertex(); vertexbuffer.pos((double)right, (double)bottom, 0.0D).endVertex(); vertexbuffer.pos((double)right, (double)top, 0.0D).endVertex(); vertexbuffer.pos((double)left, (double)top, 0.0D).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); }
private static long renderTime(int p_renderTime_0_, long p_renderTime_1_, int p_renderTime_3_, int p_renderTime_4_, int p_renderTime_5_, float p_renderTime_6_, VertexBuffer p_renderTime_7_) { long i = p_renderTime_1_ / 200000L; if (i < 3L) { return 0L; } else { p_renderTime_7_.pos((double)((float)p_renderTime_0_ + 0.5F), (double)(p_renderTime_6_ - (float)i + 0.5F), 0.0D).color(p_renderTime_3_, p_renderTime_4_, p_renderTime_5_, 255).endVertex(); p_renderTime_7_.pos((double)((float)p_renderTime_0_ + 0.5F), (double)(p_renderTime_6_ + 0.5F), 0.0D).color(p_renderTime_3_, p_renderTime_4_, p_renderTime_5_, 255).endVertex(); return i; } }
/** * 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.snowDigParticleScale * f; super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ); }
/** * Draws a textured rectangle using the texture currently bound to the TextureManager */ 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 vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX); vertexbuffer.pos((double)(xCoord + 0.0F), (double)(yCoord + (float)maxV), (double)this.zLevel).tex((double)((float)(minU + 0) * 0.00390625F), (double)((float)(minV + maxV) * 0.00390625F)).endVertex(); vertexbuffer.pos((double)(xCoord + (float)maxU), (double)(yCoord + (float)maxV), (double)this.zLevel).tex((double)((float)(minU + maxU) * 0.00390625F), (double)((float)(minV + maxV) * 0.00390625F)).endVertex(); vertexbuffer.pos((double)(xCoord + (float)maxU), (double)(yCoord + 0.0F), (double)this.zLevel).tex((double)((float)(minU + maxU) * 0.00390625F), (double)((float)(minV + 0) * 0.00390625F)).endVertex(); vertexbuffer.pos((double)(xCoord + 0.0F), (double)(yCoord + 0.0F), (double)this.zLevel).tex((double)((float)(minU + 0) * 0.00390625F), (double)((float)(minV + 0) * 0.00390625F)).endVertex(); tessellator.draw(); }
public void render(VertexBuffer renderer, float scale) { for (TexturedQuad texturedquad : this.quadList) { if (texturedquad != null) { texturedquad.draw(renderer, scale); } } }
protected void drawContainerBackground(Tessellator p_drawContainerBackground_1_) { VertexBuffer vertexbuffer = p_drawContainerBackground_1_.getBuffer(); this.mc.getTextureManager().bindTexture(Gui.OPTIONS_BACKGROUND); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); float f = 32.0F; vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); vertexbuffer.pos((double)this.left, (double)this.bottom, 0.0D).tex((double)((float)this.left / 32.0F), (double)((float)(this.bottom + (int)this.amountScrolled) / 32.0F)).color(32, 32, 32, 255).endVertex(); vertexbuffer.pos((double)this.right, (double)this.bottom, 0.0D).tex((double)((float)this.right / 32.0F), (double)((float)(this.bottom + (int)this.amountScrolled) / 32.0F)).color(32, 32, 32, 255).endVertex(); vertexbuffer.pos((double)this.right, (double)this.top, 0.0D).tex((double)((float)this.right / 32.0F), (double)((float)(this.top + (int)this.amountScrolled) / 32.0F)).color(32, 32, 32, 255).endVertex(); vertexbuffer.pos((double)this.left, (double)this.top, 0.0D).tex((double)((float)this.left / 32.0F), (double)((float)(this.top + (int)this.amountScrolled) / 32.0F)).color(32, 32, 32, 255).endVertex(); p_drawContainerBackground_1_.draw(); }
private void renderShadowSingle(IBlockState state, double p_188299_2_, double p_188299_4_, double p_188299_6_, BlockPos p_188299_8_, float p_188299_9_, float p_188299_10_, double p_188299_11_, double p_188299_13_, double p_188299_15_) { if (state.isFullCube()) { Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); double d0 = ((double)p_188299_9_ - (p_188299_4_ - ((double)p_188299_8_.getY() + p_188299_13_)) / 2.0D) * 0.5D * (double)this.getWorldFromRenderManager().getLightBrightness(p_188299_8_); if (d0 >= 0.0D) { if (d0 > 1.0D) { d0 = 1.0D; } AxisAlignedBB axisalignedbb = state.getBoundingBox(this.getWorldFromRenderManager(), p_188299_8_); double d1 = (double)p_188299_8_.getX() + axisalignedbb.minX + p_188299_11_; double d2 = (double)p_188299_8_.getX() + axisalignedbb.maxX + p_188299_11_; double d3 = (double)p_188299_8_.getY() + axisalignedbb.minY + p_188299_13_ + 0.015625D; double d4 = (double)p_188299_8_.getZ() + axisalignedbb.minZ + p_188299_15_; double d5 = (double)p_188299_8_.getZ() + axisalignedbb.maxZ + p_188299_15_; float f = (float)((p_188299_2_ - d1) / 2.0D / (double)p_188299_10_ + 0.5D); float f1 = (float)((p_188299_2_ - d2) / 2.0D / (double)p_188299_10_ + 0.5D); float f2 = (float)((p_188299_6_ - d4) / 2.0D / (double)p_188299_10_ + 0.5D); float f3 = (float)((p_188299_6_ - d5) / 2.0D / (double)p_188299_10_ + 0.5D); vertexbuffer.pos(d1, d3, d4).tex((double)f, (double)f2).color(1.0F, 1.0F, 1.0F, (float)d0).endVertex(); vertexbuffer.pos(d1, d3, d5).tex((double)f, (double)f3).color(1.0F, 1.0F, 1.0F, (float)d0).endVertex(); vertexbuffer.pos(d2, d3, d5).tex((double)f1, (double)f3).color(1.0F, 1.0F, 1.0F, (float)d0).endVertex(); vertexbuffer.pos(d2, d3, d4).tex((double)f1, (double)f2).color(1.0F, 1.0F, 1.0F, (float)d0).endVertex(); } } }
public static void calcNormalChunkLayer(VertexBuffer wrr) { if (wrr.getVertexFormat().hasNormal() && wrr.drawMode == 7 && wrr.vertexCount % 4 == 0) { SVertexBuilder svertexbuilder = wrr.sVertexBuilder; endSetVertexFormat(wrr); int i = wrr.vertexCount * svertexbuilder.vertexSize; for (int j = 0; j < i; j += svertexbuilder.vertexSize * 4) { svertexbuilder.calcNormal(wrr, j); } } }
/** * Renders a white box with the bounds of the AABB trasnlated by an offset. */ public static void renderOffsetAABB(AxisAlignedBB boundingBox, double x, double y, double z) { GlStateManager.disableTexture2D(); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); vertexbuffer.setTranslation(x, y, z); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_NORMAL); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex(); tessellator.draw(); vertexbuffer.setTranslation(0.0D, 0.0D, 0.0D); GlStateManager.enableTexture2D(); }
public void render(float p_190060_1_, long p_190060_2_) { EntityPlayer entityplayer = this.minecraft.thePlayer; World world = this.minecraft.theWorld; double d0 = entityplayer.lastTickPosX + (entityplayer.posX - entityplayer.lastTickPosX) * (double)p_190060_1_; double d1 = entityplayer.lastTickPosY + (entityplayer.posY - entityplayer.lastTickPosY) * (double)p_190060_1_; double d2 = entityplayer.lastTickPosZ + (entityplayer.posZ - entityplayer.lastTickPosZ) * (double)p_190060_1_; GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.disableTexture2D(); BlockPos blockpos = new BlockPos(entityplayer.posX, 0.0D, entityplayer.posZ); Iterable<BlockPos> iterable = BlockPos.MutableBlockPos.getAllInBox(blockpos.add(-40, 0, -40), blockpos.add(40, 0, 40)); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(5, DefaultVertexFormats.POSITION_COLOR); for (BlockPos blockpos1 : iterable) { int i = world.getHeightmapHeight(blockpos1.getX(), blockpos1.getZ()); if (world.getBlockState(blockpos1.add(0, i, 0).down()) == Blocks.AIR.getDefaultState()) { RenderGlobal.addChainedFilledBoxVertices(vertexbuffer, (double)((float)blockpos1.getX() + 0.25F) - d0, (double)i - d1, (double)((float)blockpos1.getZ() + 0.25F) - d2, (double)((float)blockpos1.getX() + 0.75F) - d0, (double)i + 0.09375D - d1, (double)((float)blockpos1.getZ() + 0.75F) - d2, 0.0F, 0.0F, 1.0F, 0.5F); } else { RenderGlobal.addChainedFilledBoxVertices(vertexbuffer, (double)((float)blockpos1.getX() + 0.25F) - d0, (double)i - d1, (double)((float)blockpos1.getZ() + 0.25F) - d2, (double)((float)blockpos1.getX() + 0.75F) - d0, (double)i + 0.09375D - d1, (double)((float)blockpos1.getZ() + 0.75F) - d2, 0.0F, 1.0F, 0.0F, 0.5F); } } tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.popMatrix(); }
public static void drawSelectionBoundingBox(AxisAlignedBB boundingBox) { Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(3, DefaultVertexFormats.POSITION); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); tessellator.draw(); vertexbuffer.begin(3, DefaultVertexFormats.POSITION); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); tessellator.draw(); vertexbuffer.begin(1, DefaultVertexFormats.POSITION); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex(); vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex(); vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex(); tessellator.draw(); }
public static void drawOutlinedBoundingBox(net.minecraft.util.math.AxisAlignedBB par1AxisAlignedBB) { Tessellator tessellator = Tessellator.getInstance(); net.minecraft.client.renderer.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(3, DefaultVertexFormats.POSITION); vertexbuffer.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ).endVertex(); tessellator.draw(); vertexbuffer.begin(3, DefaultVertexFormats.POSITION); vertexbuffer.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ).endVertex(); tessellator.draw(); vertexbuffer.begin(1, DefaultVertexFormats.POSITION); vertexbuffer.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ).endVertex(); vertexbuffer.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ).endVertex(); tessellator.draw(); GlStateManager.disableColorLogic(); GlStateManager.enableTexture2D(); }
public static void drawNameplate(FontRenderer fontRendererIn, String str, float x, float y, float z, int verticalShift, float viewerYaw, float viewerPitch, boolean isThirdPersonFrontal) { GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); GlStateManager.glNormal3f(0.0F, 1.0F, 0.0F); GlStateManager.rotate(-viewerYaw, 0.0F, 1.0F, 0.0F); GlStateManager.rotate((float)(isThirdPersonFrontal ? -1 : 1) * viewerPitch, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-0.025F, -0.025F, 0.025F); GlStateManager.disableLighting(); GlStateManager.depthMask(false); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); int i = fontRendererIn.getStringWidth(str) / 2; GlStateManager.disableTexture2D(); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR); vertexbuffer.pos((double)(-i - 1), (double)(-1 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); vertexbuffer.pos((double)(-i - 1), (double)(8 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); vertexbuffer.pos((double)(i + 1), (double)(8 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); vertexbuffer.pos((double)(i + 1), (double)(-1 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.depthMask(true); fontRendererIn.drawString(str, -fontRendererIn.getStringWidth(str) / 2, verticalShift, -1); GlStateManager.enableLighting(); GlStateManager.disableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); }
/** * Renders the skybox in the main menu */ private void renderSkybox(int mouseX, int mouseY, float partialTicks) { this.mc.getFramebuffer().unbindFramebuffer(); GlStateManager.viewport(0, 0, 256, 256); this.drawPanorama(mouseX, mouseY, partialTicks); this.rotateAndBlurSkybox(partialTicks); int i = 3; CustomPanoramaProperties custompanoramaproperties = CustomPanorama.getCustomPanoramaProperties(); if (custompanoramaproperties != null) { i = custompanoramaproperties.getBlur3(); } for (int j = 0; j < i; ++j) { this.rotateAndBlurSkybox(partialTicks); this.rotateAndBlurSkybox(partialTicks); } this.mc.getFramebuffer().bindFramebuffer(true); GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); float f2 = 120.0F / (float) (this.width > this.height ? this.width : this.height); float f = (float) this.height * f2 / 256.0F; float f1 = (float) this.width * f2 / 256.0F; int k = this.width; int l = this.height; Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); vertexbuffer.pos(0.0D, (double) l, (double) this.zLevel).tex((double) (0.5F - f), (double) (0.5F + f1)) .color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); vertexbuffer.pos((double) k, (double) l, (double) this.zLevel).tex((double) (0.5F - f), (double) (0.5F - f1)) .color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); vertexbuffer.pos((double) k, 0.0D, (double) this.zLevel).tex((double) (0.5F + f), (double) (0.5F - f1)) .color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); vertexbuffer.pos(0.0D, 0.0D, (double) this.zLevel).tex((double) (0.5F + f), (double) (0.5F + f1)) .color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); tessellator.draw(); }