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.theoriginalbit.moarperipherals.client.render.RendererItemSonic.java

License:Apache License

@Override
protected void manipulateInventoryRender(ItemStack stack) {
    float scale = 0.3f;
    GL11.glScalef(scale, scale, scale);/*from   w w w  .  j a va  2  s .  co m*/
    GL11.glRotatef(180, 1, 0, 0);
    GL11.glTranslatef(0f, 1f, 0f);
}

From source file:com.theoriginalbit.moarperipherals.client.render.RendererItemSonic.java

License:Apache License

@Override
protected void manipulateThirdPersonRender(ItemStack stack) {
    float scale = 0.225f;
    GL11.glScalef(scale, scale, scale);/*  ww  w . j  a v  a2s  . co  m*/
    GL11.glRotatef(175, 1, 0, 0);
    GL11.glTranslatef(0f, -3.5f, -4.5f);
}

From source file:com.theoriginalbit.moarperipherals.client.render.RendererItemSonic.java

License:Apache License

@Override
protected void manipulateFirstPersonRender(ItemStack stack) {
    float scale = 0.25f;
    GL11.glScalef(scale, scale, scale);/*from ww w. j a  v a  2s .c o  m*/
    GL11.glRotatef(180, 1, 0, 0);
    GL11.glRotatef(-90, 0, 1, 0);
    GL11.glRotatef(10, 0, 0, 1);
    GL11.glTranslatef(-3f, -3f, 0f);
}

From source file:com.theoriginalbit.moarperipherals.client.render.RendererTileAntenna.java

License:Apache License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float t) {
    TileAntennaController tile = (TileAntennaController) tileEntity;
    if (tile.isTowerComplete()) {
        GL11.glPushMatrix();/*from  ww w .j  a v  a 2 s .c o  m*/
        GL11.glTranslatef((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f);
        GL11.glRotatef(180, 0, 0, 1);
        GL11.glTranslatef(0.0f, -1.0f, 0.0f);
        GL11.glPushMatrix();
        bindTexture(Constants.TEXTURES_MODEL.ANTENNA.getResourceLocation());
        model.render(null, 0F, 0F, 0f, 0f, 0f, 0.0625f);
        GL11.glPopMatrix();
        GL11.glPopMatrix();
    }
}

From source file:com.theslarfab.tmnmod.client.renderer.tileentity.TileEntityEndWoodChestRenderer.java

License:Open Source License

public void renderTileEntityAt(TileEntityEndWoodChest p_147502_1_, double p_147502_2_, double p_147502_4_,
        double p_147502_6_, float p_147502_8_) {
    int i;//  ww  w .  j a  v  a 2s.c o m

    if (!p_147502_1_.hasWorldObj()) {
        i = 0;
    } else {
        Block block = p_147502_1_.getBlockType();
        i = p_147502_1_.getBlockMetadata();

        if (block instanceof BlockEndWoodChest && i == 0) {
            try {
                ((BlockEndWoodChest) block).func_149954_e(p_147502_1_.getWorldObj(), p_147502_1_.xCoord,
                        p_147502_1_.yCoord, p_147502_1_.zCoord);
            } catch (ClassCastException e) {
                FMLLog.severe("Attempted to render a chest at %d,  %d, %d that was not a chest",
                        p_147502_1_.xCoord, p_147502_1_.yCoord, p_147502_1_.zCoord);
            }
            i = p_147502_1_.getBlockMetadata();
        }

        p_147502_1_.checkForAdjacentChests();
    }

    if (p_147502_1_.adjacentChestZNeg == null && p_147502_1_.adjacentChestXNeg == null) {
        ModelChest modelchest;

        if (p_147502_1_.adjacentChestXPos == null && p_147502_1_.adjacentChestZPos == null) {
            modelchest = this.singleChest;

            this.bindTexture(chestTexture);

        } else {
            modelchest = this.doubleChest;

            this.bindTexture(doubleChestTexture);

        }

        GL11.glPushMatrix();
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef((float) p_147502_2_, (float) p_147502_4_ + 1.0F, (float) p_147502_6_ + 1.0F);
        GL11.glScalef(1.0F, -1.0F, -1.0F);
        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
        short short1 = 0;

        if (i == 2) {
            short1 = 180;
        }

        if (i == 3) {
            short1 = 0;
        }

        if (i == 4) {
            short1 = 90;
        }

        if (i == 5) {
            short1 = -90;
        }

        if (i == 2 && p_147502_1_.adjacentChestXPos != null) {
            GL11.glTranslatef(1.0F, 0.0F, 0.0F);
        }

        if (i == 5 && p_147502_1_.adjacentChestZPos != null) {
            GL11.glTranslatef(0.0F, 0.0F, -1.0F);
        }

        GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        float f1 = p_147502_1_.prevLidAngle + (p_147502_1_.lidAngle - p_147502_1_.prevLidAngle) * p_147502_8_;
        float f2;

        if (p_147502_1_.adjacentChestZNeg != null) {
            f2 = p_147502_1_.adjacentChestZNeg.prevLidAngle
                    + (p_147502_1_.adjacentChestZNeg.lidAngle - p_147502_1_.adjacentChestZNeg.prevLidAngle)
                            * p_147502_8_;

            if (f2 > f1) {
                f1 = f2;
            }
        }

        if (p_147502_1_.adjacentChestXNeg != null) {
            f2 = p_147502_1_.adjacentChestXNeg.prevLidAngle
                    + (p_147502_1_.adjacentChestXNeg.lidAngle - p_147502_1_.adjacentChestXNeg.prevLidAngle)
                            * p_147502_8_;

            if (f2 > f1) {
                f1 = f2;
            }
        }

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

From source file:com.xlogisticzz.learningModding.client.RenderSpaceship.java

License:LGPL

public void renderSpaceship(EntitySpaceship spaceship, double x, double y, double z, float yaw,
        float partialTickTime) {

    GL11.glPushMatrix();//from   ww  w  . j ava2 s . co  m
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glRotatef(180.0F - yaw, 0.0F, 1.0F, 0.0F);
    GL11.glScalef(-1.0F, -1.0F, 1.0F);

    bindEntityTexture(spaceship);

    this.model.render(spaceship, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

    GL11.glPopMatrix();
}

From source file:com.yogpc.qp.client.RenderRefinery.java

License:Open Source License

private void render(final TileRefinery tile, final double x, final double y, final double z) {
    float anim = 0;
    int angle = 0;
    ModelRenderer theMagnet = this.magnet[0];
    if (tile != null) {
        anim = tile.getAnimationStage();
        angle = 0;//from www.  j a  va2  s. co  m
        switch (tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord)) {
        case 2:
            angle = 90;
            break;
        case 3:
            angle = 270;
            break;
        case 4:
            angle = 180;
            break;
        case 5:
            angle = 0;
            break;
        }

        if (tile.animationSpeed <= 1)
            theMagnet = this.magnet[0];
        else if (tile.animationSpeed <= 2.5)
            theMagnet = this.magnet[1];
        else if (tile.animationSpeed <= 4.5)
            theMagnet = this.magnet[2];
        else
            theMagnet = this.magnet[3];
    }

    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);

    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
    GL11.glScalef(0.99F, 0.99F, 0.99F);

    GL11.glRotatef(angle, 0, 1, 0);

    bindTexture(TEXTURE);

    GL11.glPushMatrix();
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    GL11.glTranslatef(-4F * pixel, 0, -4F * pixel);
    this.tank.render(pixel);
    GL11.glTranslatef(4F * pixel, 0, 4F * pixel);

    GL11.glTranslatef(-4F * pixel, 0, 4F * pixel);
    this.tank.render(pixel);
    GL11.glTranslatef(4F * pixel, 0, -4F * pixel);

    GL11.glTranslatef(4F * pixel, 0, 0);
    this.tank.render(pixel);
    GL11.glTranslatef(-4F * pixel, 0, 0);
    GL11.glPopMatrix();

    float trans1, trans2;

    if (anim <= 100) {
        trans1 = 12F * pixel * anim / 100F;
        trans2 = 0;
    } else if (anim <= 200) {
        trans1 = 12F * pixel - 12F * pixel * (anim - 100F) / 100F;
        trans2 = 12F * pixel * (anim - 100F) / 100F;
    } else {
        trans1 = 12F * pixel * (anim - 200F) / 100F;
        trans2 = 12F * pixel - 12F * pixel * (anim - 200F) / 100F;
    }

    renderMagnet(trans1, theMagnet, 0);
    renderMagnet(trans2, theMagnet, 12 * pixel);

    if (tile != null) {
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        GL11.glScalef(0.5F, 1, 0.5F);
        renderFluid(tile.src[0], 0, 0, 0, tile.buf);
        renderFluid(tile.src[1], 0, 0, 1, tile.buf);
        renderFluid(tile.res, 1, 0, 0.5F, tile.buf);
        GL11.glPopAttrib();
    }
    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:dan200.billund.client.RenderAirDrop.java

private void doRenderFallingSand(EntityAirDrop entity, double x, double y, double z, float f, float f2) {
    World world = entity.getWorld();/*from  w  ww. j  a v a 2  s  .c om*/
    Block block = Block.blocksList[entity.blockID];

    if (world.getBlockId(MathHelper.floor_double(entity.posX), MathHelper.floor_double(entity.posY),
            MathHelper.floor_double(entity.posZ)) != entity.blockID) {
        GL11.glPushMatrix();
        GL11.glTranslatef((float) x - 0.5f, (float) y - 0.5f, (float) z - 0.5f);
        this.bindEntityTexture(entity);

        GL11.glDisable(GL11.GL_LIGHTING);

        if (block != null) {
            ChestItemRenderHelper.instance.renderChest(block, 0, 0.0f);

            if (!entity.deployed) {
                GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
                GL11.glTranslatef(-0.5f, -0.5f, 0.5f);
                GL11.glScalef(1.2f, 1.2f, 1.2f);

                Minecraft mc = Minecraft.getMinecraft();
                mc.getTextureManager().bindTexture(chuteTexture);
                m_model.render(0.0625f);
            }
        }

        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopMatrix();
    }
}

From source file:dark.core.client.renders.RenderFakeBlock.java

License:Minecraft Mod Public

/** Renders a block as an Entity */
public void doRenderBlock(EntityFakeBlock entity, double i, double j, double k) {
    if (entity.isDead) {
        return;//ww w. j  a  v  a  2s  .  c o m
    }

    shadowSize = entity.shadowSize;
    World world = entity.worldObj;
    BlockRenderInfo util = new BlockRenderInfo();
    util.texture = entity.texture;
    func_110776_a(TextureMap.field_110575_b);

    for (int iBase = 0; iBase < entity.iSize; ++iBase) {
        for (int jBase = 0; jBase < entity.jSize; ++jBase) {
            for (int kBase = 0; kBase < entity.kSize; ++kBase) {

                util.min = new Vector3();

                double remainX = entity.iSize - iBase;
                double remainY = entity.jSize - jBase;
                double remainZ = entity.kSize - kBase;

                util.max = new Vector3((remainX > 1.0 ? 1.0 : remainX), (remainY > 1.0 ? 1.0 : remainY),
                        (remainZ > 1.0 ? 1.0 : remainZ));

                GL11.glPushMatrix();
                GL11.glTranslatef((float) i, (float) j, (float) k);
                GL11.glRotatef(entity.rotationX, 1, 0, 0);
                GL11.glRotatef(entity.rotationY, 0, 1, 0);
                GL11.glRotatef(entity.rotationZ, 0, 0, 1);
                GL11.glTranslatef(iBase, jBase, kBase);

                int lightX, lightY, lightZ;

                lightX = (int) (Math.floor(entity.posX) + iBase);
                lightY = (int) (Math.floor(entity.posY) + jBase);
                lightZ = (int) (Math.floor(entity.posZ) + kBase);

                GL11.glDisable(2896 /* GL_LIGHTING */);
                renderBlock(util, world, new Vector3(lightX, lightY, lightZ));
                GL11.glEnable(2896 /* GL_LIGHTING */);
                GL11.glPopMatrix();

            }
        }
    }
}

From source file:de.keyle.dungeoncraft.editor.editors.world.render.block.Bed.java

License:Open Source License

@Override
public void render(byte blockData, int x, int y, int z, ChunkSchematic chunk) {
    boolean head = true;

    blockData &= 0xF;// w w w .j a  v a 2s  .co m
    if ((blockData & 0x8) == 0) {
        head = false;
    }
    blockData &= 0x3;

    GL11.glPushMatrix();
    GL11.glTranslatef(x, y, z);

    int xShift = 0;
    int zShift = 0;

    // Render pointing South by default
    if (blockData == 2) {
        // Pointing North
        GL11.glRotatef(180f, 0f, 1f, 0f);
        xShift = -1;
        zShift = -1;
    } else if (blockData == 1) {
        // Pointing West
        GL11.glRotatef(-90f, 0f, 1f, 0f);
        zShift = -1;
    } else if (blockData == 3) {
        // Pointing East
        GL11.glRotatef(90f, 0f, 1f, 0f);
        xShift = -1;
    }

    if (head) {
        // Top face
        Renderer.renderHorizontal(HEAD_TOP, xShift, zShift, xShift + 1, zShift + 1, 0.5625f, false);
        // Side faces
        Renderer.renderNonstandardVertical(HEAD_SIDE, xShift, 0, zShift, xShift, 0.5625f, zShift + 1);
        Renderer.renderNonstandardVertical(HEAD_SIDE, xShift + 1, 0, zShift, xShift + 1, 0.5625f, zShift + 1);
        Renderer.renderNonstandardVertical(HEAD_END, xShift, 0, zShift + 1, xShift + 1, 0.5625f, zShift + 1);
    } else {
        // Top face
        Renderer.renderHorizontal(FEED_TOP, xShift, zShift, xShift + 1, zShift + 1, 0.5625f, false);
        // Side faces
        Renderer.renderNonstandardVertical(FEED_SIDE, xShift, 0, zShift, xShift, 0.5625f, zShift + 1);
        Renderer.renderNonstandardVertical(FEED_SIDE, xShift + 1, 0, zShift, xShift + 1, 0.5625f, zShift + 1);
        Renderer.renderNonstandardVertical(FEED_END, xShift, 0, zShift, xShift + 1, 0.5625f, zShift);
    }

    GL11.glPopMatrix();
}