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:gravestone.renderer.tileentity.TileEntityGSHauntedChestRenderer.java

License:LGPL

/**
 * Renders the TileEntity for the chest at a position.
 *///w w w.  ja v a 2 s .  com
public void renderTileEntityChestAt(TileEntityGSHauntedChest te, double par2, double par4, double par6,
        float par8) {
    int metadata = 0;

    if (te.hasWorldObj()) {
        metadata = te.getBlockMetadata();
    }

    ModelChest modelchest = this.chestModel;

    if (this.isChristmas) {
        this.bindTexture(Resources.CHRISTMAS_CHEST);
    } else {
        this.bindTexture(Resources.DEFAULT_CHEST);
    }

    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1, 1, 1, 1);
    GL11.glTranslatef((float) par2, (float) par4 + 1, (float) par6 + 1);
    GL11.glScalef(1, -1, -1);
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    float direction = 0;

    switch (metadata) {
    case 2:
        direction = 180;
        break;
    case 3:
        direction = 0;
        break;
    case 4:
        direction = 90;
        break;
    case 5:
        direction = -90;
        break;
    }

    GL11.glRotatef(direction, 0, 1, 0);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    float f1 = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * par8;

    f1 = 1 - f1;
    f1 = 1 - f1 * f1 * f1;
    modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2F);
    modelchest.renderAll();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
    GL11.glColor4f(1, 1, 1, 1);
}

From source file:gravestone.renderer.tileentity.TileEntityGSMemorialRenderer.java

License:LGPL

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f, int par9) {
    TileEntityGSMemorial tileEntity = (TileEntityGSMemorial) te;
    EnumMemorials memorialType = tileEntity.getMemorialType();
    int meta = 0;

    if (tileEntity.getWorld() != null) {
        meta = tileEntity.getBlockMetadata();
    }/*w ww.  j a  v a  2 s.  co m*/
    EnumFacing facing = EnumFacing.values()[meta];

    GL11.glPushMatrix();

    if (tileEntity.getWorld() != null) {
        GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
        GL11.glScalef(1, -1, -1);
    } else {
        switch (memorialType.getMemorialType()) {
        case CROSS:
        case OBELISK:
            GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
            GL11.glScalef(0.4F, -0.4F, -0.4F);
            break;
        default:
            GL11.glTranslatef((float) x + 0.5F, (float) y + 0.8F, (float) z + 0.5F);
            GL11.glScalef(0.7F, -0.7F, -0.7F);
            break;
        }
    }

    switch (facing) {
    case SOUTH:
        GL11.glRotatef(0, 0, 1, 0);
        break;
    case WEST:
        GL11.glRotatef(90, 0, 1, 0);
        break;
    case NORTH:
        GL11.glRotatef(180, 0, 1, 0);
        break;
    case EAST:
        GL11.glRotatef(270, 0, 1, 0);
        break;
    }
    //
    //        if (memorialType == 9) {
    //            celticCross.renderAll();
    //        } else
    boolean isMossy = tileEntity.isMossy();
    ModelMemorial model = getModel(memorialType.getMemorialType());
    model.setPedestalTexture(getPedestalTexture(memorialType, isMossy));
    switch (memorialType.getMemorialType()) {
    case CREEPER_STATUE:
        bindTextureByName(getTexture(memorialType, memorialType.getTexture(), isMossy));
        model.customRender(tileEntity.isEnchanted());
        break;
    case STEVE_STATUE:
        bindTextureByName(getTexture(memorialType, memorialType.getTexture(), isMossy));
        model.customRender(getArmorTexture(memorialType, isMossy), tileEntity.isEnchanted());
        break;
    case GIBBET:
    case STOCKS:
    case BURNING_STAKE:
        bindTextureByName(memorialType.getTexture());
        model.customRender(memorialType, tileEntity.getHangedMob(), tileEntity.getHangedVillagerProfession());
        break;
    default:
        bindTextureByName(getTexture(memorialType, memorialType.getTexture(), isMossy));
        if (tileEntity.isEnchanted()) {
            model.renderEnchanted();
        } else {
            model.renderAll();
        }
    }

    GL11.glPopMatrix();
}

From source file:gravestone.renderer.tileentity.TileEntityGSPileOfBonesRenderer.java

License:LGPL

public void renderTileEntityCandleAt(TileEntityGSPileOfBones tileEntity, float x, float y, float z,
        float par8) {
    this.bindTexture(Resources.PILE_OF_BONES);

    int meta;/*w  w  w . java2 s.  c om*/

    GL11.glPushMatrix();
    if (tileEntity.getWorld() == null) {
        GL11.glTranslatef(x + 0.5F, y + 2.7F, z + 0.5F);
        GL11.glScalef(1.8F, -1.8F, -1.8F);
        GL11.glRotatef(-90, 0, 1, 0);
        meta = tileEntity.getBlockMetadata();
    } else {
        GL11.glTranslatef(x + 0.5F, y + 1.5F, z + 0.5F);
        GL11.glScalef(1, -1, -1);
        meta = tileEntity.getBlockMetadata();
        int direction = tileEntity.getDirection();
        switch (direction) {
        case 1:
            direction = -90;
            break;
        case 0:
            direction = 180;
            break;
        case 2:
            direction = 0;
            break;
        case 3:
        default:
            direction = 90;
            break;
        }
        GL11.glRotatef(direction, 0, 1, 0);
    }

    pileOfBonesModel.renderAll(meta != 0);
    GL11.glPopMatrix();
}

From source file:gravestone.renderer.tileentity.TileEntityGSSkullCandleRenderer.java

License:LGPL

public void renderTileEntitySkullAt(TileEntityGSSkullCandle tileEntity, float x, float y, float z, float par8) {
    float rotation = 0;
    byte meta;//from www .java2s .c  o  m
    if (tileEntity.getWorld() != null) {
        rotation = (tileEntity.getRotation() * 360) / 8F;
        meta = (byte) tileEntity.getBlockMetadata();
    } else {
        meta = (byte) tileEntity.getBlockMetadata();//(byte) tileEntity.blockMetadata;
    }

    bindSkullCandleTexture(EnumSkullCandle.getById(meta));

    GL11.glPushMatrix();
    if (tileEntity.getWorld() == null) {
        GL11.glTranslatef(x + 0.5F, y + 2.2F, z + 0.5F);
        GL11.glScalef(1.5F, -1.5F, -1.5F);
    } else {
        GL11.glTranslatef(x + 0.5F, y + 1.5F, z + 0.5F);
        GL11.glScalef(1, -1, -1);
    }
    GL11.glRotatef(rotation, 0, 1, 0);

    skullCandleModel.renderAll();
    GL11.glPopMatrix();
}

From source file:growthcraft.cellar.client.render.item.ItemRenderCultureJar.java

License:Open Source License

@Override
protected void render(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();/* w w w  .j av a  2  s  .co m*/
    {
        bindTexture(GrcCellarResources.INSTANCE.textureCultureJar);
        GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
        GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
        GL11.glTranslatef(0.0f, -1.5f, 0.0f);
        GrcCellarResources.INSTANCE.modelCultureJar.render(null, 0f, 0f, 0f, 0f, 0f, ModelCultureJar.SCALE);
    }
    GL11.glPopMatrix();
}

From source file:growthcraft.milk.client.render.item.ItemRendererCheeseBlock.java

License:Open Source License

@Override
protected void render(ItemRenderType type, ItemStack stack, Object... data) {
    final Item item = stack.getItem();
    if (item instanceof ItemBlockCheeseBlock) {
        final ItemBlockCheeseBlock cheeseBlock = (ItemBlockCheeseBlock) item;
        final EnumCheeseType cheese = cheeseBlock.getCheeseType(stack);
        final EnumCheeseStage cheeseStage = cheeseBlock.getCheeseStage(stack);
        final ResourceLocation texture = GrcMilkResources.INSTANCE.texturesCheeseBlock.get(cheese)
                .get(cheeseStage);//from w w  w.j a va  2 s .co  m
        GL11.glPushMatrix();
        {
            bindTexture(texture);
            GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
            GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
            GL11.glTranslatef(0.0f, -1.5f, 0.0f);
            GrcMilkResources.INSTANCE.modelCheeseBlock.render(null, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
                    ModelCheeseBlock.SCALE);
        }
        GL11.glPopMatrix();
    }
}

From source file:growthcraft.milk.client.render.item.ItemRendererHangingCurds.java

License:Open Source License

@Override
protected void render(ItemRenderType type, ItemStack stack, Object... data) {
    final Item item = stack.getItem();
    if (item instanceof ItemBlockHangingCurds) {
        final ItemBlockHangingCurds hangingCurds = (ItemBlockHangingCurds) item;
        final EnumCheeseType cheese = hangingCurds.getCheeseType(stack);
        GL11.glPushMatrix();//from w  w  w.  ja v  a  2s .com
        {
            bindTexture(GrcMilkResources.INSTANCE.textureHangingCurds);
            GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
            GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
            GL11.glTranslatef(0.0f, -1.5f, 0.0f);
            GrcMilkResources.INSTANCE.modelHangingCurds.setCurdColor(cheese.getColor()).render(null, 0.0f, 0.0f,
                    0.0f, 0.0f, 0.0f, ModelHangingCurds.SCALE);
        }
        GL11.glPopMatrix();
    }
}

From source file:growthcraft.milk.client.render.RenderButterChurn.java

License:Open Source License

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    if (modelID == RENDER_ID) {
        GL11.glPushMatrix();/*from  ww w. j  a  v a 2s  .c o m*/
        {
            Minecraft.getMinecraft().renderEngine.bindTexture(GrcMilkResources.INSTANCE.textureButterChurn);
            GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
            GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
            GL11.glTranslatef(0.0f, -1.0f, 0.0f);
            GrcMilkResources.INSTANCE.modelButterChurn.render(null, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
                    ModelButterChurn.SCALE);
        }
        GL11.glPopMatrix();
    }
}

From source file:growthcraft.milk.client.render.RenderCheesePress.java

License:Open Source License

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    if (modelID == RENDER_ID) {
        GL11.glPushMatrix();//from   w w  w .jav  a 2  s . com
        {
            Minecraft.getMinecraft().renderEngine.bindTexture(GrcMilkResources.INSTANCE.textureCheesePress);
            GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
            GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
            GL11.glTranslatef(0.0f, -1.0f, 0.0f);
            GrcMilkResources.INSTANCE.modelCheesePress.render(null, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
                    ModelCheesePress.SCALE);
        }
        GL11.glPopMatrix();
    }
}

From source file:growthcraft.milk.client.render.RenderCheeseVat.java

License:Open Source License

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    if (modelID == RENDER_ID) {
        GL11.glPushMatrix();/*from  w  w  w. j av a  2s.c  o  m*/
        {
            Minecraft.getMinecraft().renderEngine.bindTexture(GrcMilkResources.INSTANCE.textureCheeseVat);
            GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
            GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
            GL11.glTranslatef(0.0f, -1.0f, 0.0f);
            GrcMilkResources.INSTANCE.modelCheeseVat.render(null, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
                    ModelCheeseVat.SCALE);
        }
        GL11.glPopMatrix();
    }
}