Example usage for org.lwjgl.opengl GL11 glTranslatef

List of usage examples for org.lwjgl.opengl GL11 glTranslatef

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glTranslatef.

Prototype

public static native void glTranslatef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y,
        @NativeType("GLfloat") float z);

Source Link

Document

Manipulates the current matrix with a translation matrix along the x-, y- and z- axes.

Usage

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

License:Creative Commons License

private void renderFeather(EntityClayMan clayMan, RenderClayMan renderer) {
    GL11.glPushMatrix();/*w w w  .jav  a2 s  .  c  o  m*/
    renderer.modelBipedMain.bipedBody.postRender(0.0625F);
    GL11.glTranslatef(0.0F, -0.6F, 0.0F);

    float itemScale = 1.5F;
    GL11.glScalef(itemScale, itemScale, itemScale);
    GL11.glTranslatef(0.6F, 0.05F, 0.0F);
    GL11.glRotatef(22.5F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(90.0F, -1.0F, 0.0F, 1.0F);

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

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

License:Creative Commons License

private void renderGlass(EntityClayMan clayMan, RenderClayMan renderer) {
    GL11.glPushMatrix();/*from   w ww  .  j  a  va2  s.  c om*/
    renderer.modelBipedMain.bipedHead.postRender(0.0625F);
    GL11.glTranslatef(0.0F, -0.6F, 0.0F);

    float itemScale = 0.18F;

    GL11.glScalef(itemScale, itemScale, itemScale);
    GL11.glTranslatef(0.84F, 1.5F, -1.1F);

    short color = clayMan.getUpgrade(SoldierUpgrades.getUpgrade(SoldierUpgrades.UPG_GLASS)).getNbtTag()
            .getShort("leftColor");
    if (color < 0) {
        renderer.getItemRenderer().renderItem(clayMan, this.p_glass, 0);
    } else {
        this.p_glassStained.setItemDamage(color);
        renderer.getItemRenderer().renderItem(clayMan, this.p_glassStained, 0);
    }
    GL11.glTranslatef(-1.68F, 0.0F, 0.0F);

    color = clayMan.getUpgrade(SoldierUpgrades.getUpgrade(SoldierUpgrades.UPG_GLASS)).getNbtTag()
            .getShort("rightColor");
    if (color < 0) {
        renderer.getItemRenderer().renderItem(clayMan, this.p_glass, 0);
    } else {
        this.p_glassStained.setItemDamage(color);
        renderer.getItemRenderer().renderItem(clayMan, this.p_glassStained, 0);
    }
    GL11.glPopMatrix();
}

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

License:Creative Commons License

private static void renderLeftHandItem(EntityClayMan clayMan, RenderClayMan renderer, ItemStack stack) {
    GL11.glPushMatrix();/*  w w w .jav a 2  s .  co m*/
    renderer.modelBipedMain.bipedLeftArm.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.event.SoldierLeftHandRenderHandler.java

License:Creative Commons License

private static void renderThrowableBlock(EntityClayMan clayMan, RenderClayMan renderer, ItemStack stack) {
    GL11.glPushMatrix();/*from   w  w w. j a  va 2s  . c o  m*/
    renderer.modelBipedMain.bipedLeftArm.postRender(0.0625F);
    GL11.glTranslatef(0.05F, 0.55F, 0.0F);
    GL11.glScalef(0.3F, 0.3F, 0.3F);
    renderer.getItemRenderer().renderItem(clayMan, stack, 0);
    GL11.glPopMatrix();
}

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

License:Creative Commons License

private static void renderShield(EntityClayMan clayMan, RenderClayMan renderer) {
    IIcon icon = clayMan.hasUpgrade(SoldierUpgrades.UPG_IRON_BLOCK) ? Textures.s_shieldStudIcon
            : Textures.s_shieldIcon;//from  w  ww .  jav a  2s  .co  m

    GL11.glPushMatrix();
    renderer.modelBipedMain.bipedLeftArm.postRender(0.0625F);
    GL11.glTranslatef(-0.4F, 0.15F, -0.2F);
    GL11.glScalef(0.75F, 0.75F, 0.75F);
    ItemRenderHelper.renderIconIn3D(icon, false, false, 0xFFFFFF);
    GL11.glPopMatrix();
}

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

License:Creative Commons License

private void renderSlimefeet(RenderClayMan clayManRender, float partTicks) {
    ModelBiped model = clayManRender.modelBipedMain;

    this.slimeLeftLeg.rotateAngleX = model.bipedLeftLeg.rotateAngleX;
    this.slimeLeftLeg.rotateAngleY = model.bipedLeftLeg.rotateAngleY;
    this.slimeLeftLeg.rotateAngleZ = model.bipedLeftLeg.rotateAngleZ;
    this.slimeRightLeg.rotateAngleX = model.bipedRightLeg.rotateAngleX;
    this.slimeRightLeg.rotateAngleY = model.bipedRightLeg.rotateAngleY;
    this.slimeRightLeg.rotateAngleZ = model.bipedRightLeg.rotateAngleZ;

    clayManRender.bindTexture(Textures.CLAYMAN_SLIMEFEET);
    GL11.glPushMatrix();/*from w w  w. j  a v a2s.c  om*/
    GL11.glScalef(1.2F, 1.2F, 1.2F);
    GL11.glTranslatef(0.0F, -0.2F, 0.0F);
    this.slimeLeftLeg.render(partTicks);
    this.slimeRightLeg.render(partTicks);
    GL11.glPopMatrix();
}

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();//from   ww w.j a  v a  2 s.com
    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();//from  ww w . java  2 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.event.SoldierRightHandRenderHandler.java

License:Creative Commons License

private static void renderKnuckle(EntityClayMan clayMan, RenderClayMan renderer, ItemStack stack) {
    GL11.glPushMatrix();// ww w.j  av a  2 s .com
    renderer.modelBipedMain.bipedRightArm.postRender(0.0625F);
    GL11.glTranslatef(-0.05F, 0.55F, 0.0F);
    GL11.glScalef(0.3F, 0.3F, 0.3F);
    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 w w  . j  a v  a2s .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();
}