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:de.sanandrew.mods.claysoldiers.client.event.SoldierModelRenderHandler.java

License:Creative Commons License

private static void renderCape(EntityClayMan clayMan, RenderClayMan clayManRender, float partTicks,
        boolean isSuper) {
    GL11.glPushMatrix();//w  w w .  j  ava2  s  . c om
    GL11.glTranslatef(0.0F, 0.0F, 0.175F);

    double swingProgX = calcSwingProgress(clayMan.cloakHelper.swingPosX, clayMan.cloakHelper.prevSwingPosX,
            clayMan.posX, clayMan.prevPosX, partTicks);
    double swingProgY = calcSwingProgress(clayMan.cloakHelper.swingPosY, clayMan.cloakHelper.prevSwingPosY,
            clayMan.posY, clayMan.prevPosY, partTicks) * 10.0F;
    double swingProgZ = calcSwingProgress(clayMan.cloakHelper.swingPosZ, clayMan.cloakHelper.prevSwingPosZ,
            clayMan.posZ, clayMan.prevPosZ, partTicks);
    float yawOffProg = clayMan.prevRenderYawOffset
            + (clayMan.renderYawOffset - clayMan.prevRenderYawOffset) * partTicks;
    double yawOffProgSin = MathHelper.sin(yawOffProg * (float) Math.PI / 180.0F);
    double yawOffProgNCos = -MathHelper.cos(yawOffProg * (float) Math.PI / 180.0F);

    if (swingProgY < -6.0F) {
        swingProgY = -6.0F;
    }

    if (swingProgY > 32.0F) {
        swingProgY = 32.0F;
    }

    float swingXZSin = (float) (swingProgX * yawOffProgSin + swingProgZ * yawOffProgNCos) * 100.0F;
    float swingXZNCos = (float) (swingProgX * yawOffProgNCos - swingProgZ * yawOffProgSin) * 100.0F;

    if (swingXZSin < 0.0F) {
        swingXZSin = 0.0F;
    }

    GL11.glRotatef(6.0F + swingXZSin / 2.0F + (float) swingProgY, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(swingXZNCos / 2.0F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(-swingXZNCos / 2.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);

    if (isSuper) {
        clayManRender.bindTexture(Textures.CLAYMAN_CAPE_DIAMOND);
    } else {
        float[] color = getSplittedColor(clayMan.getMiscColor());
        GL11.glColor3f(color[0], color[1], color[2]);
        clayManRender.bindTexture(Textures.CLAYMAN_CAPE_BLANK);
    }

    clayManRender.modelBipedMain.bipedCloak.render(0.0625F);
    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.claysoldiers.client.event.SoldierRightHandRenderHandler.java

License:Creative Commons License

private static void renderRightHandItem(EntityClayMan clayMan, RenderClayMan renderer, ItemStack stack) {
    GL11.glPushMatrix();//w  w w.ja  v a2 s .co m
    renderer.modelBipedMain.bipedRightArm.postRender(0.0625F);
    GL11.glTranslatef(-0.1F, 0.6F, 0.0F);

    float itemScale = 0.6F;
    GL11.glScalef(itemScale, itemScale, itemScale);
    GL11.glRotatef(140.0F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);

    renderer.getItemRenderer().renderItem(clayMan, stack, 0);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.claysoldiers.client.model.tileentity.ModelClayNexus.java

License:Creative Commons License

private static void renderScaledBox(ModelRenderer box, float scaleFactor) {
    Triplet<Float, Float, Float> rot = Triplet.with(box.rotateAngleX, box.rotateAngleY, box.rotateAngleZ);
    Triplet<Float, Float, Float> point = Triplet.with(box.rotationPointX, box.rotationPointY,
            box.rotationPointZ);/*from w ww  .  j a v a2  s. com*/
    setRotation(box, 0.0F, 0.0F, 0.0F);
    box.rotationPointX = 0.0F;
    box.rotationPointY = 0.0F;
    box.rotationPointZ = 0.0F;

    GL11.glPushMatrix();
    GL11.glTranslatef(point.getValue0() * scaleFactor, point.getValue1() * scaleFactor,
            point.getValue2() * scaleFactor);
    GL11.glRotatef(rot.getValue2() * (180.0F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(rot.getValue1() * (180.0F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(rot.getValue0() * (180.0F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
    GL11.glScalef(1.01F, 1.01F, 1.01F);
    GL11.glTranslatef(0.0F, -0.00075F, 0.0F);
    box.render(scaleFactor);
    GL11.glPopMatrix();

    setRotation(box, rot.getValue0(), rot.getValue1(), rot.getValue2());
    box.rotationPointX = point.getValue0();
    box.rotationPointY = point.getValue1();
    box.rotationPointZ = point.getValue2();
}

From source file:de.sanandrew.mods.claysoldiers.client.render.item.ItemRendererClayNexus.java

License:Creative Commons License

private void renderNexus(float x, float y, float z) {
    GL11.glPushMatrix();/*from  w  ww .jav a  2  s .  co  m*/
    GL11.glTranslatef(x, y + 1.57F + 0.125F, z);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glScalef(1.1875F, 1.1875F, 1.1875F);

    Minecraft.getMinecraft().getTextureManager().bindTexture(Textures.NEXUS_TEXTURE);
    this.modelClayNexus.renderTileEntity();
    Minecraft.getMinecraft().getTextureManager().bindTexture(Textures.NEXUS_GLOWING);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    this.modelClayNexus.renderTileEntityGlowmap();
    GL11.glDisable(GL11.GL_BLEND);

    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.claysoldiers.client.render.tileentity.RenderClayNexus.java

License:Creative Commons License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partTicks) {
    TileEntityClayNexus nexus = (TileEntityClayNexus) tileEntity;

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

    this.bindTexture(Textures.NEXUS_TEXTURE);
    nexusModel.renderTileEntity();

    this.renderGlowmap(nexus);

    if (nexus.getStackInSlot(TileEntityClayNexus.SOLDIER_SLOT) != null) {
        renderSoldierItem(nexus, nexus.getStackInSlot(TileEntityClayNexus.SOLDIER_SLOT), partTicks);
    }

    if (nexus.getStackInSlot(TileEntityClayNexus.THROWABLE_SLOT) != null) {
        renderThrowableItem(nexus, nexus.getStackInSlot(TileEntityClayNexus.THROWABLE_SLOT), partTicks);
    }

    ItemStack heldItem = Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem();
    if (heldItem != null && heldItem.getItem() == RegistryItems.statDisplay) {
        renderHealth(nexus);
    }

    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.claysoldiers.client.render.tileentity.RenderClayNexus.java

License:Creative Commons License

private static void renderSoldierItem(TileEntityClayNexus nexus, ItemStack stack, float partTicks) {
    float[] colors = new float[] { 1.0F, 1.0F, 1.0F };
    float itmAngle = nexus.prevSpinAngle + (nexus.spinAngle - nexus.prevSpinAngle) * partTicks - 45.0F;

    RGBAValues rgba = SAPUtils.getRgbaFromColorInt(ItemClayManDoll.getTeam(stack).getIconColor());
    colors[0] = rgba.getRed() / 255.0F;/*from ww  w. j  a v  a  2  s. co  m*/
    colors[1] = rgba.getGreen() / 255.0F;
    colors[2] = rgba.getBlue() / 255.0F;

    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, 1.225F, 0.0F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(0.25F, 0.25F, 0.25F);
    GL11.glRotatef(itmAngle, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, 0.0F, 0.0F);
    GL11.glColor3f(colors[0], colors[1], colors[2]);
    ItemRenderHelper.renderItemIn3D(stack);
    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.claysoldiers.client.render.tileentity.RenderClayNexus.java

License:Creative Commons License

private static void renderThrowableItem(TileEntityClayNexus nexus, ItemStack stack, float partTicks) {
    float itmAngle = nexus.prevSpinAngle + (nexus.spinAngle - nexus.prevSpinAngle) * partTicks - 45.0F;
    ASoldierUpgrade upg = SoldierUpgrades.getUpgrade(stack);
    IThrowableUpgrade throwableUpg = upg instanceof IThrowableUpgrade ? (IThrowableUpgrade) upg : null;
    if (throwableUpg == null) {
        return;/*from  w  ww  .j  a v a 2 s.  co  m*/
    }

    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, 0.875F, 0.0F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(0.25F, 0.25F, 0.25F);
    GL11.glRotatef(-itmAngle, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, 0.0F, 0.0F);
    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    throwableUpg.renderNexusThrowable(nexus, partTicks);
    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.claysoldiers.client.render.tileentity.RenderClayNexus.java

License:Creative Commons License

private static void renderHealth(TileEntityClayNexus nexus) {
    Tessellator tessellator = Tessellator.instance;

    GL11.glPushMatrix();//from   w  w  w .jav a  2 s  .c o  m
    GL11.glTranslatef(0.0F, 0.5F, 0.0F);
    GL11.glRotatef(RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);

    float healthPerc = Math.min(1.0F, 1.0F - nexus.getHealth() / nexus.getMaxHealth());

    float prevBrightX = OpenGlHelper.lastBrightnessX;
    float prevBrightY = OpenGlHelper.lastBrightnessY;
    int brightness = 0xF0;
    int brightX = brightness % 65536;
    int brightY = brightness / 65536;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX, brightY);

    tessellator.startDrawingQuads();
    tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 1.0F);
    tessellator.addVertex(-0.5D, -0.05D, 0.0D);
    tessellator.addVertex(-0.5D + healthPerc, -0.05D, 0.0D);
    tessellator.addVertex(-0.5D + healthPerc, 0.05D, 0.0D);
    tessellator.addVertex(-0.5D, 0.05D, 0.0D);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setColorRGBA_F(1.0F, 0.0F, 0.0F, 1.0F);
    tessellator.addVertex(-0.5D + healthPerc, -0.05D, 0.0D);
    tessellator.addVertex(0.5D, -0.05D, 0.0D);
    tessellator.addVertex(0.5D, 0.05D, 0.0D);
    tessellator.addVertex(-0.5D + healthPerc, 0.05D, 0.0D);
    tessellator.draw();

    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevBrightX, prevBrightY);

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

From source file:de.sanandrew.mods.particledeco.client.render.block.RenderParticleBox.java

License:Creative Commons License

@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
    Tessellator tessellator = Tessellator.instance;

    block.setBlockBoundsForItemRender();
    renderer.setRenderBoundsFromBlock(block);
    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glScalef(1.5F, 1.0F, 1.5F);//from  w w  w.j  a v a 2 s.  c o  m
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    GL11.glScalef(1.0F, 1.5F, 1.0F);
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, -1.0F, 0.0F);
    renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, 1));
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, 1));
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, 1));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, 1));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
    renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, 1));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, 1));
    tessellator.draw();
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}

From source file:de.sanandrew.mods.turretmod.client.render.entity.RenderTurretArrow.java

License:Creative Commons License

public void doRender(EntityArrow arrow, double x, double y, double z, float yaw, float partTicks) {
    this.bindEntityTexture(arrow);
    GL11.glPushMatrix();//  w ww.  ja  v a  2  s  . c  o m
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glRotatef(arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * partTicks - 90.0F,
            0.0F, 1.0F, 0.0F);
    GL11.glRotatef(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * partTicks, 0.0F,
            0.0F, 1.0F);
    Tessellator tessellator = Tessellator.instance;

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    float shake = arrow.arrowShake - partTicks;

    if (shake > 0.0F) {
        float shakeVal = -MathHelper.sin(shake * 3.0F) * shake;
        GL11.glRotatef(shakeVal, 0.0F, 0.0F, 1.0F);
    }

    float scale = 0.03625F;
    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(scale, scale, scale);
    GL11.glTranslatef(4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(scale, 0.0F, 0.0F);

    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, 0.0F, 0.15625F);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, 0.15625F, 0.15625F);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, 0.15625F, 0.3125F);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, 0.0F, 0.3125F);
    tessellator.draw();
    GL11.glNormal3f(-scale, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, 0.0F, 0.15625F);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, 0.15625F, 0.15625F);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, 0.15625F, 0.3125F);
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, 0.0F, 0.3125F);
    tessellator.draw();

    for (int i = 0; i < 4; ++i) {
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glNormal3f(0.0F, 0.0F, scale);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, 0.0F, 0.0F);
        tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, 0.5F, 0.0F);
        tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, 0.5F, 0.15625F);
        tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, 0.0F, 0.15625F);
        tessellator.draw();
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}