List of usage examples for org.lwjgl.opengl GL11 glDepthMask
public static void glDepthMask(@NativeType("GLboolean") boolean flag)
From source file:matteroverdrive.util.RenderUtils.java
License:Open Source License
public static void drawStencil(int xMin, int yMin, int xMax, int yMax, int mask) { GL11.glDisable(GL_TEXTURE_2D);/*from ww w. j a v a2s . c o m*/ GL11.glStencilFunc(GL_ALWAYS, mask, mask); GL11.glStencilOp(0, 0, GL_REPLACE); GL11.glStencilMask(1); GL11.glColorMask(false, false, false, false); GL11.glDepthMask(false); Tessellator.instance.startDrawingQuads(); Tessellator.instance.addVertex((double) xMin, (double) yMax, 0.0D); Tessellator.instance.addVertex((double) xMax, (double) yMax, 0.0D); Tessellator.instance.addVertex((double) xMax, (double) yMin, 0.0D); Tessellator.instance.addVertex((double) xMin, (double) yMin, 0.0D); Tessellator.instance.draw(); GL11.glEnable(GL_TEXTURE_2D); GL11.glStencilFunc(GL_EQUAL, mask, mask); GL11.glStencilMask(0); GL11.glColorMask(true, true, true, true); GL11.glDepthMask(true); }
From source file:mattparks.mods.starcraft.callisto.client.SCCallistoSkyProvider.java
License:LGPL
@Override public void render(float partialTicks, WorldClient world, Minecraft mc) { SCCallistoWorldProvider gcProvider = null; if (world.provider instanceof SCCallistoWorldProvider) { gcProvider = (SCCallistoWorldProvider) world.provider; }//from w w w . j a v a 2 s.c o m GL11.glDisable(GL11.GL_TEXTURE_2D); final Vec3 var2 = this.getCustomSkyColor(); float var3 = (float) var2.xCoord * (1 - world.getStarBrightness(partialTicks) * 2); float var4 = (float) var2.yCoord * (1 - world.getStarBrightness(partialTicks) * 2); float var5 = (float) var2.zCoord * (1 - world.getStarBrightness(partialTicks) * 2); float var8; if (mc.gameSettings.anaglyph) { final float var6 = (var3 * 30.0F + var4 * 59.0F + var5 * 11.0F) / 100.0F; final float var7 = (var3 * 30.0F + var4 * 70.0F) / 100.0F; var8 = (var3 * 30.0F + var5 * 70.0F) / 100.0F; var3 = var6; var4 = var7; var5 = var8; } GL11.glColor3f(1, 1, 1); final Tessellator var23 = 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); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glPushMatrix(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 5F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); var12 = 30.0F; FMLClientHandler.instance().getClient().renderEngine.bindTexture(SCCallistoSkyProvider.sunTexture); var23.startDrawingQuads(); var23.addVertexWithUV(-var12, 150.0D, -var12, 0.0D, 0.0D); var23.addVertexWithUV(var12, 150.0D, -var12, 1.0D, 0.0D); var23.addVertexWithUV(var12, 150.0D, var12, 1.0D, 1.0D); var23.addVertexWithUV(-var12, 150.0D, var12, 0.0D, 1.0D); var23.draw(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_BLEND); // JUPITER: var12 = 10.0F; final float jupiterRotation = (float) (world.getSpawnPoint().posZ - mc.thePlayer.posZ) * 0.01F; GL11.glRotatef(-180.0F, 0.0F, 1.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 5F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 40.0F, 1.0F, 0.0F, 0.0F); var12 = 30.0F; FMLClientHandler.instance().getClient().renderEngine.bindTexture(SCCallistoSkyProvider.jupiterTexture); var23.startDrawingQuads(); var23.addVertexWithUV(-var12, 155.0D, -var12, 0.0D, 0.0D); var23.addVertexWithUV(var12, 155.0D, -var12, 1.0D, 0.0D); var23.addVertexWithUV(var12, 155.0D, var12, 1.0D, 1.0D); var23.addVertexWithUV(-var12, 155.0D, var12, 0.0D, 1.0D); var23.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.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0.0F, 0.0F, 0.0F); final 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.glColor3f(70F / 256F, 70F / 256F, 70F / 256F); 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:mattparks.mods.starcraft.eris.client.SCErisSkyProvider.java
License:LGPL
@Override public void render(float partialTicks, WorldClient world, Minecraft mc) { SCErisWorldProvider gcProvider = null; if (world.provider instanceof SCErisWorldProvider) { gcProvider = (SCErisWorldProvider) world.provider; }// w ww .jav a 2 s . co m float var10; float var11; float var12; final Tessellator var23 = Tessellator.instance; GL11.glDisable(GL11.GL_TEXTURE_2D); final Vec3 var2 = this.getCustomSkyColor(); float var3 = (float) var2.xCoord * (1 - world.getStarBrightness(partialTicks) * 2); float var4 = (float) var2.yCoord * (1 - world.getStarBrightness(partialTicks) * 2); float var5 = (float) var2.zCoord * (1 - world.getStarBrightness(partialTicks) * 2); float var8; if (mc.gameSettings.anaglyph) { final float var6 = (var3 * 30.0F + var4 * 59.0F + var5 * 11.0F) / 100.0F; final float var7 = (var3 * 30.0F + var4 * 70.0F) / 100.0F; var8 = (var3 * 30.0F + var5 * 70.0F) / 100.0F; var3 = var6; var4 = var7; var5 = var8; } GL11.glColor3f(1, 1, 1); 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 var20 = 0; if (gcProvider != null) { var20 = gcProvider.getStarBrightness(partialTicks); } GL11.glPushMatrix(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); // STARS: 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(); if (var20 > 0.0F) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor4f(1.0F, 1.0F, 1.0F, var20); GL11.glCallList(this.starGLCallList); GL11.glEnable(GL11.GL_TEXTURE_2D); } GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glPushMatrix(); // Sun: GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); var12 = 30.0F; FMLClientHandler.instance().getClient().renderEngine.bindTexture(SCErisSkyProvider.sunTexture); var23.startDrawingQuads(); var23.addVertexWithUV(-var12, 150.0D, -var12, 0.0D, 0.0D); var23.addVertexWithUV(var12, 150.0D, -var12, 1.0D, 0.0D); var23.addVertexWithUV(var12, 150.0D, var12, 1.0D, 1.0D); var23.addVertexWithUV(-var12, 150.0D, var12, 0.0D, 1.0D); var23.draw(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_BLEND); 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); final 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.glColor3f(70F / 256F, 70F / 256F, 70F / 256F); 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:mattparks.mods.starcraft.europa.client.SCEuropaSkyProvider.java
License:LGPL
@Override public void render(float partialTicks, WorldClient world, Minecraft mc) { SCEuropaWorldProvider gcProvider = null; if (world.provider instanceof SCEuropaWorldProvider) { gcProvider = (SCEuropaWorldProvider) world.provider; }//from w w w . j a v a2 s . co m GL11.glDisable(GL11.GL_TEXTURE_2D); final Vec3 var2 = this.getCustomSkyColor(); float var3 = (float) var2.xCoord * (1 - world.getStarBrightness(partialTicks) * 2); float var4 = (float) var2.yCoord * (1 - world.getStarBrightness(partialTicks) * 2); float var5 = (float) var2.zCoord * (1 - world.getStarBrightness(partialTicks) * 2); float var8; if (mc.gameSettings.anaglyph) { final float var6 = (var3 * 30.0F + var4 * 59.0F + var5 * 11.0F) / 100.0F; final float var7 = (var3 * 30.0F + var4 * 70.0F) / 100.0F; var8 = (var3 * 30.0F + var5 * 70.0F) / 100.0F; var3 = var6; var4 = var7; var5 = var8; } GL11.glColor3f(1, 1, 1); final Tessellator var23 = 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); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glPushMatrix(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 5F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); var12 = 30.0F; FMLClientHandler.instance().getClient().renderEngine.bindTexture(SCEuropaSkyProvider.sunTexture); var23.startDrawingQuads(); var23.addVertexWithUV(-var12, 150.0D, -var12, 0.0D, 0.0D); var23.addVertexWithUV(var12, 150.0D, -var12, 1.0D, 0.0D); var23.addVertexWithUV(var12, 150.0D, var12, 1.0D, 1.0D); var23.addVertexWithUV(-var12, 150.0D, var12, 0.0D, 1.0D); var23.draw(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_BLEND); // JUPITER: var12 = 10.0F; final float jupiterRotation = (float) (world.getSpawnPoint().posZ - mc.thePlayer.posZ) * 0.01F; GL11.glRotatef(-180.0F, 0.0F, 1.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 5F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 80.0F, 1.0F, 0.0F, 0.0F); var12 = 30.0F; FMLClientHandler.instance().getClient().renderEngine.bindTexture(SCEuropaSkyProvider.jupiterTexture); var23.startDrawingQuads(); var23.addVertexWithUV(-var12, 95.0D, -var12, 0.0D, 0.0D); var23.addVertexWithUV(var12, 95.0D, -var12, 1.0D, 0.0D); var23.addVertexWithUV(var12, 95.0D, var12, 1.0D, 1.0D); var23.addVertexWithUV(-var12, 95.0D, var12, 0.0D, 1.0D); var23.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.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0.0F, 0.0F, 0.0F); final 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.glColor3f(70F / 256F, 70F / 256F, 70F / 256F); 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:mattparks.mods.starcraft.ganymede.client.SCGanymedeSkyProvider.java
License:LGPL
@Override public void render(float partialTicks, WorldClient world, Minecraft mc) { SCGanymedeWorldProvider gcProvider = null; if (world.provider instanceof SCGanymedeWorldProvider) { gcProvider = (SCGanymedeWorldProvider) world.provider; }//from ww w .ja v a 2 s .c o m GL11.glDisable(GL11.GL_TEXTURE_2D); final Vec3 var2 = this.getCustomSkyColor(); float var3 = (float) var2.xCoord * (1 - world.getStarBrightness(partialTicks) * 2); float var4 = (float) var2.yCoord * (1 - world.getStarBrightness(partialTicks) * 2); float var5 = (float) var2.zCoord * (1 - world.getStarBrightness(partialTicks) * 2); float var8; if (mc.gameSettings.anaglyph) { final float var6 = (var3 * 30.0F + var4 * 59.0F + var5 * 11.0F) / 100.0F; final float var7 = (var3 * 30.0F + var4 * 70.0F) / 100.0F; var8 = (var3 * 30.0F + var5 * 70.0F) / 100.0F; var3 = var6; var4 = var7; var5 = var8; } GL11.glColor3f(1, 1, 1); final Tessellator var23 = 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); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glPushMatrix(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 5F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); var12 = 30.0F; FMLClientHandler.instance().getClient().renderEngine.bindTexture(SCGanymedeSkyProvider.sunTexture); var23.startDrawingQuads(); var23.addVertexWithUV(-var12, 150.0D, -var12, 0.0D, 0.0D); var23.addVertexWithUV(var12, 150.0D, -var12, 1.0D, 0.0D); var23.addVertexWithUV(var12, 150.0D, var12, 1.0D, 1.0D); var23.addVertexWithUV(-var12, 150.0D, var12, 0.0D, 1.0D); var23.draw(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_BLEND); // JUPITER: var12 = 10.0F; final float jupiterRotation = (float) (world.getSpawnPoint().posZ - mc.thePlayer.posZ) * 0.01F; GL11.glRotatef(-180.0F, 0.0F, 1.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 5F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 60.0F, 1.0F, 0.0F, 0.0F); var12 = 30.0F; FMLClientHandler.instance().getClient().renderEngine.bindTexture(SCGanymedeSkyProvider.jupiterTexture); var23.startDrawingQuads(); var23.addVertexWithUV(-var12, 125.0D, -var12, 0.0D, 0.0D); var23.addVertexWithUV(var12, 125.0D, -var12, 1.0D, 0.0D); var23.addVertexWithUV(var12, 125.0D, var12, 1.0D, 1.0D); var23.addVertexWithUV(-var12, 125.0D, var12, 0.0D, 1.0D); var23.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.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0.0F, 0.0F, 0.0F); final 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.glColor3f(70F / 256F, 70F / 256F, 70F / 256F); 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:mattparks.mods.starcraft.io.client.SCIoSkyProvider.java
License:LGPL
@Override public void render(float partialTicks, WorldClient world, Minecraft mc) { GL11.glDisable(GL11.GL_TEXTURE_2D);//w w w . j a v a2 s.c om 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[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTicks), partialTicks); 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); } 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] = 194 / 255.0F; afloat[2] = 180 / 255.0F; afloat[3] = 0.3F; f6 = afloat[0]; f7 = afloat[1]; f8 = afloat[2]; float f11; float var12; 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; } final Tessellator var23 = Tessellator.instance; tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN); tessellator1.setColorRGBA_F(f6, f7, f8, afloat[3] * 2); tessellator1.addVertex(0.0D, 100.0D, 0.0D); byte b0 = 16; tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F); // Render sun aura f10 = 20.0F; tessellator1.addVertex((double) -f10, 100.0D, (double) -f10); tessellator1.addVertex((double) 0, 100.0D, (double) -f10 * 1.5F); tessellator1.addVertex((double) f10, 100.0D, (double) -f10); tessellator1.addVertex((double) f10 * 1.5F, 100.0D, (double) 0); tessellator1.addVertex((double) f10, 100.0D, (double) f10); tessellator1.addVertex((double) 0, 100.0D, (double) f10 * 1.5F); tessellator1.addVertex((double) -f10, 100.0D, (double) f10); tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, (double) 0); tessellator1.addVertex((double) -f10, 100.0D, (double) -f10); tessellator1.draw(); tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN); tessellator1.setColorRGBA_F(f6, f7, f8, afloat[3]); tessellator1.addVertex(0.0D, 100.0D, 0.0D); tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F); // Render larger sun aura f10 = 40.0F; tessellator1.addVertex((double) -f10, 100.0D, (double) -f10); tessellator1.addVertex((double) 0, 100.0D, (double) -f10 * 1.5F); tessellator1.addVertex((double) f10, 100.0D, (double) -f10); tessellator1.addVertex((double) f10 * 1.5F, 100.0D, (double) 0); tessellator1.addVertex((double) f10, 100.0D, (double) f10); tessellator1.addVertex((double) 0, 100.0D, (double) f10 * 1.5F); tessellator1.addVertex((double) -f10, 100.0D, (double) f10); tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, (double) 0); tessellator1.addVertex((double) -f10, 100.0D, (double) -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.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); // Render sun f10 = 14.0F; mc.renderEngine.bindTexture(sunTexture); tessellator1.startDrawingQuads(); tessellator1.addVertexWithUV((double) (-f10), 400.0D, (double) (-f10), 0.0D, 0.0D); tessellator1.addVertexWithUV((double) f10, 400.0D, (double) (-f10), 1.0D, 0.0D); tessellator1.addVertexWithUV((double) f10, 400.0D, (double) f10, 1.0D, 1.0D); tessellator1.addVertexWithUV((double) (-f10), 400.0D, (double) f10, 0.0D, 1.0D); tessellator1.draw(); // JUPITER: var12 = 10.0F; final float jupiterRotation = (float) (world.getSpawnPoint().posZ - mc.thePlayer.posZ) * 0.01F; GL11.glRotatef(-180.0F, 0.0F, 1.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 5F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 100.0F, 1.0F, 0.0F, 0.0F); var12 = 30.0F; FMLClientHandler.instance().getClient().renderEngine.bindTexture(SCIoSkyProvider.jupiterTexture); var23.startDrawingQuads(); var23.addVertexWithUV(-var12, 75.0D, -var12, 0.0D, 0.0D); var23.addVertexWithUV(var12, 75.0D, -var12, 1.0D, 0.0D); var23.addVertexWithUV(var12, 75.0D, var12, 1.0D, 1.0D); var23.addVertexWithUV(-var12, 75.0D, var12, 0.0D, 1.0D); var23.draw(); // Render earth f10 = 0.5F; GL11.glScalef(0.6F, 0.6F, 0.6F); GL11.glRotatef(40.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(SCIoSkyProvider.overworldTexture); 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((double) (-f8), (double) f9, (double) f8); tessellator1.addVertex((double) f8, (double) f9, (double) f8); tessellator1.addVertex((double) f8, (double) f10, (double) f8); tessellator1.addVertex((double) (-f8), (double) f10, (double) f8); tessellator1.addVertex((double) (-f8), (double) f10, (double) (-f8)); tessellator1.addVertex((double) f8, (double) f10, (double) (-f8)); tessellator1.addVertex((double) f8, (double) f9, (double) (-f8)); tessellator1.addVertex((double) (-f8), (double) f9, (double) (-f8)); tessellator1.addVertex((double) f8, (double) f10, (double) (-f8)); tessellator1.addVertex((double) f8, (double) f10, (double) f8); tessellator1.addVertex((double) f8, (double) f9, (double) f8); tessellator1.addVertex((double) f8, (double) f9, (double) (-f8)); tessellator1.addVertex((double) (-f8), (double) f9, (double) (-f8)); tessellator1.addVertex((double) (-f8), (double) f9, (double) f8); tessellator1.addVertex((double) (-f8), (double) f10, (double) f8); tessellator1.addVertex((double) (-f8), (double) f10, (double) (-f8)); tessellator1.addVertex((double) (-f8), (double) f10, (double) (-f8)); tessellator1.addVertex((double) (-f8), (double) f10, (double) f8); tessellator1.addVertex((double) f8, (double) f10, (double) f8); tessellator1.addVertex((double) f8, (double) f10, (double) (-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:mattparks.mods.starcraft.mercury.client.SCMercurySkyProvider.java
License:LGPL
@Override public void render(float partialTicks, WorldClient world, Minecraft mc) { SCMercuryWorldProvider gcProvider = null; if (world.provider instanceof SCMercuryWorldProvider) { gcProvider = (SCMercuryWorldProvider) world.provider; }//from w w w .j a v a 2 s . co m float var10; float var11; float var12; final Tessellator var23 = Tessellator.instance; GL11.glDisable(GL11.GL_TEXTURE_2D); final Vec3 var2 = this.getCustomSkyColor(); float var3 = (float) var2.xCoord * (1 - world.getStarBrightness(partialTicks) * 2); float var4 = (float) var2.yCoord * (1 - world.getStarBrightness(partialTicks) * 2); float var5 = (float) var2.zCoord * (1 - world.getStarBrightness(partialTicks) * 2); float var8; if (mc.gameSettings.anaglyph) { final float var6 = (var3 * 30.0F + var4 * 59.0F + var5 * 11.0F) / 100.0F; final float var7 = (var3 * 30.0F + var4 * 70.0F) / 100.0F; var8 = (var3 * 30.0F + var5 * 70.0F) / 100.0F; var3 = var6; var4 = var7; var5 = var8; } GL11.glColor3f(1, 1, 1); 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 var20 = 0; if (gcProvider != null) { var20 = gcProvider.getStarBrightness(partialTicks); } GL11.glPushMatrix(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(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(); if (var20 > 0.0F) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor4f(1.0F, 1.0F, 1.0F, var20); GL11.glCallList(this.starGLCallList); GL11.glEnable(GL11.GL_TEXTURE_2D); } GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glPushMatrix(); // Sun: GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); var12 = 30.0F; FMLClientHandler.instance().getClient().renderEngine.bindTexture(SCMercurySkyProvider.sunTexture); var23.startDrawingQuads(); var23.addVertexWithUV(-var12, 150.0D, -var12, 0.0D, 0.0D); var23.addVertexWithUV(var12, 150.0D, -var12, 1.0D, 0.0D); var23.addVertexWithUV(var12, 150.0D, var12, 1.0D, 1.0D); var23.addVertexWithUV(-var12, 150.0D, var12, 0.0D, 1.0D); var23.draw(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_BLEND); // OVERWORLD: var12 = 0.5F; GL11.glScalef(0.6F, 0.6F, 0.6F); GL11.glRotatef(40.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(SCMercurySkyProvider.venusTexture); var23.startDrawingQuads(); var23.addVertexWithUV(-var12, -100.0D, var12, 0, 1); var23.addVertexWithUV(var12, -100.0D, var12, 1, 1); var23.addVertexWithUV(var12, -100.0D, -var12, 1, 0); var23.addVertexWithUV(-var12, -100.0D, -var12, 0, 0); var23.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.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0.0F, 0.0F, 0.0F); final 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.glColor3f(70F / 256F, 70F / 256F, 70F / 256F); 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:mattparks.mods.starcraft.titan.client.SCTitanSkyProvider.java
License:LGPL
@Override public void render(float partialTicks, WorldClient world, Minecraft mc) { GL11.glDisable(GL11.GL_TEXTURE_2D);//ww w . ja v a 2 s .c om 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[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTicks), partialTicks); 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); } 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] = 194 / 255.0F; afloat[2] = 180 / 255.0F; afloat[3] = 0.3F; f6 = afloat[0]; f7 = afloat[1]; f8 = afloat[2]; float f11; float var12; 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; } final Tessellator var23 = Tessellator.instance; tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN); tessellator1.setColorRGBA_F(f6, f7, f8, afloat[3] * 2); tessellator1.addVertex(0.0D, 100.0D, 0.0D); byte b0 = 16; tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F); // Render sun aura f10 = 20.0F; tessellator1.addVertex((double) -f10, 200.0D, (double) -f10); tessellator1.addVertex((double) 0, 200.0D, (double) -f10 * 1.5F); tessellator1.addVertex((double) f10, 200.0D, (double) -f10); tessellator1.addVertex((double) f10 * 1.5F, 200.0D, (double) 0); tessellator1.addVertex((double) f10, 200.0D, (double) f10); tessellator1.addVertex((double) 0, 200.0D, (double) f10 * 1.5F); tessellator1.addVertex((double) -f10, 200.0D, (double) f10); tessellator1.addVertex((double) -f10 * 1.5F, 200.0D, (double) 0); tessellator1.addVertex((double) -f10, 200.0D, (double) -f10); tessellator1.draw(); tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN); tessellator1.setColorRGBA_F(f6, f7, f8, afloat[3]); tessellator1.addVertex(0.0D, 100.0D, 0.0D); tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F); // Render larger sun aura f10 = 40.0F; tessellator1.addVertex((double) -f10, 200.0D, (double) -f10); tessellator1.addVertex((double) 0, 200.0D, (double) -f10 * 1.5F); tessellator1.addVertex((double) f10, 200.0D, (double) -f10); tessellator1.addVertex((double) f10 * 1.5F, 200.0D, (double) 0); tessellator1.addVertex((double) f10, 200.0D, (double) f10); tessellator1.addVertex((double) 0, 200.0D, (double) f10 * 1.5F); tessellator1.addVertex((double) -f10, 200.0D, (double) f10); tessellator1.addVertex((double) -f10 * 1.5F, 200.0D, (double) 0); tessellator1.addVertex((double) -f10, 200.0D, (double) -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.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); // Render sun f10 = 14.0F; mc.renderEngine.bindTexture(sunTexture); tessellator1.startDrawingQuads(); tessellator1.addVertexWithUV((double) (-f10), 450.0D, (double) (-f10), 0.0D, 0.0D); tessellator1.addVertexWithUV((double) f10, 450.0D, (double) (-f10), 1.0D, 0.0D); tessellator1.addVertexWithUV((double) f10, 450.0D, (double) f10, 1.0D, 1.0D); tessellator1.addVertexWithUV((double) (-f10), 450.0D, (double) f10, 0.0D, 1.0D); tessellator1.draw(); // saturn: var12 = 10.0F; final float saturnRotation = (float) (world.getSpawnPoint().posZ - mc.thePlayer.posZ) * 0.01F; GL11.glRotatef(-180.0F, 0.0F, 1.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 5F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 100.0F, 1.0F, 0.0F, 0.0F); var12 = 30.0F; FMLClientHandler.instance().getClient().renderEngine.bindTexture(SCTitanSkyProvider.saturnTexture); var23.startDrawingQuads(); var23.addVertexWithUV(-var12, 75.0D, -var12, 0.0D, 0.0D); var23.addVertexWithUV(var12, 75.0D, -var12, 1.0D, 0.0D); var23.addVertexWithUV(var12, 75.0D, var12, 1.0D, 1.0D); var23.addVertexWithUV(-var12, 75.0D, var12, 0.0D, 1.0D); var23.draw(); // Render earth f10 = 0.5F; GL11.glScalef(0.6F, 0.6F, 0.6F); GL11.glRotatef(40.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(SCTitanSkyProvider.overworldTexture); 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((double) (-f8), (double) f9, (double) f8); tessellator1.addVertex((double) f8, (double) f9, (double) f8); tessellator1.addVertex((double) f8, (double) f10, (double) f8); tessellator1.addVertex((double) (-f8), (double) f10, (double) f8); tessellator1.addVertex((double) (-f8), (double) f10, (double) (-f8)); tessellator1.addVertex((double) f8, (double) f10, (double) (-f8)); tessellator1.addVertex((double) f8, (double) f9, (double) (-f8)); tessellator1.addVertex((double) (-f8), (double) f9, (double) (-f8)); tessellator1.addVertex((double) f8, (double) f10, (double) (-f8)); tessellator1.addVertex((double) f8, (double) f10, (double) f8); tessellator1.addVertex((double) f8, (double) f9, (double) f8); tessellator1.addVertex((double) f8, (double) f9, (double) (-f8)); tessellator1.addVertex((double) (-f8), (double) f9, (double) (-f8)); tessellator1.addVertex((double) (-f8), (double) f9, (double) f8); tessellator1.addVertex((double) (-f8), (double) f10, (double) f8); tessellator1.addVertex((double) (-f8), (double) f10, (double) (-f8)); tessellator1.addVertex((double) (-f8), (double) f10, (double) (-f8)); tessellator1.addVertex((double) (-f8), (double) f10, (double) f8); tessellator1.addVertex((double) f8, (double) f10, (double) f8); tessellator1.addVertex((double) f8, (double) f10, (double) (-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:mca.client.render.RenderHuman.java
License:Open Source License
private void renderHuman(EntityHuman entity, double posX, double posY, double posZ, float rotationYaw, float rotationPitch) { final EntityPlayer player = Minecraft.getMinecraft().thePlayer; final PlayerMemory memory = entity.getPlayerMemoryWithoutCreating(player); if (!entity.getDoDisplay()) { return;/* ww w.j a v a 2 s . c om*/ } //Pass special renders according to player memory here. if (RadixMath.getDistanceToEntity(entity, player) <= 5.0F && !entity.getAI(AISleep.class).getIsSleeping() && !entity.displayNameForPlayer && memory != null) { UVPoint uvp = memory.doDisplayFeedback() ? (memory.getLastInteractionSuccess() ? plus : minus) : memory.getHasQuest() ? exMark : null; if (uvp != null) { GL11.glPushMatrix(); { GL11.glTranslatef((float) posX, (float) posY + entity.height + 0.25F + 0.5F, (float) posZ); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GL11.glScalef(-LABEL_SCALE, -LABEL_SCALE, LABEL_SCALE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslatef(0.0F, 0.25F / LABEL_SCALE, 0.0F); RenderHelper.drawTexturedRectangle(gui, (int) posX, (int) posY + 12, uvp.getU(), uvp.getV(), uvp.getWidth(), uvp.getHeight()); } GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_LIGHTING); } } double posYCorrection = posY - entity.yOffset; shadowOpaque = 1.0F; final ItemStack heldItem = entity.getHeldItem(); modelArmorPlate.heldItemRight = modelArmor.heldItemRight = modelBipedMain.heldItemRight = heldItem == null ? 0 : 1; modelArmorPlate.isSneak = modelArmor.isSneak = modelBipedMain.isSneak = entity.isSneaking(); if (heldItem != null) { final EnumAction useAction = heldItem.getItemUseAction(); if (useAction == EnumAction.bow) { modelArmorPlate.aimedBow = modelArmor.aimedBow = modelBipedMain.aimedBow = true; } } if (entity.isSneaking()) { posYCorrection -= 0.125D; } super.doRender(entity, posX, posYCorrection, posZ, rotationYaw, rotationPitch); modelArmorPlate.aimedBow = modelArmor.aimedBow = modelBipedMain.aimedBow = false; modelArmorPlate.isSneak = modelArmor.isSneak = modelBipedMain.isSneak = false; modelArmorPlate.heldItemRight = modelArmor.heldItemRight = modelBipedMain.heldItemRight = 0; }
From source file:mca.client.render.RenderHuman.java
License:Open Source License
private void renderHearts(EntityHuman human, double posX, double posY, double posZ, int heartsLevel) { try {//w w w. j a va 2 s . co m //Clamp to 10 first to calculate gold hearts. int clampedHearts = RadixMath.clamp(((Math.abs(heartsLevel) + 5) / 10), 0, 10); final boolean isNegative = heartsLevel < 0; int goldHearts = isNegative ? 0 : clampedHearts - 5; final int heartU = 5; final int goldHeartU = 37; final int negHeartU = 21; //Clamp down to 5 hearts since processing has completed, needed to generate the list properly. clampedHearts = RadixMath.clamp(clampedHearts, 0, 5); final List<Integer> heartsToDraw = new ArrayList<Integer>(); //Add the needed gold hearts. while (goldHearts > 0) { heartsToDraw.add(goldHeartU); goldHearts--; } //Add the remaining hearts. while (heartsToDraw.size() < clampedHearts) { if (isNegative) { heartsToDraw.add(negHeartU); } else { heartsToDraw.add(heartU); } } //Draw hearts. if (!heartsToDraw.isEmpty()) { GL11.glPushMatrix(); { GL11.glTranslatef((float) posX + 0.0F, (float) posY + human.height + 0.25F, (float) posZ); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GL11.glScalef(-LABEL_SCALE, -LABEL_SCALE, LABEL_SCALE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslatef(0.0F, 0.25F / LABEL_SCALE, 0.0F); switch (heartsToDraw.size()) { case 1: RenderHelper.drawTexturedRectangle(gui, ((int) posX + (10 * 2) - 22), (int) posY - 4, heartsToDraw.get(0), 20, 9, 9); break; case 2: for (int i = 0; i < 2; i++) { RenderHelper.drawTexturedRectangle(gui, ((int) posX + (10 * i) - 9), (int) posY - 4, heartsToDraw.get(i), 20, 9, 9); } break; case 3: for (int i = 0; i < 3; i++) { RenderHelper.drawTexturedRectangle(gui, ((int) posX + (10 * i) - 14), (int) posY - 4, heartsToDraw.get(i), 20, 9, 9); } break; case 4: for (int i = 0; i < 4; i++) { RenderHelper.drawTexturedRectangle(gui, ((int) posX + (10 * i) - 19), (int) posY - 4, heartsToDraw.get(i), 20, 9, 9); } break; case 5: for (int i = 0; i < 5; i++) { RenderHelper.drawTexturedRectangle(gui, ((int) posX + (10 * i) - 23), (int) posY - 4, heartsToDraw.get(i), 20, 9, 9); } break; } } GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_LIGHTING); } } catch (Throwable e) { e.printStackTrace(); } }