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:stevekung.mods.moreplanets.planets.fronos.render.entities.RenderPoisonArrow.java

License:Creative Commons License

public void doRender(EntityPoisonArrow entity, double par2, double par3, double par4, float par5, float par6) {
    this.bindEntityTexture(entity);
    GL11.glPushMatrix();//from   w  w  w .  java  2s  .c o  m
    GL11.glTranslatef((float) par2, (float) par3, (float) par4);
    GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par6 - 90.0F, 0.0F,
            1.0F, 0.0F);
    GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par6, 0.0F,
            0.0F, 1.0F);

    Tessellator localTessellator = Tessellator.instance;
    int i = 0;

    float f1 = 0.0F;
    float f2 = 0.5F;
    float f3 = (0 + i * 10) / 32.0F;
    float f4 = (5 + i * 10) / 32.0F;
    float f5 = 0.0F;
    float f6 = 0.15625F;
    float f7 = (5 + i * 10) / 32.0F;
    float f8 = (10 + i * 10) / 32.0F;
    float f9 = 0.05625F;
    GL11.glEnable(32826);
    float f10 = entity.arrowShake - par6;

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

    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(f9, f9, f9);
    GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(f9, 0.0F, 0.0F);
    localTessellator.startDrawingQuads();
    localTessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f5, f7);
    localTessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f6, f7);
    localTessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f6, f8);
    localTessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f5, f8);
    localTessellator.draw();

    GL11.glNormal3f(-f9, 0.0F, 0.0F);
    localTessellator.startDrawingQuads();
    localTessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f5, f7);
    localTessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f6, f7);
    localTessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f6, f8);
    localTessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f5, f8);
    localTessellator.draw();

    for (int j = 0; j < 4; j++) {
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glNormal3f(0.0F, 0.0F, f9);
        localTessellator.startDrawingQuads();
        localTessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, f1, f3);
        localTessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, f2, f3);
        localTessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, f2, f4);
        localTessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, f1, f4);
        localTessellator.draw();
    }
    GL11.glDisable(32826);
    GL11.glPopMatrix();
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glNormal3f(float a, float b, float c) {
    GL11.glNormal3f(a, b, c);
}

From source file:zeldaswordskills.client.render.entity.RenderCustomArrow.java

License:Open Source License

public void renderArrow(EntityArrowCustom arrow, double dx, double dy, double dz, float yaw,
        float partialTick) {
    bindEntityTexture(arrow);/* w  w  w . ja va2  s  . co m*/
    GL11.glPushMatrix();
    GL11.glTranslated(dx, dy, dz);
    GL11.glRotatef(arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * partialTick - 90.0F,
            0.0F, 1.0F, 0.0F);
    GL11.glRotatef(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * partialTick,
            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) arrow.arrowShake - partialTick;

    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:zeldaswordskills.client.render.entity.RenderEntityHookShot.java

License:Open Source License

public void doRender(EntityHookShot entity, double x, double y, double z, float yaw, float partialTick) {
    bindEntityTexture(entity);//w ww  . ja  v  a2  s. co  m
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, z);
    GlStateManager.rotate(
            entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTick - 90.0F, 0.0F,
            1.0F, 0.0F);
    GlStateManager.rotate(
            entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTick, 0.0F,
            0.0F, 1.0F);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer renderer = tessellator.getWorldRenderer();
    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;
    GlStateManager.enableRescaleNormal();
    GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
    GlStateManager.scale(f10, f10, f10);
    GlStateManager.translate(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(f10, 0.0F, 0.0F);
    renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    renderer.pos(-7.0D, -2.0D, -2.0D).tex((double) f4, (double) f6).endVertex();
    renderer.pos(-7.0D, -2.0D, 2.0D).tex((double) f5, (double) f6).endVertex();
    renderer.pos(-7.0D, 2.0D, 2.0D).tex((double) f5, (double) f7).endVertex();
    renderer.pos(-7.0D, 2.0D, -2.0D).tex((double) f4, (double) f7).endVertex();
    tessellator.draw();
    GL11.glNormal3f(-f10, 0.0F, 0.0F);
    renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    renderer.pos(-7.0D, 2.0D, -2.0D).tex((double) f6, (double) f8).endVertex();
    renderer.pos(-7.0D, 2.0D, 2.0D).tex((double) f7, (double) f8).endVertex();
    renderer.pos(-7.0D, -2.0D, 2.0D).tex((double) f7, (double) f9).endVertex();
    renderer.pos(-7.0D, -2.0D, -2.0D).tex((double) f6, (double) f9).endVertex();
    tessellator.draw();
    for (int i = 0; i < 4; ++i) {
        GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glNormal3f(0.0F, 0.0F, f10);
        renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
        renderer.pos(-8.0D, -2.0D, 0.0D).tex((double) f2, (double) f4).endVertex();
        renderer.pos(8.0D, -2.0D, 0.0D).tex((double) f3, (double) f4).endVertex();
        renderer.pos(8.0D, 2.0D, 0.0D).tex((double) f3, (double) f5).endVertex();
        renderer.pos(-8.0D, 2.0D, 0.0D).tex((double) f2, (double) f5).endVertex();
        tessellator.draw();
    }
    GlStateManager.disableRescaleNormal();
    GlStateManager.popMatrix();
    renderLeash(entity, x, y, z, yaw, partialTick);
    super.doRender(entity, x, y, z, yaw, partialTick);
}