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:buildcraft.core.lib.client.render.RenderUtils.java

License:Minecraft Mod Public

public static void rotate(Vec3d rotation) {
    GL11.glRotated(rotation.xCoord, 1, 0, 0);
    GL11.glRotated(rotation.yCoord, 0, 1, 0);
    GL11.glRotated(rotation.zCoord, 0, 0, 1);
}

From source file:buildcraftAdditions.client.render.BucketItemRenderer.java

License:GNU General Public License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    if (item == null || item.getItem() == null || !(item.getItem() instanceof ItemBucketBCA))
        return;//from   w w  w.  j a v  a2 s .c  o  m

    ItemBucketBCA bucket = (ItemBucketBCA) item.getItem();
    Fluid fluid = null;
    boolean gaseous = false;

    if (bucket.getFluid() != null) {
        fluid = bucket.getFluid().getFluid();
        if (fluid != null && (fluid.isGaseous() || fluid.getDensity() < 0))
            gaseous = true;
    }

    IIcon overlay = bucket.getOverlay();
    IIcon bucketIcon = Items.bucket.getIconFromDamage(0);

    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glRotated(180, 0, 0, 1);
        GL11.glTranslated(-1, -1, 0);
    } else if (type.equals(ItemRenderType.ENTITY)) {
        GL11.glRotated(180, 0, 0, 1);
        GL11.glRotated(90, 0, 1, 0);
        GL11.glTranslated(-0.5, -0.9, 0);
        if (item.isOnItemFrame()) {
            GL11.glTranslated(0.075, 0.475, 0);
            GL11.glScaled(0.85, 0.85, 0.85);
        }
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glTranslated(1, 1, 0);
        GL11.glRotated(180, 0, 0, 1);
    }

    if (fluid != null) {
        Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET);
        renderMask(overlay, fluid.getIcon(), type, gaseous);
    }
    Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET);

    if (!type.equals(ItemRenderType.INVENTORY)) {
        if (gaseous)
            ItemRenderer.renderItemIn2D(Tessellator.instance, bucketIcon.getMaxU(), bucketIcon.getMinV(),
                    bucketIcon.getMinU(), bucketIcon.getMaxV(), bucketIcon.getIconWidth(),
                    bucketIcon.getIconHeight(), 0.0625F);
        else
            ItemRenderer.renderItemIn2D(Tessellator.instance, bucketIcon.getMinU(), bucketIcon.getMaxV(),
                    bucketIcon.getMaxU(), bucketIcon.getMinV(), bucketIcon.getIconWidth(),
                    bucketIcon.getIconHeight(), 0.0625F);
    } else
        renderIcon(bucketIcon, 0, gaseous);

    GL11.glColor4f(1, 1, 1, 1);
    GL11.glPopMatrix();
}

From source file:buildcraftAdditions.client.render.CanisterItemRender.java

License:GNU General Public License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    IIcon overlay = canister.overlay;/*w  w  w. ja  v a  2 s. c  o  m*/
    IIcon cannister = canister.getIconFromDamage(0);

    GL11.glPushMatrix();
    if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D);
        GL11.glTranslated(-1.0D, -1.0D, 0.0D);
    } else if (type.equals(ItemRenderType.ENTITY)) {
        GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D);
        GL11.glRotated(90.0D, 0.0D, 1.0D, 0.0D);
        GL11.glTranslated(-0.5D, -0.9D, 0.0D);
        if (item.isOnItemFrame()) {
            GL11.glTranslated(0.1D, 0.4D, 0.0D);
            GL11.glScaled(0.85D, 0.85D, 0.85D);
        }
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glTranslated(1.0D, 1.0D, 0.0D);
        GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D);
    }

    if (item.stackTagCompound != null && item.getTagCompound().hasKey("Fluid")) {
        Fluid fluid = FluidRegistry
                .getFluid(item.stackTagCompound.getCompoundTag("Fluid").getString("FluidName"));
        if (fluid != null) {
            Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE);
            renderMask(overlay, fluid.getIcon(), type);
        }
    }
    Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE);

    if (!type.equals(ItemRenderType.INVENTORY))
        ItemRenderer.renderItemIn2D(Tessellator.instance, cannister.getMinU(), cannister.getMaxV(),
                cannister.getMaxU(), cannister.getMinV(), cannister.getIconWidth(), cannister.getIconHeight(),
                0.0625F);
    else
        renderIcon(cannister, 0.0D);

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}

From source file:buildcraftAdditions.client.render.items.BackPackItemRenderer.java

License:GNU General Public License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

    GL11.glPushMatrix();//w  w w . j  av  a2 s.com
    switch (type) {
    case EQUIPPED:
        GL11.glRotated(180, 0, 0, 1);
        GL11.glTranslated(-0.75, -0.5, 0);
        break;
    case EQUIPPED_FIRST_PERSON:
        GL11.glTranslated(1, .5, 0);
        GL11.glRotated(270, 0, 1, 0);
        GL11.glRotated(180, 1, 0, 0);
        GL11.glRotated(180, 0, 1, 0);
        break;
    case INVENTORY:
        GL11.glRotated(180, 0, 1, 0);
        GL11.glRotated(180, 1, 0, 0);
        GL11.glTranslated(0, -.25, 0);
    }
    BackPackModel.INSTANCE2.render(null, 0, 0, 0, 0, 0, 0.06f);

    GL11.glPopMatrix();
}

From source file:buildcraftAdditions.client.render.items.BackpackStandItemRenderer.java

License:GNU General Public License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();/* w  w w.  ja v  a  2  s .  c o m*/
    switch (type) {
    case ENTITY:
        GL11.glTranslated(0, 1, 0);
        GL11.glRotated(180, 1, 0, 0);
        GL11.glRotated(90, 0, 1, 0);
        break;
    case EQUIPPED:
        GL11.glRotated(180, 0, 0, 1);
        GL11.glTranslated(-0.75, 0, 0);
        GL11.glTranslated(0, -1.5, 0);
        break;
    case EQUIPPED_FIRST_PERSON:
        GL11.glTranslated(1, 1.5, 0);
        GL11.glRotated(90, 0, 1, 0);
        GL11.glRotated(180, 0, 0, 1);
        break;
    case INVENTORY:
        GL11.glRotated(180, 1, 0, 0);
        GL11.glTranslated(0, -1, 0);
        break;
    default:
        break;
    }
    ModelBackpackStand.INSTANCE2.render(null, 0, 0, 0, 0, 0, 0.0625F);

    GL11.glPopMatrix();
}

From source file:buildcraftAdditions.client.render.items.CanisterItemRender.java

License:GNU General Public License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    if (item == null || item.getItem() == null || !(item.getItem() instanceof ItemCanister))
        return;/*from  w  ww .jav  a 2s  . c  o m*/

    ItemCanister canister = (ItemCanister) item.getItem();

    IIcon overlay = canister.getOverlay();
    IIcon canisterIcon = canister.getIconFromDamage(0);

    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glRotated(180, 0, 0, 1);
        GL11.glTranslated(-1, -1, 0);
    } else if (type.equals(ItemRenderType.ENTITY)) {
        GL11.glRotated(180, 0, 0, 1);
        GL11.glRotated(90, 0, 1, 0);
        GL11.glTranslated(-0.5, -0.9, 0);
        if (item.isOnItemFrame()) {
            GL11.glTranslated(0.075, 0.475, 0);
            GL11.glScaled(0.85, 0.85, 0.85);
        }
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glTranslated(1, 1, 0);
        GL11.glRotated(180, 0, 0, 1);
    }

    FluidStack fluid = Utils.getFluidStackFromItemStack(item);
    if (fluid != null) {
        Fluid f = fluid.getFluid();
        if (f != null) {
            Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET);
            renderMask(overlay, f.getIcon(), type);
        }
    }
    Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET);

    if (type.equals(ItemRenderType.INVENTORY))
        renderIcon(canisterIcon, 0);
    else
        ItemRenderer.renderItemIn2D(Tessellator.instance, canisterIcon.getMinU(), canisterIcon.getMaxV(),
                canisterIcon.getMaxU(), canisterIcon.getMinV(), canisterIcon.getIconWidth(),
                canisterIcon.getIconHeight(), 0.0625F);

    GL11.glColor4f(1, 1, 1, 1);
    GL11.glPopMatrix();
}

From source file:buildcraftAdditions.client.render.items.KineticDusterItemRenderer.java

License:GNU General Public License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

    GL11.glPushMatrix();/*w  w  w.j  a va2 s  .  c o  m*/
    GL11.glRotated(180, 0, 0, 1);
    switch (type) {
    case EQUIPPED:
    case EQUIPPED_FIRST_PERSON:
        GL11.glTranslated(-0.5, -1.5, 0.5);
        break;
    case INVENTORY:
    case ENTITY:
        GL11.glTranslated(0, -1, 0);
        break;
    default:
        break;
    }
    model.render(0);

    GL11.glPopMatrix();
}

From source file:buildcraftAdditions.client.render.KineticToolItemRender.java

License:GNU General Public License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    IIcon overlayChainsaw = tool.overlayChainsaw;
    IIcon overlayDigger = tool.overlayDigger;
    IIcon overlayDrill = tool.overlayDrill;
    IIcon overlayHoe = tool.overlayHoe;/*from ww  w.  j av  a2s  .  c  o  m*/
    IIcon toolIcon = tool.getIconFromDamage(0);

    GL11.glPushMatrix();
    if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D);
        GL11.glTranslated(-1.0D, -1.0D, 0.0D);
    } else if (type.equals(ItemRenderType.ENTITY)) {
        GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D);
        GL11.glRotated(90.0D, 0.0D, 1.0D, 0.0D);
        GL11.glTranslated(-0.5D, -0.9D, 0.0D);
        if (item.isOnItemFrame()) {
            GL11.glTranslated(0.1D, 0.4D, 0.0D);
            GL11.glScaled(0.85D, 0.85D, 0.85D);
        }
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glTranslated(1.0D, 1.0D, 0.0D);
        GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D);
    }

    String lastUsedMode = "";
    if (item.stackTagCompound != null && item.stackTagCompound.hasKey("lastUsedMode"))
        lastUsedMode = item.stackTagCompound.getString("lastUsedMode");
    if (lastUsedMode.equals("axe")) {
        Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE);
        renderMask(overlayChainsaw, overlayChainsaw, type);
    }

    if (lastUsedMode.equals("shovel")) {
        Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE);
        renderMask(overlayDigger, overlayDigger, type);
    }

    if (lastUsedMode.equals("pickaxe")) {
        Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE);
        renderMask(overlayDrill, overlayDrill, type);
    }

    if (lastUsedMode.equals("hoe")) {
        Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE);
        renderMask(overlayHoe, overlayHoe, type);
    }

    Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE);

    if (!type.equals(ItemRenderType.INVENTORY))
        ItemRenderer.renderItemIn2D(Tessellator.instance, toolIcon.getMinU(), toolIcon.getMaxV(),
                toolIcon.getMaxU(), toolIcon.getMinV(), toolIcon.getIconWidth(), toolIcon.getIconHeight(),
                0.0625F);
    else
        renderIcon(toolIcon, 0.0D);

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}

From source file:buildcraftAdditions.client.render.tileentities.RendererBackPackStand.java

License:GNU General Public License

@Override
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float fl) {
    if (entity == null || !(entity instanceof TileBackpackStand))
        return;//  w  ww .ja  va2s.  c  o  m
    int orientation = entity.getWorldObj().getBlockMetadata(entity.xCoord, entity.yCoord, entity.zCoord);
    int angle;
    switch (orientation) {
    case 2:
        angle = 0;
        break;
    case 3:
        angle = 180;
        break;
    case 4:
        angle = 90;
        break;
    case 5:
        angle = -90;
        break;
    default:
        angle = 0;
    }
    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5, y + 2.4, z + 0.5);
    GL11.glRotated(angle, 0, 1, 0);
    GL11.glRotated(180, 1, 0, 0);
    GL11.glScaled(10, 10, 10);
    ModelBackpackStand.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.01f);
    GL11.glPopMatrix();

    TileBackpackStand stand = (TileBackpackStand) entity;
    if (stand.inventory.getStackInSlot(0) == null)
        return;
    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5, y + 1.4, z + 0.5);
    GL11.glRotated(angle, 0, 1, 0);
    GL11.glRotated(180, 1, 0, 0);
    BackPackModel.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.1F);
    GL11.glPopMatrix();

    ItemStack bStack = stand.inventory.getStackInSlot(0);
    ItemKineticBackpack backpack = (ItemKineticBackpack) bStack.getItem();
    if (backpack.getInstalledCapsule(bStack, 0) != 0) {
        GL11.glPushMatrix();
        switch (orientation) {
        case 2:
            GL11.glTranslated(x + 0.7, y + 3.15, z + 0.07);
            break;
        case 3:
            GL11.glTranslated(x + 0.3, y + 3.15, z + 0.93);
            break;
        case 4:
            GL11.glTranslated(x + 0.07, y + 3.15, z + 0.3);
            break;
        case 5:
            GL11.glTranslated(x + 0.92, y + 3.15, z + 0.71);
            break;
        }
        GL11.glScaled(2, 2, 2);
        GL11.glRotated(angle, 0, 1, 0);
        GL11.glRotated(180, 1, 0, 0);
        ModelCapsule.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.05F, backpack.getInstalledCapsule(bStack, 0));
        GL11.glPopMatrix();
    }
    if (backpack.getInstalledCapsule(bStack, 1) != 0) {
        GL11.glPushMatrix();
        switch (orientation) {
        case 2:
            GL11.glTranslated(x + 0.3, y + 3.15, z + 0.07);
            break;
        case 3:
            GL11.glTranslated(x + 0.7, y + 3.15, z + 0.93);
            break;
        case 4:
            GL11.glTranslated(x + 0.08, y + 3.15, z + 0.69);
            break;
        case 5:
            GL11.glTranslated(x + 0.93, y + 3.15, z + 0.3);
            break;
        }
        GL11.glRotated(angle, 0, 1, 0);
        GL11.glScaled(2, 2, 2);
        GL11.glRotated(180, 1, 0, 0);
        ModelCapsule.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.05F, backpack.getInstalledCapsule(bStack, 1));
        GL11.glPopMatrix();
    }
    if (backpack.getInstalledCapsule(bStack, 2) != 0) {
        GL11.glPushMatrix();
        switch (orientation) {
        case 2:
            GL11.glTranslated(x + 0.7, y + 2.85, z + 0.07);
            break;
        case 3:
            GL11.glTranslated(x + 0.3, y + 2.85, z + 0.93);
            break;
        case 4:
            GL11.glTranslated(x + 0.07, y + 2.85, z + 0.3);
            break;
        case 5:
            GL11.glTranslated(x + 0.92, y + 2.85, z + 0.71);
            break;
        }

        GL11.glScaled(2, 2, 2);
        GL11.glRotated(angle, 0, 1, 0);
        GL11.glRotated(180, 1, 0, 0);
        ModelCapsule.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.05F, backpack.getInstalledCapsule(bStack, 2));
        GL11.glPopMatrix();
    }
    if (backpack.getInstalledCapsule(bStack, 3) != 0) {
        GL11.glPushMatrix();
        switch (orientation) {
        case 2:
            GL11.glTranslated(x + 0.3, y + 2.85, z + 0.07);
            break;
        case 3:
            GL11.glTranslated(x + 0.7, y + 2.85, z + 0.93);
            break;
        case 4:
            GL11.glTranslated(x + 0.07, y + 2.85, z + 0.71);
            break;
        case 5:
            GL11.glTranslated(x + 0.92, y + 2.85, z + 0.31);
            break;
        }
        GL11.glScaled(2, 2, 2);
        GL11.glRotated(angle, 0, 1, 0);
        GL11.glRotated(180, 1, 0, 0);
        ModelCapsule.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.05F, backpack.getInstalledCapsule(bStack, 3));
        GL11.glPopMatrix();
    }
}

From source file:buildcraftAdditions.client.render.tileentities.RendererDusterKinetic.java

License:GNU General Public License

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float fl) {
    super.renderTileEntityAt(tile, x, y, z, fl);
    if (tile != null && tile instanceof TileKineticDuster) {
        TileKineticDuster duster = (TileKineticDuster) tile;
        GL11.glPushMatrix();/*from  w w w. jav a2s  .  c  o  m*/
        GL11.glTranslated(x + .5, y + 1.5, z + .5);
        GL11.glRotated(180, 1, 0, 0);
        model.render(duster.progressStage);
        GL11.glPopMatrix();
    }
}