Example usage for org.lwjgl.opengl GL11 glScalef

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

Introduction

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

Prototype

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

Source Link

Document

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

Usage

From source file:mal.core.gui.GuiTexturedButton.java

License:Open Source License

/**
  * Draws this button to the screen.//w ww . j  a v a  2s .  co m
  */
@Override
public void drawButton(Minecraft mc, int mx, int my) {
    if (this.visible) {
        FontRenderer fontrenderer = mc.fontRenderer;
        mc.getTextureManager().bindTexture(new ResourceLocation(modname, imageLocation));
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.field_146123_n = mx >= this.xPosition && my >= this.yPosition && mx < this.xPosition + this.width
                && my < this.yPosition + this.height;
        int k = this.getHoverState(this.field_146123_n);
        GL11.glEnable(GL11.GL_BLEND);
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glScalef(0.5f, 0.5f, 0.5f);
        this.drawTexturedModalRect(this.xPosition * 2, this.yPosition * 2, u * 2, v * 2 + (height) * 2 * state,
                this.width * 2 + 2, this.height * 2 + 1);
        GL11.glScalef(2.0f, 2.0f, 2.0f);
        //this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height);
        this.mouseDragged(mc, mx, my);
        int l = 14737632;

        if (packedFGColour != 0) {
            l = packedFGColour;
        } else if (!this.enabled) {
            l = 10526880;
        } else if (this.field_146123_n) {
            l = 16777120;
        }

        this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2,
                this.yPosition + (this.height - 8) / 2, l);
    }
}

From source file:mal.lootbags.gui.OpenerGui.java

License:Open Source License

/**
  * Draw the foreground layer for the GuiContainer (everything in front of the items)
  *//*ww  w  . ja  v a  2 s.  c o  m*/
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
    this.fontRendererObj.drawString("Lootbag Opener", 52, 5, 4210752);

    if (LootBags.OPENERMAXCOOLDOWN > 0) {
        GL11.glPushMatrix();
        GL11.glScalef(0.7f, 0.7f, 0.7f);
        this.fontRendererObj.drawString("Cooldown: " + bench.getCooldown(), 103, 52, 4210752);
        GL11.glPopMatrix();
    }

}

From source file:map.GameMap.java

License:Open Source License

private void renderMinimap() {
    int size = MINIMAP_SIZE;
    Texture tex = new Texture("ground");
    miniMap = new Material(name + "_minimap");
    int[] viewport = GLUtils.getViewport();
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();/*  ww w . j ava2 s  . com*/
    GL11.glOrtho(0, size, size, 0, -10, 10);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glViewport(0, 0, size, size);

    GL11.glClearColor(0.0f, 0, 0, 1.0f);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glScalef(size / tiles.length, size / tiles.length, size / tiles.length);

    GLUtils.glLightPos(1.0f, 1.0f, 1.0f);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    draw(null);
    GL11.glEnable(GL11.GL_CULL_FACE);

    IntBuffer addr = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
    GL11.glGenTextures(addr);
    tex.setID(addr.get(0));
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getID());

    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0, 0, size, size, 0);

    miniMap.setTexture(0, tex);
    GL11.glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
}

From source file:matteroverdrive.client.render.entity.EntityRendererPhaserFire.java

License:Open Source License

/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity>) and this method has signature public void func_76986_a(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 *//*from w ww  . j  ava  2  s  .com*/
public void doRender(PlasmaBolt plasmaBolt, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
    this.bindEntityTexture(plasmaBolt);
    RenderUtils.disableLightmap();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
    RenderUtils.applyColorWithMultipy(plasmaBolt.getColor(),
            MOEasing.Quad.easeOut(plasmaBolt.getLife(), 0, 1, 0.7f));
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);
    GL11.glRotatef(plasmaBolt.prevRotationYaw
            + (plasmaBolt.rotationYaw - plasmaBolt.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(plasmaBolt.prevRotationPitch
            + (plasmaBolt.rotationPitch - plasmaBolt.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F);
    Tessellator tessellator = Tessellator.instance;
    byte b0 = 0;
    float f2 = 0.0F;
    float f3 = 0.5F;
    float f4 = (float) (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;
    float renderSize = plasmaBolt.getRenderSize();
    double length = 6
            * Vec3.createVectorHelper(plasmaBolt.motionX, plasmaBolt.motionY, plasmaBolt.motionZ).lengthVector()
            + 10;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glDisable(GL11.GL_CULL_FACE);

    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(1, -renderSize, -renderSize, (double) f6, (double) f8);
    tessellator.addVertexWithUV(1, -renderSize, renderSize, (double) f7, (double) f8);
    tessellator.addVertexWithUV(1, renderSize, renderSize, (double) f7, (double) f9);
    tessellator.addVertexWithUV(1, renderSize, -renderSize, (double) f6, (double) f9);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(length - 1, -renderSize, renderSize, (double) f7, (double) f8);
    tessellator.addVertexWithUV(length - 1, renderSize, renderSize, (double) f7, (double) f9);
    tessellator.addVertexWithUV(length - 1, renderSize, -renderSize, (double) f6, (double) f9);
    tessellator.addVertexWithUV(length - 1, -renderSize, -renderSize, (double) f6, (double) f8);
    tessellator.draw();

    for (int i = 0; i < 2; ++i) {
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glNormal3f(0.0F, 0.0F, f10);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0, -renderSize, 0.0D, (double) f2, (double) f4);
        tessellator.addVertexWithUV(length, -renderSize, 0.0D, (double) f3, (double) f4);
        tessellator.addVertexWithUV(length, renderSize, 0.0D, (double) f3, (double) f5);
        tessellator.addVertexWithUV(0, renderSize, 0.0D, (double) f2, (double) f5);
        tessellator.draw();
    }

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
    RenderUtils.enableLightmap();
}

From source file:matteroverdrive.client.render.entity.EntityRendererRougeAndroid.java

License:Open Source License

@Override
public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_,
        float p_76986_8_, float p_76986_9_) {
    if (hologram) {
        GL11.glPushMatrix();/*from  www  .  j av a  2 s  .  c o  m*/
        GL11.glDisable(GL11.GL_CULL_FACE);
        this.mainModel.onGround = this.renderSwingProgress(p_76986_1_, p_76986_9_);

        if (this.renderPassModel != null) {
            this.renderPassModel.onGround = this.mainModel.onGround;
        }

        this.mainModel.isRiding = p_76986_1_.isRiding();

        if (this.renderPassModel != null) {
            this.renderPassModel.isRiding = this.mainModel.isRiding;
        }

        this.mainModel.isChild = p_76986_1_.isChild();

        if (this.renderPassModel != null) {
            this.renderPassModel.isChild = this.mainModel.isChild;
        }

        this.renderLivingAt(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_);

        try {
            float f2 = 0;
            float f3 = 0;
            float f4;

            f4 = this.handleRotationFloat(p_76986_1_, p_76986_9_);
            this.rotateCorpse(p_76986_1_, f4, f2, p_76986_9_);
            float f5 = 0.0625F;
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            GL11.glScalef(-1.0F, -1.0F, 1.0F);
            this.preRenderCallback(p_76986_1_, p_76986_9_);
            GL11.glTranslatef(0.0F, -24.0F * f5 - 0.0078125F, 0.0F);
            float f6 = p_76986_1_.prevLimbSwingAmount
                    + (p_76986_1_.limbSwingAmount - p_76986_1_.prevLimbSwingAmount) * p_76986_9_;
            float f7 = p_76986_1_.limbSwing - p_76986_1_.limbSwingAmount * (1.0F - p_76986_9_);

            if (p_76986_1_.isChild()) {
                f7 *= 3.0F;
            }

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

            GL11.glEnable(GL11.GL_ALPHA_TEST);
            this.mainModel.setLivingAnimations(p_76986_1_, f7, f6, p_76986_9_);
            this.renderModel(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5);
            int j;
            float f8;
            float f9;
            float f10;

            for (int i = 0; i < 4; ++i) {
                j = this.shouldRenderPass(p_76986_1_, i, p_76986_9_);

                if (j > 0) {
                    this.renderPassModel.setLivingAnimations(p_76986_1_, f7, f6, p_76986_9_);
                    this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5);

                    if ((j & 240) == 16) {
                        this.func_82408_c(p_76986_1_, i, p_76986_9_);
                        this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch,
                                f5);
                    }

                    if ((j & 15) == 15) {
                        f8 = (float) p_76986_1_.ticksExisted + p_76986_9_;
                        //this.bindTexture(RES_ITEM_GLINT);
                        GL11.glEnable(GL11.GL_BLEND);
                        f9 = 0.5F;
                        GL11.glColor4f(f9, f9, f9, 1.0F);
                        GL11.glDepthFunc(GL11.GL_EQUAL);
                        GL11.glDepthMask(false);

                        for (int k = 0; k < 2; ++k) {
                            GL11.glDisable(GL11.GL_LIGHTING);
                            f10 = 0.76F;
                            GL11.glColor4f(0.5F * f10, 0.25F * f10, 0.8F * f10, 1.0F);
                            GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
                            GL11.glMatrixMode(GL11.GL_TEXTURE);
                            GL11.glLoadIdentity();
                            float f11 = f8 * (0.001F + (float) k * 0.003F) * 20.0F;
                            float f12 = 0.33333334F;
                            GL11.glScalef(f12, f12, f12);
                            GL11.glRotatef(30.0F - (float) k * 60.0F, 0.0F, 0.0F, 1.0F);
                            GL11.glTranslatef(0.0F, f11, 0.0F);
                            GL11.glMatrixMode(GL11.GL_MODELVIEW);
                            this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2,
                                    p_76986_1_.rotationPitch, f5);
                        }

                        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                        GL11.glMatrixMode(GL11.GL_TEXTURE);
                        GL11.glDepthMask(true);
                        GL11.glLoadIdentity();
                        GL11.glMatrixMode(GL11.GL_MODELVIEW);
                        GL11.glEnable(GL11.GL_LIGHTING);
                        GL11.glDisable(GL11.GL_BLEND);
                        GL11.glDepthFunc(GL11.GL_LEQUAL);
                    }

                    GL11.glDisable(GL11.GL_BLEND);
                    GL11.glEnable(GL11.GL_ALPHA_TEST);
                }
            }

            GL11.glDepthMask(true);
            this.renderEquippedItems(p_76986_1_, p_76986_9_);
            float f14 = p_76986_1_.getBrightness(p_76986_9_);
            j = this.getColorMultiplier(p_76986_1_, f14, p_76986_9_);
            OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);

            if ((j >> 24 & 255) > 0 || p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0) {
                GL11.glDisable(GL11.GL_TEXTURE_2D);
                GL11.glDisable(GL11.GL_ALPHA_TEST);
                GL11.glEnable(GL11.GL_BLEND);
                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                GL11.glDepthFunc(GL11.GL_EQUAL);

                if (p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0) {
                    GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
                    this.mainModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5);

                    for (int l = 0; l < 4; ++l) {
                        if (this.inheritRenderPass(p_76986_1_, l, p_76986_9_) >= 0) {
                            GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
                            this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2,
                                    p_76986_1_.rotationPitch, f5);
                        }
                    }
                }

                if ((j >> 24 & 255) > 0) {
                    f8 = (float) (j >> 16 & 255) / 255.0F;
                    f9 = (float) (j >> 8 & 255) / 255.0F;
                    float f15 = (float) (j & 255) / 255.0F;
                    f10 = (float) (j >> 24 & 255) / 255.0F;
                    GL11.glColor4f(f8, f9, f15, f10);
                    this.mainModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5);

                    for (int i1 = 0; i1 < 4; ++i1) {
                        if (this.inheritRenderPass(p_76986_1_, i1, p_76986_9_) >= 0) {
                            GL11.glColor4f(f8, f9, f15, f10);
                            this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2,
                                    p_76986_1_.rotationPitch, f5);
                        }
                    }
                }

                GL11.glDepthFunc(GL11.GL_LEQUAL);
                GL11.glDisable(GL11.GL_BLEND);
                GL11.glEnable(GL11.GL_ALPHA_TEST);
                GL11.glEnable(GL11.GL_TEXTURE_2D);
            }

            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        } catch (Exception exception) {

        }

        OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glPopMatrix();
        this.passSpecialRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_);
    } else {
        super.doRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
    }
}

From source file:mattparks.mods.starcraft.io.client.SCIoSkyProvider.java

License:LGPL

@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
    GL11.glDisable(GL11.GL_TEXTURE_2D);/*from  w w  w  .  j a  v  a2s .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[] 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;
    }

    final 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);
    byte b0 = 16;
    tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F);

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

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

    // Render larger sun aura
    f10 = 40.0F;
    tessellator1.addVertex((double) -f10, 100.0D, (double) -f10);
    tessellator1.addVertex((double) 0, 100.0D, (double) -f10 * 1.5F);
    tessellator1.addVertex((double) f10, 100.0D, (double) -f10);
    tessellator1.addVertex((double) f10 * 1.5F, 100.0D, (double) 0);
    tessellator1.addVertex((double) f10, 100.0D, (double) f10);
    tessellator1.addVertex((double) 0, 100.0D, (double) f10 * 1.5F);
    tessellator1.addVertex((double) -f10, 100.0D, (double) f10);
    tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, (double) 0);
    tessellator1.addVertex((double) -f10, 100.0D, (double) -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 = 14.0F;
    mc.renderEngine.bindTexture(sunTexture);
    tessellator1.startDrawingQuads();
    tessellator1.addVertexWithUV((double) (-f10), 400.0D, (double) (-f10), 0.0D, 0.0D);
    tessellator1.addVertexWithUV((double) f10, 400.0D, (double) (-f10), 1.0D, 0.0D);
    tessellator1.addVertexWithUV((double) f10, 400.0D, (double) f10, 1.0D, 1.0D);
    tessellator1.addVertexWithUV((double) (-f10), 400.0D, (double) f10, 0.0D, 1.0D);
    tessellator1.draw();

    // JUPITER:
    var12 = 10.0F;
    final float jupiterRotation = (float) (world.getSpawnPoint().posZ - mc.thePlayer.posZ) * 0.01F;
    GL11.glRotatef(-180.0F, 0.0F, 1.0F, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 5F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 100.0F, 1.0F, 0.0F, 0.0F);
    var12 = 30.0F;
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(SCIoSkyProvider.jupiterTexture);
    var23.startDrawingQuads();
    var23.addVertexWithUV(-var12, 75.0D, -var12, 0.0D, 0.0D);
    var23.addVertexWithUV(var12, 75.0D, -var12, 1.0D, 0.0D);
    var23.addVertexWithUV(var12, 75.0D, var12, 1.0D, 1.0D);
    var23.addVertexWithUV(-var12, 75.0D, var12, 0.0D, 1.0D);
    var23.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(SCIoSkyProvider.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();

    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((double) (-f8), (double) f9, (double) f8);
        tessellator1.addVertex((double) f8, (double) f9, (double) f8);
        tessellator1.addVertex((double) f8, (double) f10, (double) f8);
        tessellator1.addVertex((double) (-f8), (double) f10, (double) f8);
        tessellator1.addVertex((double) (-f8), (double) f10, (double) (-f8));
        tessellator1.addVertex((double) f8, (double) f10, (double) (-f8));
        tessellator1.addVertex((double) f8, (double) f9, (double) (-f8));
        tessellator1.addVertex((double) (-f8), (double) f9, (double) (-f8));
        tessellator1.addVertex((double) f8, (double) f10, (double) (-f8));
        tessellator1.addVertex((double) f8, (double) f10, (double) f8);
        tessellator1.addVertex((double) f8, (double) f9, (double) f8);
        tessellator1.addVertex((double) f8, (double) f9, (double) (-f8));
        tessellator1.addVertex((double) (-f8), (double) f9, (double) (-f8));
        tessellator1.addVertex((double) (-f8), (double) f9, (double) f8);
        tessellator1.addVertex((double) (-f8), (double) f10, (double) f8);
        tessellator1.addVertex((double) (-f8), (double) f10, (double) (-f8));
        tessellator1.addVertex((double) (-f8), (double) f10, (double) (-f8));
        tessellator1.addVertex((double) (-f8), (double) f10, (double) f8);
        tessellator1.addVertex((double) f8, (double) f10, (double) f8);
        tessellator1.addVertex((double) f8, (double) f10, (double) (-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:mattparks.mods.starcraft.mercury.client.render.item.SCMercuryItemRendererSpaceshipT4.java

License:LGPL

@Override
protected void renderSpaceship(ItemRenderType type, RenderBlocks render, ItemStack item, float translateX,
        float translateY, float translateZ) {
    GL11.glPushMatrix();//w w  w. j av a2 s  .co  m

    this.transform(item, type);

    if (item.getItemDamage() < 10) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.texture);
        this.modelSpaceship.render(this.spaceship, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
        GL11.glPopMatrix();
    } else {
        FMLClientHandler.instance().getClient().renderEngine
                .bindTexture(SCMercuryItemRendererSpaceshipT4.cargoRocketTexture);
        this.cargoRocketModel.renderAll();
        GL11.glPopMatrix();
    }

    if (type == ItemRenderType.INVENTORY) {
        int index = Math.min(
                Math.max(item.getItemDamage() >= 10 ? item.getItemDamage() - 10 : item.getItemDamage(), 0),
                EnumRocketType.values().length - 1);

        if (EnumRocketType.values()[index].getInventorySpace() > 3) {
            final ModelChest modelChest = this.chestModel;
            FMLClientHandler.instance().getClient().renderEngine
                    .bindTexture(GCCoreItemRendererSpaceship.chestTexture);

            GL11.glPushMatrix();
            GL11.glDisable(GL11.GL_DEPTH_TEST);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glScalef(0.5F, -0.5F, -0.5F);
            GL11.glTranslatef(1.5F, 1.95F, 1.7F);
            final short short1 = 0;

            GL11.glRotatef(short1, 0.0F, 1.0F, 0.0F);
            GL11.glTranslatef(-1.5F, -1.5F, -1.5F);
            float f1 = 0;
            f1 = 1.0F - f1;
            f1 = 1.0F - f1 * f1 * f1;
            modelChest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);

            modelChest.chestBelow.render(0.0625F);
            modelChest.chestLid.render(0.0625F);
            modelChest.chestKnob.render(0.0625F);
            GL11.glEnable(GL11.GL_DEPTH_TEST);
            GL11.glPopMatrix();
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        }
    }
}

From source file:mattparks.mods.starcraft.mercury.client.render.item.SCMercuryItemRendererSpaceshipT4.java

License:LGPL

@Override
public void transform(ItemStack itemstack, ItemRenderType type) {
    final EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
    long var10 = this.spaceship.entityId * 493286711L;
    var10 = var10 * var10 * 4392167121L + var10 * 98761L;
    final float var12 = (((var10 >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
    final float var13 = (((var10 >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
    final float var14 = (((var10 >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;

    if (type == ItemRenderType.EQUIPPED) {
        if (itemstack.getItemDamage() >= 10) {
            GL11.glTranslatef(0.5F, 0.2F, 0F);
        }//w ww .  j a va2 s.  c  om

        GL11.glRotatef(70, 1.0F, 0, 0);
        GL11.glRotatef(-10, 0.0F, 1, 0);
        GL11.glRotatef(50, 0.0F, 1, 1);
        GL11.glTranslatef(0F, 2.0F, 0F);
        GL11.glScalef(5.2F, 5.2F, 5.2F);

        if (itemstack.getItemDamage() >= 10) {
            GL11.glTranslatef(0F, 0.45F, 0F);
            GL11.glScalef(0.45F, 0.45F, 0.45F);
        }

        if (player != null && player.ridingEntity != null
                && player.ridingEntity instanceof GCCoreEntityRocketT1) {
            GL11.glScalef(0.0F, 0.0F, 0.0F);
        }
    }

    if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
        GL11.glTranslatef(-0.5F, 4.2F, 0F);

        if (itemstack.getItemDamage() >= 10) {
            GL11.glTranslatef(0F, 1.5F, -6.0F);
        }

        GL11.glRotatef(28, 0.0F, 0, 1);
        GL11.glRotatef(50 + 180, 0.0F, 1, 0);
        GL11.glRotatef(73, 1.0F, 0, 0);
        GL11.glScalef(5.2F, 5.2F, 5.2F);

        if (player != null && player.ridingEntity != null
                && player.ridingEntity instanceof GCCoreEntityRocketT1) {
            GL11.glScalef(0.0F, 0.0F, 0.0F);
        }
    }

    GL11.glTranslatef(var12, var13 - 0.1F, var14);
    GL11.glScalef(-0.4F, -0.4F, 0.4F);

    if (type == ItemRenderType.INVENTORY || type == ItemRenderType.ENTITY) {
        if (type == ItemRenderType.INVENTORY) {
            GL11.glRotatef(85F, 1F, 0F, 1F);
            GL11.glRotatef(20F, 1F, 0F, 0F);
            GL11.glScalef(0.9F, 0.9F, 0.9F);
        } else {
            GL11.glTranslatef(0, -0.9F, 0);
            GL11.glScalef(0.5F, 0.5F, 0.5F);
        }

        if (itemstack.getItemDamage() >= 10) {
            GL11.glRotatef(90F, 1F, 0F, 1F);
            GL11.glScalef(0.45F, 0.45F, 0.45F);
            GL11.glTranslatef(0, -0.9F, 0);
            GL11.glTranslatef(0, -0.9F, 0);
            GL11.glTranslatef(0, -0.9F, 0);
        }

        GL11.glScalef(1.3F, 1.3F, 1.3F);
        GL11.glTranslatef(0, -0.6F, 0);
        GL11.glRotatef(Sys.getTime() / 90F % 360F * (itemstack.getItemDamage() >= 10 ? -1 : 1), 0F, 1F, 0F);
    }
}

From source file:mattparks.mods.starcraft.mercury.client.SCMercurySkyProvider.java

License:LGPL

@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
    SCMercuryWorldProvider gcProvider = null;

    if (world.provider instanceof SCMercuryWorldProvider) {
        gcProvider = (SCMercuryWorldProvider) world.provider;
    }//from  w  w w  .  j a va 2  s.  c om

    float var10;
    float var11;
    float var12;
    final Tessellator var23 = Tessellator.instance;

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    final Vec3 var2 = this.getCustomSkyColor();
    float var3 = (float) var2.xCoord * (1 - world.getStarBrightness(partialTicks) * 2);
    float var4 = (float) var2.yCoord * (1 - world.getStarBrightness(partialTicks) * 2);
    float var5 = (float) var2.zCoord * (1 - world.getStarBrightness(partialTicks) * 2);
    float var8;

    if (mc.gameSettings.anaglyph) {
        final float var6 = (var3 * 30.0F + var4 * 59.0F + var5 * 11.0F) / 100.0F;
        final float var7 = (var3 * 30.0F + var4 * 70.0F) / 100.0F;
        var8 = (var3 * 30.0F + var5 * 70.0F) / 100.0F;
        var3 = var6;
        var4 = var7;
        var5 = var8;
    }

    GL11.glColor3f(1, 1, 1);
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(0, 0, 0);
    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 var20 = 0;

    if (gcProvider != null) {
        var20 = gcProvider.getStarBrightness(partialTicks);
    }

    GL11.glPushMatrix();

    GL11.glDisable(GL11.GL_BLEND);

    GL11.glEnable(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();

    if (var20 > 0.0F) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, var20);
        GL11.glCallList(this.starGLCallList);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);

    GL11.glPushMatrix();

    // Sun:
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
    var12 = 30.0F;
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(SCMercurySkyProvider.sunTexture);
    var23.startDrawingQuads();
    var23.addVertexWithUV(-var12, 150.0D, -var12, 0.0D, 0.0D);
    var23.addVertexWithUV(var12, 150.0D, -var12, 1.0D, 0.0D);
    var23.addVertexWithUV(var12, 150.0D, var12, 1.0D, 1.0D);
    var23.addVertexWithUV(-var12, 150.0D, var12, 0.0D, 1.0D);
    var23.draw();

    GL11.glPopMatrix();

    GL11.glPushMatrix();

    GL11.glDisable(GL11.GL_BLEND);

    // OVERWORLD:
    var12 = 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(SCMercurySkyProvider.venusTexture);
    var23.startDrawingQuads();
    var23.addVertexWithUV(-var12, -100.0D, var12, 0, 1);
    var23.addVertexWithUV(var12, -100.0D, var12, 1, 1);
    var23.addVertexWithUV(var12, -100.0D, -var12, 1, 0);
    var23.addVertexWithUV(-var12, -100.0D, -var12, 0, 0);
    var23.draw();

    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);
    final double var25 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon();

    if (var25 < 0.0D) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, 12.0F, 0.0F);
        GL11.glCallList(this.glSkyList2);
        GL11.glPopMatrix();
        var10 = 1.0F;
        var11 = -((float) (var25 + 65.0D));
        var12 = -var10;
        var23.startDrawingQuads();
        var23.setColorRGBA_I(0, 255);
        var23.addVertex(-var10, var11, var10);
        var23.addVertex(var10, var11, var10);
        var23.addVertex(var10, var12, var10);
        var23.addVertex(-var10, var12, var10);
        var23.addVertex(-var10, var12, -var10);
        var23.addVertex(var10, var12, -var10);
        var23.addVertex(var10, var11, -var10);
        var23.addVertex(-var10, var11, -var10);
        var23.addVertex(var10, var12, -var10);
        var23.addVertex(var10, var12, var10);
        var23.addVertex(var10, var11, var10);
        var23.addVertex(var10, var11, -var10);
        var23.addVertex(-var10, var11, -var10);
        var23.addVertex(-var10, var11, var10);
        var23.addVertex(-var10, var12, var10);
        var23.addVertex(-var10, var12, -var10);
        var23.addVertex(-var10, var12, -var10);
        var23.addVertex(-var10, var12, var10);
        var23.addVertex(var10, var12, var10);
        var23.addVertex(var10, var12, -var10);
        var23.draw();
    }

    GL11.glColor3f(70F / 256F, 70F / 256F, 70F / 256F);

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

From source file:mattparks.mods.starcraft.moons.client.render.item.SCJupiterItemRendererSpaceshipT5.java

License:LGPL

@Override
protected void renderSpaceship(ItemRenderType type, RenderBlocks render, ItemStack item, float translateX,
        float translateY, float translateZ) {
    GL11.glPushMatrix();//w  w w  .  j  a va  2s .com

    this.transform(item, type);

    if (item.getItemDamage() < 10) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(this.texture);
        this.modelSpaceship.render(this.spaceship, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
        GL11.glPopMatrix();
    } else {
        FMLClientHandler.instance().getClient().renderEngine
                .bindTexture(SCJupiterItemRendererSpaceshipT5.cargoRocketTexture);
        this.cargoRocketModel.renderAll();
        GL11.glPopMatrix();
    }

    if (type == ItemRenderType.INVENTORY) {
        int index = Math.min(
                Math.max(item.getItemDamage() >= 10 ? item.getItemDamage() - 10 : item.getItemDamage(), 0),
                EnumRocketType.values().length - 1);

        if (EnumRocketType.values()[index].getInventorySpace() > 3) {
            final ModelChest modelChest = this.chestModel;
            FMLClientHandler.instance().getClient().renderEngine
                    .bindTexture(GCCoreItemRendererSpaceship.chestTexture);

            GL11.glPushMatrix();
            GL11.glDisable(GL11.GL_DEPTH_TEST);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glScalef(0.5F, -0.5F, -0.5F);
            GL11.glTranslatef(1.5F, 1.95F, 1.7F);
            final short short1 = 0;

            GL11.glRotatef(short1, 0.0F, 1.0F, 0.0F);
            GL11.glTranslatef(-1.5F, -1.5F, -1.5F);
            float f1 = 0;
            f1 = 1.0F - f1;
            f1 = 1.0F - f1 * f1 * f1;
            modelChest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);

            modelChest.chestBelow.render(0.0625F);
            modelChest.chestLid.render(0.0625F);
            modelChest.chestKnob.render(0.0625F);
            GL11.glEnable(GL11.GL_DEPTH_TEST);
            GL11.glPopMatrix();
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        }
    }
}