1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-16 18:19:55 +00:00

Use RenderSystem for setting polygon offsets

This commit is contained in:
Jonathan Coates 2022-12-15 21:24:38 +00:00
parent e7fe22d4f8
commit 36ce490566
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
3 changed files with 35 additions and 5 deletions

View File

@ -208,8 +208,8 @@ private static void renderTerminal(
backgroundBuffer.drawWithShader(matrix, RenderSystem.getProjectionMatrix(), RenderTypes.getTerminalShader());
// Render foreground geometry with glPolygonOffset enabled.
GL11.glPolygonOffset(-1.0f, -10.0f);
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
RenderSystem.polygonOffset(-1.0f, -10.0f);
RenderSystem.enablePolygonOffset();
foregroundBuffer.bind();
foregroundBuffer.drawWithShader(
@ -221,8 +221,8 @@ private static void renderTerminal(
);
// Clear state
GL11.glPolygonOffset(0.0f, -0.0f);
GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
RenderSystem.polygonOffset(0.0f, -0.0f);
RenderSystem.disablePolygonOffset();
RenderTypes.TERMINAL.clearRenderState();
VertexBuffer.unbind();

View File

@ -0,0 +1,29 @@
/*
* This file is part of ComputerCraft - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.mixin.gametest.client;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.worldselection.WorldOpenFlows;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@Mixin(WorldOpenFlows.class)
public class WorldOpenFlowsMixin {
/**
* Never prompt for backup/experimental options when running tests
*
* @param screen The current menu
* @param level The level to load.
* @param customised Whether this rule uses legacy customised worldgen options.
* @param action The action run to load the world.
* @author SquidDev
* @reason Makes it easier to run tests. We can switch to an @Inject if this becomes a problem.
*/
@Overwrite
private void askForBackup(Screen screen, String level, boolean customised, Runnable action) {
action.run();
}
}

View File

@ -15,6 +15,7 @@
"TestCommandAccessor"
],
"client": [
"client.MinecraftMixin"
"client.MinecraftMixin",
"client.WorldOpenFlowsMixin"
]
}