Example usage for org.lwjgl.opengl GL11 glRotatef

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

Introduction

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

Prototype

public static native void glRotatef(@NativeType("GLfloat") float angle, @NativeType("GLfloat") float x,
        @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);

Source Link

Document

Manipulates the current matrix with a rotation matrix.

Usage

From source file:com.shinoow.abyssalcraft.client.render.block.TileEntityDGheadRenderer.java

License:Apache License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {

    GL11.glPushMatrix();// w w  w.j ava2s . c  o  m
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);

    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    TileEntityDGhead tile = (TileEntityDGhead) te;
    int direction = tile.getDirection();
    GL11.glRotatef(direction * 90, 0.0F, 1.0F, 0.0F);
    model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

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

From source file:com.shinoow.abyssalcraft.client.render.block.TileEntityDreadAltarBottomRenderer.java

License:Apache License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {

    GL11.glPushMatrix();/*  ww w  . j a  va 2s.com*/
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);

    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

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

From source file:com.shinoow.abyssalcraft.client.render.block.TileEntityOheadRenderer.java

License:Apache License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {

    GL11.glPushMatrix();/*from  w ww. j ava  2s .  c  o  m*/
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);

    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    TileEntityOhead tile = (TileEntityOhead) te;
    int direction = tile.getDirection();
    GL11.glRotatef(direction * 90, 0.0F, 1.0F, 0.0F);
    model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

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

From source file:com.shinoow.abyssalcraft.client.render.block.TileEntityPheadRenderer.java

License:Apache License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {

    GL11.glPushMatrix();//  w w  w. ja v a2s. co  m
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);

    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    TileEntityPhead tile = (TileEntityPhead) te;
    int direction = tile.getDirection();
    GL11.glRotatef(direction * 90, 0.0F, 1.0F, 0.0F);
    model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

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

From source file:com.shinoow.abyssalcraft.client.render.block.TileEntityWheadRenderer.java

License:Apache License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {

    GL11.glPushMatrix();// www .j  a va 2s  .  co m
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);

    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    TileEntityWhead tile = (TileEntityWhead) te;
    int direction = tile.getDirection();
    GL11.glRotatef(direction * 90, 0.0F, 1.0F, 0.0F);
    model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

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

From source file:com.shinoow.abyssalcraft.client.render.entity.RenderDragonBoss.java

License:Apache License

/**
 * Used to rotate the dragon as a whole in RenderDragon. It's called in the rotateCorpse method.
 *//*w ww  .jav a  2  s. com*/
protected void rotateDragonBody(EntityDragonBoss par1entitydragonboss, float par2, float par3, float par4) {
    float f3 = (float) par1entitydragonboss.getMovementOffsets(7, par4)[0];
    float f4 = (float) (par1entitydragonboss.getMovementOffsets(5, par4)[1]
            - par1entitydragonboss.getMovementOffsets(10, par4)[1]);
    GL11.glRotatef(-f3, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(f4 * 10.0F, 1.0F, 0.0F, 0.0F);
    GL11.glTranslatef(0.0F, 0.0F, 1.0F);

    if (par1entitydragonboss.deathTime > 0) {
        float f5 = (par1entitydragonboss.deathTime + par4 - 1.0F) / 20.0F * 1.6F;
        f5 = MathHelper.sqrt_float(f5);

        if (f5 > 1.0F)
            f5 = 1.0F;

        GL11.glRotatef(f5 * getDeathMaxRotation(par1entitydragonboss), 0.0F, 0.0F, 1.0F);
    }
}

From source file:com.shinoow.abyssalcraft.client.render.entity.RenderDragonBoss.java

License:Apache License

/**
 * Renders the dragon, along with its dying animation
 *//*from   w  w w  .  j a va2 s .c  o m*/
public void renderDragon(EntityDragonBoss par1entitydragonboss, double par2, double par4, double par6,
        float par8, float par9) {
    BossStatus.setBossStatus(par1entitydragonboss, false);
    super.doRender(par1entitydragonboss, par2, par4, par6, par8, par9);

    if (par1entitydragonboss.healingcircle != null) {
        float f2 = EntityDragonMinion.innerRotation + par9;
        float f3 = MathHelper.sin(f2 * 0.2F) / 2.0F + 0.5F;
        f3 = (f3 * f3 + f3) * 0.2F;
        float f4 = (float) (par1entitydragonboss.healingcircle.posX - par1entitydragonboss.posX
                - (par1entitydragonboss.prevPosX - par1entitydragonboss.posX) * (1.0F - par9));
        float f5 = (float) (f3 + par1entitydragonboss.healingcircle.posY - 1.0D - par1entitydragonboss.posY
                - (par1entitydragonboss.prevPosY - par1entitydragonboss.posY) * (1.0F - par9));
        float f6 = (float) (par1entitydragonboss.healingcircle.posZ - par1entitydragonboss.posZ
                - (par1entitydragonboss.prevPosZ - par1entitydragonboss.posZ) * (1.0F - par9));
        float f7 = MathHelper.sqrt_float(f4 * f4 + f6 * f6);
        float f8 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6);
        GL11.glPushMatrix();
        GL11.glTranslatef((float) par2, (float) par4 + 2.0F, (float) par6);
        GL11.glRotatef((float) -Math.atan2(f6, f4) * 180.0F / (float) Math.PI - 90.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef((float) -Math.atan2(f7, f5) * 180.0F / (float) Math.PI - 90.0F, 1.0F, 0.0F, 0.0F);
        Tessellator tessellator = Tessellator.instance;
        RenderHelper.disableStandardItemLighting();
        GL11.glDisable(GL11.GL_CULL_FACE);
        bindTexture(field_110843_g);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        float f9 = 0.0F - (par1entitydragonboss.ticksExisted + par9) * 0.01F;
        float f10 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6) / 32.0F
                - (par1entitydragonboss.ticksExisted + par9) * 0.01F;
        tessellator.startDrawing(5);
        byte b0 = 8;

        for (int i = 0; i <= b0; ++i) {
            float f11 = MathHelper.sin(i % b0 * (float) Math.PI * 2.0F / b0) * 0.75F;
            float f12 = MathHelper.cos(i % b0 * (float) Math.PI * 2.0F / b0) * 0.75F;
            float f13 = i % b0 * 1.0F / b0;
            tessellator.setColorOpaque_I(0);
            tessellator.addVertexWithUV(f11 * 0.2F, f12 * 0.2F, 0.0D, f13, f10);
            tessellator.setColorOpaque_I(16777215);
            tessellator.addVertexWithUV(f11, f12, f8, f13, f9);
        }

        tessellator.draw();
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glShadeModel(GL11.GL_FLAT);
        RenderHelper.enableStandardItemLighting();
        GL11.glPopMatrix();
    }
}

From source file:com.shinoow.abyssalcraft.client.render.entity.RenderDragonBoss.java

License:Apache License

/**
 * Renders the animation for when an enderdragon dies
 *//*from   www  .  j a va  2 s .c  o  m*/
protected void renderDragonDying(EntityDragonBoss par1entitydragonboss, float par2) {
    super.renderEquippedItems(par1entitydragonboss, par2);
    Tessellator tessellator = Tessellator.instance;

    if (par1entitydragonboss.deathTicks > 0) {
        RenderHelper.disableStandardItemLighting();
        float f1 = (par1entitydragonboss.deathTicks + par2) / 200.0F;
        float f2 = 0.0F;

        if (f1 > 0.8F)
            f2 = (f1 - 0.8F) / 0.2F;

        Random random = new Random(432L);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDepthMask(false);
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, -1.0F, -2.0F);

        for (int i = 0; i < (f1 + f1 * f1) / 2.0F * 60.0F; ++i) {
            GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F + f1 * 90.0F, 0.0F, 0.0F, 1.0F);
            tessellator.startDrawing(6);
            float f3 = random.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
            float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
            tessellator.setColorRGBA_I(16777215, (int) (255.0F * (1.0F - f2)));
            tessellator.addVertex(0.0D, 0.0D, 0.0D);
            tessellator.setColorRGBA_I(16711935, 0);
            tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4);
            tessellator.addVertex(0.866D * f4, f3, -0.5F * f4);
            tessellator.addVertex(0.0D, f3, 1.0F * f4);
            tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4);
            tessellator.draw();
        }

        GL11.glPopMatrix();
        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glShadeModel(GL11.GL_FLAT);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        RenderHelper.enableStandardItemLighting();
    }
}

From source file:com.shinoow.abyssalcraft.client.render.entity.RenderDragonMinion.java

License:Apache License

/**
 * Used to rotate the dragon as a whole in RenderDragon. It's called in the rotateCorpse method.
 */// w  w  w  .ja  v a2 s.c  o  m
protected void rotateDragonBody(EntityDragonMinion par1EntityDragonMinion, float par2, float par3, float par4) {
    float f3 = (float) par1EntityDragonMinion.getMovementOffsets(7, par4)[0];
    float f4 = (float) (par1EntityDragonMinion.getMovementOffsets(5, par4)[1]
            - par1EntityDragonMinion.getMovementOffsets(10, par4)[1]);
    GL11.glRotatef(-f3, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(f4 * 10.0F, 1.0F, 0.0F, 0.0F);
    GL11.glTranslatef(0.0F, 0.0F, 1.0F);

    if (par1EntityDragonMinion.deathTime > 0) {
        float f5 = (par1EntityDragonMinion.deathTime + par4 - 1.0F) / 20.0F * 1.6F;
        f5 = MathHelper.sqrt_float(f5);

        if (f5 > 1.0F)
            f5 = 1.0F;

        GL11.glRotatef(f5 * getDeathMaxRotation(par1EntityDragonMinion), 0.0F, 0.0F, 1.0F);
    }
}

From source file:com.shinoow.abyssalcraft.client.render.item.RenderCudgel.java

License:Apache License

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

    if (type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.EQUIPPED) {
        GL11.glPushMatrix();/*from  w  w w  . j ava 2 s .  c  o m*/

        FMLClientHandler.instance().getClient().renderEngine.bindTexture(resource);

        GL11.glRotatef(90F, 1.0F, 1.0F, -0.5F);

        if (type == ItemRenderType.EQUIPPED)
            GL11.glTranslatef(0.75F, -0.1F, 0.1F);
        else
            GL11.glTranslatef(0.61F, 0.0F, 0.0F);

        float scale = 1.1F;
        GL11.glScalef(scale, scale, scale);

        model.render((Entity) data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);

        GL11.glPopMatrix();
    }
    if (type == ItemRenderType.ENTITY) {

        GL11.glPushMatrix();
        float scale = 1.5F;
        GL11.glScalef(scale, scale, scale);
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(resource);
        GL11.glRotatef(0F, 1.0f, 0.0f, 0.0f);
        GL11.glRotatef(90F, 0.0f, 1.0f, 0.0f);
        GL11.glRotatef(90F, 0.0f, 0.0f, 1.0f);
        GL11.glTranslatef(0.5F, -0.5F, 0.1F);
        model.render((Entity) data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
        GL11.glPopMatrix();

    }
    if (type == ItemRenderType.INVENTORY) {
        GL11.glPushMatrix();
        float scale = 1.0F;
        GL11.glScalef(scale, scale, scale);
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(resource);

        GL11.glRotatef(80F, 1.0f, 0.0f, 0.0f);
        GL11.glRotatef(-80F, 0.0f, 1.0f, 0.0f);
        GL11.glTranslatef(0.0F, 0.0F, 0F);
        model.render(0.0625F);
        GL11.glPopMatrix();
    }
}