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:mca.client.render.RenderTombstone.java

License:Open Source License

public void renderTombstoneAt(TileTombstone tombstoneEntity, double posX, double posY, double posZ,
        float partialTickTime) {
    final StringBuilder stringBuilder = new StringBuilder();
    final FontRenderer fontRendererObj = func_147498_b();

    final int meta = tombstoneEntity.getBlockMetadata();
    final float rotation = setRotationByMeta(meta);

    GL11.glPushMatrix();//from w  w  w. j  a v a2s. c  om

    GL11.glTranslated(posX + 0.50F, posY + 1.59F, posZ + 0.53F);
    GL11.glRotatef(-rotation, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(0, 0.5F, 0);
    GL11.glScalef(1.4F, 1.4F, 1.4F);

    bindResource(TEXTURE);

    GL11.glPushMatrix();
    {
        GL11.glScalef(1F, -1F, -1F);
        tombstoneModel.renderTombstone();
    }
    GL11.glPopMatrix();

    //Text size is 0.017F.
    GL11.glTranslatef(0.0F, -1.15F, 0.07F);
    GL11.glScalef(0.017F / 2, -0.017F / 2, 0.017F / 2);
    GL11.glNormal3f(0.0F, 0.0F, -1F * 0.017F);
    GL11.glDepthMask(false);

    for (int line = 0; line < tombstoneEntity.signText.length; line++) {
        String lineText = tombstoneEntity.signText[line];

        if (line == tombstoneEntity.lineBeingEdited) {
            lineText = stringBuilder.append("> ").append(lineText).append(" <").toString();
        }

        fontRendererObj.drawString(lineText, -fontRendererObj.getStringWidth(lineText) / 2,
                line * 10 - tombstoneEntity.signText.length * 5, 0x000000);
    }

    GL11.glDepthMask(true);
    GL11.glPopMatrix();
}

From source file:me.cybermaxke.elementarrows.forge.render.RenderIce.java

License:Open Source License

@Override
public void doRender(Entity arg0, double arg1, double arg2, double arg3, float arg4, float arg5) {
    AxisAlignedBB aabb = arg0.boundingBox;

    float sizeX = (float) (aabb.maxX - aabb.minX) + 0.6f;
    float sizeY = (float) (aabb.maxY - aabb.minY) + 0.6f;
    float sizeZ = (float) (aabb.maxZ - aabb.minZ) + 0.6f;

    arg2 += sizeY / 2;//from ww  w  .  ja v  a2 s  . co  m

    int i = MathHelper.floor_double(arg0.posX);
    int j = MathHelper.floor_double(arg0.posY);
    int k = MathHelper.floor_double(arg0.posZ);

    GL11.glPushMatrix();
    GL11.glTranslatef((float) arg1, (float) arg2, (float) arg3);
    GL11.glScalef(sizeX, sizeY, sizeZ);

    this.bindEntityTexture(arg0);

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_BLEND);

    this.renderBlocks.setRenderBounds(0d, 0d, 0d, 1d, 1d, 1d);
    this.renderBlocks.renderBlockSandFalling(Blocks.ice, arg0.worldObj, i, j, k, 0);

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}

From source file:me.twentyonez.guardianchest.render.tile_entity.GCChestRenderer.java

License:LGPL

public void renderTileEntityAt(TileEntityGCChest p_147502_1_, double p_147502_2_, double p_147502_4_,
        double p_147502_6_, float p_147502_8_) {
    int i;/*w w w. java 2 s  .  c  o m*/

    if (!p_147502_1_.hasWorldObj()) {
        i = 0;
    } else {
        Block block = p_147502_1_.getBlockType();
        i = p_147502_1_.getBlockMetadata();

        if (block instanceof GCChest && i == 0) {
            try {
                ((GCChest) block).func_149954_e(p_147502_1_.getWorldObj(), p_147502_1_.xCoord,
                        p_147502_1_.yCoord, p_147502_1_.zCoord);
            } catch (ClassCastException e) {
                FMLLog.severe("Attempted to render a chest at %d,  %d, %d that was not a chest",
                        p_147502_1_.xCoord, p_147502_1_.yCoord, p_147502_1_.zCoord);
            }
            i = p_147502_1_.getBlockMetadata();
        }

        p_147502_1_.checkForAdjacentChests();
    }

    if (p_147502_1_.adjacentChestZNeg == null && p_147502_1_.adjacentChestXNeg == null) {
        ModelChest modelchest;

        modelchest = this.field_147510_h;
        this.bindTexture(field_147505_d);

        GL11.glPushMatrix();
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef((float) p_147502_2_, (float) p_147502_4_ + 1.0F, (float) p_147502_6_ + 1.0F);
        GL11.glScalef(1.0F, -1.0F, -1.0F);
        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
        short short1 = 0;

        if (i == 2) {
            short1 = 180;
        }

        if (i == 3) {
            short1 = 0;
        }

        if (i == 4) {
            short1 = 90;
        }

        if (i == 5) {
            short1 = -90;
        }

        if (i == 2 && p_147502_1_.adjacentChestXPos != null) {
            GL11.glTranslatef(1.0F, 0.0F, 0.0F);
        }

        if (i == 5 && p_147502_1_.adjacentChestZPos != null) {
            GL11.glTranslatef(0.0F, 0.0F, -1.0F);
        }

        GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        float f1 = p_147502_1_.prevLidAngle + (p_147502_1_.lidAngle - p_147502_1_.prevLidAngle) * p_147502_8_;
        float f2;

        if (p_147502_1_.adjacentChestZNeg != null) {
            f2 = p_147502_1_.adjacentChestZNeg.prevLidAngle
                    + (p_147502_1_.adjacentChestZNeg.lidAngle - p_147502_1_.adjacentChestZNeg.prevLidAngle)
                            * p_147502_8_;

            if (f2 > f1) {
                f1 = f2;
            }
        }

        if (p_147502_1_.adjacentChestXNeg != null) {
            f2 = p_147502_1_.adjacentChestXNeg.prevLidAngle
                    + (p_147502_1_.adjacentChestXNeg.lidAngle - p_147502_1_.adjacentChestXNeg.prevLidAngle)
                            * p_147502_8_;

            if (f2 > f1) {
                f1 = f2;
            }
        }

        f1 = 1.0F - f1;
        f1 = 1.0F - f1 * f1 * f1;
        modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
        modelchest.renderAll();
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    }
}

From source file:me.twentyonez.guardianchest.render.tile_entity.ItemGuardianTier0Renderer.java

License:LGPL

public void renderTileEntityAt(TileEntityItemGuardianTier0 p_147502_1_, double p_147502_2_, double p_147502_4_,
        double p_147502_6_, float p_147502_8_) {
    int i;//from   ww w  .j  a  v a 2  s. c  o m

    if (!p_147502_1_.hasWorldObj()) {
        i = 0;
    } else {
        Block block = p_147502_1_.getBlockType();
        i = p_147502_1_.getBlockMetadata();

        if (block instanceof GCChest && i == 0) {
            try {
                ((GCChest) block).func_149954_e(p_147502_1_.getWorldObj(), p_147502_1_.xCoord,
                        p_147502_1_.yCoord, p_147502_1_.zCoord);
            } catch (ClassCastException e) {
                FMLLog.severe("Attempted to render a chest at %d,  %d, %d that was not a chest",
                        p_147502_1_.xCoord, p_147502_1_.yCoord, p_147502_1_.zCoord);
            }
            i = p_147502_1_.getBlockMetadata();
        }

        p_147502_1_.checkForAdjacentChests();
    }

    if (p_147502_1_.adjacentChestZNeg == null && p_147502_1_.adjacentChestXNeg == null) {
        ModelChest modelchest;

        if (p_147502_1_.adjacentChestXPos == null && p_147502_1_.adjacentChestZPos == null) {
            modelchest = this.field_147510_h;

            this.bindTexture(field_147504_g);

        } else {
            modelchest = this.field_147511_i;

            this.bindTexture(field_147505_d);

        }

        GL11.glPushMatrix();
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef((float) p_147502_2_, (float) p_147502_4_ + 1.0F, (float) p_147502_6_ + 1.0F);
        GL11.glScalef(1.0F, -1.0F, -1.0F);
        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
        short short1 = 0;

        if (i == 2) {
            short1 = 180;
        }

        if (i == 3) {
            short1 = 0;
        }

        if (i == 4) {
            short1 = 90;
        }

        if (i == 5) {
            short1 = -90;
        }

        if (i == 2 && p_147502_1_.adjacentChestXPos != null) {
            GL11.glTranslatef(1.0F, 0.0F, 0.0F);
        }

        if (i == 5 && p_147502_1_.adjacentChestZPos != null) {
            GL11.glTranslatef(0.0F, 0.0F, -1.0F);
        }

        GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        float f1 = p_147502_1_.prevLidAngle + (p_147502_1_.lidAngle - p_147502_1_.prevLidAngle) * p_147502_8_;
        float f2;

        if (p_147502_1_.adjacentChestZNeg != null) {
            f2 = p_147502_1_.adjacentChestZNeg.prevLidAngle
                    + (p_147502_1_.adjacentChestZNeg.lidAngle - p_147502_1_.adjacentChestZNeg.prevLidAngle)
                            * p_147502_8_;

            if (f2 > f1) {
                f1 = f2;
            }
        }

        if (p_147502_1_.adjacentChestXNeg != null) {
            f2 = p_147502_1_.adjacentChestXNeg.prevLidAngle
                    + (p_147502_1_.adjacentChestXNeg.lidAngle - p_147502_1_.adjacentChestXNeg.prevLidAngle)
                            * p_147502_8_;

            if (f2 > f1) {
                f1 = f2;
            }
        }

        f1 = 1.0F - f1;
        f1 = 1.0F - f1 * f1 * f1;
        modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
        modelchest.renderAll();
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    }
}

From source file:me.twentyonez.guardianchest.render.tile_entity.ItemGuardianTier1Renderer.java

License:LGPL

public void renderTileEntityAt(TileEntityItemGuardianTier1 p_147502_1_, double p_147502_2_, double p_147502_4_,
        double p_147502_6_, float p_147502_8_) {
    int i;/*from ww  w . j av  a  2  s  . c o m*/

    if (!p_147502_1_.hasWorldObj()) {
        i = 0;
    } else {
        Block block = p_147502_1_.getBlockType();
        i = p_147502_1_.getBlockMetadata();

        if (block instanceof GCChest && i == 0) {
            try {
                ((GCChest) block).func_149954_e(p_147502_1_.getWorldObj(), p_147502_1_.xCoord,
                        p_147502_1_.yCoord, p_147502_1_.zCoord);
            } catch (ClassCastException e) {
                FMLLog.severe("Attempted to render a chest at %d,  %d, %d that was not a chest",
                        p_147502_1_.xCoord, p_147502_1_.yCoord, p_147502_1_.zCoord);
            }
            i = p_147502_1_.getBlockMetadata();
        }

        p_147502_1_.checkForAdjacentChests();
    }

    if (p_147502_1_.adjacentChestZNeg == null && p_147502_1_.adjacentChestXNeg == null) {
        ModelChest modelchest;

        if (p_147502_1_.adjacentChestXPos == null && p_147502_1_.adjacentChestZPos == null) {
            modelchest = this.field_147510_h;

            this.bindTexture(field_147504_g);

        } else {
            modelchest = this.field_147511_i;

            this.bindTexture(field_147505_d);

        }

        GL11.glPushMatrix();
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef((float) p_147502_2_, (float) p_147502_4_ + 1.0F, (float) p_147502_6_ + 1.0F);
        GL11.glScalef(1.0F, -1.0F, -1.0F);
        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
        short short1 = 0;

        if (i == 2) {
            short1 = 180;
        }

        if (i == 3) {
            short1 = 0;
        }

        if (i == 4) {
            short1 = 90;
        }

        if (i == 5) {
            short1 = -90;
        }

        if (i == 2 && p_147502_1_.adjacentChestXPos != null) {
            GL11.glTranslatef(1.0F, 0.0F, 0.0F);
        }

        if (i == 5 && p_147502_1_.adjacentChestZPos != null) {
            GL11.glTranslatef(0.0F, 0.0F, -1.0F);
        }

        GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        float f1 = p_147502_1_.prevLidAngle + (p_147502_1_.lidAngle - p_147502_1_.prevLidAngle) * p_147502_8_;
        float f2;

        if (p_147502_1_.adjacentChestZNeg != null) {
            f2 = p_147502_1_.adjacentChestZNeg.prevLidAngle
                    + (p_147502_1_.adjacentChestZNeg.lidAngle - p_147502_1_.adjacentChestZNeg.prevLidAngle)
                            * p_147502_8_;

            if (f2 > f1) {
                f1 = f2;
            }
        }

        if (p_147502_1_.adjacentChestXNeg != null) {
            f2 = p_147502_1_.adjacentChestXNeg.prevLidAngle
                    + (p_147502_1_.adjacentChestXNeg.lidAngle - p_147502_1_.adjacentChestXNeg.prevLidAngle)
                            * p_147502_8_;

            if (f2 > f1) {
                f1 = f2;
            }
        }

        f1 = 1.0F - f1;
        f1 = 1.0F - f1 * f1 * f1;
        modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
        modelchest.renderAll();
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    }
}

From source file:me.twentyonez.guardianchest.render.tile_entity.ItemGuardianTier2Renderer.java

License:LGPL

public void renderTileEntityAt(TileEntityItemGuardianTier2 p_147502_1_, double p_147502_2_, double p_147502_4_,
        double p_147502_6_, float p_147502_8_) {
    int i;/*w  w w  .  j a v  a  2  s .  c  o m*/

    if (!p_147502_1_.hasWorldObj()) {
        i = 0;
    } else {
        Block block = p_147502_1_.getBlockType();
        i = p_147502_1_.getBlockMetadata();

        if (block instanceof GCChest && i == 0) {
            try {
                ((GCChest) block).func_149954_e(p_147502_1_.getWorldObj(), p_147502_1_.xCoord,
                        p_147502_1_.yCoord, p_147502_1_.zCoord);
            } catch (ClassCastException e) {
                FMLLog.severe("Attempted to render a chest at %d,  %d, %d that was not a chest",
                        p_147502_1_.xCoord, p_147502_1_.yCoord, p_147502_1_.zCoord);
            }
            i = p_147502_1_.getBlockMetadata();
        }

        p_147502_1_.checkForAdjacentChests();
    }

    if (p_147502_1_.adjacentChestZNeg == null && p_147502_1_.adjacentChestXNeg == null) {
        ModelChest modelchest;

        if (p_147502_1_.adjacentChestXPos == null && p_147502_1_.adjacentChestZPos == null) {
            modelchest = this.field_147510_h;

            this.bindTexture(field_147504_g);

        } else {
            modelchest = this.field_147511_i;

            this.bindTexture(field_147505_d);

        }

        GL11.glPushMatrix();
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef((float) p_147502_2_, (float) p_147502_4_ + 1.0F, (float) p_147502_6_ + 1.0F);
        GL11.glScalef(1.0F, -1.0F, -1.0F);
        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
        short short1 = 0;

        if (i == 2) {
            short1 = 180;
        }

        if (i == 3) {
            short1 = 0;
        }

        if (i == 4) {
            short1 = 90;
        }

        if (i == 5) {
            short1 = -90;
        }

        if (i == 2 && p_147502_1_.adjacentChestXPos != null) {
            GL11.glTranslatef(1.0F, 0.0F, 0.0F);
        }

        if (i == 5 && p_147502_1_.adjacentChestZPos != null) {
            GL11.glTranslatef(0.0F, 0.0F, -1.0F);
        }

        GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        float f1 = p_147502_1_.prevLidAngle + (p_147502_1_.lidAngle - p_147502_1_.prevLidAngle) * p_147502_8_;
        float f2;

        if (p_147502_1_.adjacentChestZNeg != null) {
            f2 = p_147502_1_.adjacentChestZNeg.prevLidAngle
                    + (p_147502_1_.adjacentChestZNeg.lidAngle - p_147502_1_.adjacentChestZNeg.prevLidAngle)
                            * p_147502_8_;

            if (f2 > f1) {
                f1 = f2;
            }
        }

        if (p_147502_1_.adjacentChestXNeg != null) {
            f2 = p_147502_1_.adjacentChestXNeg.prevLidAngle
                    + (p_147502_1_.adjacentChestXNeg.lidAngle - p_147502_1_.adjacentChestXNeg.prevLidAngle)
                            * p_147502_8_;

            if (f2 > f1) {
                f1 = f2;
            }
        }

        f1 = 1.0F - f1;
        f1 = 1.0F - f1 * f1 * f1;
        modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
        modelchest.renderAll();
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    }
}

From source file:me.ukl.api.gui.component.CheckBox.java

License:MIT License

@Override
public void render() {
    this.drawBackground();
    Color checkColor = isChecked() ? getCheckedColor() : getUncheckedColor();
    float checkScale = getHeight() - 4;
    GL11.glPushMatrix();//from w ww .  j a v  a2  s .  c  o  m
    GL11.glTranslatef(getX() + getWidth() / 2, getY() + getHeight() / 2, 0);
    GL11.glScalef(checkScale, checkScale, checkScale);
    GL11.glTranslatef(0.05F, 0F, 0F);
    GL11.glRotatef(-45, 0, 0, 1);
    RenderUtil.drawRect(-0.5F, 0, 1F, 0.2F, checkColor);
    GL11.glTranslatef(-0.5F, 0F, 0F);
    GL11.glRotatef(-90, 0, 0, 1);
    RenderUtil.drawRect(-0.2F, 0F, 1 / 3F + 0.2F, 0.2F, checkColor);
    GL11.glPopMatrix();
}

From source file:me.undergroundminer3.uee4.pipesModded.AdvPipeRenderer.java

License:Minecraft Mod Public

@Deprecated
//please copy this instead
public void pipeWireRender(TileGenericPipe pipe, float cx, float cy, float cz, PipeWire color, double x,
        double y, double z) {

    PipeRenderState state = pipe.renderState;

    float minX = CoreConstants.PIPE_MIN_POS;
    float minY = CoreConstants.PIPE_MIN_POS;
    float minZ = CoreConstants.PIPE_MIN_POS;

    float maxX = CoreConstants.PIPE_MAX_POS;
    float maxY = CoreConstants.PIPE_MAX_POS;
    float maxZ = CoreConstants.PIPE_MAX_POS;

    boolean foundX = false, foundY = false, foundZ = false;

    if (state.wireMatrix.isWireConnected(color, ForgeDirection.WEST)) {
        minX = 0;//from  w w  w .  jav a 2  s. c  o m
        foundX = true;
    }

    if (state.wireMatrix.isWireConnected(color, ForgeDirection.EAST)) {
        maxX = 1;
        foundX = true;
    }

    if (state.wireMatrix.isWireConnected(color, ForgeDirection.DOWN)) {
        minY = 0;
        foundY = true;
    }

    if (state.wireMatrix.isWireConnected(color, ForgeDirection.UP)) {
        maxY = 1;
        foundY = true;
    }

    if (state.wireMatrix.isWireConnected(color, ForgeDirection.NORTH)) {
        minZ = 0;
        foundZ = true;
    }

    if (state.wireMatrix.isWireConnected(color, ForgeDirection.SOUTH)) {
        maxZ = 1;
        foundZ = true;
    }

    boolean center = false;

    if (minX == 0 && maxX != 1 && (foundY || foundZ))
        if (cx == CoreConstants.PIPE_MIN_POS) {
            maxX = CoreConstants.PIPE_MIN_POS;
        } else {
            center = true;
        }

    if (minX != 0 && maxX == 1 && (foundY || foundZ))
        if (cx == CoreConstants.PIPE_MAX_POS) {
            minX = CoreConstants.PIPE_MAX_POS;
        } else {
            center = true;
        }

    if (minY == 0 && maxY != 1 && (foundX || foundZ))
        if (cy == CoreConstants.PIPE_MIN_POS) {
            maxY = CoreConstants.PIPE_MIN_POS;
        } else {
            center = true;
        }

    if (minY != 0 && maxY == 1 && (foundX || foundZ))
        if (cy == CoreConstants.PIPE_MAX_POS) {
            minY = CoreConstants.PIPE_MAX_POS;
        } else {
            center = true;
        }

    if (minZ == 0 && maxZ != 1 && (foundX || foundY))
        if (cz == CoreConstants.PIPE_MIN_POS) {
            maxZ = CoreConstants.PIPE_MIN_POS;
        } else {
            center = true;
        }

    if (minZ != 0 && maxZ == 1 && (foundX || foundY))
        if (cz == CoreConstants.PIPE_MAX_POS) {
            minZ = CoreConstants.PIPE_MAX_POS;
        } else {
            center = true;
        }

    boolean found = foundX || foundY || foundZ;

    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_CULL_FACE);
    RenderHelper.disableStandardItemLighting();

    GL11.glColor3f(1, 1, 1);
    GL11.glTranslatef((float) x, (float) y, (float) z);

    float scale = 1.001f;
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    GL11.glScalef(scale, scale, scale);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

    bindTexture(TextureMap.locationBlocksTexture);

    RenderInfo box = new RenderInfo();
    box.texture = BuildCraftTransport.instance.wireIconProvider
            .getIcon(state.wireMatrix.getWireIconIndex(color));

    // Z render

    if (minZ != CoreConstants.PIPE_MIN_POS || maxZ != CoreConstants.PIPE_MAX_POS || !found) {
        box.setBounds(cx == CoreConstants.PIPE_MIN_POS ? cx - 0.05F : cx,
                cy == CoreConstants.PIPE_MIN_POS ? cy - 0.05F : cy, minZ,
                cx == CoreConstants.PIPE_MIN_POS ? cx : cx + 0.05F,
                cy == CoreConstants.PIPE_MIN_POS ? cy : cy + 0.05F, maxZ);
        RenderEntityBlock.INSTANCE.renderBlock(box, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord,
                pipe.zCoord, true, true);
    }

    // X render

    if (minX != CoreConstants.PIPE_MIN_POS || maxX != CoreConstants.PIPE_MAX_POS || !found) {
        box.setBounds(minX, cy == CoreConstants.PIPE_MIN_POS ? cy - 0.05F : cy,
                cz == CoreConstants.PIPE_MIN_POS ? cz - 0.05F : cz, maxX,
                cy == CoreConstants.PIPE_MIN_POS ? cy : cy + 0.05F,
                cz == CoreConstants.PIPE_MIN_POS ? cz : cz + 0.05F);
        RenderEntityBlock.INSTANCE.renderBlock(box, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord,
                pipe.zCoord, true, true);
    }

    // Y render

    if (minY != CoreConstants.PIPE_MIN_POS || maxY != CoreConstants.PIPE_MAX_POS || !found) {
        box.setBounds(cx == CoreConstants.PIPE_MIN_POS ? cx - 0.05F : cx, minY,
                cz == CoreConstants.PIPE_MIN_POS ? cz - 0.05F : cz,
                cx == CoreConstants.PIPE_MIN_POS ? cx : cx + 0.05F, maxY,
                cz == CoreConstants.PIPE_MIN_POS ? cz : cz + 0.05F);
        RenderEntityBlock.INSTANCE.renderBlock(box, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord,
                pipe.zCoord, true, true);
    }

    if (center || !found) {
        box.setBounds(cx == CoreConstants.PIPE_MIN_POS ? cx - 0.05F : cx,
                cy == CoreConstants.PIPE_MIN_POS ? cy - 0.05F : cy,
                cz == CoreConstants.PIPE_MIN_POS ? cz - 0.05F : cz,
                cx == CoreConstants.PIPE_MIN_POS ? cx : cx + 0.05F,
                cy == CoreConstants.PIPE_MIN_POS ? cy : cy + 0.05F,
                cz == CoreConstants.PIPE_MIN_POS ? cz : cz + 0.05F);
        RenderEntityBlock.INSTANCE.renderBlock(box, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord,
                pipe.zCoord, true, true);
    }

    RenderHelper.enableStandardItemLighting();

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:me.undergroundminer3.uee4.pipesModded.AdvPipeRenderer.java

License:Minecraft Mod Public

@Deprecated
//please copy this instead
public void renderPower(Pipe<PipeTransportPower> pipe, double x, double y, double z) {
    initializeDisplayPowerList(pipe.container.getWorldObj());

    PipeTransportPower pow = pipe.transport;

    GL11.glPushMatrix();/*from  w  w w.  java2 s  .  c o m*/
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glDisable(GL11.GL_LIGHTING);
    //      GL11.glEnable(GL11.GL_BLEND);

    GL11.glTranslatef((float) x, (float) y, (float) z);

    bindTexture(TextureMap.locationBlocksTexture);

    int[] displayList = pow.overload > 0 ? displayPowerListOverload : displayPowerList;

    for (int side = 0; side < 6; ++side) {
        GL11.glPushMatrix();

        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
        GL11.glRotatef(angleY[side], 0, 1, 0);
        GL11.glRotatef(angleZ[side], 0, 0, 1);
        float scale = 1.0F - side * 0.0001F;
        GL11.glScalef(scale, scale, scale);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

        short stage = pow.clientDisplayPower[side];
        if (stage >= 1) {
            if (stage < displayList.length) {
                GL11.glCallList(displayList[stage]);
            } else {
                GL11.glCallList(displayList[displayList.length - 1]);
            }
        }

        GL11.glPopMatrix();
    }

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:micdoodle8.mods.galacticraft.planets.mars.client.SkyProviderMars.java

License:LGPL

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

    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;
    }

    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(-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, 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(-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 = 14.0F;
    mc.renderEngine.bindTexture(SkyProviderMars.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(SkyProviderMars.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(-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);
}