use of codechicken.lib.render.pipeline.ColourMultiplier in project GregTech by GregTechCE.
the class WorldSceneRenderer method render.
/**
* Renders scene on given coordinates with given width and height, and RGB background color
* Note that this will ignore any transformations applied currently to projection/view matrix,
* so specified coordinates are scaled MC gui coordinates.
* It will return matrices of projection and view in previous state after rendering
*/
public void render(int x, int y, int width, int height, int backgroundColor) {
Vec2f mousePosition = setupCamera(x, y, width, height, backgroundColor);
if (renderCallback != null) {
renderCallback.preRenderScene(this);
}
Minecraft minecraft = Minecraft.getMinecraft();
minecraft.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
BlockRendererDispatcher dispatcher = minecraft.getBlockRendererDispatcher();
BlockRenderLayer oldRenderLayer = MinecraftForgeClient.getRenderLayer();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
for (BlockPos pos : renderedBlocks) {
if (renderFilter != null && !renderFilter.test(pos))
// do not render if position is skipped
continue;
IBlockState blockState = world.getBlockState(pos);
for (BlockRenderLayer renderLayer : BlockRenderLayer.values()) {
if (!blockState.getBlock().canRenderInLayer(blockState, renderLayer))
continue;
ForgeHooksClient.setRenderLayer(renderLayer);
dispatcher.renderBlock(blockState, pos, world, bufferBuilder);
}
}
tessellator.draw();
ForgeHooksClient.setRenderLayer(oldRenderLayer);
if (mousePosition != null) {
this.lastHitBlock = handleMouseHit(mousePosition);
} else {
this.lastHitBlock = null;
}
if (lastHitBlock != null) {
GlStateManager.disableTexture2D();
CCRenderState renderState = CCRenderState.instance();
renderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR, tessellator.getBuffer());
ColourMultiplier multiplier = new ColourMultiplier(0);
renderState.setPipeline(new Translation(lastHitBlock), multiplier);
BlockFace blockFace = new BlockFace();
renderState.setModel(blockFace);
for (EnumFacing renderSide : EnumFacing.VALUES) {
float diffuse = LightUtil.diffuseLight(renderSide);
int color = (int) (255 * diffuse);
multiplier.colour = RenderUtil.packColor(color, color, color, 100);
blockFace.loadCuboidFace(Cuboid6.full, renderSide.getIndex());
renderState.render();
}
renderState.draw();
GlStateManager.enableTexture2D();
}
resetCamera();
}
use of codechicken.lib.render.pipeline.ColourMultiplier in project GregTech by GregTechCE.
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, pipeline, side, Cuboid6.full, baseRingSprite);
renderState.brightness = 0xF000F0;
renderState.colour = 0xFFFFFFFF;
Textures.renderFace(renderState, cornerOffset, new IVertexOperation[0], side, Cuboid6.full, baseBackgroundSprite);
}
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);
}
}
use of codechicken.lib.render.pipeline.ColourMultiplier in project GregTech by GregTechCE.
the class SteamBoiler 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);
renderer.render(renderState, translation, pipeline, getFrontFacing(), isBurning());
}
use of codechicken.lib.render.pipeline.ColourMultiplier in project GregTech by GregTechCE.
the class MetaTileEntityMagicEnergyAbsorber method renderMetaTileEntity.
@Override
@SideOnly(Side.CLIENT)
public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {
IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(getPaintingColorForRendering())));
getRenderer().render(renderState, translation, colouredPipeline);
}
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, IVertexOperation[] pipeline) {
TextureAtlasSprite atlasSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/stone");
IVertexOperation[] renderPipeline = ArrayUtils.add(pipeline, new ColourMultiplier(paintingColor));
for (EnumFacing face : EnumFacing.VALUES) {
renderFace(renderState, face, Cuboid6.full, atlasSprite, renderPipeline);
}
}
Aggregations