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:hellfirepvp.astralsorcery.common.item.base.IGrindable.java

License:Open Source License

@SideOnly(Side.CLIENT)
public static void applyDefaultGrindstoneTransforms() {
    GL11.glTranslated(0.55, 0.75, 0.6);//www.j  a va2 s .  co  m
    GL11.glRotated(125, 1, 0, 0);
    GL11.glRotated(180, 0, 0, 1);
    /*GL11.glRotated(180, 0, 1, 0);
    GL11.glRotated(35, 1, 0, 0);
    GL11.glRotated(15, 0, 0, 1);*/
}

From source file:makeo.gadomancy.client.renderers.entity.RenderGolemHelper.java

License:LGPL

public static void renderToolItem(EntityGolemBase golem, ItemStack itemstack, ModelBase mainModel,
        RenderManager renderManager) {//from   w  w w  .  j  a v  a  2  s . c o m
    GL11.glPushMatrix();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    float angle = (float) (0.195 * Math.PI / -1 * ((ModelGolem) mainModel).golemRightArm.rotateAngleX);

    float y = (float) (Math.cos(angle) * 1.15);
    float z = (float) (Math.sin(angle) * 1.15);

    GL11.glTranslatef(-0.25F, y, z * -0.5f);

    GL11.glRotated(angle / Math.PI * 180f, -1, 0, 0);

    float fs = 0.66F;
    GL11.glScalef(fs, fs, fs);

    net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient
            .getItemRenderer(itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED);
    boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(
            net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack,
            net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D));

    Item item = itemstack.getItem();
    float f1;

    if (item instanceof ItemBlock
            && (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType()))) {
        f1 = 0.5F;
        GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
        f1 *= 0.75F;
        GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(-f1, -f1, f1);
    } else if (item == Items.bow) {
        f1 = 0.625F;
        GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
        GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(f1, -f1, f1);
        GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    } else if (item.isFull3D()) {
        f1 = 0.625F;

        if (item.shouldRotateAroundWhenRendering()) {
            GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
            GL11.glTranslatef(0.0F, -0.125F, 0.0F);
        }

        GL11.glTranslatef(0.0F, 0.1875F, 0.0F);

        GL11.glScalef(f1, -f1, f1);
        GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    } else {
        f1 = 0.375F;
        GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
        GL11.glScalef(f1, f1, f1);
        GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
    }

    float f2;
    int i;
    float f5;

    if (itemstack.getItem().requiresMultipleRenderPasses()) {
        for (i = 0; i < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++i) {
            int j = itemstack.getItem().getColorFromItemStack(itemstack, i);
            f5 = (float) (j >> 16 & 255) / 255.0F;
            f2 = (float) (j >> 8 & 255) / 255.0F;
            float f3 = (float) (j & 255) / 255.0F;
            GL11.glColor4f(f5, f2, f3, 1.0F);

            renderManager.itemRenderer.renderItem(golem, itemstack, i);
        }
    } else {
        i = itemstack.getItem().getColorFromItemStack(itemstack, 0);
        float f4 = (float) (i >> 16 & 255) / 255.0F;
        f5 = (float) (i >> 8 & 255) / 255.0F;
        f2 = (float) (i & 255) / 255.0F;
        GL11.glColor4f(f4, f5, f2, 1.0F);

        renderManager.itemRenderer.renderItem(golem, itemstack, 0);
    }

    GL11.glScaled(1.0D, 1.0D, 1.0D);

    GL11.glPopMatrix();
}

From source file:makeo.gadomancy.client.renderers.tile.RenderTileInfusionClaw.java

License:LGPL

private void renderCircle(TileInfusionClaw tile, float elapsed) {
    GL11.glPushMatrix();//  ww  w. j a  v a2s. c om

    float speed = (float) Math.pow(1.1, Math.abs(tile.animationStates[9]));
    if (speed > 50) {
        speed = 50;
    }

    if (tile.animationStates[9] > 0) {
        tile.animationStates[9] += 0.5 * elapsed;

        if (tile.animationStates[9] > 20 * 5f) {
            tile.animationStates[9] = -tile.animationStates[9];

            ItemStack wandStack = tile.getStackInSlot(0);
            if (wandStack != null) {
                tile.animationStates[11] = ((ItemWandCasting) wandStack.getItem()).isStaff(wandStack) ? 0.5f
                        : 0.1f;
            }
        }
    } else if (tile.animationStates[9] < 0) {
        tile.animationStates[9] += elapsed * 0.5;

        if (tile.animationStates[9] > 0) {
            tile.animationStates[9] = 0;
        }
    }

    for (int i = 0; i < 4; i++) {
        GL11.glPushMatrix();

        tile.animationStates[10] += speed * (elapsed * 0.001 * Math.PI);

        float angle = (float) (tile.animationStates[10] + (i * 0.5 * Math.PI));
        float x = (float) Math.sin(angle);
        float y = (float) Math.cos(angle);
        float radius = 0.25f;

        GL11.glTranslated(0, (1f / 16f) * Math.sin(angle / 1.4) + (1f / 16f), 0);
        GL11.glTranslated(radius * x, -0.27, radius * y);
        GL11.glRotated(45, Math.cos(angle), 0, -Math.sin(angle));
        GL11.glScalef(0.75f, 0.75f, 0.75f);

        renderPart(i);

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

From source file:matteroverdrive.util.RenderUtils.java

License:Open Source License

public static void rotateFromBlock(World world, int x, int y, int z) {
    if (world != null) {
        int metadata = world.getBlockMetadata(x, y, z);

        ForgeDirection direction = ForgeDirection.values()[metadata];

        if (direction == ForgeDirection.WEST) {
            GL11.glRotated(-90, 0, 1, 0);
        } else if (direction == ForgeDirection.EAST) {
            GL11.glRotated(90, 0, 1, 0);
        } else if (direction == ForgeDirection.NORTH) {
            GL11.glRotated(-180, 0, 1, 0);
        }//from w w  w.ja v a2s . c om
    }

    //System.out.println("Metadata " + metadata + "at [" + x +","+ y +","+ z + "]");
}

From source file:mca.client.render.RenderHuman.java

License:Open Source License

protected void renderHumanSleeping(EntityHuman entity, double partialTickTime) {
    final AISleep sleepAI = entity.getAI(AISleep.class);
    final int meta = sleepAI.getBedMeta();

    if (meta == 8) {
        entity.rotationYawHead = 180.0F;
        GL11.glTranslated(-0.5D, 0.0D, -1.0D);
        GL11.glRotated(90, -1, 0, 0);
        GL11.glTranslated(0.0D, 0.0D, -0.75D);
    }//from  w  w w .j a  v  a  2s .  com

    else if (meta == 11) {
        entity.rotationYawHead = 90.0F;
        GL11.glTranslated(0.5D, 0.0D, -1.0D);
        GL11.glRotated(90, -1, 0, 0);
        GL11.glTranslated(0.0D, 0.0D, -0.75D);
    }

    else if (meta == 10) {
        entity.rotationYawHead = 0.0F;
        GL11.glTranslated(0.5D, 0.0D, -2.0D);
        GL11.glRotated(90, -1, 0, 0);
        GL11.glTranslated(0.0D, 0.0D, -0.75D);
    }

    else if (meta == 9) {
        entity.rotationYawHead = -90.0F;
        GL11.glTranslated(-0.5D, 0.0D, -2.0D);
        GL11.glRotated(90, -1, 0, 0);
        GL11.glTranslated(0.0D, 0.0D, -0.75D);
    }
}

From source file:minesweeperMod.client.ModelFlag.java

License:LGPL

public void renderModel(float size, float rotation) {
    Base.render(size);
    GL11.glRotated(rotation, 0, 1, 0);
    Pole.render(size);
    Flag.render(size);
}

From source file:net.ae97.notlet.client.GameInstance.java

License:Open Source License

private static void renderEntity(Entity entity) {
    int SpriteScaleFactor = 1;
    double x = entity.getLocation().getX();
    double y = entity.getLocation().getY();
    Texture texture = textureMapping.get(entity.getSprite());
    texture.bind();//from   w  w  w  . j a  va2 s.co m
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2d(x * 32, y * 32);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2d((x * 32) + texture.getTextureWidth() * SpriteScaleFactor, y * 32);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2d((x * 32) + texture.getTextureWidth() * SpriteScaleFactor,
            (y * 32) + texture.getTextureHeight() * SpriteScaleFactor);
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2d(x * 32, (y * 32) + texture.getTextureHeight() * SpriteScaleFactor);
    if (entity instanceof Arrow) {
        Arrow arrow = (Arrow) entity;
        switch (arrow.getFacingDirection()) {
        case DOWN:
            GL11.glRotated(90, 0, 0, 0);
        case LEFT:
            GL11.glRotated(90, 0, 0, 0);
        case UP:
            GL11.glRotated(90, 0, 0, 0);
        }
    }
    GL11.glEnd();
}

From source file:net.awairo.mcmod.spawnchecker.presetmode.spawnervisualizer.MobSpawnerPointMerker.java

License:Minecraft Mod Public

@Override
protected void render(MarkerModel model) {
    GL11.glPushMatrix();//from   w  w w  .  j ava 2s .co  m

    {
        final double tick = inherent + tickCounts + partialTicks;
        final double tremor = Math.sin(tick * 0.06f) * 0.02;

        GL11.glTranslated(posX - manager().viewerPosX, posY - manager().viewerPosY + tremor,
                posZ - manager().viewerPosZ);

        setGLColor(argbColor);

        // ???
        GL11.glRotatef(90, 1, 0, 0);
        // ????
        GL11.glRotated(inherent + tick, 0, 0, 1);

        model.render();
    }

    GL11.glPopMatrix();
}

From source file:net.kubin.world.characters.CharacterBody.java

License:Apache License

public void transformToRightHand() {
    /* Transform the matix */
    GL11.glLoadIdentity();/*from  w w  w .  j  a v a2s.  c om*/

    GL11.glTranslatef(0.2f - _progressRightHand / 10.0f, -0.05f,
            -0.2f - _progressRightHand / 20.0f * +(_progressRightHand * _blockDistance * 1.2f));
    GL11.glRotatef(-65, 0, 1, 0);
    GL11.glRotated(_progressRightHand * 50 - 10.0d, 0, 0, 1);
    GL11.glRotated(_progressRightHand * 20, 1, 1, 0);
    GL11.glRotatef(90, 0, 0, 1);
    GL11.glRotatef(20, 0, 1, 0);
}

From source file:net.lyonlancer5.mcmp.karasu.client.renderer.tileentity.TileEntityEndRodRenderer.java

License:Apache License

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
    GL11.glPushMatrix();//from ww w.j  a v a 2s.c  om
    GL11.glTranslated(x, y, z);

    colour(0xFFFFFF);

    bindTexture(TextureMap.locationBlocksTexture);

    ForgeDirection dir = ForgeDirection.getOrientation(tile.getBlockMetadata());
    switch (dir) {
    case DOWN:
        GL11.glRotated(180, 1, 0, 0);
        GL11.glTranslated(0, -1, -1);
        break;
    case EAST:
        GL11.glRotated(270, 0, 0, 1);
        GL11.glTranslated(-1, 0, 0);
        break;
    case NORTH:
        GL11.glRotated(270, 1, 0, 0);
        GL11.glTranslated(0, -1, 0);
        break;
    case SOUTH:
        GL11.glRotated(90, 1, 0, 0);
        GL11.glTranslated(0, 0, -1);
        break;
    case WEST:
        GL11.glRotated(90, 0, 0, 1);
        GL11.glTranslated(0, -1, 0);
        break;
    default:
        break;
    }

    renderRod(renderer, tile.getBlockType(), tile.getBlockMetadata());

    GL11.glPopMatrix();
}