Skip to content

Commit

Permalink
Clean up monitor cursor rendering
Browse files Browse the repository at this point in the history
 - 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
4228011, and I'm sure I tested it then.

Fixes #2013. Probably.
  • Loading branch information
SquidDev committed Nov 23, 2024
1 parent cddb8fe commit d1a6b04
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d1a6b04

Please sign in to comment.