use of codechicken.lib.render.pipeline.IVertexOperation 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);
}
use of codechicken.lib.render.pipeline.IVertexOperation in project LogisticsPipes by RS485.
the class Model3D method render.
@Override
public void render(I3DOperation... i3dOperations) {
List<IVertexOperation> list = new ArrayList<>();
for (I3DOperation op : i3dOperations) {
list.add((IVertexOperation) op.getOriginal());
}
model.render(CCRenderState.instance(), list.toArray(new IVertexOperation[0]));
}
use of codechicken.lib.render.pipeline.IVertexOperation 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);
}
}
}
}
use of codechicken.lib.render.pipeline.IVertexOperation 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);
}
use of codechicken.lib.render.pipeline.IVertexOperation in project GregTech by GregTechCE.
the class CableRenderer method renderBlock.
@Override
public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) {
CCRenderState renderState = CCRenderState.instance();
renderState.reset();
renderState.bind(buffer);
renderState.setBrightness(world, pos);
IVertexOperation[] pipeline = { new Translation(pos) };
BlockCable blockCable = (BlockCable) state.getBlock();
TileEntityCable tileEntityCable = (TileEntityCable) blockCable.getPipeTileEntity(world, pos);
if (tileEntityCable == null)
return false;
int paintingColor = tileEntityCable.getInsulationColor();
int connectedSidesMask = blockCable.getActualConnections(tileEntityCable, world);
Insulation insulation = tileEntityCable.getPipeType();
Material material = tileEntityCable.getPipeMaterial();
if (insulation != null && material != null) {
BlockRenderLayer renderLayer = MinecraftForgeClient.getRenderLayer();
if (renderLayer == BlockRenderLayer.CUTOUT) {
renderCableBlock(material, insulation, paintingColor, renderState, pipeline, connectedSidesMask);
}
ICoverable coverable = tileEntityCable.getCoverableImplementation();
coverable.renderCovers(renderState, new Matrix4().translate(pos.getX(), pos.getY(), pos.getZ()), renderLayer);
}
return true;
}
Aggregations