mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-27 16:02:17 +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:
parent
fb128152a5
commit
06b0538b76
@ -409,7 +409,7 @@ public final class FixedWidthFontRenderer
|
||||
false,
|
||||
false ) ) // blur, minimap
|
||||
.alpha( ONE_TENTH_ALPHA )
|
||||
.writeMaskState( DEPTH_MASK )
|
||||
.writeMaskState( ALL_MASK )
|
||||
.lightmap( DISABLE_LIGHTMAP )
|
||||
.build( false ) );
|
||||
|
||||
|
@ -77,6 +77,10 @@ public final class ComputerCraftProxyClient implements ClientModInitializer
|
||||
BlockRenderLayerMap.INSTANCE.putBlock( ComputerCraftRegistry.ModBlocks.TURTLE_NORMAL, RenderLayer.getTranslucent() );
|
||||
BlockRenderLayerMap.INSTANCE.putBlock( ComputerCraftRegistry.ModBlocks.TURTLE_ADVANCED, RenderLayer.getTranslucent() );
|
||||
|
||||
// Monitors' textures have transparent fronts and so count as cutouts.
|
||||
BlockRenderLayerMap.INSTANCE.putBlock( ComputerCraftRegistry.ModBlocks.MONITOR_NORMAL, RenderLayer.getCutout() );
|
||||
BlockRenderLayerMap.INSTANCE.putBlock( ComputerCraftRegistry.ModBlocks.MONITOR_ADVANCED, RenderLayer.getCutout() );
|
||||
|
||||
// Setup TESRs
|
||||
BlockEntityRendererRegistry.INSTANCE.register( ComputerCraftRegistry.ModTiles.MONITOR_NORMAL, TileEntityMonitorRenderer::new );
|
||||
BlockEntityRendererRegistry.INSTANCE.register( ComputerCraftRegistry.ModTiles.MONITOR_ADVANCED, TileEntityMonitorRenderer::new );
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user