Search in sources :

Example 6 with ColourMultiplier

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

the class FluidPipeRenderer method renderPipeBlock.

public boolean renderPipeBlock(Material material, FluidPipeType pipeType, int insulationColor, CCRenderState state, IVertexOperation[] pipeline, int connectMask) {
    int pipeColor = GTUtility.convertRGBtoOpaqueRGBA_CL(getPipeColor(material, insulationColor));
    ColourMultiplier multiplier = new ColourMultiplier(pipeColor);
    PipeTextureInfo textureInfo = this.pipeTextures.get(pipeType);
    PipeModelInfo modelInfo = this.pipeModels.get(pipeType);
    IVertexOperation[] openingTexture = ArrayUtils.addAll(pipeline, new IconTransformation(textureInfo.inTexture), multiplier);
    IVertexOperation[] sideTexture = ArrayUtils.addAll(pipeline, new IconTransformation(textureInfo.sideTexture), multiplier);
    int sidedConnMask = connectMask & 0b111111;
    CCModel fullBlockModel = null;
    if (sidedConnMask == 0b000011) {
        fullBlockModel = modelInfo.fullBlockModels[0];
    } else if (sidedConnMask == 0b001100) {
        fullBlockModel = modelInfo.fullBlockModels[1];
    } else if (sidedConnMask == 0b110000) {
        fullBlockModel = modelInfo.fullBlockModels[2];
    }
    if (fullBlockModel != null) {
        state.setPipeline(fullBlockModel, 0, fullBlockModel.verts.length, sideTexture);
        state.render();
        return true;
    }
    Cuboid6 centerCuboid = BlockFluidPipe.getSideBox(null, pipeType.getThickness());
    state.setPipeline(openingTexture);
    BlockRenderer.renderCuboid(state, centerCuboid, 0);
    for (EnumFacing side : EnumFacing.VALUES) {
        if ((connectMask & 1 << side.getIndex()) > 0) {
            CCModel model = modelInfo.connectionModels[side.getIndex()];
            state.setPipeline(model, 0, model.verts.length, sideTexture);
            state.render();
        }
    }
    return true;
}
Also used : IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) EnumFacing(net.minecraft.util.EnumFacing) Cuboid6(codechicken.lib.vec.Cuboid6) CCModel(codechicken.lib.render.CCModel) ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier) IconTransformation(codechicken.lib.vec.uv.IconTransformation)

Example 7 with ColourMultiplier

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

the class MetaTileEntityQuantumTank method renderMetaTileEntity.

@Override
public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {
    Textures.VOLTAGE_CASINGS[tier].render(renderState, translation, ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering()))));
    translation.translate(0.5, 0.001, 0.5);
    translation.rotate(Math.toRadians(rotations[getFrontFacing().getIndex() - 2]), new Vector3(0.0, 1.0, 0.0));
    translation.translate(-0.5, 0.0, -0.5);
    Textures.SCREEN.renderSided(EnumFacing.UP, renderState, translation, pipeline);
}
Also used : Vector3(codechicken.lib.vec.Vector3) ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier)

Example 8 with ColourMultiplier

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

the class StoneRenderer method renderBlock.

@Override
public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) {
    // otherwise, we are in solid rendering layer and render primary stone
    CCRenderState renderState = CCRenderState.instance();
    renderState.reset();
    renderState.bind(buffer);
    Matrix4 translation = new Matrix4();
    translation.translate(pos.getX(), pos.getY(), pos.getZ());
    TextureAtlasSprite stoneSprite = TextureUtils.getBlockTexture("stone");
    Material material = ((BlockSurfaceRock) state.getBlock()).getStoneMaterial(world, pos, state);
    int renderingColor = GTUtility.convertRGBtoOpaqueRGBA_CL(material.materialRGB);
    IVertexOperation[] operations = new IVertexOperation[] { new IconTransformation(stoneSprite), new ColourMultiplier(renderingColor), new TransformationList(translation) };
    if (world != null) {
        renderState.setBrightness(world, pos);
    }
    renderState.setPipeline(operations);
    CCModel actualModel = getActualModel(world, pos);
    renderState.setModel(actualModel);
    renderState.render();
    return true;
}
Also used : IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) BlockSurfaceRock(gregtech.common.blocks.surfacerock.BlockSurfaceRock) Material(gregtech.api.unification.material.type.Material) CCRenderState(codechicken.lib.render.CCRenderState) TransformationList(codechicken.lib.vec.TransformationList) Matrix4(codechicken.lib.vec.Matrix4) CCModel(codechicken.lib.render.CCModel) IconTransformation(codechicken.lib.vec.uv.IconTransformation) ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier)

Example 9 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, Matrix4 translation, IVertexOperation[] pipeline) {
    IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())));
    getBaseRenderer().render(renderState, translation, colouredPipeline);
}
Also used : IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier)

Example 10 with ColourMultiplier

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

the class MetaTileEntity method renderMetaTileEntity.

/**
 * Renders this meta tile entity
 * Note that you shouldn't refer to world-related information in this method, because it
 * will be called on ItemStacks too
 *
 * @param renderState render state (either chunk batched or item)
 * @param pipeline    default set of pipeline transformations
 */
@SideOnly(Side.CLIENT)
public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {
    TextureAtlasSprite atlasSprite = TextureUtils.getMissingSprite();
    IVertexOperation[] renderPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())));
    for (EnumFacing face : EnumFacing.VALUES) {
        Textures.renderFace(renderState, translation, renderPipeline, face, Cuboid6.full, atlasSprite);
    }
}
Also used : IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

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