List of usage examples for org.lwjgl.opengl GL11 glRotatef
public static native void glRotatef(@NativeType("GLfloat") float angle, @NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
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; }//www.ja va2 s.c om 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);//ww w .ja va 2 s . c o m 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.render.item.SCMercuryItemRendererSpaceshipT4.java
License:LGPL
@Override protected void renderSpaceship(ItemRenderType type, RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) { GL11.glPushMatrix();/*w w w . j av a2 s . c om*/ this.transform(item, type); if (item.getItemDamage() < 10) { FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.texture); this.modelSpaceship.render(this.spaceship, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } else { FMLClientHandler.instance().getClient().renderEngine .bindTexture(SCMercuryItemRendererSpaceshipT4.cargoRocketTexture); this.cargoRocketModel.renderAll(); GL11.glPopMatrix(); } if (type == ItemRenderType.INVENTORY) { int index = Math.min( Math.max(item.getItemDamage() >= 10 ? item.getItemDamage() - 10 : item.getItemDamage(), 0), EnumRocketType.values().length - 1); if (EnumRocketType.values()[index].getInventorySpace() > 3) { final ModelChest modelChest = this.chestModel; FMLClientHandler.instance().getClient().renderEngine .bindTexture(GCCoreItemRendererSpaceship.chestTexture); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glScalef(0.5F, -0.5F, -0.5F); GL11.glTranslatef(1.5F, 1.95F, 1.7F); final short short1 = 0; GL11.glRotatef(short1, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-1.5F, -1.5F, -1.5F); float f1 = 0; f1 = 1.0F - f1; f1 = 1.0F - f1 * f1 * f1; modelChest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F); modelChest.chestBelow.render(0.0625F); modelChest.chestLid.render(0.0625F); modelChest.chestKnob.render(0.0625F); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } } }
From source file:mattparks.mods.starcraft.mercury.client.render.item.SCMercuryItemRendererSpaceshipT4.java
License:LGPL
@Override public void transform(ItemStack itemstack, ItemRenderType type) { final EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer; long var10 = this.spaceship.entityId * 493286711L; var10 = var10 * var10 * 4392167121L + var10 * 98761L; final float var12 = (((var10 >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; final float var13 = (((var10 >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; final float var14 = (((var10 >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; if (type == ItemRenderType.EQUIPPED) { if (itemstack.getItemDamage() >= 10) { GL11.glTranslatef(0.5F, 0.2F, 0F); }//from w ww .j a v a 2 s . c o m GL11.glRotatef(70, 1.0F, 0, 0); GL11.glRotatef(-10, 0.0F, 1, 0); GL11.glRotatef(50, 0.0F, 1, 1); GL11.glTranslatef(0F, 2.0F, 0F); GL11.glScalef(5.2F, 5.2F, 5.2F); if (itemstack.getItemDamage() >= 10) { GL11.glTranslatef(0F, 0.45F, 0F); GL11.glScalef(0.45F, 0.45F, 0.45F); } if (player != null && player.ridingEntity != null && player.ridingEntity instanceof GCCoreEntityRocketT1) { GL11.glScalef(0.0F, 0.0F, 0.0F); } } if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glTranslatef(-0.5F, 4.2F, 0F); if (itemstack.getItemDamage() >= 10) { GL11.glTranslatef(0F, 1.5F, -6.0F); } GL11.glRotatef(28, 0.0F, 0, 1); GL11.glRotatef(50 + 180, 0.0F, 1, 0); GL11.glRotatef(73, 1.0F, 0, 0); GL11.glScalef(5.2F, 5.2F, 5.2F); if (player != null && player.ridingEntity != null && player.ridingEntity instanceof GCCoreEntityRocketT1) { GL11.glScalef(0.0F, 0.0F, 0.0F); } } GL11.glTranslatef(var12, var13 - 0.1F, var14); GL11.glScalef(-0.4F, -0.4F, 0.4F); if (type == ItemRenderType.INVENTORY || type == ItemRenderType.ENTITY) { if (type == ItemRenderType.INVENTORY) { GL11.glRotatef(85F, 1F, 0F, 1F); GL11.glRotatef(20F, 1F, 0F, 0F); GL11.glScalef(0.9F, 0.9F, 0.9F); } else { GL11.glTranslatef(0, -0.9F, 0); GL11.glScalef(0.5F, 0.5F, 0.5F); } if (itemstack.getItemDamage() >= 10) { GL11.glRotatef(90F, 1F, 0F, 1F); GL11.glScalef(0.45F, 0.45F, 0.45F); GL11.glTranslatef(0, -0.9F, 0); GL11.glTranslatef(0, -0.9F, 0); GL11.glTranslatef(0, -0.9F, 0); } GL11.glScalef(1.3F, 1.3F, 1.3F); GL11.glTranslatef(0, -0.6F, 0); GL11.glRotatef(Sys.getTime() / 90F % 360F * (itemstack.getItemDamage() >= 10 ? -1 : 1), 0F, 1F, 0F); } }
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 ww.ja 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.moons.client.render.item.SCJupiterItemRendererSpaceshipT5.java
License:LGPL
@Override protected void renderSpaceship(ItemRenderType type, RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) { GL11.glPushMatrix();//from w ww .j a va 2 s. com this.transform(item, type); if (item.getItemDamage() < 10) { FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.texture); this.modelSpaceship.render(this.spaceship, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } else { FMLClientHandler.instance().getClient().renderEngine .bindTexture(SCJupiterItemRendererSpaceshipT5.cargoRocketTexture); this.cargoRocketModel.renderAll(); GL11.glPopMatrix(); } if (type == ItemRenderType.INVENTORY) { int index = Math.min( Math.max(item.getItemDamage() >= 10 ? item.getItemDamage() - 10 : item.getItemDamage(), 0), EnumRocketType.values().length - 1); if (EnumRocketType.values()[index].getInventorySpace() > 3) { final ModelChest modelChest = this.chestModel; FMLClientHandler.instance().getClient().renderEngine .bindTexture(GCCoreItemRendererSpaceship.chestTexture); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glScalef(0.5F, -0.5F, -0.5F); GL11.glTranslatef(1.5F, 1.95F, 1.7F); final short short1 = 0; GL11.glRotatef(short1, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-1.5F, -1.5F, -1.5F); float f1 = 0; f1 = 1.0F - f1; f1 = 1.0F - f1 * f1 * f1; modelChest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F); modelChest.chestBelow.render(0.0625F); modelChest.chestLid.render(0.0625F); modelChest.chestKnob.render(0.0625F); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } } }
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);/*from w w w .j a va2 s . c o m*/ 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.RenderFishHook.java
License:Open Source License
/** * Renders the fish hook in the world.//from w w w . j a v a2 s.c om * * @param entityFishHook The fish hook being rendered. * @param posX The x position the hook is being rendered at. * @param posY The y position the hook is being rendered at. * @param posZ The z position the hook is being rendered at. * @param angle The angle relative to the angler that the hook is rendered at. * @param offsetY The y offset of the hook. */ public void doRenderFishHook(EntityChoreFishHook entityFishHook, double posX, double posY, double posZ, float angle, float offsetY) { GL11.glPushMatrix(); GL11.glTranslatef((float) posX, (float) posY, (float) posZ); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(0.5F, 0.5F, 0.5F); this.bindEntityTexture(entityFishHook); final Tessellator tessellator = Tessellator.instance; final float textureSizeU = (1 * 8 + 0) / 128.0F; final float textureSizeV = (1 * 8 + 8) / 128.0F; final float textureLocationX = (2 * 8 + 0) / 128.0F; final float textureLocationY = (2 * 8 + 8) / 128.0F; GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV(0.0F - 0.5F, 0.0F - 0.5F, 0.0D, textureSizeU, textureLocationY); tessellator.addVertexWithUV(1.0F - 0.5F, 0.0F - 0.5F, 0.0D, textureSizeV, textureLocationY); tessellator.addVertexWithUV(1.0F - 0.5F, 1.0F - 0.5F, 0.0D, textureSizeV, textureLocationX); tessellator.addVertexWithUV(0.0F - 0.5F, 1.0F - 0.5F, 0.0D, textureSizeU, textureLocationX); tessellator.draw(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); if (entityFishHook.angler != null) { final float orientation = MathHelper .sin(MathHelper.sqrt_float(entityFishHook.angler.getSwingProgress(offsetY)) * (float) Math.PI); final Vec3 vec3 = entityFishHook.worldObj.getWorldVec3Pool().getVecFromPool(-0.5D, 0.03D, 0.8D); vec3.rotateAroundX(-(entityFishHook.angler.prevRotationPitch + (entityFishHook.angler.rotationPitch - entityFishHook.angler.prevRotationPitch) * offsetY) * (float) Math.PI / 180.0F); vec3.rotateAroundY(-(entityFishHook.angler.prevRotationYaw + (entityFishHook.angler.rotationYaw - entityFishHook.angler.prevRotationYaw) * offsetY) * (float) Math.PI / 180.0F); vec3.rotateAroundY(orientation * 0.5F); vec3.rotateAroundX(-orientation * 0.7F); double correctedPosX = entityFishHook.angler.prevPosX + (entityFishHook.angler.posX - entityFishHook.angler.prevPosX) * (double) offsetY + vec3.xCoord; double correctedPosY = entityFishHook.angler.prevPosY + (entityFishHook.angler.posY - entityFishHook.angler.prevPosY) * (double) offsetY + vec3.yCoord; double correctedPosZ = entityFishHook.angler.prevPosZ + (entityFishHook.angler.posZ - entityFishHook.angler.prevPosZ) * (double) offsetY + vec3.zCoord; float scale = 0.7F; if (entityFishHook.angler instanceof EntityPlayerChild) { final int age = ((AbstractChild) entityFishHook.angler).age; scale = 0.55F + 0.39F / MCA.getInstance().getModProperties().kidGrowUpTimeMinutes * age; } final float offsetYaw = (entityFishHook.angler.prevRenderYawOffset + (entityFishHook.angler.renderYawOffset - entityFishHook.angler.prevRenderYawOffset) * offsetY) * (float) Math.PI / 180.0F; final double sinOffsetYaw = MathHelper.sin(offsetYaw); final double cosOffsetYaw = MathHelper.cos(offsetYaw); correctedPosX = entityFishHook.angler.prevPosX + (entityFishHook.angler.posX - entityFishHook.angler.prevPosX) * offsetY - cosOffsetYaw * 0.35D - sinOffsetYaw * 0.85D; correctedPosY = entityFishHook.angler.prevPosY + scale * 1.6 + (entityFishHook.angler.posY - entityFishHook.angler.prevPosY) * offsetY - 0.45D; correctedPosZ = entityFishHook.angler.prevPosZ + (entityFishHook.angler.posZ - entityFishHook.angler.prevPosZ) * offsetY - sinOffsetYaw * 0.35D + cosOffsetYaw * 0.85D; final double distX = entityFishHook.prevPosX + (entityFishHook.posX - entityFishHook.prevPosX) * (double) offsetY; final double distY = entityFishHook.prevPosY + (entityFishHook.posY - entityFishHook.prevPosY) * (double) offsetY + 0.25D; final double distZ = entityFishHook.prevPosZ + (entityFishHook.posZ - entityFishHook.prevPosZ) * (double) offsetY; final double correctionX = (double) ((float) (correctedPosX - distX)); final double correctionY = (double) ((float) (correctedPosY - distY)); final double correctionZ = (double) ((float) (correctedPosZ - distZ)); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); tessellator.startDrawing(3); tessellator.setColorOpaque_I(0); for (int loop = 0; loop <= 16; ++loop) { final float unknown = (float) loop / (float) 16; tessellator.addVertex(posX + correctionX * unknown, posY + correctionY * (unknown * unknown + unknown) * 0.5D + 0.25D, posZ + correctionZ * unknown); } tessellator.draw(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
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;/*w w w . jav a2 s .co m*/ } //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 {/*from www . j av a 2 s .c o 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(); } }