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:buildcraft.transport.render.PipeRendererTESR.java
License:Minecraft Mod Public
private void renderPower(Pipe<PipeTransportPower> pipe, double x, double y, double z) { initializeDisplayPowerList(pipe.container.getWorldObj()); PipeTransportPower pow = pipe.transport; GL11.glPushMatrix();// w w w.j a va 2s . co m GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_LIGHTING); // GL11.glEnable(GL11.GL_BLEND); GL11.glTranslatef((float) x, (float) y, (float) z); bindTexture(TextureMap.locationBlocksTexture); int[] displayList = pow.overload > 0 ? displayPowerListOverload : displayPowerList; for (int side = 0; side < 6; ++side) { GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glRotatef(angleY[side], 0, 1, 0); GL11.glRotatef(angleZ[side], 0, 0, 1); float scale = 1.0F - side * 0.0001F; GL11.glScalef(scale, scale, scale); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); short stage = pow.clientDisplayPower[side]; if (stage >= 1) { if (stage < displayList.length) { GL11.glCallList(displayList[stage]); } else { GL11.glCallList(displayList[displayList.length - 1]); } } GL11.glPopMatrix(); } /*bindTexture(STRIPES_TEXTURE); for (int side = 0; side < 6; side += 2) { if (pipe.container.isPipeConnected(ForgeDirection.values()[side])) { GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glRotatef(angleY[side], 0, 1, 0); GL11.glRotatef(angleZ[side], 0, 0, 1); float scale = 1.0F - side * 0.0001F; GL11.glScalef(scale, scale, scale); float movement = (0.50F) * pipe.transport.getPistonStage(side / 2); GL11.glTranslatef(-0.25F - 1F / 16F - movement, -0.5F, -0.5F); // float factor = (float) (1.0 / 256.0); float factor = (float) (1.0 / 16.0); box.render(factor); GL11.glPopMatrix(); } }*/ GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:buildcraft.transport.render.PipeRendererTESR.java
License:Minecraft Mod Public
private void renderFluids(Pipe<PipeTransportFluids> pipe, double x, double y, double z) { PipeTransportFluids trans = pipe.transport; boolean needsRender = false; for (int i = 0; i < 7; ++i) { FluidStack fluidStack = trans.renderCache[i]; if (fluidStack != null && fluidStack.amount > 0) { needsRender = true;// w w w.ja v a 2 s. c o m break; } } if (!needsRender) { return; } GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTranslatef((float) x, (float) y, (float) z); // sides boolean sides = false, above = false; for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { int i = side.ordinal(); FluidStack fluidStack = trans.renderCache[i]; if (fluidStack == null || fluidStack.amount <= 0) { continue; } if (!pipe.container.isPipeConnected(side)) { continue; } DisplayFluidList d = getListFromBuffer(fluidStack, pipe.container.getWorldObj()); if (d == null) { continue; } int stage = (int) ((float) fluidStack.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1)); GL11.glPushMatrix(); int list = 0; switch (ForgeDirection.VALID_DIRECTIONS[i]) { case UP: above = true; list = d.sideVertical[stage]; break; case DOWN: GL11.glTranslatef(0, -0.75F, 0); list = d.sideVertical[stage]; break; case EAST: case WEST: case SOUTH: case NORTH: sides = true; // Yes, this is kind of ugly, but was easier than transform the coordinates above. GL11.glTranslatef(0.5F, 0.0F, 0.5F); GL11.glRotatef(angleY[i], 0, 1, 0); GL11.glRotatef(angleZ[i], 0, 0, 1); GL11.glTranslatef(-0.5F, 0.0F, -0.5F); list = d.sideHorizontal[stage]; break; default: } bindTexture(TextureMap.locationBlocksTexture); RenderUtils.setGLColorFromInt(trans.colorRenderCache[i]); GL11.glCallList(list); GL11.glPopMatrix(); } // CENTER FluidStack fluidStack = trans.renderCache[ForgeDirection.UNKNOWN.ordinal()]; if (fluidStack != null && fluidStack.amount > 0) { DisplayFluidList d = getListFromBuffer(fluidStack, pipe.container.getWorldObj()); if (d != null) { int stage = (int) ((float) fluidStack.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1)); bindTexture(TextureMap.locationBlocksTexture); RenderUtils.setGLColorFromInt(trans.colorRenderCache[ForgeDirection.UNKNOWN.ordinal()]); if (above) { GL11.glCallList(d.centerVertical[stage]); } if (!above || sides) { GL11.glCallList(d.centerHorizontal[stage]); } } } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:buildcraft.transport.render.RenderPipe.java
License:Minecraft Mod Public
private void renderPower(Pipe pipe, double x, double y, double z) { PipeTransportPower pow = (PipeTransportPower) pipe.transport; GL11.glPushMatrix();//from w w w . ja v a 2 s . c o m GL11.glDisable(2896 /* GL_LIGHTING */); ForgeHooksClient.bindTexture(DefaultProps.TEXTURE_BLOCKS, 0); GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); int[] displayList = pow.overload ? displayPowerListOverload : displayPowerList; for (int i = 0; i < 6; ++i) { GL11.glPushMatrix(); GL11.glRotatef(angleY[i], 0, 1, 0); GL11.glRotatef(angleZ[i], 0, 0, 1); if (pow.displayPower[i] >= 1.0) { short stage = pow.displayPower[i]; if (stage < displayList.length) { GL11.glCallList(displayList[stage]); } else { GL11.glCallList(displayList[displayList.length - 1]); } } GL11.glPopMatrix(); } GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); }
From source file:buildcraft.transport.render.RenderPipe.java
License:Minecraft Mod Public
private void renderLiquids(Pipe pipe, double x, double y, double z) { PipeTransportLiquids liq = (PipeTransportLiquids) pipe.transport; GL11.glPushMatrix();//from w ww . j a v a 2 s . co m GL11.glDisable(2896 /* GL_LIGHTING */); GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); // sides boolean sides = false, above = false; for (int i = 0; i < 6; ++i) { // ILiquidTank tank = liq.getTanks()[i]; // LiquidStack liquid = tank.getLiquid(); LiquidStack liquid = liq.renderCache[i]; // int amount = liquid != null ? liquid.amount : 0; // int amount = liquid != null ? liq.renderAmmount[i] : 0; if (liquid != null && liquid.amount > 0) { DisplayLiquidList d = getListFromBuffer(liquid, pipe.worldObj); if (d == null) { continue; } int stage = (int) ((float) liquid.amount / (float) (liq.getCapacity()) * (LIQUID_STAGES - 1)); GL11.glPushMatrix(); int list = 0; switch (ForgeDirection.VALID_DIRECTIONS[i]) { case UP: above = true; list = d.sideVertical[stage]; break; case DOWN: GL11.glTranslatef(0, -0.75F, 0); list = d.sideVertical[stage]; break; case EAST: case WEST: case SOUTH: case NORTH: sides = true; GL11.glRotatef(angleY[i], 0, 1, 0); GL11.glRotatef(angleZ[i], 0, 0, 1); list = d.sideHorizontal[stage]; break; default: } GL11.glCallList(list); GL11.glPopMatrix(); } } // CENTER // ILiquidTank tank = liq.getTanks()[ForgeDirection.Unknown.ordinal()]; // LiquidStack liquid = tank.getLiquid(); LiquidStack liquid = liq.renderCache[ForgeDirection.UNKNOWN.ordinal()]; // int amount = liquid != null ? liquid.amount : 0; // int amount = liquid != null ? liq.renderAmmount[ForgeDirection.Unknown.ordinal()] : 0; if (liquid != null && liquid.amount > 0) { // DisplayLiquidList d = getListFromBuffer(liq.getTanks()[ForgeDirection.Unknown.ordinal()].getLiquid(), pipe.worldObj); DisplayLiquidList d = getListFromBuffer(liquid, pipe.worldObj); if (d != null) { int stage = (int) ((float) liquid.amount / (float) (liq.getCapacity()) * (LIQUID_STAGES - 1)); if (above) { GL11.glCallList(d.centerVertical[stage]); } if (!above || sides) { GL11.glCallList(d.centerHorizontal[stage]); } } } GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); }
From source file:buildcraft.transport.RenderPipe.java
License:Minecraft Mod Public
private void renderPower(Pipe pipe, double x, double y, double z) { PipeTransportPower pow = (PipeTransportPower) pipe.transport; GL11.glPushMatrix();//from ww w . j a v a 2s. com GL11.glDisable(2896 /* GL_LIGHTING */); MinecraftForgeClient.bindTexture(DefaultProps.TEXTURE_BLOCKS); GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); for (int i = 0; i < 6; ++i) { GL11.glPushMatrix(); GL11.glRotatef(angleY[i], 0, 1, 0); GL11.glRotatef(angleZ[i], 0, 0, 1); if (pow.displayPower[i] >= 1.0) { int stage = 0; for (; stage < displayPowerStages; ++stage) if (displayPowerLimits[stage] > pow.displayPower[i]) break; if (stage < displayPowerList.length) GL11.glCallList(displayPowerList[stage]); else GL11.glCallList(displayPowerList[displayPowerList.length - 1]); } GL11.glPopMatrix(); } GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); }
From source file:buildcraft.transport.RenderPipe.java
License:Minecraft Mod Public
private void renderLiquids(Pipe pipe, double x, double y, double z) { PipeTransportLiquids liq = (PipeTransportLiquids) pipe.transport; GL11.glPushMatrix();//from w w w. ja va2 s.c o m GL11.glDisable(2896 /* GL_LIGHTING */); GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); // sides boolean sides = false, above = false; for (int i = 0; i < 6; ++i) { //ILiquidTank tank = liq.getTanks()[i]; //LiquidStack liquid = tank.getLiquid(); LiquidStack liquid = liq.renderCache[i]; //int amount = liquid != null ? liquid.amount : 0; //int amount = liquid != null ? liq.renderAmmount[i] : 0; if (liquid != null && liquid.amount > 0) { DisplayLiquidList d = getListFromBuffer(liquid, pipe.worldObj); if (d == null) continue; int stage = (int) ((float) liquid.amount / (float) (PipeTransportLiquids.LIQUID_IN_PIPE) * (displayLiquidStages - 1)); GL11.glPushMatrix(); int list = 0; switch (Orientations.values()[i]) { case YPos: above = true; list = d.sideVertical[stage]; break; case YNeg: GL11.glTranslatef(0, -0.75F, 0); list = d.sideVertical[stage]; break; case XPos: case XNeg: case ZPos: case ZNeg: sides = true; GL11.glRotatef(angleY[i], 0, 1, 0); GL11.glRotatef(angleZ[i], 0, 0, 1); list = d.sideHorizontal[stage]; break; } GL11.glCallList(list); GL11.glPopMatrix(); } } // CENTER // ILiquidTank tank = liq.getTanks()[Orientations.Unknown.ordinal()]; // LiquidStack liquid = tank.getLiquid(); LiquidStack liquid = liq.renderCache[Orientations.Unknown.ordinal()]; //int amount = liquid != null ? liquid.amount : 0; //int amount = liquid != null ? liq.renderAmmount[Orientations.Unknown.ordinal()] : 0; if (liquid != null && liquid.amount > 0) { //DisplayLiquidList d = getListFromBuffer(liq.getTanks()[Orientations.Unknown.ordinal()].getLiquid(), pipe.worldObj); DisplayLiquidList d = getListFromBuffer(liquid, pipe.worldObj); if (d != null) { int stage = (int) ((float) liquid.amount / (float) (PipeTransportLiquids.LIQUID_IN_PIPE) * (displayLiquidStages - 1)); if (above) GL11.glCallList(d.centerVertical[stage]); if (!above || sides) GL11.glCallList(d.centerHorizontal[stage]); } } GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); }
From source file:buildcraft.transport.RenderPipe.java
License:Minecraft Mod Public
private void drawItem(int iconIndex, int quantity) { Tessellator tesselator = Tessellator.instance; float var4 = (iconIndex % 16 * 16 + 0) / 256.0F; float var5 = (iconIndex % 16 * 16 + 16) / 256.0F; float var6 = (iconIndex / 16 * 16 + 0) / 256.0F; float var7 = (iconIndex / 16 * 16 + 16) / 256.0F; float var8 = 1.0F; float var9 = 0.5F; float var10 = 0.25F; for (int var11 = 0; var11 < quantity; ++var11) { GL11.glPushMatrix();/*from w w w . ja v a 2 s . com*/ if (var11 > 0) { float var12 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F; float var13 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F; float var14 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.3F; GL11.glTranslatef(var12, var13, var14); } GL11.glRotatef(180.0F - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F); tesselator.startDrawingQuads(); tesselator.setNormal(0.0F, 1.0F, 0.0F); tesselator.addVertexWithUV((0.0F - var9), (0.0F - var10), 0.0D, var4, var7); tesselator.addVertexWithUV((var8 - var9), (0.0F - var10), 0.0D, var5, var7); tesselator.addVertexWithUV((var8 - var9), (1.0F - var10), 0.0D, var5, var6); tesselator.addVertexWithUV((0.0F - var9), (1.0F - var10), 0.0D, var4, var6); tesselator.draw(); GL11.glPopMatrix(); } }
From source file:buildcraftAdditions.client.render.entities.EntityLaserShotRenderer.java
License:GNU General Public License
private void doRender(EntityLaserShot entity, double x, double y, double z, float rotation, float partialTicks) { bindEntityTexture(entity);//from w w w . j a v a 2 s. com GL11.glPushMatrix(); float strength = entity.getStrength(); if (strength >= 1) GL11.glColor3f(1, 0, 0); else if (strength > 0.75) GL11.glColor3f(0.75F, 0, 0.25F); else if (strength > 0.6) GL11.glColor3f(0.5F, 0, 0.5F); else if (strength > 0.35) GL11.glColor3f(0.25F, 0, 0.75F); else GL11.glColor3f(0, 0, 1); GL11.glTranslated(x, y, z); GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90, 0, 1, 0); GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0, 0, 1); Tessellator t = Tessellator.instance; double d1 = 0; double d2 = 0.5; double d3 = 0 / 32D; double d4 = 5 / 32D; double d5 = 0.05625; GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f1 = entity.throwableShake - partialTicks; if (f1 > 0) { float f2 = -MathHelper.sin(f1 * 3) * f1; GL11.glRotatef(f2, 0, 0, 1); } GL11.glRotatef(45, 1, 0, 0); GL11.glScaled(d5, d5, d5); GL11.glTranslatef(-4, 0, 0); for (int i = 0; i < 4; i++) { GL11.glRotatef(90, 1, 0, 0); GL11.glNormal3d(0, 0, d5); t.startDrawingQuads(); t.addVertexWithUV(-8, -2, 0, d1, d3); t.addVertexWithUV(8, -2, 0, d2, d3); t.addVertexWithUV(8, 2, 0, d2, d4); t.addVertexWithUV(-8, 2, 0, d1, d4); t.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:buildcraftAdditions.client.render.tileentities.RendererDuster.java
License:GNU General Public License
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float fl) { if (tile != null && tile instanceof TileBaseDuster) { TileBaseDuster duster = (TileBaseDuster) tile; GL11.glPushMatrix();//from w ww . java2 s . co m GL11.glTranslated(x + .5, y + .5 + getYOffset(), z + .5); float angle = 0; switch (ForgeDirection.getOrientation(duster.getBlockMetadata())) { case NORTH: angle = 0; break; case SOUTH: angle = 180; break; case WEST: angle = 90; break; case EAST: angle = -90; break; default: break; } GL11.glRotatef(angle, 0, 1, 0); ItemStack stack = duster.getStackInSlot(0); if (stack != null && stack.getItem() != null && stack.stackSize > 0) { EntityItem item = new EntityItem(Minecraft.getMinecraft().theWorld, 0, 0, 0, stack); item.hoverStart = 0; RenderManager.instance.renderEntityWithPosYaw(item, 0, 0, 0, 0, 0); } GL11.glPopMatrix(); } }
From source file:ccm.burialservices.client.renderers.GraveRenderer.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float tickTime) { GraveTE te = (GraveTE) tileentity;//w w w. j av a2s. co m GL11.glPushMatrix(); GL11.glTranslated(x, y, z); //Center to block ResourceLocation skin = te.getLocationSkin(); float f5 = 0.9F; float f6 = 0.0625F; switch (te.getBlockMetadata()) { case 0: break; case 1: GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); GL11.glTranslated(-1, 0, 0); break; case 2: GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F); GL11.glTranslated(-1, 0, -1); break; case 3: GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F); GL11.glTranslated(0, 0, -1); break; } GL11.glTranslated(0.5, 0.1d, 0.5); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glScalef(f6, f6, f6); Minecraft.getMinecraft().renderEngine.bindTexture(skin); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F); MODEL_BIPED.bipedHead.rotateAngleX = (float) Math.toRadians(15F); MODEL_BIPED.bipedHead.render(f5); MODEL_BIPED.bipedBody.render(f5); MODEL_BIPED.bipedRightArm.render(f5); MODEL_BIPED.bipedLeftArm.render(f5); MODEL_BIPED.bipedRightLeg.render(f5); MODEL_BIPED.bipedLeftLeg.render(f5); GL11.glPopMatrix(); ItemStack is = te.getHolding(); if (is != null) { renderItemHolding(0, te.getBlockMetadata(), is, x, y, z, tickTime); if (is.getItem().requiresMultipleRenderPasses()) { for (int i = 1; i < is.getItem().getRenderPasses(is.getItemDamage()); i++) { renderItemHolding(i, te.getBlockMetadata(), is, x, y, z, tickTime); } } } renderSign(x, y, z, tickTime, te.text, te.getBlockMetadata(), is != null); }