List of usage examples for org.lwjgl.opengl GL11 glScalef
public static native void glScalef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:minesweeperMod.client.MinesweeperDrawBlockHighlightHandler.java
License:LGPL
public static void highlightTile(EntityPlayer player, double x, double y, double z, float partialTicks, int tile) { x += 0.5D;/*from ww w .ja v a 2 s . com*/ y += 0.5D; z += 0.5D; double iPX = player.prevPosX + (player.posX - player.prevPosX) * partialTicks; double iPY = player.prevPosY + (player.posY - player.prevPosY) * partialTicks; double iPZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks; float xScale = 1.0F; float yScale = 1; float zScale = 1.0F; float xShift = 0.0F; float yShift = 0.01F; float zShift = 0.0F; GL11.glDepthMask(false); GL11.glDisable(GL11.GL_CULL_FACE); for (int i = 4; i < 5; i++) { ForgeDirection forgeDir = ForgeDirection.getOrientation(i); int zCorrection = i == 2 ? -1 : 1; GL11.glPushMatrix(); GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift); GL11.glScalef(1F * xScale, 1F * yScale, 1F * zScale); GL11.glRotatef(90, forgeDir.offsetX, forgeDir.offsetY, forgeDir.offsetZ); GL11.glTranslated(0, 0, 0.5f * zCorrection); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); drawQuad(-0.5F, -0.5F, 1F, 1F, 0F, tile); GL11.glPopMatrix(); } GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDepthMask(true); }
From source file:minesweeperMod.client.RenderFlag.java
License:LGPL
public void renderFlag(EntityFlag flag, double par2, double par4, double par6, float par8, float par9) { bindEntityTexture(flag);/*from w w w . j ava2 s . c o m*/ GL11.glPushMatrix(); GL11.glTranslatef((float) par2, (float) par4 + 1.5F, (float) par6); GL11.glScalef(1.0F, -1F, -1F); model.renderModel(1F / 16F, flag.oldFlagRotation + (flag.flagRotation - flag.oldFlagRotation) * par9); GL11.glPopMatrix(); }
From source file:mod.steamnsteel.client.renderer.tileentity.CupolaTESR.java
License:Open Source License
private void renderCupola(CupolaTE te) { if (te.isSlave()) return;/*from w ww . j a v a 2 s.c o m*/ final Tessellator instance = Tessellator.getInstance(); final BlockPos pos = te.getPos(); final World world = te.getWorld(); // Lighting final float brightness = ModBlock.cupola.getMixedBrightnessForBlock(world, pos); final int skyLight = world.getLightBrightnessForSkyBlocks(pos, 0); final int skyLightLSB = skyLight % 65536; final int skyLightMSB = skyLight / 65536; final WorldRenderer worldRenderer = instance.getWorldRenderer(); worldRenderer.setColorOpaque_F(brightness, brightness, brightness); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, skyLightLSB, skyLightMSB); // Open Render buffer GL11.glPushMatrix(); // Inherent adjustments to model GL11.glScalef(SCALE.left, SCALE.middle, SCALE.right); GL11.glTranslatef(OFFSET.left, OFFSET.middle, OFFSET.right); // Orient the model to match the placement final IBlockState metadata = world.getBlockState(pos); final Orientation orientation = Orientation.getdecodedOrientation(metadata); GL11.glRotatef(getAngleFromOrientation(orientation), 0.0F, 1.0F, 0.0F); // Bind the texture if (te.isActive()) bindTexture(TEXTURE_ACTIVE); else bindTexture(TEXTURE); // Render model.render(); // Close Render Buffer GL11.glPopMatrix(); }
From source file:mod.steamnsteel.client.renderer.tileentity.PlotoniumChestTESR.java
License:Open Source License
private void renderPlotoniumChest(RemnantRuinChestTE te, float tick) { final World world = te.getWorld(); final BlockPos pos = te.getPos(); GL11.glPushMatrix();/*from ww w . ja v a2 s. c om*/ // Position Renderer bindTexture(TEXTURE); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(1.0F, -1.0F, -1.0F); //flip & rotate GL11.glTranslatef(0.5F, 0.5F, 0.5F); //translate block pos around fromBLK ORG final IBlockState metadata = world.getBlockState(pos); final Orientation orientation = Orientation.getdecodedOrientation(metadata); GL11.glRotatef(getAngleFromOrientation(orientation), 0.0F, -1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); //translate BLK ORG to block pos //lid angle. float adjLDAngle = te.getPrevLidAngle() + (te.getLidAngle() - te.getPrevLidAngle()) * tick; adjLDAngle = 1.0F - adjLDAngle; adjLDAngle = 1.0F - adjLDAngle * adjLDAngle * adjLDAngle; //noinspection NumericCastThatLosesPrecision vanillaChest.chestLid.rotateAngleX = -(adjLDAngle * (float) Math.PI / 2.0F); vanillaChest.renderAll(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:mods.cloudmaster.CloudRenderer.java
/** * Renders the 3d fancy clouds// ww w . j a va2 s . c o m */ public void renderCloudsFancy(float par1, WorldClient world, Minecraft mc) { GL11.glDisable(GL11.GL_CULL_FACE); float f1 = (float) (mc.renderViewEntity.lastTickPosY + (mc.renderViewEntity.posY - mc.renderViewEntity.lastTickPosY) * (double) par1); Tessellator tessellator = Tessellator.instance; float f2 = 12.0F; float f3 = 4.0F; double d0 = (double) ((float) cloudTickCounter + par1); double d1 = (mc.renderViewEntity.prevPosX + (mc.renderViewEntity.posX - mc.renderViewEntity.prevPosX) * (double) par1 + d0 * 0.029999999329447746D) / (double) f2; double d2 = (mc.renderViewEntity.prevPosZ + (mc.renderViewEntity.posZ - mc.renderViewEntity.prevPosZ) * (double) par1) / (double) f2 + 0.33000001311302185D; float f4 = getCloudHeight() - f1 + 0.33F; int i = MathHelper.floor_double(d1 / 2048.0D); int j = MathHelper.floor_double(d2 / 2048.0D); d1 -= (double) (i * 2048); d2 -= (double) (j * 2048); mc.renderEngine.bindTexture(CLOUD_TEXTURE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Vec3 vec3 = world.getCloudColour(par1); float f5 = (float) vec3.xCoord; float f6 = (float) vec3.yCoord; float f7 = (float) vec3.zCoord; float f8; float f9; float f10; if (mc.gameSettings.anaglyph) { f8 = (f5 * 30.0F + f6 * 59.0F + f7 * 11.0F) / 100.0F; f10 = (f5 * 30.0F + f6 * 70.0F) / 100.0F; f9 = (f5 * 30.0F + f7 * 70.0F) / 100.0F; f5 = f8; f6 = f10; f7 = f9; } f8 = (float) (d1 * 0.0D); f10 = (float) (d2 * 0.0D); f9 = 0.00390625F; f8 = (float) MathHelper.floor_double(d1) * f9; f10 = (float) MathHelper.floor_double(d2) * f9; float f11 = (float) (d1 - (double) MathHelper.floor_double(d1)); float f12 = (float) (d2 - (double) MathHelper.floor_double(d2)); byte b0 = 8; byte b1 = 4; float f13 = 9.765625E-4F; GL11.glScalef(f2, 1.0F, f2); for (int k = 0; k < 2; ++k) { if (k == 0) { GL11.glColorMask(false, false, false, false); } else if (mc.gameSettings.anaglyph) { if (EntityRenderer.anaglyphField == 0) { GL11.glColorMask(false, true, true, true); } else { GL11.glColorMask(true, false, false, true); } } else { GL11.glColorMask(true, true, true, true); } for (int l = -b1 + 1; l <= b1; ++l) { for (int i1 = -b1 + 1; i1 <= b1; ++i1) { tessellator.startDrawingQuads(); float f14 = (float) (l * b0); float f15 = (float) (i1 * b0); float f16 = f14 - f11; float f17 = f15 - f12; if (f4 > -f3 - 1.0F) { tessellator.setColorRGBA_F(f5 * 0.7F, f6 * 0.7F, f7 * 0.7F, 0.8F); tessellator.setNormal(0.0F, -1.0F, 0.0F); tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + 0.0F), (double) (f17 + (float) b0), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + 0.0F), (double) (f17 + (float) b0), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + 0.0F), (double) (f17 + 0.0F), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + 0.0F), (double) (f17 + 0.0F), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); } if (f4 <= f3 + 1.0F) { tessellator.setColorRGBA_F(f5, f6, f7, 0.8F); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + f3 - f13), (double) (f17 + (float) b0), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + f3 - f13), (double) (f17 + (float) b0), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + f3 - f13), (double) (f17 + 0.0F), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + f3 - f13), (double) (f17 + 0.0F), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); } tessellator.setColorRGBA_F(f5 * 0.9F, f6 * 0.9F, f7 * 0.9F, 0.8F); int j1; if (l > -1) { tessellator.setNormal(-1.0F, 0.0F, 0.0F); for (j1 = 0; j1 < b0; ++j1) { tessellator.addVertexWithUV((double) (f16 + (float) j1 + 0.0F), (double) (f4 + 0.0F), (double) (f17 + (float) b0), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) j1 + 0.0F), (double) (f4 + f3), (double) (f17 + (float) b0), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) j1 + 0.0F), (double) (f4 + f3), (double) (f17 + 0.0F), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) j1 + 0.0F), (double) (f4 + 0.0F), (double) (f17 + 0.0F), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); } } if (l <= 1) { tessellator.setNormal(1.0F, 0.0F, 0.0F); for (j1 = 0; j1 < b0; ++j1) { tessellator.addVertexWithUV((double) (f16 + (float) j1 + 1.0F - f13), (double) (f4 + 0.0F), (double) (f17 + (float) b0), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) j1 + 1.0F - f13), (double) (f4 + f3), (double) (f17 + (float) b0), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + (float) b0) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) j1 + 1.0F - f13), (double) (f4 + f3), (double) (f17 + 0.0F), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) j1 + 1.0F - f13), (double) (f4 + 0.0F), (double) (f17 + 0.0F), (double) ((f14 + (float) j1 + 0.5F) * f9 + f8), (double) ((f15 + 0.0F) * f9 + f10)); } } tessellator.setColorRGBA_F(f5 * 0.8F, f6 * 0.8F, f7 * 0.8F, 0.8F); if (i1 > -1) { tessellator.setNormal(0.0F, 0.0F, -1.0F); for (j1 = 0; j1 < b0; ++j1) { tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + f3), (double) (f17 + (float) j1 + 0.0F), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + f3), (double) (f17 + (float) j1 + 0.0F), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + 0.0F), (double) (f17 + (float) j1 + 0.0F), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + 0.0F), (double) (f17 + (float) j1 + 0.0F), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); } } if (i1 <= 1) { tessellator.setNormal(0.0F, 0.0F, 1.0F); for (j1 = 0; j1 < b0; ++j1) { tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + f3), (double) (f17 + (float) j1 + 1.0F - f13), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + f3), (double) (f17 + (float) j1 + 1.0F - f13), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + (float) b0), (double) (f4 + 0.0F), (double) (f17 + (float) j1 + 1.0F - f13), (double) ((f14 + (float) b0) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); tessellator.addVertexWithUV((double) (f16 + 0.0F), (double) (f4 + 0.0F), (double) (f17 + (float) j1 + 1.0F - f13), (double) ((f14 + 0.0F) * f9 + f8), (double) ((f15 + (float) j1 + 0.5F) * f9 + f10)); } } tessellator.draw(); } } } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:mods.mffs.client.renderer.TECapacitorRenderer.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) { if (tileEntity instanceof TileEntityCapacitor) { TileEntityCapacitor topview = (TileEntityCapacitor) tileEntity; GL11.glPushMatrix();/* w ww.j a v a2 s . c o m*/ GL11.glPolygonOffset(-10, -10); GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL); int side = topview.getSide(); float dx = 1F / 16; float dz = 1F / 16; float displayWidth = 1 - 2F / 16; float displayHeight = 1 - 2F / 16; GL11.glTranslatef((float) x, (float) y, (float) z); switch (side) { case 1: break; case 0: GL11.glTranslatef(1, 1, 0); GL11.glRotatef(180, 1, 0, 0); GL11.glRotatef(180, 0, 1, 0); break; case 3: GL11.glTranslatef(0, 1, 0); GL11.glRotatef(0, 0, 1, 0); GL11.glRotatef(90, 1, 0, 0); break; case 2: GL11.glTranslatef(1, 1, 1); GL11.glRotatef(180, 0, 1, 0); GL11.glRotatef(90, 1, 0, 0); break; case 5: GL11.glTranslatef(0, 1, 1); GL11.glRotatef(90, 0, 1, 0); GL11.glRotatef(90, 1, 0, 0); break; case 4: GL11.glTranslatef(1, 1, 0); GL11.glRotatef(-90, 0, 1, 0); GL11.glRotatef(90, 1, 0, 0); break; } GL11.glTranslatef(dx + displayWidth / 2, 1F, dz + displayHeight / 2); GL11.glRotatef(-90, 1, 0, 0); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); FontRenderer fontRenderer = this.getFontRenderer(); int maxWidth = 1; String header = "MFFS Capacitor"; maxWidth = Math.max(fontRenderer.getStringWidth(header), maxWidth); maxWidth += 4; int lineHeight = fontRenderer.FONT_HEIGHT + 2; int requiredHeight = lineHeight * 1; float scaleX = displayWidth / maxWidth; float scaleY = displayHeight / requiredHeight; float scale = Math.min(scaleX, scaleY); GL11.glScalef(scale, -scale, scale); GL11.glDepthMask(false); int offsetX; int offsetY; int realHeight = (int) Math.floor(displayHeight / scale); int realWidth = (int) Math.floor(displayWidth / scale); if (scaleX < scaleY) { offsetX = 2; offsetY = (realHeight - requiredHeight) / 2; } else { offsetX = (realWidth - maxWidth) / 2 + 2; offsetY = 0; } GL11.glDisable(GL11.GL_LIGHTING); fontRenderer.drawString(header, offsetX - realWidth / 2, 1 + offsetY - realHeight / 2 + -2 * lineHeight, 1); fontRenderer.drawString("capacity: ", offsetX - realWidth / 2, 1 + offsetY - realHeight / 2 + 0 * lineHeight, 1); fontRenderer.drawString(String.valueOf(topview.getPercentageStorageCapacity()).concat(" % "), offsetX + realWidth / 2 - offsetX - fontRenderer.getStringWidth( String.valueOf(topview.getPercentageStorageCapacity()).concat(" % ")), offsetY - realHeight / 2 - 0 * lineHeight, 1); fontRenderer.drawString("range: ", offsetX - realWidth / 2, 1 + offsetY - realHeight / 2 + 1 * lineHeight, 1); fontRenderer.drawString(String.valueOf(topview.getTransmitRange()), offsetX + realWidth / 2 - offsetX - fontRenderer.getStringWidth(String.valueOf(topview.getTransmitRange())), offsetY - realHeight / 2 + 1 * lineHeight, 1); fontRenderer.drawString("linked device: ", offsetX - realWidth / 2, 1 + offsetY - realHeight / 2 + 2 * lineHeight, 1); fontRenderer.drawString(String.valueOf(topview.getLinketProjektor()), offsetX + realWidth / 2 - offsetX - fontRenderer.getStringWidth(String.valueOf(topview.getLinketProjektor())), offsetY - realHeight / 2 + 2 * lineHeight, 1); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthMask(true); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL); GL11.glPopMatrix(); } }
From source file:mods.mffs.client.renderer.TEExtractorRenderer.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) { if (tileEntity instanceof TileEntityExtractor) { TileEntityExtractor topview = (TileEntityExtractor) tileEntity; GL11.glPushMatrix();/* w w w.ja v a 2s.com*/ GL11.glPolygonOffset(-10, -10); GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL); int side = topview.getSide(); float dx = 1F / 16; float dz = 1F / 16; float displayWidth = 1 - 2F / 16; float displayHeight = 1 - 2F / 16; GL11.glTranslatef((float) x, (float) y, (float) z); switch (side) { case 1: break; case 0: GL11.glTranslatef(1, 1, 0); GL11.glRotatef(180, 1, 0, 0); GL11.glRotatef(180, 0, 1, 0); break; case 3: GL11.glTranslatef(0, 1, 0); GL11.glRotatef(0, 0, 1, 0); GL11.glRotatef(90, 1, 0, 0); break; case 2: GL11.glTranslatef(1, 1, 1); GL11.glRotatef(180, 0, 1, 0); GL11.glRotatef(90, 1, 0, 0); break; case 5: GL11.glTranslatef(0, 1, 1); GL11.glRotatef(90, 0, 1, 0); GL11.glRotatef(90, 1, 0, 0); break; case 4: GL11.glTranslatef(1, 1, 0); GL11.glRotatef(-90, 0, 1, 0); GL11.glRotatef(90, 1, 0, 0); break; } GL11.glTranslatef(dx + displayWidth / 2, 1F, dz + displayHeight / 2); GL11.glRotatef(-90, 1, 0, 0); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); FontRenderer fontRenderer = this.getFontRenderer(); int maxWidth = 1; String header = "MFFS Extractor"; maxWidth = Math.max(fontRenderer.getStringWidth(header), maxWidth); maxWidth += 4; int lineHeight = fontRenderer.FONT_HEIGHT + 2; int requiredHeight = lineHeight * 1; float scaleX = displayWidth / maxWidth; float scaleY = displayHeight / requiredHeight; float scale = Math.min(scaleX, scaleY); GL11.glScalef(scale, -scale, scale); GL11.glDepthMask(false); int offsetX; int offsetY; int realHeight = (int) Math.floor(displayHeight / scale); int realWidth = (int) Math.floor(displayWidth / scale); if (scaleX < scaleY) { offsetX = 2; offsetY = (realHeight - requiredHeight) / 2; } else { offsetX = (realWidth - maxWidth) / 2 + 2; offsetY = 0; } GL11.glDisable(GL11.GL_LIGHTING); fontRenderer.drawString(header, offsetX - realWidth / 2, 1 + offsetY - realHeight / 2 + -2 * lineHeight, 1); fontRenderer.drawString("WE:", offsetX - realWidth / 2, 1 + offsetY - realHeight / 2 + -0 * lineHeight, 1); fontRenderer.drawString(String.valueOf(topview.getWorkdone()).concat(" % "), offsetX + realWidth / 2 - offsetX - fontRenderer.getStringWidth(String.valueOf(topview.getWorkdone()).concat(" % ")), offsetY - realHeight / 2 - 0 * lineHeight, 1); fontRenderer.drawString("WC left:", offsetX - realWidth / 2, 1 + offsetY - realHeight / 2 + 1 * lineHeight, 1); fontRenderer.drawString(String.valueOf(topview.getWorkCylce()), offsetX + realWidth / 2 - offsetX - fontRenderer.getStringWidth(String.valueOf(topview.getWorkCylce())), offsetY - realHeight / 2 + 1 * lineHeight, 1); fontRenderer.drawString("FE Cap:", offsetX - realWidth / 2, 1 + offsetY - realHeight / 2 + 2 * lineHeight, 1); fontRenderer.drawString(String.valueOf(topview.getCapacity()).concat("%"), offsetX + realWidth / 2 - offsetX - fontRenderer.getStringWidth(String.valueOf(topview.getCapacity()).concat("%")), offsetY - realHeight / 2 + 2 * lineHeight, 1); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthMask(true); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL); GL11.glPopMatrix(); } }
From source file:mods.railcraft.client.gui.GuiTicket.java
License:Open Source License
/** * Draws the screen and all the components in it. *//*from w w w . j a va 2 s . co m*/ @Override public void drawScreen(int par1, int par2, float par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture(TEXTURE); int xOffset = (this.width - this.imageWidth) / 2; byte yOffset = 18; this.drawTexturedModalRect(xOffset, yOffset, 0, 0, this.imageWidth, this.imageHeight); if (readingManual) { GuiTools.drawCenteredString(fontRendererObj, LocalizationPlugin.translate("railcraft.gui.routing.ticket.manual.title"), yOffset + 14, width); String text = LocalizationPlugin.translate("railcraft.gui.routing.ticket.manual"); this.fontRendererObj.drawSplitString(text, xOffset + 16, yOffset + 30, WRAP_WIDTH, 0); } else { GL11.glPushMatrix(); GL11.glScalef(2F, 2F, 2F); GuiTools.drawCenteredString(fontRendererObj, EnumChatFormatting.BOLD + LocalizationPlugin.translate("railcraft.gui.routing.ticket.title"), yOffset - 2, width / 2, 0xFFFFFF, true); GL11.glPopMatrix(); GuiTools.drawCenteredString(fontRendererObj, LocalizationPlugin.translate("railcraft.gui.routing.ticket.line1"), yOffset + 50, width); GuiTools.drawCenteredString(fontRendererObj, LocalizationPlugin.translate("railcraft.gui.routing.ticket.line2"), yOffset + 65, width); String text = EnumChatFormatting.BLACK + "Dest=" + dest; if (fontRendererObj.getBidiFlag()) { text = text + "_"; } else if (updateCount / 6 % 2 == 0) { text = text + "" + EnumChatFormatting.BLACK + "_"; } else { text = text + "" + EnumChatFormatting.GRAY + "_"; } this.fontRendererObj.drawSplitString(text, xOffset + 16, yOffset + 98, WRAP_WIDTH, 0); } super.drawScreen(par1, par2, par3); }
From source file:mods.railcraft.client.gui.GuiTools.java
License:Open Source License
public static void drawVillager(EntityVillager villager, int x, int y, int scale, float yaw, float pitch) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING);//w ww . j ava2 s.c o m GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glPushMatrix(); GL11.glTranslatef((float) x, (float) y, 50.0F); GL11.glScalef((float) (-scale), (float) scale, (float) scale); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-((float) Math.atan((double) (pitch / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); villager.renderYawOffset = (float) Math.atan((double) (yaw / 40.0F)) * 20.0F; villager.rotationYaw = (float) Math.atan((double) (yaw / 40.0F)) * 40.0F; villager.rotationPitch = -((float) Math.atan((double) (pitch / 40.0F))) * 20.0F; villager.rotationYawHead = villager.rotationYaw; GL11.glTranslatef(0.0F, villager.yOffset, 0.0F); RenderManager.instance.playerViewY = 180.0F; RenderManager.instance.renderEntityWithPosYaw(villager, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); GL11.glPopMatrix(); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); GL11.glPopAttrib(); }
From source file:mods.railcraft.client.render.carts.CartContentRendererCargo.java
License:Open Source License
public void renderCargo(RenderCart renderer, EntityCartCargo cart, float light, float time, int x, int y, int z) {/*from w w w.j a va2s . c om*/ if (!cart.hasFilter()) return; GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); EntityItem item = new EntityItem(null, 0.0D, 0.0D, 0.0D, cart.getFilterItem().copy()); item.getEntityItem().stackSize = 1; item.hoverStart = 0.0F; boolean renderIn3D = RenderBlocks .renderItemIn3d(Block.getBlockFromItem(item.getEntityItem().getItem()).getRenderType()); RenderItem.renderInFrame = true; if (!renderIn3D) { if (!RenderManager.instance.options.fancyGraphics) GL11.glDisable(GL11.GL_CULL_FACE); GL11.glTranslatef(0.0F, -0.44F, 0.0F); float scale = 1.5F; GL11.glScalef(scale, scale, scale); GL11.glRotatef(90.F, 0.0F, 1.0F, 0.0F); int numIterations = cart.getSlotsFilled(); rand.setSeed(738); for (int i = 0; i < numIterations; i++) { GL11.glPushMatrix(); float tx = (float) rand.nextGaussian() * 0.1F; float ty = (float) rand.nextGaussian() * 0.01F; float tz = (float) rand.nextGaussian() * 0.2F; GL11.glTranslatef(tx, ty, tz); renderEntityItem(item); GL11.glPopMatrix(); } } else { GL11.glTranslatef(-0.08F, -0.44F, -0.18F); float scale = 1.8F; GL11.glScalef(scale, scale, scale); GL11.glRotatef(90.F, 0.0F, 1.0F, 0.0F); int slotsFilled = cart.getSlotsFilled(); int numIterations; if (slotsFilled <= 0) { numIterations = 0; } else { numIterations = (int) Math.ceil(slotsFilled / 3.2); numIterations = MathHelper.clamp_int(numIterations, 1, 5); } rand.setSeed(1983); for (int i = 0; i < numIterations; i++) { GL11.glPushMatrix(); float tx = (float) rand.nextGaussian() * 0.2F; float ty = (float) rand.nextGaussian() * 0.06F; float tz = (float) rand.nextGaussian() * 0.15F; GL11.glTranslatef(tx, ty, tz); renderEntityItem(item); GL11.glPopMatrix(); } } RenderItem.renderInFrame = false; GL11.glPopAttrib(); GL11.glPopMatrix(); }