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:model.Triangle.java

License:Open Source License

public void draw() {
    if (tex[0] != null)
        GL11.glTexCoord2f(tex[0].x, tex[0].y);
    GL11.glNormal3f(norm[0].x, norm[0].y, norm[0].z);
    GL11.glVertex3f(pos[0].x, pos[0].y, pos[0].z);
    if (tex[1] != null)
        GL11.glTexCoord2f(tex[1].x, tex[1].y);
    GL11.glNormal3f(norm[1].x, norm[1].y, norm[1].z);
    GL11.glVertex3f(pos[1].x, pos[1].y, pos[1].z);
    if (tex[2] != null)
        GL11.glTexCoord2f(tex[2].x, tex[2].y);
    GL11.glNormal3f(norm[2].x, norm[2].y, norm[2].z);
    GL11.glVertex3f(pos[2].x, pos[2].y, pos[2].z);
}

From source file:mods.railcraft.client.render.RenderTools.java

License:Open Source License

public static void renderString(String name, double xOffset, double yOffset, double zOffset) {
    RenderManager rm = RenderManager.instance;
    FontRenderer fontrenderer = rm.getFontRenderer();
    float f = 1.6F;
    float f1 = 1 / 60F * f;
    GL11.glPushMatrix();/*from   w ww  .  j  av  a  2s .  c o  m*/
    GL11.glTranslatef((float) xOffset, (float) yOffset, (float) zOffset);
    GL11.glNormal3f(0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-rm.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(rm.playerViewX, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(-f1, -f1, f1);
    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);
    Tessellator tessellator = Tessellator.instance;

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    tessellator.startDrawingQuads();
    int j = fontrenderer.getStringWidth(name) / 2;
    tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
    tessellator.addVertex((double) (-j - 1), (double) -1, 0.0D);
    tessellator.addVertex((double) (-j - 1), (double) 8, 0.0D);
    tessellator.addVertex((double) (j + 1), (double) 8, 0.0D);
    tessellator.addVertex((double) (j + 1), (double) -1, 0.0D);
    tessellator.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    fontrenderer.drawString(name, -fontrenderer.getStringWidth(name) / 2, 0, 553648127);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    fontrenderer.drawString(name, -fontrenderer.getStringWidth(name) / 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:net.mechanicalcat.pycode.obj.Model.java

License:Open Source License

public void genList() {
    this.glList = GL11.glGenLists(1);
    GL11.glNewList(this.glList, GL11.GL_COMPILE);
    //        if use_texture: glEnable(GL_TEXTURE_2D)
    GL11.glFrontFace(GL11.GL_CCW);/*from   w  ww.  jav a 2 s .  com*/
    GL11.glEnable(GL11.GL_CULL_FACE);

    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
    GL11.glDepthFunc(GL11.GL_LESS);
    GL11.glCullFace(GL11.GL_BACK);
    String currentMaterial = "";
    Material mtl;
    for (Face face : this.faces) {
        if (!face.material.equals(currentMaterial)) {
            currentMaterial = face.material;
            mtl = this.materials.get(face.material);
            if (mtl == null) {
                GL11.glColor3f(1, 1, 1);
            } else {
                //                    if 'texture_Kd' in mtl:
                //                    # use diffuse texmap
                //                    glBindTexture(GL_TEXTURE_2D, mtl['texture_Kd'])
                GL11.glColor3f(mtl.diffuse.x, mtl.diffuse.y, mtl.diffuse.z);
            }
        }

        GL11.glBegin(GL11.GL_POLYGON);
        for (int i = 0; i < face.vertexes.size(); i++) {
            if (face.normals.get(i) != 0) {
                Vector3f n = this.normals.get(face.normals.get(i));
                GL11.glNormal3f(n.x, n.y, n.z);
            }
            //                if texture_coords[i]:
            //                    glTexCoord2fv(self.texcoords[texture_coords[i] - 1])
            Vector3f v = this.vertices.get(face.vertexes.get(i));
            GL11.glVertex3f(v.x, v.y, v.z);
        }
        GL11.glEnd();
    }

    GL11.glCullFace(GL11.GL_BACK);
    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);

    GL11.glDisable(GL11.GL_CULL_FACE);

    //      if use_texture: glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEndList();
}

From source file:net.minecraft.src.wirelessredstone.presentation.TileEntityRedstoneWirelessRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) {
    try {//  w  ww .j  av a2s  .  c o m
        float f4 = 0.01F;

        GL11.glPushMatrix();
        GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 1F + f4);
        GL11.glScalef(f4, -f4, f4);
        GL11.glNormal3f(0.0F, 0.0F, -1F * f4);

        renderFreq((TileEntityRedstoneWireless) tileentity);
        GL11.glPopMatrix();

        GL11.glPushMatrix();
        GL11.glTranslatef((float) d + 1F + f4, (float) d1 + 1.5F, (float) d2 + 0.5F);
        GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(f4, -f4, f4);
        GL11.glNormal3f(0.0F, 0.0F, -1F * f4);

        renderFreq((TileEntityRedstoneWireless) tileentity);
        GL11.glPopMatrix();

        GL11.glPushMatrix();
        GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 - f4);
        GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(f4, -f4, f4);
        GL11.glNormal3f(0.0F, 0.0F, 1F * f4);

        renderFreq((TileEntityRedstoneWireless) tileentity);
        GL11.glPopMatrix();

        GL11.glPushMatrix();
        GL11.glTranslatef((float) d - f4, (float) d1 + 1.5F, (float) d2 + 0.5F);
        GL11.glRotatef(270F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(f4, -f4, f4);
        GL11.glNormal3f(0.0F, 0.0F, -1F * f4);

        renderFreq((TileEntityRedstoneWireless) tileentity);
        GL11.glPopMatrix();
    } catch (Exception e) {
        LoggerRedstoneWireless.getInstance("WirelessRedstone: " + this.getClass().toString())
                .writeStackTrace(e);
    }
}

From source file:net.shadowmage.ancientwarfare.core.model.PrimitiveBox.java

License:Open Source License

@Override
protected void renderPrimitive(float tw, float th) {
    float px = 1.f / tw;
    float py = 1.f / th;
    float w = (float) Math.ceil((x2 - x1) * 16.f);
    float h = (float) Math.ceil((y2 - y1) * 16.f);
    float l = (float) Math.ceil((z2 - z1) * 16.f);
    float ty = this.ty();
    float tx = this.tx();

    float tx1, ty1, tx2, ty2;
    if (w < 1) {
        w = 1;/*from ww  w.  ja  v  a 2  s  .c o m*/
    }
    if (h < 1) {
        h = 1;
    }
    if (l < 1) {
        l = 1;
    }

    //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);
    }
    if (ry != 0) {
        GL11.glRotatef(ry, 0, 1, 0);
    }
    if (rz != 0) {
        GL11.glRotatef(rz, 0, 0, 1);
    }

    GL11.glBegin(GL11.GL_QUADS);

    //front side  
    tx1 = (tx + l) * px;
    ty1 = (th - (ty + l + h)) * py;
    tx2 = (tx + l + w) * px;
    ty2 = (th - (ty + l)) * py;
    ty1 = 1.f - ty1;
    ty2 = 1.f - ty2;
    GL11.glNormal3f(0, 0, 1);
    GL11.glTexCoord2f(tx1, ty1);
    GL11.glVertex3f(x1, y1, z2);
    GL11.glTexCoord2f(tx2, ty1);
    GL11.glVertex3f(x2, y1, z2);
    GL11.glTexCoord2f(tx2, ty2);
    GL11.glVertex3f(x2, y2, z2);
    GL11.glTexCoord2f(tx1, ty2);
    GL11.glVertex3f(x1, y2, z2);

    ////rear side
    tx1 = (tx + l + l + w) * px;
    ty1 = (th - (ty + l + h)) * py;
    tx2 = (tx + l + w + l + w) * px;
    ty2 = (th - (ty + l)) * py;
    ty1 = 1.f - ty1;
    ty2 = 1.f - ty2;
    GL11.glNormal3f(0, 0, -1);
    GL11.glTexCoord2f(tx1, ty1);
    GL11.glVertex3f(x2, y1, z1);
    GL11.glTexCoord2f(tx2, ty1);
    GL11.glVertex3f(x1, y1, z1);
    GL11.glTexCoord2f(tx2, ty2);
    GL11.glVertex3f(x1, y2, z1);
    GL11.glTexCoord2f(tx1, ty2);
    GL11.glVertex3f(x2, y2, z1);

    //right side
    tx1 = (tx + l + w) * px;
    ty1 = (th - (ty + l + h)) * py;
    tx2 = (tx + l + w + l) * px;
    ty2 = (th - (ty + l)) * py;
    ty1 = 1.f - ty1;
    ty2 = 1.f - ty2;
    GL11.glNormal3f(-1, 0, 0);
    GL11.glTexCoord2f(tx1, ty1);
    GL11.glVertex3f(x1, y1, z1);
    GL11.glTexCoord2f(tx2, ty1);
    GL11.glVertex3f(x1, y1, z2);
    GL11.glTexCoord2f(tx2, ty2);
    GL11.glVertex3f(x1, y2, z2);
    GL11.glTexCoord2f(tx1, ty2);
    GL11.glVertex3f(x1, y2, z1);

    //  //left side
    tx1 = (tx) * px;
    ty1 = (th - (ty + l + h)) * py;
    tx2 = (tx + l) * px;
    ty2 = (th - (ty + l)) * py;
    ty1 = 1.f - ty1;
    ty2 = 1.f - ty2;
    GL11.glNormal3f(1, 0, 0);
    GL11.glTexCoord2f(tx1, ty1);
    GL11.glVertex3f(x2, y1, z2);
    GL11.glTexCoord2f(tx2, ty1);
    GL11.glVertex3f(x2, y1, z1);
    GL11.glTexCoord2f(tx2, ty2);
    GL11.glVertex3f(x2, y2, z1);
    GL11.glTexCoord2f(tx1, ty2);
    GL11.glVertex3f(x2, y2, z2);

    //  //top side
    tx1 = (tx + l) * px;
    ty1 = (th - (ty + l)) * py;
    tx2 = (tx + l + w) * px;
    ty2 = (th - (ty)) * py;
    ty1 = 1.f - ty1;
    ty2 = 1.f - ty2;
    GL11.glNormal3f(0, 1, 0);
    GL11.glTexCoord2f(tx1, ty1);
    GL11.glVertex3f(x2, y2, z1);
    GL11.glTexCoord2f(tx2, ty1);
    GL11.glVertex3f(x1, y2, z1);
    GL11.glTexCoord2f(tx2, ty2);
    GL11.glVertex3f(x1, y2, z2);
    GL11.glTexCoord2f(tx1, ty2);
    GL11.glVertex3f(x2, y2, z2);

    //  //bottom side
    tx1 = (tx + l + w) * px;
    ty1 = (th - (ty + l)) * py;
    tx2 = (tx + l + w + w) * px;
    ty2 = (th - (ty)) * py;
    ty1 = 1.f - ty1;
    ty2 = 1.f - ty2;
    GL11.glNormal3f(0, -1, 0);
    GL11.glTexCoord2f(tx1, ty1);
    GL11.glVertex3f(x2, y1, z2);
    GL11.glTexCoord2f(tx2, ty1);
    GL11.glVertex3f(x1, y1, z2);
    GL11.glTexCoord2f(tx2, ty2);
    GL11.glVertex3f(x1, y1, z1);
    GL11.glTexCoord2f(tx1, ty2);
    GL11.glVertex3f(x2, y1, z1);

    GL11.glEnd();
}

From source file:net.shadowmage.ancientwarfare.core.model.PrimitiveQuad.java

License:Open Source License

@Override
protected void renderPrimitive(float tw, float th) {
    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  2 s .c  om
    }
    if (ry != 0) {
        GL11.glRotatef(ry, 0, 1, 0);
    }
    if (rz != 0) {
        GL11.glRotatef(rz, 0, 0, 1);
    }

    GL11.glBegin(GL11.GL_QUADS);

    //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:net.shadowmage.ancientwarfare.core.model.PrimitiveTriangle.java

License:Open Source License

@Override
protected void renderPrimitive(float tw, float th) {
    if (rx != 0) {
        GL11.glRotatef(rx, 1, 0, 0);//from w  w  w  . j av a2s  .  c  o  m
    }
    if (ry != 0) {
        GL11.glRotatef(ry, 0, 1, 0);
    }
    if (rz != 0) {
        GL11.glRotatef(rz, 0, 0, 1);
    }

    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:net.slimevoid.wirelessredstone.client.presentation.TileEntityRedstoneWirelessRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) {
    try {/*from w ww . j av a  2  s.c om*/
        float f4 = 0.01F;

        GL11.glPushMatrix();
        GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 1F + f4);
        GL11.glScalef(f4, -f4, f4);
        GL11.glNormal3f(0.0F, 0.0F, -1F * f4);

        renderFreq((TileEntityRedstoneWireless) tileentity);
        GL11.glPopMatrix();

        GL11.glPushMatrix();
        GL11.glTranslatef((float) d + 1F + f4, (float) d1 + 1.5F, (float) d2 + 0.5F);
        GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(f4, -f4, f4);
        GL11.glNormal3f(0.0F, 0.0F, -1F * f4);

        renderFreq((TileEntityRedstoneWireless) tileentity);
        GL11.glPopMatrix();

        GL11.glPushMatrix();
        GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 - f4);
        GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(f4, -f4, f4);
        GL11.glNormal3f(0.0F, 0.0F, 1F * f4);

        renderFreq((TileEntityRedstoneWireless) tileentity);
        GL11.glPopMatrix();

        GL11.glPushMatrix();
        GL11.glTranslatef((float) d - f4, (float) d1 + 1.5F, (float) d2 + 0.5F);
        GL11.glRotatef(270F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(f4, -f4, f4);
        GL11.glNormal3f(0.0F, 0.0F, -1F * f4);

        renderFreq((TileEntityRedstoneWireless) tileentity);
        GL11.glPopMatrix();
    } catch (Exception e) {
        LoggerRedstoneWireless.getInstance("TileEntityRedstoneWirelessRenderer").writeStackTrace(e);
    }
}

From source file:net.smert.frameworkgl.opengl.helpers.LegacyRenderHelper.java

License:Apache License

public void normal(float x, float y, float z) {
    GL11.glNormal3f(x, y, z);
}

From source file:org.blockartistry.mod.DynSurround.client.storm.StormRenderer.java

License:MIT License

/**
 * Render RAIN and snow/*from  w  w  w. j  a va  2  s.c om*/
 */
public void render(final EntityRenderer renderer, final float partialTicks) {

    StormProperties.setTextures();
    final World world = renderer.mc.theWorld;

    IRenderHandler r = world.provider.getWeatherRenderer();
    if (r != null) {
        r.render(partialTicks, (WorldClient) world, renderer.mc);
        return;
    }

    if (!DimensionRegistry.hasWeather(world))
        return;

    final float rainStrength = world.getRainStrength(partialTicks);
    if (rainStrength <= 0.0F)
        return;

    final float alphaRatio;
    if (StormProperties.getIntensityLevel() > 0.0F)
        alphaRatio = world.rainingStrength / StormProperties.getIntensityLevel();
    else
        alphaRatio = rainStrength;

    renderer.enableLightmap();

    final Entity entity = renderer.mc.getRenderViewEntity();
    final int playerX = MathHelper.floor_double(entity.posX);
    final int playerY = MathHelper.floor_double(entity.posY);
    final int playerZ = MathHelper.floor_double(entity.posZ);
    final Tessellator tess = Tessellator.getInstance();
    final VertexBuffer worldrenderer = tess.getBuffer();

    GlStateManager.disableCull();
    GL11.glNormal3f(0.0F, 1.0F, 0.0F);
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.alphaFunc(516, 0.1F);

    final double spawnX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks;
    final double spawnY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks;
    final double spawnZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;

    final int locY = MathHelper.floor_double(spawnY);
    final int range = renderer.mc.gameSettings.fancyGraphics ? 10 : 5;

    int j1 = -1;
    float f1 = (float) renderer.rendererUpdateCount + partialTicks;
    worldrenderer.setTranslation(-spawnX, -spawnY, -spawnZ);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    BlockPos.MutableBlockPos mutable = new BlockPos.MutableBlockPos();

    for (int gridZ = playerZ - range; gridZ <= playerZ + range; ++gridZ) {
        for (int gridX = playerX - range; gridX <= playerX + range; ++gridX) {
            final int idx = (gridZ - playerZ + 16) * 32 + gridX - playerX + 16;
            final double rainX = (double) RAIN_X_COORDS[idx] * 0.5D;
            final double rainY = (double) RAIN_Y_COORDS[idx] * 0.5D;
            mutable.setPos(gridX, 0, gridZ);
            final BiomeInfo biome = BiomeRegistry.get(world.getBiome(mutable));
            final boolean hasDust = biome.getHasDust();

            if (hasDust || biome.getHasPrecipitation()) {
                final int precipHeight = getPrecipitationHeight(world, mutable).getY();
                int k2 = playerY - range;
                int l2 = playerY + range;

                if (k2 < precipHeight) {
                    k2 = precipHeight;
                }

                if (l2 < precipHeight) {
                    l2 = precipHeight;
                }

                int i3 = precipHeight;

                if (precipHeight < locY) {
                    i3 = locY;
                }

                if (k2 != l2) {
                    random.setSeed((long) (gridX * gridX * 3121 + gridX * 45238971
                            ^ gridZ * gridZ * 418711 + gridZ * 13761));
                    mutable.setPos(gridX, k2, gridZ);
                    final float biomeTemp = biome.getFloatTemperature(mutable);
                    final float heightTemp = world.getBiomeProvider().getTemperatureAtHeight(biomeTemp,
                            precipHeight);

                    if (!hasDust && heightTemp >= 0.15F) {
                        if (j1 != 0) {
                            if (j1 >= 0) {
                                tess.draw();
                            }

                            j1 = 0;
                            renderer.mc.getTextureManager().bindTexture(locationRainPng);
                            worldrenderer.begin(GL11.GL_QUADS,
                                    DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
                        }

                        double d5 = ((double) (renderer.rendererUpdateCount + gridX * gridX * 3121
                                + gridX * 45238971 + gridZ * gridZ * 418711 + gridZ * 13761 & 31)
                                + (double) partialTicks) / 32.0D * (3.0D + random.nextDouble());
                        double d6 = (double) ((float) gridX + 0.5F) - entity.posX;
                        double d7 = (double) ((float) gridZ + 0.5F) - entity.posZ;
                        float f3 = MathHelper.sqrt_double(d6 * d6 + d7 * d7) / (float) range;
                        float f4 = ((1.0F - f3 * f3) * 0.5F + 0.5F) * alphaRatio;
                        mutable.setPos(gridX, i3, gridZ);
                        int j3 = world.getCombinedLight(mutable, 0);
                        int k3 = j3 >> 16 & 65535;
                        int l3 = j3 & 65535;
                        worldrenderer
                                .pos((double) gridX - rainX + 0.5D, (double) k2, (double) gridZ - rainY + 0.5D)
                                .tex(0.0D, (double) k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4)
                                .lightmap(k3, l3).endVertex();
                        worldrenderer
                                .pos((double) gridX + rainX + 0.5D, (double) k2, (double) gridZ + rainY + 0.5D)
                                .tex(1.0D, (double) k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4)
                                .lightmap(k3, l3).endVertex();
                        worldrenderer
                                .pos((double) gridX + rainX + 0.5D, (double) l2, (double) gridZ + rainY + 0.5D)
                                .tex(1.0D, (double) l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4)
                                .lightmap(k3, l3).endVertex();
                        worldrenderer
                                .pos((double) gridX - rainX + 0.5D, (double) l2, (double) gridZ - rainY + 0.5D)
                                .tex(0.0D, (double) l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4)
                                .lightmap(k3, l3).endVertex();
                    } else {
                        if (j1 != 1) {
                            if (j1 >= 0) {
                                tess.draw();
                            }

                            // If cold enough the dust texture will be
                            // snow that blows sideways
                            ResourceLocation texture = locationSnowPng;
                            if (hasDust && heightTemp >= 0.15F)
                                texture = locationDustPng;

                            j1 = 1;
                            renderer.mc.getTextureManager().bindTexture(texture);
                            // GL_QUADS == 7
                            worldrenderer.begin(GL11.GL_QUADS,
                                    DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
                        }

                        Color color = new Color(1.0F, 1.0F, 1.0F);
                        if (world.provider.getDimension() == -1) {
                            final Color c = biome.getDustColor();
                            if (color != null)
                                color.mix(c);
                        }

                        double d8 = (double) (((float) (renderer.rendererUpdateCount & 511) + partialTicks)
                                / 512.0F);
                        // The 0.2F factor was originally 0.01F. It
                        // affects the horizontal
                        // movement of particles, which works well for
                        // dust.
                        final float factor = hasDust ? 0.2F : 0.01F;
                        double d9 = random.nextDouble()
                                + (double) f1 * factor * (double) ((float) random.nextGaussian());
                        double d10 = random.nextDouble()
                                + (double) (f1 * (float) random.nextGaussian()) * 0.001D;
                        double d11 = (double) ((float) gridX + 0.5F) - entity.posX;
                        double d12 = (double) ((float) gridZ + 0.5F) - entity.posZ;
                        float f6 = MathHelper.sqrt_double(d11 * d11 + d12 * d12) / (float) range;
                        float f5 = ((1.0F - f6 * f6) * 0.3F + 0.5F) * alphaRatio;
                        mutable.setPos(gridX, i3, gridZ);
                        int i4 = (world.getCombinedLight(mutable, 0) * 3 + 15728880) / 4;
                        int j4 = i4 >> 16 & 65535;
                        int k4 = i4 & 65535;
                        worldrenderer
                                .pos((double) gridX - rainX + 0.5D, (double) k2, (double) gridZ - rainY + 0.5D)
                                .tex(0.0D + d9, (double) k2 * 0.25D + d8 + d10)
                                .color(color.red, color.green, color.blue, f5).lightmap(j4, k4).endVertex();
                        worldrenderer
                                .pos((double) gridX + rainX + 0.5D, (double) k2, (double) gridZ + rainY + 0.5D)
                                .tex(1.0D + d9, (double) k2 * 0.25D + d8 + d10)
                                .color(color.red, color.green, color.blue, f5).lightmap(j4, k4).endVertex();
                        worldrenderer
                                .pos((double) gridX + rainX + 0.5D, (double) l2, (double) gridZ + rainY + 0.5D)
                                .tex(1.0D + d9, (double) l2 * 0.25D + d8 + d10)
                                .color(color.red, color.green, color.blue, f5).lightmap(j4, k4).endVertex();
                        worldrenderer
                                .pos((double) gridX - rainX + 0.5D, (double) l2, (double) gridZ - rainY + 0.5D)
                                .tex(0.0D + d9, (double) l2 * 0.25D + d8 + d10)
                                .color(color.red, color.green, color.blue, f5).lightmap(j4, k4).endVertex();
                    }
                }
            }
        }
    }

    if (j1 >= 0) {
        tess.draw();
    }

    worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
    GlStateManager.enableCull();
    GlStateManager.disableBlend();
    GlStateManager.alphaFunc(516, 0.1F);
    renderer.disableLightmap();
}