Example usage for org.lwjgl.opengl GL11 glTranslated

List of usage examples for org.lwjgl.opengl GL11 glTranslated

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glTranslated.

Prototype

public static native void glTranslated(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y,
        @NativeType("GLdouble") double z);

Source Link

Document

Double version of #glTranslatef Translatef .

Usage

From source file:steamcraft.client.renderers.tile.TileCopperPipeRenderer.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tile, double transX, double transY, double transZ, float f) {
    GL11.glPushMatrix();//from w w w .j ava2s.  c om

    GL11.glTranslated(transX, transY, transZ);
    GL11.glDisable(GL11.GL_LIGHTING);

    this.bindTexture(TileCopperPipeRenderer.texture);

    TileCopperPipe pipe = (TileCopperPipe) tile;

    ForgeDirection opposite = pipe.onlyOneOpposite();

    if ((opposite != null) && (pipe.extract == null))
        this.drawStraightConnection(opposite, pipe);
    else {
        this.drawCore(pipe);

        for (ForgeDirection dir : pipe.connections)
            if (dir != null)
                if (pipe.extract == dir)
                    this.drawAlternateConnection(dir, pipe);
                else
                    this.drawConnection(dir, pipe);
    }

    GL11.glEnable(GL11.GL_LIGHTING);

    GL11.glTranslated(-transX, -transY, -transZ);

    GL11.glPopMatrix();
}

From source file:steamcraft.client.renderers.tile.TileCopperWireRenderer.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tile, double transX, double transY, double transZ, float f) {
    GL11.glPushMatrix();/* www. j  a v  a  2s  .c o m*/

    GL11.glTranslated(transX, transY, transZ);
    GL11.glDisable(GL11.GL_LIGHTING);

    TileCopperWire wire = (TileCopperWire) tile;

    if (tile.getBlockMetadata() == 0)
        this.bindTexture(TileCopperWireRenderer.texture);
    else
        this.bindTexture(TileCopperWireRenderer.texture1);
    this.drawCore(wire);

    for (ForgeDirection dir : wire.connections)
        if (dir != null)
            if (wire.extract == dir)
                this.drawAlternateConnection(dir, wire);
            else
                this.drawConnection(dir, wire);

    GL11.glEnable(GL11.GL_LIGHTING);

    GL11.glTranslated(-transX, -transY + -3F, -transZ);

    GL11.glPopMatrix();
}

From source file:structuregenmod.handlers.SGTBlockHighlightHandler.java

License:Open Source License

/**
 * Highlights the tile located at x/y/z//from w  ww .  j a  va 2 s .  co  m
 */
public static final void highlightTile(EntityPlayer player, double x, double y, double z, float partialTicks,
        float transparency) {
    double iPX = player.prevPosX + (player.posX - player.prevPosX) * partialTicks;
    double iPY = player.prevPosY + (player.posY - player.prevPosY) * partialTicks;
    double iPZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks;

    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glPushMatrix();
    GL11.glTranslated(-iPX + x + 0.5D, -iPY + y + 0.51D, -iPZ + z + 0.5D);
    GL11.glScalef(1.0F, 1.0F, 1.0F);
    GL11.glRotatef(90, -1, 0, 0);
    GL11.glTranslated(0, 0, 0.5f);
    GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
    drawQuad(transparency);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(true);
}

From source file:taiga.mcmods.buildguide.BlockMarker.java

private void transformToPlayer() {
    FMLClientHandler ch = FMLClientHandler.instance();

    double x = ch.getClient().h.s;
    double y = ch.getClient().h.t;
    double z = ch.getClient().h.u;

    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glPushMatrix();//w  w  w .  jav  a  2  s .  c o m

    GL11.glTranslated(-x, -y, -z);
}

From source file:thaumic.tinkerer.client.render.tile.kami.RenderTileWarpGate.java

License:Creative Commons License

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    GL11.glPushMatrix();//  w w  w. ja v  a 2 s . c  o m
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glTranslated(x + 0.5, y + 2.5, z + 0.5);
    GL11.glRotatef(180F, 1F, 0F, 1F);
    int repeat = 5;
    cubes.renderSpinningCubes(12, repeat, repeat);
    GL11.glPopMatrix();
}

From source file:thaumic.tinkerer.client.render.tile.RenderTileAnimationTablet.java

License:Creative Commons License

@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float partialTicks) {
    TileAnimationTablet tile = (TileAnimationTablet) tileentity;

    int meta = tile.getBlockMetadata() & 7;
    if (meta < 2)
        meta = 2; // Just in case

    int rotation = meta == 2 ? 270 : meta == 3 ? 90 : meta == 4 ? 0 : 180;

    GL11.glPushMatrix();//from   w ww .j ava2s.  c o m
    GL11.glTranslated(d0, d1, d2);
    renderOverlay(tile, overlayCenter, -1, false, false, 0.65, 0.13F, 0F);
    if (tile.leftClick)
        renderOverlay(tile, overlayLeft, 1, false, true, 1, 0.13F, 0F);
    else
        renderOverlay(tile, overlayRight, 1, false, true, 1, 0.131F, 0F);
    renderOverlay(tile, overlayIndent, 0, false, false, 0.5F, 0.13F, rotation + 90F);

    GL11.glRotatef(rotation, 0F, 1F, 0F);
    GL11.glTranslated(0.1, 0.2 + Math.cos(System.currentTimeMillis() / 600D) / 18F, 0.5);
    float[] translations = TRANSLATIONS[meta - 2];
    GL11.glTranslatef(translations[0], translations[1], translations[2]);
    GL11.glScalef(0.8F, 0.8F, 0.8F);
    GL11.glTranslatef(0.5F, 0F, 0.5F);
    GL11.glRotatef(tile.swingProgress, 0F, 0F, 1F);
    GL11.glTranslatef(-0.5F, 0F, -0.5F);
    GL11.glTranslatef(-tile.swingProgress / 250F, tile.swingProgress / 1000F, 0F);
    GL11.glRotatef((float) Math.cos(System.currentTimeMillis() / 400F) * 5F, 1F, 0F, 1F);
    renderItem(tile);
    GL11.glPopMatrix();
}

From source file:thaumic.tinkerer.client.render.tile.RenderTileEnchanter.java

License:Creative Commons License

@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float partTicks) {
    TileEnchanter enchanter = (TileEnchanter) tileentity;

    GL11.glPushMatrix();// w w w.ja v  a 2 s.c  o m
    GL11.glTranslated(d0, d1 + 0.75, d2);

    ItemStack item = enchanter.getStackInSlot(0);
    if (item != null) {
        GL11.glPushMatrix();
        GL11.glRotatef(90F, 1F, 0F, 0F);
        final float scale = 0.7F;
        GL11.glScalef(scale, scale, scale);
        GL11.glTranslatef(0.6F, -0.2F, 0F);
        GL11.glRotatef(30F, 0F, 0F, 1F);

        ClientHelper.minecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);

        int renderPass = 0;
        do {
            IIcon icon = item.getItem().getIcon(item, renderPass);
            if (icon != null) {
                Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
                GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
                float f = icon.getMinU();
                float f1 = icon.getMaxU();
                float f2 = icon.getMinV();
                float f3 = icon.getMaxV();
                ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(),
                        icon.getIconHeight(), 1F / 16F);
                GL11.glColor3f(1F, 1F, 1F);
            }
            renderPass++;
        } while (renderPass < item.getItem().getRenderPasses(item.getItemDamage()));
        GL11.glPopMatrix();
    }

    item = enchanter.getStackInSlot(1);
    if (item != null) {
        GL11.glPushMatrix();
        GL11.glRotatef(90F, 1F, 0F, 0F);
        final float scale = 0.5F;
        GL11.glScalef(scale, scale, scale);
        GL11.glTranslatef(0.6F, 1.5F, -0.1F);
        GL11.glRotatef(-70F, 0F, 0F, 1F);
        long millis = System.currentTimeMillis();

        GL11.glTranslatef(0F, 0F, (float) (Math.cos((double) millis / 1000F) - 1.2F) / 10F);
        GL11.glTranslatef(0F, 0.325F, 0F);
        GL11.glRotatef((float) Math.cos((double) millis / 500F) * 5F, 1F, 0F, 0F);
        GL11.glTranslatef(0F, -0.325F, 0F);

        wandRenderer.renderItem(ItemRenderType.ENTITY, item, (Object[]) null);
        GL11.glPopMatrix();
    }

    GL11.glPopMatrix();
}

From source file:thaumic.tinkerer.client.render.tile.RenderTileFunnel.java

License:Creative Commons License

@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
    TileFunnel funnel = (TileFunnel) tileentity;
    ItemStack stack = funnel.getStackInSlot(0);
    if (stack != null) {
        GL11.glPushMatrix();/*from   w ww  . ja v a 2s  .  co m*/
        GL11.glTranslated(d0 + 0.5, d1 + 0.365, d2 + 0.5);
        //if(Block.getBlockFromItem(stack.getItem())== ConfigBlocks.blockJar) {
        //   GL11.glTranslatef(0F, 0.25F, 0F);
        //   jarRenderer.renderInventoryBlock(ConfigBlocks.blockJar, 0, 0, new RenderBlocks());
        //}
        // else
        jarRenderer1.renderItem(IItemRenderer.ItemRenderType.ENTITY, stack, (Object[]) null);
        GL11.glPopMatrix();
    }
}

From source file:thaumic.tinkerer.client.render.tile.RenderTileMagnet.java

License:Creative Commons License

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    GL11.glPushMatrix();//w ww . j a  v  a2  s  .  c o m
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glTranslatef((float) x, (float) y, (float) z);
    boolean blue = tileentity.getWorldObj() == null || (tileentity.getBlockMetadata() & 1) == 0;
    boolean mob = tileentity.getWorldObj() == null ? RenderTileMagnet.mob
            : (tileentity.getBlockMetadata() & 2) == 2;

    ClientHelper.minecraft().renderEngine
            .bindTexture(mob ? blue ? blueMob : redMob : blue ? RenderTileMagnet.blue : red);

    int redstone = 0;
    if (tileentity.getWorldObj() != null) {
        for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
            redstone = Math.max(redstone,
                    tileentity.getWorldObj().getIndirectPowerLevelTo(tileentity.xCoord + dir.offsetX,
                            tileentity.yCoord + dir.offsetY, tileentity.zCoord + dir.offsetZ, dir.ordinal()));
    } else
        redstone = 15;

    GL11.glTranslatef(0.5F, 1.5F, 0.5F);
    GL11.glScalef(1F, -1F, -1F);
    model.render();

    GL11.glRotatef(90F, 1F, 0F, 0F);
    GL11.glTranslatef(0F, 0F, -0.6F);
    IIcon icon = ((ItemHoverHarness) ConfigItems.itemHoverHarness).iconLightningRing;

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 2; j++) {
            GL11.glScalef(1F, -1F, 1F);
            UtilsFX.renderQuadCenteredFromIcon(false, icon, redstone / 15F * 0.7F + (redstone == 0 ? 0 : 0.4F),
                    blue ? 0F : 1F, 0F, blue ? 1F : 0F, 225, GL11.GL_ONE_MINUS_SRC_ALPHA, 0.9F);
        }

        GL11.glTranslated(0, 0, -(Math.cos(System.currentTimeMillis() / 500F) + 1) * 0.09 - 0.1);
    }
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    GL11.glPopMatrix();
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glTranslated(double a, double b, double c) {
    GL11.glTranslated(a, b, c);
}