Search in sources :

Example 1 with LightMapOperation

use of gregtech.client.renderer.cclop.LightMapOperation in project GregTech by GregTechCEu.

the class FireboxActiveRenderer method renderOrientedState.

@Override
@SideOnly(Side.CLIENT)
public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) {
    pipeline = ArrayUtils.addAll(pipeline, new LightMapOperation(0b10100000, 0b10100000));
    for (EnumFacing facing : EnumFacing.VALUES) {
        OrientedOverlayRenderer.OverlayFace overlayFace = OrientedOverlayRenderer.OverlayFace.bySide(facing, frontFacing);
        TextureAtlasSprite renderSprite = sprites.get(overlayFace);
        if (renderSprite != null) {
            Textures.renderFace(renderState, translation, pipeline, facing, bounds, renderSprite, BlockRenderLayer.CUTOUT_MIPPED);
            TextureAtlasSprite emissiveSprite = spritesEmissive.get(overlayFace);
            if (emissiveSprite != null && facing != frontFacing && facing != EnumFacing.UP && facing != EnumFacing.DOWN) {
                if (ConfigHolder.client.machinesEmissiveTextures) {
                    IVertexOperation[] lightPipeline = ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240), new ColourOperation(0xffffffff));
                    Textures.renderFace(renderState, translation, lightPipeline, facing, bounds, emissiveSprite, BloomEffectUtil.getRealBloomLayer());
                } else {
                    Textures.renderFace(renderState, translation, ArrayUtils.add(pipeline, new ColourOperation(0xffffffff)), facing, bounds, emissiveSprite, BlockRenderLayer.CUTOUT_MIPPED);
                }
            }
        }
    }
}
Also used : IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) ColourOperation(gregtech.client.renderer.cclop.ColourOperation) LightMapOperation(gregtech.client.renderer.cclop.LightMapOperation) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) EnumFacing(net.minecraft.util.EnumFacing) OrientedOverlayRenderer(gregtech.client.renderer.texture.cube.OrientedOverlayRenderer) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with LightMapOperation

use of gregtech.client.renderer.cclop.LightMapOperation in project GregTech by GregTechCEu.

the class LargeTurbineRenderer method renderSided.

@SideOnly(Side.CLIENT)
public void renderSided(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing side, boolean hasBase, boolean hasRotor, boolean isActive, int rotorRGB) {
    Matrix4 cornerOffset = null;
    switch(side.getAxis()) {
        case X:
            cornerOffset = translation.copy().translate(0.01 * side.getXOffset(), -1.0, -1.0);
            cornerOffset.scale(1.0, 3.0, 3.0);
            break;
        case Z:
            cornerOffset = translation.copy().translate(-1.0, -1.0, 0.01 * side.getZOffset());
            cornerOffset.scale(3.0, 3.0, 1.0);
            break;
        case Y:
            cornerOffset = translation.copy().translate(-1.0, 0.01 * side.getYOffset(), -1.0);
            cornerOffset.scale(3.0, 1.0, 3.0);
            break;
    }
    if (hasBase) {
        Textures.renderFace(renderState, cornerOffset, ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240)), side, Cuboid6.full, baseRingSprite, BlockRenderLayer.CUTOUT_MIPPED);
        Textures.renderFace(renderState, cornerOffset, ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240), new ColourOperation(0xFFFFFFFF)), side, Cuboid6.full, baseBackgroundSprite, BlockRenderLayer.CUTOUT_MIPPED);
    }
    if (hasRotor) {
        TextureAtlasSprite sprite = isActive ? activeBladeSprite : idleBladeSprite;
        IVertexOperation[] color = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(rotorRGB)));
        Textures.renderFace(renderState, cornerOffset, color, side, Cuboid6.full, sprite, BlockRenderLayer.CUTOUT_MIPPED);
    }
}
Also used : ColourOperation(gregtech.client.renderer.cclop.ColourOperation) IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) LightMapOperation(gregtech.client.renderer.cclop.LightMapOperation) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) Matrix4(codechicken.lib.vec.Matrix4) ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with LightMapOperation

use of gregtech.client.renderer.cclop.LightMapOperation in project GregTech by GregTechCEu.

the class SimpleSidedCubeRenderer method renderOrientedState.

@Override
@SideOnly(Side.CLIENT)
public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) {
    RenderSide overlayFace = RenderSide.bySide(frontFacing);
    TextureAtlasSprite renderSprite = sprites.get(overlayFace);
    Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, renderSprite, BlockRenderLayer.CUTOUT_MIPPED);
    TextureAtlasSprite spriteEmissive = spritesEmissive.get(overlayFace);
    if (spriteEmissive != null) {
        if (ConfigHolder.client.machinesEmissiveTextures) {
            IVertexOperation[] lightPipeline = ArrayUtils.add(pipeline, new LightMapOperation(240, 240));
            Textures.renderFace(renderState, translation, lightPipeline, frontFacing, bounds, spriteEmissive, BloomEffectUtil.getRealBloomLayer());
        } else
            Textures.renderFace(renderState, translation, pipeline, frontFacing, bounds, spriteEmissive, BlockRenderLayer.CUTOUT_MIPPED);
    }
}
Also used : IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) LightMapOperation(gregtech.client.renderer.cclop.LightMapOperation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 4 with LightMapOperation

use of gregtech.client.renderer.cclop.LightMapOperation in project GregTech by GregTechCEu.

the class MetaTileEntityPrimitiveBlastFurnace method renderMetaTileEntity.

@Override
public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {
    super.renderMetaTileEntity(renderState, translation, pipeline);
    getFrontOverlay().renderOrientedState(renderState, translation, pipeline, getFrontFacing(), recipeMapWorkable.isActive(), recipeMapWorkable.isWorkingEnabled());
    if (recipeMapWorkable.isActive() && isStructureFormed()) {
        EnumFacing back = getFrontFacing().getOpposite();
        Matrix4 offset = translation.copy().translate(back.getXOffset(), -0.3, back.getZOffset());
        CubeRendererState op = Textures.RENDER_STATE.get();
        Textures.RENDER_STATE.set(new CubeRendererState(op.layer, CubeRendererState.PASS_MASK, op.world));
        Textures.renderFace(renderState, offset, ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240), new ColourOperation(0xFFFFFFFF)), EnumFacing.UP, Cuboid6.full, TextureUtils.getBlockTexture("lava_still"), BloomEffectUtil.getRealBloomLayer());
        Textures.RENDER_STATE.set(op);
    }
}
Also used : ColourOperation(gregtech.client.renderer.cclop.ColourOperation) CubeRendererState(gregtech.client.renderer.CubeRendererState) LightMapOperation(gregtech.client.renderer.cclop.LightMapOperation) EnumFacing(net.minecraft.util.EnumFacing) Matrix4(codechicken.lib.vec.Matrix4)

Example 5 with LightMapOperation

use of gregtech.client.renderer.cclop.LightMapOperation in project GregTech by GregTechCEu.

the class OrientedOverlayRenderer method renderOrientedState.

@Override
@SideOnly(Side.CLIENT)
public void renderOrientedState(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 bounds, EnumFacing frontFacing, boolean isActive, boolean isWorkingEnabled) {
    for (EnumFacing renderSide : EnumFacing.VALUES) {
        ActivePredicate predicate = sprites.get(OverlayFace.bySide(renderSide, frontFacing));
        if (predicate != null) {
            TextureAtlasSprite renderSprite = predicate.getSprite(isActive, isWorkingEnabled);
            // preserve the original translation when not rotating the top and bottom
            Matrix4 renderTranslation = translation.copy();
            // Rotate the top and bottom faces to match front facing
            Rotation rotation = new Rotation(0, 0, 1, 0);
            if (renderSide == EnumFacing.UP || renderSide == EnumFacing.DOWN) {
                if (frontFacing == EnumFacing.NORTH) {
                    renderTranslation.translate(1, 0, 1);
                    rotation = new Rotation(Math.PI, 0, 1, 0);
                } else if (frontFacing == EnumFacing.EAST) {
                    renderTranslation.translate(0, 0, 1);
                    rotation = new Rotation(Math.PI / 2, 0, 1, 0);
                } else if (frontFacing == EnumFacing.WEST) {
                    renderTranslation.translate(1, 0, 0);
                    rotation = new Rotation(-Math.PI / 2, 0, 1, 0);
                }
                renderTranslation = RenderUtil.adjustTrans(renderTranslation, renderSide, 1);
                renderTranslation.apply(rotation);
            }
            Textures.renderFace(renderState, renderTranslation, ArrayUtils.addAll(pipeline, rotation), renderSide, bounds, renderSprite, BlockRenderLayer.CUTOUT_MIPPED);
            TextureAtlasSprite emissiveSprite = predicate.getEmissiveSprite(isActive, isWorkingEnabled);
            if (emissiveSprite != null) {
                if (ConfigHolder.client.machinesEmissiveTextures) {
                    IVertexOperation[] lightPipeline = ArrayUtils.addAll(pipeline, new LightMapOperation(240, 240), rotation);
                    Textures.renderFace(renderState, renderTranslation, lightPipeline, renderSide, bounds, emissiveSprite, BloomEffectUtil.getRealBloomLayer());
                } else {
                    // have to still render both overlays or else textures will be broken
                    Textures.renderFace(renderState, renderTranslation, ArrayUtils.addAll(pipeline, rotation), renderSide, bounds, emissiveSprite, BlockRenderLayer.CUTOUT_MIPPED);
                }
            }
        }
    }
}
Also used : IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) LightMapOperation(gregtech.client.renderer.cclop.LightMapOperation) EnumFacing(net.minecraft.util.EnumFacing) Rotation(codechicken.lib.vec.Rotation) Matrix4(codechicken.lib.vec.Matrix4) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

LightMapOperation (gregtech.client.renderer.cclop.LightMapOperation)7 IVertexOperation (codechicken.lib.render.pipeline.IVertexOperation)6 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)6 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)5 EnumFacing (net.minecraft.util.EnumFacing)4 Matrix4 (codechicken.lib.vec.Matrix4)3 ColourOperation (gregtech.client.renderer.cclop.ColourOperation)3 ColourMultiplier (codechicken.lib.render.pipeline.ColourMultiplier)1 Rotation (codechicken.lib.vec.Rotation)1 CubeRendererState (gregtech.client.renderer.CubeRendererState)1 OrientedOverlayRenderer (gregtech.client.renderer.texture.cube.OrientedOverlayRenderer)1 OverlayFace (gregtech.client.renderer.texture.cube.OrientedOverlayRenderer.OverlayFace)1