List of usage examples for org.lwjgl.opengl GL11 glTranslatef
public static native void glTranslatef(@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();/* www .j av a 2 s . c om*/ 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;//from w w w .j a va2s .co 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.PipeRendererTESR.java
License:Minecraft Mod Public
public void doRenderItem(TravelingItem travellingItem, double x, double y, double z, float light, EnumColor color) {//from ww w. ja v a2 s .c o m if (travellingItem == null || travellingItem.getItemStack() == null) { return; } float renderScale = 0.7f; ItemStack itemstack = travellingItem.getItemStack(); GL11.glPushMatrix(); GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glTranslatef(0, 0.25F, 0); GL11.glScalef(renderScale, renderScale, renderScale); dummyEntityItem.setEntityItemStack(itemstack); customRenderItem.doRender(dummyEntityItem, 0, 0, 0, 0, 0); if (color != null) { bindTexture(TextureMap.locationBlocksTexture); RenderInfo block = new RenderInfo(); block.texture = PipeIconProvider.TYPE.ItemBox.getIcon(); float pix = 0.0625F; float min = -4 * pix; float max = 4 * pix; block.minY = min; block.maxY = max; block.minZ = min; block.maxZ = max; block.minX = min; block.maxX = max; RenderUtils.setGLColorFromInt(color.getLightHex()); RenderEntityBlock.INSTANCE.renderBlock(block, null, 0, 0, 0, false, true); } GL11.glPopMatrix(); }
From source file:buildcraft.transport.render.PlugItemRenderer.java
License:Minecraft Mod Public
private void renderPlugItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) { // Render StructurePipe Block block = BuildCraftTransport.genericPipeBlock; Tessellator tessellator = Tessellator.instance; block = BuildCraftTransport.genericPipeBlock; IIcon textureID = BuildCraftTransport.instance.pipeIconProvider .getIcon(PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal()); // Structure pipe block.setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.375F, 0.75F); block.setBlockBoundsForItemRender(); render.setRenderBoundsFromBlock(block); GL11.glTranslatef(translateX, translateY, translateZ + 0.25F); tessellator.startDrawingQuads();/* www .j a v a 2 s . c om*/ tessellator.setNormal(0.0F, -0F, 0.0F); render.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, textureID); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); render.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, textureID); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1F); render.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, textureID); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); render.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, textureID); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(-1F, 0.0F, 0.0F); render.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, textureID); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(1.0F, 0.0F, 0.0F); render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, textureID); tessellator.draw(); }
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 www . ja v a 2s. c om*/ 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 w w . j a v a 2 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) (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.render.RenderPipe.java
License:Minecraft Mod Public
public void doRenderItem(IPipedItem entityitem, double d, double d1, double d2, float f1) { if (entityitem == null || entityitem.getItemStack() == null) return;/*w w w . ja va2 s . com*/ float renderScale = 0.7f; ItemStack itemstack = entityitem.getItemStack(); GL11.glPushMatrix(); GL11.glTranslatef((float) d, (float) d1, (float) d2); GL11.glTranslatef(0, 0.25F, 0); GL11.glScalef(renderScale, renderScale, renderScale); dummyEntityItem.func_92058_a(itemstack); customRenderItem.doRenderItem(dummyEntityItem, 0, 0, 0, 0, 0); GL11.glPopMatrix(); }
From source file:buildcraft.transport.render.RobotStationItemRenderer.java
License:Minecraft Mod Public
private void renderPlugItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) { // Render StructurePipe Block block = BuildCraftTransport.genericPipeBlock; Tessellator tessellator = Tessellator.instance; block = BuildCraftTransport.genericPipeBlock; IIcon textureID = BuildCraftTransport.instance.pipeIconProvider .getIcon(PipeIconProvider.TYPE.PipeRobotStation.ordinal()); // Structure pipe block.setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.375F, 0.75F); block.setBlockBoundsForItemRender(); render.setRenderBoundsFromBlock(block); GL11.glTranslatef(translateX, translateY, translateZ + 0.25F); tessellator.startDrawingQuads();/*from w w w . j av a2 s . com*/ tessellator.setNormal(0.0F, -0F, 0.0F); render.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, textureID); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); render.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, textureID); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1F); render.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, textureID); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); render.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, textureID); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(-1F, 0.0F, 0.0F); render.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, textureID); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(1.0F, 0.0F, 0.0F); render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, textureID); tessellator.draw(); }
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 ava 2s . c o m*/ 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();// w ww.ja va 2 s . com 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(); }