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:com.breckinloggins.DrawUtils.java
License:Open Source License
public static void drawQuad(float x, float y, int size, float rotation) { int halfSize = size / 2; GL11.glPushMatrix();//from w w w . ja v a 2 s . c om { GL11.glTranslatef(x, y, 0); GL11.glRotatef(rotation, 0f, 0f, 1f); GL11.glTranslatef(-x, -y, 0); GL11.glBegin(GL11.GL_QUADS); { GL11.glVertex2f(x - halfSize, y - halfSize); GL11.glVertex2f(x + halfSize, y - halfSize); GL11.glVertex2f(x + halfSize, y + halfSize); GL11.glVertex2f(x - halfSize, y + halfSize); } GL11.glEnd(); } GL11.glPopMatrix(); }
From source file:com.builtbroken.assemblyline.content.inserter.TileInsertArmClient.java
@Override @SideOnly(Side.CLIENT)//from w ww . j av a 2s. c o m public void renderDynamic(Pos pos, float deltaFrame, int pass) { if (ticks < 2) { renderAngle.set(rotation); } else { renderAngle.lerp(rotation, deltaFrame).clampTo360(); } float yaw = (float) renderAngle.yaw(); //Render inserter GL11.glPushMatrix(); GL11.glTranslatef(pos.xf() + 0.5f, pos.yf() + 0.4f, pos.zf() + 0.5f); GL11.glRotated(yaw, 0, 1, 0); FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture); model.renderAllExcept("Base", "BaseTop"); GL11.glPopMatrix(); //----------------------------- //Render item in hand GL11.glPushMatrix(); GL11.glTranslated(pos.xf() + 0.5f, pos.yf() + 0.2f, pos.zf() + 0.5f); //Setup world position double x = renderAngle.x() * 1.15; double z = renderAngle.z() * 1.15; FakeItemRender.setWorldPosition(worldObj, xi() + 0.5 + x, yi() + 0.5, zi() + 0.5 + z); //Render actual item with rotation yaw += 90f; GL11.glRotatef(yaw, 0.0F, 1.0F, 0.0F); FakeItemRender.renderItemAtPosition(1, 0, 0, renderStack); GL11.glPopMatrix(); }
From source file:com.builtbroken.assemblyline.content.rail.carts.RenderCart.java
@Override public void doRender(final Entity entity, final double xx, final double yy, final double zz, final float p_76986_8_, final float delta) { final EntityCart cart = (EntityCart) entity; float f5 = cart.prevRotationPitch + (cart.rotationPitch - cart.prevRotationPitch) * delta; double x2 = MathHelper.lerp(cart.lastRenderX, xx, delta); double y2 = MathHelper.lerp(cart.lastRenderY, yy, delta); double z2 = MathHelper.lerp(cart.lastRenderZ, zz, delta); //Start all//from w w w.j av a 2 s.c o m GL11.glPushMatrix(); GL11.glTranslated(x2, y2, z2); GL11.glRotatef(180.0F - delta, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-f5, 0.0F, 0.0F, 1.0F); //store last position cart.lastRenderX = x2; cart.lastRenderY = y2; cart.lastRenderZ = z2; float halfWidth = cart.width / 2.0F; float halfLength = cart.length / 2.0F; float yaw = (float) Math.abs(MathUtility.clampAngleTo180(cart.rotationYaw)); if (yaw >= 45 && yaw <= 135) { halfWidth = cart.length / 2.0F; halfLength = cart.width / 2.0F; } AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(-(double) halfWidth, 0, -(double) halfLength, +(double) halfWidth, 0.2, +(double) halfLength); //Render bottom of cart GL11.glPushMatrix(); RenderUtility.renderCube(bounds, Blocks.iron_block); GL11.glPopMatrix(); //Render stuff on top of cart if (cart.getType() != CartTypes.EMPTY) { GL11.glPushMatrix(); if (cart.getType() == CartTypes.CHEST) { if (Holiday.isXMAS()) { this.bindTexture(xmasChestTexture); } else { this.bindTexture(chestTexture); } GL11.glRotatef(180, 0.0F, 0.0F, 1.0F); GL11.glScalef(0.6f, 0.6f, 0.6f); GL11.glTranslated(-0.5, -1.2, -0.5); chestModel.renderAll(); } else if (cart.getType() == CartTypes.STACK) { ItemStack stack = cart.getInventory().getStackInSlot(0); try { if (stack != null) { //TODO implement a custom override for rendering items on cart using an interface as well event IItemRenderer renderer = MinecraftForgeClient.getItemRenderer(stack, IItemRenderer.ItemRenderType.ENTITY); if (renderer != null) { /** see if {@link net.minecraftforge.client.ForgeHooksClient#renderEntityItem(EntityItem, ItemStack, float, float, Random, TextureManager, RenderBlocks, int)} * will work much better */ EntityItem fakeItem = new EntityItem(cart.oldWorld()); fakeItem.setPosition(cart.x(), cart.y() + 0.5, cart.z()); renderer.renderItem(IItemRenderer.ItemRenderType.ENTITY, stack, RenderBlocks.getInstance(), fakeItem); } else if (stack.getItem() instanceof ItemBlock) { RenderUtility.renderCube(AxisAlignedBB.getBoundingBox(0, 0, 0, .8, .8, .8), Blocks.planks); } else { RenderItemOverlayUtility .renderIcon3D(stack.getItem().getIconFromDamage(stack.getItemDamage()), 1); } } } catch (Exception e) { AssemblyLine.INSTANCE.logger().error("Failed to render " + stack, e); RenderUtility.renderCube(AxisAlignedBB.getBoundingBox(0, 0, 0, .2, .1, .2), Blocks.wool); } RenderUtility.renderCube(AxisAlignedBB.getBoundingBox(0, 0, 0, .9, .1, .9), Blocks.planks); } else { GL11.glScalef(0.5f, 0.5f, 0.5f); GL11.glTranslated(-0.5, .3, -0.5); RenderUtility.renderCube(AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1), Blocks.planks); } GL11.glPopMatrix(); } //End all GL11.glPopMatrix(); if (Engine.runningAsDev) { drawBounds(cart, xx, yy, zz); } }
From source file:com.builtbroken.atomic.content.machines.processing.boiler.render.RenderItemBoiler.java
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix();//from www .j av a 2 s. co m GL11.glScaled(0.0625f, 0.0625f, 0.0625f); if (type.equals(ItemRenderType.INVENTORY)) { GL11.glTranslatef(-0.5f, -0.8f, -0.5f); GL11.glRotatef(180f, 0, 1, 0); } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) { GL11.glRotatef(45f, 0, 1, 0); GL11.glTranslatef(1f, 12f, 9f); } else if (type.equals(ItemRenderType.EQUIPPED)) { GL11.glTranslatef(8f, 10f, 8f); } FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture_on); model_base.renderAll(); model_core.renderAll(); GL11.glPopMatrix(); }
From source file:com.builtbroken.atomic.content.machines.processing.boiler.render.TESRChemBoiler.java
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float deltaFrame) { GL11.glPushMatrix();//from ww w. j a v a 2s .c o m GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); GL11.glScaled(0.0625f, 0.0625f, 0.0625f); if (tile instanceof TileEntityChemBoiler) { TileEntityChemBoiler entityChemExtractor = (TileEntityChemBoiler) tile; ForgeDirection facing = entityChemExtractor.getFacingDirection(); switch (facing) { case NORTH: GL11.glRotatef(-90, 0, 1, 0); break; case SOUTH: GL11.glRotatef(90, 0, 1, 0); break; case EAST: GL11.glRotatef(180, 0, 1, 0); break; case WEST: //Good by default break; } bindTexture(((TileEntityChemBoiler) tile).processTimer > 0 ? texture_on : texture_off); //Render main body model_base.renderAll(); //Render rotating parts GL11.glRotatef(((TileEntityChemBoiler) tile).rotate(deltaFrame), 0, 1, 0); model_core.renderAll(); } GL11.glPopMatrix(); }
From source file:com.builtbroken.atomic.content.machines.processing.centrifuge.render.RenderItemCentrifuge.java
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix();/* w w w.j ava2 s . com*/ GL11.glScaled(0.0625f, 0.0625f, 0.0625f); if (type.equals(ItemRenderType.INVENTORY)) { GL11.glTranslatef(-0.5f, -0.8f, -0.5f); GL11.glRotatef(180f, 0, 1, 0); } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) { GL11.glRotatef(45f, 0, 1, 0); GL11.glTranslatef(1f, 12f, 9f); } else if (type.equals(ItemRenderType.EQUIPPED)) { GL11.glTranslatef(8f, 10f, 8f); } FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture); model_body.renderAll(); model_core.renderAll(); GL11.glPopMatrix(); }
From source file:com.builtbroken.atomic.content.machines.processing.centrifuge.render.TESRChemCentrifuge.java
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float deltaFrame) { GL11.glPushMatrix();//ww w.j a v a 2 s . c om GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); GL11.glScaled(0.0625f, 0.0625f, 0.0625f); if (tile instanceof TileEntityChemCentrifuge) { TileEntityChemCentrifuge entityChemExtractor = (TileEntityChemCentrifuge) tile; ForgeDirection facing = entityChemExtractor.getFacingDirection(); switch (facing) { case NORTH: GL11.glRotatef(-90, 0, 1, 0); break; case SOUTH: GL11.glRotatef(90, 0, 1, 0); break; case EAST: GL11.glRotatef(180, 0, 1, 0); break; case WEST: //GL11.glRotatef(-90, 0, 1, 0); break; } bindTexture(texture); //Render main body model_body.renderAll(); //Render rotating parts GL11.glRotatef(((TileEntityChemCentrifuge) tile).rotate(deltaFrame), 0, 1, 0); model_core.renderAll(); } GL11.glPopMatrix(); }
From source file:com.builtbroken.atomic.content.machines.processing.extractor.render.RenderItemExtractor.java
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix();// w ww. j a v a 2 s .com GL11.glScaled(0.0625f, 0.0625f, 0.0625f); if (type.equals(ItemRenderType.INVENTORY)) { GL11.glTranslatef(-0.5f, -0.8f, -0.5f); GL11.glRotatef(180f, 0, 1, 0); } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) { GL11.glRotatef(45f, 0, 1, 0); GL11.glTranslatef(1f, 12f, 9f); } else if (type.equals(ItemRenderType.EQUIPPED)) { GL11.glTranslatef(8f, 10f, 8f); } FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture); model_base.renderAll(); model_drum.renderAll(); GL11.glPopMatrix(); }
From source file:com.builtbroken.atomic.content.machines.processing.extractor.render.TESRChemExtractor.java
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float deltaFrame) { GL11.glPushMatrix();/*from ww w. j av a2 s .c om*/ GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); GL11.glScaled(0.0625f, 0.0625f, 0.0625f); if (tile instanceof TileEntityChemExtractor) { TileEntityChemExtractor entityChemExtractor = (TileEntityChemExtractor) tile; ForgeDirection facing = entityChemExtractor.getFacingDirection(); switch (facing) { case NORTH: GL11.glRotatef(-90, 0, 1, 0); break; case SOUTH: GL11.glRotatef(90, 0, 1, 0); break; case EAST: GL11.glRotatef(180, 0, 1, 0); break; case WEST: //Good by default break; } bindTexture(texture); //Render main body model_base.renderAll(); //Render rotating parts GL11.glTranslated(-2.5, 1.5, 0); float rotation = ((TileEntityChemExtractor) tile).rotate(deltaFrame); GL11.glRotatef(rotation, 0, 0, 1); model_drum.renderAll(); } GL11.glPopMatrix(); }
From source file:com.builtbroken.atomic.content.machines.reactor.fission.core.RenderItemReactor.java
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix();/*from w w w. java2 s . c o m*/ GL11.glScaled(0.0625f, 0.0625f, 0.0625f); if (type.equals(ItemRenderType.INVENTORY)) { GL11.glTranslatef(-0.5f, -0.8f, -0.5f); GL11.glRotatef(180f, 0, 1, 0); } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) { GL11.glRotatef(45f, 0, 1, 0); GL11.glTranslatef(1f, 12f, 9f); } else if (type.equals(ItemRenderType.EQUIPPED)) { GL11.glTranslatef(8f, 10f, 8f); } FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture); model.renderAll(); GL11.glPopMatrix(); }