List of usage examples for org.lwjgl.opengl GL11 GL_FLAT
int GL_FLAT
To view the source code for org.lwjgl.opengl GL11 GL_FLAT.
Click Source Link
From source file:stevekung.mods.moreplanets.planets.pluto.dimension.sky.SkyProviderPluto.java
License:Creative Commons License
@Override public void render(float partialTicks, WorldClient world, Minecraft mc) { WorldProviderPluto gcProvider = null; if (world.provider instanceof WorldProviderPluto) { gcProvider = (WorldProviderPluto) world.provider; }/*from w ww.j a v a 2 s . c o m*/ GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableStandardItemLighting(); GL11.glDisable(GL11.GL_TEXTURE_2D); Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks); float f1 = (float) vec3.xCoord; float f2 = (float) vec3.yCoord; float f3 = (float) vec3.zCoord; float f6; if (mc.gameSettings.anaglyph) { float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F; float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F; f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F; f1 = f4; f2 = f5; f3 = f6; } GL11.glColor3f(1F, 1F, 1F); Tessellator var23 = Tessellator.instance; Tessellator tessellator1 = Tessellator.instance; GL11.glDepthMask(false); GL11.glEnable(GL11.GL_FOG); GL11.glColor3f(0, 0, 0); GL11.glCallList(this.glSkyList); GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderHelper.disableStandardItemLighting(); float var10; float var11; float var12; float var20 = 0; if (gcProvider != null) { var20 = gcProvider.getStarBrightness(partialTicks); } if (var20 > 0.0F) { GL11.glColor4f(1.0F, 1.0F, 1.0F, var20); GL11.glCallList(this.starGLCallList); } float f7; float f8; float f9; float f10; float f18 = 0; float[] afloat = new float[4]; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glPushMatrix(); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); afloat[0] = 255 / 255.0F; afloat[1] = 255 / 255.0F; afloat[2] = 235 / 255.0F; afloat[3] = 0.3F; f6 = afloat[0]; f7 = afloat[1]; f8 = afloat[2]; float f11; if (mc.gameSettings.anaglyph) { f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F; f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F; f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F; f6 = f9; f7 = f10; f8 = f11; } f18 = 1.0F - f18; tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN); tessellator1.setColorRGBA_F(f6 * f18, f7 * f18, f8 * f18, afloat[3] * 2 / f18); tessellator1.addVertex(0.0D, 100.0D, 0.0D); tessellator1.setColorRGBA_F(afloat[0] * f18, afloat[1] * f18, afloat[2] * f18, 0.0F); // Render sun aura f10 = 5.0F; tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F); tessellator1.addVertex(f10, 100.0D, -f10); tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(f10, 100.0D, f10); tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F); tessellator1.addVertex(-f10, 100.0D, f10); tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.draw(); tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN); tessellator1.setColorRGBA_F(f6 * f18, f7 * f18, f8 * f18, afloat[3] * f18); tessellator1.addVertex(0.0D, 100.0D, 0.0D); tessellator1.setColorRGBA_F(afloat[0] * f18, afloat[1] * f18, afloat[2] * f18, 0.0F); // Render larger sun aura f10 = 7.0F; tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F); tessellator1.addVertex(f10, 100.0D, -f10); tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(f10, 100.0D, f10); tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F); tessellator1.addVertex(-f10, 100.0D, f10); tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.draw(); GL11.glPopMatrix(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glEnable(GL11.GL_TEXTURE_2D); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO); GL11.glPushMatrix(); f7 = 0.0F; f8 = 0.0F; f9 = 0.0F; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef(f7, f8, f9); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glPushMatrix(); GL11.glPopMatrix(); GL11.glPushMatrix(); // Render sun GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); f10 = this.sunSize - 5.75F; mc.renderEngine.bindTexture(this.sunTexture); tessellator1.startDrawingQuads(); tessellator1.addVertexWithUV(-f10, 100.0D, -f10, 0.0D, 0.0D); tessellator1.addVertexWithUV(f10, 100.0D, -f10, 1.0D, 0.0D); tessellator1.addVertexWithUV(f10, 100.0D, f10, 1.0D, 1.0D); tessellator1.addVertexWithUV(-f10, 100.0D, f10, 0.0D, 1.0D); tessellator1.draw(); GL11.glDisable(GL11.GL_BLEND); // Earth f10 = 0.35F; GL11.glScalef(0.6F, 0.6F, 0.6F); GL11.glRotatef(15.0F, 5.0F, 0.0F, 0.0F); GL11.glRotatef(-32F, -100.0F, -20.0F, 180.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.earthTexture); tessellator1.startDrawingQuads(); tessellator1.addVertexWithUV(-f10, -100.0D, f10, 0, 1); tessellator1.addVertexWithUV(f10, -100.0D, f10, 1, 1); tessellator1.addVertexWithUV(f10, -100.0D, -f10, 1, 0); tessellator1.addVertexWithUV(-f10, -100.0D, -f10, 0, 0); tessellator1.draw(); // Venus f10 = 1.55F; GL11.glScalef(0.6F, 0.6F, 0.6F); GL11.glRotatef(200F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-600F, 50.0F, 10.0F, 10.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 10.0F, 0.0F, 0.0F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.venusTexture); tessellator1.startDrawingQuads(); tessellator1.addVertexWithUV(-f10, -100.0D, f10, 0, 1); tessellator1.addVertexWithUV(f10, -100.0D, f10, 1, 1); tessellator1.addVertexWithUV(f10, -100.0D, -f10, 1, 0); tessellator1.addVertexWithUV(-f10, -100.0D, -f10, 0, 0); tessellator1.draw(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_FOG); GL11.glPopMatrix(); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0.0F, 0.0F, 0.0F); double var25 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon(); if (var25 < 0.0D) { GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 12.0F, 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); var10 = 1.0F; var11 = -((float) (var25 + 65.0D)); var12 = -var10; var23.startDrawingQuads(); var23.setColorRGBA_I(0, 255); var23.addVertex(-var10, var11, var10); var23.addVertex(var10, var11, var10); var23.addVertex(var10, var12, var10); var23.addVertex(-var10, var12, var10); var23.addVertex(-var10, var12, -var10); var23.addVertex(var10, var12, -var10); var23.addVertex(var10, var11, -var10); var23.addVertex(-var10, var11, -var10); var23.addVertex(var10, var12, -var10); var23.addVertex(var10, var12, var10); var23.addVertex(var10, var11, var10); var23.addVertex(var10, var11, -var10); var23.addVertex(-var10, var11, -var10); var23.addVertex(-var10, var11, var10); var23.addVertex(-var10, var12, var10); var23.addVertex(-var10, var12, -var10); var23.addVertex(-var10, var12, -var10); var23.addVertex(-var10, var12, var10); var23.addVertex(var10, var12, var10); var23.addVertex(var10, var12, -var10); var23.draw(); } GL11.glPushMatrix(); GL11.glTranslatef(0.0F, -((float) (var25 - 16.0D)), 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); }
From source file:stevekung.mods.moreplanets.planets.polongnius.dimension.sky.SkyProviderPolongnius.java
License:Creative Commons License
@Override public void render(float partialTicks, WorldClient world, Minecraft mc) { GL11.glDisable(GL11.GL_TEXTURE_2D);//ww w .ja v a2 s .c o m GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableStandardItemLighting(); GL11.glDisable(GL11.GL_TEXTURE_2D); Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks); float f1 = (float) vec3.xCoord; float f2 = (float) vec3.yCoord; float f3 = (float) vec3.zCoord; float f6; if (mc.gameSettings.anaglyph) { float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F; float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F; f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F; f1 = f4; f2 = f5; f3 = f6; } GL11.glColor3f(f1, f2, f3); Tessellator tessellator1 = Tessellator.instance; GL11.glDepthMask(false); GL11.glEnable(GL11.GL_FOG); GL11.glColor3f(f1, f2, f3); GL11.glCallList(this.glSkyList); GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); RenderHelper.disableStandardItemLighting(); float f7; float f8; float f9; float f10; float f18 = world.getStarBrightness(partialTicks); if (f18 > 0.0F) { GL11.glColor4f(f18, f18, f18, f18); GL11.glCallList(this.starList); } float[] afloat = new float[4]; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glPushMatrix(); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); afloat[0] = 0 / 255.0F; afloat[1] = 225 / 255.0F; afloat[2] = 255 / 255.0F; afloat[3] = 0.4F; f6 = afloat[0]; f7 = afloat[1]; f8 = afloat[2]; float f11; if (mc.gameSettings.anaglyph) { f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F; f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F; f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F; f6 = f9; f7 = f10; f8 = f11; } f18 = 1.0F - f18; tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN); tessellator1.setColorRGBA_F(f6 * f18, f7 * f18, f8 * f18, afloat[3] * 2 / f18); tessellator1.addVertex(0.0D, 100.0D, 0.0D); tessellator1.setColorRGBA_F(afloat[0] * f18, afloat[1] * f18, afloat[2] * f18, 0.0F); // Render sun aura f10 = 14.0F; tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F); tessellator1.addVertex(f10, 100.0D, -f10); tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(f10, 100.0D, f10); tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F); tessellator1.addVertex(-f10, 100.0D, f10); tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.draw(); tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN); tessellator1.setColorRGBA_F(f6 * f18, f7 * f18, f8 * f18, afloat[3] * f18); tessellator1.addVertex(0.0D, 100.0D, 0.0D); tessellator1.setColorRGBA_F(afloat[0] * f18, afloat[1] * f18, afloat[2] * f18, 0.0F); // Render larger sun aura f10 = 30.0F; tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F); tessellator1.addVertex(f10, 100.0D, -f10); tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(f10, 100.0D, f10); tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F); tessellator1.addVertex(-f10, 100.0D, f10); tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.draw(); GL11.glPopMatrix(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glEnable(GL11.GL_TEXTURE_2D); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO); GL11.glPushMatrix(); GL11.glPopMatrix(); GL11.glPushMatrix(); f7 = 0.0F; f8 = 0.0F; f9 = 0.0F; GL11.glTranslatef(f7, f8, f9); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor4f(0.0F, 0.0F, 0.0F, 1.0F); f10 = 9.5F / 3.5F; tessellator1.startDrawingQuads(); tessellator1.addVertex(-f10, 99.9D, -f10); tessellator1.addVertex(f10, 99.9D, -f10); tessellator1.addVertex(f10, 99.9D, f10); tessellator1.addVertex(-f10, 99.9D, f10); tessellator1.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); // Render sirius GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor4f(0.0F, 0.0F, 0.0F, 1.0F); //Some blanking to conceal the stars f10 = this.sunSize / 3.5F; tessellator1.startDrawingQuads(); tessellator1.addVertex(-f10, 99.9D, -f10); tessellator1.addVertex(f10, 99.9D, -f10); tessellator1.addVertex(f10, 99.9D, f10); tessellator1.addVertex(-f10, 99.9D, f10); tessellator1.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); f10 = this.sunSize + 7; mc.renderEngine.bindTexture(this.siriusTexture); tessellator1.startDrawingQuads(); tessellator1.addVertexWithUV(-f10, 100.0D, -f10, 0.0D, 0.0D); tessellator1.addVertexWithUV(f10, 100.0D, -f10, 1.0D, 0.0D); tessellator1.addVertexWithUV(f10, 100.0D, f10, 1.0D, 1.0D); tessellator1.addVertexWithUV(-f10, 100.0D, f10, 0.0D, 1.0D); tessellator1.draw(); // Render diona f10 = 0.75F; GL11.glScalef(0.6F, 0.6F, 0.6F); GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(220F, 1.0F, -0.3F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.dionaTexture); tessellator1.startDrawingQuads(); tessellator1.addVertexWithUV(-f10, -100.0D, f10, 0, 1); tessellator1.addVertexWithUV(f10, -100.0D, f10, 1, 1); tessellator1.addVertexWithUV(f10, -100.0D, -f10, 1, 0); tessellator1.addVertexWithUV(-f10, -100.0D, -f10, 0, 0); tessellator1.draw(); GL11.glPopMatrix(); GL11.glPushMatrix(); // Render nibiru f10 = 3.8F; GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(0.6F, 0.6F, 0.6F); GL11.glRotatef(-30.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(-10.0F, 1.0F, 0.5F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.nibiruTexture); tessellator1.startDrawingQuads(); tessellator1.addVertexWithUV(-f10, -100.0D, f10, 0, 1); tessellator1.addVertexWithUV(f10, -100.0D, f10, 1, 1); tessellator1.addVertexWithUV(f10, -100.0D, -f10, 1, 0); tessellator1.addVertexWithUV(-f10, -100.0D, -f10, 0, 0); tessellator1.draw(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_FOG); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0.0F, 0.0F, 0.0F); double d0 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon(); if (d0 < 0.0D) { GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 12.0F, 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); f8 = 1.0F; f9 = -((float) (d0 + 65.0D)); f10 = -f8; tessellator1.startDrawingQuads(); tessellator1.setColorRGBA_I(0, 255); tessellator1.addVertex(-f8, f9, f8); tessellator1.addVertex(f8, f9, f8); tessellator1.addVertex(f8, f10, f8); tessellator1.addVertex(-f8, f10, f8); tessellator1.addVertex(-f8, f10, -f8); tessellator1.addVertex(f8, f10, -f8); tessellator1.addVertex(f8, f9, -f8); tessellator1.addVertex(-f8, f9, -f8); tessellator1.addVertex(f8, f10, -f8); tessellator1.addVertex(f8, f10, f8); tessellator1.addVertex(f8, f9, f8); tessellator1.addVertex(f8, f9, -f8); tessellator1.addVertex(-f8, f9, -f8); tessellator1.addVertex(-f8, f9, f8); tessellator1.addVertex(-f8, f10, f8); tessellator1.addVertex(-f8, f10, -f8); tessellator1.addVertex(-f8, f10, -f8); tessellator1.addVertex(-f8, f10, f8); tessellator1.addVertex(f8, f10, f8); tessellator1.addVertex(f8, f10, -f8); tessellator1.draw(); } if (world.provider.isSkyColored()) { GL11.glColor3f(f1 * 0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F); } else { GL11.glColor3f(f1, f2, f3); } GL11.glPushMatrix(); GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); }
From source file:stevekung.mods.moreplanets.planets.siriusb.dimension.sky.SkyProviderSiriusB.java
License:Creative Commons License
@Override public void render(float partialTicks, WorldClient world, Minecraft mc) { GL11.glDisable(GL11.GL_TEXTURE_2D);/*from w w w. j a v a2 s . c o m*/ GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableStandardItemLighting(); GL11.glDisable(GL11.GL_TEXTURE_2D); Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks); float f1 = (float) vec3.xCoord; float f2 = (float) vec3.yCoord; float f3 = (float) vec3.zCoord; float f6; if (mc.gameSettings.anaglyph) { float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F; float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F; f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F; f1 = f4; f2 = f5; f3 = f6; } GL11.glColor3f(0, 0, 0); Tessellator tessellator1 = Tessellator.instance; GL11.glDepthMask(false); GL11.glEnable(GL11.GL_FOG); GL11.glColor3f(0, 0, 0); GL11.glCallList(this.glSkyList); GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); RenderHelper.disableStandardItemLighting(); float f7; float f8; float f9; float f10; float f18 = world.getStarBrightness(partialTicks); if (f18 > 0.0F) { GL11.glColor4f(f18, f18, f18, f18); GL11.glCallList(this.starList); } float[] afloat = new float[4]; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glPushMatrix(); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); afloat[0] = 0 / 255.0F; afloat[1] = 225 / 255.0F; afloat[2] = 255 / 255.0F; afloat[3] = 0.5F; f6 = afloat[0]; f7 = afloat[1]; f8 = afloat[2]; float f11; if (mc.gameSettings.anaglyph) { f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F; f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F; f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F; f6 = f9; f7 = f10; f8 = f11; } f18 = 1.0F - f18; tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN); tessellator1.setColorRGBA_F(f6 * f18, f7 * f18, f8 * f18, afloat[3] * 2 / f18); tessellator1.addVertex(0.0D, 100.0D, 0.0D); tessellator1.setColorRGBA_F(afloat[0] * f18, afloat[1] * f18, afloat[2] * f18, 0.0F); // Render sun aura f10 = 150.0F; tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F); tessellator1.addVertex(f10, 100.0D, -f10); tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(f10, 100.0D, f10); tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F); tessellator1.addVertex(-f10, 100.0D, f10); tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.draw(); tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN); tessellator1.setColorRGBA_F(f6 * f18, f7 * f18, f8 * f18, afloat[3] * f18); tessellator1.addVertex(0.0D, 100.0D, 0.0D); tessellator1.setColorRGBA_F(afloat[0] * f18, afloat[1] * f18, afloat[2] * f18, 0.0F); // Render larger sun aura f10 = 200.0F; tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F); tessellator1.addVertex(f10, 100.0D, -f10); tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(f10, 100.0D, f10); tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F); tessellator1.addVertex(-f10, 100.0D, f10); tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.draw(); GL11.glPopMatrix(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glEnable(GL11.GL_TEXTURE_2D); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO); GL11.glPushMatrix(); f7 = 0.0F; f8 = 0.0F; f9 = 0.0F; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef(f7, f8, f9); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); // Sirius GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); f10 = this.sunSize; mc.renderEngine.bindTexture(this.siriusTexture); tessellator1.startDrawingQuads(); tessellator1.addVertexWithUV(-f10, 100.0D, -f10, 0.0D, 0.0D); tessellator1.addVertexWithUV(f10, 100.0D, -f10, 1.0D, 0.0D); tessellator1.addVertexWithUV(f10, 100.0D, f10, 1.0D, 1.0D); tessellator1.addVertexWithUV(-f10, 100.0D, f10, 0.0D, 1.0D); tessellator1.draw(); GL11.glDisable(GL11.GL_BLEND); // Fronos f10 = 0.35F; GL11.glScalef(0.6F, 0.6F, 0.6F); GL11.glRotatef(15.0F, 5.0F, 0.0F, 0.0F); GL11.glRotatef(-32F, -100.0F, -20.0F, 180.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.fronosTexture); tessellator1.startDrawingQuads(); tessellator1.addVertexWithUV(-f10, -100.0D, f10, 0, 1); tessellator1.addVertexWithUV(f10, -100.0D, f10, 1, 1); tessellator1.addVertexWithUV(f10, -100.0D, -f10, 1, 0); tessellator1.addVertexWithUV(-f10, -100.0D, -f10, 0, 0); tessellator1.draw(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_FOG); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0.0F, 0.0F, 0.0F); double d0 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon(); if (d0 < 0.0D) { GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 12.0F, 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); f8 = 1.0F; f9 = -((float) (d0 + 65.0D)); f10 = -f8; tessellator1.startDrawingQuads(); tessellator1.setColorRGBA_I(0, 255); tessellator1.addVertex(-f8, f9, f8); tessellator1.addVertex(f8, f9, f8); tessellator1.addVertex(f8, f10, f8); tessellator1.addVertex(-f8, f10, f8); tessellator1.addVertex(-f8, f10, -f8); tessellator1.addVertex(f8, f10, -f8); tessellator1.addVertex(f8, f9, -f8); tessellator1.addVertex(-f8, f9, -f8); tessellator1.addVertex(f8, f10, -f8); tessellator1.addVertex(f8, f10, f8); tessellator1.addVertex(f8, f9, f8); tessellator1.addVertex(f8, f9, -f8); tessellator1.addVertex(-f8, f9, -f8); tessellator1.addVertex(-f8, f9, f8); tessellator1.addVertex(-f8, f10, f8); tessellator1.addVertex(-f8, f10, -f8); tessellator1.addVertex(-f8, f10, -f8); tessellator1.addVertex(-f8, f10, f8); tessellator1.addVertex(f8, f10, f8); tessellator1.addVertex(f8, f10, -f8); tessellator1.draw(); } if (world.provider.isSkyColored()) { GL11.glColor3f(f1 * 0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F); } else { GL11.glColor3f(f1, f2, f3); } GL11.glPushMatrix(); GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); }
From source file:stevekung.mods.moreplanets.planets.venus.dimension.sky.SkyProviderVenus.java
License:Creative Commons License
@Override public void render(float partialTicks, WorldClient world, Minecraft mc) { GL11.glDisable(GL11.GL_TEXTURE_2D);/*from w w w . j a v a2s . c o m*/ GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableStandardItemLighting(); GL11.glDisable(GL11.GL_TEXTURE_2D); Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks); float f1 = (float) vec3.xCoord; float f2 = (float) vec3.yCoord; float f3 = (float) vec3.zCoord; float f6; if (mc.gameSettings.anaglyph) { float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F; float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F; f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F; f1 = f4; f2 = f5; f3 = f6; } GL11.glColor3f(f1, f2, f3); Tessellator tessellator1 = Tessellator.instance; GL11.glDepthMask(false); GL11.glEnable(GL11.GL_FOG); GL11.glColor3f(f1, f2, f3); GL11.glCallList(this.glSkyList); GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); RenderHelper.disableStandardItemLighting(); float f7; float f8; float f9; float f10; float f18 = world.getStarBrightness(partialTicks); if (f18 > 0.0F) { GL11.glColor4f(f18, f18, f18, f18); GL11.glCallList(this.starList); } float[] afloat = new float[4]; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glPushMatrix(); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); afloat[0] = 255 / 255.0F; afloat[1] = 225 / 255.0F; afloat[2] = 255 / 255.0F; afloat[3] = 0.3F; f6 = afloat[0]; f7 = afloat[1]; f8 = afloat[2]; float f11; if (mc.gameSettings.anaglyph) { f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F; f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F; f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F; f6 = f9; f7 = f10; f8 = f11; } f18 = 1.0F - f18; tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN); tessellator1.setColorRGBA_F(f6 * f18, f7 * f18, f8 * f18, afloat[3] * 2 / f18); tessellator1.addVertex(0.0D, 100.0D, 0.0D); tessellator1.setColorRGBA_F(afloat[0] * f18, afloat[1] * f18, afloat[2] * f18, 0.0F); // Render sun aura f10 = 50.0F; tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F); tessellator1.addVertex(f10, 100.0D, -f10); tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(f10, 100.0D, f10); tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F); tessellator1.addVertex(-f10, 100.0D, f10); tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.draw(); tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN); tessellator1.setColorRGBA_F(f6 * f18, f7 * f18, f8 * f18, afloat[3] * f18); tessellator1.addVertex(0.0D, 100.0D, 0.0D); tessellator1.setColorRGBA_F(afloat[0] * f18, afloat[1] * f18, afloat[2] * f18, 0.0F); // Render larger sun aura f10 = 75.0F; tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F); tessellator1.addVertex(f10, 100.0D, -f10); tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(f10, 100.0D, f10); tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F); tessellator1.addVertex(-f10, 100.0D, f10); tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0); tessellator1.addVertex(-f10, 100.0D, -f10); tessellator1.draw(); GL11.glPopMatrix(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glEnable(GL11.GL_TEXTURE_2D); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO); GL11.glPushMatrix(); f7 = 0.0F; f8 = 0.0F; f9 = 0.0F; GL11.glTranslatef(f7, f8, f9); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); // Render sun GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor4f(0.0F, 0.0F, 0.0F, 1.0F); //Some blanking to conceal the stars f10 = this.sunSize / 3.5F; tessellator1.startDrawingQuads(); tessellator1.addVertex(-f10, 99.9D, -f10); tessellator1.addVertex(f10, 99.9D, -f10); tessellator1.addVertex(f10, 99.9D, f10); tessellator1.addVertex(-f10, 99.9D, f10); tessellator1.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); f10 = this.sunSize; mc.renderEngine.bindTexture(this.sunTexture); tessellator1.startDrawingQuads(); tessellator1.addVertexWithUV(-f10, 100.0D, -f10, 0.0D, 0.0D); tessellator1.addVertexWithUV(f10, 100.0D, -f10, 1.0D, 0.0D); tessellator1.addVertexWithUV(f10, 100.0D, f10, 1.0D, 1.0D); tessellator1.addVertexWithUV(-f10, 100.0D, f10, 0.0D, 1.0D); tessellator1.draw(); // Render mercury f10 = 1.2F; GL11.glScalef(0.6F, 0.6F, 0.6F); GL11.glRotatef(80.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(200F, 1.0F, 0.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.mercuryTexture); tessellator1.startDrawingQuads(); tessellator1.addVertexWithUV(-f10, -100.0D, f10, 0, 1); tessellator1.addVertexWithUV(f10, -100.0D, f10, 1, 1); tessellator1.addVertexWithUV(f10, -100.0D, -f10, 1, 0); tessellator1.addVertexWithUV(-f10, -100.0D, -f10, 0, 0); tessellator1.draw(); GL11.glPopMatrix(); GL11.glPushMatrix(); // Render earth f10 = 0.25F; GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(0.6F, 0.6F, 0.6F); GL11.glRotatef(40.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(0F, 1.0F, 0.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.earthTexture); tessellator1.startDrawingQuads(); tessellator1.addVertexWithUV(-f10, -100.0D, f10, 0, 1); tessellator1.addVertexWithUV(f10, -100.0D, f10, 1, 1); tessellator1.addVertexWithUV(f10, -100.0D, -f10, 1, 0); tessellator1.addVertexWithUV(-f10, -100.0D, -f10, 0, 0); tessellator1.draw(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_FOG); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0.0F, 0.0F, 0.0F); double d0 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon(); if (d0 < 0.0D) { GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 12.0F, 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); f8 = 1.0F; f9 = -((float) (d0 + 65.0D)); f10 = -f8; tessellator1.startDrawingQuads(); tessellator1.setColorRGBA_I(0, 255); tessellator1.addVertex(-f8, f9, f8); tessellator1.addVertex(f8, f9, f8); tessellator1.addVertex(f8, f10, f8); tessellator1.addVertex(-f8, f10, f8); tessellator1.addVertex(-f8, f10, -f8); tessellator1.addVertex(f8, f10, -f8); tessellator1.addVertex(f8, f9, -f8); tessellator1.addVertex(-f8, f9, -f8); tessellator1.addVertex(f8, f10, -f8); tessellator1.addVertex(f8, f10, f8); tessellator1.addVertex(f8, f9, f8); tessellator1.addVertex(f8, f9, -f8); tessellator1.addVertex(-f8, f9, -f8); tessellator1.addVertex(-f8, f9, f8); tessellator1.addVertex(-f8, f10, f8); tessellator1.addVertex(-f8, f10, -f8); tessellator1.addVertex(-f8, f10, -f8); tessellator1.addVertex(-f8, f10, f8); tessellator1.addVertex(f8, f10, f8); tessellator1.addVertex(f8, f10, -f8); tessellator1.draw(); } if (world.provider.isSkyColored()) { GL11.glColor3f(f1 * 0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F); } else { GL11.glColor3f(f1, f2, f3); } GL11.glPushMatrix(); GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); }
From source file:thaumic.tinkerer.client.core.helper.ClientHelper.java
License:Creative Commons License
public static void drawGradientRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) { float var7 = (par5 >> 24 & 255) / 255.0F; float var8 = (par5 >> 16 & 255) / 255.0F; float var9 = (par5 >> 8 & 255) / 255.0F; float var10 = (par5 & 255) / 255.0F; float var11 = (par6 >> 24 & 255) / 255.0F; float var12 = (par6 >> 16 & 255) / 255.0F; float var13 = (par6 >> 8 & 255) / 255.0F; float var14 = (par6 & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D);//from www . j av a 2 s .co m GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glShadeModel(GL11.GL_SMOOTH); Tessellator var15 = Tessellator.instance; var15.startDrawingQuads(); var15.setColorRGBA_F(var8, var9, var10, var7); var15.addVertex(par3, par2, z); var15.addVertex(par1, par2, z); var15.setColorRGBA_F(var12, var13, var14, var11); var15.addVertex(par1, par4, z); var15.addVertex(par3, par4, z); var15.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:totemic_commons.pokefenn.client.RenderHelper.java
License:MIT License
public static void renderStar(int color, float xScale, float yScale, float zScale, long seed) { Tessellator tessellator = Tessellator.instance; int ticks = (int) (Minecraft.getMinecraft().theWorld.getTotalWorldTime() % 200); if (ticks >= 100) ticks = 200 - ticks - 1;/* www. ja va 2 s . c om*/ float f1 = ticks / 200F; float f2 = 0F; if (f1 > 0.7F) f2 = (f1 - 0.7F) / 0.2F; Random random = new Random(seed); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(770, 1); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); GL11.glTranslatef(0F, -1F, -2F); GL11.glScalef(xScale, yScale, zScale); for (int i = 0; i < (f1 + f1 * f1) / 2F * 90F + 30F; i++) { GL11.glRotatef(random.nextFloat() * 360F, 1F, 0F, 0F); GL11.glRotatef(random.nextFloat() * 360F, 0F, 1F, 0F); GL11.glRotatef(random.nextFloat() * 360F, 0F, 0F, 1F); GL11.glRotatef(random.nextFloat() * 360F, 1F, 0F, 0F); GL11.glRotatef(random.nextFloat() * 360F, 0F, 1F, 0F); GL11.glRotatef(random.nextFloat() * 360F + f1 * 90F, 0F, 0F, 1F); tessellator.startDrawing(GL11.GL_TRIANGLE_FAN); float f3 = random.nextFloat() * 20F + 5F + f2 * 10F; float f4 = random.nextFloat() * 2F + 1F + f2 * 2F; tessellator.setColorRGBA_I(color, (int) (255F * (1F - f2))); tessellator.addVertex(0, 0, 0); tessellator.setColorRGBA_F(0F, 0F, 0F, 0); tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4); tessellator.addVertex(0.866D * f4, f3, -0.5F * f4); tessellator.addVertex(0, f3, 1F * f4); tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4); tessellator.draw(); } GL11.glDepthMask(true); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glShadeModel(GL11.GL_FLAT); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glPopMatrix(); }
From source file:vazkii.arl.util.RenderHelper.java
License:Open Source License
public static void drawGradientRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) { float var7 = (par5 >> 24 & 255) / 255F; float var8 = (par5 >> 16 & 255) / 255F; float var9 = (par5 >> 8 & 255) / 255F; float var10 = (par5 & 255) / 255F; float var11 = (par6 >> 24 & 255) / 255F; float var12 = (par6 >> 16 & 255) / 255F; float var13 = (par6 >> 8 & 255) / 255F; float var14 = (par6 & 255) / 255F; GlStateManager.disableTexture2D();//from ww w . ja va 2s . co m GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator var15 = Tessellator.getInstance(); VertexBuffer buff = var15.getBuffer(); buff.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buff.pos(par3, par2, z).color(var8, var9, var10, var7).endVertex(); buff.pos(par1, par2, z).color(var8, var9, var10, var7).endVertex(); buff.pos(par1, par4, z).color(var12, var13, var14, var11).endVertex(); buff.pos(par3, par4, z).color(var12, var13, var14, var11).endVertex(); var15.draw(); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); }
From source file:vazkii.botania.client.core.handler.TiaraWingRenderHandler.java
License:Creative Commons License
private void renderHalo(EntityPlayer player, float partialTicks) { float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks; float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks; float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks; GL11.glPushMatrix();//from w w w .j a v a2 s .c om GL11.glRotatef(yawOffset, 0, -1, 0); GL11.glRotatef(yaw - 270, 0, 1, 0); GL11.glRotatef(pitch, 0, 0, 1); GL11.glShadeModel(GL11.GL_SMOOTH); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); GL11.glDisable(GL11.GL_LIGHTING); GL11.glColor4f(1F, 1F, 1F, 1F); Minecraft.getMinecraft().renderEngine.bindTexture(textureHalo); GL11.glTranslated(0, -player.eyeHeight + (player.isSneaking() ? 0.0625 : 0), 0); GL11.glRotated(30, 1, 0, -1); GL11.glTranslatef(-0.1F, -0.5F, -0.1F); GL11.glRotatef(player.ticksExisted + partialTicks, 0, 1, 0); Tessellator tes = Tessellator.instance; tes.startDrawingQuads(); tes.addVertexWithUV(-0.5, 0, -0.5, 0, 0); tes.addVertexWithUV(-0.5, 0, 0.5, 0, 1); tes.addVertexWithUV(0.5, 0, 0.5, 1, 1); tes.addVertexWithUV(0.5, 0, -0.5, 1, 0); tes.draw(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glShadeModel(GL11.GL_FLAT); GL11.glPopMatrix(); }
From source file:vazkii.botania.client.core.handler.TooltipAdditionDisplayHandler.java
License:Open Source License
@SubscribeEvent public static void onToolTipRender(RenderTooltipEvent.PostText evt) { if (evt.getStack() == null) return;/* w ww .ja v a 2 s . c o m*/ ItemStack stack = evt.getStack(); Minecraft mc = Minecraft.getMinecraft(); int width = evt.getWidth(); int height = 3; int tooltipX = evt.getX(); int tooltipY = evt.getY() - 4; FontRenderer font = evt.getFontRenderer(); if (stack.getItem() instanceof ItemTerraPick) drawTerraPick(stack, tooltipX, tooltipY, width, height, font); else if (stack.getItem() instanceof IManaTooltipDisplay) drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), tooltipX, tooltipY, width, height); EntryData data = LexiconRecipeMappings.getDataForStack(stack); if (data != null) { int lexSlot = -1; ItemStack lexiconStack = null; for (int i = 0; i < InventoryPlayer.getHotbarSize(); i++) { ItemStack stackAt = mc.thePlayer.inventory.getStackInSlot(i); if (stackAt != null && stackAt.getItem() instanceof ILexicon && ((ILexicon) stackAt.getItem()) .isKnowledgeUnlocked(stackAt, data.entry.getKnowledgeType())) { lexiconStack = stackAt; lexSlot = i; break; } } if (lexSlot > -1) { int x = tooltipX - 34; GlStateManager.disableDepth(); Gui.drawRect(x - 4, tooltipY - 4, x + 20, tooltipY + 26, 0x44000000); Gui.drawRect(x - 6, tooltipY - 6, x + 22, tooltipY + 28, 0x44000000); if (ConfigHandler.useShiftForQuickLookup ? GuiScreen.isShiftKeyDown() : GuiScreen.isCtrlKeyDown()) { lexiconLookupTime += ClientTickHandler.delta; int cx = x + 8; int cy = tooltipY + 8; float r = 12; float time = 20F; float angles = lexiconLookupTime / time * 360F; GlStateManager.disableLighting(); GlStateManager.disableTexture2D(); GlStateManager.shadeModel(GL11.GL_SMOOTH); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); VertexBuffer buf = Tessellator.getInstance().getBuffer(); buf.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR); float a = 0.5F + 0.2F * ((float) Math .cos((double) (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) / 10) * 0.5F + 0.5F); buf.pos(cx, cy, 0).color(0F, 0.5F, 0F, a).endVertex(); for (float i = angles; i > 0; i--) { double rad = (i - 90) / 180F * Math.PI; buf.pos(cx + Math.cos(rad) * r, cy + Math.sin(rad) * r, 0).color(0F, 1F, 0F, 1F) .endVertex(); } buf.pos(cx, cy, 0).color(0F, 1F, 0F, 0F).endVertex(); Tessellator.getInstance().draw(); GlStateManager.disableBlend(); GlStateManager.enableTexture2D(); GlStateManager.shadeModel(GL11.GL_FLAT); if (lexiconLookupTime >= time) { mc.thePlayer.inventory.currentItem = lexSlot; Botania.proxy.setEntryToOpen(data.entry); Botania.proxy.setLexiconStack(lexiconStack); mc.thePlayer.closeScreen(); ItemLexicon.openBook(mc.thePlayer, lexiconStack, mc.theWorld, false); } } else lexiconLookupTime = 0F; mc.getRenderItem().renderItemIntoGUI(new ItemStack(ModItems.lexicon), x, tooltipY); GlStateManager.disableLighting(); font.drawStringWithShadow("?", x + 10, tooltipY + 8, 0xFFFFFFFF); GlStateManager.scale(0.5F, 0.5F, 1F); boolean mac = Minecraft.IS_RUNNING_ON_MAC; mc.fontRendererObj.drawStringWithShadow( TextFormatting.BOLD + (ConfigHandler.useShiftForQuickLookup ? "Shift" : mac ? "Cmd" : "Ctrl"), (x + 10) * 2 - 16, (tooltipY + 8) * 2 + 20, 0xFFFFFFFF); GlStateManager.scale(2F, 2F, 1F); GlStateManager.enableDepth(); } else lexiconLookupTime = 0F; } else lexiconLookupTime = 0F; }
From source file:vazkii.botania.client.core.helper.RenderHelper.java
License:Open Source License
public static void drawGradientRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) { float var7 = (par5 >> 24 & 255) / 255F; float var8 = (par5 >> 16 & 255) / 255F; float var9 = (par5 >> 8 & 255) / 255F; float var10 = (par5 & 255) / 255F; float var11 = (par6 >> 24 & 255) / 255F; float var12 = (par6 >> 16 & 255) / 255F; float var13 = (par6 >> 8 & 255) / 255F; float var14 = (par6 & 255) / 255F; GlStateManager.disableTexture2D();//www. jav a 2 s . c o m GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator var15 = Tessellator.getInstance(); var15.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); var15.getBuffer().pos(par3, par2, z).color(var8, var9, var10, var7).endVertex(); var15.getBuffer().pos(par1, par2, z).color(var8, var9, var10, var7).endVertex(); var15.getBuffer().pos(par1, par4, z).color(var12, var13, var14, var11).endVertex(); var15.getBuffer().pos(par3, par4, z).color(var12, var13, var14, var11).endVertex(); var15.draw(); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); }