List of usage examples for org.lwjgl.opengl GL11 glTranslated
public static native void glTranslated(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y, @NativeType("GLdouble") double z);
From source file:ivorius.ivtoolkit.blocks.IvMultiBlockRenderHelper.java
License:Apache License
public static void transformFor(IvTileEntityMultiBlock tileEntity, double renderX, double renderY, double renderZ) { double[] center = tileEntity.getActiveCenterCoords(); GL11.glTranslated(renderX + center[0] - tileEntity.xCoord, renderY + center[1] - tileEntity.yCoord, renderZ + center[2] - tileEntity.zCoord); GL11.glRotatef(-90.0f * tileEntity.direction + 180.0f, 0.0f, 1.0f, 0.0f); }
From source file:ivorius.ivtoolkit.blocks.IvRotatableBlockRenderHelper.java
License:Apache License
public static void transformFor(IvTileEntityRotatable tileEntity, double renderX, double renderY, double renderZ) { GL11.glTranslated(renderX + 0.5, renderY + 0.5, renderZ + 0.5); GL11.glRotatef(-90.0f * tileEntity.direction + 180.0f, 0.0f, 1.0f, 0.0f); }
From source file:ivorius.ivtoolkit.items.IvItemRendererModel.java
License:Apache License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix();/* ww w . j a v a2 s . com*/ if (type == ItemRenderType.ENTITY) GL11.glTranslated(0.0, 1.0, 0.0); else if (type == ItemRenderType.INVENTORY) GL11.glTranslated(0.0, 0.3, 0.0); else GL11.glTranslated(0.5, 1.0, 0.5); GL11.glTranslatef(translation[0], translation[1] + 1.0f, translation[2]); if (type != ItemRenderType.ENTITY) { float modelScale = 1.0f / modelSize; GL11.glScalef(modelScale, modelScale, modelScale); } GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); GL11.glRotatef(rotation[0], 1.0f, 0.0f, 0.0f); GL11.glRotatef(rotation[1], 0.0f, 1.0f, 0.0f); GL11.glRotatef(rotation[2], 0.0f, 0.0f, 1.0f); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); Minecraft.getMinecraft().getTextureManager().bindTexture(texture); model.render(item); GL11.glPopMatrix(); }
From source file:ivorius.ivtoolkit.items.IvItemRendererModelCustom.java
License:Apache License
@Override public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix();//from w w w . java2 s. c o m if (type == IItemRenderer.ItemRenderType.ENTITY) GL11.glTranslated(0.0, 1.0, 0.0); else if (type == IItemRenderer.ItemRenderType.INVENTORY) GL11.glTranslated(0.0, 0.3, 0.0); else GL11.glTranslated(0.5, 1.0, 0.5); GL11.glTranslatef(translation[0], translation[1] + 1.0f, translation[2]); if (type != IItemRenderer.ItemRenderType.ENTITY) { float modelScale = 1.0f / modelSize; GL11.glScalef(modelScale, modelScale, modelScale); } GL11.glRotatef(rotation[0], 1.0f, 0.0f, 0.0f); GL11.glRotatef(rotation[1], 0.0f, 1.0f, 0.0f); GL11.glRotatef(rotation[2], 0.0f, 0.0f, 1.0f); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); Minecraft.getMinecraft().getTextureManager().bindTexture(texture); model.render(item); GL11.glPopMatrix(); }
From source file:ivorius.ivtoolkit.rendering.grid.AreaRenderer.java
License:Apache License
@SideOnly(Side.CLIENT) private static void drawCuboid(BlockCoord min, BlockCoord max, boolean lined, boolean insides, float sizeP) { float width2 = ((float) max.x - (float) min.x) * 0.5f; float height2 = ((float) max.y - (float) min.y) * 0.5f; float length2 = ((float) max.z - (float) min.z) * 0.5f; double centerX = min.x + width2; double centerY = min.y + height2; double centerZ = min.z + length2; int sizeCE = insides ? -1 : 1; GL11.glPushMatrix();/*w w w. ja va 2 s . co m*/ GL11.glTranslated(centerX, centerY, centerZ); if (lined) { GL11.glDisable(GL11.GL_TEXTURE_2D); drawLineCuboid(Tessellator.instance, width2 + sizeP, height2 + sizeP, length2 + sizeP, 1); GL11.glEnable(GL11.GL_TEXTURE_2D); } else drawCuboid(Tessellator.instance, width2 * sizeCE + sizeP, height2 * sizeCE + sizeP, length2 * sizeCE + sizeP, 1); GL11.glPopMatrix(); }
From source file:makeo.gadomancy.client.renderers.tile.RenderTileArcaneDropper.java
License:LGPL
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) { GL11.glPushMatrix();/*from w w w . j a va 2 s. c o m*/ GL11.glTranslated(x + 0.5, y - 0.5, z + 0.5); int metadata = tile.getBlockMetadata(); ForgeDirection side = ForgeDirection.getOrientation(metadata & 7); if (side == ForgeDirection.UP) { GL11.glRotatef(180, 1, 0, 0); GL11.glTranslatef(0, -2, 0); } else if (side != ForgeDirection.DOWN) { GL11.glRotatef(-90, side.offsetZ, 0, -1 * side.offsetX); GL11.glTranslatef(side.offsetX, -1, side.offsetZ); } boolean flipped = (metadata & 8) == 8; if (side == ForgeDirection.WEST || side == ForgeDirection.EAST) { flipped = !flipped; } if (flipped) { GL11.glRotatef(90, 0, 1, 0); } bindTexture(RESOURCE); MODEL.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); renderBellow(); GL11.glRotatef(180, 0, 1, 0); renderBellow(); GL11.glPopMatrix(); }
From source file:makeo.gadomancy.client.renderers.tile.RenderTileInfusionClaw.java
License:LGPL
private void render(TileInfusionClaw tile, double x, double y, double z, float partialTicks) { float ticks = Minecraft.getMinecraft().renderViewEntity.ticksExisted + partialTicks; float elapsed = ticks - tile.lastRenderTick; tile.lastRenderTick = ticks;/*from ww w. java 2 s . c o m*/ GL11.glPushMatrix(); GL11.glTranslated(x, y, z); renderPart(tile, elapsed, ticks); renderPrimalOrb(tile, elapsed); GL11.glPopMatrix(); }
From source file:makeo.gadomancy.client.renderers.tile.RenderTileInfusionClaw.java
License:LGPL
private void renderCircle(TileInfusionClaw tile, float elapsed) { GL11.glPushMatrix();/*from ww w .ja v a 2 s . c o m*/ float speed = (float) Math.pow(1.1, Math.abs(tile.animationStates[9])); if (speed > 50) { speed = 50; } if (tile.animationStates[9] > 0) { tile.animationStates[9] += 0.5 * elapsed; if (tile.animationStates[9] > 20 * 5f) { tile.animationStates[9] = -tile.animationStates[9]; ItemStack wandStack = tile.getStackInSlot(0); if (wandStack != null) { tile.animationStates[11] = ((ItemWandCasting) wandStack.getItem()).isStaff(wandStack) ? 0.5f : 0.1f; } } } else if (tile.animationStates[9] < 0) { tile.animationStates[9] += elapsed * 0.5; if (tile.animationStates[9] > 0) { tile.animationStates[9] = 0; } } for (int i = 0; i < 4; i++) { GL11.glPushMatrix(); tile.animationStates[10] += speed * (elapsed * 0.001 * Math.PI); float angle = (float) (tile.animationStates[10] + (i * 0.5 * Math.PI)); float x = (float) Math.sin(angle); float y = (float) Math.cos(angle); float radius = 0.25f; GL11.glTranslated(0, (1f / 16f) * Math.sin(angle / 1.4) + (1f / 16f), 0); GL11.glTranslated(radius * x, -0.27, radius * y); GL11.glRotated(45, Math.cos(angle), 0, -Math.sin(angle)); GL11.glScalef(0.75f, 0.75f, 0.75f); renderPart(i); GL11.glPopMatrix(); } GL11.glPopMatrix(); }
From source file:makeo.gadomancy.client.renderers.tile.RenderTileInfusionClaw.java
License:LGPL
private void renderSides(TileInfusionClaw tile, World world, int x, int y, int z, float elapsed) { GL11.glPushMatrix();//from w w w .j a v a 2 s. c o m float speed = (float) Math.pow(1.1, Math.abs(tile.animationStates[8])); if (tile.animationStates[8] > 0) { tile.animationStates[8] += elapsed; if (tile.animationStates[8] > 20 * 2.5f) { tile.animationStates[8] = -tile.animationStates[8]; tile.animationStates[9] = 1; createSideZap(tile); } } else if (tile.animationStates[8] < 0) { tile.animationStates[8] += elapsed * 0.5; if (tile.animationStates[8] > 0) { tile.animationStates[8] = 0; } } for (int i = 0; i < 4; i++) { float heightMove = getNextMoveOffset(tile, i, speed, elapsed); float widthMove = getNextMoveOffset(tile, i + 4, speed, elapsed); ForgeDirection dir = ForgeDirection.getOrientation(i + 2); boolean powered = world != null && world.getIndirectPowerLevelTo(x + dir.offsetX, y, z + dir.offsetZ, dir.ordinal()) > 0; GL11.glPushMatrix(); GL11.glTranslatef(-dir.offsetZ * widthMove, heightMove, -dir.offsetX * widthMove); GL11.glTranslated((0.5 - (1f / 16f * 0.75)) * dir.offsetX, 0, (0.5 - (1f / 16f * 0.75)) * dir.offsetZ); GL11.glRotatef(90, -1 * dir.offsetZ, 0, dir.offsetX); GL11.glScalef(0.75f, 0.75f, 0.75f); renderRedstonePart(powered); GL11.glPopMatrix(); } GL11.glPopMatrix(); }
From source file:makeo.gadomancy.client.renderers.tile.RenderTileManipulationFocus.java
License:LGPL
public void renderTileEntityAt(TileManipulationFocus tile, double x, double y, double z, float partialTicks) { GL11.glPushMatrix();//from www. jav a 2 s .c o m GL11.glTranslated(x, y, z); bindTexture(new SimpleResourceLocation("models/manipulation_focus_" + tile.fociId + ".png")); GL11.glRotatef(180, 1, 0, 0); GL11.glTranslatef(0.5f, -1.5f + (2 / 16f), -0.5f); if (tile.fociId == 0) { GL11.glPushMatrix(); for (int i = 0; i < 4; i++) { RANDOM_FOCUS.render(null, 0, 0, 0, 0, 0, 0.0625f); GL11.glRotatef(90, 0, 1, 0); } GL11.glPopMatrix(); } GL11.glPopMatrix(); }