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:com.builtbroken.atomic.content.items.cell.RendererItemCell.java

protected void applyRotation(ItemRenderType type) {
    if (type.equals(ItemRenderType.ENTITY)) {
        GL11.glRotated(180, 0, 0, 1);
        GL11.glRotated(90, 0, 1, 0);/*  w w  w  .j a va  2s  .  c  om*/
        GL11.glScaled(0.75, 0.75, 0.75);
        GL11.glTranslated(-0.5, -0.6, 0);
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glTranslated(1, 1, 0);
        GL11.glRotated(180, 0, 0, 1);
    } else if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glRotated(180, 0, 0, 1);
        GL11.glTranslated(-1, -1, 0);
    }
}

From source file:com.builtbroken.atomic.content.machines.steam.generator.TESRSteamGenerator.java

protected void renderSmallTurbine(float rotation) {
    bindTexture(small_texture);/*from   w  w  w .j a v a 2s.  c  om*/

    GL11.glPushMatrix();
    GL11.glRotated(rotation, 0, 1, 0);
    small_model.renderOnly(smallTurbineRenderA);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glRotated(-rotation, 0, 1, 0);
    small_model.renderOnly(smallTurbineRenderB);
    GL11.glPopMatrix();

    small_model.renderAllExcept(smallTurbineRenderAuB); //TODO convert to renderOnly
}

From source file:com.builtbroken.icbm.content.crafting.station.small.auto.TileSMAutoCraftClient.java

@Override
@SideOnly(Side.CLIENT)/*from w w w .j ava  2  s.  c  o  m*/
public void renderDynamic(Pos pos, float frame, int pass) {
    //Render launcher
    GL11.glPushMatrix();
    GL11.glTranslatef(pos.xf() + 0.5f, pos.yf(), pos.zf() + 0.5f);
    GL11.glRotated(90, 0, 1, 0);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_WORKSTATION_TEXTURE2);

    if (getDirection() == ForgeDirection.EAST) {
        GL11.glRotated(-90, 0, 1, 0);
    } else if (getDirection() == ForgeDirection.WEST) {
        GL11.glRotated(90, 0, 1, 0);
    } else if (getDirection() == ForgeDirection.SOUTH) {
        GL11.glRotated(180, 0, 1, 0);
    }
    Assets.CART1x3.renderAll();
    GL11.glPopMatrix();

    //render missile
    if (completedMissile != null) {
        GL11.glPushMatrix();
        TileSmallMissileWorkstationClient.renderMissile(pos, completedMissile, ForgeDirection.UP,
                getDirection());
        GL11.glPopMatrix();
    } else if (startedMissile != null) {
        GL11.glPushMatrix();
        TileSmallMissileWorkstationClient.renderMissile(pos, startedMissile, ForgeDirection.UP, getDirection());
        GL11.glPopMatrix();
    }
}

From source file:com.builtbroken.icbm.content.crafting.station.small.TileSmallMissileWorkstationClient.java

@SideOnly(Side.CLIENT)
public static void renderDynamic(Pos pos, Pos offset, ForgeDirection connectedBlockSide,
        ForgeDirection direction, IMissile missile, float frame, int pass) {
    //Render launcher
    GL11.glPushMatrix();/*from w  w  w .  ja  v a  2s.  c  om*/
    GL11.glTranslatef(pos.xf() + offset.xf(), pos.yf() + offset.yf(), pos.zf() + offset.zf());
    GL11.glRotated(90, 0, 1, 0);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_WORKSTATION_TEXTURE2);

    int tableX = 2;
    //Keep in mind the directions are of the facing block
    switch (connectedBlockSide) {
    case UP:
        if (direction == ForgeDirection.EAST) {
            GL11.glRotated(-90, 0, 1, 0);
            //x y z
            GL11.glTranslatef(-2, 0f, -1);
        } else if (direction == ForgeDirection.WEST) {
            GL11.glRotated(90, 0, 1, 0);
            //x y z
            GL11.glTranslatef(-1, 0f, 2);
        } else if (direction == ForgeDirection.SOUTH) {
            GL11.glRotated(180, 0, 1, 0);
            //x y z
            GL11.glTranslatef(-3, 0f, 1);
        }
        break;
    case DOWN:
        GL11.glRotated(180, 1, 0, 0);
        // z y x
        GL11.glTranslatef(0f, -1f, 1f);
        if (direction == ForgeDirection.WEST) {
            GL11.glRotated(-90, 0, 1, 0);
            //x y z
            GL11.glTranslatef(-2f, 0f, -1f);
        } else if (direction == ForgeDirection.EAST) {
            GL11.glRotated(90, 0, 1, 0);
            //x y z
            GL11.glTranslatef(-1f, 0f, 2f);
        } else if (direction == ForgeDirection.SOUTH) {
            GL11.glRotated(180, 0, 1, 0);
            //x y z
            GL11.glTranslatef(-3, 0f, 1);
        }
        break;
    case EAST:
        GL11.glRotated(90, 1, 0, 0);
        // z x y
        GL11.glTranslatef(0f, -1f, 0f);
        if (direction == ForgeDirection.DOWN) {
            GL11.glRotated(-90, 0, 1, 0);
            // y x z
            GL11.glTranslatef(-2f, 0f, -1f);
        } else if (direction == ForgeDirection.UP) {
            GL11.glRotated(90, 0, 1, 0);
            // y x z
            GL11.glTranslatef(-1f, 0f, 2f);
        }
        if (direction == ForgeDirection.SOUTH) {
            GL11.glRotated(180, 0, 1, 0);
            // y x z
            GL11.glTranslatef(-3f, 0f, 1f);
        }
        break;
    case WEST:
        GL11.glRotated(-90, 1, 0, 0);
        // z x y
        if (direction == ForgeDirection.UP) {
            GL11.glRotated(-90, 0, 1, 0);
            // y x z
            GL11.glTranslatef(-1f, 0f, -1f);
        } else if (direction == ForgeDirection.DOWN) {
            GL11.glRotated(90, 0, 1, 0);
            // y x z
            GL11.glTranslatef(-2f, 0f, 2f);
        } else {
            GL11.glTranslatef(0f, 0f, 1f);
            if (direction == ForgeDirection.SOUTH) {
                GL11.glRotated(180, 0, 1, 0);
                // y x z
                GL11.glTranslatef(-3f, 0f, 1f);
            }
        }
        break;
    case NORTH:
        GL11.glRotated(90, 0, 1, 0);
        GL11.glRotated(90, 1, 0, 0);
        // y x z
        GL11.glTranslatef(-1f, 1f, 0f);
        if (direction == ForgeDirection.DOWN) {
            GL11.glRotated(-90, 0, 1, 0);
            // y z x
            GL11.glTranslatef(-2f, 0f, -1f);
        } else if (direction == ForgeDirection.EAST) {
            GL11.glRotated(180, 0, 1, 0);
            GL11.glTranslatef(-3f, 0f, 1f);
        } else if (direction == ForgeDirection.UP) {
            GL11.glRotated(90, 0, 1, 0);
            // y z x
            GL11.glTranslatef(-1f, 0f, 2f);
        }
        break;
    case SOUTH:
        GL11.glRotated(90, 0, 1, 0);
        GL11.glRotated(-90, 1, 0, 0);
        // x z y
        GL11.glTranslatef(-1f, -2f, 1f);
        if (direction == ForgeDirection.UP) {
            GL11.glRotated(-90, 0, 1, 0);
            // y z x
            GL11.glTranslatef(-2f, 0f, -1f);
        } else if (direction == ForgeDirection.EAST) {
            GL11.glRotated(180, 0, 1, 0);
            // x z y
            GL11.glTranslatef(-3f, 0, 1f);
        } else if (direction == ForgeDirection.DOWN) {
            GL11.glRotated(90, 0, 1, 0);
            // y z x
            GL11.glTranslatef(-1f, 0f, 2f);
        }
        break;

    }
    Assets.SMALL_MISSILE_STATION_MODEL2.renderAll();
    GL11.glTranslatef(tableX, 0, 0);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(SharedAssets.TOOL_TABLE_TEXTURE);
    SharedAssets.TOOL_TABLE.renderAll();
    GL11.glPopMatrix();

    //render missile
    if (missile != null) {
        GL11.glPushMatrix();
        renderMissile(pos, missile, connectedBlockSide, direction);
        GL11.glPopMatrix();
    }
}

From source file:com.builtbroken.icbm.content.crafting.station.small.TileSmallMissileWorkstationClient.java

public static void handleMissileRotationUD(ForgeDirection direction) {
    switch (direction) {
    case EAST:/*  w w w .  j  av a  2s. co m*/
        GL11.glRotated(-90, 0, 0, 1);
        // y x z
        //GL11.glTranslatef(-1.4f, -0.5f, 0.15f);
        break;
    case WEST:
        GL11.glRotated(90, 0, 0, 1);
        // y x z
        //GL11.glTranslatef(0.5f, -1.4f, 0.15f);
        break;
    case SOUTH:
        GL11.glRotated(90, 1, 0, 0);
        // x z y
        //GL11.glTranslatef(0f, -0.6f, -1.2f);
        break;
    case NORTH:
        GL11.glRotated(-90, 1, 0, 0);
        // x z y
        //GL11.glTranslatef(0f, -1.3f, 0.75f);
        break;
    }
}

From source file:com.builtbroken.icbm.content.crafting.station.small.TileSmallMissileWorkstationClient.java

/**
 * Handles rotation for east and west//from  w  w w.  j  a  v a  2s. co m
 */
public static void handleMissileRotationEW(ForgeDirection direction) {
    switch (direction) {
    //UP is already done by default
    //EAST and WEST are invalid rotations
    case UP:
        //GL11.glTranslatef(0f, -0.1f, .08f);
        break;
    case DOWN:
        GL11.glRotated(180, 0, 0, 1);
        // ? -y ?
        //GL11.glTranslatef(-1f, -1.8f, .15f);
        break;
    case NORTH:
        GL11.glRotated(-90, 1, 0, 0);
        // x -z y
        //GL11.glTranslatef(.15f, -1.3f, 0.7f);
        break;
    case SOUTH:
        GL11.glRotated(90, 1, 0, 0);
        // x z y
        //GL11.glTranslatef(0.1f, -0.55f, -1.1f);
        break;
    }
}

From source file:com.builtbroken.icbm.content.crafting.station.small.TileSmallMissileWorkstationClient.java

/**
 * Handles rotation for north and south//from  w  ww.ja va  2  s  . co  m
 */
public static void handleMissileRotationNS(ForgeDirection direction) {
    switch (direction) {
    //UP is already done by default
    //NORTH and SOUTH are invalid rotations
    case DOWN:
        GL11.glRotated(180, 0, 0, 1);
        break;
    case EAST:
        GL11.glRotated(-90, 0, 0, 1);
        break;
    case WEST:
        GL11.glRotated(90, 0, 0, 1);
        break;
    }
}

From source file:com.builtbroken.icbm.content.crafting.station.warhead.TileWarheadStationClient.java

@Override
@SideOnly(Side.CLIENT)/*  ww w  .  ja v a  2s.  c  o  m*/
public void renderDynamic(Pos pos, float frame, int pass) {
    GL11.glPushMatrix();
    GL11.glTranslatef(pos.xf() + 1, pos.yf(), pos.zf() + 1);
    GL11.glRotated(90, 0, 1, 0);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(SharedAssets.TOOL_TABLE_TEXTURE);
    SharedAssets.TOOL_TABLE.renderAll(); //TODO render warhead on table, remove some tools
    GL11.glPopMatrix();
    //TODO render warhead

    //TODO render explosives
}

From source file:com.builtbroken.icbm.content.rail.RenderMissileCart.java

@Override
public void doRender(final Entity entity, final double xx, final double yy, final double zz,
        final float p_76986_8_, final float delta) {
    final EntityMissileCart cart = (EntityMissileCart) entity;
    float f5 = cart.prevRotationPitch + (cart.rotationPitch - cart.prevRotationPitch) * delta;

    double x2 = MathHelper.lerp(cart.lastRenderX, xx, delta);
    double y2 = MathHelper.lerp(cart.lastRenderY, yy, delta);
    double z2 = MathHelper.lerp(cart.lastRenderZ, zz, delta);

    GL11.glPushMatrix();/*  www  . j a  va2 s  .co  m*/
    GL11.glTranslated(x2, y2, z2);
    GL11.glRotatef(180.0F - delta, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-f5, 0.0F, 0.0F, 1.0F);

    cart.lastRenderX = x2;
    cart.lastRenderY = y2;
    cart.lastRenderZ = z2;

    if (cart.getType() == MissileCartTypes.SMALL) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0f, 0.05f, 0f);
        GL11.glRotated(90, 0, 1, 0);

        GL11.glRotated(cart.rotationYaw, 0, 1, 0);

        //Renders the cart
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_WORKSTATION_TEXTURE2);
        Assets.CART1x3.renderAll();

        if (cart.getCargoMissile() != null) {
            //Render missile
            GL11.glRotated(-90, 0, 1, 0);
            renderMissile(cart.getCargoMissile(), cart.railSide, cart.facingDirection);
        }

        GL11.glPopMatrix();
    } else if (cart.getType() == MissileCartTypes.MICRO) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0f, .32f, 0f);
        GL11.glRotated(90, 0, 1, 0);

        //Renders the cart
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.GREY_FAKE_TEXTURE);
        Assets.CART1x1.renderAll();

        if (cart.getCargoMissile() != null) {
            GL11.glTranslated(0, -0.44, 0);
            if (cart.getCargoMissile() instanceof ICustomMissileRender) {
                GL11.glTranslatef(0f, ((ICustomMissileRender) cart.getCargoMissile()).getRenderHeightOffset(),
                        0f);
            }
            renderMissile(cart.getCargoMissile(), ForgeDirection.EAST, ForgeDirection.UP);
        }

        GL11.glPopMatrix();
    } else if (cart.getType() == MissileCartTypes.ThreeByThree) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0f, -0.05f, 0f);
        GL11.glRotated(90, 0, 1, 0);

        //Renders the cart
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.GREY_FAKE_TEXTURE);
        Assets.CART3x3.renderAll();

        if (cart.getCargoMissile() != null) {
            GL11.glTranslated(0, -0.3, 0);
            if (cart.getCargoMissile() instanceof ICustomMissileRender) {
                GL11.glTranslatef(0f, ((ICustomMissileRender) cart.getCargoMissile()).getRenderHeightOffset(),
                        0f);
            }
            renderMissile(cart.getCargoMissile(), ForgeDirection.EAST, ForgeDirection.UP);
        }

        GL11.glPopMatrix();
    } else {
        float halfWidth = cart.width / 2.0F;
        float halfLength = cart.length / 2.0F;
        float yaw = (float) Math.abs(MathUtility.clampAngleTo180(cart.rotationYaw));
        if (yaw >= 45 && yaw <= 135) {
            halfWidth = cart.length / 2.0F;
            halfLength = cart.width / 2.0F;
        }
        AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(-(double) halfWidth, 0, -(double) halfLength,

                +(double) halfWidth, 0.3, +(double) halfLength);

        GL11.glPushMatrix();
        GL11.glTranslated(xx, yy, zz);
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.GREY_FAKE_TEXTURE);
        RenderUtility.renderCube(bounds, Blocks.iron_block, Blocks.iron_block.getIcon(0, 0));

        if (cart.getCargoMissile() != null) {
            GL11.glTranslated(0, -0.1, 0);
            if (cart.getCargoMissile() instanceof ICustomMissileRender) {
                GL11.glTranslatef(0f, ((ICustomMissileRender) cart.getCargoMissile()).getRenderHeightOffset(),
                        0f);
            }
            renderMissile(cart.getCargoMissile(), ForgeDirection.EAST, ForgeDirection.UP);
        }
        GL11.glPopMatrix();
    }
    GL11.glPopMatrix();

    if (Engine.runningAsDev) {
        drawBounds(cart, xx, yy, zz);
    }
}

From source file:com.farincorporated.frameutils.client.rendering.FramePistonRenderer.java

@Override
public void renderTileEntityAt(TileEntity ti, double x, double y, double z, float timeSinceLastTick) {
    TileFramePiston tile = (TileFramePiston) ti;
    ResourceLocation framemap = super.getFrame(tile.getMaterialType());
    GL11.glDisable(GL11.GL_CULL_FACE);/*from w  w  w  .  j a v  a  2 s  . c om*/

    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
    GL11.glScaled(scale, scale, scale);

    double[] dir = this.directionRotate(tile.getFace());
    GL11.glRotated(dir[0], dir[1], dir[2], dir[3]);

    this.renderPistonBase(framemap);

    if (tile.isStill()) {
        GL11.glPushMatrix();
        this.bindTexture(this.pistonmap);
        modelpiston.renderPart("pistsontop");
        GL11.glPopMatrix();
        GL11.glPopMatrix();
    } else {
        GL11.glPopMatrix();
        GL11.glPushMatrix();

        this.TranslateModel(x, y, z, tile.getFace(), tile.getProgress());

        GL11.glScaled(scale, scale, scale);
        GL11.glRotated(dir[0], dir[1], dir[2], dir[3]);

        GL11.glPushMatrix();
        this.bindTexture(framemap);
        this.modelpistonext.renderPart("outterframe");
        GL11.glPopMatrix();

        GL11.glPushMatrix();
        this.bindTexture(framemap);
        this.modelpistonext.renderPart("innerframe");
        GL11.glPopMatrix();

        GL11.glPushMatrix();
        this.bindTexture(pistonmap);
        this.modelpistonext.renderPart("shaft");
        GL11.glPopMatrix();

        GL11.glPushMatrix();
        this.bindTexture(pistonmap);
        this.modelpistonext.renderPart("face");
        GL11.glPopMatrix();

        GL11.glPopMatrix();
    }

}