Example usage for org.lwjgl.opengl GL11 glScalef

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

Introduction

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

Prototype

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

Source Link

Document

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

Usage

From source file:LavaBoat.renderer.RenderLavaBoat.java

License:LGPL

/**
 * The render method used in RenderBoat that renders the boat model.
 *//*from   ww w.j  a  v a2s.  c o m*/
public void renderBoat(EntityNKBoat boat, double par2, double par4, double par6, float par8, float par9) {
    GL11.glPushMatrix();
    GL11.glTranslatef((float) par2, (float) par4, (float) par6);
    GL11.glRotatef(180 - par8, 0, 1, 0);
    float f2 = boat.getTimeSinceHit() - par9;
    float f3 = boat.getDamageTaken() - par9;

    if (f3 < 0) {
        f3 = 0;
    }

    if (f2 > 0) {
        GL11.glRotatef(MathHelper.sin(f2) * f2 * f3 / 10F * boat.getForwardDirection(), 1, 0, 0);
    }

    float f4 = 0.75F;
    GL11.glScalef(f4, f4, f4);
    GL11.glScalef(1 / f4, 1 / f4, 1 / f4);

    getTexture();
    GL11.glScalef(-1, -1, 1);

    if (boatType == 1 || boatType == 3) {
        GL11.glRotatef(180, 0, 1, 0);
    }
    this.modelBoat.render(boat, 0, 0, -0.1F, 0, 0, 0.0625F);
    GL11.glPopMatrix();
}

From source file:lwjake2.render.lwjgl.Mesh.java

License:Open Source License

/**
 * R_DrawAliasModel/*  w  w  w.ja v  a2  s . c  om*/
 */
void R_DrawAliasModel(entity_t e) {
    if ((e.flags & Defines.RF_WEAPONMODEL) == 0) {
        if (R_CullAliasModel(e))
            return;
    }

    if ((e.flags & Defines.RF_WEAPONMODEL) != 0) {
        if (r_lefthand.value == 2.0f)
            return;
    }

    qfiles.dmdl_t paliashdr = (qfiles.dmdl_t) currentmodel.extradata;

    //
    // get lighting information
    //
    // PMM - rewrote, reordered to handle new shells & mixing
    // PMM - 3.20 code .. replaced with original way of doing it to keep mod authors happy
    //
    int i;
    if ((currententity.flags & (Defines.RF_SHELL_HALF_DAM | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_RED
            | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE)) != 0) {
        Math3D.VectorClear(shadelight);
        if ((currententity.flags & Defines.RF_SHELL_HALF_DAM) != 0) {
            shadelight[0] = 0.56f;
            shadelight[1] = 0.59f;
            shadelight[2] = 0.45f;
        }
        if ((currententity.flags & Defines.RF_SHELL_DOUBLE) != 0) {
            shadelight[0] = 0.9f;
            shadelight[1] = 0.7f;
        }
        if ((currententity.flags & Defines.RF_SHELL_RED) != 0)
            shadelight[0] = 1.0f;
        if ((currententity.flags & Defines.RF_SHELL_GREEN) != 0)
            shadelight[1] = 1.0f;
        if ((currententity.flags & Defines.RF_SHELL_BLUE) != 0)
            shadelight[2] = 1.0f;
    }

    else if ((currententity.flags & Defines.RF_FULLBRIGHT) != 0) {
        for (i = 0; i < 3; i++)
            shadelight[i] = 1.0f;
    } else {
        R_LightPoint(currententity.origin, shadelight);

        // player lighting hack for communication back to server
        // big hack!
        if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0) {
            // pick the greatest component, which should be the same
            // as the mono value returned by software
            if (shadelight[0] > shadelight[1]) {
                if (shadelight[0] > shadelight[2])
                    r_lightlevel.value = 150 * shadelight[0];
                else
                    r_lightlevel.value = 150 * shadelight[2];
            } else {
                if (shadelight[1] > shadelight[2])
                    r_lightlevel.value = 150 * shadelight[1];
                else
                    r_lightlevel.value = 150 * shadelight[2];
            }
        }

        if (gl_monolightmap.string.charAt(0) != '0') {
            float s = shadelight[0];

            if (s < shadelight[1])
                s = shadelight[1];
            if (s < shadelight[2])
                s = shadelight[2];

            shadelight[0] = s;
            shadelight[1] = s;
            shadelight[2] = s;
        }
    }

    if ((currententity.flags & Defines.RF_MINLIGHT) != 0) {
        for (i = 0; i < 3; i++)
            if (shadelight[i] > 0.1f)
                break;
        if (i == 3) {
            shadelight[0] = 0.1f;
            shadelight[1] = 0.1f;
            shadelight[2] = 0.1f;
        }
    }

    if ((currententity.flags & Defines.RF_GLOW) != 0) { // bonus items will pulse with time
        float scale;
        float min;

        scale = (float) (0.1f * Math.sin(r_newrefdef.time * 7));
        for (i = 0; i < 3; i++) {
            min = shadelight[i] * 0.8f;
            shadelight[i] += scale;
            if (shadelight[i] < min)
                shadelight[i] = min;
        }
    }

    // =================
    // PGM   ir goggles color override
    if ((r_newrefdef.rdflags & Defines.RDF_IRGOGGLES) != 0
            && (currententity.flags & Defines.RF_IR_VISIBLE) != 0) {
        shadelight[0] = 1.0f;
        shadelight[1] = 0.0f;
        shadelight[2] = 0.0f;
    }
    // PGM   
    // =================

    shadedots = r_avertexnormal_dots[((int) (currententity.angles[1] * (SHADEDOT_QUANT / 360.0)))
            & (SHADEDOT_QUANT - 1)];

    float an = (float) (currententity.angles[1] / 180 * Math.PI);
    shadevector[0] = (float) Math.cos(-an);
    shadevector[1] = (float) Math.sin(-an);
    shadevector[2] = 1;
    Math3D.VectorNormalize(shadevector);

    //
    // locate the proper data
    //

    c_alias_polys += paliashdr.num_tris;

    //
    // draw all the triangles
    //
    if ((currententity.flags & Defines.RF_DEPTHHACK) != 0) // hack the depth range to prevent view model from poking into walls
        GL11.glDepthRange(gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin));

    if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0f)) {
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glPushMatrix();
        GL11.glLoadIdentity();
        GL11.glScalef(-1, 1, 1);
        MYgluPerspective(r_newrefdef.fov_y, (float) r_newrefdef.width / r_newrefdef.height, 4, 4096);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);

        GL11.glCullFace(GL11.GL_BACK);
    }

    GL11.glPushMatrix();
    e.angles[PITCH] = -e.angles[PITCH]; // sigh.
    R_RotateForEntity(e);
    e.angles[PITCH] = -e.angles[PITCH]; // sigh.

    image_t skin;
    // select skin
    if (currententity.skin != null)
        skin = currententity.skin; // custom player skin
    else {
        if (currententity.skinnum >= qfiles.MAX_MD2SKINS)
            skin = currentmodel.skins[0];
        else {
            skin = currentmodel.skins[currententity.skinnum];
            if (skin == null)
                skin = currentmodel.skins[0];
        }
    }
    if (skin == null)
        skin = r_notexture; // fallback...
    GL_Bind(skin.texnum);

    // draw it

    GL11.glShadeModel(GL11.GL_SMOOTH);

    GL_TexEnv(GL11.GL_MODULATE);
    if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) {
        GL11.glEnable(GL11.GL_BLEND);
    }

    if ((currententity.frame >= paliashdr.num_frames) || (currententity.frame < 0)) {
        VID.Printf(Defines.PRINT_ALL,
                "R_DrawAliasModel " + currentmodel.name + ": no such frame " + currententity.frame + '\n');
        currententity.frame = 0;
        currententity.oldframe = 0;
    }

    if ((currententity.oldframe >= paliashdr.num_frames) || (currententity.oldframe < 0)) {
        VID.Printf(Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name + ": no such oldframe "
                + currententity.oldframe + '\n');
        currententity.frame = 0;
        currententity.oldframe = 0;
    }

    if (r_lerpmodels.value == 0.0f)
        currententity.backlerp = 0;

    GL_DrawAliasFrameLerp(paliashdr, currententity.backlerp);

    GL_TexEnv(GL11.GL_REPLACE);
    GL11.glShadeModel(GL11.GL_FLAT);

    GL11.glPopMatrix();

    if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0F)) {
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glCullFace(GL11.GL_FRONT);
    }

    if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) {
        GL11.glDisable(GL11.GL_BLEND);
    }

    if ((currententity.flags & Defines.RF_DEPTHHACK) != 0)
        GL11.glDepthRange(gldepthmin, gldepthmax);

    if (gl_shadows.value != 0.0f
            && (currententity.flags & (Defines.RF_TRANSLUCENT | Defines.RF_WEAPONMODEL)) == 0) {
        GL11.glPushMatrix();
        R_RotateForEntity(e);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glColor4f(0, 0, 0, 0.5f);
        GL_DrawAliasShadow(paliashdr, currententity.frame);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glPopMatrix();
    }
    GL11.glColor4f(1, 1, 1, 1);
}

From source file:lyonlancer5.halogen.BlockRenderHandler.java

License:Apache License

@Override
public void renderInventoryBlock(Block _block, int metadata, int modelId, RenderBlocks renderer) {
    Block_HalogenLight block = (Block_HalogenLight) _block;
    boolean renderType = false;

    if (metadata >= 0 && metadata <= 15) {
        renderer.setRenderBounds(0.25D, 0.25D, 0.875D, 0.75D, 0.75D, 1.0D);
    } else if (metadata >= 16 && metadata <= 31) {
        renderer.setRenderBounds(0.25D, 0.0D, 0.25D, 0.75D, 0.7350000143051147D, 0.75D);
    } else if (metadata >= 32 && metadata <= 47) {
        renderer.setRenderBounds(0.0D, 0.4350000023841858D, 0.875D, 1.0D, 0.5649999976158142D, 1.0D);
    } else if (metadata >= 48 && metadata <= 63) {
        renderer.setRenderBounds(0.27000001072883606D, 0.40299999713897705D, 0.949999988079071D,
                0.7300000190734863D, 0.597000002861023D, 1.0D);
    } else if (metadata >= 64 && metadata <= 79) {
        renderer.setRenderBounds(0.3199999928474426D, 0.3199999928474426D, 0.949999988079071D,
                0.6800000071525574D, 0.6800000071525574D, 1.0D);
    } else if (metadata >= 80 && metadata <= 95) {
        renderer.setRenderBounds(0.3199999928474426D, 0.0D, 0.3199999928474426D, 0.6800000071525574D,
                0.6600000262260437D, 0.6800000071525574D);
    } else if (metadata >= 96 && metadata <= 111) {
        renderer.setRenderBounds(0.3499999940395355D, 0.0D, 0.3499999940395355D, 0.6499999761581421D,
                0.6000000238418579D, 0.6499999761581421D);
        renderType = true;//ww w. ja va  2s. c  om
    } else if (metadata >= 112 && metadata <= 127) {
        renderer.setRenderBounds(0.0D, 0.375D, 0.0D, 1.0D, 0.625D, 1.0D);
    }

    Tessellator tessellator = Tessellator.instance;

    if (!renderType) {
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        tessellator.startDrawingQuads();
        tessellator.setNormal(0.0F, -1.0F, 0.0F);
        renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, metadata));
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.setNormal(0.0F, 1.0F, 0.0F);
        renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, metadata));
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.setNormal(0.0F, 0.0F, -1.0F);
        renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, metadata));
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.setNormal(0.0F, 0.0F, 1.0F);
        renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, metadata));
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.setNormal(-1.0F, 0.0F, 0.0F);
        renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, metadata));
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.setNormal(1.0F, 0.0F, 0.0F);
        renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, metadata));
        tessellator.draw();
        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    }

    if (renderType) {
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glScalef(1.5F, 1.5F, 1.5F);
        tessellator.startDrawingQuads();
        tessellator.setNormal(0.0F, -1.0F, 0.0F);
        this.renderTorchAtAngle(renderer, block, -0.5D, -0.4D, -0.5D, 0.0D, 0.0D, metadata, false);
        tessellator.draw();
        GL11.glScalef(1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_LIGHTING);
    }
}

From source file:lyonlancer5.pfsteel.client.render.entity.RenderDesertCreeper.java

License:Open Source License

/**
 * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
 * entityLiving, partialTickTime//from   www .  ja v  a2 s  .  com
 */
protected void preRenderCallback(EntityDesertCreeper p_77041_1_, float p_77041_2_) {
    float f1 = p_77041_1_.getCreeperFlashIntensity(p_77041_2_);
    float f2 = 1.0F + MathHelper.sin(f1 * 100.0F) * f1 * 0.01F;

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

    if (f1 > 1.0F) {
        f1 = 1.0F;
    }

    f1 *= f1;
    f1 *= f1;
    float f3 = (1.0F + f1 * 0.4F) * f2;
    float f4 = (1.0F + f1 * 0.1F) / f2;
    GL11.glScalef(f3, f4, f3);
}

From source file:lyonlancer5.pfsteel.client.render.entity.RenderNetherCreeper.java

License:Open Source License

/**
 * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
 * entityLiving, partialTickTime//w  w w .  jav  a 2  s .  c  om
 */
protected void preRenderCallback(EntityNetherCreeper p_77041_1_, float p_77041_2_) {
    float f1 = p_77041_1_.getCreeperFlashIntensity(p_77041_2_);
    float f2 = 1.0F + MathHelper.sin(f1 * 100.0F) * f1 * 0.01F;

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

    if (f1 > 1.0F) {
        f1 = 1.0F;
    }

    f1 *= f1;
    f1 *= f1;
    float f3 = (1.0F + f1 * 0.4F) * f2;
    float f4 = (1.0F + f1 * 0.1F) / f2;
    GL11.glScalef(f3, f4, f3);
}

From source file:lyonlancer5.pfsteel.client.render.entity.RenderSnowCreeper.java

License:Open Source License

/**
 * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
 * entityLiving, partialTickTime/*from   ww  w. j a  v a 2  s .c  o  m*/
 */
protected void preRenderCallback(EntitySnowCreeper p_77041_1_, float p_77041_2_) {
    float f1 = p_77041_1_.getCreeperFlashIntensity(p_77041_2_);
    float f2 = 1.0F + MathHelper.sin(f1 * 100.0F) * f1 * 0.01F;

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

    if (f1 > 1.0F) {
        f1 = 1.0F;
    }

    f1 *= f1;
    f1 *= f1;
    float f3 = (1.0F + f1 * 0.4F) * f2;
    float f4 = (1.0F + f1 * 0.1F) / f2;
    GL11.glScalef(f3, f4, f3);
}

From source file:lyonlancer5.pfsteel.client.render.projectile.RenderBullet.java

License:Open Source License

public void renderBullet(EntityBullet entityarrow, double d, double d1, double d2, float f, float f1) {
    bindEntityTexture(entityarrow);/* w  w w.j ava 2s .  c o  m*/
    GL11.glPushMatrix();
    GL11.glTranslatef((float) d, (float) d1, (float) d2);
    Tessellator tessellator = Tessellator.instance;
    float f2 = 0.0F;
    float f3 = 0.3125F;
    float f10 = 0.05625F;
    GL11.glEnable(32826);
    GL11.glScalef(0.07F, 0.07F, 0.07F);
    GL11.glNormal3f(f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(0.0D, -1.0D, -1.0D, f2, f2);
    tessellator.addVertexWithUV(0.0D, -1.0D, 1.0D, f3, f2);
    tessellator.addVertexWithUV(0.0D, 1.0D, 1.0D, f3, f3);
    tessellator.addVertexWithUV(0.0D, 1.0D, -1.0D, f2, f3);
    tessellator.draw();
    GL11.glNormal3f(-f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(0.0D, 1.0D, -1.0D, f2, f2);
    tessellator.addVertexWithUV(0.0D, 1.0D, 1.0D, f3, f2);
    tessellator.addVertexWithUV(0.0D, -1.0D, 1.0D, f3, f3);
    tessellator.addVertexWithUV(0.0D, -1.0D, -1.0D, f2, f3);
    tessellator.draw();
    for (int j = 0; j < 4; j++) {
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glNormal3f(0.0F, 0.0F, f10);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-1.0D, -1.0D, 0.0D, f2, f2);
        tessellator.addVertexWithUV(1.0D, -1.0D, 0.0D, f3, f2);
        tessellator.addVertexWithUV(1.0D, 1.0D, 0.0D, f3, f3);
        tessellator.addVertexWithUV(-1.0D, 1.0D, 0.0D, f2, f3);
        tessellator.draw();
    }
    GL11.glDisable(32826);
    GL11.glPopMatrix();
}

From source file:lyonlancer5.pfsteel.client.render.projectile.RenderExplosiveArrow.java

License:Open Source License

public void doRender(EntityExplosiveArrow p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_,
        float p_76986_8_, float p_76986_9_) {
    bindEntityTexture(p_76986_1_);/*from w  w w  .  j ava 2 s .c om*/
    GL11.glPushMatrix();
    GL11.glTranslatef((float) p_76986_2_, (float) p_76986_4_, (float) p_76986_6_);
    GL11.glRotatef(p_76986_1_.prevRotationYaw
            + (p_76986_1_.rotationYaw - p_76986_1_.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(p_76986_1_.prevRotationPitch
            + (p_76986_1_.rotationPitch - p_76986_1_.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F);
    Tessellator tessellator = Tessellator.instance;
    byte b0 = 0;
    float f2 = 0.0F;
    float f3 = 0.5F;
    float f4 = (float) (0 + b0 * 10) / 32.0F;
    float f5 = (float) (5 + b0 * 10) / 32.0F;
    float f6 = 0.0F;
    float f7 = 0.15625F;
    float f8 = (float) (5 + b0 * 10) / 32.0F;
    float f9 = (float) (10 + b0 * 10) / 32.0F;
    float f10 = 0.05625F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    float f11 = (float) p_76986_1_.arrowShake - p_76986_9_;

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

    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(f10, f10, f10);
    GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9);
    tessellator.draw();
    GL11.glNormal3f(-f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9);
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9);
    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, f10);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4);
        tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4);
        tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5);
        tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5);
        tessellator.draw();
    }

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

From source file:lyonlancer5.pfsteel.client.render.projectile.RenderPortalArrow.java

License:Open Source License

public void doRender(EntityPortalArrow p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_,
        float p_76986_8_, float p_76986_9_) {
    bindEntityTexture(p_76986_1_);/*  w  w w. jav a2  s .  c o  m*/
    GL11.glPushMatrix();
    GL11.glTranslatef((float) p_76986_2_, (float) p_76986_4_, (float) p_76986_6_);
    GL11.glRotatef(p_76986_1_.prevRotationYaw
            + (p_76986_1_.rotationYaw - p_76986_1_.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(p_76986_1_.prevRotationPitch
            + (p_76986_1_.rotationPitch - p_76986_1_.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F);
    Tessellator tessellator = Tessellator.instance;
    byte b0 = 0;
    float f2 = 0.0F;
    float f3 = 0.5F;
    float f4 = (float) (0 + b0 * 10) / 32.0F;
    float f5 = (float) (5 + b0 * 10) / 32.0F;
    float f6 = 0.0F;
    float f7 = 0.15625F;
    float f8 = (float) (5 + b0 * 10) / 32.0F;
    float f9 = (float) (10 + b0 * 10) / 32.0F;
    float f10 = 0.05625F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(f10, f10, f10);
    GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9);
    tessellator.draw();
    GL11.glNormal3f(-f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9);
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9);
    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, f10);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4);
        tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4);
        tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5);
        tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5);
        tessellator.draw();
    }

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

From source file:lyonlancer5.pfsteel.client.render.projectile.RenderRedBullet.java

License:Open Source License

public void doRender(EntityRedBullet p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_,
        float p_76986_8_, float p_76986_9_) {
    bindEntityTexture(p_76986_1_);/*from  w w  w .j a va2s . co  m*/
    GL11.glPushMatrix();
    GL11.glTranslatef((float) p_76986_2_, (float) p_76986_4_, (float) p_76986_6_);
    GL11.glRotatef(p_76986_1_.prevRotationYaw
            + (p_76986_1_.rotationYaw - p_76986_1_.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(p_76986_1_.prevRotationPitch
            + (p_76986_1_.rotationPitch - p_76986_1_.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F);
    Tessellator tessellator = Tessellator.instance;
    byte b0 = 0;
    float f2 = 0.0F;
    float f3 = 0.5F;
    float f4 = (float) (0 + b0 * 10) / 32.0F;
    float f5 = (float) (5 + b0 * 10) / 32.0F;
    float f6 = 0.0F;
    float f7 = 0.15625F;
    float f8 = (float) (5 + b0 * 10) / 32.0F;
    float f9 = (float) (10 + b0 * 10) / 32.0F;
    float f10 = 0.05625F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    float f11 = (float) p_76986_1_.arrowShake - p_76986_9_;

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

    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(f10, f10, f10);
    GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9);
    tessellator.draw();
    GL11.glNormal3f(-f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9);
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9);
    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, f10);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4);
        tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4);
        tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5);
        tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5);
        tessellator.draw();
    }

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