use of com.glisco.isometricrenders.mixin.MinecraftClientAccessor in project isometric-renders by gliscowo.
the class IsometricRenderHelper method renderIntoImage.
public static NativeImage renderIntoImage(int size, RenderCallback renderCallback) {
Framebuffer framebuffer = new Framebuffer(size, size, true, MinecraftClient.IS_SYSTEM_MAC);
RenderSystem.pushMatrix();
RenderSystem.enableBlend();
RenderSystem.clear(16640, MinecraftClient.IS_SYSTEM_MAC);
framebuffer.setClearColor(0, 0, 0, 0);
framebuffer.clear(MinecraftClient.IS_SYSTEM_MAC);
framebuffer.beginWrite(true);
RenderSystem.matrixMode(GL11.GL_PROJECTION);
RenderSystem.pushMatrix();
RenderSystem.loadIdentity();
RenderSystem.ortho(-1, 1, 1, -1, -100.0, 100.0);
RenderSystem.matrixMode(GL11.GL_MODELVIEW);
RenderSystem.pushMatrix();
RenderSystem.loadIdentity();
setupLighting();
VertexConsumerProvider.Immediate vertexConsumers = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
MatrixStack matrixStack = new MatrixStack();
renderCallback.render(matrixStack, vertexConsumers, ((MinecraftClientAccessor) MinecraftClient.getInstance()).getRenderTickCounter().tickDelta);
vertexConsumers.draw();
RenderSystem.popMatrix();
RenderSystem.matrixMode(GL11.GL_PROJECTION);
RenderSystem.popMatrix();
RenderSystem.matrixMode(GL11.GL_MODELVIEW);
RenderSystem.popMatrix();
framebuffer.endWrite();
return takeKeyedSnapshot(framebuffer, RuntimeConfig.backgroundColor, false, false);
}
Aggregations