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:hellfirepvp.astralsorcery.client.render.tile.TESRAttunementAltar.java

License:Open Source License

@Override
public void renderTileEntityAt(TileAttunementAltar te, double x, double y, double z, float partialTicks,
        int destroyStage) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();/*from   w w  w . j a  v a2 s .  c o m*/

    GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
    GL11.glScaled(0.0625, 0.0625, 0.0625);
    GL11.glRotated(180, 1, 0, 0);

    GlStateManager.pushMatrix();
    GlStateManager.rotate(165.0F, 1.0F, 0.0F, 0.0F);
    RenderHelper.enableStandardItemLighting();
    GlStateManager.popMatrix();

    texModelAttunementAltar.bind();
    modelAttunementAltar.renderBase();
    GL11.glPopMatrix();

    float startY = -1.5F;
    float endY = -0.5F;
    float tickPartY = (endY - startY) / ((float) TileAttunementAltar.MAX_START_ANIMATION_TICK);

    float prevPosY = endY + (te.prevActivationTick * tickPartY);
    float posY = endY + (te.activationTick * tickPartY);
    double framePosY = RenderingUtils.interpolate(prevPosY, posY, partialTicks);

    double generalAnimationTick = ClientScheduler.getClientTick() / 4D;
    if (te.animate) {
        if (te.tesrLocked) {
            te.tesrLocked = false;
        }
    } else {
        if (te.tesrLocked) {
            generalAnimationTick = 7.25D;
        } else {
            if (Math.abs(
                    (generalAnimationTick % TileAttunementAltar.MAX_START_ANIMATION_SPIN) - 7.25D) <= 0.3125) {
                generalAnimationTick = 7.25D;
                te.tesrLocked = true;
            }
        }
    }

    float spinDur = TileAttunementAltar.MAX_START_ANIMATION_SPIN;

    for (int i = 1; i < 9; i++) {
        float incrementer = (spinDur / 8) * i;

        double aFrame = generalAnimationTick + incrementer;
        double prevAFrame = generalAnimationTick + incrementer - 1;
        double renderFrame = RenderingUtils.interpolate(prevAFrame, aFrame, 0);

        double partRenderFrame = (renderFrame % spinDur) / spinDur;
        float normalized = (float) (partRenderFrame * 2F * Math.PI);

        float xOffset = MathHelper.cos(normalized);
        float zOffset = MathHelper.sin(normalized);

        GL11.glPushMatrix();
        GL11.glTranslated(x + 0.5, y + framePosY, z + 0.5);
        GL11.glScaled(0.0625, 0.0625, 0.0625);
        GL11.glRotated(180, 1, 0, 0);

        modelAttunementAltar.renderHovering(xOffset, zOffset,
                (float) RenderingUtils.interpolate(
                        ((float) te.prevActivationTick) / TileAttunementAltar.MAX_START_ANIMATION_TICK,
                        ((float) te.activationTick) / TileAttunementAltar.MAX_START_ANIMATION_TICK,
                        partialTicks));

        GL11.glPopMatrix();
    }

    RenderHelper.disableStandardItemLighting();

    GL11.glPopAttrib();
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRCelestialCrystals.java

License:Open Source License

@Override
public void renderTileEntityAt(TileCelestialCrystals te, double x, double y, double z, float partialTicks,
        int destroyStage) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();/*from  w  w w  .  ja v a 2 s.c  om*/
    RenderHelper.disableStandardItemLighting();
    GL11.glTranslated(x + 0.5, y + 0.1, z + 0.5);
    float size = 0.2F;
    GL11.glScalef(size, size, size);

    int r = 0x59A51481;
    BlockPos at = te.getPos();
    r ^= at.getX();
    r ^= at.getY();
    r ^= at.getZ();
    r = Math.abs(r);
    r = rotMapping[r % rotMapping.length];
    GL11.glRotated(r, 0, 1, 0);

    renderCelestialCrystals(te.getGrowth());
    RenderHelper.enableStandardItemLighting();
    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRCelestialCrystals.java

License:Open Source License

@Override
public void render(ItemStack stack) {
    GL11.glPushMatrix();/*  w  w w . ja  v a  2  s  .  co  m*/
    GL11.glTranslated(0.5, 0.25, 0.5);
    GL11.glScalef(0.2F, 0.2F, 0.2F);
    GL11.glRotated(-10, 0, 0, 1);
    GL11.glRotated(20, 1, 0, 0);
    GL11.glRotated(-70, 0, 1, 0);
    GL11.glDisable(GL11.GL_CULL_FACE);
    RenderHelper.disableStandardItemLighting();
    renderCelestialCrystals(MathHelper.clamp(stack.getItemDamage(), 0, 4));
    RenderHelper.enableStandardItemLighting();
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glPopMatrix();
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRCollectorCrystal.java

License:Open Source License

@Override
public void renderTileEntityAt(TileCollectorCrystal te, double x, double y, double z, float partialTicks,
        int destroyStage) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    BlockCollectorCrystalBase.CollectorCrystalType type = te.getType();
    long sBase = 1553015L;
    sBase ^= (long) te.getPos().getX();
    sBase ^= (long) te.getPos().getY();
    sBase ^= (long) te.getPos().getZ();
    Color c = type == null ? BlockCollectorCrystalBase.CollectorCrystalType.ROCK_CRYSTAL.displayColor
            : type.displayColor;//from www .j ava 2s .  c  om
    if (te.isEnhanced()) {
        RenderingUtils.renderLightRayEffects(x + 0.5, y + 0.5, z + 0.5, c, sBase,
                ClientScheduler.getClientTick(), 20, 1.4F, 50, 25);
        RenderingUtils.renderLightRayEffects(x + 0.5, y + 0.5, z + 0.5, Color.WHITE, sBase,
                ClientScheduler.getClientTick(), 40, 2, 15, 15);
    } else {
        RenderingUtils.renderLightRayEffects(x + 0.5, y + 0.5, z + 0.5, c, sBase,
                ClientScheduler.getClientTick(), 20, 50, 25);
    }

    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5, y, z + 0.5);
    renderCrystal(type == BlockCollectorCrystalBase.CollectorCrystalType.CELESTIAL_CRYSTAL, true);
    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRCollectorCrystal.java

License:Open Source License

public static void renderCrystal(boolean isCelestial, boolean bounce) {
    GL11.glPushMatrix();/*from w  w  w  .  jav  a 2 s.com*/
    if (bounce) {
        int t = (int) (Minecraft.getMinecraft().world.getTotalWorldTime() & 255);
        float perc = (256 - t) / 256F;
        perc = MathHelper.cos((float) (perc * 2 * Math.PI));
        GL11.glTranslated(0, 0.03 * perc, 0);
    }
    TextureHelper.refreshTextureBindState();
    RenderHelper.disableStandardItemLighting();
    if (isCelestial) {
        renderTile(texBlue);
    } else {
        renderTile(texWhite);
    }
    RenderHelper.enableStandardItemLighting();
    GL11.glPopMatrix();
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRCollectorCrystal.java

License:Open Source License

@Override
public void render(ItemStack stack) {
    GL11.glPushMatrix();//from   w w  w . j  a  va 2  s.  c  o m
    GL11.glTranslated(0.5, 0, 0.5);
    RenderHelper.disableStandardItemLighting();
    BlockCollectorCrystalBase.CollectorCrystalType type = ItemCollectorCrystal.getType(stack);
    switch (type) {
    case ROCK_CRYSTAL:
        renderTile(texWhite);
        break;
    case CELESTIAL_CRYSTAL:
        renderTile(texBlue);
        break;
    }
    GL11.glPopMatrix();
    RenderHelper.enableStandardItemLighting();
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRGrindstone.java

License:Open Source License

@Override
public void renderTileEntityAt(TileGrindstone te, double x, double y, double z, float partialTicks,
        int destroyStage) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GlStateManager.pushMatrix();//from w w w  .  j a  va 2s .c om
    GlStateManager.translate(x + 0.5, y + 1.65, z + 0.5);
    GlStateManager.rotate(180, 1, 0, 0);
    GlStateManager.scale(0.067, 0.067, 0.067);

    GlStateManager.pushMatrix();
    GlStateManager.rotate(-30.0F, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(165.0F, 1.0F, 0.0F, 0.0F);
    RenderHelper.enableStandardItemLighting();
    GlStateManager.popMatrix();

    renderModel(te, 1);
    GlStateManager.popMatrix();
    GL11.glPopAttrib();

    ItemStack grind = te.getGrindingItem();
    if (!grind.isEmpty()) {
        TextureHelper.refreshTextureBindState();
        TextureHelper.setActiveTextureToAtlasSprite();
        if (grind.getItem() instanceof IGrindable) {
            IGrindable grindable = (IGrindable) grind.getItem();
            GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
            GL11.glPushMatrix();
            GL11.glTranslated(x, y, z);
            grindable.applyClientGrindstoneTransforms();
            RenderHelper.enableStandardItemLighting();
            Minecraft.getMinecraft().getRenderItem().renderItem(grind,
                    ItemCameraTransforms.TransformType.GROUND);
            RenderHelper.disableStandardItemLighting();
            GL11.glPopMatrix();
            GL11.glPopAttrib();
        }
        if (SwordSharpenHelper.isSharpenableItem(grind)) {
            GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
            GL11.glPushMatrix();
            GL11.glTranslated(x, y, z);
            IGrindable.applyDefaultGrindstoneTransforms();
            RenderHelper.enableStandardItemLighting();
            Minecraft.getMinecraft().getRenderItem().renderItem(grind,
                    ItemCameraTransforms.TransformType.GROUND);
            RenderHelper.disableStandardItemLighting();
            GL11.glPopMatrix();
            GL11.glPopAttrib();
        }
    }
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRLens.java

License:Open Source License

@Override
public void renderTileEntityAt(TileCrystalLens te, double x, double y, double z, float partialTicks,
        int destroyStage) {
    List<BlockPos> linked = te.getLinkedPositions();
    float yaw = 0; //Degree
    float pitch = 0; //Degree
    if (!linked.isEmpty() && linked.size() == 1) {
        BlockPos to = linked.get(0);/*ww  w  .  j a  v  a  2s .co  m*/
        BlockPos from = te.getTrPos();
        Vector3 dir = new Vector3(to).subtract(new Vector3(from));

        pitch = (float) Math.atan2(dir.getY(), Math.sqrt(dir.getX() * dir.getX() + dir.getZ() * dir.getZ()));

        yaw = (float) Math.atan2(dir.getX(), dir.getZ());

        yaw = 180F + (float) Math.toDegrees(-yaw);
        pitch = (float) Math.toDegrees(pitch);
    }
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);

    GL11.glEnable(GL11.GL_BLEND);
    Blending.DEFAULT.apply();

    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5, y + 1.335, z + 0.5);
    GL11.glScaled(0.055, 0.055, 0.055);
    GL11.glRotated(180, 1, 0, 0);
    GL11.glRotated(yaw % 360, 0, 1, 0);
    renderHandle(yaw, pitch);
    if (te.getLensColor() != null) {
        GL11.glRotated(180, 0, 1, 0);
        Color c = te.getLensColor().wrappedColor;
        GL11.glColor4f(c.getRed() / 255F, c.getGreen() / 255F, c.getBlue() / 255F, 1F);
        renderColoredLens(yaw, -pitch);
        GL11.glColor4f(1F, 1F, 1F, 1F);
    }
    TextureHelper.refreshTextureBindState();
    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRPrismLens.java

License:Open Source License

public static void renderColoredPrismsLast() {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();//from  w  w w . j  a va2s.co m
    RenderingUtils.removeStandartTranslationFromTESRMatrix(Minecraft.getMinecraft().getRenderPartialTicks());

    GL11.glEnable(GL11.GL_BLEND);
    Blending.DEFAULT.apply();

    for (TileCrystalPrismLens prism : coloredPositions) {
        Color c = prism.getLensColor().wrappedColor;
        GL11.glPushMatrix();
        BlockPos pos = prism.getPos();

        GL11.glTranslated(pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5);
        GL11.glScaled(0.0625, 0.0625, 0.0625);
        GL11.glRotated(180, 1, 0, 0);

        GL11.glColor4f(c.getRed() / 255F, c.getGreen() / 255F, c.getBlue() / 255F, 1F);
        renderColoredPrism();
        GL11.glColor4f(1F, 1F, 1F, 1F);

        GL11.glPopMatrix();
    }

    coloredPositions.clear();

    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRPrismLens.java

License:Open Source License

@Override
public void renderTileEntityAt(TileCrystalPrismLens te, double x, double y, double z, float partialTicks,
        int destroyStage) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();//from   w  ww. j a  v  a 2 s .c om

    if (te.getLinkedPositions().size() > 0) {
        long sBase = 0x5911539513145924L;
        sBase ^= (long) te.getPos().getX();
        sBase ^= (long) te.getPos().getY();
        sBase ^= (long) te.getPos().getZ();
        RenderingUtils.renderLightRayEffects(x + 0.5, y + 0.6, z + 0.5,
                BlockCollectorCrystal.CollectorCrystalType.ROCK_CRYSTAL.displayColor, sBase,
                ClientScheduler.getClientTick(), 9, 50, 25);
    }

    GL11.glTranslated(x + 0.5, y + 0.20, z + 0.5);

    GL11.glScaled(0.6, 0.6, 0.6);
    GL11.glEnable(GL11.GL_BLEND);
    Blending.DEFAULT.apply();
    TESRCollectorCrystal.renderCrystal(false, true);
    RenderHelper.disableStandardItemLighting();
    if (te.getLensColor() != null) {
        coloredPositions.add(te);
        /*GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
        GL11.glScaled(0.0625, 0.0625, 0.0625);
        GL11.glRotated(180, 1, 0, 0);
        GL11.glEnable(GL11.GL_BLEND);
        Blending.DEFAULT.applyServer();
        Color c = te.getLensColor().wrappedColor;
        GL11.glColor4f(c.getRed() / 255F, c.getGreen() / 255F, c.getBlue() / 255F, 1F);
        renderColoredPrism();
        GL11.glColor4f(1F, 1F, 1F, 1F);*/
    }
    TextureHelper.refreshTextureBindState();
    GL11.glPopMatrix();
    GL11.glPopAttrib();
}