Example usage for org.lwjgl.opengl GL11 glRotated

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

Introduction

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

Prototype

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

Source Link

Document

Double version of #glRotatef Rotatef .

Usage

From source file:gravestone.models.block.ModelSpawnerPentagram.java

License:LGPL

public void renderAll() {
    pentagram.render(0.0625F);/*from w  w  w  . j a v a 2s.  c o m*/

    TileEntityGSSpawnerRenderer.instance.bindTextureByName(candleTexture);
    GL11.glPushMatrix();
    GL11.glTranslated(0, 0, 1);
    GL11.glRotated(180, 0, 1, 0);
    candle1.renderAll();
    GL11.glPopMatrix();

    TileEntityGSSpawnerRenderer.instance.bindTextureByName(candleTexture);
    GL11.glPushMatrix();
    GL11.glTranslated(0.95, 0, 0.3);
    GL11.glRotated(252, 0, 1, 0);
    candle2.renderAll();
    GL11.glPopMatrix();

    TileEntityGSSpawnerRenderer.instance.bindTextureByName(candleTexture);
    GL11.glPushMatrix();
    GL11.glTranslated(-0.95, 0, 0.3);
    GL11.glRotated(108, 0, 1, 0);
    candle3.renderAll();
    GL11.glPopMatrix();

    TileEntityGSSpawnerRenderer.instance.bindTextureByName(candleTexture);
    GL11.glPushMatrix();
    GL11.glTranslated(-0.59, 0, -0.8);
    GL11.glRotated(36, 0, 1, 0);
    candle4.renderAll();
    GL11.glPopMatrix();

    TileEntityGSSpawnerRenderer.instance.bindTextureByName(candleTexture);
    GL11.glPushMatrix();
    GL11.glTranslated(0.61, 0, -0.8);
    GL11.glRotated(-36, 0, 1, 0);
    candle5.renderAll();
    GL11.glPopMatrix();
}

From source file:hellfirepvp.astralsorcery.client.effect.block.EffectTranslucentFallingBlock.java

License:Open Source License

@Override
public void render(float pTicks) {
    TextureHelper.refreshTextureBindState();
    TextureHelper.setActiveTextureToAtlasSprite();
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();//www .  j ava2s  .  co m
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glEnable(GL11.GL_BLEND);
    Blending.ADDITIVEDARK.apply();
    if (disableDepth) {
        GL11.glDisable(GL11.GL_DEPTH_TEST);
    }
    GL11.glDisable(GL11.GL_CULL_FACE);

    RenderingUtils.removeStandartTranslationFromTESRMatrix(pTicks);

    Vector3 translateTo = getInterpolatedPosition(pTicks);
    GL11.glTranslated(translateTo.getX(), translateTo.getY(), translateTo.getZ());

    float alpha = alphaFunction.getAlpha(age, maxAge);
    alpha *= alphaMultiplier;
    GL11.glColor4f(1F, 1F, 1F, alpha);

    float scaleF = this.scale;
    scaleF = scaleFunction.getScale(this, pTicks, scaleF);
    GL11.glTranslated(0.5, 0.5, 0.5);
    GL11.glScaled(scaleF, scaleF, scaleF);
    GL11.glTranslated(-0.5, -0.5, -0.5);

    Vector3 rotation = getInterpolatedRotation(pTicks);
    GL11.glTranslated(0.5, 0.5, 0.5);
    GL11.glRotated(rotation.getX(), 1, 0, 0);
    GL11.glRotated(rotation.getY(), 0, 1, 0);
    GL11.glRotated(rotation.getZ(), 0, 0, 1);
    GL11.glTranslated(-0.5, -0.5, -0.5);

    Tessellator tes = Tessellator.getInstance();
    VertexBuffer vb = tes.getBuffer();
    vb.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
    IBlockAccess world = new AirBlockRenderWorld(Biomes.PLAINS, Minecraft.getMinecraft().world.getWorldType());
    Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlock(this.blockState, BlockPos.ORIGIN, world,
            vb);
    tes.draw();

    GL11.glEnable(GL11.GL_CULL_FACE);
    if (disableDepth) {
        GL11.glEnable(GL11.GL_DEPTH_TEST);
    }
    Blending.DEFAULT.apply();
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glPopMatrix();
    GL11.glPopAttrib();
    TextureHelper.refreshTextureBindState();
}

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

License:Open Source License

private void renderT3Additions(TileAltar te, double x, double y, double z, double jump) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();//  w  ww. j a  va  2s.  c  om
    GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
    GL11.glRotated(180, 1, 0, 0);
    GL11.glScaled(0.0625, 0.0625, 0.0625);
    RenderHelper.disableStandardItemLighting();

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

    texAltar3.bind();
    modelAltar3.render(null, (float) jump, 0, 0, 0, 0, 1F);
    RenderHelper.disableStandardItemLighting();
    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

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

License:Open Source License

private void renderT2Additions(TileAltar te, double x, double y, double z, double jump) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();/*from w  ww.  j a v  a 2 s.c  o m*/
    GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
    GL11.glRotated(180, 1, 0, 0);
    GL11.glScaled(0.0625, 0.0625, 0.0625);
    RenderHelper.disableStandardItemLighting();

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

    texAltar2.bind();
    modelAltar2.render(null, (float) jump, 0, 0, 0, 0, 1F);
    RenderHelper.disableStandardItemLighting();
    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

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();/*  w  ww.  j a va  2 s  .  c om*/

    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. j  ava 2s. 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();//from   ww w  .  j a va2  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.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 av  a2s . c  om
        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();// www .j a  v  a 2s  .c  o 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.util.BlockArrayRenderHelper.java

License:Open Source License

public void render3DGUI(double x, double y, float pTicks) {
    GuiScreen scr = Minecraft.getMinecraft().currentScreen;
    if (scr == null)
        return;/*from   w w w  .j  ava  2s  .  c o  m*/

    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();
    Minecraft mc = Minecraft.getMinecraft();
    double sc = new ScaledResolution(mc).getScaleFactor();
    GL11.glTranslated(x + 16D / sc, y + 16D / sc, 512);

    double mul = 10.5;

    double size = 2;
    double minSize = 0.5;

    Vec3i max = blocks.getMax();
    Vec3i min = blocks.getMin();

    double maxLength = 0;
    double pointDst = max.getX() - min.getX();
    if (pointDst > maxLength)
        maxLength = pointDst;
    pointDst = max.getY() - min.getY();
    if (pointDst > maxLength)
        maxLength = pointDst;
    pointDst = max.getZ() - min.getZ();
    if (pointDst > maxLength)
        maxLength = pointDst;
    maxLength -= 5;

    if (maxLength > 0) {
        size = (size - minSize) * (1D - (maxLength / 20D));
    }

    double dr = -5.75 * size;
    GL11.glTranslated(dr, dr, dr);
    GL11.glRotated(rotX, 1, 0, 0);
    GL11.glRotated(rotY, 0, 1, 0);
    GL11.glRotated(rotZ, 0, 0, 1);
    GL11.glTranslated(-dr, -dr, -dr);

    GL11.glScaled(-size * mul, -size * mul, -size * mul);

    BlockRendererDispatcher brd = Minecraft.getMinecraft().getBlockRendererDispatcher();
    VertexFormat blockFormat = DefaultVertexFormats.BLOCK;

    TextureHelper.setActiveTextureToAtlasSprite();
    Tessellator tes = Tessellator.getInstance();
    VertexBuffer vb = tes.getBuffer();

    vb.begin(GL11.GL_QUADS, blockFormat);
    for (Map.Entry<BlockPos, BakedBlockData> data : renderAccess.blockRenderData.entrySet()) {
        BlockPos offset = data.getKey();
        BakedBlockData renderData = data.getValue();
        if (renderData.type != Blocks.AIR) {
            brd.renderBlock(renderData.state, offset, renderAccess, vb);
        }
    }
    tes.draw();

    for (Map.Entry<BlockPos, BakedBlockData> data : renderAccess.blockRenderData.entrySet()) {
        BlockPos offset = data.getKey();
        BakedBlockData renderData = data.getValue();
        if (renderData.tileEntity != null && renderData.tesr != null) {
            renderData.tileEntity.setWorld(Minecraft.getMinecraft().world);
            renderData.tesr.renderTileEntityAt(renderData.tileEntity, offset.getX(), offset.getY(),
                    offset.getZ(), pTicks, 0);
        }
    }

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