Example usage for org.lwjgl.opengl GL11 glShadeModel

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

Introduction

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

Prototype

public static native void glShadeModel(@NativeType("GLenum") int mode);

Source Link

Document

Sets the current shade mode.

Usage

From source file:org.spoutcraft.client.gui.about.GuiAbout.java

License:Open Source License

@Override
public void drawScreen(int x, int y, float z) {
    super.drawBackground(0);
    GL11.glPushMatrix();// w w w .ja  v a2 s. c  o  m

    GL11.glDisable(2896 /*GL_LIGHTING*/);
    GL11.glDisable(2912 /*GL_FOG*/);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    bg.setTopColor(background1);
    bg.setBottomColor(background2);
    bg.setY(30);
    bg.setHeight(this.height - 50);
    bg.setX(0);
    bg.setWidth(this.width - 12);
    bg.render();

    scrollArea.setY(30);
    scrollArea.setHeight(this.height - 50);
    scrollArea.setX(this.width - 12);
    scrollArea.setWidth(16);
    scrollArea.setTopColor(scrollBarColor);
    scrollArea.setBottomColor(scrollBarColor2);
    scrollArea.render();

    // Right half
    int top = 0;
    drawScaledString("What is Spoutcraft?", this.width / 2 - 200, top, 0xffffff);
    top += 10;
    drawScaledString("Spoutcraft is a modification for the", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Minecraft client that plays exactly", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("like the official game. Its goal is", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("to give developers an easy to use", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("platform for building and distributing", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("mods, while providing a rich", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("gameplay experience for users.", this.width / 2 - 200, top, 0x808080);
    top += 10;

    top += 20;

    drawScaledString("What is Spout?", this.width / 2 - 200, top, 0xffffff);
    top += 10;
    drawScaledString("Spout is a Bukkit plugin development", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("platform that allows for previously", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("impossible tasks, such as custom items", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("blocks, mobs, animals, and vehicles. ", this.width / 2 - 200, top, 0x808080);
    top += 10;

    top += 20;

    drawScaledString("Who is SpoutDev?", this.width / 2 - 200, top, 0xffffff);
    top += 10;
    drawScaledString("SpoutDev is the team behind Spout, ", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("SpoutAPI, Spoutcraft,", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("and Spoutcraft Launcher.", this.width / 2 - 200, top, 0x808080);
    top += 10;

    top += 20;

    drawScaledString("Contributors", this.width / 2 - 200, top, 0xffffff);
    top += 10;
    drawScaledString("The Bukkit Team - Bukkit Server API", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("lahwran - Fast Events Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("lahwran - Minimap Logic", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Celtic Minstrel - Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Zeerix - Threading Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Karlthepagan - OptiTick Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Kahr - HD Textures Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Jeckari - Custom Texture Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Rycochet - GUI Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("knowbuddy - GUI Optimizations", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("TomyLobo - Mipmapping Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("Apache Foundation - Code", this.width / 2 - 200, top, 0x808080);
    top += 10;
    drawScaledString("ThVortex - FontRenderer fixes", this.width / 2 - 200, top, 0x808080);
    top += 10;

    // Left half
    top = 0;
    drawScaledString("Sponsors", this.width / 2 + 30, top, 0xffffff);
    top += 10;

    top = 130;

    drawScaledString("Team", this.width / 2 + 30, top, 0xffffff);
    top += 10;
    drawScaledString("Afforess - Lead Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("Wulfspider - Co-Lead & Support", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("alta189 - Co-Lead & Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("Top_Cat - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("raphfrk - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("narrowtux - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("Olloth - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("Rycochet - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("RoyAwesome - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("zml2008 - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("Zidane - Developer", this.width / 2 + 30, top, 0x808080);
    top += 10;

    top += 20;

    drawScaledString("Contact", this.width / 2 + 30, top, 0xffffff);
    top += 10;
    drawScaledString("Email: dev@spout.org", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("Website: spout.org", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("#spout on irc.esper.net", this.width / 2 + 30, top, 0x808080);
    top += 10;

    top += 20;

    drawScaledString("Note", this.width / 2 + 30, top, 0xffffff);
    top += 10;
    drawScaledString("Spoutcraft, Spout, and related", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("projects are open source. You", this.width / 2 + 30, top, 0x808080);
    top += 10;
    drawScaledString("can browse the source code at", this.width / 2 + 30, top, 0x808080);
    top += 10;
    sourceY = top;
    sourceWidth = this.fontRenderer.getStringWidth("https://github.com/SpoutDev");
    drawScaledString("https://github.com/SpoutDev", this.width / 2 + 30, sourceY,
            hoveringLink ? 0x65A5D1 : 0x176093);
    top += 10;

    top += 20;

    int beastNodeX = (this.width / 2 + 30);
    int beastNodeY = getScaledHeight(15);
    if (beastNodeLogo != null) {
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDepthMask(false);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef(beastNodeX, beastNodeY, 0); // Moves texture into place
        SpoutClient.getHandle().renderEngine.bindTexture(beastNodeLogo.getTextureID());
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        Tessellator tessellator = Tessellator.instance;
        //GL11.glScalef(0.5f, 0.5f, 0.5f);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0.0D, 33, -90, 0.0D, 0.0D); // Draw corners
        tessellator.addVertexWithUV(147, 33, -90, beastNodeLogo.getWidth(), 0.0D);
        tessellator.addVertexWithUV(147, 0.0D, -90, beastNodeLogo.getWidth(), beastNodeLogo.getHeight());
        tessellator.addVertexWithUV(0.0D, 0.0D, -90, 0.0D, beastNodeLogo.getHeight());
        tessellator.draw();
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glPopMatrix();
    }

    int minecraftBizX = (this.width / 2 + 30);
    int minecraftBizY = getScaledHeight(85);
    if (minecraftBizLogo != null) {
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDepthMask(false);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef(minecraftBizX, minecraftBizY, 0); // Moves texture into place
        SpoutClient.getHandle().renderEngine.bindTexture(minecraftBizLogo.getTextureID());
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        Tessellator tessellator = Tessellator.instance;
        //GL11.glScalef(0.5f, 0.5f, 0.5f);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0.0D, 33, -90, 0.0D, 0.0D); // Draw corners
        tessellator.addVertexWithUV(147, 33, -90, minecraftBizLogo.getWidth(), 0.0D);
        tessellator.addVertexWithUV(147, 0.0D, -90, minecraftBizLogo.getWidth(), minecraftBizLogo.getHeight());
        tessellator.addVertexWithUV(0.0D, 0.0D, -90, 0.0D, minecraftBizLogo.getHeight());
        tessellator.draw();
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glPopMatrix();
    }

    // Draw tooltips
    if (isInBoundingRect(beastNodeX, beastNodeY, 33, 147, x, y)) {
        drawTooltip("BeastNode provides high quality Minecraft and web hosting at affordable\n"
                + "prices and is generously sponsoring the Spout project with its hosting\n"
                + "& server needs. Mine, build, craft, and chat with your own high quality\n"
                + "Minecraft server with FREE mumble voice server and web hosting.", x, y);
    } else if (isInBoundingRect(minecraftBizX, minecraftBizY, 33, 147, x, y)) {
        drawTooltip("Your Minecraft community in a new dimension!", x, y);
    }

    GL11.glDisable(2896 /*GL_LIGHTING*/);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    SpoutClient.getHandle().renderEngine.bindTexture("/gui/gui.png");
    RenderUtil.drawTexturedModalRectangle(this.width - 14, getInvertedScaledHeight(this.height), 0, 208, 16, 16,
            0f);

    GL11.glDisable(2912 /*GL_FOG*/);
    GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
    this.overlayBackground(0, 30, 255, 255);
    this.overlayBackground(this.height - 50, this.height, 255, 255);
    drawCenteredString(this.fontRenderer, "About", this.width / 2, 16, 0xffffff);
    SpoutClient.getHandle().renderEngine.bindTexture("/title/mclogo.png");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glPushMatrix();
    GL11.glTranslatef((0.0325f * this.width), (this.height - 40), 0);
    GL11.glScalef(0.4f, 0.4f, 0.4f);
    this.drawTexturedModalRect(0, 0, 0, 0, 155, 44);
    this.drawTexturedModalRect(155, 0, 0, 45, 155, 44);
    GL11.glPopMatrix();

    if (spoutcraftTexture != null) {
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthMask(false);
        GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef((this.width - 140), (this.height - 45), 0); // Moves texture into place
        SpoutClient.getHandle().renderEngine.bindTexture(spoutcraftTexture.getTextureID());
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0.0D, 32, -90, 0.0D, 0.0D); // Draw corners
        tessellator.addVertexWithUV(128, 32, -90, spoutcraftTexture.getWidth(), 0.0D);
        tessellator.addVertexWithUV(128, 0.0D, -90, spoutcraftTexture.getWidth(),
                spoutcraftTexture.getHeight());
        tessellator.addVertexWithUV(0.0D, 0.0D, -90, 0.0D, spoutcraftTexture.getHeight());
        tessellator.draw();
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glPopMatrix();
    }

    drawString(this.fontRenderer, "Unknown Version", (int) (this.width * 0.034f), this.height - 20, 0xffffff);
    drawString(this.fontRenderer, "Copyright Mojang AB", (int) (this.width * 0.034f), this.height - 10,
            0x808080);

    String version = SpoutClient.getClientVersion();
    drawString(this.fontRenderer, version,
            (int) (this.width - 45) - fontRenderer.getStringWidth(version) + fontRenderer.getStringWidth("0"),
            this.height - 20, 0xffffff);
    drawString(this.fontRenderer, "Licensed under LGPLv3", (int) (this.width - 129), this.height - 10,
            0x808080);

    ((GuiButton) this.buttonList.get(0)).xPosition = this.width / 2 - 50;
    ((GuiButton) this.buttonList.get(0)).yPosition = this.height - 25;
    ((GuiButton) this.buttonList.get(0)).drawButton(this.mc, x, y);
    //super.drawScreen(x, x, z);

    // Shadow magic
    GL11.glEnable(3042 /*GL_BLEND*/);
    GL11.glBlendFunc(770, 771);
    GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
    GL11.glShadeModel(7425 /*GL_SMOOTH*/);
    GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
    Tessellator var16 = Tessellator.instance;
    byte var19 = 4;
    var16.startDrawingQuads();
    var16.setColorRGBA_I(0, 0);
    var16.addVertexWithUV(0, (double) (30 + var19), 0.0D, 0.0D, 1.0D);
    var16.addVertexWithUV(this.width - 12, (double) (30 + var19), 0.0D, 1.0D, 1.0D);
    var16.setColorRGBA_I(0, 255);
    var16.addVertexWithUV(this.width - 12, 30, 0.0D, 1.0D, 0.0D);
    var16.addVertexWithUV(0, 30, 0.0D, 0.0D, 0.0D);
    var16.draw();
    var16.startDrawingQuads();
    var16.setColorRGBA_I(0, 255);
    var16.addVertexWithUV(0, this.height - 50, 0.0D, 0.0D, 1.0D);
    var16.addVertexWithUV(this.width - 12, this.height - 50, 0.0D, 1.0D, 1.0D);
    var16.setColorRGBA_I(0, 0);
    var16.addVertexWithUV(this.width - 12, (double) (this.height - 50 - var19), 0.0D, 1.0D, 0.0D);
    var16.addVertexWithUV(0, (double) (this.height - 50 - var19), 0.0D, 0.0D, 0.0D);
    var16.draw();

    GL11.glEnable(3008 /*GL_ALPHA_TEST*/);

    GL11.glPopMatrix();
}

From source file:org.spoutcraft.client.gui.MCRenderDelegate.java

License:Open Source License

public void render(GenericGradient gradient) {
    GL11.glDisable(GL11.GL_TEXTURE_2D);//from  ww w .  j  ava 2  s . co m
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glBlendFunc(770, 771);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    boolean VERT = gradient.getOrientation() == Orientation.VERTICAL;
    tessellator.setColorRGBA_F(gradient.getTopColor().getRedF(), gradient.getTopColor().getGreenF(),
            gradient.getTopColor().getBlueF(), gradient.getTopColor().getAlphaF());
    tessellator.addVertex((VERT ? gradient.getWidth() : 0) + gradient.getScreenX(),
            (VERT ? 0 : gradient.getHeight()) + gradient.getScreenY(), 0.0D);
    tessellator.addVertex(gradient.getScreenX(), gradient.getScreenY(), 0.0D);
    tessellator.setColorRGBA_F(gradient.getBottomColor().getRedF(), gradient.getBottomColor().getGreenF(),
            gradient.getBottomColor().getBlueF(), gradient.getBottomColor().getAlphaF());
    tessellator.addVertex((VERT ? 0 : gradient.getWidth()) + gradient.getScreenX(),
            (VERT ? gradient.getHeight() : 0) + gradient.getScreenY(), 0.0D);
    tessellator.addVertex(gradient.getWidth() + gradient.getScreenX(),
            gradient.getHeight() + gradient.getScreenY(), 0.0D);
    tessellator.draw();
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:RediscoveredMod.RenderMD3.java

License:Open Source License

public final void renderMD3(EntityLiving entity, float f, float f1, float f2, float f3, float f4) {
    f3 = f2;// w  w w. j a va 2  s .c  o m
    f2 = f1 - (float) entity.yOffset;
    f1 = f;
    GL11.glPushMatrix();
    float f5 = entity.prevRenderYawOffset + (entity.renderYawOffset - entity.prevRenderYawOffset) * f4;
    GL11.glTranslatef(f1, f2, f3);
    this.bindTexture(textures[getTextureIndex(entity) % textures.length]);
    GL11.glRotatef(-f5 + 180F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-90F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(0.02F, -0.02F, 0.02F);
    float rotation = handleRotationFloat(entity, f4) * getSpeedMultiplier(entity);
    try {
        int frame1 = (int) rotation % renderer.getAnimFrames();
        int frame2 = (frame1 + 1) % renderer.getAnimFrames();
        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glEnable(GL11.GL_NORMALIZE);
        renderer.render(frame1, frame2, rotation - (int) rotation);
        GL11.glDisable(GL11.GL_NORMALIZE);
    } catch (Exception e) {
        e.printStackTrace();
    }
    GL11.glPopMatrix();
    passSpecialRender(entity, f1, f2, f3);
}

From source file:RediscoveredMod.RenderRedDragon.java

License:Open Source License

/**
 * Renders the dragon, along with its dying animation
 *///from ww w.j a va2 s  .c  o m
public void renderDragon(EntityGoodDragon par1EntityGoodDragon, double par2, double par4, double par6,
        float par8, float par9) {
    BossStatus.setBossStatus(par1EntityGoodDragon, false);
    super.doRenderLiving(par1EntityGoodDragon, par2, par4, par6, par8, par9);

    if (par1EntityGoodDragon.healingEnderCrystal != null) {
        float f2 = (float) par1EntityGoodDragon.healingEnderCrystal.innerRotation + par9;
        float f3 = MathHelper.sin(f2 * 0.2F) / 2.0F + 0.5F;
        f3 = (f3 * f3 + f3) * 0.2F;
        float f4 = (float) (par1EntityGoodDragon.healingEnderCrystal.posX - par1EntityGoodDragon.posX
                - (par1EntityGoodDragon.prevPosX - par1EntityGoodDragon.posX) * (double) (1.0F - par9));
        float f5 = (float) ((double) f3 + par1EntityGoodDragon.healingEnderCrystal.posY - 1.0D
                - par1EntityGoodDragon.posY
                - (par1EntityGoodDragon.prevPosY - par1EntityGoodDragon.posY) * (double) (1.0F - par9));
        float f6 = (float) (par1EntityGoodDragon.healingEnderCrystal.posZ - par1EntityGoodDragon.posZ
                - (par1EntityGoodDragon.prevPosZ - par1EntityGoodDragon.posZ) * (double) (1.0F - par9));
        float f7 = MathHelper.sqrt_float(f4 * f4 + f6 * f6);
        float f8 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6);
        GL11.glPushMatrix();
        GL11.glTranslatef((float) par2, (float) par4 + 2.0F, (float) par6);
        GL11.glRotatef((float) (-Math.atan2((double) f6, (double) f4)) * 180.0F / (float) Math.PI - 90.0F, 0.0F,
                1.0F, 0.0F);
        GL11.glRotatef((float) (-Math.atan2((double) f7, (double) f5)) * 180.0F / (float) Math.PI - 90.0F, 1.0F,
                0.0F, 0.0F);
        Tessellator tessellator = Tessellator.instance;
        RenderHelper.disableStandardItemLighting();
        GL11.glDisable(GL11.GL_CULL_FACE);
        this.bindTexture(field_110843_g);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        float f9 = 0.0F - ((float) par1EntityGoodDragon.ticksExisted + par9) * 0.01F;
        float f10 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6) / 32.0F
                - ((float) par1EntityGoodDragon.ticksExisted + par9) * 0.01F;
        tessellator.startDrawing(5);
        byte b0 = 8;

        for (int i = 0; i <= b0; ++i) {
            float f11 = MathHelper.sin((float) (i % b0) * (float) Math.PI * 2.0F / (float) b0) * 0.75F;
            float f12 = MathHelper.cos((float) (i % b0) * (float) Math.PI * 2.0F / (float) b0) * 0.75F;
            float f13 = (float) (i % b0) * 1.0F / (float) b0;
            tessellator.setColorOpaque_I(0);
            tessellator.addVertexWithUV((double) (f11 * 0.2F), (double) (f12 * 0.2F), 0.0D, (double) f13,
                    (double) f10);
            tessellator.setColorOpaque_I(16777215);
            tessellator.addVertexWithUV((double) f11, (double) f12, (double) f8, (double) f13, (double) f9);
        }

        tessellator.draw();
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glShadeModel(GL11.GL_FLAT);
        RenderHelper.enableStandardItemLighting();
        GL11.glPopMatrix();
    }
}

From source file:RediscoveredMod.RenderRedDragon.java

License:Open Source License

/**
 * Renders the animation for when an enderdragon dies
 *///  www .  ja  v a  2  s .c o m
protected void renderDragonDying(EntityGoodDragon par1EntityGoodDragon, float par2) {
    super.renderEquippedItems(par1EntityGoodDragon, par2);
    Tessellator tessellator = Tessellator.instance;

    if (par1EntityGoodDragon.deathTicks > 0) {
        RenderHelper.disableStandardItemLighting();
        float f1 = ((float) par1EntityGoodDragon.deathTicks + par2) / 200.0F;
        float f2 = 0.0F;

        if (f1 > 0.8F) {
            f2 = (f1 - 0.8F) / 0.2F;
        }

        Random random = new Random(432L);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDepthMask(false);
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, -1.0F, -2.0F);

        for (int i = 0; (float) i < (f1 + f1 * f1) / 2.0F * 60.0F; ++i) {
            GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F + f1 * 90.0F, 0.0F, 0.0F, 1.0F);
            tessellator.startDrawing(6);
            float f3 = random.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
            float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
            tessellator.setColorRGBA_I(16777215, (int) (255.0F * (1.0F - f2)));
            tessellator.addVertex(0.0D, 0.0D, 0.0D);
            tessellator.setColorRGBA_I(16711935, 0);
            tessellator.addVertex(-0.866D * (double) f4, (double) f3, (double) (-0.5F * f4));
            tessellator.addVertex(0.866D * (double) f4, (double) f3, (double) (-0.5F * f4));
            tessellator.addVertex(0.0D, (double) f3, (double) (1.0F * f4));
            tessellator.addVertex(-0.866D * (double) f4, (double) f3, (double) (-0.5F * f4));
            tessellator.draw();
        }

        GL11.glPopMatrix();
        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glShadeModel(GL11.GL_FLAT);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        RenderHelper.enableStandardItemLighting();
    }
}

From source file:RediscoveredMod.RenderSteve.java

License:Open Source License

public final void renderMD3(EntityLiving entity, float f, float f1, float f2, float f3, float f4) {
    f3 = f2;//from  w w  w  . jav  a  2 s .  c  om
    //Change later
    f2 = f1 - 0;
    f1 = f;
    GL11.glPushMatrix();
    //Change these value if it doesn't work
    float f5 = entity.prevSwingProgress + (entity.swingProgress - entity.prevSwingProgress) * f4;
    GL11.glTranslatef(f1, f2, f3);
    GL11.glRotatef(-f5 + 180.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(0.02F, -0.02F, 0.02F);
    //Change rotationYawHead
    float rotation = handleRotationFloat(entity, f4) * entity.rotationYawHead;
    try {
        int frame1 = (int) rotation % this.renderer.getAnimFrames();
        int frame2 = (frame1 + 1) % this.renderer.getAnimFrames();
        GL11.glShadeModel(7425);
        GL11.glEnable(2977);
        this.renderer.render(frame1, frame2, rotation - (int) rotation);
        GL11.glDisable(2977);
    } catch (Exception e) {
        e.printStackTrace();
    }
    GL11.glPopMatrix();
    //Change float values
    func_77033_b(entity, f1, f2, f3, 1.0F, 1.0F);
}

From source file:slimevoid.littleblocks.client.render.tileentities.LittleTilesLittleRenderer.java

License:Open Source License

public void renderLittleTiles(TileEntityLittleChunk tileentity, double x, double y, double z, float f) {
    GL11.glPushMatrix();// w  ww .  ja  v  a 2s  .c o m

    GL11.glTranslated(x, y, z);
    GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    float scale = 1F / LBCore.littleBlocksSize;
    GL11.glScaled(scale, scale, scale);

    RenderHelper.disableStandardItemLighting();
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_CULL_FACE);
    if (Minecraft.isAmbientOcclusionEnabled()) {
        GL11.glShadeModel(GL11.GL_SMOOTH);
    } else {
        GL11.glShadeModel(GL11.GL_FLAT);
    }

    for (LittleTileToRender tileToRender : this.tilesToRender) {
        this.tileEntityRenderer.renderTileEntityAt(tileToRender.tileentity, tileToRender.x, tileToRender.y,
                tileToRender.z, f);
    }

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

From source file:steamcraft.common.worldgen.dimension.util.DeepsSkyRenderer.java

License:Minecraft Mod Public

@Override
@SideOnly(Side.CLIENT)//from  w ww. j  a v  a2 s.  c  o m
public void render(float partialTicks, WorldClient world, Minecraft mc) {
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks);
    float f1 = (float) vec3.xCoord;
    float f2 = (float) vec3.yCoord;
    float f3 = (float) vec3.zCoord;
    float f4;
    if (mc.gameSettings.anaglyph) {
        float f5 = ((f1 * 30.0F) + (f2 * 59.0F) + (f3 * 11.0F)) / 100.0F;
        float f6 = ((f1 * 30.0F) + (f2 * 70.0F)) / 100.0F;
        f4 = ((f1 * 30.0F) + (f3 * 70.0F)) / 100.0F;
        f1 = f5;
        f2 = f6;
        f3 = f4;
    }
    GL11.glColor3f(f1, f2, f3);
    Tessellator tessellator1 = Tessellator.instance;
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(f1, f2, f3);
    GL11.glCallList(this.glSkyList);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderHelper.disableStandardItemLighting();
    float[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTicks),
            partialTicks);
    float f7;
    float f8;
    float f9;
    float f10;
    if (afloat != null) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glPushMatrix();
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(MathHelper.sin(world.getCelestialAngleRadians(partialTicks)) < 0.0F ? 180.0F : 0.0F,
                0.0F, 0.0F, 1.0F);
        GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
        f4 = afloat[0];
        f7 = afloat[1];
        f8 = afloat[2];
        float f11;
        if (mc.gameSettings.anaglyph) {
            f9 = ((f4 * 30.0F) + (f7 * 59.0F) + (f8 * 11.0F)) / 100.0F;
            f10 = ((f4 * 30.0F) + (f7 * 70.0F)) / 100.0F;
            f11 = ((f4 * 30.0F) + (f8 * 70.0F)) / 100.0F;
            f4 = f9;
            f7 = f10;
            f8 = f11;
        }
        tessellator1.startDrawing(6);
        tessellator1.setColorRGBA_F(f4, f7, f8, afloat[3]);
        tessellator1.addVertex(0.0D, 100.0D, 0.0D);
        byte b0 = 16;
        tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F);
        for (int j = 0; j <= b0; ++j) {
            f11 = (j * (float) Math.PI * 2.0F) / b0;
            float f12 = MathHelper.sin(f11);
            float f13 = MathHelper.cos(f11);
            tessellator1.addVertex(f12 * 120.0F, f13 * 120.0F, -f13 * 40.0F * afloat[3]);
        }
        tessellator1.draw();
        GL11.glPopMatrix();
        GL11.glShadeModel(GL11.GL_FLAT);
    }
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glPushMatrix();
    f4 = 1.0F;
    f7 = 0.0F;
    f8 = 0.0F;
    f9 = 0.0F;
    GL11.glColor4f(1.0F, 1.0F, 1.0F, f4);
    GL11.glTranslatef(f7, f8, f9);
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
    f10 = 15.0F; // Size of sun from center
    mc.renderEngine.bindTexture(new ResourceLocation(ModInfo.PREFIX + "textures/misc/sun.png")); // Sun texture + texture path
    tessellator1.startDrawingQuads();
    tessellator1.addVertexWithUV((-f10), 100.0D, (-f10), 0.0D, 0.0D);
    tessellator1.addVertexWithUV(f10, 100.0D, (-f10), 1.0D, 0.0D);
    tessellator1.addVertexWithUV(f10, 100.0D, f10, 1.0D, 1.0D);
    tessellator1.addVertexWithUV((-f10), 100.0D, f10, 0.0D, 1.0D);
    tessellator1.draw(); // Draw sun
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    float f18 = world.getStarBrightness(partialTicks) * f4;
    if (f18 > 0.0F) {
        GL11.glColor4f(f18, f18, f18, f18);
        GL11.glCallList(this.starGLCallList);
    }
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor3f(0.0F, 0.0F, 0.0F);
    double d0 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon();
    if (d0 < 0.0D) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, 12.0F, 0.0F);
        GL11.glCallList(this.glSkyList2);
        GL11.glPopMatrix();
        f8 = 1.0F;
        f9 = -((float) (d0 + 65.0D));
        f10 = -f8;
        tessellator1.startDrawingQuads();
        tessellator1.setColorRGBA_I(0, 255);
        tessellator1.addVertex((-f8), f9, f8);
        tessellator1.addVertex(f8, f9, f8);
        tessellator1.addVertex(f8, f10, f8);
        tessellator1.addVertex((-f8), f10, f8);
        tessellator1.addVertex((-f8), f10, (-f8));
        tessellator1.addVertex(f8, f10, (-f8));
        tessellator1.addVertex(f8, f9, (-f8));
        tessellator1.addVertex((-f8), f9, (-f8));
        tessellator1.addVertex(f8, f10, (-f8));
        tessellator1.addVertex(f8, f10, f8);
        tessellator1.addVertex(f8, f9, f8);
        tessellator1.addVertex(f8, f9, (-f8));
        tessellator1.addVertex((-f8), f9, (-f8));
        tessellator1.addVertex((-f8), f9, f8);
        tessellator1.addVertex((-f8), f10, f8);
        tessellator1.addVertex((-f8), f10, (-f8));
        tessellator1.addVertex((-f8), f10, (-f8));
        tessellator1.addVertex((-f8), f10, f8);
        tessellator1.addVertex(f8, f10, f8);
        tessellator1.addVertex(f8, f10, (-f8));
        tessellator1.draw();
    }
    if (world.provider.isSkyColored()) {
        GL11.glColor3f(0.2F + 0.04F, (f2 * 0.2F) + 0.04F, (f3 * 0.6F) + 0.1F);
    } else {
        GL11.glColor3f(f1, f2, f3);
    }
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F);
    GL11.glCallList(this.glSkyList2);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
}

From source file:stevekung.mods.moreplanets.core.handler.SkyProviderMarsMP.java

License:Creative Commons License

@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
    GL11.glDisable(GL11.GL_TEXTURE_2D);/*from   www.  ja v  a 2 s.c o  m*/
    Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks);
    float f1 = (float) vec3.xCoord;
    float f2 = (float) vec3.yCoord;
    float f3 = (float) vec3.zCoord;
    float f6;

    if (mc.gameSettings.anaglyph) {
        float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
        float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
        f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
        f1 = f4;
        f2 = f5;
        f3 = f6;
    }

    GL11.glColor3f(f1, f2, f3);
    Tessellator tessellator1 = Tessellator.instance;
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(f1, f2, f3);
    GL11.glCallList(this.glSkyList);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    RenderHelper.disableStandardItemLighting();
    float f7;
    float f8;
    float f9;
    float f10;
    float f18 = world.getStarBrightness(partialTicks);

    if (f18 > 0.0F) {
        GL11.glColor4f(f18, f18, f18, f18);
        GL11.glCallList(this.starList);
    }

    float[] afloat = new float[4];
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glPushMatrix();
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
    afloat[0] = 255 / 255.0F;
    afloat[1] = 194 / 255.0F;
    afloat[2] = 180 / 255.0F;
    afloat[3] = 0.3F;
    f6 = afloat[0];
    f7 = afloat[1];
    f8 = afloat[2];
    float f11;

    if (mc.gameSettings.anaglyph) {
        f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F;
        f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F;
        f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F;
        f6 = f9;
        f7 = f10;
        f8 = f11;
    }

    f18 = 1.0F - f18;

    tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN);
    tessellator1.setColorRGBA_F(f6 * f18, f7 * f18, f8 * f18, afloat[3] * 2 / f18);
    tessellator1.addVertex(0.0D, 100.0D, 0.0D);
    tessellator1.setColorRGBA_F(afloat[0] * f18, afloat[1] * f18, afloat[2] * f18, 0.0F);

    // Render sun aura
    f10 = 20.0F;
    tessellator1.addVertex(-f10, 100.0D, -f10);
    tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F);
    tessellator1.addVertex(f10, 100.0D, -f10);
    tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(f10, 100.0D, f10);
    tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F);
    tessellator1.addVertex(-f10, 100.0D, f10);
    tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(-f10, 100.0D, -f10);

    tessellator1.draw();
    tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN);
    tessellator1.setColorRGBA_F(f6 * f18, f7 * f18, f8 * f18, afloat[3] * f18);
    tessellator1.addVertex(0.0D, 100.0D, 0.0D);
    tessellator1.setColorRGBA_F(afloat[0] * f18, afloat[1] * f18, afloat[2] * f18, 0.0F);

    // Render larger sun aura
    f10 = 40.0F;
    tessellator1.addVertex(-f10, 100.0D, -f10);
    tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F);
    tessellator1.addVertex(f10, 100.0D, -f10);
    tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(f10, 100.0D, f10);
    tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F);
    tessellator1.addVertex(-f10, 100.0D, f10);
    tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(-f10, 100.0D, -f10);

    tessellator1.draw();
    GL11.glPopMatrix();
    GL11.glShadeModel(GL11.GL_FLAT);

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO);
    GL11.glPushMatrix();
    f7 = 0.0F;
    f8 = 0.0F;
    f9 = 0.0F;
    GL11.glTranslatef(f7, f8, f9);
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);

    // Render sun
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor4f(0.0F, 0.0F, 0.0F, 1.0F);
    //Some blanking to conceal the stars
    f10 = this.sunSize / 3.5F;
    tessellator1.startDrawingQuads();
    tessellator1.addVertex(-f10, 99.9D, -f10);
    tessellator1.addVertex(f10, 99.9D, -f10);
    tessellator1.addVertex(f10, 99.9D, f10);
    tessellator1.addVertex(-f10, 99.9D, f10);
    tessellator1.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    f10 = this.sunSize;
    mc.renderEngine.bindTexture(this.sunTexture);
    tessellator1.startDrawingQuads();
    tessellator1.addVertexWithUV(-f10, 100.0D, -f10, 0.0D, 0.0D);
    tessellator1.addVertexWithUV(f10, 100.0D, -f10, 1.0D, 0.0D);
    tessellator1.addVertexWithUV(f10, 100.0D, f10, 1.0D, 1.0D);
    tessellator1.addVertexWithUV(-f10, 100.0D, f10, 0.0D, 1.0D);
    tessellator1.draw();

    // Render earth
    f10 = 0.5F;
    GL11.glScalef(0.6F, 0.6F, 0.6F);
    GL11.glRotatef(40.0F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(200F, 1.0F, 0.0F, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.overworldTexture);
    tessellator1.startDrawingQuads();
    tessellator1.addVertexWithUV(-f10, -100.0D, f10, 0, 1);
    tessellator1.addVertexWithUV(f10, -100.0D, f10, 1, 1);
    tessellator1.addVertexWithUV(f10, -100.0D, -f10, 1, 0);
    tessellator1.addVertexWithUV(-f10, -100.0D, -f10, 0, 0);
    tessellator1.draw();

    // Phobos
    f10 = 3.8F;
    GL11.glScalef(0.6F, 0.6F, 0.6F);
    GL11.glRotatef(40.0F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(200F, 1.0F, 0.0F, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 10.0F, 0.0F, 0.0F);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.phobosTexture);
    tessellator1.startDrawingQuads();
    tessellator1.addVertexWithUV(-f10, -100.0D, f10, 0, 1);
    tessellator1.addVertexWithUV(f10, -100.0D, f10, 1, 1);
    tessellator1.addVertexWithUV(f10, -100.0D, -f10, 1, 0);
    tessellator1.addVertexWithUV(-f10, -100.0D, -f10, 0, 0);
    tessellator1.draw();

    // Deimos
    f10 = 1.2F;
    GL11.glScalef(0.6F, 0.6F, 0.6F);
    GL11.glRotatef(40.0F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(200F, 1.0F, 0.0F, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 10.0F, 0.0F, 0.0F);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.deimosTexture);
    tessellator1.startDrawingQuads();
    tessellator1.addVertexWithUV(-f10, -100.0D, f10, 0, 1);
    tessellator1.addVertexWithUV(f10, -100.0D, f10, 1, 1);
    tessellator1.addVertexWithUV(f10, -100.0D, -f10, 1, 0);
    tessellator1.addVertexWithUV(-f10, -100.0D, -f10, 0, 0);
    tessellator1.draw();

    GL11.glDisable(GL11.GL_TEXTURE_2D);

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor3f(0.0F, 0.0F, 0.0F);
    double d0 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon();

    if (d0 < 0.0D) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, 12.0F, 0.0F);
        GL11.glCallList(this.glSkyList2);
        GL11.glPopMatrix();
        f8 = 1.0F;
        f9 = -((float) (d0 + 65.0D));
        f10 = -f8;
        tessellator1.startDrawingQuads();
        tessellator1.setColorRGBA_I(0, 255);
        tessellator1.addVertex(-f8, f9, f8);
        tessellator1.addVertex(f8, f9, f8);
        tessellator1.addVertex(f8, f10, f8);
        tessellator1.addVertex(-f8, f10, f8);
        tessellator1.addVertex(-f8, f10, -f8);
        tessellator1.addVertex(f8, f10, -f8);
        tessellator1.addVertex(f8, f9, -f8);
        tessellator1.addVertex(-f8, f9, -f8);
        tessellator1.addVertex(f8, f10, -f8);
        tessellator1.addVertex(f8, f10, f8);
        tessellator1.addVertex(f8, f9, f8);
        tessellator1.addVertex(f8, f9, -f8);
        tessellator1.addVertex(-f8, f9, -f8);
        tessellator1.addVertex(-f8, f9, f8);
        tessellator1.addVertex(-f8, f10, f8);
        tessellator1.addVertex(-f8, f10, -f8);
        tessellator1.addVertex(-f8, f10, -f8);
        tessellator1.addVertex(-f8, f10, f8);
        tessellator1.addVertex(f8, f10, f8);
        tessellator1.addVertex(f8, f10, -f8);
        tessellator1.draw();
    }

    if (world.provider.isSkyColored()) {
        GL11.glColor3f(f1 * 0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F);
    } else {
        GL11.glColor3f(f1, f2, f3);
    }
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F);
    GL11.glCallList(this.glSkyList2);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
}

From source file:stevekung.mods.moreplanets.moons.io.dimension.sky.SkyProviderIo.java

License:Creative Commons License

@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
    GL11.glDisable(GL11.GL_TEXTURE_2D);//from  w w w. j av  a  2 s. c o m
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.enableStandardItemLighting();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks);
    float f1 = (float) vec3.xCoord;
    float f2 = (float) vec3.yCoord;
    float f3 = (float) vec3.zCoord;
    float f6;

    if (mc.gameSettings.anaglyph) {
        float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
        float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
        f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
        f1 = f4;
        f2 = f5;
        f3 = f6;
    }

    GL11.glColor3f(f1, f2, f3);
    Tessellator tessellator1 = Tessellator.instance;
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(f1, f2, f3);
    GL11.glCallList(this.glSkyList);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    // OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    RenderHelper.disableStandardItemLighting();
    float[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTicks),
            partialTicks);
    float f7;
    float f8;
    float f9;
    float f10;

    float f18 = world.getStarBrightness(partialTicks);

    if (f18 > 0.0F) {
        GL11.glColor4f(f18, f18, f18, f18);
        GL11.glCallList(this.starList);
    }

    afloat = new float[4];
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glPushMatrix();
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
    afloat[0] = 255 / 255.0F;
    afloat[1] = 194 / 255.0F;
    afloat[2] = 180 / 255.0F;
    afloat[3] = 0.3F;
    f6 = afloat[0];
    f7 = afloat[1];
    f8 = afloat[2];
    float f11;
    float var12;

    if (mc.gameSettings.anaglyph) {
        f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F;
        f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F;
        f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F;
        f6 = f9;
        f7 = f10;
        f8 = f11;
    }

    Tessellator var23 = Tessellator.instance;
    tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN);
    tessellator1.setColorRGBA_F(f6, f7, f8, afloat[3] * 2);
    tessellator1.addVertex(0.0D, 100.0D, 0.0D);
    tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F);

    // Render sun aura
    f10 = 25.0F;
    tessellator1.addVertex(-f10, 100.0D, -f10);
    tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F);
    tessellator1.addVertex(f10, 100.0D, -f10);
    tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(f10, 100.0D, f10);
    tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F);
    tessellator1.addVertex(-f10, 100.0D, f10);
    tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(-f10, 100.0D, -f10);

    tessellator1.draw();
    tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN);
    tessellator1.setColorRGBA_F(f6 * f18, f7 * f18, f8 * f18, afloat[3] * f18);
    tessellator1.addVertex(0.0D, 100.0D, 0.0D);
    tessellator1.setColorRGBA_F(afloat[0] * f18, afloat[1] * f18, afloat[2] * f18, 0.0F);

    // Render larger sun aura
    f10 = 45.0F;
    tessellator1.addVertex(-f10, 100.0D, -f10);
    tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F);
    tessellator1.addVertex(f10, 100.0D, -f10);
    tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(f10, 100.0D, f10);
    tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F);
    tessellator1.addVertex(-f10, 100.0D, f10);
    tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(-f10, 100.0D, -f10);

    tessellator1.draw();
    GL11.glPopMatrix();
    GL11.glShadeModel(GL11.GL_FLAT);

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO);
    GL11.glPushMatrix();
    f7 = 0.0F;
    f8 = 0.0F;
    f9 = 0.0F;
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glTranslatef(f7, f8, f9);
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);

    // Render sun
    f10 = 19.0F;
    mc.renderEngine.bindTexture(this.sunTexture);
    tessellator1.startDrawingQuads();
    tessellator1.addVertexWithUV(-f10, 100.0D, -f10, 0.0D, 0.0D);
    tessellator1.addVertexWithUV(f10, 100.0D, -f10, 1.0D, 0.0D);
    tessellator1.addVertexWithUV(f10, 100.0D, f10, 1.0D, 1.0D);
    tessellator1.addVertexWithUV(-f10, 100.0D, f10, 0.0D, 1.0D);
    tessellator1.draw();

    // JUPITER:
    var12 = 10.0F;
    float jupiterRotation = (float) (world.getSpawnPoint().posZ - mc.thePlayer.posZ) * 0.01F;
    GL11.glScalef(0.6F, 0.6F, 0.6F);
    GL11.glRotatef(jupiterRotation, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(1.0F, 1.0F, 0.0F, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.jupiterTexture);
    world.getMoonPhase();
    var23.startDrawingQuads();
    var23.addVertexWithUV(-var12, -75.0D, var12, 0, 1);
    var23.addVertexWithUV(var12, -75.0D, var12, 1, 1);
    var23.addVertexWithUV(var12, -75.0D, -var12, 1, 0);
    var23.addVertexWithUV(-var12, -75.0D, -var12, 0, 0);
    var23.draw();

    GL11.glDisable(GL11.GL_TEXTURE_2D);

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor3f(0.0F, 0.0F, 0.0F);
    double d0 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon();

    if (d0 < 0.0D) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, 12.0F, 0.0F);
        GL11.glCallList(this.glSkyList2);
        GL11.glPopMatrix();
        f8 = 1.0F;
        f9 = -((float) (d0 + 65.0D));
        f10 = -f8;
        tessellator1.startDrawingQuads();
        tessellator1.setColorRGBA_I(0, 255);
        tessellator1.addVertex(-f8, f9, f8);
        tessellator1.addVertex(f8, f9, f8);
        tessellator1.addVertex(f8, f10, f8);
        tessellator1.addVertex(-f8, f10, f8);
        tessellator1.addVertex(-f8, f10, -f8);
        tessellator1.addVertex(f8, f10, -f8);
        tessellator1.addVertex(f8, f9, -f8);
        tessellator1.addVertex(-f8, f9, -f8);
        tessellator1.addVertex(f8, f10, -f8);
        tessellator1.addVertex(f8, f10, f8);
        tessellator1.addVertex(f8, f9, f8);
        tessellator1.addVertex(f8, f9, -f8);
        tessellator1.addVertex(-f8, f9, -f8);
        tessellator1.addVertex(-f8, f9, f8);
        tessellator1.addVertex(-f8, f10, f8);
        tessellator1.addVertex(-f8, f10, -f8);
        tessellator1.addVertex(-f8, f10, -f8);
        tessellator1.addVertex(-f8, f10, f8);
        tessellator1.addVertex(f8, f10, f8);
        tessellator1.addVertex(f8, f10, -f8);
        tessellator1.draw();
    }

    if (world.provider.isSkyColored()) {
        GL11.glColor3f(f1 * 0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F);
    } else {
        GL11.glColor3f(f1, f2, f3);
    }

    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F);
    GL11.glCallList(this.glSkyList2);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
}