use of gregtech.api.metatileentity.IFastRenderMetaTileEntity in project GregTech by GregTechCE.
the class MetaTileEntityTESR method renderCoverFast.
/**
* Used Specifically to render covers that are IFastRenderMetaTileEntity
* Adapted from renderTileEntityFastPart
* *
*/
private void renderCoverFast(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, int destroyStage, float alpha, List<Tuple<IFastRenderMetaTileEntity, EnumFacing>> coverList) {
Matrix4 translation = (new Matrix4()).translate(x, y, z);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
RenderHelper.disableStandardItemLighting();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.enableBlend();
if (Minecraft.isAmbientOcclusionEnabled()) {
GlStateManager.shadeModel(GL11.GL_SMOOTH);
} else {
GlStateManager.shadeModel(GL11.GL_FLAT);
}
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
for (Tuple<IFastRenderMetaTileEntity, EnumFacing> tuple : coverList) {
CCRenderState renderState = CCRenderState.instance();
renderState.reset();
renderState.bind(buffer);
renderState.setBrightness(te.getWorld(), te.getPos().offset(tuple.getSecond()));
tuple.getFirst().renderMetaTileEntityFast(renderState, translation, partialTicks);
}
buffer.setTranslation(0, 0, 0);
tessellator.draw();
RenderHelper.enableStandardItemLighting();
}
use of gregtech.api.metatileentity.IFastRenderMetaTileEntity in project GregTech by GregTechCE.
the class MetaTileEntityTESR method renderTileEntityFast.
@Override
public void renderTileEntityFast(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, int destroyStage, float partial, BufferBuilder buffer) {
MetaTileEntity metaTileEntity = te.getMetaTileEntity();
if (metaTileEntity instanceof IFastRenderMetaTileEntity) {
CCRenderState renderState = CCRenderState.instance();
renderState.reset();
renderState.bind(buffer);
renderState.setBrightness(te.getWorld(), te.getPos());
Matrix4 translation = new Matrix4().translate(x, y, z);
((IFastRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityFast(renderState, translation, partialTicks);
}
}
use of gregtech.api.metatileentity.IFastRenderMetaTileEntity in project GregTech by GregTechCE.
the class MetaTileEntityRenderer method renderItem.
@Override
public void renderItem(ItemStack rawStack, TransformType transformType) {
ItemStack stack = ModCompatibility.getRealItemStack(rawStack);
if (!(stack.getItem() instanceof MachineItemBlock)) {
return;
}
MetaTileEntity metaTileEntity = MachineItemBlock.getMetaTileEntity(stack);
if (metaTileEntity == null) {
return;
}
GlStateManager.enableBlend();
CCRenderState renderState = CCRenderState.instance();
renderState.reset();
renderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
metaTileEntity.setRenderContextStack(stack);
metaTileEntity.renderMetaTileEntity(renderState, new Matrix4(), new IVertexOperation[0]);
if (metaTileEntity instanceof IFastRenderMetaTileEntity) {
((IFastRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityFast(renderState, new Matrix4(), 0.0f);
}
metaTileEntity.setRenderContextStack(null);
renderState.draw();
if (metaTileEntity instanceof IRenderMetaTileEntity) {
((IRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityDynamic(0.0, 0.0, 0.0, 0.0f);
}
GlStateManager.disableBlend();
}
Aggregations