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:com.yogpc.qp.client.RenderRefinery.java
License:Open Source License
private void render(final TileRefinery tile, final double x, final double y, final double z) { float anim = 0; int angle = 0; ModelRenderer theMagnet = this.magnet[0]; if (tile != null) { anim = tile.getAnimationStage(); angle = 0;// w w w . jav a 2 s. c o m switch (tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord)) { case 2: angle = 90; break; case 3: angle = 270; break; case 4: angle = 180; break; case 5: angle = 0; break; } if (tile.animationSpeed <= 1) theMagnet = this.magnet[0]; else if (tile.animationSpeed <= 2.5) theMagnet = this.magnet[1]; else if (tile.animationSpeed <= 4.5) theMagnet = this.magnet[2]; else theMagnet = this.magnet[3]; } GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); GL11.glScalef(0.99F, 0.99F, 0.99F); GL11.glRotatef(angle, 0, 1, 0); bindTexture(TEXTURE); GL11.glPushMatrix(); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); GL11.glTranslatef(-4F * pixel, 0, -4F * pixel); this.tank.render(pixel); GL11.glTranslatef(4F * pixel, 0, 4F * pixel); GL11.glTranslatef(-4F * pixel, 0, 4F * pixel); this.tank.render(pixel); GL11.glTranslatef(4F * pixel, 0, -4F * pixel); GL11.glTranslatef(4F * pixel, 0, 0); this.tank.render(pixel); GL11.glTranslatef(-4F * pixel, 0, 0); GL11.glPopMatrix(); float trans1, trans2; if (anim <= 100) { trans1 = 12F * pixel * anim / 100F; trans2 = 0; } else if (anim <= 200) { trans1 = 12F * pixel - 12F * pixel * (anim - 100F) / 100F; trans2 = 12F * pixel * (anim - 100F) / 100F; } else { trans1 = 12F * pixel * (anim - 200F) / 100F; trans2 = 12F * pixel - 12F * pixel * (anim - 200F) / 100F; } renderMagnet(trans1, theMagnet, 0); renderMagnet(trans2, theMagnet, 12 * pixel); if (tile != null) { 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(-0.5F, -0.5F, -0.5F); GL11.glScalef(0.5F, 1, 0.5F); renderFluid(tile.src[0], 0, 0, 0, tile.buf); renderFluid(tile.src[1], 0, 0, 1, tile.buf); renderFluid(tile.res, 1, 0, 0.5F, tile.buf); GL11.glPopAttrib(); } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:com.yogpc.qp.client.RenderRefinery.java
License:Open Source License
private static void renderMagnet(final float trans, final ModelRenderer magnet, final float offset) { GL11.glPushMatrix();// w ww .ja va 2s . c om GL11.glScalef(0.99F, 0.99F, 0.99F); GL11.glTranslatef(-0.51F, trans - 0.5F, offset - 0.5F); magnet.render(pixel); GL11.glPopMatrix(); }
From source file:com.yogpc.qp.client.RenderRefinery.java
License:Open Source License
private void renderFluid(final FluidStack liquid, final float tx, final float ty, final float tz, final float buf) { if (liquid != null && liquid.amount > 0) { final int[] list = getFluidDisplayLists(liquid); if (list != null) { if (tx != 0 || ty != 0 || tz != 0) { GL11.glPushMatrix();//w w w.j av a 2 s . c o m GL11.glTranslatef(tx, ty, tz); } bindTexture(TextureMap.locationBlocksTexture); setColor(liquid.getFluid().getColor(liquid)); GL11.glCallList(list[(int) (liquid.amount / buf * 99)]); if (tx != 0 || ty != 0 || tz != 0) GL11.glPopMatrix(); } } }
From source file:common.xandayn.personalrecipes.client.gui.RecipeHandlerGUI.java
License:Open Source License
@Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { switch (_curState) { case JUST_OPENED: Rendering.drawString("Select a Recipe Handler", 28, 6, 0xFFDDDDDD); if (slider.getSelected() != null) { Rendering.drawString("Selected: " + slider.getSelected(), 32, 108, 0xFFDDDDDD); }//from w w w. ja v a 2 s . c o m Rendering.drawString(!removeMode.isChecked() ? "Remove" : "Add", 122, 25, 0xFFDDDDDD); GL11.glPushMatrix(); GL11.glTranslatef(-guiLeft, -guiTop, 0); slider.renderForeground(mouseX, mouseY); removeMode.renderForeground(mouseX, mouseY); GL11.glPopMatrix(); break; case TYPE_SELECTED: GL11.glPushMatrix(); GL11.glTranslatef(-guiLeft, -guiTop, 0); component.renderForeground(mouseX, mouseY); GL11.glPopMatrix(); break; } }
From source file:dan200.billund.client.BillundProxyClient.java
public static void renderBrick(ItemStack brick, boolean scale, boolean center) { Tessellator tessellator = Tessellator.instance; int brightness = 15; int colour = ItemBrick.getColour(brick); int width = ItemBrick.getWidth(brick); int height = ItemBrick.getHeight(brick); int depth = ItemBrick.getDepth(brick); // Setup GL11.glPushMatrix();// ww w. j a va2 s . com if (scale) { float scaleValue = ((float) TileEntityBillund.LAYERS_PER_BLOCK) / Math.max(2.0f, (float) Math.max(width, depth) - 0.5f); GL11.glScalef(scaleValue, scaleValue, scaleValue); } if (center) { GL11.glTranslatef(-0.5f * ((float) width / (float) TileEntityBillund.ROWS_PER_BLOCK), -0.5f * ((float) height / (float) TileEntityBillund.LAYERS_PER_BLOCK), -0.5f * ((float) depth / (float) TileEntityBillund.ROWS_PER_BLOCK)); } GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); Minecraft mc = Minecraft.getMinecraft(); mc.getTextureManager().bindTexture(mc.getTextureManager().getResourceLocation(0)); // bind the terrain texture tessellator.startDrawingQuads(); tessellator.setNormal(0.0f, -1.0f, 0.0f); renderBrick(null, brightness, colour, 0, 0, 0, width, height, depth); tessellator.draw(); // Teardown GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:dan200.billund.client.RenderAirDrop.java
private void doRenderFallingSand(EntityAirDrop entity, double x, double y, double z, float f, float f2) { World world = entity.getWorld();//from ww w . j av a 2s . c o m Block block = Block.blocksList[entity.blockID]; if (world.getBlockId(MathHelper.floor_double(entity.posX), MathHelper.floor_double(entity.posY), MathHelper.floor_double(entity.posZ)) != entity.blockID) { GL11.glPushMatrix(); GL11.glTranslatef((float) x - 0.5f, (float) y - 0.5f, (float) z - 0.5f); this.bindEntityTexture(entity); GL11.glDisable(GL11.GL_LIGHTING); if (block != null) { ChestItemRenderHelper.instance.renderChest(block, 0, 0.0f); if (!entity.deployed) { GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); GL11.glTranslatef(-0.5f, -0.5f, 0.5f); GL11.glScalef(1.2f, 1.2f, 1.2f); Minecraft mc = Minecraft.getMinecraft(); mc.getTextureManager().bindTexture(chuteTexture); m_model.render(0.0625f); } } GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } }
From source file:dark.core.client.renders.RenderFakeBlock.java
License:Minecraft Mod Public
/** Renders a block as an Entity */ public void doRenderBlock(EntityFakeBlock entity, double i, double j, double k) { if (entity.isDead) { return;//from ww w . jav a2 s. c om } shadowSize = entity.shadowSize; World world = entity.worldObj; BlockRenderInfo util = new BlockRenderInfo(); util.texture = entity.texture; func_110776_a(TextureMap.field_110575_b); for (int iBase = 0; iBase < entity.iSize; ++iBase) { for (int jBase = 0; jBase < entity.jSize; ++jBase) { for (int kBase = 0; kBase < entity.kSize; ++kBase) { util.min = new Vector3(); double remainX = entity.iSize - iBase; double remainY = entity.jSize - jBase; double remainZ = entity.kSize - kBase; util.max = new Vector3((remainX > 1.0 ? 1.0 : remainX), (remainY > 1.0 ? 1.0 : remainY), (remainZ > 1.0 ? 1.0 : remainZ)); GL11.glPushMatrix(); GL11.glTranslatef((float) i, (float) j, (float) k); GL11.glRotatef(entity.rotationX, 1, 0, 0); GL11.glRotatef(entity.rotationY, 0, 1, 0); GL11.glRotatef(entity.rotationZ, 0, 0, 1); GL11.glTranslatef(iBase, jBase, kBase); int lightX, lightY, lightZ; lightX = (int) (Math.floor(entity.posX) + iBase); lightY = (int) (Math.floor(entity.posY) + jBase); lightZ = (int) (Math.floor(entity.posZ) + kBase); GL11.glDisable(2896 /* GL_LIGHTING */); renderBlock(util, world, new Vector3(lightX, lightY, lightZ)); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); } } } }
From source file:de.keyle.dungeoncraft.editor.editors.world.render.block.Bed.java
License:Open Source License
@Override public void render(byte blockData, int x, int y, int z, ChunkSchematic chunk) { boolean head = true; blockData &= 0xF;/* ww w. j a v a 2 s .c o m*/ if ((blockData & 0x8) == 0) { head = false; } blockData &= 0x3; GL11.glPushMatrix(); GL11.glTranslatef(x, y, z); int xShift = 0; int zShift = 0; // Render pointing South by default if (blockData == 2) { // Pointing North GL11.glRotatef(180f, 0f, 1f, 0f); xShift = -1; zShift = -1; } else if (blockData == 1) { // Pointing West GL11.glRotatef(-90f, 0f, 1f, 0f); zShift = -1; } else if (blockData == 3) { // Pointing East GL11.glRotatef(90f, 0f, 1f, 0f); xShift = -1; } if (head) { // Top face Renderer.renderHorizontal(HEAD_TOP, xShift, zShift, xShift + 1, zShift + 1, 0.5625f, false); // Side faces Renderer.renderNonstandardVertical(HEAD_SIDE, xShift, 0, zShift, xShift, 0.5625f, zShift + 1); Renderer.renderNonstandardVertical(HEAD_SIDE, xShift + 1, 0, zShift, xShift + 1, 0.5625f, zShift + 1); Renderer.renderNonstandardVertical(HEAD_END, xShift, 0, zShift + 1, xShift + 1, 0.5625f, zShift + 1); } else { // Top face Renderer.renderHorizontal(FEED_TOP, xShift, zShift, xShift + 1, zShift + 1, 0.5625f, false); // Side faces Renderer.renderNonstandardVertical(FEED_SIDE, xShift, 0, zShift, xShift, 0.5625f, zShift + 1); Renderer.renderNonstandardVertical(FEED_SIDE, xShift + 1, 0, zShift, xShift + 1, 0.5625f, zShift + 1); Renderer.renderNonstandardVertical(FEED_END, xShift, 0, zShift, xShift + 1, 0.5625f, zShift); } GL11.glPopMatrix(); }
From source file:de.keyle.dungeoncraft.editor.editors.world.render.block.Cactus.java
License:Open Source License
@Override public void render(byte blockData, int x, int y, int z, ChunkSchematic chunk) { if (dimensions[blockData] == null) { blockData = 0;// w w w. j av a 2s.c o m } TextureDimensions[] dataDimensions = dimensions[blockData]; GL11.glPushMatrix(); GL11.glTranslatef(x, y, z); Renderer.renderNonstandardVertical(dataDimensions[BLOCK_FACE.SIDES.ordinal()], 0.0625f, 0, 0, 0.0625f, 1, 1); Renderer.renderNonstandardVertical(dataDimensions[BLOCK_FACE.SIDES.ordinal()], 0.9f, 0, 0, 0.9375f, 1, 1); if ((y > 0 && shouldRender(x, y - 1, z, chunk)) || y == 0) { Renderer.renderHorizontal(dataDimensions[BLOCK_FACE.BOTTOM.ordinal()], 0.0625f, 0.0625f, 0.9375f, 0.9375f, 0, false); } if ((y < chunk.getMaxHeight() && shouldRender(x, y + 1, z, chunk)) || y == chunk.getMaxHeight()) { Renderer.renderHorizontal(dataDimensions[BLOCK_FACE.TOP.ordinal()], 0.0625f, 0.0625f, 0.9375f, 0.9375f, 1, false); } Renderer.renderNonstandardVertical(dataDimensions[BLOCK_FACE.FRONT.ordinal()], 0, 0, 0.0625f, 1, 1, 0.0625f); Renderer.renderNonstandardVertical(dataDimensions[BLOCK_FACE.BACK.ordinal()], 0, 0, 0.9375f, 1, 1, 0.9375f); GL11.glPopMatrix(); }
From source file:de.keyle.dungeoncraft.editor.editors.world.render.block.Cake.java
License:Open Source License
@Override public void render(byte blockData, int x, int y, int z, ChunkSchematic chunk) { GL11.glPushMatrix();// w ww . jav a 2 s .c o m GL11.glTranslatef(x, y, z); int remainingSlices = 7 - blockData; Renderer.renderVertical(SIDE[0], BORDER, BORDER, BORDER + FULL_WIDTH, BORDER, 0, HEIGHT); Renderer.renderVertical(SIDE[blockData], BORDER, BORDER, BORDER, BORDER + remainingSlices * SLICE_WIDTH, 0, HEIGHT); Renderer.renderVertical(SIDE[blockData], BORDER + FULL_WIDTH, BORDER, BORDER + FULL_WIDTH, BORDER + remainingSlices * SLICE_WIDTH, 0, HEIGHT); if (blockData == 0) { Renderer.renderVertical(SIDE[0], BORDER, BORDER + remainingSlices * SLICE_WIDTH, BORDER + FULL_WIDTH, BORDER + remainingSlices * SLICE_WIDTH, 0, HEIGHT); } else { Renderer.renderVertical(INNER, BORDER, BORDER + remainingSlices * SLICE_WIDTH, BORDER + FULL_WIDTH, BORDER + remainingSlices * SLICE_WIDTH, 0, HEIGHT); } Renderer.renderNonstandardHorizontal(TOP[blockData], BORDER, BORDER, BORDER + FULL_WIDTH, BORDER + remainingSlices * SLICE_WIDTH, HEIGHT); Renderer.renderNonstandardHorizontal(BOTTOM[blockData], BORDER, BORDER, BORDER + FULL_WIDTH, BORDER + remainingSlices * SLICE_WIDTH, 0); GL11.glPopMatrix(); }