From fc57d0a7e5cce19e6b7390e34af69b1681f4f6c8 Mon Sep 17 00:00:00 2001 From: Toad-Dev <748280+toad-dev@users.noreply.github.com> Date: Thu, 20 Jan 2022 15:36:46 -0800 Subject: [PATCH] Fix z-fighting on bold printout borders. - Changed page background to render as one quad, instead of two halves. - Set page background to a z-offset that is between zeroth (potentially bold border) and subsequent background pages. Bold borders were at the same z-offset before. --- .../computercraft/client/render/PrintoutRenderer.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/dan200/computercraft/client/render/PrintoutRenderer.java b/src/main/java/dan200/computercraft/client/render/PrintoutRenderer.java index 9912cc630..58bef2984 100644 --- a/src/main/java/dan200/computercraft/client/render/PrintoutRenderer.java +++ b/src/main/java/dan200/computercraft/client/render/PrintoutRenderer.java @@ -116,8 +116,12 @@ public final class PrintoutRenderer } } - // Left half - drawTexture( transform, buffer, x, y, z, X_FOLD_SIZE * 2, 0, X_SIZE / 2.0f, Y_SIZE, light ); + // Current page background + // z-offset is interleaved between the "zeroth" left/right page and the first left/right page, so that the + // "bold" border can be drawn over the edge where appropriate. + drawTexture( transform, buffer, x, y, z - 1e-3f * 0.5f, X_FOLD_SIZE * 2, 0, X_SIZE, Y_SIZE, light ); + + // Left pages for( int n = 0; n <= leftPages; n++ ) { drawTexture( transform, buffer, @@ -128,8 +132,7 @@ public final class PrintoutRenderer ); } - // Right half - drawTexture( transform, buffer, x + X_SIZE / 2.0f, y, z, X_FOLD_SIZE * 2 + X_SIZE / 2.0f, 0, X_SIZE / 2.0f, Y_SIZE, light ); + // Right pages for( int n = 0; n <= rightPages; n++ ) { drawTexture( transform, buffer,