Java Code Examples for org.lwjgl.opengl.GL11#glColor4d()

The following examples show how to use org.lwjgl.opengl.GL11#glColor4d() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModelVacuumPump.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
private void drawPlusAndMinus(){
    double scale = 0.05D;
    GL11.glPushMatrix();
    GL11.glTranslated(0.26D, 13.95D / 16D, 0);
    GL11.glRotated(90, 1, 0, 0);
    GL11.glScaled(scale, scale, scale);
    GL11.glColor4d(0, 1, 0, 1);
    Tessellator tess = Tessellator.instance;
    tess.startDrawing(GL11.GL_LINES);
    tess.addVertex(-1, 0, 0);
    tess.addVertex(1, 0, 0);
    tess.addVertex(0, -1, 0);
    tess.addVertex(0, 1, 0);
    tess.draw();
    GL11.glTranslated(-0.52D / scale, 0, 0);
    GL11.glColor4d(1, 0, 0, 1);
    tess.startDrawing(GL11.GL_LINES);
    tess.addVertex(-1, 0, 0);
    tess.addVertex(1, 0, 0);
    tess.draw();
    GL11.glPopMatrix();
}
 
Example 2
Source File: GLUtils.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
public static void startDrawingESPs(double d, double d1, double d2, double r, double g, double b2) {

        GL11.glPushMatrix();
        GL11.glEnable(3042);
        GL11.glBlendFunc(770, 771);
        GL11.glLineWidth(1.5f);
        GL11.glDisable(2896);
        GL11.glDisable(3553);
        GL11.glEnable(2848);
        GL11.glDisable(2929);
        GL11.glDepthMask(false);
        GL11.glColor4d(r, g, b2, 0.1850000023841858);
        GLUtils.drawBoundingBox(new AltAxisAlignedBB(d, d1, d2, d + 1.0, d1 + 1.0, d2 + 1.0));
        GL11.glColor4d(r, g, b2, 1.0);
        GLUtils.drawOutlinedBoundingBox(new AltAxisAlignedBB(d, d1, d2, d + 1.0, d1 + 1.0, d2 + 1.0));
        GL11.glLineWidth(2.0f);
        GL11.glDisable(2848);
        GL11.glEnable(3553);
        GL11.glEnable(2896);
        GL11.glEnable(2929);
        GL11.glDepthMask(true);
        GL11.glDisable(3042);
        GL11.glPopMatrix();
    }
 
Example 3
Source File: Minigun.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@SideOnly(Side.CLIENT)
public void render(double x, double y, double z, double gunRadius){
    if(isMinigunActivated() && getMinigunSpeed() == MAX_GUN_SPEED && gunAimedAtTarget && attackTarget != null) {
        GL11.glPushMatrix();
        GL11.glScaled(1, 1, 1);
        GL11.glTranslated(-x, -y, -z);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        //GL11.glDisable(GL11.GL_LIGHTING);
        RenderUtils.glColorHex(0xFF000000 | getAmmoColor());
        for(int i = 0; i < 5; i++) {

            Vec3 vec = Vec3.createVectorHelper(attackTarget.posX - x, attackTarget.posY - y, attackTarget.posZ - z).normalize();
            minigunFire.startX = x + vec.xCoord * gunRadius;
            minigunFire.startY = y + vec.yCoord * gunRadius;
            minigunFire.startZ = z + vec.zCoord * gunRadius;
            minigunFire.endX = attackTarget.posX + rand.nextDouble() - 0.5;
            minigunFire.endY = attackTarget.posY + attackTarget.height / 2 + rand.nextDouble() - 0.5;
            minigunFire.endZ = attackTarget.posZ + rand.nextDouble() - 0.5;
            minigunFire.render();
        }
        GL11.glColor4d(1, 1, 1, 1);
        // GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glPopMatrix();
    }
}
 
Example 4
Source File: SemiBlockRendererLogistics.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(SemiBlockLogistics semiBlock, float partialTick){
    int alpha = semiBlock.getAlpha();
    if(alpha == 0) return;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    //GL11.glEnable(GL11.GL_LIGHTING);
    //GL11.glColor4d(1, 0, 0, 1);
    if(alpha < 255) GL11.glEnable(GL11.GL_BLEND);
    RenderUtils.glColorHex((alpha << 24 | 0x00FFFFFF) & semiBlock.getColor());
    double fw = 1 / 32D;
    AxisAlignedBB aabb;
    if(semiBlock.getWorld() != null) {
        semiBlock.getBlock().setBlockBoundsBasedOnState(semiBlock.getWorld(), semiBlock.getPos().chunkPosX, semiBlock.getPos().chunkPosY, semiBlock.getPos().chunkPosZ);
        aabb = semiBlock.getBlock().getSelectedBoundingBoxFromPool(semiBlock.getWorld(), semiBlock.getPos().chunkPosX, semiBlock.getPos().chunkPosY, semiBlock.getPos().chunkPosZ);
    } else {
        aabb = AxisAlignedBB.getBoundingBox(0 + fw, 0 + fw, 0 + fw, 1 - fw, 1 - fw, 1 - fw);
    }

    if(semiBlock.getPos() != null) GL11.glTranslated(-semiBlock.getPos().chunkPosX, -semiBlock.getPos().chunkPosY, -semiBlock.getPos().chunkPosZ);

    renderFrame(aabb, fw);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glColor4d(1, 1, 1, 1);
}
 
Example 5
Source File: GuiContainerBase.java    From Signals with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void drawScreen(int x, int y, float partialTick){
    if(!hasInit) return;
    super.drawScreen(x, y, partialTick);

    List<String> tooltip = new ArrayList<>();

    GL11.glColor4d(1, 1, 1, 1);
    GL11.glDisable(GL11.GL_LIGHTING);
    for(IGuiWidget widget : widgets) {
        if(widget.getBounds().contains(x, y)) widget.addTooltip(x, y, tooltip, Signals.proxy.isSneakingInGui());
    }

    if(!tooltip.isEmpty()) {
        List<String> localizedTooltip = new ArrayList<>();
        for(String line : tooltip) {
            String localizedLine = I18n.format(line);
            String[] lines = WordUtils.wrap(localizedLine, 50).split(System.getProperty("line.separator"));
            for(String locLine : lines) {
                localizedTooltip.add(locLine);
            }
        }
        drawHoveringText(localizedTooltip, x, y, fontRenderer);
    }
}
 
Example 6
Source File: GuiCheckBox.java    From Signals with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTick){
    drawRect(x, y, x + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT, enabled ? -6250336 : 0xFF999999);
    drawRect(x + 1, y + 1, x + CHECKBOX_WIDTH - 1, y + CHECKBOX_HEIGHT - 1, enabled ? -16777216 : 0xFFAAAAAA);
    if(checked) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        if(enabled) {
            GL11.glColor4d(1, 1, 1, 1);
        } else {
            GL11.glColor4d(0.8, 0.8, 0.8, 1);
        }
        BufferBuilder wr = Tessellator.getInstance().getBuffer();
        wr.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
        wr.pos(x + 2, y + 5, zLevel).endVertex();
        wr.pos(x + 5, y + 7, zLevel).endVertex();
        wr.pos(x + 8, y + 3, zLevel).endVertex();
        Tessellator.getInstance().draw();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
    fontRenderer.drawString(I18n.format(text), x + 1 + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT / 2 - fontRenderer.FONT_HEIGHT / 2, enabled ? color : 0xFF888888);
}
 
Example 7
Source File: WidgetFluidFilter.java    From Signals with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTick){
    if(fluid != null) {
        ResourceLocation icon = fluid.getStill();
        if(icon != null) {
            GL11.glColor4d(1, 1, 1, 1);
            GL11.glPushMatrix();
            GL11.glTranslated(x, y, 0);
            Minecraft.getMinecraft().getTextureManager().bindTexture(icon);
            BufferBuilder wr = Tessellator.getInstance().getBuffer();
            wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
            wr.pos(0, 0, 0).tex(0, 0).endVertex();
            wr.pos(0, 16, 0).tex(0, 1).endVertex();
            wr.pos(16, 16, 0).tex(1, 1).endVertex();
            wr.pos(16, 0, 0).tex(1, 0).endVertex();
            Tessellator.getInstance().draw();
            GL11.glPopMatrix();
        }
    }
}
 
Example 8
Source File: WidgetVerticalScrollbar.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTick){
    GL11.glColor4d(1, 1, 1, 1);
    if(!Mouse.isButtonDown(0)) dragging = false;
    if(!wasClicking && Mouse.isButtonDown(0) && getBounds().contains(mouseX, mouseY)) {
        dragging = true;
    }
    if(!enabled) dragging = false;
    wasClicking = Mouse.isButtonDown(0);
    if(dragging) currentScroll = (float)(mouseY - 7 - getBounds().y) / (getBounds().height - 17);
    currentScroll = MathHelper.clamp_float(currentScroll, 0, 1);
    Minecraft.getMinecraft().getTextureManager().bindTexture(scrollTexture);
    Gui.func_146110_a(x, y, 12, 0, getBounds().width, 1, 26, 15);
    for(int i = 0; i < getBounds().height - 2; i++)
        Gui.func_146110_a(x, y + 1 + i, 12, 1, getBounds().width, 1, 26, 15);
    Gui.func_146110_a(x, y + getBounds().height - 1, 12, 14, getBounds().width, 1, 26, 15);

    if(!enabled) GL11.glColor4d(0.6, 0.6, 0.6, 1);
    Gui.func_146110_a(x + 1, y + 1 + (int)((getBounds().height - 17) * currentScroll), 0, 0, 12, 15, 26, 15);
    GL11.glColor4d(1, 1, 1, 1);
}
 
Example 9
Source File: ModelHeatSink.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void renderStatic(float size, TileEntity te){

    if(te != null) {
        int heatLevel = ((TileEntityCompressedIronBlock)te).getHeatLevel();
        double[] color = TileEntityCompressedIronBlock.getColorForHeatLevel(heatLevel);
        GL11.glColor4d(color[0], color[1], color[2], 1);
        GL11.glTranslated(0.5, 0.5, 0);
        GL11.glRotated(90, 1, 0, 0);
        GL11.glTranslated(-0.5, -1, -0.5);
    }
    Shape1.render(size);
    Shape2.render(size);
    Shape3.render(size);
    Shape4.render(size);
    Shape5.render(size);
    Shape6.render(size);
    Shape7.render(size);
    Shape8.render(size);
    Shape9.render(size);
    Shape10.render(size);
    Shape11.render(size);
    Shape12.render(size);
}
 
Example 10
Source File: WidgetTemperature.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTick){
    GL11.glDisable(GL11.GL_LIGHTING);
    Minecraft.getMinecraft().getTextureManager().bindTexture(Textures.WIDGET_TEMPERATURE);
    GL11.glColor4d(1, 1, 1, 1);
    Gui.func_146110_a(x + 6, y, 6, 0, 7, 50, 18, 50);

    int barLength = ((int)logic.getTemperature() - minTemp) * 48 / maxTemp;
    barLength = MathHelper.clamp_int(barLength, 0, 48);
    Gui.func_146110_a(x + 7, y + 1 + 48 - barLength, 13, 48 - barLength, 5, barLength, 18, 50);

    for(int scale : scales) {
        int scaleY = 48 - (scale - minTemp) * 48 / maxTemp;
        Gui.func_146110_a(x, y - 1 + scaleY, 0, 0, 6, 5, 18, 50);
    }
}
 
Example 11
Source File: RenderItemMinigun.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
private void renderEffects(ItemStack stack){
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
    Minigun minigun = ((ItemMinigun)Itemss.minigun).getMinigun(stack, player);
    if(minigun.isMinigunActivated() && minigun.getMinigunSpeed() == Minigun.MAX_GUN_SPEED) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        RenderUtils.glColorHex(0xFF000000 | minigun.getAmmoColor());
        for(int i = 0; i < 5; i++) {
            minigunFire.startX = -0.5;
            minigunFire.startY = 0.6;
            minigunFire.startZ = 0.4;
            minigunFire.endX = 0.2 * (player.getRNG().nextDouble() - 0.5) - 1;
            minigunFire.endY = 0.2 * (player.getRNG().nextDouble() - 0.5);
            minigunFire.endZ = 7;
            minigunFire.render();
        }
        GL11.glColor4d(1, 1, 1, 1);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
}
 
Example 12
Source File: SemiBlockRendererHeatFrame.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void render(SemiBlockHeatFrame semiBlock, float partialTick){
    GL11.glPushMatrix();
    Minecraft.getMinecraft().renderEngine.bindTexture(Textures.MODEL_HEAT_FRAME);
    int heatLevel = semiBlock.getHeatLevel();
    double[] color = TileEntityCompressedIronBlock.getColorForHeatLevel(heatLevel);
    GL11.glColor4d(color[0], color[1], color[2], 1);

    AxisAlignedBB aabb;
    if(semiBlock.getWorld() != null) {
        semiBlock.getBlock().setBlockBoundsBasedOnState(semiBlock.getWorld(), semiBlock.getPos().chunkPosX, semiBlock.getPos().chunkPosY, semiBlock.getPos().chunkPosZ);
        aabb = semiBlock.getBlock().getSelectedBoundingBoxFromPool(semiBlock.getWorld(), semiBlock.getPos().chunkPosX, semiBlock.getPos().chunkPosY, semiBlock.getPos().chunkPosZ);
        aabb.minX -= semiBlock.getX();
        aabb.maxX -= semiBlock.getX();
        aabb.minY -= semiBlock.getY();
        aabb.maxY -= semiBlock.getY();
        aabb.minZ -= semiBlock.getZ();
        aabb.maxZ -= semiBlock.getZ();
    } else {
        aabb = AxisAlignedBB.getBoundingBox(1 / 16D, 1 / 16D, 1 / 16D, 15 / 16D, 15 / 16D, 15 / 16D);
    }
    GL11.glTranslated(aabb.minX, aabb.minY, aabb.minZ);
    GL11.glScaled(aabb.maxX - aabb.minX, aabb.maxY - aabb.minY, aabb.maxZ - aabb.minZ);
    GL11.glTranslated(0.5, -0.5, 0.5);
    model.render(null, 0, 0, 0, 0, 0, 1 / 16F);
    GL11.glPopMatrix();
    GL11.glColor4d(1, 1, 1, 1);
}
 
Example 13
Source File: RenderSearchItemBlock.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public static void renderSearch(double x, double y, double z, int itemCount, int totalCount){
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);
    GL11.glColor4d(0, 1, 0, 0.5D);
    GL11.glRotatef(180.0F - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(180.0F - RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
    // GL11.glLineWidth(1.0F);
    double ratio = (double)itemCount / totalCount;
    double diff = (1 - ratio) / 1.5D;
    double size = 1 - diff;
    /*
    for(double i = size; i > 0; i -= 0.06D) {
        GL11.glPushMatrix();
        GL11.glScaled(i, i, i);
        renderCircle();
        GL11.glPopMatrix();
    }
    */
    Tessellator tess = Tessellator.instance;
    tess.startDrawing(GL11.GL_QUADS);
    tess.addVertexWithUV(-size, size, 0, 0, 1);
    tess.addVertexWithUV(-size, -size, 0, 0, 0);
    tess.addVertexWithUV(size, -size, 0, 1, 0);
    tess.addVertexWithUV(size, size, 0, 1, 1);

    tess.draw();

    GL11.glPopMatrix();
}
 
Example 14
Source File: RenderUtils.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public static void glColorHex(int color){
    double alpha = (color >> 24 & 255) / 255D;
    double red = (color >> 16 & 255) / 255D;
    double green = (color >> 8 & 255) / 255D;
    double blue = (color & 255) / 255D;
    GL11.glColor4d(red, green, blue, alpha);
}
 
Example 15
Source File: RenderRangeLines.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public void render(){
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderUtils.glColorHex(color);
    GL11.glLineWidth(1.0F);
    for(RenderProgressingLine line : rangeLines) {
        line.render();
    }
    GL11.glColor4d(1, 1, 1, 1);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}
 
Example 16
Source File: ModelOmnidirectionalHopper.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void renderStatic(float size, TileEntity tile){
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4d(1, 1, 1, 1);
    TileEntityOmnidirectionalHopper te = null;

    if(tile instanceof TileEntityOmnidirectionalHopper) {
        te = (TileEntityOmnidirectionalHopper)tile;
        PneumaticCraftUtils.rotateMatrixByMetadata(te.getDirection().getOpposite().ordinal());
    } else {
        PneumaticCraftUtils.rotateMatrixByMetadata(ForgeDirection.DOWN.ordinal());
    }

    Wall1.render(size);
    Wall2.render(size);
    Wall3.render(size);
    Wall4.render(size);
    Funnel.render(size);
    Funnel2.render(size);
    renderMain(te);

    GL11.glPopMatrix();

    if(te != null) {
        PneumaticCraftUtils.rotateMatrixByMetadata(te.getBlockMetadata());
    } else {
        PneumaticCraftUtils.rotateMatrixByMetadata(ForgeDirection.DOWN.ordinal());
    }
    InserterBottom.render(size);
    renderBottom(te);
    GL11.glDisable(GL11.GL_BLEND);
}
 
Example 17
Source File: RenderBlockTarget.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public void render(float partialTicks){

        double x = blockX + 0.5D;
        double y = blockY + 0.5D;
        double z = blockZ + 0.5D;

        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glPushMatrix();

        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);

        float red = 0.5F;
        float green = 0.5F;
        float blue = 1.0F;
        float alpha = 0.5F;

        GL11.glTranslated(x, y, z);

        // for some reason the blend function resets... that's why this line is
        // here.
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        if(!getBlock().isAir(world, blockX, blockY, blockZ)) arrowRenderer.render(world, blockX, blockY, blockZ, partialTicks);

        int targetAcquireProgress = (int)((ticksExisted - 50) / 0.7F);
        GL11.glRotatef(180.0F - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(180.0F - RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
        if(ticksExisted <= 120 && ticksExisted > 50) {
            GL11.glColor4d(0, 1, 0, 0.8D);
            RenderProgressBar.render(0D, 0.4D, 1.8D, 0.9D, 0, targetAcquireProgress);
        }

        GL11.glEnable(GL11.GL_TEXTURE_2D);
        if(!getBlock().isAir(world, blockX, blockY, blockZ)) {
            FontRenderer fontRenderer = RenderManager.instance.getFontRenderer();

            GL11.glColor4d(red, green, blue, alpha);
            if(ticksExisted > 120) {
                GL11.glScaled(0.02D, 0.02D, 0.02D);
                stat.render(-1, -1, partialTicks);
            } else if(ticksExisted > 50) {
                GL11.glScaled(0.02D, 0.02D, 0.02D);
                fontRenderer.drawString("Acquiring Target...", 0, 0, 0x7F7F7F);
                fontRenderer.drawString(targetAcquireProgress + "%", 37, 28, 0x002F00);
            } else if(ticksExisted < -30) {
                GL11.glScaled(0.03D, 0.03D, 0.03D);
                stat.render(-1, -1, partialTicks);
                fontRenderer.drawString("Lost Target!", 0, 0, 0xFF0000);
            }
        }
        GL11.glPopMatrix();
    }
 
Example 18
Source File: WidgetTank.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTick){
    GL11.glDisable(GL11.GL_LIGHTING);

    Fluid fluid = tank.getFluid() != null ? tank.getFluid().getFluid() : null;
    IIcon icon = fluid != null ? fluid.getStillIcon() : null;
    int amt = tank.getFluidAmount();
    int capacity = tank.getCapacity();
    int height = 64;
    int width = 16;

    if(fluid != null && icon != null && amt > 0 && capacity > 0) {
        Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);

        double fluidPercentage = amt / (double)capacity;
        double fluidHeight = height * fluidPercentage;

        GL11.glPushMatrix();
        {
            GL11.glTranslated(0, height, 0);
            GL11.glEnable(GL11.GL_BLEND);
            while(fluidHeight > 0) {
                double moved = Math.min(fluidHeight, icon.getIconHeight());
                GL11.glTranslated(0, -moved, 0);
                Tessellator t = Tessellator.instance;
                t.startDrawingQuads();
                t.setColorOpaque_I(fluid.getColor(tank.getFluid()));
                {
                    t.addVertexWithUV(x, y, 0, icon.getMinU(), icon.getMinV() + (icon.getMaxV() - icon.getMinV()) * (1 - moved / icon.getIconHeight()));
                    t.addVertexWithUV(x, y + moved, 0, icon.getMinU(), icon.getMaxV());
                    t.addVertexWithUV(x + width, y + moved, 0, icon.getMaxU(), icon.getMaxV());
                    t.addVertexWithUV(x + width, y, 0, icon.getMaxU(), icon.getMinV() + (icon.getMaxV() - icon.getMinV()) * (1 - moved / icon.getIconHeight()));
                }
                t.draw();
                fluidHeight -= moved;
            }
            GL11.glDisable(GL11.GL_BLEND);
        }
        GL11.glPopMatrix();
    }

    GL11.glColor4d(1, 1, 1, 1);
    Minecraft.getMinecraft().getTextureManager().bindTexture(Textures.WIDGET_TANK);
    Gui.func_146110_a(x, y, 0, 0, 16, 64, 16, 64);
}
 
Example 19
Source File: RenderLaser.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public void render(float partialTicks, double x1, double y1, double z1, double x2, double y2, double z2){
    Minecraft mc = FMLClientHandler.instance().getClient();
    TextureManager textureManager = mc.renderEngine;

    double laserLength = PneumaticCraftUtils.distBetween(x1, y1, z1, x2, y2, z2);
    double laserSize = 0.4;

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

    GL11.glTranslated(x1, y1, z1);

    double dx = x2 - x1;
    double dy = y2 - y1;
    double dz = z2 - z1;
    float f3 = MathHelper.sqrt_double(dx * dx + dz * dz);
    double rotYaw = Math.atan2(dx, dz) * 180.0D / Math.PI;
    double rotPitch = 90 - (float)(Math.atan2(dy, f3) * 180.0D / Math.PI);

    GL11.glRotated(rotYaw, 0, 1, 0);
    GL11.glRotated(rotPitch, 1, 0, 0);

    GL11.glScaled(laserSize, laserSize, laserSize);
    GL11.glTranslated(0, 0.6, 0);
    GL11.glRotated((ticksExisted + partialTicks) * 200, 0, 1, 0);

    GL11.glPushMatrix();
    GL11.glScaled(1, laserLength / laserSize, 1);

    /*   GL11.glTranslated(0, -0.01, 0);
       textureManager.bindTexture(Textures.RENDER_LASER_ANIMATION);
       renderAnimation(partialTicks, laserLength / laserSize);
       GL11.glTranslated(0, 0.01, 0);*/

    textureManager.bindTexture(Textures.RENDER_LASER);
    renderQuad(glowColor);
    textureManager.bindTexture(Textures.RENDER_LASER_OVERLAY);
    renderQuad(coreColor);
    GL11.glPopMatrix();

    GL11.glRotated(180, 1, 0, 0);
    textureManager.bindTexture(Textures.RENDER_LASER_START);
    renderQuad(glowColor);
    textureManager.bindTexture(Textures.RENDER_LASER_START_OVERLAY);
    renderQuad(coreColor);

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_LIGHTING);

    GL11.glColor4d(1, 1, 1, 1);
}
 
Example 20
Source File: RenderBlockArrows.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public void render(World world, int x, int y, int z, float partialTicks){
    // if(true) return;
    Block block = world.getBlock(x, y, z);
    block.setBlockBoundsBasedOnState(world, x, y, z);
    double minX = block.getBlockBoundsMinX();
    double minY = block.getBlockBoundsMinY();
    double minZ = block.getBlockBoundsMinZ();
    double maxX = block.getBlockBoundsMaxX();
    double maxY = block.getBlockBoundsMaxY();
    double maxZ = block.getBlockBoundsMaxZ();
    if(ticksExisted > 10) ticksExisted = 0;
    float progress = (ticksExisted + partialTicks) / 10F;
    GL11.glLineWidth(1.0F);
    GL11.glColor4d(1, 1, 1, progress);
    GL11.glPushMatrix();
    GL11.glTranslated(-0.5D, -0.5D, -0.5D);

    GL11.glPushMatrix();
    GL11.glTranslated(minX, minY, minZ);
    GL11.glRotatef(45, 0, 1, 0);
    GL11.glRotatef(45, 1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(maxX, minY, minZ);
    GL11.glRotatef(45, 0, -1, 0);
    GL11.glRotatef(45, 1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(minX, minY, maxZ);
    GL11.glRotatef(45, 0, -1, 0);
    GL11.glRotatef(45, -1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(maxX, minY, maxZ);
    GL11.glRotatef(45, 0, 1, 0);
    GL11.glRotatef(45, -1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(minX, maxY, minZ);
    GL11.glRotatef(45, 0, 1, 0);
    GL11.glRotatef(135, 1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(maxX, maxY, minZ);
    GL11.glRotatef(45, 0, -1, 0);
    GL11.glRotatef(135, 1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(minX, maxY, maxZ);
    GL11.glRotatef(45, 0, -1, 0);
    GL11.glRotatef(135, -1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(maxX, maxY, maxZ);
    GL11.glRotatef(45, 0, 1, 0);
    GL11.glRotatef(135, -1, 0, 0);
    drawArrow(progress);
    GL11.glPopMatrix();

    GL11.glPopMatrix();
}