From d1a6b043c2e578d9921770f14fee236b6b473af9 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Sat, 23 Nov 2024 08:15:28 +0000 Subject: [PATCH] Clean up monitor cursor rendering - Use the correct index count for the cursor quad. Monitors are now rendered as quads, rather than triangles. - *Skip* rendering the cursor vertex, rather than additionally rendering it. I confess, I'm baffled how this code was ever written. From what I can tell, this has been broken since it was first introduced in 4228011b848e99de64eb79c26598d81490c32bad, and I'm sure I tested it then. Fixes #2013. Probably. --- .../client/render/monitor/MonitorBlockEntityRenderer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorBlockEntityRenderer.java b/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorBlockEntityRenderer.java index 8e58d42b2..43ca16ac7 100644 --- a/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorBlockEntityRenderer.java +++ b/projects/common/src/client/java/dan200/computercraft/client/render/monitor/MonitorBlockEntityRenderer.java @@ -176,7 +176,7 @@ private static void renderTerminal( var size = DirectFixedWidthFontRenderer.getVertexCount(terminal); // In an ideal world we could upload these both into one buffer. However, we can't render VBOs with - // and starting and ending offset, and so need to use two buffers instead. + // a starting and ending offset, and so need to use two buffers instead. renderToBuffer(backgroundBuffer, size, sink -> DirectFixedWidthFontRenderer.drawTerminalBackground(sink, 0, 0, terminal, yMargin, yMargin, xMargin, xMargin)); @@ -208,10 +208,10 @@ private static void renderTerminal( foregroundBuffer.bind(); foregroundBuffer.drawWithShader( matrix, RenderSystem.getProjectionMatrix(), RenderTypes.getTerminalShader(), - // As mentioned in the above comment, render the extra cursor quad if it is visible this frame. Each - // // quad has an index count of 6. + // Skip the cursor quad if it is not visible this frame. FixedWidthFontRenderer.isCursorVisible(terminal) && FrameInfo.getGlobalCursorBlink() - ? foregroundBuffer.getIndexCount() + 6 : foregroundBuffer.getIndexCount() + ? foregroundBuffer.getIndexCount() + : foregroundBuffer.getIndexCount() - RenderTypes.TERMINAL.mode().indexCount(4) ); // Clear state