Search in sources :

Example 1 with ColourMultiplier

use of codechicken.lib.render.pipeline.ColourMultiplier in project GregTech by GregTechCE.

the class TieredMetaTileEntity method renderMetaTileEntity.

@Override
public void renderMetaTileEntity(CCRenderState renderState, IVertexOperation[] pipeline) {
    IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(paintingColor));
    Textures.VOLTAGE_CASINGS[tier].render(renderState, colouredPipeline);
}
Also used : IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier)

Example 2 with ColourMultiplier

use of codechicken.lib.render.pipeline.ColourMultiplier in project GregTech by GregTechCE.

the class ICoverable method renderCovers.

@SideOnly(Side.CLIENT)
default void renderCovers(CCRenderState renderState, Matrix4 translation, BlockRenderLayer layer) {
    renderState.lightMatrix.locate(getWorld(), getPos());
    double coverPlateThickness = getCoverPlateThickness();
    IVertexOperation[] platePipeline = new IVertexOperation[] { new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColor())) };
    IVertexOperation[] coverPipeline = new IVertexOperation[] { renderState.lightMatrix };
    for (EnumFacing sideFacing : EnumFacing.values()) {
        CoverBehavior coverBehavior = getCoverAtSide(sideFacing);
        if (coverBehavior == null)
            continue;
        Cuboid6 plateBox = getCoverPlateBox(sideFacing, coverPlateThickness);
        if (coverBehavior.canRenderInLayer(layer) && coverPlateThickness > 0) {
            renderState.preRenderWorld(getWorld(), getPos());
            coverBehavior.renderCoverPlate(renderState, translation, platePipeline, plateBox, layer);
        }
        if (coverBehavior.canRenderInLayer(layer)) {
            coverBehavior.renderCover(renderState, translation.copy(), coverPipeline, plateBox, layer);
            if (coverPlateThickness == 0.0 && shouldRenderBackSide() && coverBehavior.canRenderBackside()) {
                // machine is full block, but still not opaque - render cover on the back side too
                Matrix4 backTranslation = translation.copy();
                if (sideFacing.getAxis().isVertical()) {
                    REVERSE_VERTICAL_ROTATION.apply(backTranslation);
                } else {
                    REVERSE_HORIZONTAL_ROTATION.apply(backTranslation);
                }
                backTranslation.translate(-sideFacing.getXOffset(), -sideFacing.getYOffset(), -sideFacing.getZOffset());
                coverBehavior.renderCover(renderState, backTranslation, coverPipeline, plateBox, layer);
            }
        }
    }
}
Also used : IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) EnumFacing(net.minecraft.util.EnumFacing) IndexedCuboid6(codechicken.lib.raytracer.IndexedCuboid6) ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with ColourMultiplier

use of codechicken.lib.render.pipeline.ColourMultiplier in project GregTech by GregTechCE.

the class MetaTileEntityLockedSafe method renderMetaTileEntityFast.

@Override
public void renderMetaTileEntityFast(CCRenderState renderState, Matrix4 translation, float partialTicks) {
    ColourMultiplier colourMultiplier = new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(GTValues.VC[unlockComponentTier]));
    float angle = prevDoorAngle + (doorAngle - prevDoorAngle) * partialTicks;
    angle = 1.0f - (1.0f - angle) * (1.0f - angle) * (1.0f - angle);
    float resultDoorAngle = angle * 120.0f;
    Textures.SAFE.render(renderState, translation, new IVertexOperation[] { colourMultiplier }, getFrontFacing(), resultDoorAngle);
}
Also used : ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier)

Example 4 with ColourMultiplier

use of codechicken.lib.render.pipeline.ColourMultiplier in project GregTech by GregTechCE.

the class MetaTileEntityChest method renderMetaTileEntityFast.

@Override
public void renderMetaTileEntityFast(CCRenderState renderState, Matrix4 translation, float partialTicks) {
    float angle = prevLidAngle + (lidAngle - prevLidAngle) * partialTicks;
    angle = 1.0f - (1.0f - angle) * (1.0f - angle) * (1.0f - angle);
    float resultLidAngle = angle * 90.0f;
    if (ModHandler.isMaterialWood(material)) {
        ColourMultiplier multiplier = new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()));
        Textures.WOODEN_CHEST.render(renderState, translation, new IVertexOperation[] { multiplier }, getFrontFacing(), resultLidAngle);
    } else {
        ColourMultiplier multiplier = new ColourMultiplier(ColourRGBA.multiply(GTUtility.convertRGBtoOpaqueRGBA_CL(material.materialRGB), GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())));
        Textures.METAL_CHEST.render(renderState, translation, new IVertexOperation[] { multiplier }, getFrontFacing(), resultLidAngle);
    }
}
Also used : ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier)

Example 5 with ColourMultiplier

use of codechicken.lib.render.pipeline.ColourMultiplier in project GregTech by GregTechCE.

the class CableRenderer method renderCableBlock.

public void renderCableBlock(Material material, Insulation insulation1, int insulationColor1, CCRenderState state, IVertexOperation[] pipeline, int connectMask) {
    int wireColor = GTUtility.convertRGBtoOpaqueRGBA_CL(material.materialRGB);
    float thickness = insulation1.thickness;
    IVertexOperation[] wire = ArrayUtils.addAll(pipeline, new IconTransformation(wireTexture), new ColourMultiplier(wireColor));
    IVertexOperation[] overlays = wire;
    IVertexOperation[] insulation = wire;
    if (insulation1.insulationLevel != -1) {
        int insulationColor = GTUtility.convertRGBtoOpaqueRGBA_CL(insulationColor1);
        ColourMultiplier multiplier = new ColourMultiplier(insulationColor);
        insulation = ArrayUtils.addAll(pipeline, new IconTransformation(insulationTextures[5]), multiplier);
        overlays = ArrayUtils.addAll(pipeline, new IconTransformation(insulationTextures[insulation1.insulationLevel]), multiplier);
    }
    Cuboid6 cuboid6 = BlockCable.getSideBox(null, thickness);
    for (EnumFacing renderedSide : EnumFacing.VALUES) {
        if ((connectMask & 1 << renderedSide.getIndex()) == 0) {
            int oppositeIndex = renderedSide.getOpposite().getIndex();
            if ((connectMask & 1 << oppositeIndex) > 0 && (connectMask & ~(1 << oppositeIndex)) == 0) {
                // if there is something on opposite side, render overlay + wire
                renderCableSide(state, wire, renderedSide, cuboid6);
                renderCableSide(state, overlays, renderedSide, cuboid6);
            } else {
                renderCableSide(state, insulation, renderedSide, cuboid6);
            }
        }
    }
    renderCableCube(connectMask, state, insulation, wire, overlays, EnumFacing.DOWN, thickness);
    renderCableCube(connectMask, state, insulation, wire, overlays, EnumFacing.UP, thickness);
    renderCableCube(connectMask, state, insulation, wire, overlays, EnumFacing.WEST, thickness);
    renderCableCube(connectMask, state, insulation, wire, overlays, EnumFacing.EAST, thickness);
    renderCableCube(connectMask, state, insulation, wire, overlays, EnumFacing.NORTH, thickness);
    renderCableCube(connectMask, state, insulation, wire, overlays, EnumFacing.SOUTH, thickness);
}
Also used : IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) EnumFacing(net.minecraft.util.EnumFacing) Cuboid6(codechicken.lib.vec.Cuboid6) IconTransformation(codechicken.lib.vec.uv.IconTransformation) ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier)

Aggregations

ColourMultiplier (codechicken.lib.render.pipeline.ColourMultiplier)21 IVertexOperation (codechicken.lib.render.pipeline.IVertexOperation)16 EnumFacing (net.minecraft.util.EnumFacing)7 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)7 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)5 Cuboid6 (codechicken.lib.vec.Cuboid6)3 IconTransformation (codechicken.lib.vec.uv.IconTransformation)3 CCModel (codechicken.lib.render.CCModel)2 CCRenderState (codechicken.lib.render.CCRenderState)2 Matrix4 (codechicken.lib.vec.Matrix4)2 Vector3 (codechicken.lib.vec.Vector3)2 IndexedCuboid6 (codechicken.lib.raytracer.IndexedCuboid6)1 BlockFace (codechicken.lib.render.BlockRenderer.BlockFace)1 TransformationList (codechicken.lib.vec.TransformationList)1 Translation (codechicken.lib.vec.Translation)1 Material (gregtech.api.unification.material.type.Material)1 BlockSurfaceRock (gregtech.common.blocks.surfacerock.BlockSurfaceRock)1 IBlockState (net.minecraft.block.state.IBlockState)1 Minecraft (net.minecraft.client.Minecraft)1 BlockRenderLayer (net.minecraft.util.BlockRenderLayer)1