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:game.states.State_PREFAB_EDITOR.java

License:Open Source License

@Override
protected void Render() {

    OrthoMode();/* w ww .  j a v  a2  s  .  c  o m*/
    ModelMode();

    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    DrawBackground();

    ButtonGUILayer.Render();
    if (PrefabMap != null)
        PrefabMap.Render();
    PrefabPalette.Render();
    Color.white.bind();
    MenuGUILayer.Render();

    ProjectionMode();
    ModelMode();
    GL11.glDisable(GL11.GL_TEXTURE_2D);

    GL11.glTranslatef(CameraX, CameraY, -20f + CameraZ); // Move Right 1.5

    GL11.glTranslatef(9, -45, 0);
    GL11.glRotatef(MapRotatef, 0f, 1.0f, 0f);
    RenderPrefab();

}

From source file:game.states.State_SINGLEPLAYER.java

License:Open Source License

@Override
protected void Render() {

    OrthoMode();//from  w  w  w.j a  v  a  2s  .c  o  m
    ModelMode();

    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    DrawBackground();
    MainGUILayer.Render();
    MenuGUILayer.Render();
    StatRenderer.DrawBars();

    ProjectionMode();
    ModelMode();
    GL11.glDisable(GL11.GL_TEXTURE_2D);

    GL11.glTranslatef(PlayerX, PlayerY, -20f + PlayerZ); // Move Right 1.5

    GL11.glTranslatef(9, -45, 0);
    GL11.glRotatef(MapRotatef, 0f, 1.0f, 0f);
    t.Render();

}

From source file:gravestone.models.block.memorials.ModelStocks.java

License:LGPL

public void customRender(EnumMemorials memorialType, EnumHangedMobs mob, int villagerProfession) {
    renderAll();//  w ww . ja  v a  2  s. com
    if (mob != EnumHangedMobs.NONE) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0, 0.35F, 0.125F);
        GL11.glRotatef(45, 1, 0, 0);
        switch (mob) {
        case STEVE:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.STEVE);
            bipedModel.renderAll();
            break;
        case VILLAGER:
            switch (villagerProfession) {
            case 0:
                Minecraft.getMinecraft().renderEngine.bindTexture(Resources.VILLAGER_FARMER);
                break;
            case 1:
                Minecraft.getMinecraft().renderEngine.bindTexture(Resources.VILLAGER_LIBRARIAN);
                break;
            case 2:
                Minecraft.getMinecraft().renderEngine.bindTexture(Resources.VILLAGER_PRIEST);
                break;
            case 3:
                Minecraft.getMinecraft().renderEngine.bindTexture(Resources.VILLAGER_SMITH);
                break;
            case 4:
                Minecraft.getMinecraft().renderEngine.bindTexture(Resources.VILLAGER_BUTCHER);
                break;
            default:
                Minecraft.getMinecraft().renderEngine
                        .bindTexture(VillagerRegistry.getVillagerSkin(villagerProfession, Resources.VILLAGER));
                break;
            }
            villagerModel.renderAll();
            break;
        case ZOMBIE:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.ZOMBIE);
            zombieModel.renderAll();
            break;
        case ZOMBIE_VILLAGER:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.ZOMBIE_VILLAGER);
            zombieVillagerModel.renderAll();
            break;
        case SKELETON:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.SKELETON);
            skeletonModel.renderAll();
            break;
        case WITHER_SKELETON:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.WITHER_SKELETON);
            witherSkeletonModel.renderAll();
            break;
        case WITCH:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.WITCH);
            witchModel.renderAll();
            break;
        case ZOMBIE_PIGMAN:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.ZOMBIE_PIGMAN);
            zombieModel.renderAll();
        }
        GL11.glPopMatrix();
    }

}

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

License:LGPL

protected void renderEnchantment() {
    float tickModifier = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 48.0F;
    TileEntityGSGraveStoneRenderer.instance.bindTextureByName(Resources.SWORD_AURA);

    GL11.glEnable(GL11.GL_BLEND);//from   w w  w. j a  va  2s .c  om
    GL11.glDepthMask(true);
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
    GL11.glMatrixMode(GL11.GL_TEXTURE);

    for (int var21 = 0; var21 < 3; var21++) {
        GL11.glDisable(GL11.GL_LIGHTING);
        float var22 = 0.76F;
        GL11.glColor4f(0.5F * var22, 0.25F * var22, 0.8F * var22, 1.0F);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glLoadIdentity();
        float var23 = tickModifier * (0.001F + (float) var21 * 0.0015F) * 15;
        float var24 = 0.33333334F;
        GL11.glScalef(var24, var24, var24);
        GL11.glRotatef(30 - (float) var21 * 60, 0, 0, 1);
        GL11.glTranslatef(0, var23, 0);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        renderAll();
    }

    GL11.glMatrixMode(GL11.GL_TEXTURE);
    GL11.glDepthMask(true);
    GL11.glLoadIdentity();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
}

From source file:gravestone.renderer.entity.RenderAltar.java

License:LGPL

public void renderTileEntityAt(TileEntityGSAltar te, double x, double y, double z, float f) {
    ItemStack corpse = te.getCorpse();/*from   ww  w.ja  v  a 2  s  .co  m*/
    if (corpse != null) {
        GL11.glPushMatrix();

        float time = Minecraft.getMinecraft().theWorld.getTotalWorldTime() + f;
        GL11.glTranslatef((float) x + 0.5F, (float) y + 1.2F, (float) z + 0.5F);
        GL11.glRotatef(time % 360, 0, 1, 0);

        EntityItem entityItem = new EntityItem(te.getWorld(), 0, 0, 0, corpse);
        if (corpse.hasTagCompound()) {
            entityItem.getEntityItem().setTagCompound((NBTTagCompound) corpse.getTagCompound().copy());
        }
        entityItem.hoverStart = 0;

        Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entityItem, 0, 0, 0, 0, 0);
        GL11.glPopMatrix();
    }
}

From source file:gravestone.renderer.item.ItemGSCorpseRenderer.java

License:LGPL

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();/*from  ww w.  j av  a 2 s.c o  m*/
    GL11.glRotatef(180, 1, 0, 0);

    byte corpseType = (byte) item.getItemDamage();
    float xz = 0.0625F;
    switch (EnumCorpse.getById(corpseType)) {
    case VILLAGER:
        GL11.glTranslatef(0, -0.5F, 0);
        int profession = VillagerCorpseHelper.getVillagerType(item.getTagCompound());
        switch (profession) {
        case 0:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.VILLAGER_FARMER);
            break;
        case 1:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.VILLAGER_LIBRARIAN);
            break;
        case 2:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.VILLAGER_PRIEST);
            break;
        case 3:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.VILLAGER_SMITH);
            break;
        case 4:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.VILLAGER_BUTCHER);
            break;
        default:
            Minecraft.getMinecraft().renderEngine
                    .bindTexture(VillagerRegistry.getVillagerSkin(profession, Resources.VILLAGER));
            break;
        }
        villagerModel.render(null, xz, xz, xz, xz, xz, xz);
        break;
    case DOG:
        GL11.glTranslatef(0, -1, 0);
        Minecraft.getMinecraft().renderEngine.bindTexture(Resources.WOLF);
        if (dog == null) {
            dog = new EntityWolf(Minecraft.getMinecraft().theWorld);
        }
        dogModel.setLivingAnimations(dog, 0, 0, 0);
        dogModel.render(dog, xz, xz, xz, xz, xz, xz);
        break;
    case CAT:
        GL11.glTranslatef(0, -1, 0);
        int catType = CatCorpseHelper.getCatType(item.getTagCompound());
        switch (catType) {
        case 0:
        default:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.OCELOT);
            break;
        case 1:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.BLACK_CAT);
            break;
        case 2:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.RED_CAT);
            break;
        case 3:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.SIAMESE_CAT);
            break;
        }
        catModel.render(null, xz, xz, xz, xz, xz, xz);
        break;
    case HORSE:
        GL11.glTranslatef(0, -0.6F, 0);
        if (horse == null) {
            horse = new EntityHorse(Minecraft.getMinecraft().theWorld);
        }
        horse.setHorseType(HorseCorpseHelper.getHorseType(item.getTagCompound()));
        horse.setHorseVariant(HorseCorpseHelper.getHorseVariant(item.getTagCompound()));

        switch (HorseCorpseHelper.getHorseType(item.getTagCompound())) {
        case 0:
            String horseTexturePath = horse.getHorseTexture();
            ResourceLocation horseResourceLocation = (ResourceLocation) horsesTexturesMap.get(horseTexturePath);
            if (horseResourceLocation == null) {
                horseResourceLocation = new ResourceLocation(horseTexturePath);
                Minecraft.getMinecraft().getTextureManager().loadTexture(horseResourceLocation,
                        new LayeredTexture(horse.getVariantTexturePaths()));
                horsesTexturesMap.put(horseTexturePath, horseResourceLocation);
            }
            Minecraft.getMinecraft().renderEngine.bindTexture(horseResourceLocation);
            break;
        case 1:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.DONKEY);
            break;
        case 2:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.MULE);
            break;
        case 3:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.ZOMBIE_HORSE);
            break;
        case 4:
            Minecraft.getMinecraft().renderEngine.bindTexture(Resources.SKELETON_HORSE);
            break;
        }

        horseModel.setLivingAnimations(horse, 0, 0, 0);
        horseModel.render(horse, xz, xz, xz, xz, xz, xz);
        break;
    }
    GL11.glPopMatrix();
}

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

License:LGPL

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

    GL11.glPushMatrix();//from   ww w  . java  2  s.c om
    if (tileEntity.getWorld() == null) {
        GL11.glTranslatef(x + 0.5F, y + 3.7F, z + 0.5F);
        GL11.glScalef(2.5F, -2.5F, -2.5F);
    } else {
        GL11.glTranslatef(x + 0.5F, y + 1.5F, z + 0.5F);
        GL11.glScalef(1, -1, -1);
    }
    GL11.glRotatef(0, 0, 1, 0);

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

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

License:LGPL

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f, int par9) {
    TileEntityGSGraveStone tileEntity = (TileEntityGSGraveStone) te;
    EnumGraves graveType = tileEntity.getGraveType();
    int meta = 0;
    if (tileEntity.getWorld() != null) {
        meta = tileEntity.getBlockMetadata();
    }/* www  .j  a v  a2  s  .c o m*/
    EnumFacing facing = EnumFacing.values()[meta];

    //texture
    GL11.glPushMatrix();

    if (tileEntity.getWorld() == null && tileEntity.isSwordGrave()) {
        GL11.glTranslatef((float) x + 0.5F, (float) y + 2, (float) z + 0.5F);
        GL11.glScalef(1.5F, -1.5F, -1.5F);
    } else {
        GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
        GL11.glScalef(1, -1, -1);
    }

    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 (tileEntity.isSwordGrave()) {
        renderSword(tileEntity);
    } else {
        ModelGraveStone model = getModel(graveType.getGraveType());

        bindTextureByName(getTexture(graveType, graveType.getTexture(), tileEntity.isMossy()));
        if (tileEntity.isEnchanted()) {
            model.renderEnchanted();
        } else {
            model.renderAll();
        }

        if (tileEntity.hasFlower()) {
            renderFlower(tileEntity);
        }
    }

    GL11.glPopMatrix();
}

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

License:LGPL

private void renderSword(TileEntityGSGraveStone te) {
    ItemStack sword = te.getSword();/*from   w  w  w.  j a v a 2s.  c om*/
    if (te.isEnchanted()) {
        if (!sword.isItemEnchanted()) {
            if (!sword.hasTagCompound()) {
                sword.setTagCompound(new NBTTagCompound());
            }
            sword.getTagCompound().setTag("ench", new NBTTagList());
        }
    }
    EntityItem entityitem = new EntityItem(te.getWorld(), 0, 0, 0, sword);
    entityitem.hoverStart = 0;
    GL11.glTranslatef(-0.37F, 0.83F, 0);
    GL11.glScalef(1.5F, -1.5F, -1.5F);
    GL11.glRotatef(225, 0, 0, 1);

    Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entityitem, 0, 0, 0, 0, 0);
}

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

License:LGPL

private void renderFlower(TileEntityGSGraveStone te) {
    EntityItem entityitem = new EntityItem(te.getWorld(), 0, 0, 0, te.getFlower());
    entityitem.hoverStart = 0;// ww w  . j  a  va2 s. c om
    GL11.glTranslatef(0, 1.6F, -0.1F);
    GL11.glScalef(1, -1, -1);
    GL11.glRotatef(45, 0, 1, 0);

    Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entityitem, 0, 0, 0, 0, 0);

    GL11.glRotatef(-90, 0, 1, 0);
    Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entityitem, 0, 0, 0, 0, 0);
}