mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-27 03:47:38 +00:00
Reverted change to blocker layer, with tweaks.
Without the blocker layer even VBOs didn't work with shaders. So instead I put the blocker back and made it mask both color and depth buffers, which fixes the bug with chests and water drawing over monitors. Since it now masks color I hoisted it up to be drawn before the terminal, and made the terminal slightly offset to solve z-fighting with VBO renderer.
This commit is contained in:
@@ -93,10 +93,21 @@ public class TileEntityMonitorRenderer extends BlockEntityRenderer<TileMonitor>
|
||||
transform.multiply( Vector3f.POSITIVE_X.getDegreesQuaternion( pitch ) );
|
||||
transform.translate( -0.5 + TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN,
|
||||
origin.getHeight() - 0.5 - (TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN) + 0,
|
||||
0.501 );
|
||||
0.50 );
|
||||
double xSize = origin.getWidth() - 2.0 * (TileMonitor.RENDER_MARGIN + TileMonitor.RENDER_BORDER);
|
||||
double ySize = origin.getHeight() - 2.0 * (TileMonitor.RENDER_MARGIN + TileMonitor.RENDER_BORDER);
|
||||
|
||||
// Draw the background blocker
|
||||
FixedWidthFontRenderer.drawBlocker( transform.peek().getModel(),
|
||||
renderer,
|
||||
(float) -TileMonitor.RENDER_MARGIN,
|
||||
(float) TileMonitor.RENDER_MARGIN,
|
||||
(float) (xSize + 2 * TileMonitor.RENDER_MARGIN),
|
||||
(float) -(ySize + TileMonitor.RENDER_MARGIN * 2) );
|
||||
|
||||
// Set the contents slightly off the surface to prevent z-fighting
|
||||
transform.translate( 0.0, 0.0, 0.001 );
|
||||
|
||||
// Draw the contents
|
||||
Terminal terminal = originTerminal.getTerminal();
|
||||
if( terminal != null )
|
||||
@@ -123,6 +134,8 @@ public class TileEntityMonitorRenderer extends BlockEntityRenderer<TileMonitor>
|
||||
// reasonable.
|
||||
FixedWidthFontRenderer.drawCursor( matrix, buffer, 0, 0, terminal, !originTerminal.isColour() );
|
||||
|
||||
// To go along with sneaky hack above: make sure state changes are undone. I would have thought this would
|
||||
// happen automatically after these buffers are drawn, but chests will render weird around monitors without this.
|
||||
FixedWidthFontRenderer.TYPE.endDrawing();
|
||||
|
||||
transform.pop();
|
||||
@@ -138,13 +151,6 @@ public class TileEntityMonitorRenderer extends BlockEntityRenderer<TileMonitor>
|
||||
(float) -(ySize + MARGIN * 2) );
|
||||
}
|
||||
|
||||
// FixedWidthFontRenderer.drawBlocker( transform.peek().getModel(),
|
||||
// renderer,
|
||||
// (float) -TileMonitor.RENDER_MARGIN,
|
||||
// (float) TileMonitor.RENDER_MARGIN,
|
||||
// (float) (xSize + 2 * TileMonitor.RENDER_MARGIN),
|
||||
// (float) -(ySize + TileMonitor.RENDER_MARGIN * 2) );
|
||||
|
||||
transform.pop();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user