Java Code Examples for net.minecraft.client.renderer.Tessellator#setColorRGBA_F()
The following examples show how to use
net.minecraft.client.renderer.Tessellator#setColorRGBA_F() .
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: ModelWandPart.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
private void drawRune(double x, double y, double z, int rune, EntityPlayer player) { GL11.glPushMatrix(); UtilsFX.bindTexture("textures/misc/script.png"); float r = MathHelper.sin((player.ticksExisted + rune * 5) / 5.0F) * 0.1F + 0.88F; float g = MathHelper.sin((player.ticksExisted + rune * 5) / 7.0F) * 0.1F + 0.63F; float alpha = MathHelper.sin((player.ticksExisted + rune * 5) / 10.0F) * 0.2F; GL11.glColor4f(r, g, 0.2F, alpha + 0.6F); GL11.glRotated(90.0D, 0.0D, 0.0D, 1.0D); GL11.glTranslated(x, y, z); Tessellator tessellator = Tessellator.instance; float var8 = 0.0625F * rune; float var9 = var8 + 0.0625F; float var10 = 0.0F; float var11 = 1.0F; tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(r, g, 0.2F, alpha + 0.6F); tessellator.addVertexWithUV(-0.06D - alpha / 40.0F, 0.06D + alpha / 40.0F, 0.0D, var9, var11); tessellator.addVertexWithUV(0.06D + alpha / 40.0F, 0.06D + alpha / 40.0F, 0.0D, var9, var10); tessellator.addVertexWithUV(0.06D + alpha / 40.0F, -0.06D - alpha / 40.0F, 0.0D, var8, var10); tessellator.addVertexWithUV(-0.06D - alpha / 40.0F, -0.06D - alpha / 40.0F, 0.0D, var8, var11); tessellator.draw(); GL11.glPopMatrix(); }
Example 2
Source File: MoCEntityFXStar.java From mocreaturesdev with GNU General Public License v3.0 | 6 votes |
@Override public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) { //func_98187_b = bindTexture(String) FMLClientHandler.instance().getClient().renderEngine.bindTexture(MoCreatures.proxy.MISC_TEXTURE + "fxstar.png"); float sizeFactor = 0.1F * this.particleScale; float var13 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 - interpPosX); float var14 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY); float var15 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ); float var16 = 1.2F - ((float) Math.random() * 0.5F); par1Tessellator.setColorRGBA_F(this.particleRed * var16, this.particleGreen * var16, this.particleBlue * var16, 1.0F); par1Tessellator.addVertexWithUV((double) (var13 - par3 * sizeFactor - par6 * sizeFactor), (double) (var14 - par4 * sizeFactor), (double) (var15 - par5 * sizeFactor - par7 * sizeFactor), 0D, 1D); par1Tessellator.addVertexWithUV((double) (var13 - par3 * sizeFactor + par6 * sizeFactor), (double) (var14 + par4 * sizeFactor), (double) (var15 - par5 * sizeFactor + par7 * sizeFactor), 1D, 1D); par1Tessellator.addVertexWithUV((double) (var13 + par3 * sizeFactor + par6 * sizeFactor), (double) (var14 + par4 * sizeFactor), (double) (var15 + par5 * sizeFactor + par7 * sizeFactor), 1D, 0D); par1Tessellator.addVertexWithUV((double) (var13 + par3 * sizeFactor - par6 * sizeFactor), (double) (var14 - par4 * sizeFactor), (double) (var15 + par5 * sizeFactor - par7 * sizeFactor), 0D, 0D); }
Example 3
Source File: RenderElevatorCaller.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f){ TileEntityElevatorCaller tile = (TileEntityElevatorCaller)tileentity; Tessellator tess = Tessellator.instance; GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5); GL11.glScalef(1.0F, -1F, -1F); // GL11.glRotated(180, 0, 0, 1); PneumaticCraftUtils.rotateMatrixByMetadata(tileentity.getBlockMetadata()); GL11.glTranslatef(-1, 0, -1); for(TileEntityElevatorCaller.ElevatorButton button : tile.getFloors()) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); tess.startDrawingQuads(); tess.setColorRGBA_F(button.red, button.green, button.blue, 1F); tess.addVertex(button.posX + 0.5D, button.posY + 0.5D, 0.499D); tess.addVertex(button.posX + 0.5D, button.posY + button.height + 0.5D, 0.499D); tess.addVertex(button.posX + button.width + 0.5D, button.posY + button.height + 0.5D, 0.499D); tess.addVertex(button.posX + button.width + 0.5D, button.posY + 0.5D, 0.499D); tess.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPushMatrix(); GL11.glTranslated(button.posX + 0.5D, button.posY + 0.5D, 0.498); GL11.glTranslated(button.width / 2, button.height / 2, 0); float textScale = Math.min((float)button.width / 10F, (float)button.height / 10F); GL11.glScalef(textScale, textScale, textScale); func_147498_b().drawString(button.buttonText, -func_147498_b().getStringWidth(button.buttonText) / 2, -func_147498_b().FONT_HEIGHT / 2, 0xFF000000); GL11.glPopMatrix(); } GL11.glPopMatrix(); }
Example 4
Source File: ShowArmor.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
private void drawGradientRect(int p_73733_1_, int p_73733_2_, int p_73733_3_, int p_73733_4_, int p_73733_5_, int p_73733_6_) { float f = (p_73733_5_ >> 24 & 255) / 255.0F; float f1 = (p_73733_5_ >> 16 & 255) / 255.0F; float f2 = (p_73733_5_ >> 8 & 255) / 255.0F; float f3 = (p_73733_5_ & 255) / 255.0F; float f4 = (p_73733_6_ >> 24 & 255) / 255.0F; float f5 = (p_73733_6_ >> 16 & 255) / 255.0F; float f6 = (p_73733_6_ >> 8 & 255) / 255.0F; float f7 = (p_73733_6_ & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glShadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(f1, f2, f3, f); tessellator.addVertex(p_73733_3_, p_73733_2_, 300f); tessellator.addVertex(p_73733_1_, p_73733_2_, 300f); tessellator.setColorRGBA_F(f5, f6, f7, f4); tessellator.addVertex(p_73733_1_, p_73733_4_, 300f); tessellator.addVertex(p_73733_3_, p_73733_4_, 300f); tessellator.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }
Example 5
Source File: MoCRenderDolphin.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
@Override public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2, float f, float f1) { MoCEntityDolphin entitydolphin = (MoCEntityDolphin) entityliving; super.doRenderLiving(entitydolphin, d, d1, d2, f, f1); boolean flag = MoCreatures.proxy.getDisplayPetName() && !(entitydolphin.getName()).isEmpty(); boolean flag1 = MoCreatures.proxy.getDisplayPetHealth(); //boolean flag2 = MoCreatures.proxy.getdisplayPetIcons(); if (entitydolphin.renderName()) { float f2 = 1.6F; float f3 = 0.01666667F * f2; float f4 = entitydolphin.getDistanceToEntity(renderManager.livingPlayer); if (f4 < 16F) { String s = ""; s = (new StringBuilder()).append(s).append(entitydolphin.getName()).toString(); float f5 = 0.1F; FontRenderer fontrenderer = getFontRendererFromRenderManager(); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.0F, (float) d1 + f5, (float) d2); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f3, -f3, f3); GL11.glDisable(2896 /* GL_LIGHTING */); Tessellator tessellator = Tessellator.instance; byte byte0 = -50; if (flag1) { GL11.glDisable(3553 /* GL_TEXTURE_2D */); if (!flag) { byte0 += 8; } tessellator.startDrawingQuads(); // might break SSP float f6 = entitydolphin.getHealth(); // maxhealth is always 30 for dolphins so we do not need to use a datawatcher float f7 = entitydolphin.getMaxHealth(); float f8 = f6 / f7; float f9 = 40F * f8; tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F); tessellator.addVertex(-20F + f9, -10 + byte0, 0.0D); tessellator.addVertex(-20F + f9, -6 + byte0, 0.0D); tessellator.addVertex(20D, -6 + byte0, 0.0D); tessellator.addVertex(20D, -10 + byte0, 0.0D); tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F); tessellator.addVertex(-20D, -10 + byte0, 0.0D); tessellator.addVertex(-20D, -6 + byte0, 0.0D); tessellator.addVertex(f9 - 20F, -6 + byte0, 0.0D); tessellator.addVertex(f9 - 20F, -10 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); } if (flag) { GL11.glDepthMask(false); GL11.glDisable(2929 /* GL_DEPTH_TEST */); GL11.glEnable(3042 /* GL_BLEND */); GL11.glBlendFunc(770, 771); GL11.glDisable(3553 /* GL_TEXTURE_2D */); tessellator.startDrawingQuads(); int i = fontrenderer.getStringWidth(s) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-i - 1, -1 + byte0, 0.0D); tessellator.addVertex(-i - 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, -1 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff); GL11.glEnable(2929 /* GL_DEPTH_TEST */); GL11.glDepthMask(true); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1); GL11.glDisable(3042 /* GL_BLEND */); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); } } }
Example 6
Source File: PedestalRenderer.java From Artifacts with MIT License | 4 votes |
protected void renderLabel(TileEntityDisplayPedestal entity, String s, double d, double d1, double d2, int i) { double f = entity.getDistanceFrom(this.field_147501_a.staticPlayerX, this.field_147501_a.staticPlayerY, this.field_147501_a.staticPlayerZ); if (f > i) { return; } FontRenderer fontrenderer = this.field_147501_a.getFontRenderer(); float f1 = 1.6F; float f2 = 0.01666667F * f1; double angle = Math.toRadians(entity.rotation); float sin = (float)(Math.sin(angle)); float cos = (float)(Math.cos(angle)); sin = Math.round(sin*100)/100; cos = Math.round(cos*100)/100; GL11.glPushMatrix(); GL11.glTranslatef((float)d+(float)(sin*0.35), (float)d1, (float)d2-(float)(cos*0.35)); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-1*entity.rotation, 0, 1, 0); GL11.glScalef(0.3f, 0.3f, 0.3f); //GL11.glRotatef(-this.tileEntityRenderer.playerYaw, 0.0F, 1.0F, 0.0F); //GL11.glRotatef(this.tileEntityRenderer.playerPitch, 1.0F, 0.0F, 0.0F); GL11.glScalef(-f2, -f2, f2); GL11.glDisable(2896); GL11.glDepthMask(false); GL11.glDisable(2929); GL11.glEnable(3042); GL11.glBlendFunc(770, 771); Tessellator tessellator = Tessellator.instance; byte byte0 = 0; GL11.glDisable(3553); tessellator.disableColor(); tessellator.startDrawingQuads(); int j = fontrenderer.getStringWidth(s) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.35F); tessellator.addVertex(-j - 1, -1 + byte0, 0.0D); tessellator.addVertex(-j - 1, 8 + byte0, 0.0D); tessellator.addVertex(j + 1, 8 + byte0, 0.0D); tessellator.addVertex(j + 1, -1 + byte0, 0.0D); tessellator.draw(); //tessellator.func_78381_a(); GL11.glEnable(3553); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 553648127); GL11.glEnable(2929); GL11.glDepthMask(true); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1); GL11.glEnable(2896); GL11.glDisable(3042); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); }
Example 7
Source File: AntibuilderParticle.java From Artifacts with MIT License | 4 votes |
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) { par1Tessellator.draw(); GL11.glPushMatrix(); ParticleUtils.bindTexture("textures/items/radarparticle.png"); //GL11.glDepthMask(false); GL11.glDepthFunc(GL11.GL_ALWAYS); //GL11.glEnable(3042); //GL11.glBlendFunc(770, 1); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F); //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); par1Tessellator.startDrawingQuads(); /*int bright = -1; try { bright = ReflectionHelper.getPrivateValue(Tessellator.class, par1Tessellator, new String[] { "brightness", "b", "field_78401_l" }); } catch (Exception e) { System.out.println("Bad reflection"); }*/ par1Tessellator.setBrightness(255); float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge * 32.0F; if (var8 < 0.0F) { var8 = 0.0F; } if (var8 > 1.0F) { var8 = 1.0F; } this.particleScale = this.reddustParticleScale;// * var8; //replace this //super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); //Minecraft.getMinecraft().renderEngine.bindTexture(rl); float f6 = (float)this.particleTextureIndexX / 32.0F; float f7 = f6 + 0.029375F; // 0.0624375 // 0.0625 float f8 = (float)this.particleTextureIndexY / 32.0F; float f9 = f8 + 0.029375F; float f10 = 0.15F;// * this.particleScale; float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX); float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY); float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ); float f14 = 1.0F; //par1Tessellator.draw(); //GL11.glDepthFunc(GL11.GL_ALWAYS); //par1Tessellator.startDrawingQuads(); //par1Tessellator.setBrightness(255); //GL11.glDisable(GL11.GL_DEPTH_TEST); float al = 0.0F; EntityPlayer player = (EntityPlayer) this.worldObj.findNearestEntityWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(this.posX - 16, this.posY-16, this.posZ-16, this.posX+16, this.posY+16, this.posZ+16), this); if(player != null) { double d = player.getDistanceToEntity(this); if(d < 6 && d > 1) { al = (float)(d / 8D); } else if(d > 1) al = 6F / 8F; }/**/ par1Tessellator.setColorRGBA_F(this.particleRed * f14 - al/2, this.particleGreen * f14, this.particleBlue * f14 + al, 0.05F); par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9); par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8); par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8); par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9); par1Tessellator.draw(); //GL11.glDepthFunc(GL11.GL_LEQUAL); //par1Tessellator.startDrawingQuads(); //rl = new ResourceLocation("textures/particle/particles.png"); //Minecraft.getMinecraft().renderEngine.bindTexture(rl2); //GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(ParticleUtils.getParticleTexture()); par1Tessellator.startDrawingQuads(); par1Tessellator.setBrightness(0); }
Example 8
Source File: RadarParticle.java From Artifacts with MIT License | 4 votes |
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) { par1Tessellator.draw(); GL11.glPushMatrix(); ParticleUtils.bindTexture("textures/items/radarparticle.png"); //GL11.glDepthMask(false); GL11.glDepthFunc(GL11.GL_ALWAYS); //GL11.glEnable(3042); //GL11.glBlendFunc(770, 1); GL11.glColor4f(1.0F, 1.0F, 1.0F, this.particleAlpha); par1Tessellator.startDrawingQuads(); /*int bright = -1; try { bright = ReflectionHelper.getPrivateValue(Tessellator.class, par1Tessellator, new String[] { "brightness", "b", "field_78401_l" }); } catch (Exception e) { System.out.println("Bad reflection"); }*/ par1Tessellator.setBrightness(255); float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge * 32.0F; if (var8 < 0.0F) { var8 = 0.0F; } if (var8 > 1.0F) { var8 = 1.0F; } this.particleScale = this.reddustParticleScale;// * var8; //replace this //super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); //Minecraft.getMinecraft().renderEngine.bindTexture(rl); float f6 = (float)this.particleTextureIndexX / 16.0F; float f7 = f6 + 0.0624375F; float f8 = (float)this.particleTextureIndexY / 16.0F; float f9 = f8 + 0.0624375F; float f10 = 0.3F;// * this.particleScale; float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX); float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY); float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ); float f14 = 1.0F; //par1Tessellator.draw(); //GL11.glDepthFunc(GL11.GL_ALWAYS); //par1Tessellator.startDrawingQuads(); //par1Tessellator.setBrightness(255); //GL11.glDisable(GL11.GL_DEPTH_TEST); par1Tessellator.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha); par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9); par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8); par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8); par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9); par1Tessellator.draw(); //GL11.glDepthFunc(GL11.GL_LEQUAL); //par1Tessellator.startDrawingQuads(); //rl = new ResourceLocation("textures/particle/particles.png"); //Minecraft.getMinecraft().renderEngine.bindTexture(rl2); //GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glPopMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(ParticleUtils.getParticleTexture()); par1Tessellator.startDrawingQuads(); par1Tessellator.setBrightness(0); }
Example 9
Source File: TileEntityRendererMonitorStorageFluid.java From ExtraCells1 with MIT License | 4 votes |
@Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTickTime) { if (tileentity instanceof TileEntityMonitorStorageFluid) { Fluid fluid = ((TileEntityMonitorStorageFluid) tileentity).getFluid(); if (fluid == null || fluid.getIcon() == null) return; Icon fluidIcon = fluid.getFlowingIcon(); GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); FontRenderer fr = Minecraft.getMinecraft().fontRenderer; ForgeDirection d = ForgeDirection.getOrientation(tileentity.blockMetadata); GL11.glTranslated(x + 0.5D, y + 0.5D, z + 0.5D); GL11.glTranslated(d.offsetX * 0.76D, d.offsetY * 0.76D, d.offsetZ * 0.76D); if (d == ForgeDirection.UP) { GL11.glScalef(1.0F, -1.0F, 1.0F); GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); } if (d == ForgeDirection.DOWN) { GL11.glScalef(1.0F, -1.0F, 1.0F); GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); } if (d == ForgeDirection.EAST) { GL11.glScalef(-1.0F, -1.0F, -1.0F); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); } if (d == ForgeDirection.WEST) { GL11.glScalef(-1.0F, -1.0F, -1.0F); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); } if (d == ForgeDirection.NORTH) { GL11.glScalef(-1.0F, -1.0F, -1.0F); } if (d == ForgeDirection.SOUTH) { GL11.glScalef(-1.0F, -1.0F, -1.0F); GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); } GL11.glTranslatef(0.01F, 0.13F, -0.24F); GL11.glScalef(0.0625F * 0.25F, 0.0625F * 0.25F, 0.01612903F); long qty = ((TileEntityMonitorStorageFluid) tileentity).getAmount(); if (qty > 999999999999L) { qty = 999999999999L; } String msg = Long.toString(qty) + "mB"; if (Extracells.shortenedBuckets) { if (qty > 1000000000L) msg = Long.toString(qty / 1000000000L) + "MegaB"; else if (qty > 1000000L) msg = Long.toString(qty / 1000000L) + "KiloB"; else if (qty > 9999L) { msg = Long.toString(qty / 1000L) + "B"; } } TileEntityMonitorStorageFluid TE = (TileEntityMonitorStorageFluid) tileentity; if (TE.isMachineActive()) { GL11.glTranslated(-8.6F, -16.3, -1.2F); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); Tessellator cake = Tessellator.instance; cake.startDrawingQuads(); cake.setBrightness(255); cake.setColorRGBA_F(1.0f, 1.0f, 1.0f, 1.0f); cake.addVertexWithUV(0, 16, 0, fluidIcon.getMinU(), fluidIcon.getMaxV()); cake.addVertexWithUV(16, 16, 0, fluidIcon.getMaxU(), fluidIcon.getMaxV()); cake.addVertexWithUV(16, 0, 0, fluidIcon.getMaxU(), fluidIcon.getMinV()); cake.addVertexWithUV(0, 0, 0, fluidIcon.getMinU(), fluidIcon.getMinV()); cake.draw(); int width = fr.getStringWidth(msg); GL11.glTranslatef(8.25F - 0.5F * width, 24.0F, 0); GL11.glScaled(1, 0.5, 1); fr.drawString(msg, 0, 0, 0x00FFFF); } GL11.glPopMatrix(); GL11.glPopAttrib(); } }
Example 10
Source File: MoCRenderShark.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
public void doRenderLiving2(EntityLiving entityliving, double d, double d1, double d2, float f, float f1) { MoCEntityShark entityshark = (MoCEntityShark) entityliving; super.doRenderLiving(entityshark, d, d1, d2, f, f1); if (entityshark.renderName()) { float f2 = 1.6F; float f3 = 0.01666667F * f2; float f4 = entityliving.getDistanceToEntity(renderManager.livingPlayer); String s = ""; s = (new StringBuilder()).append(s).append(entityshark.getName()).toString(); if ((f4 < 12F) && (s.length() > 0)) { FontRenderer fontrenderer = getFontRendererFromRenderManager(); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.0F, (float) d1 + 0.2F, (float) d2); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f3, -f3, f3); GL11.glDisable(2896 /* GL_LIGHTING */); GL11.glDepthMask(false); GL11.glDisable(2929 /* GL_DEPTH_TEST */); GL11.glEnable(3042 /* GL_BLEND */); GL11.glBlendFunc(770, 771); Tessellator tessellator = Tessellator.instance; byte byte0 = -50; GL11.glDisable(3553 /* GL_TEXTURE_2D */); tessellator.startDrawingQuads(); int i = fontrenderer.getStringWidth(s) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-i - 1, -1 + byte0, 0.0D); tessellator.addVertex(-i - 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, -1 + byte0, 0.0D); if (MoCreatures.proxy.getDisplayPetHealth()) { float f5 = entityshark.getHealth(); float f6 = entityshark.getMaxHealth(); float f7 = f5 / f6; float f8 = 40F * f7; tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F); tessellator.addVertex(-20F + f8, -10 + byte0, 0.0D); tessellator.addVertex(-20F + f8, -6 + byte0, 0.0D); tessellator.addVertex(20D, -6 + byte0, 0.0D); tessellator.addVertex(20D, -10 + byte0, 0.0D); tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F); tessellator.addVertex(-20D, -10 + byte0, 0.0D); tessellator.addVertex(-20D, -6 + byte0, 0.0D); tessellator.addVertex(f8 - 20F, -6 + byte0, 0.0D); tessellator.addVertex(f8 - 20F, -10 + byte0, 0.0D); } tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff); GL11.glEnable(2929 /* GL_DEPTH_TEST */); GL11.glDepthMask(true); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glDisable(3042 /* GL_BLEND */); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } } }
Example 11
Source File: MoCRenderShark.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
@Override public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2, float f, float f1) { MoCEntityShark entityshark = (MoCEntityShark) entityliving; super.doRenderLiving(entityshark, d, d1, d2, f, f1); boolean flag = MoCreatures.proxy.getDisplayPetName() && !(entityshark.getName()).isEmpty(); boolean flag1 = MoCreatures.proxy.getDisplayPetHealth(); boolean flag2 = MoCreatures.proxy.getDisplayPetIcons(); if (entityshark.renderName()) { float f2 = 1.6F; float f3 = 0.01666667F * f2; float f4 = entityshark.getDistanceToEntity(renderManager.livingPlayer); if (f4 < 16F) { String s = ""; s = (new StringBuilder()).append(s).append(entityshark.getName()).toString(); float f5 = 0.1F; FontRenderer fontrenderer = getFontRendererFromRenderManager(); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.0F, (float) d1 + f5, (float) d2); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f3, -f3, f3); GL11.glDisable(2896 /* GL_LIGHTING */); Tessellator tessellator = Tessellator.instance; byte byte0 = -50; if (flag1) { GL11.glDisable(3553 /* GL_TEXTURE_2D */); if (!flag) { byte0 += 8; } tessellator.startDrawingQuads(); // might break SSP float f6 = entityshark.getHealth(); float f7 = entityshark.getMaxHealth(); float f8 = f6 / f7; float f9 = 40F * f8; tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F); tessellator.addVertex(-20F + f9, -10 + byte0, 0.0D); tessellator.addVertex(-20F + f9, -6 + byte0, 0.0D); tessellator.addVertex(20D, -6 + byte0, 0.0D); tessellator.addVertex(20D, -10 + byte0, 0.0D); tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F); tessellator.addVertex(-20D, -10 + byte0, 0.0D); tessellator.addVertex(-20D, -6 + byte0, 0.0D); tessellator.addVertex(f9 - 20F, -6 + byte0, 0.0D); tessellator.addVertex(f9 - 20F, -10 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); } if (flag) { GL11.glDepthMask(false); GL11.glDisable(2929 /* GL_DEPTH_TEST */); GL11.glEnable(3042 /* GL_BLEND */); GL11.glBlendFunc(770, 771); GL11.glDisable(3553 /* GL_TEXTURE_2D */); tessellator.startDrawingQuads(); int i = fontrenderer.getStringWidth(s) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-i - 1, -1 + byte0, 0.0D); tessellator.addVertex(-i - 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, -1 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff); GL11.glEnable(2929 /* GL_DEPTH_TEST */); GL11.glDepthMask(true); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1); GL11.glDisable(3042 /* GL_BLEND */); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); } } }
Example 12
Source File: MoCRenderDolphin.java From mocreaturesdev with GNU General Public License v3.0 | 4 votes |
public void doRenderLiving2(EntityLiving entityliving, double d, double d1, double d2, float f, float f1) { MoCEntityDolphin entitydolphin = (MoCEntityDolphin) entityliving; super.doRenderLiving(entitydolphin, d, d1, d2, f, f1); if (entitydolphin.renderName()) { float f2 = 1.6F; float f3 = 0.01666667F * f2; float f4 = entityliving.getDistanceToEntity(renderManager.livingPlayer); String s = ""; s = (new StringBuilder()).append(s).append(entitydolphin.getName()).toString(); if ((f4 < 12F) && (s.length() > 0)) { FontRenderer fontrenderer = getFontRendererFromRenderManager(); GL11.glPushMatrix(); GL11.glTranslatef((float) d + 0.0F, (float) d1 + 0.3F, (float) d2); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glScalef(-f3, -f3, f3); GL11.glDisable(2896 /* GL_LIGHTING */); GL11.glDepthMask(false); GL11.glDisable(2929 /* GL_DEPTH_TEST */); GL11.glEnable(3042 /* GL_BLEND */); GL11.glBlendFunc(770, 771); Tessellator tessellator = Tessellator.instance; byte byte0 = -50; GL11.glDisable(3553 /* GL_TEXTURE_2D */); tessellator.startDrawingQuads(); int i = fontrenderer.getStringWidth(s) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-i - 1, -1 + byte0, 0.0D); tessellator.addVertex(-i - 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, -1 + byte0, 0.0D); if (MoCreatures.proxy.getDisplayPetHealth()) { float f5 = entitydolphin.getHealth(); float f6 = entitydolphin.getMaxHealth(); float f7 = f5 / f6; float f8 = 40F * f7; tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F); tessellator.addVertex(-20F + f8, -10 + byte0, 0.0D); tessellator.addVertex(-20F + f8, -6 + byte0, 0.0D); tessellator.addVertex(20D, -6 + byte0, 0.0D); tessellator.addVertex(20D, -10 + byte0, 0.0D); tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F); tessellator.addVertex(-20D, -10 + byte0, 0.0D); tessellator.addVertex(-20D, -6 + byte0, 0.0D); tessellator.addVertex(f8 - 20F, -6 + byte0, 0.0D); tessellator.addVertex(f8 - 20F, -10 + byte0, 0.0D); } tessellator.draw(); GL11.glEnable(3553 /* GL_TEXTURE_2D */); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff); GL11.glEnable(2929 /* GL_DEPTH_TEST */); GL11.glDepthMask(true); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glDisable(3042 /* GL_BLEND */); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } } }
Example 13
Source File: TrueTypeFont.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 4 votes |
public void drawString(float x, float y, String whatchars, int startIndex, int endIndex, float scaleX, float scaleY, int format, float... rgba) { if(rgba.length == 0) rgba = new float[]{1f,1f,1f,1f}; GL11.glPushMatrix(); GL11.glScalef (scaleX, scaleY, 1.0f); FloatObject floatObject = null; int charCurrent; float totalwidth = 0; int i = startIndex, d, c; float startY = 0; switch (format) { case ALIGN_RIGHT: { d = -1; c = correctR; while (i < endIndex) { if (whatchars.charAt(i) == '\n') startY -= fontHeight; i++; } break; } case ALIGN_CENTER: { for (int l = startIndex; l <= endIndex; l++) { charCurrent = whatchars.charAt(l); if (charCurrent == '\n') break; if (charCurrent < 256) { floatObject = charArray[charCurrent]; } else { floatObject = (FloatObject)customChars.get( new Character( (char) charCurrent ) ); } totalwidth += floatObject.width-correctL; } totalwidth /= -2; } case ALIGN_LEFT: default: { d = 1; c = correctL; break; } } GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureID); Tessellator t = Tessellator.instance; t.startDrawingQuads(); // GL11.glBegin(GL11.GL_QUADS); if(rgba.length == 4) t.setColorRGBA_F(rgba[0], rgba[1], rgba[2], rgba[3]); while (i >= startIndex && i <= endIndex) { charCurrent = whatchars.charAt(i); if (charCurrent < 256) { floatObject = charArray[charCurrent]; } else { floatObject = (FloatObject)customChars.get( new Character( (char) charCurrent ) ); } if( floatObject != null ) { if (d < 0) totalwidth += (floatObject.width-c) * d; if (charCurrent == '\n') { startY -= fontHeight * d; totalwidth = 0; if (format == ALIGN_CENTER) { for (int l = i+1; l <= endIndex; l++) { charCurrent = whatchars.charAt(l); if (charCurrent == '\n') break; if (charCurrent < 256) { floatObject = charArray[charCurrent]; } else { floatObject = (FloatObject)customChars.get( new Character( (char) charCurrent ) ); } totalwidth += floatObject.width-correctL; } totalwidth /= -2; } //if center get next lines total width/2; } else { drawQuad((totalwidth + floatObject.width) + x/scaleX, startY + y/scaleY, totalwidth + x/scaleX, (startY + floatObject.height) + y/scaleY, floatObject.storedX + floatObject.width, floatObject.storedY + floatObject.height, floatObject.storedX, floatObject.storedY); if (d > 0) totalwidth += (floatObject.width-c) * d ; } i += d; } } t.draw(); // GL11.glEnd(); GL11.glPopMatrix(); }
Example 14
Source File: RenderCustomEndPortal.java From EnderStorage with MIT License | 4 votes |
public void render(double posX, double posY, double posZ, float frame, double playerX, double playerY, double playerZ, TextureManager r) { if(r == null)return; GL11.glDisable(GL11.GL_LIGHTING); Random random = new Random(31100L); for(int i = 0; i < 16; i++) { GL11.glPushMatrix(); float f5 = 16 - i; float f6 = 0.0625F; float f7 = 1.0F / (f5 + 1.0F); if(i == 0) { r.bindTexture(end_skyTex); f7 = 0.1F; f5 = 65F; f6 = 0.125F; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(770, 771); } if(i == 1) { r.bindTexture(end_portalTex); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(1, 1); f6 = 0.5F; } float f8 = (float)(-(posY + surfaceY)); float f9 = f8 + ActiveRenderInfo.objectY; float f10 = f8 + f5 + ActiveRenderInfo.objectY; float f11 = f9 / f10; f11 = (float)(posY + surfaceY) + f11; GL11.glTranslated(playerX, f11, playerZ); GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR); GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, func_40447_a(1.0F, 0.0F, 0.0F, 0.0F)); GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, func_40447_a(0.0F, 0.0F, 1.0F, 0.0F)); GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, func_40447_a(0.0F, 0.0F, 0.0F, 1.0F)); GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, func_40447_a(0.0F, 1.0F, 0.0F, 0.0F)); GL11.glEnable(GL11.GL_TEXTURE_GEN_S); GL11.glEnable(GL11.GL_TEXTURE_GEN_T); GL11.glEnable(GL11.GL_TEXTURE_GEN_R); GL11.glEnable(GL11.GL_TEXTURE_GEN_Q); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glTranslatef(0.0F, System.currentTimeMillis() % 0xaae60L / 700000F, 0.0F); GL11.glScalef(f6, f6, f6); GL11.glTranslatef(0.5F, 0.5F, 0.0F); GL11.glRotatef((i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.5F, -0.5F, 0.0F); GL11.glTranslated(-playerX, -playerZ, -playerY); f9 = f8 + ActiveRenderInfo.objectY; GL11.glTranslated((ActiveRenderInfo.objectX * f5) / f9, (ActiveRenderInfo.objectZ * f5) / f9, -playerY + 20); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); f11 = random.nextFloat() * 0.5F + 0.1F; float f12 = random.nextFloat() * 0.5F + 0.4F; float f13 = random.nextFloat() * 0.5F + 0.5F; if(i == 0) { f11 = f12 = f13 = 1.0F; } tessellator.setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F); tessellator.addVertex(posX + surfaceX1, posY + surfaceY, posZ + surfaceZ1); tessellator.addVertex(posX + surfaceX1, posY + surfaceY, posZ + surfaceZ2); tessellator.addVertex(posX + surfaceX2, posY + surfaceY, posZ + surfaceZ2); tessellator.addVertex(posX + surfaceX2, posY + surfaceY, posZ + surfaceZ1); tessellator.draw(); GL11.glPopMatrix(); GL11.glMatrixMode(ARBVertexBlend.GL_MODELVIEW0_ARB); } GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_GEN_S); GL11.glDisable(GL11.GL_TEXTURE_GEN_T); GL11.glDisable(GL11.GL_TEXTURE_GEN_R); GL11.glDisable(GL11.GL_TEXTURE_GEN_Q); GL11.glEnable(GL11.GL_LIGHTING); }
Example 15
Source File: TileEntityNewBeaconRenderer.java From Et-Futurum with The Unlicense | 4 votes |
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTickTime) { TileEntityNewBeacon beacon = (TileEntityNewBeacon) tile; float f1 = beacon.func_146002_i(); OpenGLHelper.alphaFunc(GL11.GL_GREATER, 0.1F); if (f1 > 0.0F) { Tessellator tessellator = Tessellator.instance; List<BeamSegment> list = beacon.getSegments(); int j = 0; for (int i = 0; i < list.size(); i++) { BeamSegment beamsegment = list.get(i); int l = j + beamsegment.func_177264_c(); bindTexture(BEAM_TEXTURE); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); OpenGLHelper.disableLighting(); OpenGLHelper.disableCull(); OpenGLHelper.disableBlend(); OpenGLHelper.depthMask(true); OpenGlHelper.glBlendFunc(770, 1, 1, 0); float f2 = tile.getWorldObj().getTotalWorldTime() + partialTickTime; float f3 = -f2 * 0.2F - MathHelper.floor_float(-f2 * 0.1F); double d3 = f2 * 0.025D * -1.5D; tessellator.startDrawingQuads(); double d4 = 0.2D; double d5 = 0.5D + Math.cos(d3 + 2.356194490192345D) * d4; double d6 = 0.5D + Math.sin(d3 + 2.356194490192345D) * d4; double d7 = 0.5D + Math.cos(d3 + Math.PI / 4D) * d4; double d8 = 0.5D + Math.sin(d3 + Math.PI / 4D) * d4; double d9 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * d4; double d10 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * d4; double d11 = 0.5D + Math.cos(d3 + 5.497787143782138D) * d4; double d12 = 0.5D + Math.sin(d3 + 5.497787143782138D) * d4; double d13 = 0.0D; double d14 = 1.0D; double d15 = -1.0F + f3; double d16 = beamsegment.func_177264_c() * f1 * (0.5D / d4) + d15; tessellator.setColorRGBA_F(beamsegment.func_177263_b()[0], beamsegment.func_177263_b()[1], beamsegment.func_177263_b()[2], 0.125F); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d14, d16); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d14, d15); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d13, d15); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d13, d16); tessellator.addVertexWithUV(x + d11, y + l, z + d12, d14, d16); tessellator.addVertexWithUV(x + d11, y + j, z + d12, d14, d15); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d13, d15); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d13, d16); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d14, d16); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d14, d15); tessellator.addVertexWithUV(x + d11, y + j, z + d12, d13, d15); tessellator.addVertexWithUV(x + d11, y + l, z + d12, d13, d16); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d14, d16); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d14, d15); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d13, d15); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d13, d16); tessellator.draw(); OpenGLHelper.enableBlend(); OpenGlHelper.glBlendFunc(770, 771, 1, 0); OpenGLHelper.depthMask(false); tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(beamsegment.func_177263_b()[0], beamsegment.func_177263_b()[1], beamsegment.func_177263_b()[2], 0.125F); d3 = 0.2D; d4 = 0.2D; d5 = 0.8D; d6 = 0.2D; d7 = 0.2D; d8 = 0.8D; d9 = 0.8D; d10 = 0.8D; d11 = 0.0D; d12 = 1.0D; d13 = -1.0F + f3; d14 = beamsegment.func_177264_c() * f1 + d13; tessellator.addVertexWithUV(x + d3, y + l, z + d4, d12, d14); tessellator.addVertexWithUV(x + d3, y + j, z + d4, d12, d13); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d11, d13); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d11, d14); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d12, d14); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d12, d13); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d11, d13); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d11, d14); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d12, d14); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d12, d13); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d11, d13); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d11, d14); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d12, d14); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d12, d13); tessellator.addVertexWithUV(x + d3, y + j, z + d4, d11, d13); tessellator.addVertexWithUV(x + d3, y + l, z + d4, d11, d14); tessellator.draw(); OpenGLHelper.enableLighting(); OpenGLHelper.enableTexture2D(); OpenGLHelper.depthMask(true); j = l; } } }
Example 16
Source File: FXVortex.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
private void render(Tessellator tessellator, float pTicks) { float arX = ActiveRenderInfo.rotationX; float arXZ = ActiveRenderInfo.rotationXZ; float arZ = ActiveRenderInfo.rotationZ; float arYZ = ActiveRenderInfo.rotationYZ; float arXY = ActiveRenderInfo.rotationXY; GL11.glPushMatrix(); GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float agescale = (float) (ClientHandler.ticks % 800) / 400F; if(agescale >= 1.0F) agescale = 2 - agescale; float size = 0.2F + 0.1F * agescale; if(parent != null) { size += size * (((float) parent.getSizeStage()) * 0.04F); } float anglePerc = (float) (ClientHandler.ticks % 300) / 300F; float angle = RAD - RAD * anglePerc; Vector3 iV = MiscUtils.interpolateEntityPosition(Minecraft.getMinecraft().renderViewEntity, pTicks); if(parent != null && parent.getSizeStage() > 4) { float mult = 0.001F * (parent.getSizeStage() - 4F); Vector3 shake = new Vector3( RAND.nextFloat() * mult * (RAND.nextBoolean() ? 1 : -1), RAND.nextFloat() * mult * (RAND.nextBoolean() ? 1 : -1), RAND.nextFloat() * mult * (RAND.nextBoolean() ? 1 : -1)); iV.add(shake); } GL11.glTranslated(-iV.getX(), -iV.getY(), -iV.getZ()); UtilsFX.bindTexture(TC_VORTEX_TEXTURE); tessellator.startDrawingQuads(); tessellator.setBrightness(220); tessellator.setColorRGBA_F(1F, 1F, 1F, 1F); Vec3 v1 = Vec3.createVectorHelper(-arX * size - arYZ * size, -arXZ * size, -arZ * size - arXY * size); Vec3 v2 = Vec3.createVectorHelper(-arX * size + arYZ * size, arXZ * size, -arZ * size + arXY * size); Vec3 v3 = Vec3.createVectorHelper(arX * size + arYZ * size, arXZ * size, arZ * size + arXY * size); Vec3 v4 = Vec3.createVectorHelper(arX * size - arYZ * size, -arXZ * size, arZ * size - arXY * size); if (angle != 0.0F) { Vec3 pvec = Vec3.createVectorHelper(iV.getX(), iV.getY(), iV.getZ()); Vec3 tvec = Vec3.createVectorHelper(x, y, z); Vec3 qvec = pvec.subtract(tvec).normalize(); QuadHelper.setAxis(qvec, angle).rotate(v1); QuadHelper.setAxis(qvec, angle).rotate(v2); QuadHelper.setAxis(qvec, angle).rotate(v3); QuadHelper.setAxis(qvec, angle).rotate(v4); } tessellator.setNormal(0.0F, 0.0F, -1.0F); tessellator.addVertexWithUV(x + v1.xCoord, y + v1.yCoord, z + v1.zCoord, 0, 1); tessellator.addVertexWithUV(x + v2.xCoord, y + v2.yCoord, z + v2.zCoord, 1, 1); tessellator.addVertexWithUV(x + v3.xCoord, y + v3.yCoord, z + v3.zCoord, 1, 0); tessellator.addVertexWithUV(x + v4.xCoord, y + v4.yCoord, z + v4.zCoord, 0, 0); tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glPopMatrix(); }
Example 17
Source File: RenderPortal.java From LookingGlass with GNU General Public License v3.0 | 4 votes |
@Override public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { if (!(entity instanceof EntityPortal)) return; EntityPortal portal = (EntityPortal) entity; IWorldView activeview = portal.getActiveView(); if (activeview == null) return; int texture = activeview.getTexture(); if (texture == 0) return; int width = 2; int height = 3; double left = -width / 2.; double top = 0; activeview.markDirty(); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); GL11.glTranslatef((float) d, (float) d1, (float) d2); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture); Tessellator tessellator = Tessellator.instance; tessellator.setColorRGBA_F(1, 1, 1, 1); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(left, top, 0.0D, 0.0D, 0.0D); //inc=bl out; inc=bl down tessellator.addVertexWithUV(width + left, top, 0.0D, 1.0D, 0.0D); //dc=br out; inc=br down tessellator.addVertexWithUV(width + left, height + top, 0.0D, 1.0D, 1.0D); //dec=tr out; dec=tr up tessellator.addVertexWithUV(left, height + top, 0.0D, 0.0D, 1.0D); //inc=lt out; dec=tl up tessellator.draw(); GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0); //XXX: Make the back of the portals a little nicer tessellator.setColorRGBA_F(0, 0, 1, 1); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(left, height + top, 0.0D, 0.0D, 1.0D); tessellator.addVertexWithUV(width + left, height + top, 0.0D, 1.0D, 1.0D); tessellator.addVertexWithUV(width + left, top, 0.0D, 1.0D, 0.0D); tessellator.addVertexWithUV(left, top, 0.0D, 0.0D, 0.0D); tessellator.draw(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_ALPHA_TEST); }