Search in sources :

Example 11 with Vector4f

use of com.enderio.core.common.vecmath.Vector4f in project EnderIO by SleepyTrousers.

the class TravelEntitySpecialRenderer method renderLabel.

private void renderLabel(String toRender, double globalScale, boolean highlight) {
    if (toRender != null && toRender.trim().length() > 0) {
        GlStateManager.color(1, 1, 1, 1);
        Vector4f bgCol = RenderUtil.DEFAULT_TEXT_BG_COL;
        if (highlight) {
            bgCol = new Vector4f(selectedColor.x, selectedColor.y, selectedColor.z, selectedColor.w);
        }
        GlStateManager.pushMatrix();
        GlStateManager.translate(0.5f, 0.5f, 0.5f);
        GlStateManager.scale(globalScale, globalScale, globalScale);
        Vector3f pos = new Vector3f(0, 1.2f, 0);
        float size = 0.5f;
        RenderUtil.drawBillboardedText(pos, toRender, size, bgCol);
        GL11.glPopMatrix();
    }
}
Also used : Vector4f(com.enderio.core.common.vecmath.Vector4f) Vector3f(com.enderio.core.common.vecmath.Vector3f)

Example 12 with Vector4f

use of com.enderio.core.common.vecmath.Vector4f in project EnderIO by SleepyTrousers.

the class IoConfigRenderer method renderOverlay.

private void renderOverlay(int mx, int my) {
    Rectangle vp = camera.getViewport();
    ScaledResolution scaledresolution = new ScaledResolution(mc);
    int vpx = vp.x / scaledresolution.getScaleFactor();
    int vph = vp.height / scaledresolution.getScaleFactor();
    int vpw = vp.width / scaledresolution.getScaleFactor();
    int vpy = (int) ((float) (vp.y + vp.height - 4) / (float) scaledresolution.getScaleFactor());
    GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glTranslatef(vpx, vpy, -2000.0F);
    GlStateManager.disableLighting();
    int x = vpw - 17;
    int y = vph - 18;
    mx -= vpx;
    my -= vpy;
    if (mx >= x && mx <= x + IconEIO.IO_WHATSIT.width && my >= y && my <= y + IconEIO.IO_WHATSIT.height) {
        GlStateManager.enableBlend();
        RenderUtil.renderQuad2D(x, y, 0, IconEIO.IO_WHATSIT.width, IconEIO.IO_WHATSIT.height, new Vector4f(0.4f, 0.4f, 0.4f, 0.6f));
        GlStateManager.disableBlend();
        inNeigButBounds = true;
    } else {
        inNeigButBounds = false;
    }
    GL11.glColor3f(1, 1, 1);
    IconEIO.map.render(IconEIO.IO_WHATSIT, x, y, true);
    if (selection != null) {
        IconEIO ioIcon = null;
        int yOffset = 0;
        // INPUT
        IoMode mode = selection.config.getIoMode(selection.face);
        if (mode == IoMode.PULL) {
            ioIcon = IconEIO.INPUT;
        } else if (mode == IoMode.PUSH) {
            ioIcon = IconEIO.OUTPUT;
        } else if (mode == IoMode.PUSH_PULL) {
            ioIcon = IconEIO.INPUT_OUTPUT;
        } else if (mode == IoMode.DISABLED) {
            ioIcon = IconEIO.DISABLED;
            yOffset = 5;
        }
        y = vph - mc.fontRenderer.FONT_HEIGHT - 2;
        mc.fontRenderer.drawString(getLabelForMode(mode), 4, y, ColorUtil.getRGB(Color.white));
        if (ioIcon != null) {
            int w = mc.fontRenderer.getStringWidth(mode.getLocalisedName());
            double xd = (w - ioIcon.width) / 2;
            xd = Math.max(0, w);
            xd /= 2;
            xd += 4;
            xd /= scaledresolution.getScaleFactor();
            ioIcon.getMap().render(ioIcon, xd, y - mc.fontRenderer.FONT_HEIGHT - 2 - yOffset, true);
        }
    }
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) Vector4f(com.enderio.core.common.vecmath.Vector4f) Rectangle(java.awt.Rectangle) PacketIoMode(crazypants.enderio.base.machine.modes.PacketIoMode) IoMode(crazypants.enderio.base.machine.modes.IoMode)

Aggregations

Vector4f (com.enderio.core.common.vecmath.Vector4f)12 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)5 BoundingBox (com.enderio.core.client.render.BoundingBox)4 Vector3d (com.enderio.core.common.vecmath.Vector3d)2 Vertex (com.enderio.core.common.vecmath.Vertex)2 CollidableComponent (crazypants.enderio.base.conduit.geom.CollidableComponent)2 Offset (crazypants.enderio.base.conduit.geom.Offset)2 ArrayList (java.util.ArrayList)2 ScaledResolution (net.minecraft.client.gui.ScaledResolution)2 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)2 EnumFacing (net.minecraft.util.EnumFacing)2 FluidStack (net.minecraftforge.fluids.FluidStack)2 IWidgetIcon (com.enderio.core.api.client.render.IWidgetIcon)1 Vector3f (com.enderio.core.common.vecmath.Vector3f)1 ConduitDisplayMode (crazypants.enderio.base.conduit.ConduitDisplayMode)1 ConnectionMode (crazypants.enderio.base.conduit.ConnectionMode)1 IoMode (crazypants.enderio.base.machine.modes.IoMode)1 PacketIoMode (crazypants.enderio.base.machine.modes.PacketIoMode)1 InfinityParticle (crazypants.enderio.base.render.ranged.InfinityParticle)1 HalfBakedList (crazypants.enderio.base.render.util.HalfBakedQuad.HalfBakedList)1