mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-28 00:12:16 +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,
|
||||||
false ) ) // blur, minimap
|
false ) ) // blur, minimap
|
||||||
.alpha( ONE_TENTH_ALPHA )
|
.alpha( ONE_TENTH_ALPHA )
|
||||||
.writeMaskState( DEPTH_MASK )
|
.writeMaskState( ALL_MASK )
|
||||||
.lightmap( DISABLE_LIGHTMAP )
|
.lightmap( DISABLE_LIGHTMAP )
|
||||||
.build( false ) );
|
.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_NORMAL, RenderLayer.getTranslucent() );
|
||||||
BlockRenderLayerMap.INSTANCE.putBlock( ComputerCraftRegistry.ModBlocks.TURTLE_ADVANCED, 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
|
// Setup TESRs
|
||||||
BlockEntityRendererRegistry.INSTANCE.register( ComputerCraftRegistry.ModTiles.MONITOR_NORMAL, TileEntityMonitorRenderer::new );
|
BlockEntityRendererRegistry.INSTANCE.register( ComputerCraftRegistry.ModTiles.MONITOR_NORMAL, TileEntityMonitorRenderer::new );
|
||||||
BlockEntityRendererRegistry.INSTANCE.register( ComputerCraftRegistry.ModTiles.MONITOR_ADVANCED, 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.multiply( Vector3f.POSITIVE_X.getDegreesQuaternion( pitch ) );
|
||||||
transform.translate( -0.5 + TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN,
|
transform.translate( -0.5 + TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN,
|
||||||
origin.getHeight() - 0.5 - (TileMonitor.RENDER_BORDER + TileMonitor.RENDER_MARGIN) + 0,
|
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 xSize = origin.getWidth() - 2.0 * (TileMonitor.RENDER_MARGIN + TileMonitor.RENDER_BORDER);
|
||||||
double ySize = origin.getHeight() - 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
|
// Draw the contents
|
||||||
Terminal terminal = originTerminal.getTerminal();
|
Terminal terminal = originTerminal.getTerminal();
|
||||||
if( terminal != null )
|
if( terminal != null )
|
||||||
@ -123,6 +134,8 @@ public class TileEntityMonitorRenderer extends BlockEntityRenderer<TileMonitor>
|
|||||||
// reasonable.
|
// reasonable.
|
||||||
FixedWidthFontRenderer.drawCursor( matrix, buffer, 0, 0, terminal, !originTerminal.isColour() );
|
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();
|
FixedWidthFontRenderer.TYPE.endDrawing();
|
||||||
|
|
||||||
transform.pop();
|
transform.pop();
|
||||||
@ -138,13 +151,6 @@ public class TileEntityMonitorRenderer extends BlockEntityRenderer<TileMonitor>
|
|||||||
(float) -(ySize + MARGIN * 2) );
|
(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();
|
transform.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user