Example usage for org.lwjgl.opengl GL11 glNormal3f

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

Introduction

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

Prototype

public static native void glNormal3f(@NativeType("GLfloat") float nx, @NativeType("GLfloat") float ny,
        @NativeType("GLfloat") float nz);

Source Link

Document

Sets the current normal.

Usage

From source file:shadowmage.ancient_framework.client.model.PrimitiveQuad.java

License:Open Source License

@Override
protected void renderForDisplayList() {
    float tw = parent.getModel().textureWidth;
    float th = parent.getModel().textureHeight;
    float px = 1.f / tw;
    float py = 1.f / th;
    float w = (x2 - x1) * 16.f;
    float l = 1.f;//TODO fix this for proper texture handling
    float h = (y2 - y1) * 16.f;
    float ty = this.ty();
    float tx = this.tx();

    float tx1, ty1, tx2, ty2;

    //render the cube. only called a single time when building the display list for a piece
    if (rx != 0) {
        GL11.glRotatef(rx, 1, 0, 0);/*  ww  w.java 2s  . com*/
    }
    if (ry != 0) {
        GL11.glRotatef(ry, 0, 1, 0);
    }
    if (rz != 0) {
        GL11.glRotatef(rz, 0, 0, 1);
    }

    GL11.glBegin(GL11.GL_QUADS);

    AWLog.logDebug("tx, ty: " + tx + "," + ty);
    AWLog.logDebug("w,l,h: " + w + "," + h);
    //  AWLog.logDebug(String.format("t: %.4f, %.4f, %.4f, %.4f", tx1, ty1, tx2, ty2));

    //front side  
    tx1 = (tx + l) * px;
    ty1 = (th - (ty + l + h)) * py;
    tx2 = (tx + l + w) * px;
    ty2 = (th - (ty + l)) * py;

    GL11.glNormal3f(0, 0, 1);
    GL11.glTexCoord2f(tx1, ty1);
    GL11.glVertex3f(x1, y1, 0.f);
    GL11.glTexCoord2f(tx2, ty1);
    GL11.glVertex3f(x2, y1, 0.f);
    GL11.glTexCoord2f(tx2, ty2);
    GL11.glVertex3f(x2, y2, 0.f);
    GL11.glTexCoord2f(tx1, ty2);
    GL11.glVertex3f(x1, y2, 0.f);

    GL11.glEnd();
}

From source file:shadowmage.ancient_framework.client.model.PrimitiveTriangle.java

License:Open Source License

@Override
protected void renderForDisplayList() {
    if (rx != 0) {
        GL11.glRotatef(rx, 1, 0, 0);// w  ww.java 2  s. c  om
    }
    if (ry != 0) {
        GL11.glRotatef(ry, 0, 1, 0);
    }
    if (rz != 0) {
        GL11.glRotatef(rz, 0, 0, 1);
    }

    float tw = parent.getModel().textureWidth;
    float th = parent.getModel().textureHeight;
    float px = 1.f / tw;
    float py = 1.f / th;

    float u1, v1, u2, v2, u3, v3;
    u1 = this.u1 * px + this.tx() * px;
    u2 = this.u2 * px + this.tx() * px;
    u3 = this.u3 * px + this.tx() * px;
    v1 = this.v1 * py + this.ty() * py;
    v2 = this.v2 * py + this.ty() * py;
    v3 = this.v3 * py + this.ty() * py;
    GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
    GL11.glNormal3f(normalX, normalY, normalZ);
    GL11.glTexCoord2f(u1, v1);
    GL11.glVertex3f(x1, y1, z1);
    GL11.glTexCoord2f(u2, v2);
    GL11.glVertex3f(x2, y2, z2);
    GL11.glTexCoord2f(u3, v3);
    GL11.glVertex3f(x3, y3, z3);
    GL11.glEnd();
}

From source file:shadowmage.ancient_warfare.client.render.RenderNpcHelper.java

License:Open Source License

/**
 * shamelessly copied to enable color-differentiation per-entity
 *//*from   w w  w. ja v  a  2 s  .c  om*/
@Override
protected void renderLivingLabel(EntityLivingBase par1EntityLiving, String par2Str, double renderX,
        double renderY, double renderZ, int renderDistance) {
    double var10 = par1EntityLiving.getDistanceSqToEntity(this.renderManager.livingPlayer);
    if (var10 <= (double) (renderDistance * renderDistance)) {
        NpcBase npc = (NpcBase) par1EntityLiving;
        boolean hostile = TeamTracker.instance().isHostileTowards(npc.worldObj, npc.teamNum,
                TeamTracker.instance().getTeamForPlayer(Minecraft.getMinecraft().thePlayer));
        if (hostile && !Config.renderHostileNames) {
            return;
        }
        FontRenderer fontRenderer = this.getFontRendererFromRenderManager();
        float var13 = 1.6F;
        float var14 = 0.016666668F * var13;
        GL11.glPushMatrix();
        GL11.glTranslatef((float) renderX, (float) renderY + 2.3F, (float) renderZ);
        GL11.glNormal3f(0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
        GL11.glScalef(-var14, -var14, var14);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDepthMask(false);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        Tessellator tessellator = Tessellator.instance;
        byte yOffset = 0;// Y offset

        GL11.glDisable(GL11.GL_TEXTURE_2D);
        tessellator.startDrawingQuads();
        int xOffset = fontRenderer.getStringWidth(par2Str) / 2;// 
        tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
        tessellator.addVertex((double) (-xOffset - 1), (double) (-1 + yOffset), 0.0D);
        tessellator.addVertex((double) (-xOffset - 1), (double) (8 + yOffset), 0.0D);
        tessellator.addVertex((double) (xOffset + 1), (double) (8 + yOffset), 0.0D);
        tessellator.addVertex((double) (xOffset + 1), (double) (-1 + yOffset), 0.0D);
        tessellator.draw();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        int color = 553648127;
        int color2 = -1;
        if (hostile) {
            color = 0xffff0000;
            color2 = 0xffff0000;
        }
        fontRenderer.drawString(par2Str, -fontRenderer.getStringWidth(par2Str) / 2, yOffset, color);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDepthMask(true);
        fontRenderer.drawString(par2Str, -fontRenderer.getStringWidth(par2Str) / 2, yOffset, color2);//was-1
        if (!hostile && Settings.getRenderNpcObjectives()) {
            renderObjectiveIcon(npc.getAIObjectiveID());
            renderTaskIcon(npc.getAITaskID());
            //      renderErrorIcon(npc.getAIErrorID());
        }
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glPopMatrix();
    }
}

From source file:shadowmage.ancient_warfare.client.render.RenderVehicleHelper.java

License:Open Source License

private void renderNamePlate(VehicleBase vehicle, double par3, double par5, double par7, float yaw,
        float tick) {
    double var10 = vehicle.getDistanceSqToEntity(this.renderManager.livingPlayer);
    int par9 = 64;
    String par2Str = vehicle.vehicleType.getLocalizedName() + " " + formatter1d.format(vehicle.getHealth())
            + "/" + formatter1d.format(vehicle.baseHealth);
    if (var10 <= (double) (par9 * par9)) {
        FontRenderer var12 = this.getFontRendererFromRenderManager();
        float var13 = 1.6F;
        float var14 = 0.016666668F * var13;
        float namePlateHeight = vehicle.height + 0.75f;
        GL11.glPushMatrix();//  www  . jav  a2s. co m
        GL11.glTranslatef((float) par3 + 0.0F, (float) par5 + namePlateHeight, (float) par7);
        GL11.glNormal3f(0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
        GL11.glScalef(-var14, -var14, var14);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDepthMask(false);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        Tessellator var15 = Tessellator.instance;
        byte var16 = 0;
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        var15.startDrawingQuads();
        int var17 = var12.getStringWidth(par2Str) / 2;
        var15.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
        var15.addVertex((double) (-var17 - 1), (double) (-1 + var16), 0.0D);
        var15.addVertex((double) (-var17 - 1), (double) (8 + var16), 0.0D);
        var15.addVertex((double) (var17 + 1), (double) (8 + var16), 0.0D);
        var15.addVertex((double) (var17 + 1), (double) (-1 + var16), 0.0D);
        var15.draw();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        var12.drawString(par2Str, -var12.getStringWidth(par2Str) / 2, var16, 553648127);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDepthMask(true);
        var12.drawString(par2Str, -var12.getStringWidth(par2Str) / 2, var16, -1);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glPopMatrix();
    }
}

From source file:sophisticated_wolves.RenderSophisticatedWolf.java

License:LGPL

public void renderWolfName(EntitySophisticatedWolf wolf, double d, double d1, double d2) {
    float f = 1.6F;
    float f1 = 0.01666667F * f;
    float f2 = wolf.getDistanceToEntity(this.renderManager.livingPlayer);
    float f3 = wolf.isSitting() ? 32 : 64;
    if (f2 < f3) {
        String wolfName = wolf.getCustomNameTag();
        FontRenderer fontRenderer = this.getFontRendererFromRenderManager();
        GL11.glPushMatrix();//from   ww  w  .  jav  a2s.  com
        GL11.glTranslatef((float) d, (float) d1 + 1.5F, (float) d2);
        GL11.glNormal3f(0, 1, 0);
        GL11.glRotatef(-this.renderManager.playerViewY, 0, 1, 0);
        GL11.glRotatef(this.renderManager.playerViewX, 1, 0, 0);
        GL11.glScalef(-f1, -f1, f1);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glTranslatef(0, 0.25F / f1, 0);
        GL11.glDepthMask(false);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldRenderer = tessellator.getWorldRenderer();
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        worldRenderer.startDrawingQuads();
        int var16 = fontRenderer.getStringWidth(wolfName) / 2;
        worldRenderer.setColorRGBA_F(0, 0, 0, 0.25F);
        worldRenderer.addVertex(-var16 - 1, -1, 0);
        worldRenderer.addVertex(-var16 - 1, 8, 0);
        worldRenderer.addVertex(var16 + 1, 8, 0);
        worldRenderer.addVertex(var16 + 1, -1, 0);
        tessellator.draw();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        if (!wolf.isSitting()) {
            fontRenderer.drawString(wolfName, -fontRenderer.getStringWidth(wolfName) / 2, 0,
                    getSitNameColor(wolf));
            GL11.glEnable(GL11.GL_DEPTH_TEST);
            GL11.glDepthMask(true);
            fontRenderer.drawString(wolfName, -fontRenderer.getStringWidth(wolfName) / 2, 0,
                    getWolfNameColor(wolf));
        } else {
            GL11.glDepthMask(true);
            fontRenderer.drawString(wolfName, -fontRenderer.getStringWidth(wolfName) / 2, 0,
                    getSitNameColor(wolf));
        }
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glPopMatrix();
    }
}

From source file:sqr.client.render.RenderFakePlayer.java

License:Open Source License

protected void renderLivingLabel(Entity entity, String text, double posX, double posY, double posZ,
        int visibleDistance) {
    final double distanceSq = entity.getDistanceSqToEntity(renderManager.livingPlayer);

    if (distanceSq <= visibleDistance * visibleDistance) {
        final EntityFakePlayer fakePlayer = (EntityFakePlayer) entity;
        final FontRenderer fontRenderer = getFontRendererFromRenderManager();
        final float labelScale = 0.0268F;

        GL11.glPushMatrix();/*  w  w w  . j  a  v  a 2 s .  co m*/
        {
            GL11.glTranslatef((float) posX + 0.0F, (float) posY + entity.height + 0.5F, (float) posZ);
            GL11.glNormal3f(0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
            GL11.glScalef(-labelScale, -labelScale, labelScale);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glDepthMask(false);
            GL11.glDisable(GL11.GL_DEPTH_TEST);
            GL11.glEnable(GL11.GL_BLEND);

            OpenGlHelper.glBlendFunc(770, 771, 1, 0);

            GL11.glDisable(GL11.GL_TEXTURE_2D);

            final Tessellator tessellator = Tessellator.instance;
            tessellator.startDrawingQuads();
            tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);

            final int halfStringWidth = fontRenderer.getStringWidth(text) / 2;
            tessellator.addVertex(-halfStringWidth - 1, -1, 0.0D);
            tessellator.addVertex(-halfStringWidth - 1, 8, 0.0D);
            tessellator.addVertex(halfStringWidth + 1, 8, 0.0D);
            tessellator.addVertex(halfStringWidth + 1, -1, 0.0D);
            tessellator.draw();

            GL11.glEnable(GL11.GL_TEXTURE_2D);
            fontRenderer.drawString(text, -fontRenderer.getStringWidth(text) / 2, 0, 553648127);

            GL11.glEnable(GL11.GL_DEPTH_TEST);
            GL11.glDepthMask(true);

            if (fakePlayer.isContributor) {
                fontRenderer.drawString(Color.YELLOW + Format.ITALIC + text,
                        -fontRenderer.getStringWidth(text) / 2, 0, -1);
            }

            else {
                fontRenderer.drawString(text, -fontRenderer.getStringWidth(text) / 2, 0, -1);
            }

            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        }
        GL11.glPopMatrix();
    }
}

From source file:sqr.client.render.RenderWeb.java

License:Open Source License

public void render(EntityWeb entityWeb, double posX, double posY, double posZ, float rotationYaw,
        float rotationPitch) {
    bindEntityTexture(entityWeb);// w ww.  ja v  a2s  . c o  m

    GL11.glPushMatrix();
    {
        final Tessellator tessellator = Tessellator.instance;

        GL11.glTranslated(posX, posY, posZ);
        GL11.glRotatef(entityWeb.prevRotationYaw
                + (entityWeb.rotationYaw - entityWeb.prevRotationYaw) * rotationYaw - 90.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(
                entityWeb.prevRotationPitch
                        + (entityWeb.rotationPitch - entityWeb.prevRotationPitch) * rotationYaw,
                0.0F, 0.0F, 1.0F);

        final byte b0 = 0;
        final float f2 = 0.0F;
        final float f3 = 0.5F;
        final float f4 = (0 + b0 * 10) / 32.0F;
        final float f5 = (5 + b0 * 10) / 32.0F;
        final float f6 = 0.0F;
        final float f7 = 0.15625F;
        final float f8 = (5 + b0 * 10) / 32.0F;
        final float f9 = (10 + b0 * 10) / 32.0F;
        final 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, f6, f8);
        tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f8);
        tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f9);
        tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f9);
        tessellator.draw();

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

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

From source file:src.graphics.space.Starfield.java

License:Open Source License

private void axisWithTransform(Mat3D transform, Texture tex, float radius) {
    final Vec3D tV = new Vec3D();
    tex.bindTex();/*from  w  w w .j  a v  a  2 s .  com*/

    GL11.glBegin(GL11.GL_QUADS);

    GL11.glNormal3f(0, 0, 0);

    transform.trans(tV.set(-1, -1, 0)).scale(1.1f * radius);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex3f(tV.x, tV.y, tV.z);

    transform.trans(tV.set(1, -1, 0)).scale(1.1f * radius);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex3f(tV.x, tV.y, tV.z);

    transform.trans(tV.set(1, 1, 0)).scale(1.1f * radius);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex3f(tV.x, tV.y, tV.z);

    transform.trans(tV.set(-1, 1, 0)).scale(1.1f * radius);
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex3f(tV.x, tV.y, tV.z);

    GL11.glEnd();
}

From source file:steamcraft.client.renderers.entity.RenderGrapplingHook.java

License:Minecraft Mod Public

public void renderBullet(EntityGrapplingHook entity, double dx, double dy, double dz, float frotY,
        float frotP) {
    this.bindEntityTexture(entity);

    if ((entity.prevRotationYaw == 0.0F) && (entity.prevRotationPitch == 0.0F))
        return;//from  w  w w.  j a  v  a2s .  com

    GL11.glPushMatrix();
    GL11.glTranslatef((float) dx, (float) dy, (float) dz);
    GL11.glRotatef((entity.prevRotationYaw + ((entity.rotationYaw - entity.prevRotationYaw) * frotP)) - 90F,
            0.0F, 1.0F, 0.0F);
    GL11.glRotatef(entity.prevRotationPitch + ((entity.rotationPitch - entity.prevRotationPitch) * frotP), 0.0F,
            0.0F, 1.0F);
    Tessellator tessellator = Tessellator.instance;
    int i = 0;
    float f2 = 0.0F;
    float f3 = 0.5F;
    float f4 = (0 + (i * 10)) / 32F;
    float f5 = (5 + (i * 10)) / 32F;
    float f6 = 0.0F;
    float f7 = 0.15625F;
    float f8 = (5 + (i * 10)) / 32F;
    float f9 = (10 + (i * 10)) / 32F;
    float f10 = 0.3F;
    GL11.glEnable(32826 /* GL_RESCALE_NORMAL_EXT */);
    float f11 = 1.0F - frotP;

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

    GL11.glRotatef(45F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(f10, f10, f10);
    GL11.glTranslatef(-4F, 0.0F, 0.0F);
    GL11.glNormal3f(f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7D, -2D, -2D, f6, f8);
    tessellator.addVertexWithUV(-7D, -2D, 2D, f7, f8);
    tessellator.addVertexWithUV(-7D, 2D, 2D, f7, f9);
    tessellator.addVertexWithUV(-7D, 2D, -2D, f6, f9);
    tessellator.draw();
    GL11.glNormal3f(-f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7D, 2D, -2D, f6, f8);
    tessellator.addVertexWithUV(-7D, 2D, 2D, f7, f8);
    tessellator.addVertexWithUV(-7D, -2D, 2D, f7, f9);
    tessellator.addVertexWithUV(-7D, -2D, -2D, f6, f9);
    tessellator.draw();

    for (int j = 0; j < 4; j++) {
        GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
        GL11.glNormal3f(0.0F, 0.0F, f10);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-8D, -2D, 0.0D, f2, f4);
        tessellator.addVertexWithUV(8D, -2D, 0.0D, f3, f4);
        tessellator.addVertexWithUV(8D, 2D, 0.0D, f3, f5);
        tessellator.addVertexWithUV(-8D, 2D, 0.0D, f2, f5);
        tessellator.draw();
    }

    GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
    GL11.glPopMatrix();
}

From source file:steamcraft.client.renderers.tile.TileCastIronLampRenderer.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity te, double dx, double dy, double dz, float scale) {
    Block block = te.getBlockType();// ww w. j a  v a  2s  . com
    int metadata = te.getBlockMetadata();
    GL11.glPushMatrix();
    float f1 = 0.6666667F;
    float f2 = 0.0F;

    if ((metadata == 1) || (metadata == 4)) {
        f2 = 180F;
    }

    if (metadata == 2) {
        f2 = 90F;
    }

    if (metadata == 3) {
        f2 = -90F;
    }

    GL11.glTranslatef((float) dx + 0.5F, (float) dy + (0.75F * f1), (float) dz + 0.5F);
    GL11.glRotatef(f2, 0.0F, 1.0F, 0.0F);

    GL11.glTranslatef(0.0F, -0.3125F, -0.4375F);

    if ((block == InitBlocks.blockCastIronLampOn) || (block == InitBlocks.blockInvertedCastIronLamp)) {
        ClientHelper.textureManager().bindTexture(lampOn);
    } else if ((block == InitBlocks.blockCastIronLamp) || (block == InitBlocks.blockInvertedCastIronLampOff)) {
        ClientHelper.textureManager().bindTexture(lampOff);
    }

    GL11.glPushMatrix();
    GL11.glScalef(f1, -f1, -f1);

    if ((metadata == 0) || (metadata == 1)) {
        this.lampModelTop.renderLamp();
    } else {
        this.lampModelSide.renderLamp();
        this.lampModelSide.bracket.showModel = true;
        this.lampModelSide.bracket2.showModel = true;
    }

    GL11.glPopMatrix();
    float f4 = 0.01666667F * f1;
    GL11.glTranslatef(0.0F, 0.5F * f1, 0.07F * f1);
    GL11.glScalef(f4, -f4, f4);
    GL11.glNormal3f(0.0F, 0.0F, -1F * f4);
    GL11.glDepthMask(false);
    GL11.glDepthMask(true);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}