Search in sources :

Example 6 with Vector4f

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

the class GuiFarmStation method drawForegroundImpl.

@Override
protected void drawForegroundImpl(int mouseX, int mouseY) {
    super.drawForegroundImpl(mouseX, mouseY);
    if (!isConfigOverlayEnabled()) {
        for (int i = TileFarmStation.minSupSlot; i <= TileFarmStation.maxSupSlot; i++) {
            if (getTileEntity().isSlotLocked(i)) {
                Slot slot = inventorySlots.getSlot(i);
                GlStateManager.enableBlend();
                GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                RenderUtil.renderQuad2D(slot.xPos, slot.yPos, 0, 16, 16, new Vector4f(0, 0, 0, 0.25));
                GlStateManager.disableBlend();
            }
        }
    }
}
Also used : Vector4f(com.enderio.core.common.vecmath.Vector4f) Slot(net.minecraft.inventory.Slot)

Example 7 with Vector4f

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

the class DefaultConduitRenderer method renderDynamicEntity.

// ------------ Dynamic ---------------------------------------------
@Override
public void renderDynamicEntity(@Nonnull TileEntitySpecialRenderer conduitBundleRenderer, @Nonnull IConduitBundle te, @Nonnull IClientConduit.WithDefaultRendering conduit, double x, double y, double z, float partialTick, float worldLight) {
    Collection<CollidableComponent> components = conduit.getCollidableComponents();
    transmissionScaleFactor = conduit.getTransmitionGeometryScale();
    for (CollidableComponent component : components) {
        if (renderComponent(component)) {
            float selfIllum = Math.max(worldLight, conduit.getSelfIlluminationForState(component));
            final TextureAtlasSprite transmitionTextureForState = conduit.getTransmitionTextureForState(component);
            if (isNSEWUD(component.dir) && transmitionTextureForState != null) {
                Vector4f color = conduit.getTransmitionTextureColorForState(component);
                renderTransmissionDynamic(conduit, transmitionTextureForState, color, component, selfIllum);
            }
            TextureAtlasSprite tex = conduit.getTextureForState(component);
            if (tex == null) {
                tex = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
            }
            renderConduitDynamic(tex, conduit, component, selfIllum);
        }
    }
}
Also used : Vector4f(com.enderio.core.common.vecmath.Vector4f) CollidableComponent(crazypants.enderio.base.conduit.geom.CollidableComponent) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite)

Example 8 with Vector4f

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

the class LiquidConduitRenderer method computeFluidOutlineToCache.

public static List<CachableRenderStatement> computeFluidOutlineToCache(CollidableComponent component, Fluid fluid, double scaleFactor, float outlineWidth) {
    Map<Fluid, List<CachableRenderStatement>> cache0 = cache.get(component);
    if (cache0 == null) {
        cache0 = new HashMap<Fluid, List<CachableRenderStatement>>();
        cache.put(component, cache0);
    }
    List<CachableRenderStatement> data = cache0.get(fluid);
    if (data != null) {
        return data;
    }
    data = new ArrayList<CachableRenderStatement>();
    cache0.put(fluid, data);
    TextureAtlasSprite texture = RenderUtil.getStillTexture(fluid);
    if (texture == null) {
        return data;
    }
    int color = fluid.getColor();
    Vector4f colorv = new Vector4f((color >> 16 & 0xFF) / 255d, (color >> 8 & 0xFF) / 255d, (color & 0xFF) / 255d, 1);
    BoundingBox bbb;
    double width = outlineWidth;
    scaleFactor = scaleFactor - 0.05;
    double xScale = Math.abs(component.dir.getFrontOffsetX()) == 1 ? width : scaleFactor;
    double yScale = Math.abs(component.dir.getFrontOffsetY()) == 1 ? width : scaleFactor;
    double zScale = Math.abs(component.dir.getFrontOffsetZ()) == 1 ? width : scaleFactor;
    double offSize = (0.5 - width) / 2 - width / 2;
    double xOff = component.dir.getFrontOffsetX() * offSize;
    double yOff = component.dir.getFrontOffsetY() * offSize;
    double zOff = component.dir.getFrontOffsetZ() * offSize;
    bbb = component.bound.scale(xScale, yScale, zScale);
    bbb = bbb.translate(new Vector3d(xOff, yOff, zOff));
    for (EnumFacing face : EnumFacing.VALUES) {
        if (face != component.dir && face != component.dir.getOpposite()) {
            List<Vertex> corners = bbb.getCornersWithUvForFace(face, texture.getMinU(), texture.getMaxU(), texture.getMinV(), texture.getMaxV());
            for (Vertex corner : corners) {
                data.add(new CachableRenderStatement.AddVertexWithUV(corner.x(), corner.y(), corner.z(), corner.uv.x, corner.uv.y, colorv));
            }
        }
    }
    return data;
}
Also used : Vertex(com.enderio.core.common.vecmath.Vertex) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) Fluid(net.minecraftforge.fluids.Fluid) EnumFacing(net.minecraft.util.EnumFacing) Vector4f(com.enderio.core.common.vecmath.Vector4f) Vector3d(com.enderio.core.common.vecmath.Vector3d) BoundingBox(com.enderio.core.client.render.BoundingBox) ArrayList(java.util.ArrayList) List(java.util.List)

Example 9 with Vector4f

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

the class PowerConduitRenderer method addConduitQuads.

@Override
protected void addConduitQuads(@Nonnull IConduitBundle bundle, @Nonnull IConduit conduit, @Nonnull TextureAtlasSprite tex, @Nonnull CollidableComponent component, float selfIllum, BlockRenderLayer layer, @Nonnull List<BakedQuad> quads) {
    if (IPowerConduit.COLOR_CONTROLLER_ID.equals(component.data)) {
        IPowerConduit pc = (IPowerConduit) conduit;
        ConnectionMode conMode = pc.getConnectionMode(component.dir);
        if (conduit.containsExternalConnection(component.dir) && pc.getExtractionRedstoneMode(component.dir) != RedstoneControlMode.IGNORE && conMode != ConnectionMode.DISABLED) {
            int cInt = ((IPowerConduit) conduit).getExtractionSignalColor(component.dir).getColor();
            Vector4f col = ColorUtil.toFloat4(cInt);
            BoundingBox bound = component.bound;
            if (conMode != ConnectionMode.IN_OUT && conMode != ConnectionMode.NOT_SET) {
                Vector3d trans = ForgeDirectionOffsets.offsetScaled(component.dir, -0.12);
                bound = bound.translate(trans);
            }
            addQuadsForSection(bound, tex, component.dir, quads, col);
        }
        return;
    }
    super.addConduitQuads(bundle, conduit, tex, component, selfIllum, layer, quads);
    if (component.dir == null) {
        return;
    }
    IPowerConduit pc = (IPowerConduit) conduit;
    ConnectionMode mode = pc.getConnectionMode(component.dir);
    if (mode != ConnectionMode.INPUT && mode != ConnectionMode.OUTPUT) {
        return;
    }
    if (mode == ConnectionMode.INPUT) {
        tex = pc.getTextureForInputMode();
    } else {
        tex = pc.getTextureForOutputMode();
    }
    Offset offset = bundle.getOffset(IPowerConduit.class, component.dir);
    ConnectionModeGeometry.addModeConnectorQuads(component.dir, offset, tex, null, quads);
}
Also used : Vector4f(com.enderio.core.common.vecmath.Vector4f) Vector3d(com.enderio.core.common.vecmath.Vector3d) BoundingBox(com.enderio.core.client.render.BoundingBox) ConnectionMode(crazypants.enderio.base.conduit.ConnectionMode) Offset(crazypants.enderio.base.conduit.geom.Offset)

Example 10 with Vector4f

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

the class DefaultConduitRenderer method addBakedQuads.

// ------------ Static Model ---------------------------------------------
@Override
public void addBakedQuads(@Nonnull TileEntitySpecialRenderer<?> conduitBundleRenderer, @Nonnull IConduitBundle bundle, @Nonnull IClientConduit.WithDefaultRendering conduit, float brightness, @Nonnull BlockRenderLayer layer, List<BakedQuad> quads) {
    Collection<CollidableComponent> components = conduit.getCollidableComponents();
    transmissionScaleFactor = conduit.getTransmitionGeometryScale();
    for (CollidableComponent component : components) {
        if (renderComponent(component)) {
            float selfIllum = Math.max(brightness, conduit.getSelfIlluminationForState(component));
            final TextureAtlasSprite transmitionTextureForState = conduit.getTransmitionTextureForState(component);
            if (layer != null && isNSEWUD(component.dir) && transmitionTextureForState != null) {
                Vector4f color = conduit.getTransmitionTextureColorForState(component);
                addTransmissionQuads(transmitionTextureForState, color, conduit, component, selfIllum, quads);
            }
            TextureAtlasSprite tex = conduit.getTextureForState(component);
            if (tex == null) {
                tex = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
            }
            addConduitQuads(bundle, conduit, tex, component, selfIllum, layer, quads);
        }
    }
}
Also used : Vector4f(com.enderio.core.common.vecmath.Vector4f) CollidableComponent(crazypants.enderio.base.conduit.geom.CollidableComponent) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite)

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